Compare View
Commits (2)
Showing
71 changed files
Show diff stats
.DS_Store
No preview for this file type
PersonalCenter/.idea/misc.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <project version="4"> | 2 | <project version="4"> |
3 | <component name="EntryPointsManager"> | ||
4 | <entry_points version="2.0" /> | ||
5 | </component> | ||
3 | <component name="EntryPointsManager"> | 6 | <component name="NullableNotNullManager"> |
4 | <entry_points version="2.0" /> | 7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> |
5 | </component> | 8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> |
6 | <component name="NullableNotNullManager"> | 9 | <option name="myNullables"> |
7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> | 10 | <value> |
8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> | 11 | <list size="4"> |
9 | <option name="myNullables"> | 12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> |
10 | <value> | 13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> |
11 | <list size="4"> | 14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> |
12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | 15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> |
13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | 16 | </list> |
14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | 17 | </value> |
15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | 18 | </option> |
16 | </list> | 19 | <option name="myNotNulls"> |
17 | </value> | 20 | <value> |
18 | </option> | 21 | <list size="4"> |
19 | <option name="myNotNulls"> | 22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> |
20 | <value> | 23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> |
21 | <list size="4"> | 24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> |
22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | 25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> |
23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | 26 | </list> |
24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | 27 | </value> |
25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | 28 | </option> |
26 | </list> | 29 | </component> |
27 | </value> | 30 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
28 | </option> | 31 | <output url="file://$PROJECT_DIR$/build/classes" /> |
29 | </component> | 32 | </component> |
30 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 33 | <component name="ProjectType"> |
31 | <output url="file://$PROJECT_DIR$/build/classes" /> | 34 | <option name="id" value="Android" /> |
32 | </component> | 35 | </component> |
33 | <component name="ProjectType"> | 36 | </project> |
PersonalCenter/app/PresonalCenter.apk
No preview for this file type
PersonalCenter/app/build.gradle
1 | apply plugin: 'com.android.application' | 1 | apply plugin: 'com.android.application' |
2 | 2 | ||
3 | android { | 3 | android { |
4 | compileSdkVersion 25 | 4 | compileSdkVersion 25 |
5 | buildToolsVersion "25.0.3" | 5 | buildToolsVersion "25.0.3" |
6 | defaultConfig { | 6 | defaultConfig { |
7 | applicationId "com.hjx.personalcenter" | 7 | applicationId "com.hjx.personalcenter" |
8 | minSdkVersion 15 | 8 | minSdkVersion 15 |
9 | targetSdkVersion 25 | 9 | targetSdkVersion 23 |
10 | versionCode 6 | 10 | versionCode 17 |
11 | versionName "1.1.0" | 11 | versionName "1.2.8" |
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" |
13 | } | 13 | } |
14 | buildTypes { | 14 | buildTypes { |
15 | release { | 15 | release { |
16 | minifyEnabled false | 16 | minifyEnabled false |
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
18 | } | 18 | } |
19 | } | 19 | } |
20 | useLibrary 'org.apache.http.legacy' | 20 | useLibrary 'org.apache.http.legacy' |
21 | lintOptions{ | 21 | lintOptions{ |
22 | checkReleaseBuilds false | 22 | checkReleaseBuilds false |
23 | abortOnError false | 23 | abortOnError false |
24 | } | 24 | } |
25 | sourceSets { | 25 | sourceSets { |
26 | main { | 26 | main { |
27 | jniLibs.srcDirs = ['libs'] | 27 | jniLibs.srcDirs = ['libs'] |
28 | } | 28 | } |
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
32 | dependencies { | 32 | dependencies { |
33 | compile fileTree(include: ['*.jar'], dir: 'libs') | 33 | compile fileTree(include: ['*.jar'], dir: 'libs') |
34 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | 34 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { |
35 | exclude group: 'com.android.support', module: 'support-annotations' | 35 | exclude group: 'com.android.support', module: 'support-annotations' |
36 | }) | 36 | }) |
37 | compile 'com.tencent.bugly:crashreport:latest.release' | 37 | compile 'com.tencent.bugly:crashreport:latest.release' |
38 | compile 'org.apache.httpcomponents:httpcore:4.4.1' | 38 | compile 'org.apache.httpcomponents:httpcore:4.4.1' |
39 | compile 'org.apache.httpcomponents:httpclient:4.5' | 39 | compile 'org.apache.httpcomponents:httpclient:4.5' |
40 | compile 'com.android.support:appcompat-v7:25.3.1' | 40 | compile 'com.android.support:appcompat-v7:25.3.1' |
41 | testCompile 'junit:junit:4.12' | 41 | testCompile 'junit:junit:4.12' |
42 | compile project(':circledialog') | 42 | compile project(':circledialog') |
43 | compile project(':pickerview') | 43 | compile project(':pickerview') |
44 | compile files('libs/android-async-http-1.4.8.jar') | 44 | compile files('libs/android-async-http-1.4.8.jar') |
45 | compile 'com.google.code.gson:gson:2.7' | 45 | compile 'com.google.code.gson:gson:2.7' |
46 | compile 'com.zaaach:toprightmenu:1.0' | 46 | compile 'com.zaaach:toprightmenu:1.0' |
47 | compile 'com.android.support:recyclerview-v7:25.3.1' | 47 | compile 'com.android.support:recyclerview-v7:25.3.1' |
48 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' | 48 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' |
49 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' | 49 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' |
50 | compile 'com.google.zxing:core:3.3.0' | 50 | compile 'com.google.zxing:core:3.3.0' |
51 | compile 'com.google.zxing:android-core:3.3.0' | 51 | compile 'com.google.zxing:android-core:3.3.0' |
52 | compile project(path: ':mypresonallibrary') | 52 | compile project(path: ':mypresonallibrary') |
53 | compile files('libs/picasso-2.5.2.jar') | 53 | compile files('libs/picasso-2.5.2.jar') |
54 | } | 54 | } |
55 | 55 |
PersonalCenter/app/src/main/AndroidManifest.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | package="com.hjx.personalcenter" | 3 | package="com.hjx.personalcenter" |
4 | android:configChanges="keyboardHidden|orientation"> | 4 | android:configChanges="keyboardHidden|orientation"> |
5 | 5 | ||
6 | <application | 6 | <application |
7 | android:name=".activity.MyApplication" | 7 | android:name=".activity.MyApplication" |
8 | android:allowBackup="true" | 8 | android:allowBackup="true" |
9 | android:icon="@mipmap/grzx_icon" | 9 | android:icon="@mipmap/grzx_icon" |
10 | android:label="@string/app_name" | 10 | android:label="@string/app_name" |
11 | android:supportsRtl="true" | 11 | android:supportsRtl="true" |
12 | android:theme="@style/AppTheme"> | 12 | android:theme="@style/AppTheme"> |
13 | <provider | ||
14 | android:name="android.support.v4.content.FileProvider" | ||
15 | android:authorities="com.hjx.personalcenter.fileprovider" | ||
16 | android:exported="false" | ||
17 | android:grantUriPermissions="true"> | ||
18 | <meta-data | ||
19 | android:name="android.support.FILE_PROVIDER_PATHS" | ||
20 | android:resource="@xml/rc_file_path" /> | ||
21 | </provider> | ||
13 | <activity | 22 | <activity |
14 | android:name=".activity.MainActivity" | 23 | android:name=".activity.MainActivity" |
15 | android:launchMode="standard" | 24 | android:launchMode="standard" |
16 | android:screenOrientation="sensorLandscape"> | 25 | android:screenOrientation="sensorLandscape"> |
17 | </activity> | 26 | </activity> |
18 | <activity | 27 | <activity |
19 | android:name=".activity.LoginAndRegisterActivity" | 28 | android:name=".activity.LoginAndRegisterActivity" |
20 | android:launchMode="standard" | 29 | android:launchMode="standard" |
21 | android:screenOrientation="sensorLandscape"> | 30 | android:screenOrientation="sensorLandscape"> |
22 | <intent-filter> | 31 | <intent-filter> |
23 | <action android:name="android.intent.action.MAIN" /> | 32 | <action android:name="android.intent.action.MAIN" /> |
24 | 33 | ||
25 | <category android:name="android.intent.category.LAUNCHER" /> | 34 | <category android:name="android.intent.category.LAUNCHER" /> |
26 | </intent-filter> | 35 | </intent-filter> |
27 | 36 | ||
28 | </activity> | 37 | </activity> |
29 | <activity | 38 | <activity |
30 | android:name=".activity.ForgotPasswordActivity" | 39 | android:name=".activity.ForgotPasswordActivity" |
31 | android:launchMode="singleTask" | 40 | android:launchMode="singleTask" |
32 | android:screenOrientation="sensorLandscape"> | 41 | android:screenOrientation="sensorLandscape"> |
33 | 42 | ||
34 | </activity> | 43 | </activity> |
35 | <activity | 44 | <activity |
36 | android:name=".activity.ChangePasswordActivity" | 45 | android:name=".activity.ChangePasswordActivity" |
37 | android:launchMode="singleTask" | 46 | android:launchMode="singleTask" |
38 | android:screenOrientation="sensorLandscape"> | 47 | android:screenOrientation="sensorLandscape"> |
39 | 48 | ||
40 | </activity> | 49 | </activity> |
41 | <activity | 50 | <activity |
42 | android:name=".activity.RegisterInfoActivity" | 51 | android:name=".activity.RegisterInfoActivity" |
43 | android:launchMode="singleTask" | 52 | android:launchMode="singleTask" |
44 | android:screenOrientation="sensorLandscape"> | 53 | android:screenOrientation="sensorLandscape"> |
45 | 54 | ||
46 | </activity> | 55 | </activity> |
47 | <activity | 56 | <activity |
48 | android:name=".activity.ElectronicCardValidationActivity" | 57 | android:name=".activity.ElectronicCardValidationActivity" |
49 | android:launchMode="singleTask" | 58 | android:launchMode="singleTask" |
59 | android:windowSoftInputMode="adjustUnspecified|stateHidden" | ||
50 | android:screenOrientation="sensorLandscape"> | 60 | android:screenOrientation="sensorLandscape"> |
51 | 61 | ||
52 | </activity> | 62 | </activity> |
53 | <activity | 63 | <activity |
54 | android:name=".activity.ChangeBangDingActivity" | 64 | android:name=".activity.ChangeBangDingActivity" |
55 | android:launchMode="singleTask" | 65 | android:launchMode="singleTask" |
56 | android:screenOrientation="sensorLandscape"> | 66 | android:screenOrientation="sensorLandscape"> |
57 | 67 | ||
58 | </activity> | 68 | </activity> |
59 | <activity | 69 | <activity |
60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" | 70 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" |
61 | android:launchMode="singleTask" | 71 | android:launchMode="singleTask" |
62 | android:screenOrientation="sensorLandscape"> | 72 | android:screenOrientation="sensorLandscape"> |
63 | 73 | ||
64 | </activity> | 74 | </activity> |
65 | <activity | 75 | <activity |
66 | android:name=".activity.ChangeEletronicCardPhoneActivity" | 76 | android:name=".activity.ChangeEletronicCardPhoneActivity" |
67 | android:launchMode="singleTask" | 77 | android:launchMode="singleTask" |
68 | android:screenOrientation="sensorLandscape"> | 78 | android:screenOrientation="sensorLandscape"> |
69 | 79 | ||
70 | </activity> | 80 | </activity> |
71 | <activity | 81 | <activity |
72 | android:name=".activity.ChoiseTextBookActivity" | 82 | android:name=".activity.ChoiseTextBookActivity" |
73 | android:launchMode="singleTask" | 83 | android:launchMode="singleTask" |
74 | android:screenOrientation="sensorLandscape"> | 84 | android:screenOrientation="sensorLandscape"> |
75 | 85 | ||
76 | </activity> | 86 | </activity> |
77 | <activity | 87 | <activity |
78 | android:name=".activity.TheStartPageActivity" | 88 | android:name=".activity.TheStartPageActivity" |
79 | android:launchMode="singleTask" | 89 | android:launchMode="singleTask" |
80 | android:screenOrientation="sensorLandscape"> | 90 | android:screenOrientation="sensorLandscape"> |
81 | 91 | ||
82 | </activity> | 92 | </activity> |
83 | <activity | 93 | <activity |
84 | android:name=".activity.ElectronicCardEditInfoActivity" | 94 | android:name=".activity.ElectronicCardEditInfoActivity" |
85 | android:launchMode="singleTask" | 95 | android:launchMode="singleTask" |
86 | android:screenOrientation="sensorLandscape" | 96 | android:screenOrientation="sensorLandscape" |
87 | android:windowSoftInputMode="adjustPan"> | 97 | android:windowSoftInputMode="adjustPan"> |
88 | 98 | ||
89 | </activity> | 99 | </activity> |
90 | <activity | 100 | <activity |
91 | android:name=".activity.ElectronicCardInfoOKActivity" | 101 | android:name=".activity.ElectronicCardInfoOKActivity" |
92 | android:launchMode="singleTask" | 102 | android:launchMode="singleTask" |
93 | android:screenOrientation="sensorLandscape"> | 103 | android:screenOrientation="sensorLandscape"> |
94 | 104 | ||
95 | </activity> | 105 | </activity> |
96 | <activity | 106 | <activity |
97 | android:name=".activity.ElectronicCardLookInfoActivity" | 107 | android:name=".activity.ElectronicCardLookInfoActivity" |
98 | android:launchMode="singleTask" | 108 | android:launchMode="singleTask" |
99 | android:screenOrientation="sensorLandscape" | 109 | android:screenOrientation="sensorLandscape" |
100 | > | 110 | > |
101 | 111 | ||
102 | </activity> | 112 | </activity> |
103 | <activity | 113 | <activity |
104 | android:name=".activity.FeedBackActivity" | 114 | android:name=".activity.FeedBackActivity" |
105 | android:launchMode="singleTask" | 115 | android:launchMode="singleTask" |
106 | android:screenOrientation="sensorLandscape"> | 116 | android:screenOrientation="sensorLandscape"> |
107 | 117 | ||
108 | </activity> | 118 | </activity> |
109 | <activity | 119 | <activity |
110 | android:name=".activity.AccountManagementActivity" | 120 | android:name=".activity.AccountManagementActivity" |
111 | android:launchMode="singleTask" | 121 | android:launchMode="singleTask" |
112 | android:screenOrientation="sensorLandscape"> | 122 | android:screenOrientation="sensorLandscape"> |
113 | 123 | ||
114 | </activity> | 124 | </activity> |
115 | <activity | 125 | <activity |
116 | android:name=".activity.ChangePresonalInfoActivity" | 126 | android:name=".activity.ChangePresonalInfoActivity" |
117 | android:launchMode="singleTask" | 127 | android:launchMode="singleTask" |
118 | android:screenOrientation="sensorLandscape" | 128 | android:screenOrientation="sensorLandscape" |
119 | android:windowSoftInputMode="adjustPan"> | 129 | android:windowSoftInputMode="adjustPan"> |
120 | 130 | ||
121 | </activity> | 131 | </activity> |
122 | <activity | 132 | <activity |
123 | android:name=".activity.BangDingCode" | 133 | android:name=".activity.BangDingCode" |
124 | android:launchMode="singleTask" | 134 | android:launchMode="singleTask" |
125 | android:screenOrientation="sensorLandscape"> | 135 | android:screenOrientation="sensorLandscape"> |
126 | 136 | ||
127 | </activity> | 137 | </activity> |
128 | <service android:name="com.hjx.personalcenter.service.CenterService" | 138 | <service android:name="com.hjx.personalcenter.service.CenterService" |
129 | android:enabled="true" | 139 | android:enabled="true" |
130 | android:exported="true"> | 140 | android:exported="true"> |
131 | <intent-filter> | 141 | <intent-filter> |
132 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> | 142 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> |
133 | </intent-filter> | 143 | </intent-filter> |
134 | </service> | 144 | </service> |
135 | <service | 145 | <service |
136 | android:name="com.hjx.personalcenter.update.DownloadService" | 146 | android:name="com.hjx.personalcenter.update.DownloadService" |
137 | android:enabled="true"/> | 147 | android:enabled="true"/> |
138 | <!--<receiver | 148 | <!--<receiver |
139 | android:name="com.hjx.personalcenter.service.StaticReceiver" | 149 | android:name="com.hjx.personalcenter.service.StaticReceiver" |
140 | android:exported="true"> | 150 | android:exported="true"> |
141 | <intent-filter > | 151 | <intent-filter > |
142 | <action android:name="com.ozing.launcher.SWITCH_GRADE"/> | 152 | <action android:name="com.ozing.launcher.SWITCH_GRADE"/> |
143 | </intent-filter> | 153 | </intent-filter> |
144 | 154 | ||
145 | </receiver>--> | 155 | </receiver>--> |
156 | |||
146 | </application> | 157 | </application> |
147 | <!--权限--> | 158 | <!--权限--> |
148 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 159 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
149 | <uses-permission android:name="android.permission.CAMERA" /> | 160 | <uses-permission android:name="android.permission.CAMERA" /> |
150 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 161 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
151 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | 162 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
152 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 163 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
153 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 164 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
154 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 165 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
155 | <uses-permission android:name="android.permission.CALL_PHONE" /> | 166 | <uses-permission android:name="android.permission.CALL_PHONE" /> |
156 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 167 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
157 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | 168 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> |
158 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 169 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
159 | <uses-permission android:name="android.permission.INTERNET" /> | 170 | <uses-permission android:name="android.permission.INTERNET" /> |
160 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 171 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
161 | <uses-permission android:name="android.permission.READ_LOGS" /> | 172 | <uses-permission android:name="android.permission.READ_LOGS" /> |
162 | <uses-permission android:name="android.permission.RESTART_PACKAGES\"/> | 173 | <uses-permission android:name="android.permission.RESTART_PACKAGES\"/> |
163 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | 174 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> |
164 | 175 | ||
165 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 176 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
166 | <uses-permission android:name="android.permission.INTERNET" /> | 177 | <uses-permission android:name="android.permission.INTERNET" /> |
167 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 178 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
168 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 179 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
169 | <uses-permission android:name="android.permission.READ_LOGS" /> | 180 | <uses-permission android:name="android.permission.READ_LOGS" /> |
170 | 181 | ||
171 | </manifest> | 182 | </manifest> |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/AccountManagementActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v4.app.FragmentActivity; | 7 | import android.support.v4.app.FragmentActivity; |
8 | import android.support.v7.widget.LinearLayoutManager; | 8 | import android.support.v7.widget.LinearLayoutManager; |
9 | import android.support.v7.widget.RecyclerView; | 9 | import android.support.v7.widget.RecyclerView; |
10 | import android.util.Log; | 10 | import android.util.Log; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
13 | import android.widget.LinearLayout; | 13 | import android.widget.LinearLayout; |
14 | import android.widget.TextView; | 14 | import android.widget.TextView; |
15 | 15 | ||
16 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; | 17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; |
18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
19 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.http.HttpCode; | 21 | import com.hjx.personalcenter.http.HttpCode; |
22 | import com.hjx.personalcenter.http.HttpManager; | 22 | import com.hjx.personalcenter.http.HttpManager; |
23 | import com.hjx.personalcenter.model.ChildsInfo; | 23 | import com.hjx.personalcenter.model.ChildsInfo; |
24 | import com.hjx.personalcenter.util.AlertUtils; | 24 | import com.hjx.personalcenter.util.AlertUtils; |
25 | import com.hjx.personalcenter.util.GetDevicesUtil; | 25 | import com.hjx.personalcenter.util.GetDevicesUtil; |
26 | import com.squareup.picasso.Picasso; | 26 | import com.squareup.picasso.Picasso; |
27 | 27 | ||
28 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
29 | import java.util.List; | 29 | import java.util.List; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * 账户管理 熊巍 | 32 | * 账户管理 熊巍 |
33 | * Created by h on 2017/8/12. | 33 | * Created by h on 2017/8/12. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | public class AccountManagementActivity extends FragmentActivity implements View.OnClickListener { | 36 | public class AccountManagementActivity extends FragmentActivity implements View.OnClickListener { |
37 | private TextView changbangding, changpassword, usernames, | 37 | private TextView changbangding, changpassword, usernames, |
38 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; | 38 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; |
39 | private ImageView iv_useing, cancel; | 39 | private ImageView iv_useing, cancel; |
40 | private ImageView mSimpleDraweeView; | 40 | private ImageView mSimpleDraweeView; |
41 | private RecyclerView listview; | 41 | private RecyclerView listview; |
42 | private LinearLayout add_accunt, ll_zhu_backgrangd; | 42 | private LinearLayout add_accunt, ll_zhu_backgrangd; |
43 | private AccountChildsAdapter childsAdapter; | 43 | private AccountChildsAdapter childsAdapter; |
44 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); | 44 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); |
45 | private String subAccountId = null; | 45 | private String subAccountId = null; |
46 | Handler handler = new Handler() { | 46 | Handler handler = new Handler() { |
47 | @Override | 47 | @Override |
48 | public void handleMessage(Message msg) { | 48 | public void handleMessage(Message msg) { |
49 | super.handleMessage(msg); | 49 | super.handleMessage(msg); |
50 | switch (msg.what) { | 50 | switch (msg.what) { |
51 | case HttpCode.CHILDS_SUCESS: | 51 | case HttpCode.CHILDS_SUCESS: |
52 | ChildsInfo childsInfo = new ChildsInfo(); | 52 | ChildsInfo childsInfo = new ChildsInfo(); |
53 | if (childsInfo.getStatus()==1000) { | 53 | if (childsInfo.getStatus()==1000) { |
54 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.USERNAME); | 54 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.NICKNAME); |
55 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.ADRESS); | 55 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.REGION); |
56 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); | 56 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); |
57 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); | 57 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); |
58 | tv_username.setText(names); | 58 | tv_username.setText(names); |
59 | tv_grade.setText(grades); | 59 | tv_grade.setText(grades); |
60 | tv_school.setText(schools); | 60 | tv_school.setText(schools); |
61 | tv_adress.setText(adress); | 61 | tv_adress.setText(adress); |
62 | tv_changzhu.setText("使用中"); | 62 | tv_changzhu.setText("使用中"); |
63 | tv_changzhu.setEnabled(false); | 63 | tv_changzhu.setEnabled(false); |
64 | iv_useing.setVisibility(View.VISIBLE); | 64 | iv_useing.setVisibility(View.VISIBLE); |
65 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 65 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
66 | //mSimpleDraweeView.setImageURI(phote); | 66 | //mSimpleDraweeView.setImageURI(phote); |
67 | 67 | ||
68 | } else { | 68 | } else { |
69 | String name = null; | 69 | String name = null; |
70 | String grade = null; | 70 | String grade = null; |
71 | String school = null; | 71 | String school = null; |
72 | String addr = null; | 72 | String addr = null; |
73 | String phote = null; | 73 | String phote = null; |
74 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); | 74 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); |
75 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; | 75 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; |
76 | for (int i = 0; i < list.size(); i++) { | 76 | for (int i = 0; i < list.size(); i++) { |
77 | int type = list.get(i).getType(); | 77 | int type = list.get(i).getType(); |
78 | if (type == 1) { | 78 | if (type == 1) { |
79 | name = list.get(i).getName(); | 79 | name = list.get(i).getName(); |
80 | grade = list.get(i).getGrade(); | 80 | grade = list.get(i).getGrade(); |
81 | school = list.get(i).getSchool(); | 81 | school = list.get(i).getSchool(); |
82 | addr = list.get(i).getRegion(); | 82 | addr = list.get(i).getRegion(); |
83 | phote = list.get(i).getImage(); | 83 | phote = list.get(i).getImage(); |
84 | subAccountId = list.get(i).getGradeId(); | 84 | subAccountId = list.get(i).getGradeId(); |
85 | } else if (type == 2) { | 85 | } else if (type == 2) { |
86 | childList.add(list.get(i)); | 86 | childList.add(list.get(i)); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | tv_username.setText(name); | 89 | tv_username.setText(name); |
90 | tv_grade.setText(grade); | 90 | tv_grade.setText(grade); |
91 | tv_school.setText(school); | 91 | tv_school.setText(school); |
92 | tv_adress.setText(addr); | 92 | tv_adress.setText(addr); |
93 | if (phote!=null&&!phote.isEmpty()) { | 93 | if (phote!=null&&!phote.isEmpty()) { |
94 | Picasso.with(AccountManagementActivity.this).load(phote).into(mSimpleDraweeView); | 94 | Picasso.with(AccountManagementActivity.this).load(phote).into(mSimpleDraweeView); |
95 | } | 95 | } |
96 | data.clear(); | 96 | data.clear(); |
97 | data.addAll(childList); | 97 | data.addAll(childList); |
98 | childsAdapter.notifyDataSetChanged(); | 98 | childsAdapter.notifyDataSetChanged(); |
99 | } | 99 | } |
100 | break; | 100 | break; |
101 | } | 101 | } |
102 | } | 102 | } |
103 | }; | 103 | }; |
104 | 104 | ||
105 | @Override | 105 | @Override |
106 | protected void onCreate(Bundle savedInstanceState) { | 106 | protected void onCreate(Bundle savedInstanceState) { |
107 | super.onCreate(savedInstanceState); | 107 | super.onCreate(savedInstanceState); |
108 | setContentView(R.layout.activity_account_management); | 108 | setContentView(R.layout.activity_account_management); |
109 | initView(); | 109 | initView(); |
110 | initData(); | 110 | initData(); |
111 | initLister(); | 111 | initLister(); |
112 | } | 112 | } |
113 | 113 | ||
114 | private void initView() { | 114 | private void initView() { |
115 | changbangding = (TextView) findViewById(R.id.changBangding); | 115 | changbangding = (TextView) findViewById(R.id.changBangding); |
116 | changpassword = (TextView) findViewById(R.id.changpassword); | 116 | changpassword = (TextView) findViewById(R.id.changpassword); |
117 | usernames = (TextView) findViewById(R.id.cunt_username); | 117 | usernames = (TextView) findViewById(R.id.cunt_username); |
118 | tv_username = (TextView) findViewById(R.id.tv_account_name); | 118 | tv_username = (TextView) findViewById(R.id.tv_account_name); |
119 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); | 119 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); |
120 | tv_school = (TextView) findViewById(R.id.tv_account_school); | 120 | tv_school = (TextView) findViewById(R.id.tv_account_school); |
121 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); | 121 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); |
122 | mSimpleDraweeView = (ImageView) findViewById(R.id.tv_account_head); | 122 | mSimpleDraweeView = (ImageView) findViewById(R.id.tv_account_head); |
123 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); | 123 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); |
124 | cancel = (ImageView) findViewById(R.id.cancel); | 124 | cancel = (ImageView) findViewById(R.id.cancel); |
125 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); | 125 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); |
126 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); | 126 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); |
127 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 127 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
128 | } | 128 | } |
129 | 129 | ||
130 | private void initData() { | 130 | private void initData() { |
131 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); | 131 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
132 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 132 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
133 | usernames.setText(cunt_username); | 133 | usernames.setText(cunt_username); |
134 | 134 | ||
135 | if (account.equals("1")) { | 135 | if (account.equals("1")) { |
136 | tv_changzhu.setText("使用中"); | 136 | tv_changzhu.setText("使用中"); |
137 | tv_changzhu.setEnabled(false); | 137 | tv_changzhu.setEnabled(false); |
138 | iv_useing.setVisibility(View.VISIBLE); | 138 | iv_useing.setVisibility(View.VISIBLE); |
139 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 139 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
140 | } else { | 140 | } else { |
141 | tv_changzhu.setText("切换主账户"); | 141 | tv_changzhu.setText("切换主账户"); |
142 | tv_changzhu.setEnabled(true); | 142 | tv_changzhu.setEnabled(true); |
143 | iv_useing.setVisibility(View.GONE); | 143 | iv_useing.setVisibility(View.GONE); |
144 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 144 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 148 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
149 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 149 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
150 | listview.setLayoutManager(linearLayoutManager); | 150 | listview.setLayoutManager(linearLayoutManager); |
151 | childsAdapter = new AccountChildsAdapter(data, this); | 151 | childsAdapter = new AccountChildsAdapter(data, this); |
152 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); | 152 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); |
153 | listview.setAdapter(childsAdapter); | 153 | listview.setAdapter(childsAdapter); |
154 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { | 154 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { |
155 | @Override | 155 | @Override |
156 | public void onItemClick(View view, int position) { | 156 | public void onItemClick(View view, int position) { |
157 | 157 | ||
158 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); | 158 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); |
159 | } | 159 | } |
160 | }); | 160 | }); |
161 | 161 | ||
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | private void initLister() { | 165 | private void initLister() { |
166 | changbangding.setOnClickListener(this); | 166 | changbangding.setOnClickListener(this); |
167 | changpassword.setOnClickListener(this); | 167 | changpassword.setOnClickListener(this); |
168 | cancel.setOnClickListener(this); | 168 | cancel.setOnClickListener(this); |
169 | tv_changzhu.setOnClickListener(this); | 169 | tv_changzhu.setOnClickListener(this); |
170 | 170 | ||
171 | 171 | ||
172 | } | 172 | } |
173 | 173 | ||
174 | @Override | 174 | @Override |
175 | public void onClick(View v) { | 175 | public void onClick(View v) { |
176 | switch (v.getId()) { | 176 | switch (v.getId()) { |
177 | case R.id.changBangding: | 177 | case R.id.changBangding: |
178 | Content.authcodeflag = 1; | 178 | Content.authcodeflag = 1; |
179 | Intent changebangding = new Intent(); | 179 | Intent changebangding = new Intent(); |
180 | changebangding.setClass(AccountManagementActivity.this, ElectronicCardValidationActivity.class); | 180 | changebangding.setClass(AccountManagementActivity.this, ElectronicCardValidationActivity.class); |
181 | startActivity(changebangding); | 181 | startActivity(changebangding); |
182 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 182 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
183 | break; | 183 | break; |
184 | case R.id.changpassword: | 184 | case R.id.changpassword: |
185 | Intent changpwd = new Intent(); | 185 | Intent changpwd = new Intent(); |
186 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); | 186 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); |
187 | startActivity(changpwd); | 187 | startActivity(changpwd); |
188 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 188 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
189 | break; | 189 | break; |
190 | case R.id.change_zhu_account: | 190 | case R.id.change_zhu_account: |
191 | Content.changgeaccountflag = 1; | 191 | Content.changgeaccountflag = 1; |
192 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 192 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
193 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); | 193 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); |
194 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 194 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
195 | //String ss = SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADENS); | 195 | //String ss = SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADENS); |
196 | String zizhuanhui = SaveParam.getInstance().getCustomizeParam(AccountManagementActivity.this, SaveParam.CHILDSGRADENSss); | 196 | String zizhuanhui = SaveParam.getInstance().getCustomizeParam(AccountManagementActivity.this, SaveParam.CHILDSGRADENSss); |
197 | try { | 197 | try { |
198 | long auserID = Long.parseLong(userID); | 198 | long auserID = Long.parseLong(userID); |
199 | int zhugrade = Integer.parseInt(subAccountId); | 199 | int zhugrade = Integer.parseInt(subAccountId); |
200 | int zigrade = Integer.parseInt(zizhuanhui); | 200 | int zigrade = Integer.parseInt(zizhuanhui); |
201 | Log.i("---", "发送完了"+zhugrade+"ddd"+zhugrade); | 201 | Log.i("---", "发送完了"+zhugrade+"ddd"+zhugrade); |
202 | // if ((zhugrade < 8)&&(zigrade>=8)||(zhugrade >= 8)&&(zigrade<8)) { | 202 | // if ((zhugrade < 8)&&(zigrade>=8)||(zhugrade >= 8)&&(zigrade<8)) { |
203 | // Intent intentbroad = new Intent(); | 203 | // Intent intentbroad = new Intent(); |
204 | // intentbroad.putExtra("info", "小学"); | 204 | // intentbroad.putExtra("info", "小学"); |
205 | // //4、定义广播发送的action | 205 | // //4、定义广播发送的action |
206 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 206 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
207 | // //5、发送广播 | 207 | // //5、发送广播 |
208 | // sendBroadcast(intentbroad); | 208 | // sendBroadcast(intentbroad); |
209 | // Log.i("---", "发送完了"); | 209 | // Log.i("---", "发送完了"); |
210 | // } | 210 | // } |
211 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, | 211 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, |
212 | devicenumber, 1); | 212 | devicenumber, 1); |
213 | 213 | ||
214 | } catch (NumberFormatException e) { | 214 | } catch (NumberFormatException e) { |
215 | e.printStackTrace(); | 215 | e.printStackTrace(); |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | break; | 219 | break; |
220 | case R.id.cancel: | 220 | case R.id.cancel: |
221 | finish(); | 221 | finish(); |
222 | break; | 222 | break; |
223 | 223 | ||
224 | } | 224 | } |
225 | 225 | ||
226 | } | 226 | } |
227 | 227 | ||
228 | @Override | 228 | @Override |
229 | protected void onResume() { | 229 | protected void onResume() { |
230 | super.onResume(); | 230 | super.onResume(); |
231 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 231 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
232 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 232 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
233 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); | 233 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
234 | usernames.setText(cunt_username); | 234 | usernames.setText(cunt_username); |
235 | try { | 235 | try { |
236 | long auserID = Long.parseLong(userID); | 236 | long auserID = Long.parseLong(userID); |
237 | HttpManager.getInstance().getchildAccountinfo(this, auserID, devicenumber, handler); | 237 | HttpManager.getInstance().getchildAccountinfo(this, auserID, devicenumber, handler); |
238 | 238 | ||
239 | } catch (NumberFormatException e) { | 239 | } catch (NumberFormatException e) { |
240 | e.printStackTrace(); | 240 | e.printStackTrace(); |
241 | } | 241 | } |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeElectronicCardAdressInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.os.Handler; | 4 | import android.os.Handler; |
5 | import android.os.Message; | 5 | import android.os.Message; |
6 | import android.support.v4.app.FragmentActivity; | 6 | import android.support.v4.app.FragmentActivity; |
7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.Button; | 9 | import android.widget.Button; |
10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
13 | 13 | ||
14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
15 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 15 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
16 | import com.hjx.personalcenter.customdialog.CountryDialog; | 16 | import com.hjx.personalcenter.customdialog.CountryDialog; |
17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
18 | import com.hjx.personalcenter.db.SaveParam; | 18 | import com.hjx.personalcenter.db.SaveParam; |
19 | import com.hjx.personalcenter.http.HttpCode; | 19 | import com.hjx.personalcenter.http.HttpCode; |
20 | import com.hjx.personalcenter.http.HttpManager; | 20 | import com.hjx.personalcenter.http.HttpManager; |
21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
22 | import com.hjx.personalcenter.model.CityInfo; | 22 | import com.hjx.personalcenter.model.CityInfo; |
23 | import com.hjx.personalcenter.model.CountyInfo; | 23 | import com.hjx.personalcenter.model.CountyInfo; |
24 | import com.hjx.personalcenter.model.ProvinceInfo; | 24 | import com.hjx.personalcenter.model.ProvinceInfo; |
25 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
26 | import com.hjx.personalcenter.util.GetDevicesUtil; | 26 | import com.hjx.personalcenter.util.GetDevicesUtil; |
27 | import com.hjx.personalcenter.util.Judgment; | 27 | import com.hjx.personalcenter.util.Judgment; |
28 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 28 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
29 | 29 | ||
30 | import org.json.JSONObject; | 30 | import org.json.JSONObject; |
31 | 31 | ||
32 | import java.util.ArrayList; | 32 | import java.util.ArrayList; |
33 | import java.util.TimerTask; | 33 | import java.util.TimerTask; |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Created by h on 2017/8/9. | 36 | * Created by h on 2017/8/9. |
37 | */ | 37 | */ |
38 | 38 | ||
39 | public class ChangeElectronicCardAdressInfoActivity extends FragmentActivity implements View.OnClickListener | 39 | public class ChangeElectronicCardAdressInfoActivity extends FragmentActivity implements View.OnClickListener |
40 | ,DialogCallBack.ProvincesCallBack | 40 | ,DialogCallBack.ProvincesCallBack |
41 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ | 41 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ |
42 | private ImageView back_forgit; | 42 | private ImageView back_forgit; |
43 | private EditText forot_pwd_phone,forot_pwd_anthcode,newadress; | 43 | private EditText forot_pwd_phone,forot_pwd_anthcode,newadress; |
44 | private TextView adress; | 44 | private TextView adress; |
45 | private Button forot_pwd_sub,forot_pwd_getanthcode; | 45 | private Button forot_pwd_sub,forot_pwd_getanthcode; |
46 | private String typeStr = "general"; | 46 | private String typeStr = "general"; |
47 | private int delayTime=60; | 47 | private int delayTime=60; |
48 | private java.util.Timer Delaytimer; | 48 | private java.util.Timer Delaytimer; |
49 | Handler handler = new Handler() { | 49 | Handler handler = new Handler() { |
50 | @Override | 50 | @Override |
51 | public void handleMessage(Message msg) { | 51 | public void handleMessage(Message msg) { |
52 | super.handleMessage(msg); | 52 | super.handleMessage(msg); |
53 | JSONObject jsonObject; | 53 | JSONObject jsonObject; |
54 | String status; | 54 | String status; |
55 | switch (msg.what) { | 55 | switch (msg.what) { |
56 | case HttpCode.AUTHCODE_SUCESS1: | 56 | case HttpCode.AUTHCODE_SUCESS1: |
57 | jsonObject = (JSONObject) msg.obj; | 57 | jsonObject = (JSONObject) msg.obj; |
58 | status = jsonObject.optString("status"); | 58 | status = jsonObject.optString("status"); |
59 | if (status.equals("100")) { | 59 | if (status.equals("100")) { |
60 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "验证码发送成功"); | 60 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "验证码发送成功"); |
61 | } | 61 | } |
62 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 62 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
63 | break; | 63 | break; |
64 | case HttpCode.AUTHCODE_FAIL1: | 64 | case HttpCode.AUTHCODE_FAIL1: |
65 | jsonObject = (JSONObject) msg.obj; | 65 | jsonObject = (JSONObject) msg.obj; |
66 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); | 66 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); |
67 | break; | 67 | break; |
68 | case 21: | 68 | case 21: |
69 | if(delayTime<=0){ | 69 | if(delayTime<=0){ |
70 | if(Delaytimer!=null){ | 70 | if(Delaytimer!=null){ |
71 | Delaytimer.cancel(); | 71 | Delaytimer.cancel(); |
72 | } | 72 | } |
73 | forot_pwd_getanthcode.setEnabled(true); | 73 | forot_pwd_getanthcode.setEnabled(true); |
74 | forot_pwd_getanthcode.setClickable(true); | 74 | forot_pwd_getanthcode.setClickable(true); |
75 | forot_pwd_getanthcode.setText("获取验证码"); | 75 | forot_pwd_getanthcode.setText("获取验证码"); |
76 | delayTime=60; | 76 | delayTime=60; |
77 | }else{ | 77 | }else{ |
78 | forot_pwd_getanthcode.setEnabled(false); | 78 | forot_pwd_getanthcode.setEnabled(false); |
79 | forot_pwd_getanthcode.setClickable(false); | 79 | forot_pwd_getanthcode.setClickable(false); |
80 | forot_pwd_getanthcode.setText(delayTime + " s"); | 80 | forot_pwd_getanthcode.setText(delayTime + " s"); |
81 | } | 81 | } |
82 | break; | 82 | break; |
83 | } | 83 | } |
84 | } | 84 | } |
85 | }; | 85 | }; |
86 | @Override | 86 | @Override |
87 | protected void onCreate(Bundle savedInstanceState) { | 87 | protected void onCreate(Bundle savedInstanceState) { |
88 | super.onCreate(savedInstanceState); | 88 | super.onCreate(savedInstanceState); |
89 | setContentView(R.layout.activity_change_card_validation); | 89 | setContentView(R.layout.activity_change_card_validation); |
90 | SysApplication.getInstance().addActivity(this); | 90 | SysApplication.getInstance().addActivity(this); |
91 | initView(); | 91 | initView(); |
92 | setLister(); | 92 | setLister(); |
93 | } | 93 | } |
94 | //获取验证码 | 94 | //获取验证码 |
95 | private void getauthcode() { | 95 | private void getauthcode() { |
96 | forot_pwd_anthcode.requestFocus(); | 96 | forot_pwd_anthcode.requestFocus(); |
97 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 97 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
98 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); | 98 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); |
99 | valiDelay(); | 99 | valiDelay(); |
100 | 100 | ||
101 | } | 101 | } |
102 | private void initView() { | 102 | private void initView() { |
103 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); | 103 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); |
104 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); | 104 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); |
105 | adress = (TextView) findViewById(R.id.et_newpassword); | 105 | adress = (TextView) findViewById(R.id.et_newpassword); |
106 | newadress = (EditText) findViewById(R.id.et_again_newpassword); | 106 | newadress = (EditText) findViewById(R.id.et_again_newpassword); |
107 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); | 107 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); |
108 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); | 108 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); |
109 | back_forgit= (ImageView) findViewById(R.id.cancel); | 109 | back_forgit= (ImageView) findViewById(R.id.cancel); |
110 | } | 110 | } |
111 | private void setLister() { | 111 | private void setLister() { |
112 | back_forgit.setOnClickListener(this); | 112 | back_forgit.setOnClickListener(this); |
113 | forot_pwd_sub.setOnClickListener(this); | 113 | forot_pwd_sub.setOnClickListener(this); |
114 | forot_pwd_getanthcode.setOnClickListener(this); | 114 | forot_pwd_getanthcode.setOnClickListener(this); |
115 | adress.setOnClickListener(this); | 115 | adress.setOnClickListener(this); |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | @Override | 119 | @Override |
120 | public void onClick(View view) { | 120 | public void onClick(View view) { |
121 | switch (view.getId()){ | 121 | switch (view.getId()){ |
122 | case R.id.btn_ok: | 122 | case R.id.btn_ok: |
123 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 123 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
124 | String forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); | 124 | String forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); |
125 | String forot_pwd_pwd3 = adress.getText().toString().trim(); | 125 | String forot_pwd_pwd3 = adress.getText().toString().trim(); |
126 | String forot_pwd_pwd4 = newadress.getText().toString().trim(); | 126 | String forot_pwd_pwd4 = newadress.getText().toString().trim(); |
127 | if (TextUtils.isEmpty(forot_pwd_phone1)|| | 127 | if (TextUtils.isEmpty(forot_pwd_phone1)|| |
128 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ | 128 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ |
129 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请将必填项填写完整"); | 129 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请将必填项填写完整"); |
130 | return; | 130 | return; |
131 | }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ | 131 | } |
132 | else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ | ||
132 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "手机号码输入有误"); | 133 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "手机号码输入有误"); |
133 | 134 | ||
134 | } else { | 135 | } |
136 | else { | ||
135 | //修改地址接口 | 137 | //修改地址接口 |
136 | String userID = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 138 | String userID = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
137 | HttpManager.getInstance().changecardadressinfo(this,userID,forot_pwd_phone1,forot_pwd_anthcode1,forot_pwd_pwd3+forot_pwd_pwd4); | 139 | HttpManager.getInstance().changecardadressinfo(this,userID,forot_pwd_phone1,forot_pwd_anthcode1,forot_pwd_pwd3+forot_pwd_pwd4); |
138 | 140 | ||
139 | 141 | ||
140 | } | 142 | } |
141 | break; | 143 | break; |
142 | case R.id.btn_authcode: | 144 | case R.id.btn_authcode: |
143 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 145 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
144 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ | 146 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ |
145 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请输入正确的手机号"); | 147 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请输入正确的手机号"); |
146 | }else { | 148 | }else { |
147 | forot_pwd_anthcode.requestFocus(); | 149 | forot_pwd_anthcode.requestFocus(); |
148 | getauthcode(); | 150 | getauthcode(); |
149 | 151 | ||
150 | } | 152 | } |
151 | 153 | ||
152 | break; | 154 | break; |
153 | case R.id.et_newpassword: | 155 | case R.id.et_newpassword: |
154 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) ChangeElectronicCardAdressInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 156 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) ChangeElectronicCardAdressInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
155 | break; | 157 | break; |
156 | 158 | ||
157 | case R.id.cancel: | 159 | case R.id.cancel: |
158 | finish(); | 160 | finish(); |
159 | break; | 161 | break; |
160 | } | 162 | } |
161 | } | 163 | } |
162 | 164 | ||
163 | @Override | 165 | @Override |
164 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 166 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
165 | String regionName = data.get(position).getRegionName(); | 167 | String regionName = data.get(position).getRegionName(); |
166 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 168 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
167 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 169 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
168 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 170 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
169 | adress.setText(""); | 171 | adress.setText(""); |
170 | adress.setText(provice+regionName); | 172 | adress.setText(provice+regionName); |
171 | 173 | ||
172 | 174 | ||
173 | } | 175 | } |
174 | 176 | ||
175 | @Override | 177 | @Override |
176 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 178 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
177 | String regionName = data.get(position).getRegionName(); | 179 | String regionName = data.get(position).getRegionName(); |
178 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 180 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
179 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 181 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
180 | adress.setText(""); | 182 | adress.setText(""); |
181 | adress.setText(provices+citys+regionName); | 183 | adress.setText(provices+citys+regionName); |
182 | } | 184 | } |
183 | 185 | ||
184 | @Override | 186 | @Override |
185 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 187 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
186 | String regionName = data.get(position).getRegionName(); | 188 | String regionName = data.get(position).getRegionName(); |
187 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 189 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
188 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 190 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
189 | adress.setText(""); | 191 | adress.setText(""); |
190 | adress.setText(regionName); | 192 | adress.setText(regionName); |
191 | } | 193 | } |
192 | 194 | ||
193 | // 线程类 定时器 | 195 | // 线程类 定时器 |
194 | public void valiDelay() { | 196 | public void valiDelay() { |
195 | 197 | ||
196 | Delaytimer = new java.util.Timer(true); | 198 | Delaytimer = new java.util.Timer(true); |
197 | 199 | ||
198 | 200 | ||
199 | TimerTask task = new TimerTask() { | 201 | TimerTask task = new TimerTask() { |
200 | public void run() { | 202 | public void run() { |
201 | //每次需要执行的代码放到这里面。 | 203 | //每次需要执行的代码放到这里面。 |
202 | delayTime--; | 204 | delayTime--; |
203 | handler.sendEmptyMessage(21); | 205 | handler.sendEmptyMessage(21); |
204 | 206 | ||
205 | 207 | ||
206 | 208 | ||
207 | } | 209 | } |
208 | }; | 210 | }; |
209 | Delaytimer.schedule(task, 1000,1000); | 211 | Delaytimer.schedule(task, 1000,1000); |
210 | } | 212 | } |
211 | 213 | ||
212 | } | 214 | } |
213 | 215 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangePasswordActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.v4.app.FragmentActivity; | 4 | import android.support.v4.app.FragmentActivity; |
5 | import android.text.Editable; | ||
5 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
7 | import android.text.TextWatcher; | ||
6 | import android.text.method.HideReturnsTransformationMethod; | 8 | import android.text.method.HideReturnsTransformationMethod; |
7 | import android.text.method.PasswordTransformationMethod; | 9 | import android.text.method.PasswordTransformationMethod; |
8 | import android.view.View; | 10 | import android.view.View; |
9 | import android.widget.Button; | 11 | import android.widget.Button; |
10 | import android.widget.EditText; | 12 | import android.widget.EditText; |
13 | import android.widget.ImageButton; | ||
11 | import android.widget.ImageView; | 14 | import android.widget.ImageView; |
12 | 15 | ||
13 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
14 | import com.hjx.personalcenter.db.SaveParam; | 17 | import com.hjx.personalcenter.db.SaveParam; |
15 | import com.hjx.personalcenter.http.HttpManager; | 18 | import com.hjx.personalcenter.http.HttpManager; |
16 | import com.hjx.personalcenter.util.AlertUtils; | 19 | import com.hjx.personalcenter.util.AlertUtils; |
17 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 20 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
18 | 21 | ||
19 | /**修改密码 | 22 | /**修改密码 |
20 | * Created by h on 2017/6/27. | 23 | * Created by h on 2017/6/27. |
21 | */ | 24 | */ |
22 | 25 | ||
23 | public class ChangePasswordActivity extends FragmentActivity implements View.OnClickListener { | 26 | public class ChangePasswordActivity extends FragmentActivity implements View.OnClickListener { |
24 | private EditText old_pwd,newpassword,newpassword1; | 27 | private EditText old_pwd,newpassword,newpassword1; |
25 | private Button sub_change_pwd; | 28 | private Button sub_change_pwd; |
26 | private ImageView back_change_pwd,eyes_iv_change1; | 29 | private ImageView back_change_pwd,eyes_iv_change1; |
30 | private ImageButton oldpassword_delete_btn; | ||
27 | public static Boolean showPassword = false; | 31 | public static Boolean showPassword = false; |
28 | @Override | 32 | @Override |
29 | protected void onCreate(Bundle savedInstanceState) { | 33 | protected void onCreate(Bundle savedInstanceState) { |
30 | super.onCreate(savedInstanceState); | 34 | super.onCreate(savedInstanceState); |
31 | setContentView(R.layout.activity_changepsword); | 35 | setContentView(R.layout.activity_changepsword); |
32 | initView(); | 36 | initView(); |
33 | setLister(); | 37 | setLister(); |
38 | initTextWatch(); | ||
34 | } | 39 | } |
35 | 40 | ||
36 | private void initView() { | 41 | private void initView() { |
37 | old_pwd = (EditText) findViewById(R.id.et_oldpassword); | 42 | old_pwd = (EditText) findViewById(R.id.et_oldpassword); |
38 | newpassword = (EditText) findViewById(R.id.et_newpassword); | 43 | newpassword = (EditText) findViewById(R.id.et_newpassword); |
39 | newpassword1 = (EditText) findViewById(R.id.et_again_newpassword); | 44 | newpassword1 = (EditText) findViewById(R.id.et_again_newpassword); |
40 | sub_change_pwd = (Button) findViewById(R.id.btn_ok); | 45 | sub_change_pwd = (Button) findViewById(R.id.btn_ok); |
41 | back_change_pwd = (ImageView) findViewById(R.id.cancel); | 46 | back_change_pwd = (ImageView) findViewById(R.id.cancel); |
42 | eyes_iv_change1 = (ImageView) findViewById(R.id.iv_pwd_change); | 47 | eyes_iv_change1 = (ImageView) findViewById(R.id.iv_pwd_change); |
48 | oldpassword_delete_btn = (ImageButton) findViewById(R.id.oldpassword_delete_btn); | ||
43 | 49 | ||
44 | 50 | ||
45 | } | 51 | } |
46 | 52 | ||
47 | private void setLister() { | 53 | private void setLister() { |
48 | sub_change_pwd.setOnClickListener(this); | 54 | sub_change_pwd.setOnClickListener(this); |
49 | back_change_pwd.setOnClickListener(this); | 55 | back_change_pwd.setOnClickListener(this); |
50 | eyes_iv_change1.setOnClickListener(this); | 56 | eyes_iv_change1.setOnClickListener(this); |
57 | oldpassword_delete_btn.setOnClickListener(this); | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * 输入框改变的监听 | ||
62 | */ | ||
63 | private void initTextWatch() { | ||
64 | old_pwd.addTextChangedListener(new TextWatcher() { | ||
65 | @Override | ||
66 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
67 | } | ||
68 | |||
69 | @Override | ||
70 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
71 | if (s.toString().length() == 0) { | ||
72 | oldpassword_delete_btn.setVisibility(View.INVISIBLE); | ||
73 | } else { | ||
74 | oldpassword_delete_btn.setVisibility(View.VISIBLE); | ||
75 | } | ||
76 | } | ||
77 | |||
78 | @Override | ||
79 | public void afterTextChanged(Editable s) { | ||
80 | |||
81 | } | ||
82 | }); | ||
83 | old_pwd.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
84 | @Override | ||
85 | public void onFocusChange(View v, boolean hasFocus) { | ||
86 | if (hasFocus) { | ||
87 | if (!old_pwd.getText().toString().isEmpty()) { | ||
88 | oldpassword_delete_btn.setVisibility(View.VISIBLE); | ||
89 | } | ||
90 | } else { | ||
91 | |||
92 | oldpassword_delete_btn.setVisibility(View.INVISIBLE); | ||
93 | } | ||
94 | } | ||
95 | }); | ||
51 | } | 96 | } |
52 | 97 | ||
53 | @Override | 98 | @Override |
54 | public void onClick(View v) { | 99 | public void onClick(View v) { |
55 | String old_pwd1 = old_pwd.getText().toString().trim(); | 100 | String old_pwd1 = old_pwd.getText().toString().trim(); |
56 | String newpassword3 = newpassword.getText().toString().trim(); | 101 | String newpassword3 = newpassword.getText().toString().trim(); |
57 | String newpassword4 = newpassword1.getText().toString().trim(); | 102 | String newpassword4 = newpassword1.getText().toString().trim(); |
58 | switch (v.getId()){ | 103 | switch (v.getId()){ |
59 | //确认修改 | 104 | //确认修改 |
60 | case R.id.btn_ok: | 105 | case R.id.btn_ok: |
61 | 106 | ||
62 | //Log.e("test","sp保存的密码是"+sp.getLoginParam(ChangePwd.this, "password")); | 107 | //Log.e("test","sp保存的密码是"+sp.getLoginParam(ChangePwd.this, "password")); |
63 | if (TextUtils.isEmpty(old_pwd1)|| | 108 | if (TextUtils.isEmpty(old_pwd1)|| |
64 | TextUtils.isEmpty(newpassword3) || TextUtils.isEmpty(newpassword4)){ | 109 | TextUtils.isEmpty(newpassword3) || TextUtils.isEmpty(newpassword4)){ |
65 | AlertUtils.showToast(ChangePasswordActivity.this, "请将必填项填写完整"); | 110 | AlertUtils.showToast(ChangePasswordActivity.this, "请将必填项填写完整"); |
66 | return; | 111 | return; |
67 | }else if(newpassword3.length()<8||newpassword4.length()<8){ | 112 | }else if(newpassword3.length()<8||newpassword4.length()<8){ |
68 | AlertUtils.showToast(ChangePasswordActivity.this,"密码不能少于8位"); | 113 | AlertUtils.showToast(ChangePasswordActivity.this,"密码不能少于8位"); |
69 | }else if(!newpassword3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)||!newpassword4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ | 114 | }else if(!newpassword3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)||!newpassword4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ |
70 | AlertUtils.showToast(ChangePasswordActivity.this, "密码必须由数字和字母组成"); | 115 | AlertUtils.showToast(ChangePasswordActivity.this, "密码必须由数字和字母组成"); |
71 | } | 116 | } |
72 | //得到原密码并且判断是否输入的一样 | 117 | //得到原密码并且判断是否输入的一样 |
73 | else if(!SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"password").equals(old_pwd1)){ | 118 | else if(!SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"password").equals(old_pwd1)){ |
74 | 119 | ||
75 | AlertUtils.showToast(ChangePasswordActivity.this, "原密码输入错误"); | 120 | AlertUtils.showToast(ChangePasswordActivity.this, "原密码输入错误"); |
76 | 121 | ||
77 | }else if (!newpassword3.equals(newpassword4)){ | 122 | }else if (!newpassword3.equals(newpassword4)){ |
78 | AlertUtils.showToast(ChangePasswordActivity.this, "两次密码输入不一致"); | 123 | AlertUtils.showToast(ChangePasswordActivity.this, "两次密码输入不一致"); |
79 | return; | 124 | return; |
80 | }else{ | 125 | }else{ |
81 | //修改密码接口 | 126 | //修改密码接口 |
82 | String name = SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"username"); | 127 | String name = SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"username"); |
83 | HttpManager.getInstance().changepwd(this,name,old_pwd1,newpassword3); | 128 | HttpManager.getInstance().changepwd(this,name,old_pwd1,newpassword3); |
84 | } | 129 | } |
85 | 130 | ||
86 | break; | 131 | break; |
87 | case R.id.iv_pwd_change: | 132 | case R.id.iv_pwd_change: |
88 | if(showPassword){//显示密码 | 133 | if(showPassword){//显示密码 |
89 | showPassword = !showPassword; | 134 | showPassword = !showPassword; |
90 | eyes_iv_change1.setImageResource(R.mipmap.pwd_open); | 135 | eyes_iv_change1.setImageResource(R.mipmap.pwd_open); |
91 | newpassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 136 | newpassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
92 | newpassword.setSelection(newpassword.getText().toString().length()); | 137 | newpassword.setSelection(newpassword.getText().toString().length()); |
93 | }else{//隐藏密码 | 138 | }else{//隐藏密码 |
94 | showPassword = !showPassword; | 139 | showPassword = !showPassword; |
95 | eyes_iv_change1.setImageResource(R.mipmap.pwd_hide); | 140 | eyes_iv_change1.setImageResource(R.mipmap.pwd_hide); |
96 | newpassword.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 141 | newpassword.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
97 | newpassword.setSelection(newpassword.getText().toString().length()); | 142 | newpassword.setSelection(newpassword.getText().toString().length()); |
98 | } | 143 | } |
99 | break; | 144 | break; |
100 | 145 | ||
101 | case R.id.cancel: | 146 | case R.id.cancel: |
102 | finish(); | 147 | finish(); |
103 | break; | 148 | break; |
149 | case R.id.oldpassword_delete_btn: | ||
150 | old_pwd.setText(""); | ||
151 | break; | ||
104 | } | 152 | } |
105 | 153 | ||
106 | } | 154 | } |
107 | } | 155 | } |
108 | 156 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v4.app.FragmentActivity; | 7 | import android.support.v4.app.FragmentActivity; |
8 | import android.util.Log; | 8 | import android.util.Log; |
9 | import android.view.View; | 9 | import android.view.View; |
10 | import android.widget.AdapterView; | 10 | import android.widget.AdapterView; |
11 | import android.widget.Button; | 11 | import android.widget.Button; |
12 | import android.widget.GridView; | 12 | import android.widget.GridView; |
13 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
14 | import android.widget.TextView; | 14 | import android.widget.TextView; |
15 | import android.widget.Toast; | 15 | import android.widget.Toast; |
16 | 16 | ||
17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.adapter.GridAdapter; | 18 | import com.hjx.personalcenter.adapter.GridAdapter; |
19 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 19 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
20 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 20 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
21 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
22 | import com.hjx.personalcenter.http.HttpCode; | 22 | import com.hjx.personalcenter.http.HttpCode; |
23 | import com.hjx.personalcenter.http.HttpManager; | 23 | import com.hjx.personalcenter.http.HttpManager; |
24 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 24 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
25 | import com.hjx.personalcenter.model.DefautPublishInfo; | 25 | import com.hjx.personalcenter.model.DefautPublishInfo; |
26 | import com.hjx.personalcenter.model.VersionInfo; | 26 | import com.hjx.personalcenter.model.VersionInfo; |
27 | import com.hjx.personalcenter.util.AlertUtils; | 27 | import com.hjx.personalcenter.util.AlertUtils; |
28 | import com.hjx.personalcenter.util.GetDevicesUtil; | 28 | import com.hjx.personalcenter.util.GetDevicesUtil; |
29 | import com.squareup.picasso.Picasso; | 29 | import com.squareup.picasso.Picasso; |
30 | 30 | ||
31 | import org.json.JSONException; | 31 | import org.json.JSONException; |
32 | import org.json.JSONObject; | 32 | import org.json.JSONObject; |
33 | 33 | ||
34 | import java.util.ArrayList; | 34 | import java.util.ArrayList; |
35 | import java.util.List; | 35 | import java.util.List; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * 选择教材 | 38 | * 选择教材 |
39 | * Created by h on 2017/8/10. | 39 | * Created by h on 2017/8/10. |
40 | */ | 40 | */ |
41 | 41 | ||
42 | public class ChoiseTextBookActivity extends FragmentActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { | 42 | public class ChoiseTextBookActivity extends FragmentActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { |
43 | private GridView gridView; | 43 | private GridView gridView; |
44 | private Button btn_ok; | 44 | private Button btn_ok; |
45 | private ImageView cancel; | 45 | private ImageView cancel; |
46 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 46 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
47 | private GridAdapter sim_adapter; | 47 | private GridAdapter sim_adapter; |
48 | private ImageView simpleDraweeView; | 48 | private ImageView simpleDraweeView; |
49 | private TextView publish; | 49 | private TextView publish; |
50 | private String chinese, math, english, physics, chemistry, history, geography, political, biology, science; | 50 | private String chinese, math, english, physics, chemistry, history, geography, political, biology, science; |
51 | 51 | ||
52 | 52 | ||
53 | Handler handler = new Handler() { | 53 | Handler handler = new Handler() { |
54 | @Override | 54 | @Override |
55 | public void handleMessage(Message msg) { | 55 | public void handleMessage(Message msg) { |
56 | super.handleMessage(msg); | 56 | super.handleMessage(msg); |
57 | JSONObject jsonObject; | 57 | JSONObject jsonObject; |
58 | String status; | 58 | String status; |
59 | switch (msg.what) { | 59 | switch (msg.what) { |
60 | case HttpCode.CHECKCARD: | 60 | case HttpCode.CHECKCARD: |
61 | try { | 61 | try { |
62 | jsonObject = new JSONObject((String) msg.obj); | 62 | jsonObject = new JSONObject((String) msg.obj); |
63 | status = jsonObject.optString("status"); | 63 | status = jsonObject.optString("status"); |
64 | if (status.equals("1")) { | 64 | if (status.equals("1")) { |
65 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); | 65 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); |
66 | Intent intent = new Intent(); | 66 | Intent intent = new Intent(); |
67 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 67 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
68 | ChoiseTextBookActivity.this.startActivity(intent); | 68 | ChoiseTextBookActivity.this.startActivity(intent); |
69 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 69 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
70 | } else if (status.equals("2001")) { | 70 | } else if (status.equals("2001")) { |
71 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); | 71 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); |
72 | } else if (status.equals("2002")) { | 72 | } else if (status.equals("2002")) { |
73 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您的机器为样机,可直接使用!"); | 73 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您的机器为样机,可直接使用!"); |
74 | Intent intent = new Intent(); | 74 | Intent intent = new Intent(); |
75 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 75 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
76 | ChoiseTextBookActivity.this.startActivity(intent); | 76 | ChoiseTextBookActivity.this.startActivity(intent); |
77 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 77 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
78 | } | 78 | } |
79 | 79 | ||
80 | } catch (JSONException e) { | 80 | } catch (JSONException e) { |
81 | e.printStackTrace(); | 81 | e.printStackTrace(); |
82 | } | 82 | } |
83 | 83 | ||
84 | break; | 84 | break; |
85 | case HttpCode.PUBLISH_SUCESS: | 85 | case HttpCode.PUBLISH_SUCESS: |
86 | defautPublishInfos.clear(); | 86 | defautPublishInfos.clear(); |
87 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 87 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
88 | sim_adapter.notifyDataSetChanged(); | 88 | sim_adapter.notifyDataSetChanged(); |
89 | for (int i = 0; i < defautPublishInfos.size(); i++) { | 89 | for (int i = 0; i < defautPublishInfos.size(); i++) { |
90 | String subject = defautPublishInfos.get(i).getSubject(); | 90 | String subject = defautPublishInfos.get(i).getSubject(); |
91 | if (subject.equals("语文")) { | 91 | if (subject.equals("语文")) { |
92 | chinese = defautPublishInfos.get(i).getPress(); | 92 | chinese = defautPublishInfos.get(i).getPress(); |
93 | } else if (subject.equals("数学")) { | 93 | } else if (subject.equals("数学")) { |
94 | math = defautPublishInfos.get(i).getPress(); | 94 | math = defautPublishInfos.get(i).getPress(); |
95 | } else if (subject.equals("英语")) { | 95 | } else if (subject.equals("英语")) { |
96 | english = defautPublishInfos.get(i).getPress(); | 96 | english = defautPublishInfos.get(i).getPress(); |
97 | } else if (subject.equals("物理")) { | 97 | } else if (subject.equals("物理")) { |
98 | physics = defautPublishInfos.get(i).getPress(); | 98 | physics = defautPublishInfos.get(i).getPress(); |
99 | } else if (subject.equals("化学")) { | 99 | } else if (subject.equals("化学")) { |
100 | chemistry = defautPublishInfos.get(i).getPress(); | 100 | chemistry = defautPublishInfos.get(i).getPress(); |
101 | } else if (subject.equals("历史")) { | 101 | } else if (subject.equals("历史")) { |
102 | history = defautPublishInfos.get(i).getPress(); | 102 | history = defautPublishInfos.get(i).getPress(); |
103 | } else if (subject.equals("地理")) { | 103 | } else if (subject.equals("地理")) { |
104 | geography = defautPublishInfos.get(i).getPress(); | 104 | geography = defautPublishInfos.get(i).getPress(); |
105 | } else if (subject.equals("政治")) { | 105 | } else if (subject.equals("政治")) { |
106 | political = defautPublishInfos.get(i).getPress(); | 106 | political = defautPublishInfos.get(i).getPress(); |
107 | } else if (subject.equals("生物")) { | 107 | } else if (subject.equals("生物")) { |
108 | biology = defautPublishInfos.get(i).getPress(); | 108 | biology = defautPublishInfos.get(i).getPress(); |
109 | } else if (subject.equals("科学")) { | 109 | } else if (subject.equals("科学")) { |
110 | science = defautPublishInfos.get(i).getPress(); | 110 | science = defautPublishInfos.get(i).getPress(); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | break; | 113 | break; |
114 | case HttpCode.REGISTERINFO_SUCESS: | 114 | case HttpCode.REGISTERINFO_SUCESS: |
115 | try { | 115 | try { |
116 | jsonObject = new JSONObject((String) msg.obj); | 116 | jsonObject = new JSONObject((String) msg.obj); |
117 | String statusregister = jsonObject.optString("status"); | 117 | String statusregister = jsonObject.optString("status"); |
118 | if (statusregister.equals("1")) { | 118 | if (statusregister.equals("1")) { |
119 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); | 119 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); |
120 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ChoiseTextBookActivity.this).getDeviceNumber(); | 120 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ChoiseTextBookActivity.this).getDeviceNumber(); |
121 | if (deviceNumber == null) { | 121 | if (deviceNumber == null) { |
122 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 122 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
123 | 123 | ||
124 | } else { | 124 | } else { |
125 | //验证保卡信息 | 125 | //验证保卡信息 |
126 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, deviceNumber, handler); | 126 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, deviceNumber, handler); |
127 | } | 127 | } |
128 | 128 | ||
129 | } else { | 129 | } else { |
130 | // AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); | 130 | // AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); |
131 | } | 131 | } |
132 | } catch (JSONException e) { | 132 | } catch (JSONException e) { |
133 | e.printStackTrace(); | 133 | e.printStackTrace(); |
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | break; | 137 | break; |
138 | 138 | ||
139 | } | 139 | } |
140 | 140 | ||
141 | } | 141 | } |
142 | }; | 142 | }; |
143 | 143 | ||
144 | @Override | 144 | @Override |
145 | protected void onCreate(Bundle savedInstanceState) { | 145 | protected void onCreate(Bundle savedInstanceState) { |
146 | super.onCreate(savedInstanceState); | 146 | super.onCreate(savedInstanceState); |
147 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 147 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
148 | String graderid = SaveParam.getInstance().getLoginParam(this, SaveParam.CHILDSGRADENS); | 148 | String graderid = SaveParam.getInstance().getLoginParam(this, SaveParam.CHILDSGRADENS); |
149 | String accounts = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this,SaveParam.ACCOUNT); | 149 | String accounts = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this,SaveParam.ACCOUNT); |
150 | try { | 150 | try { |
151 | long auserID = Long.parseLong(userID); | 151 | long auserID = Long.parseLong(userID); |
152 | int graderID = Integer.parseInt(graderid); | 152 | int graderID = Integer.parseInt(graderid); |
153 | int accountss = Integer.parseInt(accounts); | 153 | int accountss = Integer.parseInt(accounts); |
154 | //获取版本信息 | 154 | //获取版本信息 |
155 | HttpManager.getInstance().getpublishinfo(this, auserID, graderID,accountss, handler); | 155 | HttpManager.getInstance().getpublishinfo(this, auserID, graderID,accountss, handler); |
156 | 156 | ||
157 | } catch (NumberFormatException e) { | 157 | } catch (NumberFormatException e) { |
158 | e.printStackTrace(); | 158 | e.printStackTrace(); |
159 | } | 159 | } |
160 | setContentView(R.layout.activity_choisetextbook); | 160 | setContentView(R.layout.activity_choisetextbook); |
161 | SysApplication.getInstance().addActivity(this); | 161 | SysApplication.getInstance().addActivity(this); |
162 | initView(); | 162 | initView(); |
163 | initData(); | 163 | initData(); |
164 | initLister(); | 164 | initLister(); |
165 | } | 165 | } |
166 | 166 | ||
167 | private void initView() { | 167 | private void initView() { |
168 | gridView = (GridView) findViewById(R.id.grideview); | 168 | gridView = (GridView) findViewById(R.id.grideview); |
169 | cancel = (ImageView) findViewById(R.id.cancel); | 169 | cancel = (ImageView) findViewById(R.id.cancel); |
170 | btn_ok = (Button) findViewById(R.id.btn_ok); | 170 | btn_ok = (Button) findViewById(R.id.btn_ok); |
171 | } | 171 | } |
172 | 172 | ||
173 | private void initData() { | 173 | private void initData() { |
174 | sim_adapter = new GridAdapter(defautPublishInfos, this); | 174 | sim_adapter = new GridAdapter(defautPublishInfos, this); |
175 | //配置适配器 | 175 | //配置适配器 |
176 | gridView.setAdapter(sim_adapter); | 176 | gridView.setAdapter(sim_adapter); |
177 | 177 | ||
178 | } | 178 | } |
179 | 179 | ||
180 | private void initLister() { | 180 | private void initLister() { |
181 | btn_ok.setOnClickListener(this); | 181 | btn_ok.setOnClickListener(this); |
182 | cancel.setOnClickListener(this); | 182 | cancel.setOnClickListener(this); |
183 | gridView.setOnItemClickListener(this); | 183 | gridView.setOnItemClickListener(this); |
184 | 184 | ||
185 | } | 185 | } |
186 | 186 | ||
187 | @Override | 187 | @Override |
188 | public void onClick(View v) { | 188 | public void onClick(View v) { |
189 | switch (v.getId()) { | 189 | switch (v.getId()) { |
190 | case R.id.btn_ok: | 190 | case R.id.btn_ok: |
191 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 191 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
192 | String regionId = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); | 192 | String regionId = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); |
193 | String regionId1 = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.CITYS); | 193 | String regionId1 = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.CITYS); |
194 | if (regionId == null) { | 194 | if (regionId == null) { |
195 | regionId = regionId1; | 195 | regionId = regionId1; |
196 | } | 196 | } |
197 | String grade = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CHILDSGRADENS); | 197 | String grade = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CHILDSGRADENS); |
198 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); | 198 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); |
199 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.USERNAME); | 199 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.NICKNAME); |
200 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADRESS); | 200 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.REGION); |
201 | String realName = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.REALNAME); | ||
202 | String address = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADDRESS); | ||
201 | 203 | ||
202 | try { | 204 | try { |
203 | if (userID == null) { | 205 | if (userID == null) { |
204 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 206 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
205 | 207 | ||
206 | } else { | 208 | } else { |
207 | Object schoolID; | 209 | Object schoolID; |
208 | long auserID = Long.parseLong(userID); | 210 | long auserID = Long.parseLong(userID); |
209 | int gradeID = Integer.parseInt(grade); | 211 | int gradeID = Integer.parseInt(grade); |
210 | long regionID = Long.parseLong(regionId); | 212 | long regionID = Long.parseLong(regionId); |
211 | if (schoolid == null) { | 213 | if (schoolid == null) { |
212 | schoolID = null; | 214 | schoolID = null; |
213 | } else { | 215 | } else { |
214 | schoolID = Long.parseLong(schoolid); | 216 | schoolID = Long.parseLong(schoolid); |
215 | } | 217 | } |
216 | 218 | ||
217 | //提交注册信息 | 219 | //提交注册信息 |
218 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, | 220 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, |
219 | name, gradeID, regionID, regeionname, schoolID, math, english, chinese, physics, chemistry, history, geography, political, biology, science, handler); | 221 | name, gradeID, regionID, regeionname, realName,address,schoolID, math, english, chinese, physics, chemistry, history, geography, political, biology, science, handler); |
220 | } | 222 | } |
221 | 223 | ||
222 | } catch (NumberFormatException e) { | 224 | } catch (NumberFormatException e) { |
223 | e.printStackTrace(); | 225 | e.printStackTrace(); |
224 | } | 226 | } |
225 | 227 | ||
226 | break; | 228 | break; |
227 | case R.id.cancel: | 229 | case R.id.cancel: |
228 | finish(); | 230 | finish(); |
229 | break; | 231 | break; |
230 | } | 232 | } |
231 | 233 | ||
232 | } | 234 | } |
233 | 235 | ||
234 | @Override | 236 | @Override |
235 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 237 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
236 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); | 238 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); |
237 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); | 239 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); |
238 | simpleDraweeView = (ImageView) view.findViewById(R.id.image_publish); | 240 | simpleDraweeView = (ImageView) view.findViewById(R.id.image_publish); |
239 | publish = (TextView) view.findViewById(R.id.tv_publish); | 241 | publish = (TextView) view.findViewById(R.id.tv_publish); |
240 | 242 | ||
241 | } | 243 | } |
242 | 244 | ||
243 | @Override | 245 | @Override |
244 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | 246 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { |
245 | String imageurl = data.get(position).getPressCover(); | 247 | String imageurl = data.get(position).getPressCover(); |
246 | String publishs = data.get(position).getPressName(); | 248 | String publishs = data.get(position).getPressName(); |
247 | if (imageurl!=null&&!imageurl.isEmpty()) { | 249 | if (imageurl!=null&&!imageurl.isEmpty()) { |
248 | Picasso.with(ChoiseTextBookActivity.this).load(imageurl).into(simpleDraweeView); | 250 | Picasso.with(ChoiseTextBookActivity.this).load(imageurl).into(simpleDraweeView); |
249 | } | 251 | } |
250 | publish.setText(publishs); | 252 | publish.setText(publishs); |
251 | String subject = SaveParam.getInstance().getLoginParam(this, SaveParam.SUBJECT); | 253 | String subject = SaveParam.getInstance().getLoginParam(this, SaveParam.SUBJECT); |
252 | Log.e("test", "选择的科目" + subject); | 254 | Log.e("test", "选择的科目" + subject); |
253 | if ("语文".equals(subject)) { | 255 | if ("语文".equals(subject)) { |
254 | chinese = publishs; | 256 | chinese = publishs; |
255 | } else if ("数学".equals(subject)) { | 257 | } else if ("数学".equals(subject)) { |
256 | math = publishs; | 258 | math = publishs; |
257 | } else if ("英语".equals(subject)) { | 259 | } else if ("英语".equals(subject)) { |
258 | english = publishs; | 260 | english = publishs; |
259 | } else if ("物理".equals(subject)) { | 261 | } else if ("物理".equals(subject)) { |
260 | physics = publishs; | 262 | physics = publishs; |
261 | } else if ("化学".equals(subject)) { | 263 | } else if ("化学".equals(subject)) { |
262 | chemistry = publishs; | 264 | chemistry = publishs; |
263 | } else if ("历史".equals(subject)) { | 265 | } else if ("历史".equals(subject)) { |
264 | history = publishs; | 266 | history = publishs; |
265 | } else if ("地理".equals(subject)) { | 267 | } else if ("地理".equals(subject)) { |
266 | geography = publishs; | 268 | geography = publishs; |
267 | } else if ("政治".equals(subject)) { | 269 | } else if ("政治".equals(subject)) { |
268 | political = publishs; | 270 | political = publishs; |
269 | } else if ("生物".equals(subject)) { | 271 | } else if ("生物".equals(subject)) { |
270 | biology = publishs; | 272 | biology = publishs; |
271 | } else if ("科学".equals(subject)) { | 273 | } else if ("科学".equals(subject)) { |
272 | science = publishs; | 274 | science = publishs; |
273 | } | 275 | } |
274 | 276 | ||
275 | } | 277 | } |
276 | } | 278 | } |
277 | 279 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardEditInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Dialog; | ||
3 | import android.content.Intent; | 4 | import android.content.Intent; |
4 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.os.Handler; | ||
7 | import android.os.Message; | ||
5 | import android.support.v4.app.FragmentActivity; | 8 | import android.support.v4.app.FragmentActivity; |
6 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
10 | import android.util.Log; | ||
11 | import android.view.LayoutInflater; | ||
7 | import android.view.View; | 12 | import android.view.View; |
13 | import android.view.ViewGroup; | ||
8 | import android.widget.Button; | 14 | import android.widget.Button; |
9 | import android.widget.EditText; | 15 | import android.widget.EditText; |
10 | import android.widget.ImageView; | 16 | import android.widget.ImageView; |
11 | import android.widget.LinearLayout; | 17 | import android.widget.LinearLayout; |
12 | import android.widget.TextView; | 18 | import android.widget.TextView; |
13 | 19 | ||
14 | import com.bigkoo.pickerview.TimePickerView; | 20 | import com.bigkoo.pickerview.TimePickerView; |
15 | import com.hjx.personalcenter.R; | 21 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 22 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
17 | import com.hjx.personalcenter.customdialog.CountryDialog; | 23 | import com.hjx.personalcenter.customdialog.CountryDialog; |
18 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 24 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
19 | import com.hjx.personalcenter.db.Content; | 25 | import com.hjx.personalcenter.db.Content; |
20 | import com.hjx.personalcenter.db.SaveParam; | 26 | import com.hjx.personalcenter.db.SaveParam; |
27 | import com.hjx.personalcenter.http.HttpCode; | ||
28 | import com.hjx.personalcenter.http.HttpManager; | ||
21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 29 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
22 | import com.hjx.personalcenter.model.CityInfo; | 30 | import com.hjx.personalcenter.model.CityInfo; |
23 | import com.hjx.personalcenter.model.CountyInfo; | 31 | import com.hjx.personalcenter.model.CountyInfo; |
32 | import com.hjx.personalcenter.model.PesonalInfo; | ||
24 | import com.hjx.personalcenter.model.ProvinceInfo; | 33 | import com.hjx.personalcenter.model.ProvinceInfo; |
25 | import com.hjx.personalcenter.util.AlertUtils; | 34 | import com.hjx.personalcenter.util.AlertUtils; |
35 | import com.hjx.personalcenter.util.BrithdayStar; | ||
26 | import com.hjx.personalcenter.util.GetDate; | 36 | import com.hjx.personalcenter.util.GetDate; |
37 | import com.squareup.picasso.Picasso; | ||
27 | 38 | ||
28 | import java.util.ArrayList; | 39 | import java.util.ArrayList; |
29 | 40 | ||
30 | /**填写保卡信息 熊巍 | 41 | /** |
42 | * 填写保卡信息 熊巍 | ||
31 | * Created by h on 2017/8/11. | 43 | * Created by h on 2017/8/11. |
32 | */ | 44 | */ |
33 | 45 | ||
34 | public class ElectronicCardEditInfoActivity extends FragmentActivity implements View.OnClickListener | 46 | public class ElectronicCardEditInfoActivity extends FragmentActivity implements View.OnClickListener |
35 | ,DialogCallBack.ProvincesCallBack | 47 | , DialogCallBack.ProvincesCallBack |
36 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ | 48 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack { |
37 | private LinearLayout lineL_buy_time; | 49 | private LinearLayout lineL_buy_time; |
38 | private TextView tv_buy_time,adress_shop,adress_custem; | 50 | private TextView adress_shop, adress_custem; |
39 | private EditText username,store,detalAdress,telphone; | 51 | private EditText username, store, detalAdress, telphone,et_salesperson_phone; |
40 | private TimePickerView pvTime; | 52 | private TimePickerView pvTime; |
41 | private Button btn_change_info; | 53 | private Button btn_change_info,cancel_btn,go_btn; |
42 | private ImageView iv_card_back,shop_adress,custom_adress; | 54 | private ImageView iv_card_back, shop_adress, custom_adress; |
55 | private Dialog salesDialog; | ||
43 | 56 | ||
44 | @Override | 57 | @Override |
45 | protected void onCreate(Bundle savedInstanceState) { | 58 | protected void onCreate(Bundle savedInstanceState) { |
46 | super.onCreate(savedInstanceState); | 59 | super.onCreate(savedInstanceState); |
47 | setContentView(R.layout.activity_electroniccard_info); | 60 | setContentView(R.layout.activity_electroniccard_info); |
48 | SysApplication.getInstance().addActivity(this); | 61 | SysApplication.getInstance().addActivity(this); |
49 | initView(); | 62 | initView(); |
50 | initData(); | 63 | initData(); |
51 | initLister(); | 64 | initLister(); |
52 | } | 65 | } |
53 | 66 | ||
54 | private void initView() { | 67 | private void initView() { |
55 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); | 68 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); |
56 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); | 69 | // tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); |
57 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); | 70 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); |
58 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); | 71 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); |
59 | username = (EditText) findViewById(R.id.et_edit_username); | 72 | username = (EditText) findViewById(R.id.et_edit_username); |
60 | store = (EditText) findViewById(R.id.et_edit_store); | 73 | store = (EditText) findViewById(R.id.et_edit_store); |
61 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); | 74 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); |
62 | telphone = (EditText) findViewById(R.id.et_edit_telphone); | 75 | telphone = (EditText) findViewById(R.id.et_edit_telphone); |
63 | btn_change_info = (Button) findViewById(R.id.btn_change_info); | 76 | btn_change_info = (Button) findViewById(R.id.btn_change_info); |
64 | iv_card_back = (ImageView) findViewById(R.id.iv_card_back); | 77 | iv_card_back = (ImageView) findViewById(R.id.iv_card_back); |
65 | shop_adress = (ImageView) findViewById(R.id.shopdizhi); | 78 | shop_adress = (ImageView) findViewById(R.id.shopdizhi); |
66 | custom_adress = (ImageView) findViewById(R.id.cunstomdizhi); | 79 | custom_adress = (ImageView) findViewById(R.id.cunstomdizhi); |
80 | et_salesperson_phone = (EditText) findViewById(R.id.et_salesperson_phone); | ||
67 | } | 81 | } |
68 | 82 | ||
69 | private void initData() { | 83 | private void initData() { |
70 | GetDate date = new GetDate(); | 84 | GetDate date = new GetDate(); |
71 | tv_buy_time.setText(date.getYMD().toString()); | 85 | // tv_buy_time.setText(date.getYMD().toString()); |
86 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | ||
87 | long id = Long.parseLong(userID); | ||
88 | //获取个人信息 | ||
89 | HttpManager.getInstance().getpresonalinfo(this, id, 1, handler); | ||
72 | 90 | ||
73 | } | 91 | } |
74 | 92 | ||
93 | Handler handler = new Handler() { | ||
94 | @Override | ||
95 | public void handleMessage(Message msg) { | ||
96 | super.handleMessage(msg); | ||
97 | switch (msg.what) { | ||
98 | case HttpCode.GETINFO: | ||
99 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; | ||
100 | username.setText(cardinfoBean.getRealName()); | ||
101 | adress_custem.setText(cardinfoBean.getRegion().getRegionName()); | ||
102 | detalAdress.setText(cardinfoBean.getAddress()); | ||
103 | break; | ||
104 | case HttpCode.SUCHCARDINFO: | ||
105 | Intent intent = new Intent(); | ||
106 | intent.putExtra(SaveParam.CARDPHONE,getIntent().getStringExtra(SaveParam.CARDPHONE)); | ||
107 | intent.putExtra(SaveParam.SALES_ID,msg.obj.toString()); | ||
108 | intent.putExtra(SaveParam.SALES_PHONE,et_salesperson_phone.getText().toString().trim()); | ||
109 | intent.setClass(ElectronicCardEditInfoActivity.this, ElectronicCardInfoOKActivity.class); | ||
110 | startActivity(intent); | ||
111 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
112 | break; | ||
113 | case HttpCode.NO_SALES_MAN: | ||
114 | showSwitchDialog(); | ||
115 | break; | ||
116 | } | ||
117 | } | ||
118 | }; | ||
119 | |||
75 | private void initLister() { | 120 | private void initLister() { |
76 | adress_shop.setOnClickListener(this); | 121 | adress_shop.setOnClickListener(this); |
77 | adress_custem.setOnClickListener(this); | 122 | adress_custem.setOnClickListener(this); |
78 | btn_change_info.setOnClickListener(this); | 123 | btn_change_info.setOnClickListener(this); |
79 | iv_card_back.setOnClickListener(this); | 124 | iv_card_back.setOnClickListener(this); |
80 | shop_adress.setOnClickListener(this); | 125 | shop_adress.setOnClickListener(this); |
81 | custom_adress.setOnClickListener(this); | 126 | custom_adress.setOnClickListener(this); |
82 | 127 | ||
83 | } | 128 | } |
84 | 129 | ||
130 | private void showSwitchDialog() { | ||
131 | //自定义部分 | ||
132 | LayoutInflater mInflater = LayoutInflater.from(this); | ||
133 | View dialogView = mInflater.inflate(R.layout.sales_dialog_layout, | ||
134 | null); | ||
135 | salesDialog = new Dialog(this, R.style.CustomHintDialog); | ||
136 | cancel_btn = (Button) dialogView.findViewById(R.id.cancel_btn); | ||
137 | go_btn = (Button) dialogView.findViewById(R.id.go_btn); | ||
138 | salesDialog.addContentView(dialogView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); | ||
139 | salesDialog.setCanceledOnTouchOutside(true); | ||
140 | salesDialog.show(); | ||
141 | cancel_btn.setOnClickListener(this); | ||
142 | go_btn.setOnClickListener(this); | ||
143 | } | ||
144 | |||
85 | @Override | 145 | @Override |
86 | public void onClick(View v) { | 146 | public void onClick(View v) { |
87 | switch (v.getId()){ | 147 | switch (v.getId()) { |
88 | case R.id.btn_change_info: | 148 | case R.id.btn_change_info: |
89 | String info1 =username.getText().toString().trim(); | 149 | String info1 = username.getText().toString().trim(); |
90 | String info2 =adress_custem.getText().toString().trim(); | 150 | String info2 = adress_custem.getText().toString().trim(); |
91 | String info3 =detalAdress.getText().toString().trim(); | 151 | String info3 = detalAdress.getText().toString().trim(); |
92 | String info4 =tv_buy_time.getText().toString().trim(); | 152 | // String info4 =tv_buy_time.getText().toString().trim(); |
93 | String info5 =adress_shop.getText().toString().trim(); | 153 | String info5 = adress_shop.getText().toString().trim(); |
94 | String info6 =store.getText().toString().trim(); | 154 | String info6 = store.getText().toString().trim(); |
95 | String info7 =telphone.getText().toString().trim(); | 155 | String info7 = telphone.getText().toString().trim(); |
96 | 156 | String info8 = et_salesperson_phone.getText().toString().trim(); | |
97 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2)||TextUtils.isEmpty(info3) | 157 | |
98 | ||TextUtils.isEmpty(info4)||TextUtils.isEmpty(info5)||TextUtils.isEmpty(info6) | 158 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2) || TextUtils.isEmpty(info3) |
99 | ||TextUtils.isEmpty(info7)) { | 159 | || TextUtils.isEmpty(info5) || TextUtils.isEmpty(info6) |
160 | || TextUtils.isEmpty(info7)) { | ||
100 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); | 161 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); |
101 | return; | 162 | return; |
102 | }else { | 163 | } else if(!TextUtils.isEmpty(info8) ){ |
164 | HttpManager.getInstance().checkSalesmanPhone(this,info8,handler); | ||
165 | savedata(); | ||
166 | } else{ | ||
103 | savedata(); | 167 | savedata(); |
104 | Intent intent = new Intent(); | 168 | Intent intent = new Intent(); |
105 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); | 169 | intent.putExtra(SaveParam.CARDPHONE,getIntent().getStringExtra(SaveParam.CARDPHONE)); |
170 | intent.setClass(ElectronicCardEditInfoActivity.this, ElectronicCardInfoOKActivity.class); | ||
106 | startActivity(intent); | 171 | startActivity(intent); |
107 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 172 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
108 | } | 173 | } |
109 | 174 | ||
110 | break; | 175 | break; |
111 | case R.id.tv_edit_adress_shop: | 176 | case R.id.tv_edit_adress_shop: |
112 | case R.id.shopdizhi: | 177 | case R.id.shopdizhi: |
113 | Content.adressflag =1; | 178 | Content.adressflag = 1; |
114 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 179 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
115 | 180 | ||
116 | break; | 181 | break; |
117 | case R.id.tv_edit_adress_custem: | 182 | case R.id.tv_edit_adress_custem: |
118 | case R.id.cunstomdizhi: | 183 | case R.id.cunstomdizhi: |
119 | Content.adressflag =2; | 184 | Content.adressflag = 2; |
120 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 185 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
121 | 186 | ||
122 | break; | 187 | break; |
123 | case R.id.iv_card_back: | 188 | case R.id.iv_card_back: |
124 | finish(); | 189 | finish(); |
125 | break; | 190 | break; |
191 | case R.id.cancel_btn: | ||
192 | salesDialog.cancel(); | ||
193 | break; | ||
194 | case R.id.go_btn: | ||
195 | salesDialog.cancel(); | ||
196 | Intent intent = new Intent(); | ||
197 | intent.putExtra(SaveParam.CARDPHONE,getIntent().getStringExtra(SaveParam.CARDPHONE)); | ||
198 | intent.setClass(ElectronicCardEditInfoActivity.this, ElectronicCardInfoOKActivity.class); | ||
199 | startActivity(intent); | ||
200 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
201 | break; | ||
126 | 202 | ||
127 | } | 203 | } |
128 | 204 | ||
129 | 205 | ||
130 | } | 206 | } |
207 | |||
131 | //保存数据 | 208 | //保存数据 |
132 | private void savedata() { | 209 | private void savedata() { |
133 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CUNSTEMNAME, username.getText().toString().trim()); | 210 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.CUNSTEMNAME, username.getText().toString().trim()); |
134 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim()+detalAdress.getText().toString().trim()); | 211 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim() + detalAdress.getText().toString().trim()); |
135 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); | 212 | // SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); |
136 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPADRESS, adress_shop.getText().toString().trim()+store.getText().toString().trim()); | 213 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.SHOPADRESS, adress_shop.getText().toString().trim() + store.getText().toString().trim()); |
137 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); | 214 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); |
215 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.SALES_PHONE, et_salesperson_phone.getText().toString().trim()); | ||
138 | 216 | ||
139 | } | 217 | } |
140 | 218 | ||
141 | @Override | 219 | @Override |
142 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 220 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
143 | String regionName = data.get(position).getRegionName(); | 221 | String regionName = data.get(position).getRegionName(); |
144 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 222 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); |
145 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 223 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); |
146 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 224 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
147 | if (Content.adressflag ==1){ | 225 | if (Content.adressflag == 1) { |
148 | adress_shop.setText(""); | 226 | adress_shop.setText(""); |
149 | adress_shop.setText(provice+regionName); | 227 | adress_shop.setText(provice + regionName); |
150 | }else { | 228 | } else { |
151 | adress_custem.setText(""); | 229 | adress_custem.setText(""); |
152 | adress_custem.setText(provice+regionName); | 230 | adress_custem.setText(provice + regionName); |
153 | } | 231 | } |
154 | 232 | ||
155 | } | 233 | } |
156 | 234 | ||
157 | @Override | 235 | @Override |
158 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 236 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
159 | String regionName = data.get(position).getRegionName(); | 237 | String regionName = data.get(position).getRegionName(); |
160 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 238 | int regionId = data.get(position).getRegionId(); |
161 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 239 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); |
162 | if (Content.adressflag ==1){ | 240 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); |
241 | if (Content.adressflag == 1) { | ||
163 | adress_shop.setText(""); | 242 | adress_shop.setText(""); |
164 | adress_shop.setText(provices+citys+regionName); | 243 | adress_shop.setText(provices + citys + regionName); |
165 | }else { | 244 | } else { |
166 | adress_custem.setText(""); | 245 | adress_custem.setText(""); |
167 | adress_custem.setText(provices+citys+regionName); | 246 | adress_custem.setText(provices + citys + regionName); |
168 | } | 247 | } |
169 | 248 | ||
170 | 249 | ||
171 | |||
172 | } | 250 | } |
173 | 251 | ||
174 | @Override | 252 | @Override |
175 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 253 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
176 | String regionName = data.get(position).getRegionName(); | 254 | String regionName = data.get(position).getRegionName(); |
177 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 255 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); |
178 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 256 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
179 | adress_custem.setText(""); | 257 | // adress_custem.setText(""); |
180 | adress_custem.setText(regionName); | 258 | // adress_custem.setText(regionName); |
181 | 259 | ||
182 | } | 260 | } |
183 | } | 261 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardInfoOKActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.v4.app.FragmentActivity; | 4 | import android.support.v4.app.FragmentActivity; |
5 | import android.view.KeyEvent; | 5 | import android.view.KeyEvent; |
6 | import android.view.View; | 6 | import android.view.View; |
7 | import android.widget.Button; | 7 | import android.widget.Button; |
8 | import android.widget.ImageView; | 8 | import android.widget.ImageView; |
9 | import android.widget.LinearLayout; | ||
9 | import android.widget.TextView; | 10 | import android.widget.TextView; |
11 | import android.widget.Toast; | ||
10 | 12 | ||
11 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
12 | import com.hjx.personalcenter.db.Content; | 14 | import com.hjx.personalcenter.db.Content; |
13 | import com.hjx.personalcenter.db.SaveParam; | 15 | import com.hjx.personalcenter.db.SaveParam; |
14 | import com.hjx.personalcenter.http.HttpManager; | 16 | import com.hjx.personalcenter.http.HttpManager; |
15 | import com.hjx.personalcenter.util.GetDevicesUtil; | 17 | import com.hjx.personalcenter.util.GetDevicesUtil; |
16 | 18 | ||
17 | /**确认保卡信息 | 19 | /**确认保卡信息 |
18 | * Created by h on 2017/8/11. | 20 | * Created by h on 2017/8/11. |
19 | */ | 21 | */ |
20 | 22 | ||
21 | public class ElectronicCardInfoOKActivity extends FragmentActivity implements View.OnClickListener { | 23 | public class ElectronicCardInfoOKActivity extends FragmentActivity implements View.OnClickListener { |
22 | private Button btn_finish,btn_bangding; | 24 | private Button btn_finish,btn_bangding; |
23 | private ImageView iv_last_step; | 25 | private ImageView iv_last_step; |
24 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; | 26 | private TextView usename,deviceModel,customer_address,mac_adress,deviceNumber,shopadress,phone,tlePhone,tv_salesperson_phone; |
27 | private LinearLayout salesperson_phone_layout; | ||
28 | private String salesId; | ||
25 | @Override | 29 | @Override |
26 | protected void onCreate(Bundle savedInstanceState) { | 30 | protected void onCreate(Bundle savedInstanceState) { |
27 | super.onCreate(savedInstanceState); | 31 | super.onCreate(savedInstanceState); |
28 | setContentView(R.layout.activity_ok_cardinfo); | 32 | setContentView(R.layout.activity_ok_cardinfo); |
29 | SysApplication.getInstance().addActivity(this); | 33 | SysApplication.getInstance().addActivity(this); |
30 | initView(); | 34 | initView(); |
31 | initData(); | 35 | initData(); |
32 | initLister(); | 36 | initLister(); |
33 | } | 37 | } |
34 | private void initView() { | 38 | private void initView() { |
35 | btn_finish = (Button) findViewById(R.id.btn_finish); | 39 | btn_finish = (Button) findViewById(R.id.btn_finish); |
36 | iv_last_step = (ImageView) findViewById(R.id.cancel); | 40 | iv_last_step = (ImageView) findViewById(R.id.cancel); |
37 | usename = (TextView) findViewById(R.id.iv_card_username); | 41 | usename = (TextView) findViewById(R.id.iv_card_username); |
38 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 42 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
39 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 43 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
40 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 44 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
41 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 45 | // shoptime = (TextView) findViewById(R.id.tv_card_time); |
42 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 46 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
43 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 47 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
44 | phone = (TextView) findViewById(R.id.tv_card_phone); | 48 | phone = (TextView) findViewById(R.id.tv_card_phone); |
45 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 49 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
46 | btn_bangding = (Button) findViewById(R.id.btn_bangding); | 50 | btn_bangding = (Button) findViewById(R.id.btn_bangding); |
51 | tv_salesperson_phone = (TextView) findViewById(R.id.tv_salesperson_phone); | ||
52 | salesperson_phone_layout = (LinearLayout) findViewById(R.id.salesperson_phone_layout); | ||
47 | } | 53 | } |
48 | 54 | ||
49 | private void initData() { | 55 | private void initData() { |
56 | salesId=getIntent().getStringExtra(SaveParam.SALES_ID); | ||
57 | |||
50 | //获取设备信息 | 58 | //获取设备信息 |
51 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 59 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
52 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 60 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
53 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 61 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
54 | //获取保卡信息 | 62 | //获取保卡信息 |
55 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | 63 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); |
56 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | 64 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); |
57 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | 65 | // shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); |
58 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | 66 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); |
59 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | 67 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); |
60 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | 68 | phone.setText(getIntent().getStringExtra(SaveParam.CARDPHONE)); |
61 | 69 | if (salesId != null && !salesId.isEmpty()) { | |
70 | tv_salesperson_phone.setText(getIntent().getStringExtra(SaveParam.SALES_PHONE)); | ||
71 | }else{ | ||
72 | salesperson_phone_layout.setVisibility(View.INVISIBLE); | ||
73 | } | ||
62 | 74 | ||
63 | } | 75 | } |
64 | 76 | ||
65 | private void initLister() { | 77 | private void initLister() { |
66 | iv_last_step.setOnClickListener(this); | 78 | iv_last_step.setOnClickListener(this); |
67 | btn_finish.setOnClickListener(this); | 79 | btn_finish.setOnClickListener(this); |
68 | btn_bangding.setOnClickListener(this); | 80 | btn_bangding.setOnClickListener(this); |
69 | } | 81 | } |
70 | 82 | ||
71 | @Override | 83 | @Override |
72 | public void onClick(View v) { | 84 | public void onClick(View v) { |
73 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 85 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
74 | long auserID = 0; | 86 | long auserID = 0; |
75 | switch (v.getId()){ | 87 | switch (v.getId()){ |
76 | case R.id.btn_finish: | 88 | case R.id.btn_finish: |
77 | Content.cardintentflag =1; | 89 | Content.cardintentflag =1; |
78 | try { | 90 | try { |
79 | auserID = Long.parseLong(userID); | 91 | auserID = Long.parseLong(userID); |
80 | } catch (NumberFormatException e) { | 92 | } catch (NumberFormatException e) { |
81 | e.printStackTrace(); | 93 | e.printStackTrace(); |
82 | } | 94 | } |
95 | |||
83 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), | 96 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), |
84 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), | 97 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), |
85 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), | 98 | tlePhone.getText().toString().trim(), |
86 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), | 99 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), |
87 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | 100 | mac_adress.getText().toString().trim(),phone.getText().toString().trim(), |
101 | SaveParam.getInstance().getsaveCityParam(this,SaveParam.COUNTRY), salesId); | ||
88 | break; | 102 | break; |
89 | case R.id.btn_bangding: | 103 | case R.id.btn_bangding: |
90 | Content.cardintentflag =2; | 104 | Content.cardintentflag =2; |
91 | try { | 105 | try { |
92 | auserID = Long.parseLong(userID); | 106 | auserID = Long.parseLong(userID); |
93 | } catch (NumberFormatException e) { | 107 | } catch (NumberFormatException e) { |
94 | e.printStackTrace(); | 108 | e.printStackTrace(); |
95 | } | 109 | } |
96 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), | 110 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), |
97 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), | 111 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), |
98 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), | 112 | tlePhone.getText().toString().trim(), |
99 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), | 113 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), |
100 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | 114 | mac_adress.getText().toString().trim(),phone.getText().toString().trim(), |
115 | SaveParam.getInstance().getsaveCityParam(this,SaveParam.COUNTRY),salesId); | ||
101 | 116 | ||
102 | break; | 117 | break; |
103 | case R.id.cancel: | 118 | case R.id.cancel: |
104 | finish(); | 119 | finish(); |
105 | break; | 120 | break; |
106 | } | 121 | } |
107 | } | 122 | } |
108 | @Override | 123 | // @Override |
109 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 124 | // public boolean onKeyDown(int keyCode, KeyEvent event) { |
110 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 125 | // if (keyCode == KeyEvent.KEYCODE_BACK) { |
111 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardInfoOKActivity.this,SaveParam.CARDPHONE,""); | 126 | // SaveParam.getInstance().saveCustomizeParam(ElectronicCardInfoOKActivity.this,SaveParam.CARDPHONE,""); |
112 | return false;//return true;拦截事件传递,从而屏蔽back键。 | 127 | // return false;//return true;拦截事件传递,从而屏蔽back键。 |
113 | } | 128 | // } |
114 | if (KeyEvent.KEYCODE_HOME == keyCode) { | 129 | // if (KeyEvent.KEYCODE_HOME == keyCode) { |
115 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardInfoOKActivity.this,SaveParam.CARDPHONE,""); | 130 | // SaveParam.getInstance().saveCustomizeParam(ElectronicCardInfoOKActivity.this,SaveParam.CARDPHONE,""); |
116 | return false;//同理 | 131 | // return false;//同理 |
117 | } | 132 | // } |
118 | return super.onKeyDown(keyCode, event); | 133 | // return super.onKeyDown(keyCode, event); |
119 | } | 134 | // } |
120 | 135 | ||
121 | } | 136 | } |
122 | 137 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardLookInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Build; | ||
4 | import android.os.Bundle; | 5 | import android.os.Bundle; |
5 | import android.os.Handler; | 6 | import android.os.Handler; |
6 | import android.os.Message; | 7 | import android.os.Message; |
7 | import android.support.v4.app.FragmentActivity; | 8 | import android.support.v4.app.FragmentActivity; |
8 | import android.view.View; | 9 | import android.view.View; |
9 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
10 | import android.widget.TextView; | 11 | import android.widget.TextView; |
11 | 12 | ||
12 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
13 | import com.hjx.personalcenter.db.Content; | 14 | import com.hjx.personalcenter.db.Content; |
14 | import com.hjx.personalcenter.db.SaveParam; | 15 | import com.hjx.personalcenter.db.SaveParam; |
15 | import com.hjx.personalcenter.http.HttpCode; | 16 | import com.hjx.personalcenter.http.HttpCode; |
16 | import com.hjx.personalcenter.http.HttpManager; | 17 | import com.hjx.personalcenter.http.HttpManager; |
17 | import com.hjx.personalcenter.model.CardInfo; | 18 | import com.hjx.personalcenter.model.CardInfo; |
18 | import com.hjx.personalcenter.util.AlertUtils; | 19 | import com.hjx.personalcenter.util.AlertUtils; |
19 | import com.hjx.personalcenter.util.GetDevicesUtil; | 20 | import com.hjx.personalcenter.util.GetDevicesUtil; |
20 | 21 | ||
21 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
22 | 23 | ||
23 | /** | 24 | /** |
24 | * Created by h on 2017/8/11. | 25 | * Created by h on 2017/8/11. |
25 | */ | 26 | */ |
26 | 27 | ||
27 | public class ElectronicCardLookInfoActivity extends FragmentActivity implements View.OnClickListener { | 28 | public class ElectronicCardLookInfoActivity extends FragmentActivity implements View.OnClickListener { |
28 | private ImageView iv_last_step; | 29 | private ImageView iv_last_step; |
29 | private TextView usename, deviceModel, customer_address, mac_adress, shoptime, deviceNumber, | 30 | private TextView usename, deviceModel, customer_address, mac_adress, shoptime, deviceNumber, |
30 | shopadress, phone, tlePhone, tv_card_adress_change, tv_card_phone_change; | 31 | shopadress, phone, tlePhone, tv_card_adress_change, tv_card_phone_change,service_phone; |
31 | private ArrayList<CardInfo.DataBean> data = new ArrayList<>(); | 32 | private ArrayList<CardInfo.DataBean> data = new ArrayList<>(); |
32 | 33 | ||
33 | Handler handler = new Handler() { | 34 | Handler handler = new Handler() { |
34 | @Override | 35 | @Override |
35 | public void handleMessage(Message msg) { | 36 | public void handleMessage(Message msg) { |
36 | super.handleMessage(msg); | 37 | super.handleMessage(msg); |
37 | switch (msg.what) { | 38 | switch (msg.what) { |
38 | 39 | ||
39 | case HttpCode.SUCHCARDINFO: | 40 | case HttpCode.SUCHCARDINFO: |
40 | CardInfo.DataBean cardinfoBean = (CardInfo.DataBean) msg.obj; | 41 | CardInfo.DataBean cardinfoBean = (CardInfo.DataBean) msg.obj; |
41 | if (cardinfoBean != null) { | 42 | if (cardinfoBean != null) { |
42 | //获取设备信息 | 43 | //获取设备信息 |
43 | deviceModel.setText(cardinfoBean.getProductModel()); | 44 | deviceModel.setText(cardinfoBean.getProductModel()); |
44 | deviceNumber.setText(cardinfoBean.getDeviceNumber()); | 45 | deviceNumber.setText(cardinfoBean.getDeviceNumber()); |
45 | mac_adress.setText(cardinfoBean.getMacAddress()); | 46 | mac_adress.setText(cardinfoBean.getMacAddress()); |
46 | //获取保卡信息 | 47 | //获取保卡信息 |
47 | usename.setText(cardinfoBean.getCustomerName()); | 48 | usename.setText(cardinfoBean.getCustomerName()); |
48 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.CUNSTEMNAME, cardinfoBean.getCustomerName()); | 49 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.CUNSTEMNAME, cardinfoBean.getCustomerName()); |
49 | customer_address.setText(cardinfoBean.getCustomerAddress()); | 50 | customer_address.setText(cardinfoBean.getCustomerAddress()); |
50 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.ADRESSCUNSTEM, cardinfoBean.getCustomerAddress()); | 51 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.ADRESSCUNSTEM, cardinfoBean.getCustomerAddress()); |
51 | shoptime.setText(cardinfoBean.getBuyTime()); | 52 | shoptime.setText(cardinfoBean.getBuyTime()); |
52 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPTIME, cardinfoBean.getBuyTime()); | 53 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPTIME, cardinfoBean.getBuyTime()); |
53 | shopadress.setText(cardinfoBean.getBuyAddress()); | 54 | shopadress.setText(cardinfoBean.getBuyAddress()); |
54 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPADRESS, cardinfoBean.getBuyAddress()); | 55 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPADRESS, cardinfoBean.getBuyAddress()); |
55 | tlePhone.setText(cardinfoBean.getAlterSaleCall()); | 56 | tlePhone.setText(cardinfoBean.getAlterSaleCall()); |
56 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPTLEPHONE, cardinfoBean.getMobilePhone()); | 57 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPTLEPHONE, cardinfoBean.getMobilePhone()); |
57 | phone.setText(cardinfoBean.getMobilePhone()); | 58 | phone.setText(cardinfoBean.getMobilePhone()); |
58 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.CARDPHONE, cardinfoBean.getMobilePhone() ); | 59 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.CARDPHONE, cardinfoBean.getMobilePhone() ); |
59 | initData(); | 60 | initData(); |
60 | }else { | 61 | }else { |
61 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"您的机器还没有保卡信息,请重新登录"); | 62 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"您的机器还没有保卡信息,请重新登录"); |
62 | } | 63 | } |
63 | 64 | ||
64 | break; | 65 | break; |
65 | 66 | ||
66 | } | 67 | } |
67 | 68 | ||
68 | } | 69 | } |
69 | }; | 70 | }; |
70 | 71 | ||
71 | @Override | 72 | @Override |
72 | protected void onCreate(Bundle savedInstanceState) { | 73 | protected void onCreate(Bundle savedInstanceState) { |
73 | super.onCreate(savedInstanceState); | 74 | super.onCreate(savedInstanceState); |
74 | setContentView(R.layout.activity_electronic_look_cardinfo); | 75 | setContentView(R.layout.activity_electronic_look_cardinfo); |
75 | initView(); | 76 | initView(); |
76 | initData(); | 77 | initData(); |
77 | initLister(); | 78 | initLister(); |
78 | } | 79 | } |
79 | 80 | ||
80 | @Override | 81 | @Override |
81 | protected void onResume() { | 82 | protected void onResume() { |
82 | super.onResume(); | 83 | super.onResume(); |
83 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ElectronicCardLookInfoActivity.this).getDeviceNumber(); | 84 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ElectronicCardLookInfoActivity.this).getDeviceNumber(); |
84 | HttpManager.getInstance().getcardinfo(this, deviceNumber, handler); | 85 | HttpManager.getInstance().getcardinfo(this, deviceNumber, handler); |
85 | } | 86 | } |
86 | 87 | ||
87 | private void initView() { | 88 | private void initView() { |
88 | usename = (TextView) findViewById(R.id.iv_card_username); | 89 | usename = (TextView) findViewById(R.id.iv_card_username); |
89 | iv_last_step = (ImageView) findViewById(R.id.cancel); | 90 | iv_last_step = (ImageView) findViewById(R.id.cancel); |
90 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 91 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
91 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 92 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
92 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 93 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
93 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 94 | shoptime = (TextView) findViewById(R.id.tv_card_time); |
94 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 95 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
95 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 96 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
96 | phone = (TextView) findViewById(R.id.tv_card_phone); | 97 | phone = (TextView) findViewById(R.id.tv_card_phone); |
97 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 98 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
98 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); | 99 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); |
99 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); | 100 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); |
101 | service_phone = (TextView) findViewById(R.id.service_phone); | ||
102 | if(Build.MODEL.equals("T5 PLUS")) | ||
103 | service_phone.setText("400-158-8738") ; | ||
104 | else | ||
105 | service_phone.setText("400-800-3813"); | ||
106 | |||
100 | } | 107 | } |
101 | 108 | ||
102 | private void initData() { | 109 | private void initData() { |
103 | 110 | ||
104 | // //获取设备信息 | 111 | // //获取设备信息 |
105 | // deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 112 | // deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
106 | // deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 113 | // deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
107 | // mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 114 | // mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
108 | // //获取保卡信息 | 115 | // //获取保卡信息 |
109 | // usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | 116 | // usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); |
110 | // customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | 117 | // customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); |
111 | // shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | 118 | // shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); |
112 | // shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | 119 | // shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); |
113 | // tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | 120 | // tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); |
114 | // phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | 121 | // phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); |
115 | 122 | ||
116 | 123 | ||
117 | } | 124 | } |
118 | 125 | ||
119 | private void initLister() { | 126 | private void initLister() { |
120 | tv_card_adress_change.setOnClickListener(this); | 127 | tv_card_adress_change.setOnClickListener(this); |
121 | tv_card_phone_change.setOnClickListener(this); | 128 | tv_card_phone_change.setOnClickListener(this); |
122 | iv_last_step.setOnClickListener(this); | 129 | iv_last_step.setOnClickListener(this); |
123 | } | 130 | } |
124 | 131 | ||
125 | @Override | 132 | @Override |
126 | public void onClick(View v) { | 133 | public void onClick(View v) { |
127 | switch (v.getId()) { | 134 | switch (v.getId()) { |
128 | case R.id.tv_card_adress_change: | 135 | case R.id.tv_card_adress_change: |
129 | Intent intent = new Intent(); | 136 | Intent intent = new Intent(); |
130 | intent.setClass(this, ChangeElectronicCardAdressInfoActivity.class); | 137 | intent.setClass(this, ChangeElectronicCardAdressInfoActivity.class); |
131 | startActivity(intent); | 138 | startActivity(intent); |
132 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 139 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
133 | 140 | ||
134 | break; | 141 | break; |
135 | case R.id.tv_card_phone_change: | 142 | case R.id.tv_card_phone_change: |
136 | Content.authcodeflag = 2; | 143 | Content.authcodeflag = 2; |
137 | Intent intent1 = new Intent(); | 144 | Intent intent1 = new Intent(); |
138 | intent1.setClass(this, ElectronicCardValidationActivity.class); | 145 | intent1.setClass(this, ElectronicCardValidationActivity.class); |
139 | startActivity(intent1); | 146 | startActivity(intent1); |
140 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 147 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
141 | 148 | ||
142 | 149 | ||
143 | break; | 150 | break; |
144 | case R.id.cancel: | 151 | case R.id.cancel: |
145 | finish(); | 152 | finish(); |
146 | break; | 153 | break; |
147 | } | 154 | } |
148 | } | 155 | } |
149 | 156 | ||
150 | } | 157 | } |
151 | 158 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardValidationActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Build; | ||
4 | import android.os.Bundle; | 5 | import android.os.Bundle; |
5 | import android.os.Handler; | 6 | import android.os.Handler; |
6 | import android.os.Message; | 7 | import android.os.Message; |
7 | import android.support.v4.app.FragmentActivity; | 8 | import android.support.v4.app.FragmentActivity; |
9 | import android.text.Editable; | ||
8 | import android.text.TextUtils; | 10 | import android.text.TextUtils; |
11 | import android.text.TextWatcher; | ||
9 | import android.view.View; | 12 | import android.view.View; |
10 | import android.widget.Button; | 13 | import android.widget.Button; |
11 | import android.widget.EditText; | 14 | import android.widget.EditText; |
15 | import android.widget.ImageButton; | ||
12 | import android.widget.ImageView; | 16 | import android.widget.ImageView; |
17 | import android.widget.LinearLayout; | ||
13 | import android.widget.TextView; | 18 | import android.widget.TextView; |
14 | 19 | ||
15 | import com.hjx.personalcenter.R; | 20 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.db.Content; | 21 | import com.hjx.personalcenter.db.Content; |
17 | import com.hjx.personalcenter.db.SaveParam; | 22 | import com.hjx.personalcenter.db.SaveParam; |
18 | import com.hjx.personalcenter.http.HttpCode; | 23 | import com.hjx.personalcenter.http.HttpCode; |
19 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
20 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
21 | import com.hjx.personalcenter.util.GetDevicesUtil; | 26 | import com.hjx.personalcenter.util.GetDevicesUtil; |
22 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 27 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
23 | 28 | ||
29 | import org.json.JSONException; | ||
24 | import org.json.JSONObject; | 30 | import org.json.JSONObject; |
25 | 31 | ||
26 | import java.util.TimerTask; | 32 | import java.util.TimerTask; |
27 | 33 | ||
28 | /** | 34 | /** |
29 | * Created by h on 2017/8/9. | 35 | * Created by h on 2017/8/9. |
30 | */ | 36 | */ |
31 | 37 | ||
32 | public class ElectronicCardValidationActivity extends FragmentActivity implements View.OnClickListener { | 38 | public class ElectronicCardValidationActivity extends FragmentActivity implements View.OnClickListener { |
33 | private Button btn_card_valiyanzhen,get_authcode; | 39 | private Button btn_card_valiyanzhen, get_authcode; |
34 | private EditText phonenumber,anth_6num;//;//密码 | 40 | private EditText phonenumber, anth_6num, activation_code;//;//密码 |
41 | private ImageButton phone_delete_btn, code_delete_btn, activation_code_delete_btn; | ||
35 | private TextView menu_title; | 42 | private TextView menu_title; |
36 | private ImageView cancel; | 43 | private ImageView cancel; |
37 | private int delayTime=60; | 44 | private int delayTime = 60; |
45 | private LinearLayout rl_authcode, activation_code_layout; | ||
38 | private java.util.Timer Delaytimer; | 46 | private java.util.Timer Delaytimer; |
39 | private String sourceStr ="android"; | 47 | private String sourceStr = "android"; |
40 | private String typeStr = "general"; | 48 | private String typeStr = "general"; |
41 | String authcode = ""; | 49 | String authcode = ""; |
42 | Handler handler = new Handler() { | 50 | Handler handler = new Handler() { |
43 | @Override | 51 | @Override |
44 | public void handleMessage(Message msg) { | 52 | public void handleMessage(Message msg) { |
45 | super.handleMessage(msg); | 53 | super.handleMessage(msg); |
46 | JSONObject jsonObject; | 54 | JSONObject jsonObject; |
47 | String status; | 55 | String status; |
48 | switch (msg.what) { | 56 | switch (msg.what) { |
49 | case HttpCode.AUTHCODE_SUCESS: | 57 | case HttpCode.AUTHCODE_SUCESS: |
50 | jsonObject = (JSONObject) msg.obj; | 58 | jsonObject = (JSONObject) msg.obj; |
51 | status = jsonObject.optString("status"); | 59 | status = jsonObject.optString("status"); |
52 | authcode = jsonObject.optString("jsessionid"); | 60 | authcode = jsonObject.optString("jsessionid"); |
53 | if (status.equals("100")) { | 61 | if (status.equals("100")) { |
54 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); | 62 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); |
55 | } | 63 | } |
56 | 64 | ||
57 | break; | 65 | break; |
58 | case HttpCode.AUTHCODE_FAIL: | 66 | case HttpCode.AUTHCODE_FAIL: |
59 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); | 67 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); |
60 | break; | 68 | break; |
61 | case 21: | 69 | case 21: |
62 | if(delayTime<=0){ | 70 | if (delayTime <= 0) { |
63 | if(Delaytimer!=null){ | 71 | if (Delaytimer != null) { |
64 | Delaytimer.cancel(); | 72 | Delaytimer.cancel(); |
65 | } | ||
66 | get_authcode.setEnabled(true); | ||
67 | get_authcode.setClickable(true); | ||
68 | get_authcode.setText("获取验证码"); | ||
69 | delayTime=60; | ||
70 | }else{ | ||
71 | get_authcode.setEnabled(false); | ||
72 | get_authcode.setClickable(false); | ||
73 | get_authcode.setText(delayTime + " s"); | ||
74 | } | 73 | } |
75 | break; | 74 | get_authcode.setEnabled(true); |
76 | } | 75 | get_authcode.setClickable(true); |
76 | get_authcode.setText("获取验证码"); | ||
77 | delayTime = 60; | ||
78 | } else { | ||
79 | get_authcode.setEnabled(false); | ||
80 | get_authcode.setClickable(false); | ||
81 | get_authcode.setText(delayTime + " s"); | ||
82 | } | ||
83 | break; | ||
84 | case HttpCode.ACTIVATION_SUCCESS: | ||
85 | jsonObject = (JSONObject) msg.obj; | ||
86 | status = jsonObject.optString("status"); | ||
87 | if(status.equals("1")){ | ||
88 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "激活成功"); | ||
89 | String phone = phonenumber.getText().toString().trim(); | ||
90 | Intent intent = new Intent(); | ||
91 | intent.putExtra(SaveParam.CARDPHONE, phone); | ||
92 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | ||
93 | startActivity(intent); | ||
94 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
95 | }else if(status.equals("5001")){ | ||
96 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "激活码无效"); | ||
97 | }else if(status.equals("0")){ | ||
98 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "无法链接到服务器,请检查您的网络或稍后重试"); | ||
99 | } | ||
100 | break; | ||
101 | } | ||
77 | } | 102 | } |
78 | }; | 103 | }; |
104 | |||
79 | @Override | 105 | @Override |
80 | protected void onCreate(Bundle savedInstanceState) { | 106 | protected void onCreate(Bundle savedInstanceState) { |
81 | super.onCreate(savedInstanceState); | 107 | super.onCreate(savedInstanceState); |
82 | setContentView(R.layout.activity_electroniccard_validation); | 108 | setContentView(R.layout.activity_electroniccard_validation); |
83 | SysApplication.getInstance().addActivity(this); | 109 | SysApplication.getInstance().addActivity(this); |
84 | initView(); | 110 | initView(); |
85 | initData(); | 111 | initData(); |
86 | initLister(); | 112 | initLister(); |
113 | initTextWatch(); | ||
87 | } | 114 | } |
88 | 115 | ||
89 | private void initView() { | 116 | private void initView() { |
90 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); | 117 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); |
91 | get_authcode = (Button) findViewById(R.id.btn_authcode); | 118 | get_authcode = (Button) findViewById(R.id.btn_authcode); |
92 | anth_6num = (EditText) findViewById(R.id.et_authcode); | 119 | anth_6num = (EditText) findViewById(R.id.et_authcode); |
93 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); | 120 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); |
121 | activation_code = (EditText) findViewById(R.id.activation_code); | ||
94 | menu_title = (TextView) findViewById(R.id.menu_title); | 122 | menu_title = (TextView) findViewById(R.id.menu_title); |
95 | cancel = (ImageView) findViewById(R.id.cancel); | 123 | cancel = (ImageView) findViewById(R.id.cancel); |
124 | code_delete_btn = (ImageButton) findViewById(R.id.code_delete_btn); | ||
125 | phone_delete_btn = (ImageButton) findViewById(R.id.phone_delete_btn); | ||
126 | activation_code_delete_btn = (ImageButton) findViewById(R.id.activation_code_delete_btn); | ||
127 | rl_authcode = (LinearLayout) findViewById(R.id.rl_authcode); | ||
128 | activation_code_layout = (LinearLayout) findViewById(R.id.activation_code_layout); | ||
96 | } | 129 | } |
97 | 130 | ||
98 | private void initData() { | 131 | private void initData() { |
99 | if (Content.authcodeflag==1){ | 132 | phonenumber.setText(SaveParam.getInstance().getLoginParam(this, "username")); |
133 | if (Content.authcodeflag == 1) { | ||
100 | menu_title.setText("更换绑定"); | 134 | menu_title.setText("更换绑定"); |
101 | btn_card_valiyanzhen.setText("确定"); | 135 | btn_card_valiyanzhen.setText("确定"); |
102 | 136 | phonenumber.setText(""); | |
103 | }else if (Content.authcodeflag==2){ | 137 | rl_authcode.setVisibility(View.VISIBLE); |
138 | } else if (Content.authcodeflag == 2) { | ||
104 | menu_title.setText("修改保卡信息"); | 139 | menu_title.setText("修改保卡信息"); |
105 | btn_card_valiyanzhen.setText("确定"); | 140 | btn_card_valiyanzhen.setText("确定"); |
106 | 141 | rl_authcode.setVisibility(View.VISIBLE); | |
107 | }else { | 142 | anth_6num.requestFocus(); |
108 | menu_title.setText("填写保卡信息"); | 143 | } else { |
144 | if (Build.MODEL.toUpperCase().equals("T5 PLUS")) {//T5 PLUS需要输入注册激活码 | ||
145 | menu_title.setText("激活机器并确认绑定保卡的手机号"); | ||
146 | activation_code_layout.setVisibility(View.VISIBLE); | ||
147 | } else { | ||
148 | menu_title.setText("确认绑定保卡的手机号"); | ||
149 | activation_code_layout.setVisibility(View.GONE); | ||
150 | } | ||
109 | btn_card_valiyanzhen.setText("下一步"); | 151 | btn_card_valiyanzhen.setText("下一步"); |
152 | anth_6num.requestFocus(); | ||
110 | } | 153 | } |
111 | 154 | ||
112 | 155 | ||
113 | |||
114 | } | 156 | } |
115 | 157 | ||
116 | private void initLister() { | 158 | private void initLister() { |
117 | get_authcode.setOnClickListener(this); | 159 | get_authcode.setOnClickListener(this); |
118 | btn_card_valiyanzhen.setOnClickListener(this); | 160 | btn_card_valiyanzhen.setOnClickListener(this); |
119 | cancel.setOnClickListener(this); | 161 | cancel.setOnClickListener(this); |
162 | phone_delete_btn.setOnClickListener(this); | ||
163 | code_delete_btn.setOnClickListener(this); | ||
164 | activation_code_delete_btn.setOnClickListener(this); | ||
165 | |||
166 | } | ||
167 | |||
168 | /** | ||
169 | * 输入框改变的监听 | ||
170 | */ | ||
171 | private void initTextWatch() { | ||
172 | phonenumber.addTextChangedListener(new TextWatcher() { | ||
173 | @Override | ||
174 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
175 | } | ||
176 | |||
177 | @Override | ||
178 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
179 | if (s.toString().length() == 0) { | ||
180 | phone_delete_btn.setVisibility(View.INVISIBLE); | ||
181 | } else { | ||
182 | phone_delete_btn.setVisibility(View.VISIBLE); | ||
183 | } | ||
184 | if (Build.MODEL.toUpperCase().equals("T5 PLUS")) { | ||
185 | if (!menu_title.getText().toString().equals("激活机器并确认绑定保卡的手机号") || s.toString().length() == 0 || !s.toString().equals(SaveParam.getInstance().getLoginParam(ElectronicCardValidationActivity.this, "username"))) { | ||
186 | rl_authcode.setVisibility(View.VISIBLE); | ||
187 | } else { | ||
188 | rl_authcode.setVisibility(View.GONE); | ||
189 | } | ||
190 | } else { | ||
191 | if (!menu_title.getText().toString().equals("确认绑定保卡的手机号") || s.toString().length() == 0 || !s.toString().equals(SaveParam.getInstance().getLoginParam(ElectronicCardValidationActivity.this, "username"))) { | ||
192 | rl_authcode.setVisibility(View.VISIBLE); | ||
193 | } else { | ||
194 | rl_authcode.setVisibility(View.GONE); | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | |||
199 | @Override | ||
200 | public void afterTextChanged(Editable s) { | ||
201 | |||
202 | } | ||
203 | }); | ||
204 | phonenumber.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
205 | @Override | ||
206 | public void onFocusChange(View v, boolean hasFocus) { | ||
207 | if (hasFocus) { | ||
208 | if (!phonenumber.getText().toString().isEmpty()) { | ||
209 | phone_delete_btn.setVisibility(View.VISIBLE); | ||
210 | } | ||
211 | } else { | ||
212 | |||
213 | phone_delete_btn.setVisibility(View.INVISIBLE); | ||
214 | } | ||
215 | } | ||
216 | }); | ||
217 | anth_6num.addTextChangedListener(new TextWatcher() { | ||
218 | @Override | ||
219 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
220 | |||
221 | } | ||
120 | 222 | ||
223 | @Override | ||
224 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
225 | if (s.toString().length() == 0) { | ||
226 | |||
227 | code_delete_btn.setVisibility(View.INVISIBLE); | ||
228 | } else { | ||
229 | code_delete_btn.setVisibility(View.VISIBLE); | ||
230 | } | ||
231 | } | ||
232 | |||
233 | @Override | ||
234 | public void afterTextChanged(Editable s) { | ||
235 | |||
236 | } | ||
237 | }); | ||
238 | anth_6num.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
239 | @Override | ||
240 | public void onFocusChange(View v, boolean hasFocus) { | ||
241 | if (hasFocus) { | ||
242 | if (!anth_6num.getText().toString().isEmpty()) { | ||
243 | code_delete_btn.setVisibility(View.VISIBLE); | ||
244 | } | ||
245 | } else { | ||
246 | code_delete_btn.setVisibility(View.INVISIBLE); | ||
247 | } | ||
248 | } | ||
249 | }); | ||
250 | activation_code.addTextChangedListener(new TextWatcher() { | ||
251 | @Override | ||
252 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
253 | |||
254 | } | ||
255 | |||
256 | @Override | ||
257 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
258 | if (s.toString().length() == 0) { | ||
259 | |||
260 | activation_code_delete_btn.setVisibility(View.INVISIBLE); | ||
261 | } else { | ||
262 | activation_code_delete_btn.setVisibility(View.VISIBLE); | ||
263 | } | ||
264 | } | ||
265 | |||
266 | @Override | ||
267 | public void afterTextChanged(Editable s) { | ||
268 | |||
269 | } | ||
270 | }); | ||
271 | activation_code.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
272 | @Override | ||
273 | public void onFocusChange(View v, boolean hasFocus) { | ||
274 | if (hasFocus) { | ||
275 | if (!activation_code.getText().toString().isEmpty()) { | ||
276 | activation_code_delete_btn.setVisibility(View.VISIBLE); | ||
277 | } | ||
278 | } else { | ||
279 | activation_code_delete_btn.setVisibility(View.INVISIBLE); | ||
280 | } | ||
281 | } | ||
282 | }); | ||
121 | } | 283 | } |
122 | 284 | ||
123 | @Override | 285 | @Override |
124 | public void onClick(View v) { | 286 | public void onClick(View v) { |
125 | switch (v.getId()){ | 287 | switch (v.getId()) { |
126 | case R.id.btn_card_valiyanzhen: | 288 | case R.id.btn_card_valiyanzhen: |
127 | 289 | String userID22 = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | |
128 | String usernameStr = phonenumber.getText().toString().trim(); | 290 | String usernameStr = phonenumber.getText().toString().trim(); |
129 | String authcodeStr = anth_6num.getText().toString().trim(); | 291 | String authcodeStr = anth_6num.getText().toString().trim(); |
130 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { | 292 | String activationStr = activation_code.getText().toString().trim(); |
131 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); | 293 | if (TextUtils.isEmpty(usernameStr)) { |
294 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号不能为空"); | ||
132 | return; | 295 | return; |
133 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 296 | } else if (activation_code_layout.getVisibility() == View.VISIBLE && TextUtils.isEmpty(activationStr)) { |
297 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "注册激活码不能为空"); | ||
298 | return; | ||
299 | }else if (rl_authcode.getVisibility() == View.VISIBLE && TextUtils.isEmpty(authcodeStr)) { | ||
300 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码不能为空"); | ||
301 | return; | ||
302 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)) { | ||
134 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); | 303 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); |
135 | 304 | ||
136 | }else if (!authcode.equals(authcodeStr)){ | 305 | } else if (!authcode.equals(authcodeStr)) { |
137 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); | 306 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); |
138 | }else { | 307 | } else { |
139 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 308 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
140 | Long auserID = null; | 309 | Long auserID = null; |
141 | try { | 310 | try { |
142 | auserID = Long.parseLong(userID); | 311 | auserID = Long.parseLong(userID); |
143 | } catch (NumberFormatException e) { | 312 | } catch (NumberFormatException e) { |
144 | e.printStackTrace(); | 313 | e.printStackTrace(); |
145 | } | 314 | } |
146 | if (Content.authcodeflag==1){ | 315 | if (Content.authcodeflag == 1) { |
147 | //修改账户手机号 | 316 | //修改账户手机号 |
148 | HttpManager.getInstance().changeaccountphone(this, | 317 | HttpManager.getInstance().changeaccountphone(this, |
149 | auserID,usernameStr,authcodeStr); | 318 | auserID, usernameStr, authcodeStr); |
150 | 319 | ||
151 | }else if (Content.authcodeflag==2){ | 320 | } else if (Content.authcodeflag == 2) { |
152 | //修改保卡手机号 | 321 | //修改保卡手机号 |
153 | String userID22 = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 322 | |
154 | HttpManager.getInstance().changecardinfophone(this, | 323 | HttpManager.getInstance().changecardinfophone(this, |
155 | userID22,usernameStr,authcodeStr); | 324 | userID22, usernameStr, authcodeStr); |
156 | }else { | 325 | } else { |
157 | String phone =phonenumber.getText().toString().trim(); | 326 | if(Build.MODEL.toUpperCase().equals("T5 PLUS")){ |
158 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone ); | 327 | HttpManager.getInstance().submitEcard(this,userID22,activationStr,handler); |
159 | Intent intent = new Intent(); | 328 | } else{ |
160 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | 329 | String phone = phonenumber.getText().toString().trim(); |
161 | startActivity(intent); | 330 | // SaveParam.getInstance().saveCustomizeParam(this, SaveParam.CARDPHONE, phone); |
162 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 331 | Intent intent = new Intent(); |
332 | intent.putExtra(SaveParam.CARDPHONE, phone); | ||
333 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | ||
334 | startActivity(intent); | ||
335 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
336 | } | ||
163 | } | 337 | } |
164 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); | 338 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); |
165 | // Intent intent = new Intent(); | 339 | // Intent intent = new Intent(); |
166 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | 340 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); |
167 | // startActivity(intent); | 341 | // startActivity(intent); |
168 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); | 342 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); |
169 | } | 343 | } |
170 | break; | 344 | break; |
171 | case R.id.btn_authcode: | 345 | case R.id.btn_authcode: |
172 | String usernameStr1 = phonenumber.getText().toString().trim(); | 346 | String usernameStr1 = phonenumber.getText().toString().trim(); |
173 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ | 347 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)) { |
174 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); | 348 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); |
175 | }else { | 349 | } else { |
176 | anth_6num.requestFocus(); | 350 | anth_6num.requestFocus(); |
177 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); | 351 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); |
178 | valiDelay(); | 352 | valiDelay(); |
179 | 353 | ||
180 | } | 354 | } |
181 | 355 | ||
182 | break; | 356 | break; |
183 | case R.id.cancel: | 357 | case R.id.cancel: |
184 | finish(); | 358 | finish(); |
185 | break; | 359 | break; |
360 | case R.id.phone_delete_btn: | ||
361 | phonenumber.setText(""); | ||
362 | break; | ||
363 | case R.id.code_delete_btn: | ||
364 | anth_6num.setText(""); | ||
365 | break; | ||
366 | case R.id.activation_code_delete_btn: | ||
367 | activation_code.setText(""); | ||
368 | break; | ||
186 | } | 369 | } |
187 | } | 370 | } |
371 | |||
188 | // 线程类 定时器 | 372 | // 线程类 定时器 |
189 | public void valiDelay() { | 373 | public void valiDelay() { |
190 | 374 | ||
191 | Delaytimer = new java.util.Timer(true); | 375 | Delaytimer = new java.util.Timer(true); |
192 | 376 | ||
193 | 377 | ||
194 | TimerTask task = new TimerTask() { | 378 | TimerTask task = new TimerTask() { |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/FeedBackActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.content.pm.PackageManager; | 4 | import android.content.pm.PackageManager; |
5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
6 | import android.net.Uri; | 6 | import android.net.Uri; |
7 | import android.os.Build; | 7 | import android.os.Build; |
8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
9 | import android.provider.MediaStore; | 9 | import android.provider.MediaStore; |
10 | import android.support.annotation.NonNull; | 10 | import android.support.annotation.NonNull; |
11 | import android.support.v4.app.FragmentActivity; | 11 | import android.support.v4.app.FragmentActivity; |
12 | import android.support.v4.content.FileProvider; | 12 | import android.support.v4.content.FileProvider; |
13 | import android.text.TextUtils; | 13 | import android.text.TextUtils; |
14 | import android.view.Gravity; | 14 | import android.view.Gravity; |
15 | import android.view.View; | 15 | import android.view.View; |
16 | import android.widget.AdapterView; | 16 | import android.widget.AdapterView; |
17 | import android.widget.EditText; | 17 | import android.widget.EditText; |
18 | import android.widget.ImageView; | 18 | import android.widget.ImageView; |
19 | import android.widget.TextView; | 19 | import android.widget.TextView; |
20 | import android.widget.Toast; | 20 | import android.widget.Toast; |
21 | 21 | ||
22 | import com.hjx.personalcenter.R; | 22 | import com.hjx.personalcenter.R; |
23 | import com.hjx.personalcenter.db.SaveParam; | 23 | import com.hjx.personalcenter.db.SaveParam; |
24 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
25 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
26 | import com.hjx.personalcenter.util.CropUtils; | 26 | import com.hjx.personalcenter.util.CropUtils; |
27 | import com.hjx.personalcenter.util.DialogPermission; | 27 | import com.hjx.personalcenter.util.DialogPermission; |
28 | import com.hjx.personalcenter.util.FileUtil; | 28 | import com.hjx.personalcenter.util.FileUtil; |
29 | import com.hjx.personalcenter.util.PermissionUtil; | 29 | import com.hjx.personalcenter.util.PermissionUtil; |
30 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 30 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
31 | import com.mylhyl.circledialog.CircleDialog; | 31 | import com.mylhyl.circledialog.CircleDialog; |
32 | import com.mylhyl.circledialog.callback.ConfigButton; | 32 | import com.mylhyl.circledialog.callback.ConfigButton; |
33 | import com.mylhyl.circledialog.callback.ConfigDialog; | 33 | import com.mylhyl.circledialog.callback.ConfigDialog; |
34 | import com.mylhyl.circledialog.params.ButtonParams; | 34 | import com.mylhyl.circledialog.params.ButtonParams; |
35 | import com.mylhyl.circledialog.params.DialogParams; | 35 | import com.mylhyl.circledialog.params.DialogParams; |
36 | 36 | ||
37 | import java.io.File; | 37 | import java.io.File; |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Created by h on 2017/8/11. | 40 | * Created by h on 2017/8/11. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | public class FeedBackActivity extends FragmentActivity implements View.OnClickListener { | 43 | public class FeedBackActivity extends FragmentActivity implements View.OnClickListener { |
44 | private ImageView iv_cance, iv_show, iv_take; | 44 | private ImageView iv_cance, iv_show, iv_take; |
45 | private EditText content, phone; | 45 | private EditText content, phone; |
46 | private TextView tv_sub; | 46 | private TextView tv_sub; |
47 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 47 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
48 | private static final int REQUEST_CODE_ALBUM = 2; | 48 | private static final int REQUEST_CODE_ALBUM = 2; |
49 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 49 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
50 | private ImageView mSimpleDraweeView; | 50 | private ImageView mSimpleDraweeView; |
51 | String type = "个人中心"; | 51 | String type = "个人中心"; |
52 | private File file; | 52 | private File file; |
53 | private Uri uri; | 53 | private Uri uri; |
54 | 54 | ||
55 | @Override | 55 | @Override |
56 | protected void onCreate(Bundle savedInstanceState) { | 56 | protected void onCreate(Bundle savedInstanceState) { |
57 | super.onCreate(savedInstanceState); | 57 | super.onCreate(savedInstanceState); |
58 | setContentView(R.layout.activity_feedback); | 58 | setContentView(R.layout.activity_feedback); |
59 | initView(); | 59 | initView(); |
60 | initData(); | 60 | initData(); |
61 | initLister(); | 61 | initLister(); |
62 | } | 62 | } |
63 | 63 | ||
64 | private void initView() { | 64 | private void initView() { |
65 | iv_cance = (ImageView) findViewById(R.id.cancel); | 65 | iv_cance = (ImageView) findViewById(R.id.cancel); |
66 | mSimpleDraweeView = (ImageView) findViewById(R.id.show_iv); | 66 | mSimpleDraweeView = (ImageView) findViewById(R.id.show_iv); |
67 | iv_take = (ImageView) findViewById(R.id.iv_take); | 67 | iv_take = (ImageView) findViewById(R.id.iv_take); |
68 | content = (EditText) findViewById(R.id.feedback_content); | 68 | content = (EditText) findViewById(R.id.feedback_content); |
69 | phone = (EditText) findViewById(R.id.feedback_phone); | 69 | phone = (EditText) findViewById(R.id.feedback_phone); |
70 | tv_sub = (TextView) findViewById(R.id.feedback_sub); | 70 | tv_sub = (TextView) findViewById(R.id.feedback_sub); |
71 | 71 | ||
72 | } | 72 | } |
73 | 73 | ||
74 | private void initData() { | 74 | private void initData() { |
75 | file = new File(FileUtil.getCachePath(this), "user-feedback.jpg"); | 75 | file = new File(FileUtil.getCachePath(this), "user-feedback.jpg"); |
76 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 76 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
77 | uri = Uri.fromFile(file); | 77 | uri = Uri.fromFile(file); |
78 | } else { | 78 | } else { |
79 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 79 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
80 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 80 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter.fileprovider", file); |
81 | } | 81 | } |
82 | 82 | ||
83 | } | 83 | } |
84 | 84 | ||
85 | private void initLister() { | 85 | private void initLister() { |
86 | iv_cance.setOnClickListener(this); | 86 | iv_cance.setOnClickListener(this); |
87 | iv_take.setOnClickListener(this); | 87 | iv_take.setOnClickListener(this); |
88 | tv_sub.setOnClickListener(this); | 88 | tv_sub.setOnClickListener(this); |
89 | mSimpleDraweeView.setOnClickListener(this); | 89 | mSimpleDraweeView.setOnClickListener(this); |
90 | 90 | ||
91 | } | 91 | } |
92 | 92 | ||
93 | @Override | 93 | @Override |
94 | public void onClick(View v) { | 94 | public void onClick(View v) { |
95 | String contents = content.getText().toString().trim(); | 95 | String contents = content.getText().toString().trim(); |
96 | String contants = phone.getText().toString().trim(); | 96 | String contants = phone.getText().toString().trim(); |
97 | switch (v.getId()) { | 97 | switch (v.getId()) { |
98 | case R.id.cancel: | 98 | case R.id.cancel: |
99 | finish(); | 99 | finish(); |
100 | break; | 100 | break; |
101 | case R.id.iv_take: | 101 | case R.id.iv_take: |
102 | choiceAvatar(); | 102 | choiceAvatar(); |
103 | break; | 103 | break; |
104 | case R.id.feedback_sub: | 104 | case R.id.feedback_sub: |
105 | //提交用户反馈 | 105 | //提交用户反馈 |
106 | if (TextUtils.isEmpty(contents)) { | 106 | if (TextUtils.isEmpty(contents)) { |
107 | AlertUtils.showToast(FeedBackActivity.this, "写下两点宝贵的意见或建议吧"); | 107 | AlertUtils.showToast(FeedBackActivity.this, "写下两点宝贵的意见或建议吧"); |
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 110 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
111 | try { | 111 | try { |
112 | HttpManager.getInstance().feedback(FeedBackActivity.this, userID, | 112 | HttpManager.getInstance().feedback(FeedBackActivity.this, userID, |
113 | contents, contants, file.getPath(), type); | 113 | contents, contants, file.getPath(), type); |
114 | } catch (Exception e) { | 114 | } catch (Exception e) { |
115 | e.printStackTrace(); | 115 | e.printStackTrace(); |
116 | } | 116 | } |
117 | break; | 117 | break; |
118 | case R.id.show_iv: | 118 | case R.id.show_iv: |
119 | 119 | ||
120 | 120 | ||
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | //拍摄头像 | 125 | //拍摄头像 |
126 | private void choiceAvatar() { | 126 | private void choiceAvatar() { |
127 | final String[] items = {"拍照", "从相册选择"}; | 127 | final String[] items = {"拍照", "从相册选择"}; |
128 | new CircleDialog.Builder(this) | 128 | new CircleDialog.Builder(this) |
129 | .configDialog(new ConfigDialog() { | 129 | .configDialog(new ConfigDialog() { |
130 | @Override | 130 | @Override |
131 | public void onConfig(DialogParams params) { | 131 | public void onConfig(DialogParams params) { |
132 | //增加弹出动画 | 132 | //增加弹出动画 |
133 | params.gravity = Gravity.CENTER; | 133 | params.gravity = Gravity.CENTER; |
134 | } | 134 | } |
135 | }) | 135 | }) |
136 | .setTitle("请选择图片来源") | 136 | .setTitle("请选择图片来源") |
137 | .setWidth(0.5f) | 137 | .setWidth(0.5f) |
138 | .setItems(items, new AdapterView.OnItemClickListener() { | 138 | .setItems(items, new AdapterView.OnItemClickListener() { |
139 | @Override | 139 | @Override |
140 | public void onItemClick(AdapterView<?> parent, View view, int | 140 | public void onItemClick(AdapterView<?> parent, View view, int |
141 | position, long id) { | 141 | position, long id) { |
142 | switch (position) { | 142 | switch (position) { |
143 | case 0: | 143 | case 0: |
144 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { | 144 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { |
145 | uploadAvatarFromPhotoRequest(); | 145 | uploadAvatarFromPhotoRequest(); |
146 | } | 146 | } |
147 | break; | 147 | break; |
148 | case 1: | 148 | case 1: |
149 | uploadAvatarFromAlbumRequest(); | 149 | uploadAvatarFromAlbumRequest(); |
150 | break; | 150 | break; |
151 | } | 151 | } |
152 | 152 | ||
153 | } | 153 | } |
154 | }) | 154 | }) |
155 | .setNegative("取消", null) | 155 | .setNegative("取消", null) |
156 | .configNegative(new ConfigButton() { | 156 | .configNegative(new ConfigButton() { |
157 | @Override | 157 | @Override |
158 | public void onConfig(ButtonParams params) { | 158 | public void onConfig(ButtonParams params) { |
159 | //取消按钮字体颜色 | 159 | //取消按钮字体颜色 |
160 | params.textColor = Color.RED; | 160 | params.textColor = Color.RED; |
161 | } | 161 | } |
162 | }) | 162 | }) |
163 | .show(); | 163 | .show(); |
164 | 164 | ||
165 | 165 | ||
166 | } | 166 | } |
167 | 167 | ||
168 | //照相 | 168 | //照相 |
169 | private void uploadAvatarFromPhotoRequest() { | 169 | private void uploadAvatarFromPhotoRequest() { |
170 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 170 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
171 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 171 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
172 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 172 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
173 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 173 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
174 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 174 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
175 | } | 175 | } |
176 | 176 | ||
177 | //选择图库 | 177 | //选择图库 |
178 | private void uploadAvatarFromAlbumRequest() { | 178 | private void uploadAvatarFromAlbumRequest() { |
179 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 179 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
180 | photoPickerIntent.setType("image/*"); | 180 | photoPickerIntent.setType("image/*"); |
181 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 181 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
182 | } | 182 | } |
183 | 183 | ||
184 | //回掉 | 184 | //回掉 |
185 | @Override | 185 | @Override |
186 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 186 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
187 | super.onActivityResult(requestCode, resultCode, data); | 187 | super.onActivityResult(requestCode, resultCode, data); |
188 | if (resultCode != -1) { | 188 | if (resultCode != -1) { |
189 | return; | 189 | return; |
190 | } | 190 | } |
191 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 191 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
192 | Uri newUri; | 192 | Uri newUri; |
193 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 193 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
194 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 194 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
195 | } else { | 195 | } else { |
196 | newUri = data.getData(); | 196 | newUri = data.getData(); |
197 | } | 197 | } |
198 | if (newUri != null) { | 198 | if (newUri != null) { |
199 | //uploadAvatarFromPhoto(); | 199 | //uploadAvatarFromPhoto(); |
200 | //裁剪图片 | 200 | //裁剪图片 |
201 | startPhotoZoom(newUri); | 201 | startPhotoZoom(newUri); |
202 | } else { | 202 | } else { |
203 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 203 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
204 | } | 204 | } |
205 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 205 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
206 | uploadAvatarFromPhoto(); | 206 | uploadAvatarFromPhoto(); |
207 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 207 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
208 | uploadAvatarFromPhoto(); | 208 | uploadAvatarFromPhoto(); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | private void uploadAvatarFromPhoto() { | 212 | private void uploadAvatarFromPhoto() { |
213 | compressAndUploadAvatar(file.getPath()); | 213 | compressAndUploadAvatar(file.getPath()); |
214 | 214 | ||
215 | } | 215 | } |
216 | 216 | ||
217 | private void compressAndUploadAvatar(String fileSrc) { | 217 | private void compressAndUploadAvatar(String fileSrc) { |
218 | 218 | ||
219 | 219 | ||
220 | //上传到服务器 | 220 | //上传到服务器 |
221 | 221 | ||
222 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 222 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
223 | String mimeType = "image/*"; | 223 | String mimeType = "image/*"; |
224 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 224 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
225 | //String fileName = cover.getName(); | 225 | //String fileName = cover.getName(); |
226 | //HttpManager.getInstance().header(this, fileSrc); | 226 | //HttpManager.getInstance().header(this, fileSrc); |
227 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 227 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
228 | //Fresco设置圆形头像 | 228 | //Fresco设置圆形头像 |
229 | // GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 229 | // GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
230 | // GenericDraweeHierarchy hierarchy = builder | 230 | // GenericDraweeHierarchy hierarchy = builder |
231 | // .setDesiredAspectRatio(1f) | 231 | // .setDesiredAspectRatio(1f) |
232 | // .setFailureImage(R.mipmap.blank) | 232 | // .setFailureImage(R.mipmap.blank) |
233 | // //圆形头像 | 233 | // //圆形头像 |
234 | // .setRoundingParams(RoundingParams.fromCornersRadius(0.7f)) | 234 | // .setRoundingParams(RoundingParams.fromCornersRadius(0.7f)) |
235 | // .build(); | 235 | // .build(); |
236 | // //OOM | 236 | // //OOM |
237 | // ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) | 237 | // ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) |
238 | // //根据View的尺寸放缩图片 | 238 | // //根据View的尺寸放缩图片 |
239 | // .setResizeOptions(new ResizeOptions(mSimpleDraweeView.getWidth(), mSimpleDraweeView.getHeight())) | 239 | // .setResizeOptions(new ResizeOptions(mSimpleDraweeView.getWidth(), mSimpleDraweeView.getHeight())) |
240 | // .build(); | 240 | // .build(); |
241 | 241 | ||
242 | 242 | ||
243 | //加载本地图片 | 243 | //加载本地图片 |
244 | mSimpleDraweeView.setImageURI(Uri.fromFile(new File(fileSrc))); | 244 | mSimpleDraweeView.setImageURI(Uri.fromFile(new File(fileSrc))); |
245 | 245 | ||
246 | //Picasso.with(FeedBackActivity.this).load(fileSrc).into(mSimpleDraweeView); | 246 | //Picasso.with(FeedBackActivity.this).load(fileSrc).into(mSimpleDraweeView); |
247 | // Uri uri = Uri.fromFile(cover); | 247 | // Uri uri = Uri.fromFile(cover); |
248 | // DraweeController controller = Fresco.newDraweeControllerBuilder() | 248 | // DraweeController controller = Fresco.newDraweeControllerBuilder() |
249 | // .setOldController(mSimpleDraweeView.getController()) | 249 | // .setOldController(mSimpleDraweeView.getController()) |
250 | // .setImageRequest(request) | 250 | // .setImageRequest(request) |
251 | // .setUri(uri) | 251 | // .setUri(uri) |
252 | // .build(); | 252 | // .build(); |
253 | // mSimpleDraweeView.setHierarchy(hierarchy); | 253 | // mSimpleDraweeView.setHierarchy(hierarchy); |
254 | // mSimpleDraweeView.setController(controller); | 254 | // mSimpleDraweeView.setController(controller); |
255 | 255 | ||
256 | } | 256 | } |
257 | 257 | ||
258 | public void startPhotoZoom(Uri uri) { | 258 | public void startPhotoZoom(Uri uri) { |
259 | Intent intent = new Intent("com.android.camera.action.CROP"); | 259 | Intent intent = new Intent("com.android.camera.action.CROP"); |
260 | intent.setDataAndType(uri, "image/*"); | 260 | intent.setDataAndType(uri, "image/*"); |
261 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 261 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
262 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 262 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
263 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 263 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
264 | intent.putExtra("aspectY", 1);// x:y=1:1 | 264 | intent.putExtra("aspectY", 1);// x:y=1:1 |
265 | // intent.putExtra("outputX", 400);//图片输出大小 | 265 | // intent.putExtra("outputX", 400);//图片输出大小 |
266 | // intent.putExtra("outputY", 400); | 266 | // intent.putExtra("outputY", 400); |
267 | intent.putExtra("output", Uri.fromFile(file)); | 267 | intent.putExtra("output", Uri.fromFile(file)); |
268 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 268 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
269 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 269 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
270 | } | 270 | } |
271 | 271 | ||
272 | @Override | 272 | @Override |
273 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 273 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
274 | switch (requestCode) { | 274 | switch (requestCode) { |
275 | 275 | ||
276 | case PermissionUtil.REQUEST_SHOWCAMERA: | 276 | case PermissionUtil.REQUEST_SHOWCAMERA: |
277 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 277 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
278 | // Permission Granted | 278 | // Permission Granted |
279 | uploadAvatarFromPhotoRequest(); | 279 | uploadAvatarFromPhotoRequest(); |
280 | 280 | ||
281 | } else { | 281 | } else { |
282 | if (!SharedPreferenceMark.getHasShowCamera()) { | 282 | if (!SharedPreferenceMark.getHasShowCamera()) { |
283 | SharedPreferenceMark.setHasShowCamera(true); | 283 | SharedPreferenceMark.setHasShowCamera(true); |
284 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 284 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
285 | 285 | ||
286 | } else { | 286 | } else { |
287 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 287 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
288 | .show(); | 288 | .show(); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | break; | 291 | break; |
292 | default: | 292 | default: |
293 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 293 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
294 | } | 294 | } |
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ForgotPasswordActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.os.Handler; | 4 | import android.os.Handler; |
5 | import android.os.Message; | 5 | import android.os.Message; |
6 | import android.support.v4.app.FragmentActivity; | 6 | import android.support.v4.app.FragmentActivity; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
8 | import android.text.Editable; | ||
8 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
10 | import android.text.TextWatcher; | ||
9 | import android.text.method.HideReturnsTransformationMethod; | 11 | import android.text.method.HideReturnsTransformationMethod; |
10 | import android.text.method.PasswordTransformationMethod; | 12 | import android.text.method.PasswordTransformationMethod; |
11 | import android.view.View; | 13 | import android.view.View; |
12 | import android.widget.Button; | 14 | import android.widget.Button; |
13 | import android.widget.EditText; | 15 | import android.widget.EditText; |
16 | import android.widget.ImageButton; | ||
14 | import android.widget.ImageView; | 17 | import android.widget.ImageView; |
15 | 18 | ||
16 | import com.hjx.personalcenter.R; | 19 | import com.hjx.personalcenter.R; |
17 | import com.hjx.personalcenter.http.HttpCode; | 20 | import com.hjx.personalcenter.http.HttpCode; |
18 | import com.hjx.personalcenter.http.HttpManager; | 21 | import com.hjx.personalcenter.http.HttpManager; |
19 | import com.hjx.personalcenter.util.AlertUtils; | 22 | import com.hjx.personalcenter.util.AlertUtils; |
20 | import com.hjx.personalcenter.util.Judgment; | 23 | import com.hjx.personalcenter.util.Judgment; |
21 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 24 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
22 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 25 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
23 | 26 | ||
24 | import org.json.JSONException; | 27 | import org.json.JSONException; |
25 | import org.json.JSONObject; | 28 | import org.json.JSONObject; |
26 | 29 | ||
27 | import java.util.TimerTask; | 30 | import java.util.TimerTask; |
28 | 31 | ||
29 | /** | 32 | /** |
30 | * 忘记密码 | 33 | * 忘记密码 |
31 | * Created by h on 2017/6/17. | 34 | * Created by h on 2017/6/17. |
32 | */ | 35 | */ |
33 | 36 | ||
34 | public class ForgotPasswordActivity extends FragmentActivity implements View.OnClickListener { | 37 | public class ForgotPasswordActivity extends FragmentActivity implements View.OnClickListener { |
35 | private ImageView back_forgit, iv_pwd_change; | 38 | private ImageView back_forgit, iv_pwd_change,iv_newpwd_change; |
36 | private EditText forot_pwd_phone, forot_pwd_anthcode, forot_pwd_pwd, forot_pwd_pwd2; | 39 | private EditText forot_pwd_phone, forot_pwd_anthcode, forot_pwd_pwd, forot_pwd_pwd2; |
37 | private Button forot_pwd_sub, forot_pwd_getanthcode; | 40 | private Button forot_pwd_sub, forot_pwd_getanthcode; |
41 | private ImageButton phone_delete_btn,code_delete_btn; | ||
38 | private String forot_pwd_phone1; | 42 | private String forot_pwd_phone1; |
39 | private String forot_pwd_anthcode1; | 43 | private String forot_pwd_anthcode1; |
40 | private String forot_pwd_pwd3; | 44 | private String forot_pwd_pwd3; |
41 | private String forot_pwd_pwd4; | 45 | private String forot_pwd_pwd4; |
42 | private String typeStr = "login"; | 46 | private String typeStr = "login"; |
43 | private int delayTime=60; | 47 | private int delayTime=60; |
44 | private java.util.Timer Delaytimer; | 48 | private java.util.Timer Delaytimer; |
45 | public static Boolean showPassword = false; | 49 | public static Boolean showPassword = false; |
50 | public static Boolean showNewPassword = false; | ||
46 | 51 | ||
47 | Handler handler = new Handler() { | 52 | Handler handler = new Handler() { |
48 | @Override | 53 | @Override |
49 | public void handleMessage(Message msg) { | 54 | public void handleMessage(Message msg) { |
50 | super.handleMessage(msg); | 55 | super.handleMessage(msg); |
51 | try { | 56 | try { |
52 | JSONObject jsonObject; | 57 | JSONObject jsonObject; |
53 | String status; | 58 | String status; |
54 | switch (msg.what) { | 59 | switch (msg.what) { |
55 | case HttpCode.PASSWORD_SUCESS: | 60 | case HttpCode.PASSWORD_SUCESS: |
56 | jsonObject = (JSONObject) msg.obj; | 61 | jsonObject = (JSONObject) msg.obj; |
57 | status = jsonObject.getString("status"); | 62 | status = jsonObject.getString("status"); |
58 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 63 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
59 | if (status.equals("100")) { | 64 | if (status.equals("100")) { |
60 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改成功"); | 65 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改成功"); |
61 | } | 66 | } |
62 | 67 | ||
63 | break; | 68 | break; |
64 | case HttpCode.PASSWORD_FAIL: | 69 | case HttpCode.PASSWORD_FAIL: |
65 | jsonObject = (JSONObject) msg.obj; | 70 | jsonObject = (JSONObject) msg.obj; |
66 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); | 71 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); |
67 | break; | 72 | break; |
68 | case HttpCode.AUTHCODE_SUCESS1: | 73 | case HttpCode.AUTHCODE_SUCESS1: |
69 | jsonObject = (JSONObject) msg.obj; | 74 | jsonObject = (JSONObject) msg.obj; |
70 | status = jsonObject.optString("status"); | 75 | status = jsonObject.optString("status"); |
71 | if (status.equals("100")) { | 76 | if (status.equals("100")) { |
72 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); | 77 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); |
73 | } | 78 | } |
74 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 79 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
75 | break; | 80 | break; |
76 | case HttpCode.AUTHCODE_FAIL1: | 81 | case HttpCode.AUTHCODE_FAIL1: |
77 | jsonObject = (JSONObject) msg.obj; | 82 | jsonObject = (JSONObject) msg.obj; |
78 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); | 83 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); |
79 | break; | 84 | break; |
80 | case HttpCode.IS_REFISTER: | 85 | case HttpCode.IS_REFISTER: |
81 | jsonObject = (JSONObject) msg.obj; | 86 | jsonObject = (JSONObject) msg.obj; |
82 | status = jsonObject.getString("status"); | 87 | status = jsonObject.getString("status"); |
83 | if (status.equals("true")) { | 88 | if (status.equals("true")) { |
84 | getauthcode(); | 89 | getauthcode(); |
85 | 90 | ||
86 | } else { | 91 | } else { |
87 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); | 92 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); |
88 | } | 93 | } |
89 | break; | 94 | break; |
90 | case 21: | 95 | case 21: |
91 | 96 | ||
92 | if(delayTime<=0){ | 97 | if(delayTime<=0){ |
93 | if(Delaytimer!=null){ | 98 | if(Delaytimer!=null){ |
94 | Delaytimer.cancel(); | 99 | Delaytimer.cancel(); |
95 | } | 100 | } |
96 | forot_pwd_getanthcode.setEnabled(true); | 101 | forot_pwd_getanthcode.setEnabled(true); |
97 | forot_pwd_getanthcode.setClickable(true); | 102 | forot_pwd_getanthcode.setClickable(true); |
98 | forot_pwd_getanthcode.setText("获取验证码"); | 103 | forot_pwd_getanthcode.setText("获取验证码"); |
99 | delayTime=60; | 104 | delayTime=60; |
100 | }else{ | 105 | }else{ |
101 | forot_pwd_getanthcode.setEnabled(false); | 106 | forot_pwd_getanthcode.setEnabled(false); |
102 | forot_pwd_getanthcode.setClickable(false); | 107 | forot_pwd_getanthcode.setClickable(false); |
103 | forot_pwd_getanthcode.setText(delayTime + " s"); | 108 | forot_pwd_getanthcode.setText(delayTime + " s"); |
104 | } | 109 | } |
105 | break; | 110 | break; |
106 | } | 111 | } |
107 | } catch (JSONException e) { | 112 | } catch (JSONException e) { |
108 | e.printStackTrace(); | 113 | e.printStackTrace(); |
109 | } | 114 | } |
110 | } | 115 | } |
111 | }; | 116 | }; |
112 | 117 | ||
113 | @Override | 118 | @Override |
114 | protected void onCreate(Bundle savedInstanceState) { | 119 | protected void onCreate(Bundle savedInstanceState) { |
115 | super.onCreate(savedInstanceState); | 120 | super.onCreate(savedInstanceState); |
116 | setContentView(R.layout.activity_forgetpsword); | 121 | setContentView(R.layout.activity_forgetpsword); |
117 | initView(); | 122 | initView(); |
118 | setLister(); | 123 | setLister(); |
124 | initTextWatch(); | ||
119 | } | 125 | } |
120 | 126 | ||
121 | //获取验证码 | 127 | //获取验证码 |
122 | private void getauthcode() { | 128 | private void getauthcode() { |
123 | forot_pwd_anthcode.requestFocus(); | 129 | forot_pwd_anthcode.requestFocus(); |
124 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); | 130 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); |
125 | valiDelay(); | 131 | valiDelay(); |
126 | 132 | ||
127 | } | 133 | } |
128 | 134 | ||
129 | private void initView() { | 135 | private void initView() { |
130 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); | 136 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); |
131 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); | 137 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); |
132 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); | 138 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); |
133 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); | 139 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); |
134 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); | 140 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); |
135 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); | 141 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); |
136 | iv_pwd_change = (ImageView) findViewById(R.id.iv_pwd_change); | 142 | iv_pwd_change = (ImageView) findViewById(R.id.iv_pwd_change); |
143 | iv_newpwd_change = (ImageView) findViewById(R.id.iv_newpwd_change); | ||
137 | back_forgit = (ImageView) findViewById(R.id.cancel); | 144 | back_forgit = (ImageView) findViewById(R.id.cancel); |
145 | phone_delete_btn = (ImageButton) findViewById(R.id.phone_delete_btn); | ||
146 | code_delete_btn = (ImageButton) findViewById(R.id.code_delete_btn); | ||
138 | } | 147 | } |
139 | 148 | ||
140 | private void setLister() { | 149 | private void setLister() { |
141 | iv_pwd_change.setOnClickListener(this); | 150 | iv_pwd_change.setOnClickListener(this); |
151 | iv_newpwd_change.setOnClickListener(this); | ||
142 | back_forgit.setOnClickListener(this); | 152 | back_forgit.setOnClickListener(this); |
143 | forot_pwd_sub.setOnClickListener(this); | 153 | forot_pwd_sub.setOnClickListener(this); |
144 | forot_pwd_getanthcode.setOnClickListener(this); | 154 | forot_pwd_getanthcode.setOnClickListener(this); |
155 | phone_delete_btn.setOnClickListener(this); | ||
156 | code_delete_btn.setOnClickListener(this); | ||
145 | 157 | ||
146 | } | 158 | } |
147 | 159 | ||
160 | /** | ||
161 | * 输入框改变的监听 | ||
162 | */ | ||
163 | private void initTextWatch() { | ||
164 | forot_pwd_phone.addTextChangedListener(new TextWatcher() { | ||
165 | @Override | ||
166 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
167 | } | ||
168 | |||
169 | @Override | ||
170 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
171 | if (s.toString().length() == 0) { | ||
172 | phone_delete_btn.setVisibility(View.INVISIBLE); | ||
173 | } else { | ||
174 | phone_delete_btn.setVisibility(View.VISIBLE); | ||
175 | } | ||
176 | } | ||
177 | |||
178 | @Override | ||
179 | public void afterTextChanged(Editable s) { | ||
180 | |||
181 | } | ||
182 | }); | ||
183 | forot_pwd_phone.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
184 | @Override | ||
185 | public void onFocusChange(View v, boolean hasFocus) { | ||
186 | if (hasFocus) { | ||
187 | if (!forot_pwd_phone.getText().toString().isEmpty()) { | ||
188 | phone_delete_btn.setVisibility(View.VISIBLE); | ||
189 | } | ||
190 | } else { | ||
191 | |||
192 | phone_delete_btn.setVisibility(View.INVISIBLE); | ||
193 | } | ||
194 | } | ||
195 | }); | ||
196 | forot_pwd_anthcode.addTextChangedListener(new TextWatcher() { | ||
197 | @Override | ||
198 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
199 | |||
200 | } | ||
201 | |||
202 | @Override | ||
203 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
204 | if (s.toString().length() == 0) { | ||
205 | |||
206 | code_delete_btn.setVisibility(View.INVISIBLE); | ||
207 | } else { | ||
208 | code_delete_btn.setVisibility(View.VISIBLE); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | @Override | ||
213 | public void afterTextChanged(Editable s) { | ||
214 | |||
215 | } | ||
216 | }); | ||
217 | forot_pwd_anthcode.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
218 | @Override | ||
219 | public void onFocusChange(View v, boolean hasFocus) { | ||
220 | if (hasFocus) { | ||
221 | if (!forot_pwd_anthcode.getText().toString().isEmpty()) { | ||
222 | code_delete_btn.setVisibility(View.VISIBLE); | ||
223 | } | ||
224 | } else { | ||
225 | code_delete_btn.setVisibility(View.INVISIBLE); | ||
226 | } | ||
227 | } | ||
228 | }); | ||
229 | } | ||
230 | |||
148 | 231 | ||
149 | @Override | 232 | @Override |
150 | public void onClick(View view) { | 233 | public void onClick(View view) { |
151 | switch (view.getId()) { | 234 | switch (view.getId()) { |
152 | case R.id.btn_ok: | 235 | case R.id.btn_ok: |
153 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 236 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
154 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); | 237 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); |
155 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); | 238 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); |
156 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); | 239 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); |
157 | if (TextUtils.isEmpty(forot_pwd_phone1) || | 240 | if (TextUtils.isEmpty(forot_pwd_phone1) || |
158 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)) { | 241 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)) { |
159 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); | 242 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); |
160 | return; | 243 | return; |
161 | } else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)) { | 244 | } else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)) { |
162 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); | 245 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); |
163 | 246 | ||
164 | } else if (forot_pwd_pwd3.length() < 8 || forot_pwd_pwd4.length() < 8) { | 247 | } else if (forot_pwd_pwd3.length() < 8 || forot_pwd_pwd4.length() < 8) { |
165 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); | 248 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); |
166 | } else if (!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER) || !forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)) { | 249 | } else if (!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER) || !forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)) { |
167 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); | 250 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); |
168 | } else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)) { | 251 | } else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)) { |
169 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); | 252 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); |
170 | return; | 253 | return; |
171 | } else { | 254 | } else { |
172 | //忘记密码接口 | 255 | //忘记密码接口 |
173 | HttpManager.getInstance().forgetpassword(this, forot_pwd_phone1, forot_pwd_pwd3, forot_pwd_anthcode1, handler); | 256 | HttpManager.getInstance().forgetpassword(this, forot_pwd_phone1, forot_pwd_pwd3, forot_pwd_anthcode1, handler); |
174 | } | 257 | } |
175 | break; | 258 | break; |
176 | case R.id.btn_authcode: | 259 | case R.id.btn_authcode: |
177 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 260 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
178 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)) { | 261 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)) { |
179 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); | 262 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); |
180 | } else { | 263 | } else { |
181 | forot_pwd_anthcode.requestFocus(); | 264 | forot_pwd_anthcode.requestFocus(); |
182 | ifregister(); | 265 | ifregister(); |
183 | 266 | ||
184 | } | 267 | } |
185 | 268 | ||
186 | break; | 269 | break; |
187 | case R.id.iv_pwd_change: | 270 | case R.id.iv_pwd_change: |
188 | if (showPassword) {//显示密码 | 271 | if (showPassword) {//显示密码 |
189 | showPassword = !showPassword; | 272 | showPassword = !showPassword; |
190 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); | 273 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); |
191 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 274 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
192 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 275 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
193 | } else {//隐藏密码 | 276 | } else {//隐藏密码 |
194 | showPassword = !showPassword; | 277 | showPassword = !showPassword; |
195 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); | 278 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); |
196 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 279 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
197 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 280 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
198 | } | 281 | } |
199 | break; | 282 | break; |
283 | case R.id.iv_newpwd_change: | ||
284 | if (showNewPassword) {//显示密码 | ||
285 | showNewPassword = !showNewPassword; | ||
286 | iv_newpwd_change.setImageResource(R.mipmap.pwd_open); | ||
287 | forot_pwd_pwd2.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | ||
288 | forot_pwd_pwd2.setSelection(forot_pwd_pwd.getText().toString().length()); | ||
289 | } else {//隐藏密码 | ||
290 | showNewPassword = !showNewPassword; | ||
291 | iv_newpwd_change.setImageResource(R.mipmap.pwd_hide); | ||
292 | forot_pwd_pwd2.setTransformationMethod(PasswordTransformationMethod.getInstance()); | ||
293 | forot_pwd_pwd2.setSelection(forot_pwd_pwd.getText().toString().length()); | ||
294 | } | ||
295 | break; | ||
200 | 296 | ||
201 | case R.id.cancel: | 297 | case R.id.cancel: |
202 | finish(); | 298 | finish(); |
203 | break; | 299 | break; |
300 | case R.id.phone_delete_btn: | ||
301 | forot_pwd_phone.setText(""); | ||
302 | break; | ||
303 | case R.id.code_delete_btn: | ||
304 | forot_pwd_anthcode.setText(""); | ||
305 | break; | ||
204 | } | 306 | } |
205 | } | 307 | } |
206 | 308 | ||
207 | //是否注册 | 309 | //是否注册 |
208 | private void ifregister() { | 310 | private void ifregister() { |
209 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 311 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
210 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); | 312 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); |
211 | } | 313 | } |
212 | 314 | ||
213 | // 线程类 定时器 | 315 | // 线程类 定时器 |
214 | public void valiDelay() { | 316 | public void valiDelay() { |
215 | 317 | ||
216 | Delaytimer = new java.util.Timer(true); | 318 | Delaytimer = new java.util.Timer(true); |
217 | 319 | ||
218 | 320 | ||
219 | TimerTask task = new TimerTask() { | 321 | TimerTask task = new TimerTask() { |
220 | public void run() { | 322 | public void run() { |
221 | //每次需要执行的代码放到这里面。 | 323 | //每次需要执行的代码放到这里面。 |
222 | delayTime--; | 324 | delayTime--; |
223 | handler.sendEmptyMessage(21); | 325 | handler.sendEmptyMessage(21); |
224 | } | 326 | } |
225 | }; | 327 | }; |
226 | Delaytimer.schedule(task, 1000,1000); | 328 | Delaytimer.schedule(task, 1000,1000); |
227 | } | 329 | } |
228 | } | 330 | } |
229 | 331 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/LoginAndRegisterActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.provider.Settings; | 5 | import android.provider.Settings; |
6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
8 | import android.support.v4.app.FragmentActivity; | 8 | import android.support.v4.app.FragmentActivity; |
9 | import android.support.v4.view.ViewPager; | 9 | import android.support.v4.view.ViewPager; |
10 | import android.view.Gravity; | 10 | import android.view.Gravity; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | 12 | ||
13 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
14 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; | 14 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; |
15 | import com.hjx.personalcenter.db.SaveParam; | 15 | import com.hjx.personalcenter.db.SaveParam; |
16 | import com.hjx.personalcenter.fragment.LoginFragment; | 16 | import com.hjx.personalcenter.fragment.LoginFragment; |
17 | import com.hjx.personalcenter.fragment.RegisterFragment; | 17 | import com.hjx.personalcenter.fragment.RegisterFragment; |
18 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; | 18 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; |
19 | import com.hjx.personalcenter.update.UpdateChecker; | ||
19 | import com.hjx.personalcenter.util.NetUtils; | 20 | import com.hjx.personalcenter.util.NetUtils; |
21 | import com.hjx.personalcenter.util.PermissionUtil; | ||
20 | import com.mylhyl.circledialog.CircleDialog; | 22 | import com.mylhyl.circledialog.CircleDialog; |
21 | import com.mylhyl.circledialog.callback.ConfigText; | 23 | import com.mylhyl.circledialog.callback.ConfigText; |
22 | import com.mylhyl.circledialog.params.TextParams; | 24 | import com.mylhyl.circledialog.params.TextParams; |
23 | 25 | ||
24 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
25 | import java.util.Arrays; | 27 | import java.util.Arrays; |
26 | import java.util.List; | 28 | import java.util.List; |
27 | 29 | ||
28 | /** | 30 | /** |
29 | * 登录和注册 熊巍 | 31 | * 登录和注册 熊巍 |
30 | * Created by h on 2017/8/8. | 32 | * Created by h on 2017/8/8. |
31 | */ | 33 | */ |
32 | 34 | ||
33 | public class LoginAndRegisterActivity extends FragmentActivity { | 35 | public class LoginAndRegisterActivity extends FragmentActivity { |
34 | private ViewPager viewPager; | 36 | private ViewPager viewPager; |
35 | private SlidingTabLayout tableLayout; | 37 | private SlidingTabLayout tableLayout; |
36 | private List<Fragment> loginlist; | 38 | private List<Fragment> loginlist; |
37 | private LoginAndRegisterAdapter logindapter; | 39 | private LoginAndRegisterAdapter logindapter; |
38 | private List<String> title = Arrays.asList("登录", "注册"); | 40 | private List<String> title = Arrays.asList("登录", "注册"); |
39 | 41 | ||
40 | @Override | 42 | @Override |
41 | protected void onCreate(@Nullable Bundle savedInstanceState) { | 43 | protected void onCreate(@Nullable Bundle savedInstanceState) { |
42 | super.onCreate(savedInstanceState); | 44 | super.onCreate(savedInstanceState); |
43 | SysApplication.getInstance().addActivity(this); | 45 | SysApplication.getInstance().addActivity(this); |
44 | //检查网络 | 46 | //检查网络 |
45 | boolean isconnect = NetUtils.isNetworkConnected(this); | 47 | boolean isconnect = NetUtils.isNetworkConnected(this); |
46 | if (!isconnect){ | 48 | if (!isconnect){ |
47 | new CircleDialog.Builder(this) | 49 | new CircleDialog.Builder(this) |
48 | .setCanceledOnTouchOutside(false) | 50 | .setCanceledOnTouchOutside(false) |
49 | .setCancelable(false) | 51 | .setCancelable(false) |
50 | .setWidth(0.5f) | 52 | .setWidth(0.5f) |
51 | .configText(new ConfigText() { | 53 | .configText(new ConfigText() { |
52 | @Override | 54 | @Override |
53 | public void onConfig(TextParams params) { | 55 | public void onConfig(TextParams params) { |
54 | params.gravity = Gravity.CENTER; | 56 | params.gravity = Gravity.CENTER; |
55 | params.padding = new int[]{50, 50, 50, 50}; | 57 | params.padding = new int[]{50, 50, 50, 50}; |
56 | } | 58 | } |
57 | }) | 59 | }) |
58 | .setText("当前无网络,请检查网络设置") | 60 | .setText("当前无网络,请检查网络设置") |
59 | .setNegative("继续使用", null) | 61 | .setNegative("继续使用", null) |
60 | .setPositive("设置网络", new View.OnClickListener() { | 62 | .setPositive("设置网络", new View.OnClickListener() { |
61 | @Override | 63 | @Override |
62 | public void onClick(View v) { | 64 | public void onClick(View v) { |
63 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 65 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
64 | startActivity(intent); | 66 | startActivity(intent); |
65 | } | 67 | } |
66 | }) | 68 | }) |
67 | .show(); | 69 | .show(); |
68 | } | 70 | } |
69 | String islogin =SaveParam.getInstance().getLoginParam(this,"login"); | 71 | String islogin =SaveParam.getInstance().getLoginParam(this,"login"); |
70 | String type =SaveParam.getInstance().getCustomizeParam(LoginAndRegisterActivity.this,SaveParam.ACCOUNT); | 72 | String type =SaveParam.getInstance().getCustomizeParam(LoginAndRegisterActivity.this,SaveParam.ACCOUNT); |
71 | if (type==null){ | 73 | if (type==null){ |
72 | SaveParam.getInstance().saveCustomizeParam(LoginAndRegisterActivity.this, SaveParam.ACCOUNT,"1"); | 74 | SaveParam.getInstance().saveCustomizeParam(LoginAndRegisterActivity.this, SaveParam.ACCOUNT,"1"); |
73 | } | 75 | } |
74 | if ("true".equals(islogin)){ | 76 | if ("true".equals(islogin)){ |
75 | Intent intent = new Intent(); | 77 | Intent intent = new Intent(); |
76 | intent.setClass(LoginAndRegisterActivity.this,MainActivity.class); | 78 | intent.setClass(LoginAndRegisterActivity.this,MainActivity.class); |
77 | startActivity(intent); | 79 | startActivity(intent); |
78 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 80 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
79 | finish(); | 81 | finish(); |
80 | 82 | ||
81 | } | 83 | } |
82 | setContentView(R.layout.activity_loginandregister); | 84 | setContentView(R.layout.activity_loginandregister); |
83 | initView(); | 85 | initView(); |
84 | initData(); | 86 | initData(); |
87 | updateVersion(); | ||
85 | setLister(); | 88 | setLister(); |
86 | } | 89 | } |
87 | 90 | ||
88 | private void initView() { | 91 | private void initView() { |
89 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); | 92 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); |
90 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); | 93 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); |
91 | } | 94 | } |
92 | 95 | ||
93 | private void initData() { | 96 | private void initData() { |
94 | loginlist = new ArrayList<>(); | 97 | loginlist = new ArrayList<>(); |
95 | for (int i = 0; i < title.size(); i++) { | 98 | for (int i = 0; i < title.size(); i++) { |
96 | if (title.get(i).equals("登录")) { | 99 | if (title.get(i).equals("登录")) { |
97 | loginlist.add(LoginFragment.newInstance(i + 1)); | 100 | loginlist.add(LoginFragment.newInstance(i + 1)); |
98 | } else { | 101 | } else { |
99 | loginlist.add(RegisterFragment.newInstance(i + 1)); | 102 | loginlist.add(RegisterFragment.newInstance(i + 1)); |
100 | } | 103 | } |
101 | } | 104 | } |
102 | 105 | ||
103 | 106 | ||
104 | //设置Tab上的标题 | 107 | //设置Tab上的标题 |
105 | tableLayout.setData(title); | 108 | tableLayout.setData(title); |
106 | //设置关联的ViewPager | 109 | //设置关联的ViewPager |
107 | tableLayout.setViewPager(viewPager, 0); | 110 | tableLayout.setViewPager(viewPager, 0); |
108 | logindapter = new LoginAndRegisterAdapter(loginlist, getSupportFragmentManager()); | 111 | logindapter = new LoginAndRegisterAdapter(loginlist, getSupportFragmentManager()); |
109 | //给ViewPager设置适配器 | 112 | //给ViewPager设置适配器 |
110 | viewPager.setAdapter(logindapter); | 113 | viewPager.setAdapter(logindapter); |
111 | //设置滑动时数据不丢失 | 114 | //设置滑动时数据不丢失 |
112 | viewPager.setOffscreenPageLimit(0); | 115 | viewPager.setOffscreenPageLimit(0); |
113 | //将TabLayout和ViewPager关联起来。 | 116 | //将TabLayout和ViewPager关联起来。 |
114 | } | 117 | } |
115 | 118 | ||
116 | private void setLister() { | 119 | private void setLister() { |
117 | 120 | ||
118 | } | 121 | } |
119 | 122 | ||
123 | //////版本更新 | ||
124 | private void updateVersion() { | ||
125 | if (PermissionUtil.hasReadExternalStoragePermission(this)) { | ||
126 | UpdateChecker updateChecker = new UpdateChecker(this); | ||
127 | updateChecker.checkForUpdates(); | ||
128 | } | ||
129 | } | ||
130 | |||
120 | 131 | ||
121 | } | 132 | } |
122 | 133 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Dialog; | ||
3 | import android.content.Context; | 4 | import android.content.Context; |
4 | import android.content.Intent; | 5 | import android.content.Intent; |
5 | import android.content.pm.PackageManager; | 6 | import android.content.pm.PackageManager; |
6 | import android.net.Uri; | 7 | import android.net.Uri; |
7 | import android.os.Build; | 8 | import android.os.Build; |
8 | import android.os.Bundle; | 9 | import android.os.Bundle; |
9 | import android.os.Handler; | 10 | import android.os.Handler; |
10 | import android.os.Message; | 11 | import android.os.Message; |
11 | import android.provider.MediaStore; | 12 | import android.provider.MediaStore; |
12 | import android.support.annotation.NonNull; | 13 | import android.support.annotation.NonNull; |
13 | import android.support.v4.app.FragmentActivity; | 14 | import android.support.v4.app.FragmentActivity; |
14 | import android.support.v4.content.FileProvider; | 15 | import android.support.v4.content.FileProvider; |
15 | import android.support.v7.widget.LinearLayoutManager; | 16 | import android.support.v7.widget.LinearLayoutManager; |
16 | import android.support.v7.widget.RecyclerView; | 17 | import android.support.v7.widget.RecyclerView; |
17 | import android.util.Log; | 18 | import android.util.Log; |
18 | import android.view.KeyEvent; | 19 | import android.view.KeyEvent; |
20 | import android.view.LayoutInflater; | ||
19 | import android.view.View; | 21 | import android.view.View; |
22 | import android.view.ViewGroup; | ||
23 | import android.widget.Button; | ||
20 | import android.widget.GridView; | 24 | import android.widget.GridView; |
21 | import android.widget.ImageView; | 25 | import android.widget.ImageView; |
22 | import android.widget.LinearLayout; | 26 | import android.widget.LinearLayout; |
23 | import android.widget.TextView; | 27 | import android.widget.TextView; |
24 | import android.widget.Toast; | 28 | import android.widget.Toast; |
25 | 29 | ||
26 | import com.google.gson.Gson; | 30 | import com.google.gson.Gson; |
27 | import com.hjx.personalcenter.R; | 31 | import com.hjx.personalcenter.R; |
28 | import com.hjx.personalcenter.adapter.MianGridAdapter; | 32 | import com.hjx.personalcenter.adapter.MianGridAdapter; |
29 | import com.hjx.personalcenter.adapter.VideoAdapter; | 33 | import com.hjx.personalcenter.adapter.VideoAdapter; |
30 | import com.hjx.personalcenter.customdialog.HeadDialog; | 34 | import com.hjx.personalcenter.customdialog.HeadDialog; |
31 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 35 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
32 | import com.hjx.personalcenter.db.Content; | 36 | import com.hjx.personalcenter.db.Content; |
33 | import com.hjx.personalcenter.db.SaveParam; | 37 | import com.hjx.personalcenter.db.SaveParam; |
34 | import com.hjx.personalcenter.http.HttpCode; | 38 | import com.hjx.personalcenter.http.HttpCode; |
35 | import com.hjx.personalcenter.http.HttpManager; | 39 | import com.hjx.personalcenter.http.HttpManager; |
36 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 40 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
37 | import com.hjx.personalcenter.model.DefautPublishInfo; | 41 | import com.hjx.personalcenter.model.DefautPublishInfo; |
38 | import com.hjx.personalcenter.model.PesonalInfo; | 42 | import com.hjx.personalcenter.model.PesonalInfo; |
39 | import com.hjx.personalcenter.model.SignInfo; | 43 | import com.hjx.personalcenter.model.SignInfo; |
40 | import com.hjx.personalcenter.model.VideoInfo; | 44 | import com.hjx.personalcenter.model.VideoInfo; |
41 | import com.hjx.personalcenter.update.UpdateChecker; | 45 | import com.hjx.personalcenter.update.UpdateChecker; |
42 | import com.hjx.personalcenter.util.AlertUtils; | 46 | import com.hjx.personalcenter.util.AlertUtils; |
43 | import com.hjx.personalcenter.util.BrithdayStar; | 47 | import com.hjx.personalcenter.util.BrithdayStar; |
44 | import com.hjx.personalcenter.util.CropUtils; | 48 | import com.hjx.personalcenter.util.CropUtils; |
45 | import com.hjx.personalcenter.util.DialogPermission; | 49 | import com.hjx.personalcenter.util.DialogPermission; |
46 | import com.hjx.personalcenter.util.FileUtil; | 50 | import com.hjx.personalcenter.util.FileUtil; |
47 | import com.hjx.personalcenter.util.GetDevicesUtil; | 51 | import com.hjx.personalcenter.util.GetDevicesUtil; |
48 | import com.hjx.personalcenter.util.PermissionUtil; | 52 | import com.hjx.personalcenter.util.PermissionUtil; |
49 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 53 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
50 | import com.mylhyl.circledialog.CircleDialog; | 54 | import com.mylhyl.circledialog.CircleDialog; |
51 | import com.mylhyl.circledialog.callback.ConfigInput; | 55 | import com.mylhyl.circledialog.callback.ConfigInput; |
52 | import com.mylhyl.circledialog.params.InputParams; | 56 | import com.mylhyl.circledialog.params.InputParams; |
53 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 57 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
54 | import com.squareup.picasso.Picasso; | 58 | import com.squareup.picasso.Picasso; |
55 | import com.zaaach.toprightmenu.MenuItem; | 59 | import com.zaaach.toprightmenu.MenuItem; |
56 | import com.zaaach.toprightmenu.TopRightMenu; | 60 | import com.zaaach.toprightmenu.TopRightMenu; |
57 | 61 | ||
58 | import org.json.JSONException; | 62 | import org.json.JSONException; |
59 | import org.json.JSONObject; | 63 | import org.json.JSONObject; |
60 | 64 | ||
61 | import java.io.File; | 65 | import java.io.File; |
62 | import java.io.UnsupportedEncodingException; | 66 | import java.io.UnsupportedEncodingException; |
63 | import java.util.ArrayList; | 67 | import java.util.ArrayList; |
64 | import java.util.List; | 68 | import java.util.List; |
65 | 69 | ||
66 | public class MainActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 70 | public class MainActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
67 | private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex, tv_edit_presoninfo; | 71 | private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex,iv_switch, tv_edit_presoninfo; |
68 | private TextView tv_sign, | 72 | private TextView tv_sign, |
69 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 73 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
70 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; | 74 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; |
71 | private TextView linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass, iv_look_card; | 75 | private TextView linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass, iv_look_card; |
72 | private TopRightMenu mTopRightMenu; | 76 | private TopRightMenu mTopRightMenu; |
73 | private LinearLayout view_novedeo; | 77 | private LinearLayout view_novedeo; |
74 | private View sssssssss; | 78 | private View sssssssss; |
75 | //水平滑动 | 79 | //水平滑动 |
76 | private RecyclerView mRecyclerView; | 80 | private RecyclerView mRecyclerView; |
77 | private GridView mRecyclerViewpublish; | 81 | private GridView mRecyclerViewpublish; |
78 | private VideoAdapter RecyclerViewadapter; | 82 | private VideoAdapter RecyclerViewadapter; |
79 | private MianGridAdapter RecyclerViewadapterpublish; | 83 | private MianGridAdapter RecyclerViewadapterpublish; |
80 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 84 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
81 | 85 | ||
82 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); | 86 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); |
83 | private boolean showIcon = false; | 87 | private boolean showIcon = false; |
84 | private boolean dimBg = false; | 88 | private boolean dimBg = false; |
85 | private boolean needAnim = true; | 89 | private boolean needAnim = true; |
86 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 90 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
87 | private static final int REQUEST_CODE_ALBUM = 2; | 91 | private static final int REQUEST_CODE_ALBUM = 2; |
88 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 92 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
89 | private ImageView mSimpleDraweeView; | 93 | private ImageView mSimpleDraweeView; |
90 | private File file; | 94 | private File file; |
91 | private Uri uri; | 95 | private Uri uri; |
92 | String portrait; | 96 | String portrait; |
97 | private Button middle_btn,primary_btn; | ||
98 | private Dialog hintDialog; | ||
99 | |||
93 | Handler handler = new Handler() { | 100 | Handler handler = new Handler() { |
94 | @Override | 101 | @Override |
95 | public void handleMessage(Message msg) { | 102 | public void handleMessage(Message msg) { |
96 | super.handleMessage(msg); | 103 | super.handleMessage(msg); |
97 | switch (msg.what) { | 104 | switch (msg.what) { |
98 | case HttpCode.GETINFO: | 105 | case HttpCode.GETINFO: |
99 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; | 106 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; |
100 | tv_username.setText(cardinfoBean.getNickName()); | 107 | tv_username.setText(cardinfoBean.getNickName()); |
101 | tv_username1.setText(cardinfoBean.getNickName()); | 108 | tv_username1.setText(cardinfoBean.getNickName()); |
102 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 109 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
103 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 110 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
104 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 111 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
105 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 112 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
106 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 113 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
107 | String sex = cardinfoBean.getGender(); | 114 | String sex = cardinfoBean.getGender(); |
108 | if ("0".equals(sex)) { | 115 | if ("0".equals(sex)) { |
109 | tv_sex.setText("男"); | 116 | tv_sex.setText("男"); |
110 | iv_sex.setImageResource(R.mipmap.men); | 117 | iv_sex.setImageResource(R.mipmap.men); |
111 | } else { | 118 | } else { |
112 | tv_sex.setText("女"); | 119 | tv_sex.setText("女"); |
113 | iv_sex.setImageResource(R.mipmap.women); | 120 | iv_sex.setImageResource(R.mipmap.women); |
114 | } | 121 | } |
115 | portrait = cardinfoBean.getPortrait(); | 122 | portrait = cardinfoBean.getPortrait(); |
116 | //mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | 123 | //mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); |
117 | if (portrait!=null&&!portrait.isEmpty()) { | 124 | if (portrait!=null&&!portrait.isEmpty()) { |
118 | Picasso.with(MainActivity.this).load(portrait).into(mSimpleDraweeView); | 125 | Picasso.with(MainActivity.this).load(portrait).into(mSimpleDraweeView); |
119 | } | 126 | } |
120 | //加载星座 | 127 | //加载星座 |
121 | BrithdayStar brithdayStar = new BrithdayStar(); | 128 | BrithdayStar brithdayStar = new BrithdayStar(); |
122 | if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) { | 129 | if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) { |
123 | tv_mygad.setText(""); | 130 | tv_mygad.setText(""); |
124 | } else { | 131 | } else { |
125 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); | 132 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); |
126 | tv_mygad.setText(xiongzuo); | 133 | tv_mygad.setText(xiongzuo); |
127 | } | 134 | } |
128 | //保存个人信息 | 135 | //保存个人信息 |
129 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName()); | 136 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName()); |
130 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName()); | 137 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName()); |
131 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName()); | 138 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName()); |
132 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday()); | 139 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday()); |
133 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString()); | 140 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString()); |
134 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq()); | 141 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq()); |
135 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName()); | 142 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName()); |
136 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress()); | 143 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress()); |
137 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId()); | 144 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId()); |
138 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait()); | 145 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait()); |
139 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId()); | 146 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId()); |
140 | String graderID = cardinfoBean.getGrade().getGradeId(); | 147 | String graderID = cardinfoBean.getGrade().getGradeId(); |
141 | Log.e("test", "nianji" + graderID); | 148 | Log.e("test", "nianji" + graderID); |
142 | try { | 149 | try { |
143 | long auserID = Long.parseLong(graderID); | 150 | long auserID = Long.parseLong(graderID); |
144 | String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | 151 | String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); |
145 | // if ((auserID < 8) && (ss == null)) { | 152 | // if ((auserID < 8) && (ss == null)) { |
146 | // Intent intentbroad = new Intent(); | 153 | // Intent intentbroad = new Intent(); |
147 | // intentbroad.putExtra("info", "小学"); | 154 | // intentbroad.putExtra("info", "小学"); |
148 | // //4、定义广播发送的action | 155 | // //4、定义广播发送的action |
149 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 156 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
150 | // //5、发送广播 | 157 | // //5、发送广播 |
151 | // sendBroadcast(intentbroad); | 158 | // sendBroadcast(intentbroad); |
152 | // Log.i("---", "发送完了"); | 159 | // Log.i("---", "发送完了"); |
153 | // } | 160 | // } |
154 | } catch (NumberFormatException e) { | 161 | } catch (NumberFormatException e) { |
155 | e.printStackTrace(); | 162 | e.printStackTrace(); |
156 | } | 163 | } |
157 | 164 | ||
158 | 165 | ||
159 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); | 166 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); |
160 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 167 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
161 | //账户类型 | 168 | //账户类型 |
162 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 169 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
163 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 170 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
164 | 171 | ||
165 | try { | 172 | try { |
166 | Object auserID; | 173 | Object auserID; |
167 | int type; | 174 | int type; |
168 | int graderIDs = Integer.parseInt(graderID); | 175 | int graderIDs = Integer.parseInt(graderID); |
169 | if ("2".equals(accounts)) { | 176 | if ("2".equals(accounts)) { |
170 | type = Integer.parseInt(accounts); | 177 | type = Integer.parseInt(accounts); |
171 | auserID = childID; | 178 | auserID = childID; |
172 | } else { | 179 | } else { |
173 | type = Integer.parseInt(accounts); | 180 | type = Integer.parseInt(accounts); |
174 | auserID = Long.parseLong(userID); | 181 | auserID = Long.parseLong(userID); |
175 | } | 182 | } |
176 | //获取版本信息 | 183 | //获取版本信息 |
177 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); | 184 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); |
178 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); | 185 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); |
179 | 186 | ||
180 | } catch (NumberFormatException e) { | 187 | } catch (NumberFormatException e) { |
181 | e.printStackTrace(); | 188 | e.printStackTrace(); |
182 | } | 189 | } |
183 | 190 | ||
184 | break; | 191 | break; |
185 | case HttpCode.SIGN: | 192 | case HttpCode.SIGN: |
186 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; | 193 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; |
187 | if (dataBean.getSignature() == null) { | 194 | if (dataBean.getSignature() == null) { |
188 | tv_sign.setText("你还未设置个性签名"); | 195 | tv_sign.setText("你还未设置个性签名"); |
189 | } else { | 196 | } else { |
190 | tv_sign.setText(dataBean.getSignature()); | 197 | tv_sign.setText(dataBean.getSignature()); |
191 | } | 198 | } |
192 | 199 | ||
193 | break; | 200 | break; |
194 | case HttpCode.PUBLISH_SUCESS: | 201 | case HttpCode.PUBLISH_SUCESS: |
195 | defautPublishInfos.clear(); | 202 | defautPublishInfos.clear(); |
196 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 203 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
197 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 204 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
198 | Gson gson = new Gson(); | 205 | Gson gson = new Gson(); |
199 | Log.e("test", "(List<DefautPublishInfo.DataBean>) msg.obj" + gson.toJson(msg.obj)); | 206 | Log.e("test", "(List<DefautPublishInfo.DataBean>) msg.obj" + gson.toJson(msg.obj)); |
200 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj)); | 207 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj)); |
201 | break; | 208 | break; |
202 | case HttpCode.GETVIDIO_SUCESS: | 209 | case HttpCode.GETVIDIO_SUCESS: |
203 | videoinfo.clear(); | 210 | videoinfo.clear(); |
204 | view_novedeo.setVisibility(View.GONE); | 211 | view_novedeo.setVisibility(View.GONE); |
205 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); | 212 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); |
206 | RecyclerViewadapter.notifyDataSetChanged(); | 213 | RecyclerViewadapter.notifyDataSetChanged(); |
207 | break; | 214 | break; |
208 | case HttpCode.SUCHCARDINFOONE: | 215 | case HttpCode.SUCHCARDINFOONE: |
209 | JSONObject jsonObject; | 216 | JSONObject jsonObject; |
210 | String status; | 217 | String status; |
211 | try { | 218 | try { |
212 | jsonObject = new JSONObject((String) msg.obj); | 219 | jsonObject = new JSONObject((String) msg.obj); |
213 | status = jsonObject.getString("status"); | 220 | status = jsonObject.getString("status"); |
214 | if (status.equals("1")) { | 221 | if (status.equals("1")) { |
215 | //sssssssss.setVisibility(View.VISIBLE); | 222 | //sssssssss.setVisibility(View.VISIBLE); |
216 | tv_yangji.setVisibility(View.GONE); | 223 | tv_yangji.setVisibility(View.GONE); |
217 | iv_look_card.setVisibility(View.VISIBLE); | 224 | iv_look_card.setVisibility(View.VISIBLE); |
218 | //客机没有保卡 | 225 | //客机没有保卡 |
219 | } else if (status.equals("2001")) { | 226 | } else if (status.equals("2001")) { |
220 | //sssssssss.setVisibility(View.VISIBLE); | 227 | //sssssssss.setVisibility(View.VISIBLE); |
221 | tv_yangji.setVisibility(View.GONE); | 228 | tv_yangji.setVisibility(View.GONE); |
222 | iv_look_card.setVisibility(View.VISIBLE); | 229 | iv_look_card.setVisibility(View.VISIBLE); |
223 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录"); | 230 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录"); |
224 | SaveParam.getInstance().clearData(MainActivity.this); | 231 | SaveParam.getInstance().clearData(MainActivity.this); |
225 | Intent settingintent = new Intent(); | 232 | Intent settingintent = new Intent(); |
226 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 233 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
227 | startActivity(settingintent); | 234 | startActivity(settingintent); |
235 | MainActivity.this.finish(); | ||
228 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 236 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
229 | } else if (status.equals("2002")) {//样机 | 237 | } else if (status.equals("2002")) {//样机 |
230 | //sssssssss.setVisibility(View.INVISIBLE); | 238 | //sssssssss.setVisibility(View.INVISIBLE); |
231 | iv_look_card.setVisibility(View.INVISIBLE); | 239 | iv_look_card.setVisibility(View.INVISIBLE); |
232 | tv_yangji.setVisibility(View.VISIBLE); | 240 | tv_yangji.setVisibility(View.VISIBLE); |
233 | 241 | ||
234 | } else { | 242 | } else { |
235 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); | 243 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); |
236 | } | 244 | } |
237 | } catch (JSONException e) { | 245 | } catch (JSONException e) { |
238 | e.printStackTrace(); | 246 | e.printStackTrace(); |
239 | } | 247 | } |
240 | case HttpCode.TOUXIANG: | 248 | case HttpCode.TOUXIANG: |
241 | if (msg.obj.equals("1")){ | 249 | if (msg.obj.equals("1")){ |
242 | String s = SaveParam.getInstance().getLoginParam(MainActivity.this,SaveParam.PORTAIT); | 250 | String s = SaveParam.getInstance().getLoginParam(MainActivity.this,SaveParam.PORTAIT); |
243 | if (portrait!=null&&!portrait.isEmpty()){ | 251 | if (portrait!=null&&!portrait.isEmpty()){ |
244 | Picasso.with(MainActivity.this).load(s).into(mSimpleDraweeView); | 252 | Picasso.with(MainActivity.this).load(s).into(mSimpleDraweeView); |
245 | } | 253 | } |
246 | 254 | ||
247 | } | 255 | } |
248 | break; | 256 | break; |
257 | case HttpCode.RELOGIN: | ||
258 | //清除数据 | ||
259 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.ACCOUNT, "1"); | ||
260 | SaveParam.getInstance().clearData(MainActivity.this); | ||
261 | Intent settingintent = new Intent(); | ||
262 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | ||
263 | startActivity(settingintent); | ||
264 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
265 | finish(); | ||
266 | break; | ||
249 | case HttpCode.RELOGIN: | 267 | |
250 | //清除数据 | 268 | |
251 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.ACCOUNT, "1"); | 269 | } |
252 | SaveParam.getInstance().clearData(MainActivity.this); | 270 | } |
253 | Intent settingintent = new Intent(); | 271 | }; |
254 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 272 | |
255 | startActivity(settingintent); | 273 | @Override |
256 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 274 | protected void onCreate(Bundle savedInstanceState) { |
257 | finish(); | 275 | super.onCreate(savedInstanceState); |
258 | break; | 276 | setContentView(R.layout.activity_main); |
259 | 277 | SysApplication.getInstance().addActivity(this); | |
260 | 278 | initView(); | |
261 | } | 279 | initData(); |
262 | } | 280 | initLister(); |
263 | }; | 281 | updateVersion(); |
282 | GetDevicesUtil.getMacAddress(this); | ||
264 | 283 | } | |
265 | @Override | 284 | |
266 | protected void onCreate(Bundle savedInstanceState) { | 285 | //////版本更新 |
267 | super.onCreate(savedInstanceState); | 286 | private void updateVersion() { |
268 | setContentView(R.layout.activity_main); | 287 | if (PermissionUtil.hasReadExternalStoragePermission(this)) { |
269 | SysApplication.getInstance().addActivity(this); | 288 | UpdateChecker updateChecker = new UpdateChecker(this); |
270 | initView(); | 289 | updateChecker.checkForUpdates(); |
271 | initData(); | 290 | } |
272 | initLister(); | 291 | } |
273 | updateVersion(); | 292 | |
274 | } | 293 | private void initView() { |
275 | 294 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | |
276 | //////版本更新 | 295 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); |
277 | private void updateVersion() { | 296 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); |
278 | UpdateChecker updateChecker = new UpdateChecker(this); | 297 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
279 | updateChecker.checkForUpdates(); | 298 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
280 | 299 | tv_sign = (TextView) findViewById(R.id.tv_sign); | |
281 | 300 | //头像 | |
282 | } | 301 | mSimpleDraweeView = (ImageView) findViewById(R.id.iv_head); |
283 | 302 | //初始化个人信息 | |
284 | private void initView() { | 303 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
304 | iv_switch = (ImageView) findViewById(R.id.iv_switch); | ||
285 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 305 | tv_username = (TextView) findViewById(R.id.tv_username); |
286 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); | 306 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
287 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); | 307 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
288 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 308 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
289 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 309 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
290 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 310 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
291 | //头像 | 311 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
292 | mSimpleDraweeView = (ImageView) findViewById(R.id.iv_head); | 312 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
293 | //初始化个人信息 | 313 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
294 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 314 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); |
295 | tv_username = (TextView) findViewById(R.id.tv_username); | 315 | //跳转其他应用 |
296 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 316 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); |
297 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 317 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); |
298 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 318 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); |
299 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 319 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); |
300 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 320 | // |
301 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 321 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
302 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 322 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); |
303 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 323 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); |
304 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); | 324 | |
305 | //跳转其他应用 | 325 | //sssssssss = findViewById(R.id.sssssssss); |
306 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); | 326 | |
307 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); | 327 | } |
308 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); | 328 | |
309 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); | 329 | |
310 | // | 330 | private void initData() { |
311 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 331 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
312 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); | 332 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
313 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); | 333 | uri = Uri.fromFile(file); |
314 | 334 | } else { | |
315 | //sssssssss = findViewById(R.id.sssssssss); | 335 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
316 | 336 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter.fileprovider", file); | |
317 | } | 337 | } |
318 | 338 | //设置布局管理器 | |
319 | 339 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | |
320 | private void initData() { | 340 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); |
321 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 341 | |
322 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 342 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); |
323 | uri = Uri.fromFile(file); | 343 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); |
324 | } else { | 344 | |
325 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 345 | mRecyclerView.setLayoutManager(linearLayoutManager); |
326 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 346 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); |
327 | } | 347 | |
328 | //设置布局管理器 | 348 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); |
329 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 349 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); |
330 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); | 350 | |
331 | 351 | //设置视频适配器 | |
332 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); | 352 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); |
333 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); | 353 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this); |
334 | 354 | ||
335 | mRecyclerView.setLayoutManager(linearLayoutManager); | 355 | //版本信息适配器 |
336 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); | 356 | mRecyclerView.setAdapter(RecyclerViewadapter); |
337 | 357 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | |
338 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); | 358 | |
339 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); | 359 | //判断保卡信息是否为样机 |
340 | 360 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); | |
341 | //设置视频适配器 | 361 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); |
342 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); | 362 | Log.d("test", "yangji" + yangji); |
343 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this); | 363 | if ("1".equals(yangji)) { |
344 | 364 | //sssssssss.setVisibility(View.INVISIBLE); | |
345 | //版本信息适配器 | 365 | iv_look_card.setVisibility(View.INVISIBLE); |
346 | mRecyclerView.setAdapter(RecyclerViewadapter); | 366 | tv_yangji.setVisibility(View.VISIBLE); |
347 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | 367 | } else { |
348 | 368 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.YANGJI, "0"); | |
349 | //判断保卡信息是否为样机 | 369 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); |
350 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); | 370 | |
351 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); | 371 | } |
352 | Log.d("test", "yangji" + yangji); | 372 | |
353 | if ("1".equals(yangji)) { | 373 | |
354 | //sssssssss.setVisibility(View.INVISIBLE); | 374 | } |
355 | iv_look_card.setVisibility(View.INVISIBLE); | 375 | |
356 | tv_yangji.setVisibility(View.VISIBLE); | 376 | private void initLister() { |
357 | } else { | 377 | iv_imformatioan.setOnClickListener(this); |
358 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.YANGJI, "0"); | 378 | iv_look_card.setOnClickListener(this); |
359 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); | 379 | tv_edit_presoninfo.setOnClickListener(this); |
360 | 380 | iv_setting.setOnClickListener(this); | |
361 | } | 381 | iv_sign.setOnClickListener(this); |
362 | 382 | tv_sign.setOnClickListener(this); | |
363 | 383 | mSimpleDraweeView.setOnClickListener(this); | |
364 | } | 384 | linel_mycuoti.setOnClickListener(this); |
365 | 385 | linel_mynote.setOnClickListener(this); | |
366 | private void initLister() { | 386 | linel_mycollege.setOnClickListener(this); |
367 | iv_imformatioan.setOnClickListener(this); | 387 | linel_myclass.setOnClickListener(this); |
388 | iv_switch.setOnClickListener(this); | ||
368 | iv_look_card.setOnClickListener(this); | 389 | |
369 | tv_edit_presoninfo.setOnClickListener(this); | 390 | } |
370 | iv_setting.setOnClickListener(this); | 391 | |
371 | iv_sign.setOnClickListener(this); | 392 | @Override |
372 | tv_sign.setOnClickListener(this); | 393 | public void onClick(View v) { |
373 | mSimpleDraweeView.setOnClickListener(this); | 394 | switch (v.getId()) { |
374 | linel_mycuoti.setOnClickListener(this); | 395 | case R.id.iv_imformatioan: |
375 | linel_mynote.setOnClickListener(this); | 396 | Intent intent = new Intent(); |
376 | linel_mycollege.setOnClickListener(this); | 397 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
377 | linel_myclass.setOnClickListener(this); | 398 | startActivity(intent); |
378 | 399 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | |
379 | } | 400 | break; |
380 | 401 | case R.id.iv_look_card: | |
381 | @Override | 402 | Intent lookintent = new Intent(); |
382 | public void onClick(View v) { | 403 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
383 | switch (v.getId()) { | 404 | startActivity(lookintent); |
384 | case R.id.iv_imformatioan: | 405 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
385 | Intent intent = new Intent(); | 406 | break; |
386 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 407 | case R.id.tv_edit_presoninfo: |
387 | startActivity(intent); | 408 | Intent editintent = new Intent(); |
388 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 409 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
389 | break; | 410 | startActivity(editintent); |
390 | case R.id.iv_look_card: | 411 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
391 | Intent lookintent = new Intent(); | 412 | break; |
392 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 413 | case R.id.iv_head: |
393 | startActivity(lookintent); | 414 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
394 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 415 | break; |
395 | break; | 416 | case R.id.iv_setting: |
396 | case R.id.tv_edit_presoninfo: | 417 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
397 | Intent editintent = new Intent(); | 418 | List<MenuItem> menuItems = new ArrayList<>(); |
398 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 419 | menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户")); |
399 | startActivity(editintent); | 420 | menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理")); |
400 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 421 | mTopRightMenu |
401 | break; | 422 | .setHeight(CropUtils.dp2px(this,100)) //默认高度480 |
402 | case R.id.iv_head: | 423 | .setWidth(CropUtils.dp2px(this,110)) //默认宽度wrap_content |
403 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 424 | .showIcon(showIcon) //显示菜单图标,默认为true |
404 | break; | 425 | .dimBackground(dimBg) //背景变暗,默认为true |
405 | case R.id.iv_setting: | 426 | .needAnimationStyle(needAnim) //显示动画,默认为true |
406 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 427 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
407 | List<MenuItem> menuItems = new ArrayList<>(); | 428 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
408 | menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户")); | 429 | @Override |
409 | menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理")); | 430 | public void onMenuItemClick(int position) { |
410 | mTopRightMenu | 431 | switch (position) { |
411 | .setHeight(150) //默认高度480 | 432 | case 0: |
412 | .setWidth(180) //默认宽度wrap_content | 433 | new CircleDialog.Builder(MainActivity.this) |
413 | .showIcon(showIcon) //显示菜单图标,默认为true | 434 | .setCanceledOnTouchOutside(false) |
414 | .dimBackground(dimBg) //背景变暗,默认为true | 435 | .setWidth(0.4f) |
415 | .needAnimationStyle(needAnim) //显示动画,默认为true | 436 | .setCancelable(false) |
416 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 437 | .setText("您确定要退出,更换其他账号登录吗?") |
417 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 438 | .setNegative("取消", null) |
418 | @Override | 439 | .setPositive("确定", new View.OnClickListener() { |
419 | public void onMenuItemClick(int position) { | 440 | @Override |
420 | switch (position) { | 441 | public void onClick(View v) { |
421 | case 0: | 442 | //String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); |
422 | new CircleDialog.Builder(MainActivity.this) | 443 | //int graderIDs = Integer.parseInt(graderID); |
423 | .setCanceledOnTouchOutside(false) | 444 | // if (graderIDs < 8) { |
424 | .setWidth(0.4f) | 445 | // Intent intentbroad = new Intent(); |
425 | .setCancelable(false) | 446 | // intentbroad.putExtra("info", "小学"); |
426 | .setText("您确定要退出,更换其他账号登录吗?") | 447 | // //4、定义广播发送的action |
427 | .setNegative("取消", null) | 448 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
428 | .setPositive("确定", new View.OnClickListener() { | 449 | // //5、发送广播 |
429 | @Override | 450 | // sendBroadcast(intentbroad); |
430 | public void onClick(View v) { | 451 | // Log.i("---", "发送完了"); |
431 | //String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | 452 | // } |
432 | //int graderIDs = Integer.parseInt(graderID); | 453 | //清除数据 |
433 | // if (graderIDs < 8) { | 454 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.ACCOUNT, "1"); |
434 | // Intent intentbroad = new Intent(); | 455 | SaveParam.getInstance().clearData(MainActivity.this); |
435 | // intentbroad.putExtra("info", "小学"); | 456 | Intent settingintent = new Intent(); |
436 | // //4、定义广播发送的action | 457 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
437 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 458 | startActivity(settingintent); |
438 | // //5、发送广播 | 459 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
439 | // sendBroadcast(intentbroad); | 460 | finish(); |
440 | // Log.i("---", "发送完了"); | 461 | } |
441 | // } | 462 | }) |
442 | //清除数据 | 463 | .show(); |
443 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.ACCOUNT, "1"); | 464 | break; |
444 | SaveParam.getInstance().clearData(MainActivity.this); | 465 | case 1: |
445 | Intent settingintent = new Intent(); | 466 | Intent accontMintent = new Intent(); |
446 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 467 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
447 | startActivity(settingintent); | 468 | startActivity(accontMintent); |
448 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 469 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
449 | finish(); | 470 | break; |
450 | } | 471 | } |
451 | }) | 472 | } |
452 | .show(); | 473 | }) |
453 | break; | 474 | .addMenuList(menuItems) |
454 | case 1: | 475 | .showAsDropDown(iv_setting, -120, 0); |
455 | Intent accontMintent = new Intent(); | 476 | break; |
456 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 477 | case R.id.iv_sign: |
457 | startActivity(accontMintent); | 478 | case R.id.tv_sign: |
458 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 479 | new CircleDialog.Builder(this) |
459 | break; | 480 | .setCanceledOnTouchOutside(false) |
460 | } | 481 | .setCancelable(true) |
461 | } | 482 | .setTitle("个性签名") |
462 | }) | 483 | .setInputHint("请输入个性签名") |
463 | .addMenuList(menuItems) | 484 | .setWidth(0.4f) |
464 | .showAsDropDown(iv_setting, -120, 0); | 485 | .setInputHeight(80) |
465 | break; | 486 | .configInput(new ConfigInput() { |
466 | case R.id.iv_sign: | 487 | @Override |
467 | case R.id.tv_sign: | 488 | public void onConfig(InputParams params) { |
468 | new CircleDialog.Builder(this) | 489 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
469 | .setCanceledOnTouchOutside(false) | 490 | } |
470 | .setCancelable(true) | 491 | }) |
471 | .setTitle("个性签名") | 492 | .setNegative("取消", new View.OnClickListener() { |
472 | .setInputHint("请输入个性签名") | 493 | @Override |
473 | .setWidth(0.4f) | 494 | public void onClick(View v) { |
474 | .setInputHeight(80) | 495 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
475 | .configInput(new ConfigInput() { | 496 | } |
476 | @Override | 497 | }) |
477 | public void onConfig(InputParams params) { | 498 | .setPositiveInput("确定", new OnInputClickListener() { |
478 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 499 | @Override |
479 | } | 500 | public void onClick(String text, View v) { |
480 | }) | 501 | if (text.equals("")) { |
481 | .setNegative("取消", new View.OnClickListener() { | 502 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
482 | @Override | 503 | } else { |
483 | public void onClick(View v) { | 504 | try { |
484 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 505 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
485 | } | 506 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
486 | }) | 507 | String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
487 | .setPositiveInput("确定", new OnInputClickListener() { | 508 | Object id = null; |
488 | @Override | 509 | long auserID = Long.parseLong(userID); |
489 | public void onClick(String text, View v) { | 510 | int typeaccount1 = Integer.parseInt(typeaccount); |
490 | if (text.equals("")) { | 511 | if (typeaccount1 == 2) { |
491 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 512 | id = childsID; |
492 | } else { | 513 | } else { |
493 | try { | 514 | id = auserID; |
494 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 515 | } |
495 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 516 | HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text); |
496 | String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 517 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
497 | Object id = null; | 518 | } catch (NumberFormatException e) { |
498 | long auserID = Long.parseLong(userID); | 519 | e.printStackTrace(); |
499 | int typeaccount1 = Integer.parseInt(typeaccount); | 520 | } |
500 | if (typeaccount1 == 2) { | 521 | |
501 | id = childsID; | 522 | tv_sign.setText(text); |
502 | } else { | 523 | } |
503 | id = auserID; | 524 | |
504 | } | 525 | } |
505 | HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text); | 526 | }) |
506 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 527 | .show(); |
507 | } catch (NumberFormatException e) { | 528 | break; |
529 | case R.id.iv_switch: | ||
530 | showSwitchDialog(); | ||
531 | break; | ||
532 | case R.id.middle_btn: | ||
533 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, "9"); | ||
534 | hintDialog.cancel(); | ||
535 | SysApplication.getInstance().exit(); | ||
536 | break; | ||
537 | case R.id.primary_btn: | ||
538 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, "3"); | ||
539 | hintDialog.cancel(); | ||
540 | SysApplication.getInstance().exit(); | ||
541 | break; | ||
508 | e.printStackTrace(); | 542 | case R.id.linel_mycuoti: |
509 | } | 543 | AlertUtils.showToast(this, "未安装该应用 "); |
510 | 544 | break; | |
511 | tv_sign.setText(text); | 545 | case R.id.linel_mynote: |
512 | } | 546 | AlertUtils.showToast(this, "未安装该应用 "); |
513 | 547 | break; | |
514 | } | 548 | case R.id.linel_mycollege: |
515 | }) | 549 | AlertUtils.showToast(this, "未安装该应用 "); |
516 | .show(); | 550 | break; |
517 | break; | 551 | case R.id.linel_myclass: |
518 | case R.id.linel_mycuoti: | 552 | AlertUtils.showToast(this, "未安装该应用 "); |
519 | AlertUtils.showToast(this, "未安装该应用 "); | 553 | break; |
520 | break; | 554 | } |
521 | case R.id.linel_mynote: | 555 | |
522 | AlertUtils.showToast(this, "未安装该应用 "); | 556 | } |
523 | break; | 557 | |
524 | case R.id.linel_mycollege: | 558 | @Override |
525 | AlertUtils.showToast(this, "未安装该应用 "); | 559 | protected void onPause() { |
526 | break; | 560 | super.onPause(); |
527 | case R.id.linel_myclass: | 561 | } |
528 | AlertUtils.showToast(this, "未安装该应用 "); | 562 | |
529 | break; | 563 | @Override |
530 | } | 564 | protected void onResume() { |
531 | 565 | super.onResume(); | |
532 | } | 566 | Content.changegradeinfoflag = 0; |
533 | 567 | Content.changeadressinfoflag = 0; | |
534 | @Override | 568 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
535 | protected void onPause() { | 569 | //获取个性签名 |
536 | super.onPause(); | 570 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
537 | } | 571 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
538 | 572 | ||
539 | @Override | 573 | try { |
540 | protected void onResume() { | 574 | Object auserID = 1; |
541 | super.onResume(); | 575 | long id = Long.parseLong(userID); |
542 | Content.changegradeinfoflag = 0; | 576 | int typeaccount1 = Integer.parseInt(typeaccount); |
543 | Content.changeadressinfoflag = 0; | 577 | //获取个人信息 |
544 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 578 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler); |
545 | //获取个性签名 | 579 | if (typeaccount1 == 2) { |
546 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 580 | auserID = childsID; |
547 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 581 | } else { |
548 | 582 | auserID = id; | |
549 | try { | 583 | } |
550 | Object auserID = 1; | 584 | Log.e("test", "个性签名的ID" + auserID); |
551 | long id = Long.parseLong(userID); | 585 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); |
552 | int typeaccount1 = Integer.parseInt(typeaccount); | 586 | //获取最近播放视频 |
553 | //获取个人信息 | 587 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); |
554 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler); | 588 | |
555 | if (typeaccount1 == 2) { | 589 | } catch (NumberFormatException e) { |
556 | auserID = childsID; | 590 | e.printStackTrace(); |
557 | } else { | 591 | } |
558 | auserID = id; | 592 | |
559 | } | 593 | } |
560 | Log.e("test", "个性签名的ID" + auserID); | 594 | |
561 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); | 595 | //回调头像监听 |
562 | //获取最近播放视频 | 596 | @Override |
563 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); | 597 | public void heard(Context context, View v, int headpitiaon) { |
564 | 598 | String picUrl = ""; | |
565 | } catch (NumberFormatException e) { | 599 | String userID; |
566 | e.printStackTrace(); | 600 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
567 | } | 601 | if ("2".equals(typeaccount)) { |
568 | 602 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | |
569 | } | 603 | } else { |
570 | 604 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | |
571 | //回调头像监听 | 605 | } |
572 | @Override | 606 | switch (v.getId()) { |
573 | public void heard(Context context, View v, int headpitiaon) { | 607 | //选择默认图片 |
574 | String picUrl = ""; | 608 | case R.id.oktakephone: |
575 | String userID; | 609 | if (headpitiaon == 1) { |
576 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 610 | mSimpleDraweeView.setImageDrawable(null); |
577 | if ("2".equals(typeaccount)) { | 611 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
578 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 612 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/75f05c02-3dbc-44e3-aec9-a73eca60ca8b.png"; |
579 | } else { | 613 | try { |
580 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 614 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
581 | } | 615 | } catch (UnsupportedEncodingException e) { |
582 | switch (v.getId()) { | 616 | e.printStackTrace(); |
583 | //选择默认图片 | 617 | } |
584 | case R.id.oktakephone: | 618 | } else if (headpitiaon == 2) { |
585 | if (headpitiaon == 1) { | 619 | mSimpleDraweeView.setImageDrawable(null); |
586 | mSimpleDraweeView.setImageDrawable(null); | 620 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
587 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 621 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/d102b0d8-435f-45a5-908f-ea43e02176d4.png"; |
588 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/75f05c02-3dbc-44e3-aec9-a73eca60ca8b.png"; | 622 | try { |
589 | try { | 623 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
590 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 624 | } catch (UnsupportedEncodingException e) { |
591 | } catch (UnsupportedEncodingException e) { | 625 | e.printStackTrace(); |
592 | e.printStackTrace(); | 626 | } |
593 | } | 627 | } else if (headpitiaon == 3) { |
594 | } else if (headpitiaon == 2) { | 628 | mSimpleDraweeView.setImageDrawable(null); |
595 | mSimpleDraweeView.setImageDrawable(null); | 629 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
596 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 630 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/a623a8ba-5e56-4827-95d1-ffeb0d6874d5.png"; |
597 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/d102b0d8-435f-45a5-908f-ea43e02176d4.png"; | 631 | try { |
598 | try { | 632 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
599 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 633 | } catch (UnsupportedEncodingException e) { |
600 | } catch (UnsupportedEncodingException e) { | 634 | e.printStackTrace(); |
601 | e.printStackTrace(); | 635 | } |
602 | } | 636 | } else if (headpitiaon == 4) { |
603 | } else if (headpitiaon == 3) { | 637 | mSimpleDraweeView.setImageDrawable(null); |
604 | mSimpleDraweeView.setImageDrawable(null); | 638 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
605 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 639 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/3d822736-a18d-47ae-b0b1-67752e027375.png"; |
606 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/a623a8ba-5e56-4827-95d1-ffeb0d6874d5.png"; | 640 | try { |
607 | try { | 641 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
608 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 642 | } catch (UnsupportedEncodingException e) { |
609 | } catch (UnsupportedEncodingException e) { | 643 | e.printStackTrace(); |
610 | e.printStackTrace(); | 644 | } |
611 | } | 645 | } else { |
612 | } else if (headpitiaon == 4) { | 646 | mSimpleDraweeView.setImageDrawable(null); |
613 | mSimpleDraweeView.setImageDrawable(null); | 647 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); |
614 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 648 | ; |
615 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/3d822736-a18d-47ae-b0b1-67752e027375.png"; | 649 | } |
616 | try { | 650 | |
617 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 651 | break; |
618 | } catch (UnsupportedEncodingException e) { | 652 | case R.id.canceltakephone: |
619 | e.printStackTrace(); | 653 | |
620 | } | 654 | break; |
621 | } else { | 655 | //拍摄和相册 |
622 | mSimpleDraweeView.setImageDrawable(null); | 656 | case R.id.take_pic: |
623 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); | 657 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
624 | ; | 658 | uploadAvatarFromPhotoRequest(); |
625 | } | 659 | } |
626 | 660 | break; | |
627 | break; | 661 | case R.id.xiangce: |
628 | case R.id.canceltakephone: | 662 | uploadAvatarFromAlbumRequest(); |
629 | 663 | break; | |
630 | break; | 664 | |
631 | //拍摄和相册 | 665 | } |
632 | case R.id.take_pic: | 666 | |
633 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 667 | } |
634 | uploadAvatarFromPhotoRequest(); | 668 | |
635 | } | 669 | //照相 |
636 | break; | 670 | private void uploadAvatarFromPhotoRequest() { |
637 | case R.id.xiangce: | 671 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
638 | uploadAvatarFromAlbumRequest(); | 672 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
639 | break; | 673 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
640 | 674 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | |
641 | } | 675 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
642 | 676 | } | |
643 | } | 677 | |
644 | 678 | //选择图库 | |
645 | //照相 | 679 | private void uploadAvatarFromAlbumRequest() { |
646 | private void uploadAvatarFromPhotoRequest() { | 680 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
647 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 681 | photoPickerIntent.setType("image/*"); |
648 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 682 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
649 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 683 | } |
650 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 684 | |
651 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 685 | //回掉 |
652 | } | 686 | @Override |
653 | 687 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
654 | //选择图库 | 688 | super.onActivityResult(requestCode, resultCode, data); |
655 | private void uploadAvatarFromAlbumRequest() { | 689 | if (resultCode != -1) { |
656 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 690 | return; |
657 | photoPickerIntent.setType("image/*"); | 691 | } |
658 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 692 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
659 | } | 693 | Uri newUri; |
660 | 694 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | |
661 | //回掉 | 695 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
662 | @Override | 696 | } else { |
663 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 697 | newUri = data.getData(); |
664 | super.onActivityResult(requestCode, resultCode, data); | 698 | } |
665 | if (resultCode != -1) { | 699 | if (newUri != null) { |
666 | return; | 700 | startPhotoZoom(newUri); |
667 | } | 701 | } else { |
668 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 702 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
669 | Uri newUri; | 703 | } |
670 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 704 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
671 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 705 | //startPhotoZoom(uri); |
672 | } else { | 706 | uploadAvatarFromPhoto(); |
673 | newUri = data.getData(); | 707 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
674 | } | 708 | uploadAvatarFromPhoto(); |
675 | if (newUri != null) { | 709 | } |
676 | startPhotoZoom(newUri); | 710 | } |
677 | } else { | 711 | |
678 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 712 | private void uploadAvatarFromPhoto() { |
679 | } | 713 | compressAndUploadAvatar(file.getPath()); |
680 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 714 | |
681 | //startPhotoZoom(uri); | 715 | } |
682 | uploadAvatarFromPhoto(); | 716 | |
683 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 717 | private void compressAndUploadAvatar(String fileSrc) { |
684 | uploadAvatarFromPhoto(); | 718 | |
685 | } | 719 | |
686 | } | 720 | //上传到服务器 |
687 | 721 | ||
688 | private void uploadAvatarFromPhoto() { | 722 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
689 | compressAndUploadAvatar(file.getPath()); | 723 | String mimeType = "image/*"; |
690 | 724 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | |
691 | } | 725 | //String fileName = cover.getName(); |
692 | 726 | String userID; | |
693 | private void compressAndUploadAvatar(String fileSrc) { | 727 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
694 | 728 | if ("2".equals(typeaccount)) { | |
695 | 729 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | |
696 | //上传到服务器 | 730 | } else { |
697 | 731 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | |
698 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 732 | } |
699 | String mimeType = "image/*"; | 733 | |
700 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 734 | //上传头像 |
701 | //String fileName = cover.getName(); | 735 | |
702 | String userID; | 736 | try { |
703 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 737 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc,handler); |
704 | if ("2".equals(typeaccount)) { | 738 | } catch (UnsupportedEncodingException e) { |
705 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 739 | e.printStackTrace(); |
706 | } else { | 740 | } |
707 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 741 | //mSimpleDraweeView.setImageURI(Uri.fromFile(new File(fileSrc))); |
708 | } | 742 | |
709 | 743 | // GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | |
710 | //上传头像 | 744 | // GenericDraweeHierarchy hierarchy = builder |
711 | 745 | // .setDesiredAspectRatio(1f) | |
712 | try { | 746 | // .setFailureImage(R.mipmap.header_default) |
713 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc,handler); | 747 | // //圆形头像 |
714 | } catch (UnsupportedEncodingException e) { | 748 | // .setRoundingParams(RoundingParams.asCircle()) |
715 | e.printStackTrace(); | 749 | // .build(); |
716 | } | 750 | // //OOM |
717 | //mSimpleDraweeView.setImageURI(Uri.fromFile(new File(fileSrc))); | 751 | // ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) |
718 | 752 | // //根据View的尺寸放缩图片 | |
719 | // GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 753 | // .setResizeOptions(new ResizeOptions(mSimpleDraweeView.getWidth(), mSimpleDraweeView.getHeight())) |
720 | // GenericDraweeHierarchy hierarchy = builder | 754 | // .build(); |
721 | // .setDesiredAspectRatio(1f) | 755 | // |
722 | // .setFailureImage(R.mipmap.header_default) | 756 | // |
723 | // //圆形头像 | 757 | // //加载本地图片 |
724 | // .setRoundingParams(RoundingParams.asCircle()) | 758 | // Uri uri = Uri.fromFile(cover); |
725 | // .build(); | 759 | //Picasso.with(MainActivity.this).load(uri).placeholder(R.mipmap.header_default).error(R.mipmap.header_default).transform(new RoundTransform(1000)).into(mSimpleDraweeView); |
726 | // //OOM | 760 | // DraweeController controller = Fresco.newDraweeControllerBuilder() |
727 | // ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) | 761 | // .setOldController(mSimpleDraweeView.getController()) |
728 | // //根据View的尺寸放缩图片 | 762 | // .setImageRequest(request) |
729 | // .setResizeOptions(new ResizeOptions(mSimpleDraweeView.getWidth(), mSimpleDraweeView.getHeight())) | 763 | // .setUri(uri) |
730 | // .build(); | 764 | // .build(); |
731 | // | 765 | // mSimpleDraweeView.setHierarchy(hierarchy); |
732 | // | 766 | // mSimpleDraweeView.setController(controller); |
733 | // //加载本地图片 | 767 | |
734 | // Uri uri = Uri.fromFile(cover); | 768 | } |
735 | //Picasso.with(MainActivity.this).load(uri).placeholder(R.mipmap.header_default).error(R.mipmap.header_default).transform(new RoundTransform(1000)).into(mSimpleDraweeView); | 769 | |
736 | // DraweeController controller = Fresco.newDraweeControllerBuilder() | 770 | public void startPhotoZoom(Uri uri) { |
737 | // .setOldController(mSimpleDraweeView.getController()) | 771 | Intent intent = new Intent("com.android.camera.action.CROP"); |
738 | // .setImageRequest(request) | 772 | intent.setDataAndType(uri, "image/*"); |
739 | // .setUri(uri) | 773 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
740 | // .build(); | 774 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
741 | // mSimpleDraweeView.setHierarchy(hierarchy); | 775 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
742 | // mSimpleDraweeView.setController(controller); | 776 | intent.putExtra("aspectY", 1);// x:y=1:1 |
743 | 777 | // intent.putExtra("outputX", 400);//图片输出大小 | |
744 | } | 778 | // intent.putExtra("outputY", 400); |
745 | 779 | intent.putExtra("output", Uri.fromFile(file)); | |
746 | public void startPhotoZoom(Uri uri) { | 780 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
747 | Intent intent = new Intent("com.android.camera.action.CROP"); | 781 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
748 | intent.setDataAndType(uri, "image/*"); | 782 | } |
749 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 783 | |
750 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 784 | @Override |
751 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 785 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
752 | intent.putExtra("aspectY", 1);// x:y=1:1 | 786 | switch (requestCode) { |
753 | // intent.putExtra("outputX", 400);//图片输出大小 | 787 | |
754 | // intent.putExtra("outputY", 400); | 788 | case PermissionUtil.REQUEST_SHOWCAMERA: |
755 | intent.putExtra("output", Uri.fromFile(file)); | 789 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
756 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 790 | // Permission Granted |
757 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 791 | uploadAvatarFromPhotoRequest(); |
758 | } | 792 | |
759 | 793 | } else { | |
760 | @Override | 794 | if (!SharedPreferenceMark.getHasShowCamera()) { |
761 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 795 | SharedPreferenceMark.setHasShowCamera(true); |
762 | switch (requestCode) { | 796 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
763 | 797 | ||
764 | case PermissionUtil.REQUEST_SHOWCAMERA: | 798 | } else { |
765 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 799 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
766 | // Permission Granted | 800 | .show(); |
767 | uploadAvatarFromPhotoRequest(); | 801 | } |
768 | 802 | } | |
769 | } else { | 803 | break; |
804 | case PermissionUtil.WRITE_EXTERNAL_STORAGE: | ||
805 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | ||
806 | // Permission Granted | ||
807 | UpdateChecker updateChecker = new UpdateChecker(this); | ||
808 | updateChecker.checkForUpdates(); | ||
809 | |||
810 | } else { | ||
811 | if (!SharedPreferenceMark.getHasShowCamera()) { | ||
812 | new DialogPermission(this, "没有存储权限将导致应用无法更新"); | ||
813 | |||
814 | } else { | ||
815 | Toast.makeText(this, "未获取存储权限,将导致应用无法更新", Toast.LENGTH_SHORT) | ||
816 | .show(); | ||
817 | } | ||
818 | } | ||
819 | break; | ||
770 | if (!SharedPreferenceMark.getHasShowCamera()) { | 820 | default: |
771 | SharedPreferenceMark.setHasShowCamera(true); | 821 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
772 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 822 | } |
773 | 823 | } | |
774 | } else { | 824 | |
775 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 825 | |
826 | private void showSwitchDialog() { | ||
827 | //自定义部分 | ||
828 | LayoutInflater mInflater = LayoutInflater.from(this); | ||
829 | View dialogView = mInflater.inflate(R.layout.dialog_layout, | ||
830 | null); | ||
831 | hintDialog = new Dialog(this, R.style.CustomHintDialog); | ||
832 | middle_btn = (Button) dialogView.findViewById(R.id.middle_btn); | ||
833 | primary_btn = (Button) dialogView.findViewById(R.id.primary_btn); | ||
834 | hintDialog.addContentView(dialogView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); | ||
835 | hintDialog.setCanceledOnTouchOutside(true); | ||
836 | hintDialog.show(); | ||
837 | middle_btn.setOnClickListener(this); | ||
838 | primary_btn.setOnClickListener(this); | ||
839 | } | ||
840 | |||
776 | .show(); | 841 | private long exitTime = 0; |
777 | } | 842 | |
778 | } | 843 | @Override |
779 | break; | 844 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
780 | default: | 845 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
781 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 846 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
782 | } | 847 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
783 | } | 848 | Toast.LENGTH_SHORT).show(); |
784 | 849 | exitTime = System.currentTimeMillis(); | |
785 | 850 | } else { | |
786 | private long exitTime = 0; | 851 | //SysApplication.getInstance().finishActivity(MainActivity.this); |
787 | 852 | SysApplication.getInstance().exit(); | |
788 | @Override | 853 | } |
789 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 854 | return false; |
790 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 855 | } |
791 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 856 | return super.onKeyDown(keyCode, event); |
792 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 857 | } |
793 | Toast.LENGTH_SHORT).show(); | 858 | } |
794 | exitTime = System.currentTimeMillis(); | 859 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MyApplication.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Application; | 3 | import android.app.Application; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.graphics.drawable.Drawable; | 5 | import android.graphics.drawable.Drawable; |
6 | import android.os.Looper; | 6 | import android.os.Looper; |
7 | import android.view.Gravity; | 7 | import android.view.Gravity; |
8 | import android.widget.TextView; | 8 | import android.widget.TextView; |
9 | import android.widget.Toast; | 9 | import android.widget.Toast; |
10 | 10 | ||
11 | import com.hjx.personalcenter.R; | 11 | import com.hjx.personalcenter.R; |
12 | import com.hjx.personalcenter.crash.CrashHandler; | 12 | import com.hjx.personalcenter.crash.CrashHandler; |
13 | import com.hjx.personalcenter.util.ImageCache; | 13 | import com.hjx.personalcenter.util.ImageCache; |
14 | import com.tencent.bugly.crashreport.CrashReport; | 14 | import com.tencent.bugly.crashreport.CrashReport; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Created by ${yf} on 2017/2/16. | 17 | * Created by ${yf} on 2017/2/16. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | public class MyApplication extends Application { | 20 | public class MyApplication extends Application { |
21 | 21 | ||
22 | private ImageCache mImageCache; | 22 | private ImageCache mImageCache; |
23 | private static Context context; | 23 | private static Context context; |
24 | private static MyApplication instance; | 24 | private static MyApplication instance; |
25 | @Override | 25 | @Override |
26 | public void onCreate() { | 26 | public void onCreate() { |
27 | context = getApplicationContext(); | 27 | context = getApplicationContext(); |
28 | //c初始化内存检测 | 28 | //c初始化内存检测 |
29 | // LeakCanary.install(this); | 29 | // LeakCanary.install(this); |
30 | //初始化Fresco | 30 | //初始化Fresco |
31 | mImageCache = new ImageCache(); | 31 | mImageCache = new ImageCache(); |
32 | instance = this; | 32 | instance = this; |
33 | CrashReport.initCrashReport(getApplicationContext(), "0c9a6274e0", false); | 33 | CrashReport.initCrashReport(getApplicationContext(), "0c9a6274e0", false); |
34 | CrashHandler crashHandler = CrashHandler.getInstance(); | 34 | // CrashHandler crashHandler = CrashHandler.getInstance(); |
35 | //生成错误日志,上线的时候得放开 | 35 | // //生成错误日志,上线的时候得放开 |
36 | crashHandler.init(getApplicationContext()); | 36 | // crashHandler.init(getApplicationContext()); |
37 | crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { | 37 | // crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { |
38 | 38 | // | |
39 | @Override | 39 | // @Override |
40 | public boolean handleCrash(final Context context, final Throwable ex) { | 40 | // public boolean handleCrash(final Context context, final Throwable ex) { |
41 | new Thread(new Runnable() { | 41 | // new Thread(new Runnable() { |
42 | @Override | 42 | // @Override |
43 | public void run() { | 43 | // public void run() { |
44 | Looper.prepare(); | 44 | // Looper.prepare(); |
45 | System.out.println("bcz = " + ex.toString()); | 45 | // System.out.println("bcz = " + ex.toString()); |
46 | Toast toast = new Toast(context); | 46 | // Toast toast = new Toast(context); |
47 | TextView tv = new TextView(context); | 47 | // TextView tv = new TextView(context); |
48 | tv.setText(" 很抱歉,"+context.getString(R.string.app_name)+"崩溃了,我们会尽快修复."); | 48 | // tv.setText(" 很抱歉,"+context.getString(R.string.app_name)+"崩溃了,我们会尽快修复."); |
49 | tv.setPadding(10, 10, 10, 10); | 49 | // tv.setPadding(10, 10, 10, 10); |
50 | tv.setTextSize(20); | 50 | // tv.setTextSize(20); |
51 | tv.setBackgroundResource(R.drawable.black_btn_default); | 51 | // tv.setBackgroundResource(R.drawable.black_btn_default); |
52 | tv.setTextColor(context.getResources().getColor(android.R.color.white)); | 52 | // tv.setTextColor(context.getResources().getColor(android.R.color.white)); |
53 | Drawable drawable= context.getResources().getDrawable(R.drawable.sorry); | 53 | // Drawable drawable= context.getResources().getDrawable(R.drawable.sorry); |
54 | drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); | 54 | // drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); |
55 | tv.setCompoundDrawables(drawable,null,null,null); | 55 | // tv.setCompoundDrawables(drawable,null,null,null); |
56 | toast.setView(tv); | 56 | // toast.setView(tv); |
57 | toast.setGravity(Gravity.CENTER, 0, 0); | 57 | // toast.setGravity(Gravity.CENTER, 0, 0); |
58 | toast.setDuration(Toast.LENGTH_LONG); | 58 | // toast.setDuration(Toast.LENGTH_LONG); |
59 | toast.show(); | 59 | // toast.show(); |
60 | Looper.loop(); | 60 | // Looper.loop(); |
61 | } | 61 | // } |
62 | }).start(); | 62 | // }).start(); |
63 | try { | 63 | // try { |
64 | Thread.sleep(1000); | 64 | // Thread.sleep(1000); |
65 | } catch (InterruptedException e) { | 65 | // } catch (InterruptedException e) { |
66 | // TODO Auto-generated catch block | 66 | // // TODO Auto-generated catch block |
67 | e.printStackTrace(); | 67 | // e.printStackTrace(); |
68 | } | 68 | // } |
69 | return false; | 69 | // return false; |
70 | } | 70 | // } |
71 | }); | 71 | // }); |
72 | super.onCreate(); | 72 | super.onCreate(); |
73 | } | 73 | } |
74 | public ImageCache getImageCache() { | 74 | public ImageCache getImageCache() { |
75 | return mImageCache; | 75 | return mImageCache; |
76 | } | 76 | } |
77 | 77 | ||
78 | public static Context getContext() { | 78 | public static Context getContext() { |
79 | return context; | 79 | return context; |
80 | } | 80 | } |
81 | public static MyApplication getInstance() { | 81 | public static MyApplication getInstance() { |
82 | return instance; | 82 | return instance; |
83 | } | 83 | } |
84 | 84 | ||
85 | } | 85 | } |
86 | 86 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v4.app.FragmentActivity; | 5 | import android.support.v4.app.FragmentActivity; |
6 | import android.text.Editable; | ||
6 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
8 | import android.text.TextWatcher; | ||
7 | import android.view.View; | 9 | import android.view.View; |
8 | import android.widget.Button; | 10 | import android.widget.Button; |
9 | import android.widget.EditText; | 11 | import android.widget.EditText; |
12 | import android.widget.ImageButton; | ||
13 | import android.widget.LinearLayout; | ||
10 | import android.widget.TextView; | 14 | import android.widget.TextView; |
11 | 15 | ||
12 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
13 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 17 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
14 | import com.hjx.personalcenter.customdialog.CountryDialog; | 18 | import com.hjx.personalcenter.customdialog.CountryDialog; |
15 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 19 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
16 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 20 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
17 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 21 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
18 | import com.hjx.personalcenter.db.Content; | 22 | import com.hjx.personalcenter.db.Content; |
19 | import com.hjx.personalcenter.db.SaveParam; | 23 | import com.hjx.personalcenter.db.SaveParam; |
20 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
22 | import com.hjx.personalcenter.model.CityInfo; | 26 | import com.hjx.personalcenter.model.CityInfo; |
23 | import com.hjx.personalcenter.model.CountyInfo; | 27 | import com.hjx.personalcenter.model.CountyInfo; |
24 | import com.hjx.personalcenter.model.GradeInfo; | 28 | import com.hjx.personalcenter.model.GradeInfo; |
25 | import com.hjx.personalcenter.model.ProvinceInfo; | 29 | import com.hjx.personalcenter.model.ProvinceInfo; |
26 | import com.hjx.personalcenter.model.SchoolInfo; | 30 | import com.hjx.personalcenter.model.SchoolInfo; |
27 | import com.hjx.personalcenter.util.AlertUtils; | 31 | import com.hjx.personalcenter.util.AlertUtils; |
28 | import com.hjx.personalcenter.util.GetDevicesUtil; | 32 | import com.hjx.personalcenter.util.GetDevicesUtil; |
29 | 33 | ||
30 | import java.util.ArrayList; | 34 | import java.util.ArrayList; |
31 | 35 | ||
32 | /** | 36 | /** |
33 | * 填写注册信息 熊巍 | 37 | * 填写注册信息 熊巍 |
34 | * Created by h on 2017/8/9. | 38 | * Created by h on 2017/8/9. |
35 | */ | 39 | */ |
36 | 40 | ||
37 | public class RegisterInfoActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 41 | public class RegisterInfoActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
38 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 42 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
39 | private EditText et_username; | 43 | private EditText et_username, et_nickname, et_address; |
44 | private ImageButton username_delete_btn, nickname_delete_btn, address_delete_btn; | ||
40 | private TextView et_region, et_grade, et_school; | 45 | private TextView et_region, et_grade, et_school; |
46 | private LinearLayout et_username_layout, et_address_layout; | ||
41 | private Button btn_ok; | 47 | private Button btn_ok; |
42 | 48 | ||
43 | @Override | 49 | @Override |
44 | protected void onCreate(Bundle savedInstanceState) { | 50 | protected void onCreate(Bundle savedInstanceState) { |
45 | super.onCreate(savedInstanceState); | 51 | super.onCreate(savedInstanceState); |
46 | setContentView(R.layout.activity_registerinfo); | 52 | setContentView(R.layout.activity_registerinfo); |
47 | SysApplication.getInstance().addActivity(this); | 53 | SysApplication.getInstance().addActivity(this); |
48 | initView(); | 54 | initView(); |
49 | initData(); | 55 | initData(); |
50 | initLister(); | 56 | initLister(); |
57 | initTextWatch(); | ||
51 | } | 58 | } |
52 | 59 | ||
53 | private void initView() { | 60 | private void initView() { |
54 | et_username = (EditText) findViewById(R.id.et_username); | 61 | et_username = (EditText) findViewById(R.id.et_username); |
62 | et_nickname = (EditText) findViewById(R.id.et_nickname); | ||
63 | et_address = (EditText) findViewById(R.id.et_address); | ||
55 | et_region = (TextView) findViewById(R.id.et_region); | 64 | et_region = (TextView) findViewById(R.id.et_region); |
56 | et_grade = (TextView) findViewById(R.id.et_grade); | 65 | et_grade = (TextView) findViewById(R.id.et_grade); |
57 | et_school = (TextView) findViewById(R.id.et_school); | 66 | et_school = (TextView) findViewById(R.id.et_school); |
58 | btn_ok = (Button) findViewById(R.id.btn_ok); | 67 | btn_ok = (Button) findViewById(R.id.btn_ok); |
68 | username_delete_btn = (ImageButton) findViewById(R.id.username_delete_btn); | ||
69 | nickname_delete_btn = (ImageButton) findViewById(R.id.nickname_delete_btn); | ||
70 | address_delete_btn = (ImageButton) findViewById(R.id.address_delete_btn); | ||
71 | et_username_layout = (LinearLayout) findViewById(R.id.et_username_layout); | ||
72 | et_address_layout = (LinearLayout) findViewById(R.id.et_address_layout); | ||
59 | 73 | ||
60 | 74 | ||
61 | } | 75 | } |
62 | 76 | ||
63 | private void initData() { | 77 | private void initData() { |
64 | if (Content.accountflag == 2) { | 78 | if (Content.accountflag == 2) { |
65 | btn_ok.setText("提交"); | 79 | btn_ok.setText("提交"); |
80 | et_username_layout.setVisibility(View.GONE); | ||
81 | et_address_layout.setVisibility(View.GONE); | ||
66 | 82 | ||
67 | } | 83 | } |
68 | 84 | ||
69 | } | 85 | } |
70 | 86 | ||
71 | private void initLister() { | 87 | private void initLister() { |
72 | et_region.setOnClickListener(this); | 88 | et_region.setOnClickListener(this); |
73 | et_grade.setOnClickListener(this); | 89 | et_grade.setOnClickListener(this); |
74 | et_school.setOnClickListener(this); | 90 | et_school.setOnClickListener(this); |
75 | btn_ok.setOnClickListener(this); | 91 | btn_ok.setOnClickListener(this); |
92 | username_delete_btn.setOnClickListener(this); | ||
93 | nickname_delete_btn.setOnClickListener(this); | ||
94 | address_delete_btn.setOnClickListener(this); | ||
76 | 95 | ||
77 | 96 | ||
78 | } | 97 | } |
79 | 98 | ||
99 | /** | ||
100 | * 输入框改变的监听 | ||
101 | */ | ||
102 | private void initTextWatch() { | ||
103 | et_username.addTextChangedListener(new TextWatcher() { | ||
104 | @Override | ||
105 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
106 | } | ||
107 | |||
108 | @Override | ||
109 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
110 | if (s.toString().length() == 0) { | ||
111 | username_delete_btn.setVisibility(View.INVISIBLE); | ||
112 | } else { | ||
113 | username_delete_btn.setVisibility(View.VISIBLE); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public void afterTextChanged(Editable s) { | ||
119 | |||
120 | } | ||
121 | }); | ||
122 | et_username.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
123 | @Override | ||
124 | public void onFocusChange(View v, boolean hasFocus) { | ||
125 | if (hasFocus) { | ||
126 | if (!et_username.getText().toString().isEmpty()) { | ||
127 | username_delete_btn.setVisibility(View.VISIBLE); | ||
128 | } | ||
129 | } else { | ||
130 | |||
131 | username_delete_btn.setVisibility(View.INVISIBLE); | ||
132 | } | ||
133 | } | ||
134 | }); | ||
135 | et_nickname.addTextChangedListener(new TextWatcher() { | ||
136 | @Override | ||
137 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
138 | |||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
143 | if (s.toString().length() == 0) { | ||
144 | |||
145 | nickname_delete_btn.setVisibility(View.INVISIBLE); | ||
146 | } else { | ||
147 | nickname_delete_btn.setVisibility(View.VISIBLE); | ||
148 | } | ||
149 | } | ||
150 | |||
151 | @Override | ||
152 | public void afterTextChanged(Editable s) { | ||
153 | |||
154 | } | ||
155 | }); | ||
156 | et_nickname.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
157 | @Override | ||
158 | public void onFocusChange(View v, boolean hasFocus) { | ||
159 | if (hasFocus) { | ||
160 | if (!et_nickname.getText().toString().isEmpty()) { | ||
161 | nickname_delete_btn.setVisibility(View.VISIBLE); | ||
162 | } | ||
163 | } else { | ||
164 | nickname_delete_btn.setVisibility(View.INVISIBLE); | ||
165 | } | ||
166 | } | ||
167 | }); | ||
168 | et_address.addTextChangedListener(new TextWatcher() { | ||
169 | @Override | ||
170 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
171 | |||
172 | } | ||
173 | |||
174 | @Override | ||
175 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
176 | if (s.toString().length() == 0) { | ||
177 | |||
178 | address_delete_btn.setVisibility(View.INVISIBLE); | ||
179 | } else { | ||
180 | address_delete_btn.setVisibility(View.VISIBLE); | ||
181 | } | ||
182 | } | ||
183 | |||
184 | @Override | ||
185 | public void afterTextChanged(Editable s) { | ||
186 | |||
187 | } | ||
188 | }); | ||
189 | et_address.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
190 | @Override | ||
191 | public void onFocusChange(View v, boolean hasFocus) { | ||
192 | if (hasFocus) { | ||
193 | if (!et_address.getText().toString().isEmpty()) { | ||
194 | address_delete_btn.setVisibility(View.VISIBLE); | ||
195 | } | ||
196 | } else { | ||
197 | address_delete_btn.setVisibility(View.INVISIBLE); | ||
198 | } | ||
199 | } | ||
200 | }); | ||
201 | } | ||
202 | |||
80 | @Override | 203 | @Override |
81 | public void onClick(View v) { | 204 | public void onClick(View v) { |
82 | String register1 = et_username.getText().toString().trim(); | 205 | String register1 = et_nickname.getText().toString().trim(); |
83 | String register2 = et_region.getText().toString().trim(); | 206 | String register2 = et_region.getText().toString().trim(); |
84 | String register3 = et_grade.getText().toString().trim(); | 207 | String register3 = et_grade.getText().toString().trim(); |
85 | String register4 = et_school.getText().toString().trim(); | 208 | String register4 = et_school.getText().toString().trim(); |
209 | String register5 = et_username.getText().toString().trim(); | ||
210 | String register6 = et_address.getText().toString().trim(); | ||
86 | switch (v.getId()) { | 211 | switch (v.getId()) { |
87 | case R.id.et_region: | 212 | case R.id.et_region: |
88 | et_school.setText(""); | 213 | et_school.setText(""); |
89 | Content.changeadressinfoflag = 1; | 214 | Content.changeadressinfoflag = 1; |
90 | choiseregion(); | 215 | choiseregion(); |
91 | break; | 216 | break; |
92 | case R.id.et_grade: | 217 | case R.id.et_grade: |
93 | et_school.setText(""); | 218 | et_school.setText(""); |
94 | Content.changegradeinfoflag = 2; | 219 | Content.changegradeinfoflag = 2; |
95 | choisegrade(); | 220 | choisegrade(); |
96 | break; | 221 | break; |
97 | case R.id.et_school: | 222 | case R.id.et_school: |
98 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { | 223 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
99 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); | 224 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); |
100 | return; | 225 | return; |
101 | } else { | 226 | } else { |
102 | choiseschool(); | 227 | choiseschool(); |
103 | } | 228 | } |
104 | 229 | ||
105 | break; | 230 | break; |
106 | case R.id.btn_ok: | 231 | case R.id.btn_ok: |
107 | if (TextUtils.isEmpty(register1) || | 232 | if (Content.accountflag == 2 && (TextUtils.isEmpty(register1) || |
108 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { | 233 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3) || TextUtils.isEmpty(register4))) { |
234 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | ||
235 | return; | ||
236 | } else if (Content.accountflag == 1 && (TextUtils.isEmpty(register1) || | ||
237 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3) || TextUtils.isEmpty(register4) | ||
238 | || TextUtils.isEmpty(register5) || TextUtils.isEmpty(register6))) { | ||
109 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | 239 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
110 | return; | 240 | return; |
111 | } else { | 241 | } else { |
112 | String register5 = et_username.getText().toString().trim(); | 242 | // String register5 = et_username.getText().toString().trim(); |
113 | String register6 = et_region.getText().toString().trim(); | 243 | // String register6 = et_region.getText().toString().trim(); |
114 | String register7 = et_grade.getText().toString().trim(); | 244 | // String register7 = et_grade.getText().toString().trim(); |
115 | String register8 = et_school.getText().toString().trim(); | 245 | // String register8 = et_school.getText().toString().trim(); |
116 | String grade = SaveParam.getInstance().getLoginParam(this, SaveParam.CHILDSGRADENS); | 246 | String grade = SaveParam.getInstance().getLoginParam(this, SaveParam.CHILDSGRADENS); |
117 | if (Content.accountflag == 2) { | 247 | if (Content.accountflag == 2) { |
118 | String accounts = SaveParam.getInstance().getCustomizeParam(RegisterInfoActivity.this,SaveParam.ACCOUNT); | 248 | String accounts = SaveParam.getInstance().getCustomizeParam(RegisterInfoActivity.this, SaveParam.ACCOUNT); |
119 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 249 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
120 | // if ("2".equals(accounts)){ | 250 | // if ("2".equals(accounts)){ |
121 | // grade = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSGRADENS); | 251 | // grade = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSGRADENS); |
122 | // } | 252 | // } |
123 | //else { | 253 | //else { |
124 | 254 | ||
125 | // } | 255 | // } |
126 | 256 | ||
127 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); | 257 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); |
128 | String regionId = SaveParam.getInstance().getsaveCityParam(this, SaveParam.COUNTRY); | 258 | String regionId = SaveParam.getInstance().getsaveCityParam(this, SaveParam.COUNTRY); |
129 | String regionId1 = SaveParam.getInstance().getsaveCityParam(this, SaveParam.CITYS); | 259 | String regionId1 = SaveParam.getInstance().getsaveCityParam(this, SaveParam.CITYS); |
130 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 260 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
131 | if (regionId == null) { | 261 | if (regionId == null) { |
132 | regionId = regionId1; | 262 | regionId = regionId1; |
133 | } | 263 | } |
134 | 264 | ||
135 | try { | 265 | try { |
136 | Object schoolss; | 266 | Object schoolss; |
137 | long auserID = Long.parseLong(userID); | 267 | long auserID = Long.parseLong(userID); |
138 | long grades = Long.parseLong(grade); | 268 | long grades = Long.parseLong(grade); |
139 | if (TextUtils.isEmpty(register8)) { | 269 | if (TextUtils.isEmpty(register4)) { |
140 | schoolss = null; | 270 | schoolss = null; |
141 | } else { | 271 | } else { |
142 | schoolss = Long.parseLong(School); | 272 | schoolss = Long.parseLong(School); |
143 | } | 273 | } |
144 | long regionIds = Long.parseLong(regionId); | 274 | long regionIds = Long.parseLong(regionId); |
145 | HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this, auserID, "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png", | 275 | HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this, auserID, "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png", |
146 | register5, grades, schoolss, regionIds, devicenumber, register6); | 276 | register1, grades, schoolss, regionIds, devicenumber, register2); |
147 | 277 | ||
148 | } catch (NumberFormatException e) { | 278 | } catch (NumberFormatException e) { |
149 | e.printStackTrace(); | 279 | e.printStackTrace(); |
150 | } | 280 | } |
151 | 281 | ||
152 | } else { | 282 | } else { |
153 | savedata(); | 283 | savedata(); |
154 | Intent intent = new Intent(); | 284 | Intent intent = new Intent(); |
155 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); | 285 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); |
156 | startActivity(intent); | 286 | startActivity(intent); |
157 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 287 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
158 | } | 288 | } |
159 | 289 | ||
160 | } | 290 | } |
161 | 291 | ||
162 | break; | 292 | break; |
293 | |||
294 | case R.id.username_delete_btn: | ||
295 | et_username.setText(""); | ||
296 | break; | ||
297 | case R.id.nickname_delete_btn: | ||
298 | et_nickname.setText(""); | ||
299 | break; | ||
300 | case R.id.address_delete_btn: | ||
301 | et_address.setText(""); | ||
302 | break; | ||
163 | } | 303 | } |
164 | 304 | ||
165 | } | 305 | } |
166 | 306 | ||
167 | private void savedata() { | 307 | private void savedata() { |
168 | String register9 = et_username.getText().toString().trim(); | 308 | SaveParam.getInstance().saveLoginParam(this, SaveParam.REALNAME, et_username.getText().toString().trim()); |
169 | String register10 = et_region.getText().toString().trim(); | 309 | SaveParam.getInstance().saveLoginParam(this, SaveParam.NICKNAME, et_nickname.getText().toString().trim()); |
170 | String register11 = et_grade.getText().toString().trim(); | 310 | SaveParam.getInstance().saveLoginParam(this, SaveParam.REGION, et_region.getText().toString().trim()); |
171 | String register12 = et_school.getText().toString().trim(); | 311 | SaveParam.getInstance().saveLoginParam(this, SaveParam.GRADES, et_grade.getText().toString().trim()); |
172 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register9); | 312 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SCHOOL, et_school.getText().toString().trim()); |
173 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register10); | 313 | SaveParam.getInstance().saveLoginParam(this, SaveParam.ADDRESS, et_address.getText().toString().trim()); |
174 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register11); | ||
175 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register12); | ||
176 | 314 | ||
177 | 315 | ||
178 | } | 316 | } |
179 | 317 | ||
180 | @Override | 318 | @Override |
181 | protected void onResume() { | 319 | protected void onResume() { |
182 | super.onResume(); | 320 | super.onResume(); |
183 | } | 321 | } |
184 | 322 | ||
185 | 323 | ||
186 | //选择地区 | 324 | //选择地区 |
187 | private void choiseregion() { | 325 | private void choiseregion() { |
188 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 326 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
189 | 327 | ||
190 | } | 328 | } |
191 | 329 | ||
192 | //选择年级 | 330 | //选择年级 |
193 | private void choisegrade() { | 331 | private void choisegrade() { |
194 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); | 332 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); |
195 | 333 | ||
196 | } | 334 | } |
197 | 335 | ||
198 | //选择学校 | 336 | //选择学校 |
199 | private void choiseschool() { | 337 | private void choiseschool() { |
200 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); | 338 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); |
201 | 339 | ||
202 | } | 340 | } |
203 | 341 | ||
204 | 342 | ||
205 | @Override | 343 | @Override |
206 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 344 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
207 | String regionName = data.get(position).getRegionName(); | 345 | String regionName = data.get(position).getRegionName(); |
208 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); | 346 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); |
209 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 347 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
210 | et_region.setText(""); | 348 | et_region.setText(""); |
211 | et_region.setText(regionName); | 349 | et_region.setText(regionName); |
212 | 350 | ||
213 | } | 351 | } |
214 | 352 | ||
215 | 353 | ||
216 | @Override | 354 | @Override |
217 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 355 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
218 | String regionName = data.get(position).getName(); | 356 | String regionName = data.get(position).getName(); |
219 | et_grade.setText(regionName); | 357 | et_grade.setText(regionName); |
220 | 358 | ||
221 | } | 359 | } |
222 | 360 | ||
223 | @Override | 361 | @Override |
224 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 362 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
225 | String regionName = data.get(position).getRegionName(); | 363 | String regionName = data.get(position).getRegionName(); |
226 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); | 364 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); |
227 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); | 365 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); |
228 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 366 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
229 | et_region.setText(""); | 367 | et_region.setText(""); |
230 | et_region.setText(provice + regionName); | 368 | et_region.setText(provice + regionName); |
231 | 369 | ||
232 | } | 370 | } |
233 | 371 | ||
234 | @Override | 372 | @Override |
235 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 373 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
236 | String regionName = data.get(position).getRegionName(); | 374 | String regionName = data.get(position).getRegionName(); |
237 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); | 375 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); |
238 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); | 376 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); |
239 | et_region.setText(""); | 377 | et_region.setText(""); |
240 | et_region.setText(provices + citys + regionName); | 378 | et_region.setText(provices + citys + regionName); |
241 | 379 | ||
242 | } | 380 | } |
243 | 381 | ||
244 | @Override | 382 | @Override |
245 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 383 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
246 | String regionName = data.get(position).getSchoolName(); | 384 | String regionName = data.get(position).getSchoolName(); |
247 | et_school.setText(regionName); | 385 | et_school.setText(regionName); |
248 | 386 | ||
249 | } | 387 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/TheStartPageActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v4.app.FragmentActivity; | 5 | import android.support.v4.app.FragmentActivity; |
6 | import android.view.KeyEvent; | 6 | import android.view.KeyEvent; |
7 | import android.view.View; | 7 | import android.view.View; |
8 | import android.widget.Button; | 8 | import android.widget.Button; |
9 | import android.widget.ImageButton; | ||
9 | 10 | ||
10 | import com.hjx.personalcenter.R; | 11 | import com.hjx.personalcenter.R; |
11 | import com.hjx.personalcenter.db.SaveParam; | 12 | import com.hjx.personalcenter.db.SaveParam; |
12 | 13 | ||
13 | /** | 14 | /** |
14 | * Created by h on 2017/8/10. | 15 | * Created by h on 2017/8/10. |
15 | */ | 16 | */ |
16 | 17 | ||
17 | public class TheStartPageActivity extends FragmentActivity implements View.OnClickListener { | 18 | public class TheStartPageActivity extends FragmentActivity implements View.OnClickListener { |
18 | private Button btn_start; | 19 | private ImageButton btn_start; |
19 | @Override | 20 | @Override |
20 | protected void onCreate(Bundle savedInstanceState) { | 21 | protected void onCreate(Bundle savedInstanceState) { |
21 | super.onCreate(savedInstanceState); | 22 | super.onCreate(savedInstanceState); |
22 | setContentView(R.layout.activity_start_page); | 23 | setContentView(R.layout.activity_start_page); |
23 | SysApplication.getInstance().addActivity(this); | 24 | SysApplication.getInstance().addActivity(this); |
24 | initView(); | 25 | initView(); |
25 | initData(); | 26 | initData(); |
26 | initLister(); | 27 | initLister(); |
27 | } | 28 | } |
28 | private void initView() { | 29 | private void initView() { |
29 | btn_start = (Button) findViewById(R.id.btn_start); | 30 | btn_start = (ImageButton) findViewById(R.id.btn_start); |
30 | } | 31 | } |
31 | 32 | ||
32 | private void initData() { | 33 | private void initData() { |
33 | 34 | ||
34 | } | 35 | } |
35 | 36 | ||
36 | private void initLister() { | 37 | private void initLister() { |
37 | btn_start.setOnClickListener(this); | 38 | btn_start.setOnClickListener(this); |
38 | } | 39 | } |
39 | 40 | ||
40 | @Override | 41 | @Override |
41 | public void onClick(View v) { | 42 | public void onClick(View v) { |
42 | switch (v.getId()){ | 43 | switch (v.getId()){ |
43 | case R.id.btn_start: | 44 | case R.id.btn_start: |
44 | SaveParam.getInstance().saveLoginParam(this, "login", "true"); | 45 | SaveParam.getInstance().saveLoginParam(this, "login", "true"); |
45 | Intent intent = new Intent(); | 46 | Intent intent = new Intent(); |
46 | intent.setClass(TheStartPageActivity.this,MainActivity.class); | 47 | intent.setClass(TheStartPageActivity.this,MainActivity.class); |
47 | startActivity(intent); | 48 | startActivity(intent); |
48 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 49 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
49 | SysApplication.getInstance().exit(); | 50 | SysApplication.getInstance().exit(); |
50 | break; | 51 | break; |
51 | } | 52 | } |
52 | } | 53 | } |
53 | @Override | 54 | @Override |
54 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 55 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
55 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 56 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
56 | return true; | 57 | return true; |
57 | } | 58 | } |
58 | return super.onKeyDown(keyCode, event); | 59 | return super.onKeyDown(keyCode, event); |
59 | } | 60 | } |
60 | } | 61 | } |
61 | 62 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CountryDialog.java
1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
2 | 2 | ||
3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | import android.os.Handler; | 7 | import android.os.Handler; |
8 | import android.os.Message; | 8 | import android.os.Message; |
9 | import android.view.Gravity; | 9 | import android.view.Gravity; |
10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
13 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
14 | import android.widget.ImageView; | 14 | import android.widget.ImageView; |
15 | import android.widget.ListView; | 15 | import android.widget.ListView; |
16 | import android.widget.Toast; | ||
16 | 17 | ||
17 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.adapter.CountryAdapter; | 19 | import com.hjx.personalcenter.adapter.CountryAdapter; |
19 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
20 | import com.hjx.personalcenter.http.HttpCode; | 21 | import com.hjx.personalcenter.http.HttpCode; |
21 | import com.hjx.personalcenter.http.HttpManager; | 22 | import com.hjx.personalcenter.http.HttpManager; |
22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 23 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
23 | import com.hjx.personalcenter.model.CountyInfo; | 24 | import com.hjx.personalcenter.model.CountyInfo; |
24 | import com.mylhyl.circledialog.BaseCircleDialog; | 25 | import com.mylhyl.circledialog.BaseCircleDialog; |
25 | import com.mylhyl.circledialog.res.values.CircleDimen; | 26 | import com.mylhyl.circledialog.res.values.CircleDimen; |
26 | 27 | ||
27 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
28 | import java.util.List; | 29 | import java.util.List; |
29 | 30 | ||
30 | /** | 31 | /** |
31 | * Created by wei on 2017/8/21. | 32 | * Created by wei on 2017/8/21. |
32 | */ | 33 | */ |
33 | @SuppressLint("ValidFragment") | 34 | @SuppressLint("ValidFragment") |
34 | public class CountryDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 35 | public class CountryDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
35 | private CountryAdapter listadapter; | 36 | private CountryAdapter listadapter; |
36 | private ListView listView; | 37 | private ListView listView; |
37 | private ImageView cance; | 38 | private ImageView cance; |
38 | private DialogCallBack.CountryCallBack mCallBack; | 39 | private DialogCallBack.CountryCallBack mCallBack; |
39 | private ArrayList<CountyInfo.CountiesBean> data = new ArrayList<>(); | 40 | private ArrayList<CountyInfo.CountiesBean> data = new ArrayList<>(); |
40 | public CountryDialog(DialogCallBack.CountryCallBack callBack) { | 41 | public CountryDialog(DialogCallBack.CountryCallBack callBack) { |
41 | this.mCallBack = callBack; | 42 | this.mCallBack = callBack; |
42 | } | 43 | } |
43 | public static CountryDialog getInstance(DialogCallBack.CountryCallBack callBack) { | 44 | public static CountryDialog getInstance(DialogCallBack.CountryCallBack callBack) { |
44 | CountryDialog dialogFragment = new CountryDialog(callBack); | 45 | CountryDialog dialogFragment = new CountryDialog(callBack); |
45 | dialogFragment.setCanceledBack(true); | 46 | dialogFragment.setCanceledBack(true); |
46 | dialogFragment.setCanceledOnTouchOutside(true); | 47 | dialogFragment.setCanceledOnTouchOutside(true); |
47 | dialogFragment.setRadius(CircleDimen.RADIUS); | 48 | dialogFragment.setRadius(CircleDimen.RADIUS); |
48 | dialogFragment.setWidth(0.5f); | 49 | dialogFragment.setWidth(0.5f); |
49 | dialogFragment.setGravity(Gravity.CENTER); | 50 | dialogFragment.setGravity(Gravity.CENTER); |
50 | dialogFragment.setBackgroundColor(Color.WHITE); | 51 | dialogFragment.setBackgroundColor(Color.WHITE); |
51 | return dialogFragment; | 52 | return dialogFragment; |
52 | } | 53 | } |
53 | Handler handler = new Handler(){ | 54 | Handler handler = new Handler(){ |
54 | @Override | 55 | @Override |
55 | public void handleMessage(Message msg) { | 56 | public void handleMessage(Message msg) { |
56 | super.handleMessage(msg); | 57 | super.handleMessage(msg); |
57 | switch (msg.what){ | 58 | switch (msg.what){ |
58 | case HttpCode.COUNTRY: | 59 | case HttpCode.COUNTRY: |
59 | 60 | ||
60 | data.clear(); | 61 | data.clear(); |
61 | data.addAll( (List<CountyInfo.CountiesBean>)msg.obj); | 62 | data.addAll( (List<CountyInfo.CountiesBean>)msg.obj); |
62 | if (data==null){ | 63 | if (data==null){ |
63 | dismiss(); | 64 | dismiss(); |
64 | } | 65 | } |
65 | listadapter.notifyDataSetChanged(); | 66 | listadapter.notifyDataSetChanged(); |
66 | break; | 67 | break; |
67 | } | 68 | } |
68 | } | 69 | } |
69 | }; | 70 | }; |
70 | 71 | ||
71 | @Override | 72 | @Override |
72 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 73 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
73 | return inflater.inflate(R.layout.custom_adilog_countrylist, container, false); | 74 | return inflater.inflate(R.layout.custom_adilog_countrylist, container, false); |
74 | } | 75 | } |
75 | 76 | ||
76 | @Override | 77 | @Override |
77 | public void onActivityCreated(Bundle savedInstanceState) { | 78 | public void onActivityCreated(Bundle savedInstanceState) { |
78 | super.onActivityCreated(savedInstanceState); | 79 | super.onActivityCreated(savedInstanceState); |
79 | listView = (ListView) getView().findViewById(R.id.listadapter); | 80 | listView = (ListView) getView().findViewById(R.id.listadapter); |
80 | cance = (ImageView) getView().findViewById(R.id.cancel); | 81 | cance = (ImageView) getView().findViewById(R.id.cancel); |
81 | String citys = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); | 82 | String citys = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); |
82 | listadapter = new CountryAdapter(data,getActivity()); | 83 | listadapter = new CountryAdapter(data,getActivity()); |
83 | listView.setAdapter(listadapter); | 84 | listView.setAdapter(listadapter); |
84 | listView.setOnItemClickListener(this); | 85 | listView.setOnItemClickListener(this); |
85 | cance.setOnClickListener(new View.OnClickListener() { | 86 | cance.setOnClickListener(new View.OnClickListener() { |
86 | @Override | 87 | @Override |
87 | public void onClick(View v) { | 88 | public void onClick(View v) { |
88 | dismiss(); | 89 | dismiss(); |
89 | } | 90 | } |
90 | }); | 91 | }); |
91 | try { | 92 | try { |
92 | int a = Integer.parseInt(citys); | 93 | int a = Integer.parseInt(citys); |
93 | HttpManager.getInstance().countyinfo(getActivity(),a,handler); | 94 | HttpManager.getInstance().countyinfo(getActivity(),a,handler); |
94 | } catch (NumberFormatException e) { | 95 | } catch (NumberFormatException e) { |
95 | e.printStackTrace(); | 96 | e.printStackTrace(); |
96 | } | 97 | } |
97 | 98 | ||
98 | 99 | ||
99 | } | 100 | } |
100 | 101 | ||
101 | @Override | 102 | @Override |
102 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 103 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
103 | SaveParam.getInstance().saveCityParam(getActivity(), SaveParam.COUNTRY, ""+data.get(position).getRegionId()); | 104 | SaveParam.getInstance().saveCityParam(getActivity(), SaveParam.COUNTRY, ""+data.get(position).getRegionId()); |
104 | mCallBack.province2OnItemClick(data,position,3); | 105 | mCallBack.province2OnItemClick(data,position,3); |
105 | dismiss(); | 106 | dismiss(); |
106 | 107 | ||
107 | } | 108 | } |
108 | } | 109 | } |
109 | 110 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/ElectronicCardDialog.java
1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
2 | 2 | ||
3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.content.Intent; | 5 | import android.content.Intent; |
6 | import android.graphics.Color; | 6 | import android.graphics.Color; |
7 | import android.os.Bundle; | 7 | import android.os.Bundle; |
8 | import android.view.Gravity; | 8 | import android.view.Gravity; |
9 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
12 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
13 | 13 | ||
14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
15 | import com.hjx.personalcenter.activity.ElectronicCardValidationActivity; | 15 | import com.hjx.personalcenter.activity.ElectronicCardValidationActivity; |
16 | import com.mylhyl.circledialog.BaseCircleDialog; | 16 | import com.mylhyl.circledialog.BaseCircleDialog; |
17 | import com.mylhyl.circledialog.res.values.CircleDimen; | 17 | import com.mylhyl.circledialog.res.values.CircleDimen; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Created by h on 2017/8/10. | 20 | * Created by h on 2017/8/10. |
21 | */ | 21 | */ |
22 | @SuppressLint("ValidFragment") | 22 | @SuppressLint("ValidFragment") |
23 | public class ElectronicCardDialog extends BaseCircleDialog { | 23 | public class ElectronicCardDialog extends BaseCircleDialog { |
24 | private ImageView cancel; | 24 | private ImageView cancel; |
25 | public static ElectronicCardDialog getInstance() { | 25 | public static ElectronicCardDialog getInstance() { |
26 | ElectronicCardDialog dialogFragment = new ElectronicCardDialog(); | 26 | ElectronicCardDialog dialogFragment = new ElectronicCardDialog(); |
27 | dialogFragment.setCanceledBack(true); | 27 | dialogFragment.setCanceledBack(true); |
28 | dialogFragment.setCanceledOnTouchOutside(true); | 28 | dialogFragment.setCanceledOnTouchOutside(false); |
29 | dialogFragment.setRadius(CircleDimen.RADIUS); | 29 | dialogFragment.setRadius(CircleDimen.RADIUS); |
30 | dialogFragment.setWidth(0.8f); | 30 | dialogFragment.setWidth(0.8f); |
31 | dialogFragment.setGravity(Gravity.CENTER); | 31 | dialogFragment.setGravity(Gravity.CENTER); |
32 | dialogFragment.setBackgroundColor(Color.WHITE); | 32 | dialogFragment.setBackgroundColor(Color.WHITE); |
33 | return dialogFragment; | 33 | return dialogFragment; |
34 | } | 34 | } |
35 | @Override | 35 | @Override |
36 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 36 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
37 | return inflater.inflate(R.layout.custom_adilog_electroniccard, container, false); | 37 | return inflater.inflate(R.layout.custom_adilog_electroniccard, container, false); |
38 | } | 38 | } |
39 | @Override | 39 | @Override |
40 | public void onActivityCreated(Bundle savedInstanceState) { | 40 | public void onActivityCreated(Bundle savedInstanceState) { |
41 | super.onActivityCreated(savedInstanceState); | 41 | super.onActivityCreated(savedInstanceState); |
42 | |||
42 | getView().findViewById(R.id.fill_card).setOnClickListener(new View.OnClickListener() { | 43 | getView().findViewById(R.id.fill_card).setOnClickListener(new View.OnClickListener() { |
43 | @Override | 44 | @Override |
44 | public void onClick(View v) { | 45 | public void onClick(View v) { |
45 | Intent intent = new Intent(); | 46 | Intent intent = new Intent(); |
46 | intent.setClass(getActivity(),ElectronicCardValidationActivity.class); | 47 | intent.setClass(getActivity(),ElectronicCardValidationActivity.class); |
47 | startActivity(intent); | 48 | startActivity(intent); |
48 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 49 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
49 | 50 | ||
50 | } | 51 | } |
51 | }); | 52 | }); |
52 | getView().findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() { | 53 | getView().findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() { |
53 | @Override | 54 | @Override |
54 | public void onClick(View v) { | 55 | public void onClick(View v) { |
55 | dismiss(); | 56 | dismiss(); |
56 | } | 57 | } |
57 | }); | 58 | }); |
58 | 59 | ||
59 | } | 60 | } |
60 | 61 | ||
61 | } | 62 | } |
62 | 63 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
1 | package com.hjx.personalcenter.db; | 1 | package com.hjx.personalcenter.db; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.content.SharedPreferences; | 5 | import android.content.SharedPreferences; |
6 | 6 | ||
7 | public class SaveParam { | 7 | public class SaveParam { |
8 | 8 | ||
9 | private static SaveParam instance; | 9 | private static SaveParam instance; |
10 | public static SaveParam getInstance(){ | 10 | public static SaveParam getInstance(){ |
11 | if (instance==null){ | 11 | if (instance==null){ |
12 | instance = new SaveParam(); | 12 | instance = new SaveParam(); |
13 | } | 13 | } |
14 | return instance; | 14 | return instance; |
15 | } | 15 | } |
16 | public static String GRADERFLAG = "graderflag";//子账号id | 16 | public static String GRADERFLAG = "graderflag";//子账号id |
17 | public static String CHILDSID = "childID";//子账号id | 17 | public static String CHILDSID = "childID";//子账号id |
18 | public static String CHILDSGRADENS = "childs";//子账号年级id | 18 | public static String CHILDSGRADENS = "childs";//子账号年级id |
19 | public static String CHILDSGRADENSss = "childssss";//子账号年级id | 19 | public static String CHILDSGRADENSss = "childssss";//子账号年级id |
20 | public static String GRADENS = "gradens";//年级id | 20 | public static String GRADENS = "gradens";//年级id |
21 | public static String SCHOOOlID = "schoolid";//学校id | 21 | public static String SCHOOOlID = "schoolid";//学校id |
22 | public static String VIEGREADE = "vergrade"; | 22 | public static String VIEGREADE = "vergrade"; |
23 | public static String ISYANGJI = "isyangji";//是否样机 | 23 | public static String ISYANGJI = "isyangji";//是否样机 |
24 | //个人信息 | 24 | //个人信息 |
25 | public static String USERNAME = "usernames";//昵称 | 25 | public static String NICKNAME = "nickname";//昵称 |
26 | public static String ADRESS = "adress";//地址 | 26 | public static String REGION = "region";//地区 |
27 | public static String GRADES = "gadens";//年级 | 27 | public static String GRADES = "gadens";//年级 |
28 | public static String SCHOOL = "school";//学校 | 28 | public static String SCHOOL = "school";//学校 |
29 | public static String REALNAME = "realName";//真实姓名 | ||
30 | public static String ADDRESS = "address";//家庭地址 | ||
29 | public static String CONSTELLATION = "constellations";//星座 | 31 | public static String CONSTELLATION = "constellations";//星座 |
30 | public static String HEADURL = "headurl";//头像 | 32 | public static String HEADURL = "headurl";//头像 |
31 | 33 | ||
32 | //用户个人信息 | 34 | //用户个人信息 |
33 | public static String ACCOUNTUSERNAME = "accountusernames";//昵称 | 35 | public static String ACCOUNTUSERNAME = "accountusernames";//昵称 |
34 | public static String ACCOUNTADRESS = "accountadress";//地址 | 36 | public static String ACCOUNTADRESS = "accountadress";//地址 |
35 | public static String ACCOUNTGRADES = "accountgadens";//年级 | 37 | public static String ACCOUNTGRADES = "accountgadens";//年级 |
36 | public static String ACCOUNTSCHOOL = "accountschool";//学校 | 38 | public static String ACCOUNTSCHOOL = "accountschool";//学校 |
37 | public static String ACCOUNTCONSTELLATION = "accountbthday";//生日 | 39 | public static String ACCOUNTCONSTELLATION = "accountbthday";//生日 |
38 | public static String ACCOUNTSEX = "accountsex";//性别 | 40 | public static String ACCOUNTSEX = "accountsex";//性别 |
39 | public static String ACCOUNTQQ= "accountqq";//qq | 41 | public static String ACCOUNTQQ= "accountqq";//qq |
40 | public static String ACCOUNTXINGZUO = "accountxingzuo";//详细地址 | 42 | public static String ACCOUNTXINGZUO = "accountxingzuo";//详细地址 |
41 | public static String PORTAIT = "portrait";//头像 | 43 | public static String PORTAIT = "portrait";//头像 |
42 | public static String ADRESSID = "adressid";//地址id | 44 | public static String ADRESSID = "adressid";//地址id |
43 | public static String MAINSHOOLID = "mainshoolid";//地址id | 45 | public static String MAINSHOOLID = "mainshoolid";//地址id |
44 | 46 | ||
45 | //电子保卡信息 | 47 | //电子保卡信息 |
46 | public static String CARDPHONE = "cardphone";//保卡手机号 | 48 | public static String CARDPHONE = "cardphone";//保卡手机号 |
47 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 | 49 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 |
48 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 | 50 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 |
49 | public static String SHOPTIME = "shoptime";//购买时间 | 51 | public static String SHOPTIME = "shoptime";//购买时间 |
50 | public static String SHOPADRESS = "shopadress";//购买地址 | 52 | public static String SHOPADRESS = "shopadress";//购买地址 |
53 | public static String SHOPADRESS_ID = "shopadress_id";//购买地址id | ||
51 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 | 54 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 |
55 | public static String SALES_PHONE = "sales_phone";//导购员手机号 | ||
56 | public static String SALES_ID = "sales_id";//导购员手机号 | ||
52 | 57 | ||
53 | //省市区参数、 | 58 | //省市区参数、 |
54 | public static String PROVINCES = "provinces";//省 | 59 | public static String PROVINCES = "provinces";//省 |
55 | public static String CITYS = "citys";//市 | 60 | public static String CITYS = "citys";//市 |
56 | public static String COUNTRY = "country";//区 | 61 | public static String COUNTRY = "country";//区 |
57 | 62 | ||
58 | //账户管理 | 63 | //账户管理 |
59 | public static String ACCOUNT = "account";//账户类型 | 64 | public static String ACCOUNT = "account";//账户类型 |
60 | //科目信息 | 65 | //科目信息 |
61 | public static String SUBJECT = "subject"; | 66 | public static String SUBJECT = "subject"; |
62 | //样机 | 67 | //样机 |
63 | public static String YANGJI = "yangji"; | 68 | public static String YANGJI = "yangji"; |
64 | //图片URL | 69 | //图片URL |
65 | public static String IMGURL = "imgurl"; | 70 | public static String IMGURL = "imgurl"; |
66 | //版本名称 | 71 | //版本名称 |
67 | public static String VERSION = "version"; | 72 | public static String VERSION = "version"; |
68 | //版本信息接口返回值 | 73 | //版本信息接口返回值 |
69 | public static String VERSIONINTEFACE = "versioninterface"; | 74 | public static String VERSIONINTEFACE = "versioninterface"; |
70 | 75 | ||
71 | 76 | ||
72 | public void saveLoginParam(Context context,String spname, String spstr) { | 77 | public void saveLoginParam(Context context,String spname, String spstr) { |
73 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 78 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
74 | Activity.MODE_PRIVATE); | 79 | Activity.MODE_PRIVATE); |
75 | 80 | ||
76 | sp.edit().putString(spname, spstr).commit(); | 81 | sp.edit().putString(spname, spstr).commit(); |
77 | } | 82 | } |
78 | 83 | ||
79 | 84 | ||
80 | public String getLoginParam(Context context,String spname) { | 85 | public String getLoginParam(Context context,String spname) { |
81 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 86 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
82 | Activity.MODE_PRIVATE); | 87 | Activity.MODE_PRIVATE); |
83 | String param = sp.getString(spname, null); | 88 | String param = sp.getString(spname, null); |
84 | return param; | 89 | return param; |
85 | } | 90 | } |
86 | public void clearData(Context context) { | 91 | public void clearData(Context context) { |
87 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 92 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
88 | Activity.MODE_PRIVATE); | 93 | Activity.MODE_PRIVATE); |
89 | sp.edit().clear().commit(); | 94 | sp.edit().clear().commit(); |
90 | } | 95 | } |
91 | 96 | ||
92 | public void saveCustomizeParam(Context context,String spname, String spstr) { | 97 | public void saveCustomizeParam(Context context,String spname, String spstr) { |
93 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 98 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
94 | Activity.MODE_PRIVATE); | 99 | Activity.MODE_PRIVATE); |
95 | 100 | ||
96 | sp.edit().putString(spname, spstr).commit(); | 101 | sp.edit().putString(spname, spstr).commit(); |
97 | 102 | ||
98 | } | 103 | } |
99 | 104 | ||
100 | public String getCustomizeParam(Context context,String spname) { | 105 | public String getCustomizeParam(Context context,String spname) { |
101 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 106 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
102 | Activity.MODE_PRIVATE); | 107 | Activity.MODE_PRIVATE); |
103 | String param = sp.getString(spname, null); | 108 | String param = sp.getString(spname, null); |
104 | return param; | 109 | return param; |
105 | } | 110 | } |
106 | 111 | ||
107 | public void clearCustomizeParam(Context context ){ | 112 | public void clearCustomizeParam(Context context ){ |
108 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 113 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
109 | Activity.MODE_PRIVATE); | 114 | Activity.MODE_PRIVATE); |
110 | sp.edit().clear().commit(); | 115 | sp.edit().clear().commit(); |
111 | } | 116 | } |
112 | public void saveCityParam(Context context,String spname, String spstr) { | 117 | public void saveCityParam(Context context,String spname, String spstr) { |
113 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 118 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
114 | Activity.MODE_PRIVATE); | 119 | Activity.MODE_PRIVATE); |
115 | 120 | ||
116 | sp.edit().putString(spname, spstr).commit(); | 121 | sp.edit().putString(spname, spstr).commit(); |
117 | 122 | ||
118 | } | 123 | } |
119 | 124 | ||
120 | public String getsaveCityParam(Context context,String spname) { | 125 | public String getsaveCityParam(Context context,String spname) { |
121 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 126 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
122 | Activity.MODE_PRIVATE); | 127 | Activity.MODE_PRIVATE); |
123 | String param = sp.getString(spname, null); | 128 | String param = sp.getString(spname, null); |
124 | return param; | 129 | return param; |
125 | } | 130 | } |
126 | 131 | ||
127 | public void clearsaveCityParam(Context context ){ | 132 | public void clearsaveCityParam(Context context ){ |
128 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 133 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
129 | Activity.MODE_PRIVATE); | 134 | Activity.MODE_PRIVATE); |
130 | sp.edit().clear().commit(); | 135 | sp.edit().clear().commit(); |
131 | } | 136 | } |
132 | } | 137 | } |
133 | 138 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/LoginFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
8 | import android.support.v4.app.Fragment; | 8 | import android.support.v4.app.Fragment; |
9 | import android.text.Editable; | ||
9 | import android.text.TextUtils; | 10 | import android.text.TextUtils; |
11 | import android.text.TextWatcher; | ||
12 | import android.util.Log; | ||
10 | import android.view.LayoutInflater; | 13 | import android.view.LayoutInflater; |
11 | import android.view.View; | 14 | import android.view.View; |
12 | import android.view.ViewGroup; | 15 | import android.view.ViewGroup; |
13 | import android.widget.Button; | 16 | import android.widget.Button; |
14 | import android.widget.EditText; | 17 | import android.widget.EditText; |
18 | import android.widget.ImageButton; | ||
15 | import android.widget.TextView; | 19 | import android.widget.TextView; |
16 | import android.widget.Toast; | 20 | import android.widget.Toast; |
17 | 21 | ||
18 | import com.hjx.personalcenter.R; | 22 | import com.hjx.personalcenter.R; |
19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; | 23 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; |
20 | import com.hjx.personalcenter.activity.MainActivity; | 24 | import com.hjx.personalcenter.activity.MainActivity; |
21 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | 25 | import com.hjx.personalcenter.activity.RegisterInfoActivity; |
22 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 26 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
23 | import com.hjx.personalcenter.db.Content; | 27 | import com.hjx.personalcenter.db.Content; |
24 | import com.hjx.personalcenter.db.SaveParam; | 28 | import com.hjx.personalcenter.db.SaveParam; |
25 | import com.hjx.personalcenter.http.HttpCode; | 29 | import com.hjx.personalcenter.http.HttpCode; |
26 | import com.hjx.personalcenter.http.HttpManager; | 30 | import com.hjx.personalcenter.http.HttpManager; |
27 | import com.hjx.personalcenter.util.AlertUtils; | 31 | import com.hjx.personalcenter.util.AlertUtils; |
28 | import com.hjx.personalcenter.util.GetDevicesUtil; | 32 | import com.hjx.personalcenter.util.GetDevicesUtil; |
29 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 33 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
30 | 34 | ||
31 | import org.json.JSONException; | 35 | import org.json.JSONException; |
32 | import org.json.JSONObject; | 36 | import org.json.JSONObject; |
33 | 37 | ||
34 | /** | 38 | /** |
35 | * 登录 | 39 | * 登录 |
36 | * Created by h on 2017/8/8. | 40 | * Created by h on 2017/8/8. |
37 | */ | 41 | */ |
38 | 42 | ||
39 | public class LoginFragment extends Fragment implements View.OnClickListener { | 43 | public class LoginFragment extends Fragment implements View.OnClickListener { |
40 | private View mView; | 44 | private View mView; |
41 | private int type; | 45 | private int type; |
42 | private TextView tv_forget_pwd; | 46 | private TextView tv_forget_pwd; |
43 | private Button btn_login; | 47 | private Button btn_login; |
48 | private ImageButton phone_delete_btn,password_delete_btn; | ||
44 | private EditText phonenumber, login_pwwd; | 49 | private EditText phonenumber, login_pwwd; |
45 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 50 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
46 | Intent intent = new Intent(); | 51 | Intent intent = new Intent(); |
52 | private String name; | ||
47 | 53 | ||
48 | public static LoginFragment newInstance(int type) { | 54 | public static LoginFragment newInstance(int type) { |
49 | LoginFragment fragment = new LoginFragment(); | 55 | LoginFragment fragment = new LoginFragment(); |
50 | Bundle bundle = new Bundle(); | 56 | Bundle bundle = new Bundle(); |
51 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 57 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
52 | fragment.setArguments(bundle); | 58 | fragment.setArguments(bundle); |
53 | return fragment; | 59 | return fragment; |
54 | 60 | ||
55 | } | 61 | } |
56 | 62 | ||
57 | Handler handler = new Handler() { | 63 | Handler handler = new Handler() { |
58 | @Override | 64 | @Override |
59 | public void handleMessage(Message msg) { | 65 | public void handleMessage(Message msg) { |
60 | super.handleMessage(msg); | 66 | super.handleMessage(msg); |
61 | 67 | ||
62 | switch (msg.what) { | 68 | switch (msg.what) { |
63 | case HttpCode.LOGIN_SUCESS: | 69 | case HttpCode.LOGIN_SUCESS: |
64 | JSONObject jsonObject; | 70 | JSONObject jsonObject; |
65 | String status; | 71 | String status; |
66 | try { | 72 | try { |
67 | jsonObject = new JSONObject((String) msg.obj); | 73 | jsonObject = new JSONObject((String) msg.obj); |
68 | status = jsonObject.getString("status"); | 74 | status = jsonObject.getString("status"); |
69 | if (status.equals("100")) { | 75 | if (status.equals("100")) { |
70 | String access_token = jsonObject.getString("access_token"); | 76 | String access_token = jsonObject.getString("access_token"); |
71 | String userId = jsonObject.getString("userId"); | 77 | String userId = jsonObject.getString("userId"); |
72 | final String name = phonenumber.getText().toString().trim(); | 78 | name = phonenumber.getText().toString().trim(); |
73 | final String pwd = login_pwwd.getText().toString().trim(); | 79 | final String pwd = login_pwwd.getText().toString().trim(); |
74 | // | 80 | // |
75 | try { | 81 | try { |
76 | long auserID = Long.parseLong(userId); | 82 | long auserID = Long.parseLong(userId); |
77 | //检测注册信息是否完整 | 83 | //检测注册信息是否完整 |
78 | HttpManager.getInstance().registerinfocheck(getActivity(), auserID, handler); | 84 | HttpManager.getInstance().registerinfocheck(getActivity(), auserID, handler); |
79 | //登录成功,保存登录数据并且获取个人信息 | 85 | //登录成功,保存登录数据并且获取个人信息 |
80 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, userId); | 86 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, userId); |
81 | 87 | ||
82 | 88 | ||
83 | } catch (NumberFormatException e) { | 89 | } catch (NumberFormatException e) { |
84 | e.printStackTrace(); | 90 | e.printStackTrace(); |
85 | } | 91 | } |
86 | 92 | ||
87 | 93 | ||
88 | } else if (status.equals("200")) { | 94 | } else if (status.equals("200")) { |
89 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); | 95 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); |
90 | return; | 96 | return; |
91 | } else if (status.equals("204")) { | 97 | } else if (status.equals("204")) { |
92 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); | 98 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); |
93 | } else { | 99 | } else { |
94 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); | 100 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); |
95 | 101 | ||
96 | 102 | ||
97 | } | 103 | } |
98 | } catch (JSONException e) { | 104 | } catch (JSONException e) { |
99 | e.printStackTrace(); | 105 | e.printStackTrace(); |
100 | } | 106 | } |
101 | break; | 107 | break; |
102 | case HttpCode.REGISTER_SUCESS: | 108 | case HttpCode.REGISTER_SUCESS: |
103 | try { | 109 | try { |
104 | jsonObject = new JSONObject((String) msg.obj); | 110 | jsonObject = new JSONObject((String) msg.obj); |
111 | Log.e("AAAAAAA",(String) msg.obj); | ||
105 | status = jsonObject.optString("status"); | 112 | status = jsonObject.optString("status"); |
106 | JSONObject isregisterinfo = (JSONObject) jsonObject.opt("data"); | 113 | JSONObject isregisterinfo = (JSONObject) jsonObject.opt("data"); |
107 | boolean isRegisterInfoComplete = isregisterinfo.optBoolean("isRegisterInfoComplete"); | 114 | boolean isRegisterInfoComplete = isregisterinfo.optBoolean("isRegisterInfoComplete"); |
108 | if (status.equals("1")) { | 115 | if (status.equals("1")) { |
109 | if (!isRegisterInfoComplete) { | 116 | if (!isRegisterInfoComplete) { |
110 | Content.accountflag = 1; | 117 | Content.accountflag = 1; |
111 | Intent intent = new Intent(); | 118 | Intent intent = new Intent(); |
112 | intent.setClass(getActivity(), RegisterInfoActivity.class); | 119 | intent.setClass(getActivity(), RegisterInfoActivity.class); |
113 | getActivity().startActivity(intent); | 120 | getActivity().startActivity(intent); |
114 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 121 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
115 | } else { | 122 | } else { |
116 | String deviceNumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | 123 | String deviceNumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); |
117 | //是否填写保卡 | 124 | //是否填写保卡 |
118 | HttpManager.getInstance().cardinfocheck(getActivity(), deviceNumber, handler); | 125 | HttpManager.getInstance().cardinfocheck(getActivity(), deviceNumber, handler); |
119 | 126 | ||
120 | 127 | ||
121 | } | 128 | } |
122 | 129 | ||
123 | } else { | 130 | } else { |
124 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | 131 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); |
132 | |||
125 | } | 133 | } |
126 | 134 | ||
127 | } catch (JSONException e) { | 135 | } catch (JSONException e) { |
128 | e.printStackTrace(); | 136 | e.printStackTrace(); |
129 | } | 137 | } |
130 | 138 | ||
131 | break; | 139 | break; |
132 | case HttpCode.CHECKCARD: | 140 | case HttpCode.CHECKCARD: |
133 | try { | 141 | try { |
134 | jsonObject = new JSONObject((String) msg.obj); | 142 | jsonObject = new JSONObject((String) msg.obj); |
143 | |||
135 | status = jsonObject.optString("status"); | 144 | status = jsonObject.optString("status"); |
136 | if (status.equals("1")) { | 145 | if (name.equals(getString(R.string.static_str)) || status.equals("2002")) { |
146 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.YANGJI, "1"); | ||
137 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); | 147 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); |
138 | Intent intent = new Intent(); | 148 | Intent intent = new Intent(); |
139 | intent.setClass(getActivity(), MainActivity.class); | 149 | intent.setClass(getActivity(), MainActivity.class); |
140 | getActivity().startActivity(intent); | 150 | getActivity().startActivity(intent); |
141 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 151 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
142 | getActivity().finish(); | 152 | } else if (status.equals("1")) { |
143 | |||
144 | } else if (status.equals("2002")) { | ||
145 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.YANGJI, "1"); | ||
146 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); | 153 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); |
147 | Intent intent = new Intent(); | 154 | Intent intent = new Intent(); |
148 | intent.setClass(getActivity(), MainActivity.class); | 155 | intent.setClass(getActivity(), MainActivity.class); |
149 | getActivity().startActivity(intent); | 156 | getActivity().startActivity(intent); |
150 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 157 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
158 | getActivity().finish(); | ||
159 | |||
151 | } else if (status.equals("2001")) { | 160 | } else if (status.equals("2001")) { |
152 | SaveParam.getInstance().saveCustomizeParam(getActivity(),SaveParam.CARDPHONE,""); | 161 | SaveParam.getInstance().saveCustomizeParam(getActivity(), SaveParam.CARDPHONE, ""); |
153 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); | 162 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); |
154 | } else { | 163 | } else { |
155 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | 164 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); |
156 | } | 165 | } |
157 | 166 | ||
158 | } catch (JSONException e) { | 167 | } catch (JSONException e) { |
159 | e.printStackTrace(); | 168 | e.printStackTrace(); |
160 | } | 169 | } |
161 | 170 | ||
162 | break; | 171 | break; |
163 | } | 172 | } |
164 | } | 173 | } |
165 | }; | 174 | }; |
166 | 175 | ||
167 | @Override | 176 | @Override |
168 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 177 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
169 | if (mView == null) { | 178 | if (mView == null) { |
170 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); | 179 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); |
171 | initView(mView); | 180 | initView(mView); |
172 | initData(); | 181 | initData(); |
182 | initTextWatch(); | ||
173 | setLister(); | 183 | setLister(); |
174 | } | 184 | } |
175 | return mView; | 185 | return mView; |
176 | } | 186 | } |
177 | 187 | ||
178 | //初始化 | 188 | //初始化 |
179 | private void initView(View mView) { | 189 | private void initView(View mView) { |
180 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); | 190 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); |
181 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); | 191 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); |
182 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); | 192 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); |
183 | btn_login = (Button) mView.findViewById(R.id.btn_login); | 193 | btn_login = (Button) mView.findViewById(R.id.btn_login); |
194 | phone_delete_btn = (ImageButton) mView.findViewById(R.id.phone_delete_btn); | ||
195 | password_delete_btn = (ImageButton) mView.findViewById(R.id.password_delete_btn); | ||
184 | 196 | ||
185 | } | 197 | } |
186 | 198 | ||
199 | /** | ||
200 | * 输入框改变的监听 | ||
201 | */ | ||
202 | private void initTextWatch() { | ||
203 | phonenumber.addTextChangedListener(new TextWatcher() { | ||
204 | @Override | ||
205 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
206 | } | ||
207 | |||
208 | @Override | ||
209 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
210 | if (s.toString().length() == 0) { | ||
211 | phone_delete_btn.setVisibility(View.INVISIBLE); | ||
212 | } else { | ||
213 | phone_delete_btn.setVisibility(View.VISIBLE); | ||
214 | } | ||
215 | } | ||
216 | |||
217 | @Override | ||
218 | public void afterTextChanged(Editable s) { | ||
219 | |||
220 | } | ||
221 | }); | ||
222 | phonenumber.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
223 | @Override | ||
224 | public void onFocusChange(View v, boolean hasFocus) { | ||
225 | if (hasFocus) { | ||
226 | if (!phonenumber.getText().toString().isEmpty()) { | ||
227 | phone_delete_btn.setVisibility(View.VISIBLE); | ||
228 | } | ||
229 | } else { | ||
230 | |||
231 | phone_delete_btn.setVisibility(View.INVISIBLE); | ||
232 | } | ||
233 | } | ||
234 | }); | ||
235 | login_pwwd.addTextChangedListener(new TextWatcher() { | ||
236 | @Override | ||
237 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
238 | |||
239 | } | ||
240 | |||
241 | @Override | ||
242 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
243 | if (s.toString().length() == 0) { | ||
244 | |||
245 | password_delete_btn.setVisibility(View.INVISIBLE); | ||
246 | } else { | ||
247 | password_delete_btn.setVisibility(View.VISIBLE); | ||
248 | } | ||
249 | } | ||
250 | |||
251 | @Override | ||
252 | public void afterTextChanged(Editable s) { | ||
253 | |||
254 | } | ||
255 | }); | ||
256 | login_pwwd.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
257 | @Override | ||
258 | public void onFocusChange(View v, boolean hasFocus) { | ||
259 | if (hasFocus) { | ||
260 | if (!login_pwwd.getText().toString().isEmpty()) { | ||
261 | password_delete_btn.setVisibility(View.VISIBLE); | ||
262 | } | ||
263 | } else { | ||
264 | password_delete_btn.setVisibility(View.INVISIBLE); | ||
265 | } | ||
266 | } | ||
267 | }); | ||
268 | } | ||
269 | |||
270 | |||
187 | private void initData() { | 271 | private void initData() { |
188 | } | 272 | } |
189 | 273 | ||
190 | private void setLister() { | 274 | private void setLister() { |
191 | tv_forget_pwd.setOnClickListener(this); | 275 | tv_forget_pwd.setOnClickListener(this); |
192 | btn_login.setOnClickListener(this); | 276 | btn_login.setOnClickListener(this); |
277 | phone_delete_btn.setOnClickListener(this); | ||
278 | password_delete_btn.setOnClickListener(this); | ||
193 | } | 279 | } |
194 | 280 | ||
195 | 281 | ||
196 | @Override | 282 | @Override |
197 | public void onClick(View v) { | 283 | public void onClick(View v) { |
198 | switch (v.getId()) { | 284 | switch (v.getId()) { |
199 | case R.id.tv_forget_pwd: | 285 | case R.id.tv_forget_pwd: |
200 | intent.setClass(getActivity(), ForgotPasswordActivity.class); | 286 | intent.setClass(getActivity(), ForgotPasswordActivity.class); |
201 | startActivity(intent); | 287 | startActivity(intent); |
202 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 288 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
203 | break; | 289 | break; |
204 | case R.id.btn_login: | 290 | case R.id.btn_login: |
205 | login(); | 291 | login(); |
206 | break; | 292 | break; |
293 | case R.id.phone_delete_btn: | ||
294 | phonenumber.setText(""); | ||
295 | break; | ||
296 | case R.id.password_delete_btn: | ||
297 | login_pwwd.setText(""); | ||
298 | break; | ||
207 | } | 299 | } |
208 | 300 | ||
209 | } | 301 | } |
210 | 302 | ||
211 | private void login() { | 303 | private void login() { |
212 | final String name = phonenumber.getText().toString().trim(); | 304 | final String name = phonenumber.getText().toString().trim(); |
213 | final String pwd = login_pwwd.getText().toString().trim(); | 305 | final String pwd = login_pwwd.getText().toString().trim(); |
214 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { | 306 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { |
215 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); | 307 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); |
216 | return; | 308 | return; |
217 | } else if (!PhoneNumCheckUtils.isPhone(name)) { | 309 | } else if (!PhoneNumCheckUtils.isPhone(name)) { |
218 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); | 310 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); |
219 | } else { | 311 | } else { |
220 | //登录接口 | 312 | //登录接口 |
221 | HttpManager.getInstance().login(name, pwd, getActivity(), handler); | 313 | HttpManager.getInstance().login(name, pwd, getActivity(), handler); |
222 | } | 314 | } |
223 | 315 | ||
224 | 316 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/RegisterFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
8 | import android.support.v4.app.Fragment; | 8 | import android.support.v4.app.Fragment; |
9 | import android.text.Editable; | ||
9 | import android.text.TextUtils; | 10 | import android.text.TextUtils; |
11 | import android.text.TextWatcher; | ||
10 | import android.text.method.HideReturnsTransformationMethod; | 12 | import android.text.method.HideReturnsTransformationMethod; |
11 | import android.text.method.PasswordTransformationMethod; | 13 | import android.text.method.PasswordTransformationMethod; |
14 | import android.util.Log; | ||
12 | import android.view.LayoutInflater; | 15 | import android.view.LayoutInflater; |
13 | import android.view.View; | 16 | import android.view.View; |
14 | import android.view.ViewGroup; | 17 | import android.view.ViewGroup; |
15 | import android.widget.Button; | 18 | import android.widget.Button; |
16 | import android.widget.EditText; | 19 | import android.widget.EditText; |
20 | import android.widget.ImageButton; | ||
17 | import android.widget.ImageView; | 21 | import android.widget.ImageView; |
18 | 22 | ||
19 | import com.hjx.personalcenter.R; | 23 | import com.hjx.personalcenter.R; |
20 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | 24 | import com.hjx.personalcenter.activity.RegisterInfoActivity; |
21 | import com.hjx.personalcenter.db.Content; | 25 | import com.hjx.personalcenter.db.Content; |
22 | import com.hjx.personalcenter.db.SaveParam; | 26 | import com.hjx.personalcenter.db.SaveParam; |
23 | import com.hjx.personalcenter.http.HttpCode; | 27 | import com.hjx.personalcenter.http.HttpCode; |
24 | import com.hjx.personalcenter.http.HttpManager; | 28 | import com.hjx.personalcenter.http.HttpManager; |
25 | import com.hjx.personalcenter.util.AlertUtils; | 29 | import com.hjx.personalcenter.util.AlertUtils; |
26 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 30 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
27 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 31 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
28 | 32 | ||
29 | import org.json.JSONException; | 33 | import org.json.JSONException; |
30 | import org.json.JSONObject; | 34 | import org.json.JSONObject; |
31 | 35 | ||
32 | import java.util.TimerTask; | 36 | import java.util.TimerTask; |
33 | 37 | ||
34 | /** | 38 | /** |
35 | * 注册 | 39 | * 注册 |
36 | * Created by Administrator on 2016/11/7. | 40 | * Created by Administrator on 2016/11/7. |
37 | */ | 41 | */ |
38 | 42 | ||
39 | public class RegisterFragment extends Fragment implements View.OnClickListener { | 43 | public class RegisterFragment extends Fragment implements View.OnClickListener { |
40 | private View mView; | 44 | private View mView; |
41 | 45 | ||
42 | private Button btn_register,get_authcode; | 46 | private Button btn_register,get_authcode; |
47 | private ImageButton phone_delete_btn,code_delete_btn; | ||
43 | private EditText phonenumber,password,anth_6num;//;//密码 | 48 | private EditText phonenumber,password,anth_6num;//;//密码 |
44 | private ImageView openeyes; | 49 | private ImageView openeyes; |
45 | private String sourceStr ="android"; | 50 | private String sourceStr ="android"; |
46 | private String typeStr = "register"; | 51 | private String typeStr = "register"; |
47 | private int delayTime=60; | 52 | private int delayTime=60; |
48 | private java.util.Timer Delaytimer; | 53 | private java.util.Timer Delaytimer; |
49 | private int type; | 54 | private int type; |
50 | public static Boolean showPassword = false; | 55 | public static Boolean showPassword = false; |
51 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 56 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
52 | 57 | ||
53 | public static RegisterFragment newInstance(int type) { | 58 | public static RegisterFragment newInstance(int type) { |
54 | RegisterFragment fragment = new RegisterFragment(); | 59 | RegisterFragment fragment = new RegisterFragment(); |
55 | Bundle bundle = new Bundle(); | 60 | Bundle bundle = new Bundle(); |
56 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 61 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
57 | fragment.setArguments(bundle); | 62 | fragment.setArguments(bundle); |
58 | return fragment; | 63 | return fragment; |
59 | 64 | ||
60 | } | 65 | } |
61 | Handler handler = new Handler() { | 66 | Handler handler = new Handler() { |
62 | @Override | 67 | @Override |
63 | public void handleMessage(Message msg) { | 68 | public void handleMessage(Message msg) { |
64 | super.handleMessage(msg); | 69 | super.handleMessage(msg); |
65 | try { | 70 | try { |
66 | JSONObject jsonObject; | 71 | JSONObject jsonObject; |
67 | String status; | 72 | String status; |
68 | switch (msg.what) { | 73 | switch (msg.what) { |
69 | case HttpCode.REGISTERED_SUCESS: | 74 | case HttpCode.REGISTERED_SUCESS: |
70 | jsonObject = (JSONObject) msg.obj; | 75 | jsonObject = (JSONObject) msg.obj; |
71 | status = jsonObject.getString("status"); | 76 | status = jsonObject.getString("status"); |
72 | //AlertUtils.showToast(RegisterActivity.this, jsonObject.optString("message")); | 77 | //AlertUtils.showToast(RegisterActivity.this, jsonObject.optString("message")); |
73 | String access_token = jsonObject.getString("access_token"); | ||
74 | String userId = jsonObject.getString("userId"); | ||
75 | if (status.equals("100")) { | 78 | if (status.equals("100")) { |
79 | String access_token = jsonObject.getString("access_token"); | ||
80 | String userId = jsonObject.getString("userId"); | ||
76 | String usernameStr = phonenumber.getText().toString().trim(); | 81 | String usernameStr = phonenumber.getText().toString().trim(); |
77 | String passwordStr = password.getText().toString().trim(); | 82 | String passwordStr = password.getText().toString().trim(); |
78 | HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,userId); | 83 | HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,userId); |
79 | SaveParam.getInstance().saveCustomizeParam(getActivity(), SaveParam.ACCOUNT, "1"); | 84 | SaveParam.getInstance().saveCustomizeParam(getActivity(), SaveParam.ACCOUNT, "1"); |
80 | AlertUtils.showToast(getActivity(), "注册成功!"); | 85 | AlertUtils.showToast(getActivity(), "注册成功!"); |
81 | Content.accountflag =1; | 86 | Content.accountflag =1; |
82 | Intent intent = new Intent(); | 87 | Intent intent = new Intent(); |
83 | intent.setClass(getActivity(),RegisterInfoActivity.class); | 88 | intent.setClass(getActivity(),RegisterInfoActivity.class); |
84 | startActivity(intent); | 89 | startActivity(intent); |
85 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 90 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
86 | }else if(status.equals("209")){ | 91 | }else if(status.equals("209")){ |
87 | AlertUtils.showToast(getActivity(), "验证码错误!"); | 92 | AlertUtils.showToast(getActivity(), "验证码错误!"); |
93 | }else{ | ||
94 | AlertUtils.showToast(getActivity(), "请检查网络!"); | ||
88 | } | 95 | } |
96 | Log.d("AAAAA",status+""); | ||
89 | break; | 97 | break; |
90 | case HttpCode.REGISTERED_FAIL: | 98 | case HttpCode.REGISTERED_FAIL: |
91 | AlertUtils.showToast(getActivity(), "注册失败"); | 99 | AlertUtils.showToast(getActivity(), "注册失败"); |
92 | break; | 100 | break; |
93 | case HttpCode.AUTHCODE_SUCESS: | 101 | case HttpCode.AUTHCODE_SUCESS: |
94 | jsonObject = (JSONObject) msg.obj; | 102 | jsonObject = (JSONObject) msg.obj; |
95 | status = jsonObject.optString("status"); | 103 | status = jsonObject.optString("status"); |
96 | if (status.equals("100")) { | 104 | if (status.equals("100")) { |
97 | AlertUtils.showToast(getActivity(), "验证码发送成功"); | 105 | AlertUtils.showToast(getActivity(), "验证码发送成功"); |
98 | } | 106 | } |
99 | 107 | ||
100 | break; | 108 | break; |
101 | case HttpCode.AUTHCODE_FAIL: | 109 | case HttpCode.AUTHCODE_FAIL: |
102 | jsonObject = (JSONObject) msg.obj; | 110 | jsonObject = (JSONObject) msg.obj; |
103 | AlertUtils.showToast(getActivity(), "验证码发送失败"); | 111 | AlertUtils.showToast(getActivity(), "验证码发送失败"); |
104 | break; | 112 | break; |
105 | case HttpCode.IS_REFISTER: | 113 | case HttpCode.IS_REFISTER: |
106 | jsonObject = (JSONObject) msg.obj; | 114 | jsonObject = (JSONObject) msg.obj; |
107 | status = jsonObject.getString("status"); | 115 | status = jsonObject.getString("status"); |
108 | if (!status.equals("true")) { | 116 | if (!status.equals("true")) { |
109 | getauthcode(); | 117 | getauthcode(); |
110 | 118 | ||
111 | }else { | 119 | }else { |
112 | AlertUtils.showToast(getActivity(), "该手机号已经注册过了"); | 120 | AlertUtils.showToast(getActivity(), "该手机号已经注册过了"); |
113 | } | 121 | } |
114 | break; | 122 | break; |
115 | case 21: | 123 | case 21: |
116 | if(delayTime<=0){ | 124 | if(delayTime<=0){ |
117 | if(Delaytimer!=null){ | 125 | if(Delaytimer!=null){ |
118 | Delaytimer.cancel(); | 126 | Delaytimer.cancel(); |
119 | } | 127 | } |
120 | get_authcode.setEnabled(true); | 128 | get_authcode.setEnabled(true); |
121 | get_authcode.setClickable(true); | 129 | get_authcode.setClickable(true); |
122 | get_authcode.setText("获取验证码"); | 130 | get_authcode.setText("获取验证码"); |
123 | delayTime=60; | 131 | delayTime=60; |
124 | }else{ | 132 | }else{ |
125 | get_authcode.setEnabled(false); | 133 | get_authcode.setEnabled(false); |
126 | get_authcode.setClickable(false); | 134 | get_authcode.setClickable(false); |
127 | get_authcode.setText(delayTime + " s"); | 135 | get_authcode.setText(delayTime + " s"); |
128 | } | 136 | } |
129 | break; | 137 | break; |
130 | } | 138 | } |
131 | } catch (JSONException e) { | 139 | } catch (JSONException e) { |
132 | e.printStackTrace(); | 140 | e.printStackTrace(); |
133 | } | 141 | } |
134 | } | 142 | } |
135 | }; | 143 | }; |
136 | @Override | 144 | @Override |
137 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 145 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
138 | if (mView == null) { | 146 | if (mView == null) { |
139 | mView = inflater.inflate(R.layout.fragment_loginandregister_register, container, false); | 147 | mView = inflater.inflate(R.layout.fragment_loginandregister_register, container, false); |
140 | initView(mView); | 148 | initView(mView); |
141 | initData(); | 149 | initData(); |
150 | initTextWatch(); | ||
142 | setLister(); | 151 | setLister(); |
143 | 152 | ||
144 | 153 | ||
145 | } | 154 | } |
146 | return mView; | 155 | return mView; |
147 | } | 156 | } |
148 | 157 | ||
149 | private void initView(View mView) { | 158 | private void initView(View mView) { |
150 | get_authcode = (Button) mView.findViewById(R.id.btn_authcode); | 159 | get_authcode = (Button) mView.findViewById(R.id.btn_authcode); |
151 | anth_6num = (EditText) mView.findViewById(R.id.et_authcode); | 160 | anth_6num = (EditText) mView.findViewById(R.id.et_authcode); |
152 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); | 161 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); |
153 | password = (EditText) mView.findViewById(R.id.et_password); | 162 | password = (EditText) mView.findViewById(R.id.et_password); |
154 | openeyes= (ImageView) mView.findViewById(R.id.iv_pwd_change); | 163 | openeyes= (ImageView) mView.findViewById(R.id.iv_pwd_change); |
155 | btn_register = (Button) mView.findViewById(R.id.btn_register); | 164 | btn_register = (Button) mView.findViewById(R.id.btn_register); |
165 | phone_delete_btn = (ImageButton) mView.findViewById(R.id.phone_delete_btn); | ||
166 | code_delete_btn = (ImageButton) mView.findViewById(R.id.code_delete_btn); | ||
156 | 167 | ||
157 | } | 168 | } |
169 | |||
170 | /** | ||
171 | * 输入框改变的监听 | ||
172 | */ | ||
173 | private void initTextWatch() { | ||
174 | phonenumber.addTextChangedListener(new TextWatcher() { | ||
175 | @Override | ||
176 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
177 | } | ||
178 | |||
179 | @Override | ||
180 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
181 | if (s.toString().length() == 0) { | ||
182 | phone_delete_btn.setVisibility(View.INVISIBLE); | ||
183 | } else { | ||
184 | phone_delete_btn.setVisibility(View.VISIBLE); | ||
185 | } | ||
186 | } | ||
187 | |||
188 | @Override | ||
189 | public void afterTextChanged(Editable s) { | ||
190 | |||
191 | } | ||
192 | }); | ||
193 | phonenumber.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
194 | @Override | ||
195 | public void onFocusChange(View v, boolean hasFocus) { | ||
196 | if (hasFocus) { | ||
197 | if (!phonenumber.getText().toString().isEmpty()) { | ||
198 | phone_delete_btn.setVisibility(View.VISIBLE); | ||
199 | } | ||
200 | } else { | ||
201 | |||
202 | phone_delete_btn.setVisibility(View.INVISIBLE); | ||
203 | } | ||
204 | } | ||
205 | }); | ||
206 | anth_6num.addTextChangedListener(new TextWatcher() { | ||
207 | @Override | ||
208 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
209 | |||
210 | } | ||
211 | |||
212 | @Override | ||
213 | public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
214 | if (s.toString().length() == 0) { | ||
215 | |||
216 | code_delete_btn.setVisibility(View.INVISIBLE); | ||
217 | } else { | ||
218 | code_delete_btn.setVisibility(View.VISIBLE); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | @Override | ||
223 | public void afterTextChanged(Editable s) { | ||
224 | |||
225 | } | ||
226 | }); | ||
227 | anth_6num.setOnFocusChangeListener(new View.OnFocusChangeListener() { | ||
228 | @Override | ||
229 | public void onFocusChange(View v, boolean hasFocus) { | ||
230 | if (hasFocus) { | ||
231 | if (!anth_6num.getText().toString().isEmpty()) { | ||
232 | code_delete_btn.setVisibility(View.VISIBLE); | ||
233 | } | ||
234 | } else { | ||
235 | code_delete_btn.setVisibility(View.INVISIBLE); | ||
236 | } | ||
237 | } | ||
238 | }); | ||
239 | } | ||
240 | |||
158 | private void initData() { | 241 | private void initData() { |
159 | } | 242 | } |
160 | private void setLister() { | 243 | private void setLister() { |
161 | get_authcode.setOnClickListener(this); | 244 | get_authcode.setOnClickListener(this); |
162 | openeyes.setOnClickListener(this); | 245 | openeyes.setOnClickListener(this); |
163 | btn_register.setOnClickListener(this); | 246 | btn_register.setOnClickListener(this); |
247 | phone_delete_btn.setOnClickListener(this); | ||
248 | code_delete_btn.setOnClickListener(this); | ||
164 | } | 249 | } |
165 | 250 | ||
166 | 251 | ||
167 | @Override | 252 | @Override |
168 | public void onClick(View v) { | 253 | public void onClick(View v) { |
169 | switch (v.getId()){ | 254 | switch (v.getId()){ |
170 | case R.id.btn_register: | 255 | case R.id.btn_register: |
171 | //测试 | 256 | //测试 |
172 | // | 257 | // |
173 | 258 | ||
174 | String usernameStr = phonenumber.getText().toString().trim(); | 259 | String usernameStr = phonenumber.getText().toString().trim(); |
175 | String authcodeStr = anth_6num.getText().toString().trim(); | 260 | String authcodeStr = anth_6num.getText().toString().trim(); |
176 | String passwordStr = password.getText().toString().trim(); | 261 | String passwordStr = password.getText().toString().trim(); |
177 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)||TextUtils.isEmpty(passwordStr)) { | 262 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)||TextUtils.isEmpty(passwordStr)) { |
178 | AlertUtils.showToast(getActivity(), "手机号,密码和验证码不能为空"); | 263 | AlertUtils.showToast(getActivity(), "手机号,密码和验证码不能为空"); |
179 | return; | 264 | return; |
180 | } else if(passwordStr.length()<8){ | 265 | } else if(passwordStr.length()<8){ |
181 | AlertUtils.showToast(getActivity(), "密码不能少于8位"); | 266 | AlertUtils.showToast(getActivity(), "密码不能少于8位"); |
182 | }else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 267 | }else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ |
183 | AlertUtils.showToast(getActivity(), "手机号码输入错误"); | 268 | AlertUtils.showToast(getActivity(), "手机号码输入错误"); |
184 | 269 | ||
185 | }else if(!passwordStr.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ | 270 | }else if(!passwordStr.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ |
186 | AlertUtils.showToast(getActivity(), "密码由英文和数字组成"); | 271 | AlertUtils.showToast(getActivity(), "密码由英文和数字组成"); |
187 | }else { | 272 | }else { |
188 | register(); | 273 | register(); |
189 | } | 274 | } |
190 | 275 | ||
191 | break; | 276 | break; |
192 | case R.id.iv_pwd_change: | 277 | case R.id.iv_pwd_change: |
193 | if(showPassword){//显示密码 | 278 | if(showPassword){//显示密码 |
194 | showPassword = !showPassword; | 279 | showPassword = !showPassword; |
195 | openeyes.setImageResource(R.mipmap.pwd_open); | 280 | openeyes.setImageResource(R.mipmap.pwd_open); |
196 | password.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 281 | password.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
197 | password.setSelection(password.getText().toString().length()); | 282 | password.setSelection(password.getText().toString().length()); |
198 | }else{//隐藏密码 | 283 | }else{//隐藏密码 |
199 | showPassword = !showPassword; | 284 | showPassword = !showPassword; |
200 | openeyes.setImageResource(R.mipmap.pwd_hide); | 285 | openeyes.setImageResource(R.mipmap.pwd_hide); |
201 | password.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 286 | password.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
202 | password.setSelection(password.getText().toString().length()); | 287 | password.setSelection(password.getText().toString().length()); |
203 | } | 288 | } |
204 | break; | 289 | break; |
205 | case R.id.btn_authcode: | 290 | case R.id.btn_authcode: |
206 | usernameStr = phonenumber.getText().toString().trim(); | 291 | usernameStr = phonenumber.getText().toString().trim(); |
207 | if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 292 | if (!PhoneNumCheckUtils.isPhone(usernameStr)){ |
208 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); | 293 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); |
209 | }else { | 294 | }else { |
210 | anth_6num.requestFocus(); | 295 | anth_6num.requestFocus(); |
211 | ifregister(); | 296 | ifregister(); |
212 | } | 297 | } |
213 | 298 | ||
214 | break; | 299 | break; |
300 | case R.id.phone_delete_btn: | ||
301 | phonenumber.setText(""); | ||
302 | break; | ||
303 | case R.id.code_delete_btn: | ||
304 | anth_6num.setText(""); | ||
305 | break; | ||
215 | } | 306 | } |
216 | 307 | ||
217 | } | 308 | } |
218 | //获取验证码 | 309 | //获取验证码 |
219 | private void getauthcode() { | 310 | private void getauthcode() { |
220 | String usernameStr = phonenumber.getText().toString().trim(); | 311 | String usernameStr = phonenumber.getText().toString().trim(); |
221 | HttpManager.getInstance().authCode(typeStr, usernameStr, handler, getActivity()); | 312 | HttpManager.getInstance().authCode(typeStr, usernameStr, handler, getActivity()); |
222 | valiDelay(); | 313 | valiDelay(); |
223 | } | 314 | } |
224 | 315 | ||
225 | private void ifregister() { | 316 | private void ifregister() { |
226 | String usernameStr = phonenumber.getText().toString().trim(); | 317 | String usernameStr = phonenumber.getText().toString().trim(); |
227 | HttpManager.getInstance().isregistered(usernameStr, handler, getActivity()); | 318 | HttpManager.getInstance().isregistered(usernameStr, handler, getActivity()); |
228 | } | 319 | } |
229 | 320 | ||
230 | private void register() { | 321 | private void register() { |
231 | String usernameStr = phonenumber.getText().toString().trim(); | 322 | String usernameStr = phonenumber.getText().toString().trim(); |
232 | String authcodeStr = anth_6num.getText().toString().trim(); | 323 | String authcodeStr = anth_6num.getText().toString().trim(); |
233 | String passwordStr = password.getText().toString().trim(); | 324 | String passwordStr = password.getText().toString().trim(); |
234 | HttpManager.getInstance().register(getActivity(), usernameStr, passwordStr, authcodeStr, sourceStr,handler); | 325 | HttpManager.getInstance().register(getActivity(), usernameStr, passwordStr, authcodeStr, sourceStr,handler); |
235 | } | 326 | } |
236 | // 线程类 定时器 | 327 | // 线程类 定时器 |
237 | public void valiDelay() { | 328 | public void valiDelay() { |
238 | 329 | ||
239 | Delaytimer = new java.util.Timer(true); | 330 | Delaytimer = new java.util.Timer(true); |
240 | 331 | ||
241 | 332 | ||
242 | TimerTask task = new TimerTask() { | 333 | TimerTask task = new TimerTask() { |
243 | public void run() { | 334 | public void run() { |
244 | //每次需要执行的代码放到这里面。 | 335 | //每次需要执行的代码放到这里面。 |
245 | delayTime--; | 336 | delayTime--; |
246 | handler.sendEmptyMessage(21); | 337 | handler.sendEmptyMessage(21); |
247 | } | 338 | } |
248 | }; | 339 | }; |
249 | Delaytimer.schedule(task, 1000,1000); | 340 | Delaytimer.schedule(task, 1000,1000); |
250 | } | 341 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpClient.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | 3 | ||
4 | import android.os.Build; | ||
5 | |||
6 | import com.hjx.personalcenter.R; | ||
7 | import com.hjx.personalcenter.activity.MyApplication; | ||
8 | import com.hjx.personalcenter.util.VersionCodeUtils; | ||
4 | import android.os.Build; | 9 | import com.loopj.android.http.AsyncHttpClient; |
5 | 10 | ||
6 | import com.hjx.personalcenter.R; | 11 | public class HttpClient extends AsyncHttpClient { |
7 | import com.hjx.personalcenter.activity.MyApplication; | 12 | private static HttpClient client; |
8 | import com.hjx.personalcenter.util.VersionCodeUtils; | 13 | |
9 | import com.loopj.android.http.AsyncHttpClient; | 14 | public static HttpClient getInstance() { |
10 | 15 | if(client == null) { | |
11 | public class HttpClient extends AsyncHttpClient { | 16 | client = new HttpClient(); |
17 | client.addHeader("app-name", MyApplication.getInstance().getString(R.string.app_name)); | ||
18 | client.addHeader("device-model", Build.MODEL); | ||
19 | client.addHeader("device-number", Build.SERIAL); | ||
20 | client.addHeader("os-type", "Android"); | ||
21 | client.addHeader("os-version", Build.VERSION.RELEASE); | ||
22 | client.addHeader("pid", MyApplication.getInstance().getPackageName()); | ||
23 | client.addHeader("version-code", VersionCodeUtils.getVersionCode()+""); | ||
24 | client.addHeader("version-name", VersionCodeUtils.getVerName()); | ||
12 | private static HttpClient client; | 25 | } |
13 | 26 | return client; | |
14 | public static HttpClient getInstance() { | 27 | } |
15 | if(client == null) { | 28 | private HttpClient() {} |
16 | client = new HttpClient(); | 29 | |
17 | client.addHeader("app-name", MyApplication.getInstance().getString(R.string.app_name)); | 30 | |
18 | client.addHeader("device-model", Build.MODEL); | 31 | } |
19 | client.addHeader("device-number", Build.SERIAL); | 32 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Created by wei on 2017/6/21. | 4 | * Created by wei on 2017/6/21. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | public class HttpCode { | 7 | public class HttpCode { |
8 | //查询保卡信息 | 8 | //查询保卡信息 |
9 | public static final int SUCHCARDINFO = 0; | 9 | public static final int SUCHCARDINFO = 0; |
10 | //是否填写保卡信息 | 10 | //是否填写保卡信息 |
11 | public static final int CHECKCARD = 1; | 11 | public static final int CHECKCARD = 1; |
12 | //注册 | 12 | //注册 |
13 | public static final int REGISTERED_SUCESS = 2; | 13 | public static final int REGISTERED_SUCESS = 2; |
14 | public static final int REGISTERED_FAIL = 3; | 14 | public static final int REGISTERED_FAIL = 3; |
15 | //注册验证码 | 15 | //注册验证码 |
16 | public static final int AUTHCODE_SUCESS = 4; | 16 | public static final int AUTHCODE_SUCESS = 4; |
17 | public static final int AUTHCODE_FAIL = 5; | 17 | public static final int AUTHCODE_FAIL = 5; |
18 | //忘记密码验证码 | 18 | //忘记密码验证码 |
19 | public static final int AUTHCODE_SUCESS1 = 6; | 19 | public static final int AUTHCODE_SUCESS1 = 6; |
20 | public static final int AUTHCODE_FAIL1 = 7; | 20 | public static final int AUTHCODE_FAIL1 = 7; |
21 | //是否已经注册 | 21 | //是否已经注册 |
22 | public static final int IS_REFISTER = 8; | 22 | public static final int IS_REFISTER = 8; |
23 | //忘记密码 | 23 | //忘记密码 |
24 | public static final int PASSWORD_SUCESS = 9; | 24 | public static final int PASSWORD_SUCESS = 9; |
25 | public static final int PASSWORD_FAIL = 10; | 25 | public static final int PASSWORD_FAIL = 10; |
26 | //s省 | 26 | //s省 |
27 | public static final int PROVICES = 11; | 27 | public static final int PROVICES = 11; |
28 | //市 | 28 | //市 |
29 | public static final int CITYS = 12; | 29 | public static final int CITYS = 12; |
30 | //区 | 30 | //区 |
31 | public static final int COUNTRY = 13; | 31 | public static final int COUNTRY = 13; |
32 | //学校 | 32 | //学校 |
33 | public static final int SCHOOL = 14; | 33 | public static final int SCHOOL = 14; |
34 | //年级 | 34 | //年级 |
35 | public static final int GRADER = 15; | 35 | public static final int GRADER = 15; |
36 | //获取个人信息 | 36 | //获取个人信息 |
37 | public static final int GETINFO = 16; | 37 | public static final int GETINFO = 16; |
38 | //获取个性签名 | 38 | //获取个性签名 |
39 | public static final int SIGN = 17; | 39 | public static final int SIGN = 17; |
40 | //登录 | 40 | //登录 |
41 | public static final int LOGIN_SUCESS = 18; | 41 | public static final int LOGIN_SUCESS = 18; |
42 | //获取子账户信息 | 42 | //获取子账户信息 |
43 | public static final int CHILDS_SUCESS = 19; | 43 | public static final int CHILDS_SUCESS = 19; |
44 | //版本升级 | 44 | //版本升级 |
45 | public static final int APPUPDATE_SUCESS = 20; | 45 | public static final int APPUPDATE_SUCESS = 20; |
46 | //获取出版社 | 46 | //获取出版社 |
47 | public static final int VERSION_SUCESS = 22; | 47 | public static final int VERSION_SUCESS = 22; |
48 | //注册信息是否完整 | 48 | //注册信息是否完整 |
49 | public static final int REGISTER_SUCESS = 23; | 49 | public static final int REGISTER_SUCESS = 23; |
50 | //获取默认版本信息 | 50 | //获取默认版本信息 |
51 | public static final int PUBLISH_SUCESS = 24; | 51 | public static final int PUBLISH_SUCESS = 24; |
52 | //注册信息提交 | 52 | //注册信息提交 |
53 | public static final int REGISTERINFO_SUCESS = 25; | 53 | public static final int REGISTERINFO_SUCESS = 25; |
54 | //获取视频信息 | 54 | //获取视频信息 |
55 | public static final int GETVIDIO_SUCESS = 26; | 55 | public static final int GETVIDIO_SUCESS = 26; |
56 | //查询保卡信息1 | 56 | //查询保卡信息1 |
57 | public static final int SUCHCARDINFOONE = 27; | 57 | public static final int SUCHCARDINFOONE = 27; |
58 | //个人信息 | 58 | //个人信息 |
59 | public static final int PESERNAOL = 28; | 59 | public static final int PESERNAOL = 28; |
60 | //touxan | 60 | //touxan |
61 | public static final int TOUXIANG = 29; | 61 | public static final int TOUXIANG = 29; |
62 | //学校 | 62 | //学校 |
63 | public static final int SCOOL = 29; | 63 | public static final int SCOOL = 29; |
64 | //每天POST设备号,需要重新登录 | ||
65 | public static final int RELOGIN = 30; | ||
66 | //T5 PLUS激活成功 | ||
67 | public static final int ACTIVATION_SUCCESS = 31; | ||
68 | //T5 PLUS激活成功 | ||
69 | public static final int NO_SALES_MAN = 32; | ||
64 | //每天POST设备号,需要重新登录 | 70 | |
65 | public static final int RELOGIN = 30; | 71 | |
66 | 72 | } | |
67 | 73 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpKey.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | /**请求参数 | 3 | /**请求参数 |
4 | * Created by wei on 2017/6/20. | 4 | * Created by wei on 2017/6/20. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | public class HttpKey { | 7 | public class HttpKey { |
8 | //注册key | 8 | //注册key |
9 | public static String USERNAME = "username"; | 9 | public static String USERNAME = "username"; |
10 | public static String PASSWORD = "password"; | 10 | public static String PASSWORD = "password"; |
11 | public static String SMSCODE = "smscode"; | 11 | public static String SMSCODE = "smscode"; |
12 | public static String SOURCE = "source"; | 12 | public static String SOURCE = "source"; |
13 | //忘记密码 | 13 | //忘记密码 |
14 | public static String AUTHCODE = "authCode"; | 14 | public static String AUTHCODE = "authCode"; |
15 | //注册验证码和忘记密码验证码 | 15 | //注册验证码和忘记密码验证码 |
16 | public static String TYPE = "type"; | 16 | public static String TYPE = "type"; |
17 | public static String MOBIL = "mobile"; | 17 | public static String MOBIL = "mobile"; |
18 | //修改密码 | 18 | //修改密码 |
19 | public static String OLDPASS = "oldPass"; | 19 | public static String OLDPASS = "oldPass"; |
20 | public static String NEWPASS = "newPass"; | 20 | public static String NEWPASS = "newPass"; |
21 | //提交保卡 | 21 | //提交保卡 |
22 | public static String USEID = "userId"; | 22 | public static String USEID = "userId"; |
23 | public static String CUSTOMENAME = "customerName"; | 23 | public static String CUSTOMENAME = "customerName"; |
24 | public static String CUSTOMADRESS = "customerAddress"; | 24 | public static String CUSTOMADRESS = "customerAddress"; |
25 | public static String BUYADREES = "buyAddress"; | 25 | public static String BUYADREES = "buyAddress"; |
26 | public static String BUYTIME = "buyTime"; | 26 | public static String BUYTIME = "buyTime"; |
27 | public static String ALTERSALECALL = "alterSaleCall"; | 27 | public static String ALTERSALECALL = "alterSaleCall"; |
28 | public static String PRODUCTMODEL = "productModel"; | 28 | public static String PRODUCTMODEL = "productModel"; |
29 | public static String DEVICENUMBER = "deviceNumber"; | 29 | public static String DEVICENUMBER = "deviceNumber"; |
30 | public static String MACADRESS = "macAddress"; | 30 | public static String MACADRESS = "macAddress"; |
31 | public static String MOBILPHONE = "customerPhone"; | 31 | public static String MOBILPHONE = "customerPhone"; |
32 | public static String SALESMANID = "salesmanId"; | ||
32 | //提交子账户信息 | 33 | //提交子账户信息 |
33 | public static String PARENTID = "parentId"; | 34 | public static String PARENTID = "parentId"; |
34 | public static String IMAGE = "image"; | 35 | public static String IMAGE = "image"; |
35 | public static String NAME = "name"; | 36 | public static String NAME = "name"; |
36 | public static String GRADE = "gradeId"; | 37 | public static String GRADE = "gradeId"; |
37 | public static String SCHOOL = "schoolId"; | 38 | public static String SCHOOL = "schoolId"; |
38 | public static String REGION = "regionId"; | 39 | public static String REGION = "regionId"; |
39 | public static String DEVINUMBER = "deviceNumber"; | 40 | public static String DEVINUMBER = "deviceNumber"; |
40 | public static String REGIONNAME = "regionName"; | 41 | public static String REGIONNAME = "regionName"; |
41 | public static String ADDDRESS = "address"; | 42 | public static String ADDDRESS = "address"; |
43 | public static String REALNAME = "realName"; | ||
42 | //提交个人信息 | 44 | //提交个人信息 |
43 | public static String ID = "id"; | 45 | public static String ID = "id"; |
44 | public static String BIRDays = "birthday"; | 46 | public static String BIRDays = "birthday"; |
45 | public static String QQ = "qq"; | 47 | public static String QQ = "qq"; |
46 | public static String GENDER = "gender"; | 48 | public static String GENDER = "gender"; |
47 | //版本信息 | 49 | //版本信息 |
48 | public static String CHINESE = "chinese"; | 50 | public static String CHINESE = "chinese"; |
49 | public static String MATH = "math"; | 51 | public static String MATH = "math"; |
50 | public static String ENGLISH = "english"; | 52 | public static String ENGLISH = "english"; |
51 | public static String PHYSICES = "physics"; | 53 | public static String PHYSICES = "physics"; |
52 | public static String CHEMISTRY = "chemistry"; | 54 | public static String CHEMISTRY = "chemistry"; |
53 | public static String HISTIRY = "history"; | 55 | public static String HISTIRY = "history"; |
54 | public static String GEOGRAPHY = "geography"; | 56 | public static String GEOGRAPHY = "geography"; |
55 | public static String POLITICAL = "political"; | 57 | public static String POLITICAL = "political"; |
56 | public static String BIOLOGY = "biology"; | 58 | public static String BIOLOGY = "biology"; |
57 | public static String SCIENCE = "science"; | 59 | public static String SCIENCE = "science"; |
58 | 60 | ||
59 | 61 | ||
60 | 62 | ||
61 | 63 | ||
62 | 64 | ||
63 | 65 | ||
64 | 66 | ||
65 | 67 | ||
66 | 68 | ||
67 | } | 69 | } |
68 | 70 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.app.ProgressDialog; | 4 | import android.app.ProgressDialog; |
5 | import android.content.Context; | 5 | import android.content.Context; |
6 | import android.content.Intent; | 6 | import android.content.Intent; |
7 | import android.os.Build; | ||
7 | import android.os.Build; | 8 | import android.os.Handler; |
8 | import android.os.Handler; | 9 | import android.os.Message; |
9 | import android.os.Message; | 10 | import android.support.v4.app.FragmentActivity; |
10 | import android.support.v4.app.FragmentActivity; | 11 | import android.util.Log; |
11 | import android.util.Log; | 12 | import android.view.KeyEvent; |
12 | import android.view.KeyEvent; | 13 | import android.widget.Toast; |
13 | import android.widget.Toast; | 14 | |
14 | 15 | import com.google.gson.Gson; | |
15 | import com.google.gson.Gson; | 16 | import com.google.gson.reflect.TypeToken; |
16 | import com.google.gson.reflect.TypeToken; | 17 | import com.hjx.personalcenter.R; |
17 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.activity.BangDingCode; |
18 | import com.hjx.personalcenter.activity.BangDingCode; | 19 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
19 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 20 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
20 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 21 | import com.hjx.personalcenter.customdialog.IllegalDialog; |
21 | import com.hjx.personalcenter.customdialog.IllegalDialog; | 22 | import com.hjx.personalcenter.db.Content; |
22 | import com.hjx.personalcenter.db.Content; | 23 | import com.hjx.personalcenter.db.SaveParam; |
23 | import com.hjx.personalcenter.db.SaveParam; | 24 | import com.hjx.personalcenter.gson.GsonTool; |
24 | import com.hjx.personalcenter.gson.GsonTool; | 25 | import com.hjx.personalcenter.model.AppVersion; |
25 | import com.hjx.personalcenter.model.AppVersion; | 26 | import com.hjx.personalcenter.model.CardInfo; |
26 | import com.hjx.personalcenter.model.CardInfo; | 27 | import com.hjx.personalcenter.model.ChildsInfo; |
27 | import com.hjx.personalcenter.model.ChildsInfo; | 28 | import com.hjx.personalcenter.model.CityInfo; |
28 | import com.hjx.personalcenter.model.CityInfo; | 29 | import com.hjx.personalcenter.model.CountyInfo; |
29 | import com.hjx.personalcenter.model.CountyInfo; | 30 | import com.hjx.personalcenter.model.DefautPublishInfo; |
30 | import com.hjx.personalcenter.model.DefautPublishInfo; | 31 | import com.hjx.personalcenter.model.GradeInfo; |
31 | import com.hjx.personalcenter.model.GradeInfo; | 32 | import com.hjx.personalcenter.model.PesonalInfo; |
32 | import com.hjx.personalcenter.model.PesonalInfo; | 33 | import com.hjx.personalcenter.model.ProvinceInfo; |
33 | import com.hjx.personalcenter.model.ProvinceInfo; | 34 | import com.hjx.personalcenter.model.SchoolInfo; |
34 | import com.hjx.personalcenter.model.SchoolInfo; | 35 | import com.hjx.personalcenter.model.SignInfo; |
35 | import com.hjx.personalcenter.model.SignInfo; | 36 | import com.hjx.personalcenter.model.VersionInfo; |
36 | import com.hjx.personalcenter.model.VersionInfo; | 37 | import com.hjx.personalcenter.model.VideoInfo; |
37 | import com.hjx.personalcenter.model.VideoInfo; | 38 | import com.hjx.personalcenter.util.AlertUtils; |
38 | import com.hjx.personalcenter.util.AlertUtils; | 39 | import com.hjx.personalcenter.util.DialogPermission; |
40 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
39 | import com.hjx.personalcenter.util.DialogPermission; | 41 | import com.loopj.android.http.AsyncHttpResponseHandler; |
40 | import com.hjx.personalcenter.util.GetDevicesUtil; | 42 | import com.loopj.android.http.JsonHttpResponseHandler; |
41 | import com.loopj.android.http.AsyncHttpResponseHandler; | 43 | import com.loopj.android.http.RequestParams; |
42 | import com.loopj.android.http.JsonHttpResponseHandler; | 44 | |
43 | import com.loopj.android.http.RequestParams; | 45 | import org.apache.http.Header; |
44 | 46 | import org.apache.http.entity.ByteArrayEntity; | |
45 | import org.apache.http.Header; | 47 | import org.apache.http.message.BasicHeader; |
46 | import org.apache.http.entity.ByteArrayEntity; | 48 | import org.apache.http.protocol.HTTP; |
47 | import org.apache.http.message.BasicHeader; | 49 | import org.json.JSONException; |
48 | import org.apache.http.protocol.HTTP; | 50 | import org.json.JSONObject; |
49 | import org.json.JSONException; | 51 | |
50 | import org.json.JSONObject; | 52 | import java.io.File; |
51 | 53 | import java.io.FileNotFoundException; | |
52 | import java.io.File; | 54 | import java.io.UnsupportedEncodingException; |
53 | import java.io.FileNotFoundException; | 55 | import java.util.ArrayList; |
54 | import java.io.UnsupportedEncodingException; | 56 | import java.util.List; |
55 | import java.util.ArrayList; | 57 | |
56 | import java.util.List; | 58 | public class HttpManager { |
57 | 59 | private static HttpManager instance; | |
58 | public class HttpManager { | 60 | private ProgressDialog mProgress = null; |
59 | private static HttpManager instance; | 61 | |
60 | private ProgressDialog mProgress = null; | 62 | public static HttpManager getInstance() { |
61 | 63 | if (instance == null) { | |
62 | public static HttpManager getInstance() { | 64 | instance = new HttpManager(); |
63 | if (instance == null) { | 65 | } |
64 | instance = new HttpManager(); | 66 | return instance; |
65 | } | 67 | } |
66 | return instance; | 68 | |
67 | } | 69 | |
68 | 70 | //登录接口 | |
69 | 71 | ||
70 | //登录接口 | 72 | public void login(final String username, final String password, final Context mContext, final Handler handler) { |
71 | 73 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | |
72 | public void login(final String username, final String password, final Context mContext, final Handler handler) { | 74 | true, true, null); |
73 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 75 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
76 | HttpClient.getInstance().addHeader("device-number", Build.SERIAL); | ||
74 | true, true, null); | 77 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
75 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 78 | @Override |
76 | HttpClient.getInstance().addHeader("device-number", Build.SERIAL); | 79 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
77 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 80 | closeProgress(); |
78 | @Override | 81 | Message msg = Message.obtain(); |
79 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 82 | msg.what = HttpCode.LOGIN_SUCESS; |
80 | closeProgress(); | 83 | msg.obj = new String(arg2); |
81 | Message msg = Message.obtain(); | 84 | handler.sendMessage(msg); |
82 | msg.what = HttpCode.LOGIN_SUCESS; | 85 | |
83 | msg.obj = new String(arg2); | 86 | |
84 | handler.sendMessage(msg); | 87 | } |
85 | 88 | ||
86 | 89 | @Override | |
87 | } | 90 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
88 | 91 | closeProgress(); | |
89 | @Override | 92 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
90 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 93 | } |
91 | closeProgress(); | 94 | }); |
92 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 95 | } |
93 | } | 96 | |
94 | }); | 97 | //注册接口 |
95 | } | 98 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
96 | 99 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | |
97 | //注册接口 | 100 | false, true, null); |
98 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 101 | JSONObject jsonObject = new JSONObject(); |
99 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 102 | ByteArrayEntity entity = null; |
100 | false, true, null); | 103 | try { |
101 | JSONObject jsonObject = new JSONObject(); | 104 | jsonObject.put(HttpKey.USERNAME, username); |
102 | ByteArrayEntity entity = null; | 105 | jsonObject.put(HttpKey.PASSWORD, password); |
103 | try { | 106 | jsonObject.put(HttpKey.SMSCODE, smscode); |
104 | jsonObject.put(HttpKey.USERNAME, username); | 107 | jsonObject.put(HttpKey.SOURCE, source); |
105 | jsonObject.put(HttpKey.PASSWORD, password); | 108 | Log.e("test", "jsonObject" + jsonObject); |
106 | jsonObject.put(HttpKey.SMSCODE, smscode); | 109 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
107 | jsonObject.put(HttpKey.SOURCE, source); | 110 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
108 | Log.e("test", "jsonObject" + jsonObject); | 111 | } catch (JSONException e) { |
109 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 112 | e.printStackTrace(); |
110 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 113 | } catch (UnsupportedEncodingException e) { |
111 | } catch (JSONException e) { | 114 | e.printStackTrace(); |
112 | e.printStackTrace(); | 115 | } |
113 | } catch (UnsupportedEncodingException e) { | 116 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
114 | e.printStackTrace(); | 117 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
115 | } | 118 | @Override |
116 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 119 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
117 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 120 | super.onSuccess(statusCode, headers, response); |
118 | @Override | 121 | closeProgress(); |
119 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 122 | Log.e("test", "onSuccess" + response); |
120 | super.onSuccess(statusCode, headers, response); | 123 | Message msg = Message.obtain(); |
121 | closeProgress(); | 124 | msg.what = HttpCode.REGISTERED_SUCESS; |
122 | Log.e("test", "onSuccess" + response); | 125 | msg.obj = response; |
123 | Message msg = Message.obtain(); | 126 | handler.sendMessage(msg); |
124 | msg.what = HttpCode.REGISTERED_SUCESS; | 127 | |
125 | msg.obj = response; | 128 | } |
126 | handler.sendMessage(msg); | 129 | |
127 | 130 | @Override | |
128 | } | 131 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
129 | 132 | super.onFailure(statusCode, headers, throwable, errorResponse); | |
130 | @Override | 133 | closeProgress(); |
131 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 134 | Log.e("test", "onFailure" + errorResponse); |
132 | super.onFailure(statusCode, headers, throwable, errorResponse); | 135 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
133 | closeProgress(); | 136 | } |
134 | Log.e("test", "onFailure" + errorResponse); | 137 | |
135 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 138 | }); |
136 | } | 139 | } |
137 | 140 | ||
138 | }); | 141 | //注册验证码 |
139 | } | 142 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
140 | 143 | RequestParams params = new RequestParams(); | |
141 | //注册验证码 | 144 | params.put(HttpKey.TYPE, type); |
142 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 145 | params.put(HttpKey.MOBIL, mobile); |
143 | RequestParams params = new RequestParams(); | 146 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
144 | params.put(HttpKey.TYPE, type); | 147 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
145 | params.put(HttpKey.MOBIL, mobile); | 148 | |
146 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 149 | @Override |
147 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 150 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
148 | 151 | Log.e("test", "onSuccess-----" + response); | |
149 | @Override | 152 | Message msg = Message.obtain(); |
150 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 153 | msg.what = HttpCode.AUTHCODE_SUCESS; |
151 | Log.e("test", "onSuccess-----" + response); | 154 | msg.obj = response; |
152 | Message msg = Message.obtain(); | 155 | handler.sendMessage(msg); |
153 | msg.what = HttpCode.AUTHCODE_SUCESS; | 156 | } |
154 | msg.obj = response; | 157 | |
155 | handler.sendMessage(msg); | 158 | @Override |
156 | } | 159 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
157 | 160 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
158 | @Override | 161 | } |
159 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 162 | }); |
160 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 163 | } |
161 | } | 164 | |
162 | }); | 165 | |
163 | } | 166 | //手机号是否注册 |
164 | 167 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | |
165 | 168 | RequestParams params = new RequestParams(); | |
166 | //手机号是否注册 | 169 | params.put(HttpKey.USERNAME, mobile); |
167 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 170 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
168 | RequestParams params = new RequestParams(); | 171 | @Override |
169 | params.put(HttpKey.USERNAME, mobile); | 172 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
170 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 173 | Log.e("test", "isregistered" + response.toString()); |
171 | @Override | 174 | Message msg = Message.obtain(); |
172 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 175 | msg.what = HttpCode.IS_REFISTER; |
173 | Log.e("test", "isregistered" + response.toString()); | 176 | msg.obj = response; |
174 | Message msg = Message.obtain(); | 177 | handler.sendMessage(msg); |
175 | msg.what = HttpCode.IS_REFISTER; | 178 | |
176 | msg.obj = response; | 179 | } |
177 | handler.sendMessage(msg); | 180 | |
178 | 181 | @Override | |
179 | } | 182 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
180 | 183 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
181 | @Override | 184 | |
182 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 185 | } |
183 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 186 | }); |
184 | 187 | } | |
185 | } | 188 | |
186 | }); | 189 | //修改密码 |
187 | } | 190 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
188 | 191 | mProgress = DialogPermission.showProgress(context, null, "正在修改密码...", | |
189 | //修改密码 | 192 | false, true, null); |
190 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 193 | RequestParams params = new RequestParams(); |
191 | mProgress = DialogPermission.showProgress(context, null, "正在修改密码...", | 194 | params.put(HttpKey.USERNAME, username); |
192 | false, true, null); | 195 | params.put(HttpKey.OLDPASS, old_pwd1); |
193 | RequestParams params = new RequestParams(); | 196 | params.put(HttpKey.NEWPASS, newpassword3); |
194 | params.put(HttpKey.USERNAME, username); | 197 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
195 | params.put(HttpKey.OLDPASS, old_pwd1); | 198 | HttpClient.getInstance().setTimeout(10 * 1000); |
196 | params.put(HttpKey.NEWPASS, newpassword3); | 199 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
197 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 200 | @Override |
198 | HttpClient.getInstance().setTimeout(10 * 1000); | 201 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
199 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 202 | closeProgress(); |
200 | @Override | 203 | try { |
201 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 204 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
202 | closeProgress(); | 205 | String status = jsonObject.optString("status"); |
203 | try { | 206 | if (status.equals("100")) { |
204 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 207 | // Log.e("test", "onSuccess" + new String(bytes)); |
205 | String status = jsonObject.optString("status"); | 208 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
206 | if (status.equals("100")) { | 209 | SaveParam.getInstance().clearData((Activity) context); |
207 | // Log.e("test", "onSuccess" + new String(bytes)); | 210 | Intent intent = new Intent(); |
208 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 211 | intent.setClass(context, LoginAndRegisterActivity.class); |
209 | SaveParam.getInstance().clearData((Activity) context); | 212 | ((Activity) context).startActivity(intent); |
210 | Intent intent = new Intent(); | 213 | ((Activity) context).finish(); |
211 | intent.setClass(context, LoginAndRegisterActivity.class); | 214 | } else { |
212 | ((Activity) context).startActivity(intent); | 215 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
213 | ((Activity) context).finish(); | 216 | } |
214 | } else { | 217 | } catch (JSONException e) { |
215 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 218 | e.printStackTrace(); |
216 | } | 219 | } |
217 | } catch (JSONException e) { | 220 | } |
218 | e.printStackTrace(); | 221 | |
219 | } | 222 | @Override |
220 | } | 223 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
221 | 224 | closeProgress(); | |
222 | @Override | 225 | // Log.e("test", "onFailure" + new String(bytes)); |
223 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 226 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
224 | closeProgress(); | 227 | } |
225 | // Log.e("test", "onFailure" + new String(bytes)); | 228 | }); |
226 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 229 | |
227 | } | 230 | } |
228 | }); | 231 | |
229 | 232 | //忘记密码 | |
230 | } | 233 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
231 | 234 | RequestParams params = new RequestParams(); | |
232 | //忘记密码 | 235 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
233 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 236 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
234 | RequestParams params = new RequestParams(); | 237 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
235 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 238 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
236 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 239 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
237 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 240 | @Override |
238 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 241 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
239 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 242 | try { |
240 | @Override | 243 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
241 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 244 | String status = jsonObject.optString("status"); |
242 | try { | 245 | if (status.equals("100")) { |
243 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 246 | // Log.e("test", "onSuccess" + new String(bytes)); |
244 | String status = jsonObject.optString("status"); | 247 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
245 | if (status.equals("100")) { | 248 | ((Activity) context).finish(); |
246 | // Log.e("test", "onSuccess" + new String(bytes)); | 249 | } else { |
247 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 250 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
248 | ((Activity) context).finish(); | 251 | } |
249 | } else { | 252 | } catch (JSONException e) { |
250 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 253 | e.printStackTrace(); |
251 | } | 254 | } |
252 | } catch (JSONException e) { | 255 | } |
253 | e.printStackTrace(); | 256 | |
254 | } | 257 | @Override |
255 | } | 258 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
256 | 259 | // Log.e("test", "onFailure" + new String(bytes)); | |
257 | @Override | 260 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
258 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 261 | } |
259 | // Log.e("test", "onFailure" + new String(bytes)); | 262 | }); |
260 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 263 | |
261 | } | 264 | } |
262 | }); | 265 | |
263 | 266 | //保存用户登录信息 | |
264 | } | 267 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { |
265 | 268 | SaveParam.getInstance().saveLoginParam(context, "username", username); | |
266 | //保存用户登录信息 | 269 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
267 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { | 270 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
268 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 271 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
269 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 272 | |
270 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 273 | |
271 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 274 | } |
272 | 275 | ||
276 | |||
277 | //营业员是否已在数据库注册 | ||
278 | public void checkSalesmanPhone(final Context mContext, String phone, final Handler handler) { | ||
279 | mProgress = DialogPermission.showProgress(mContext, null, "正在加载...", | ||
280 | false, true, null); | ||
281 | HttpClient.getInstance().setTimeout(5 * 1000); | ||
282 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | ||
283 | HttpClient.getInstance().get(HttpUrl.getSalesInfo + "?salesmanPhone=" + phone, new AsyncHttpResponseHandler() { | ||
284 | @Override | ||
285 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | ||
286 | closeProgress(); | ||
287 | try { | ||
288 | JSONObject jsonObject = new JSONObject(new String(arg2)); | ||
289 | int status = jsonObject.optInt("status"); | ||
290 | JSONObject dataObj = jsonObject.getJSONObject("data"); | ||
291 | Message msg = Message.obtain(); | ||
292 | if (status == 1 && dataObj != null) { | ||
293 | msg.what = HttpCode.SUCHCARDINFO; | ||
294 | msg.obj = dataObj.getString("salesmanId"); | ||
295 | handler.sendMessage(msg); | ||
296 | } else { | ||
297 | msg.what = HttpCode.NO_SALES_MAN; | ||
298 | handler.sendMessage(msg); | ||
299 | |||
300 | } | ||
301 | } catch (JSONException e) { | ||
302 | e.printStackTrace(); | ||
303 | } | ||
304 | |||
305 | } | ||
306 | |||
307 | @Override | ||
308 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | ||
309 | closeProgress(); | ||
310 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | ||
311 | } | ||
312 | }); | ||
313 | } | ||
314 | |||
273 | 315 | //提交保卡信息 | |
274 | } | 316 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
275 | 317 | String buyAddress, String alterSaleCall, | |
276 | //提交保卡信息 | 318 | String productModel, String deviceNumber, String macAddress, |
277 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 319 | final String mobilePhone, String regionId, String salesId) { |
278 | String buyAddress, String buyTime, String alterSaleCall, | 320 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
279 | String productModel, String deviceNumber, String macAddress, | 321 | false, true, null); |
280 | String mobilePhone) { | 322 | RequestParams params = new RequestParams(); |
281 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 323 | |
282 | false, true, null); | 324 | params.put(HttpKey.USEID, userId); |
283 | RequestParams params = new RequestParams(); | 325 | params.put(HttpKey.CUSTOMENAME, customerName); |
284 | 326 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | |
285 | params.put(HttpKey.USEID, userId); | 327 | params.put(HttpKey.BUYADREES, buyAddress); |
286 | params.put(HttpKey.CUSTOMENAME, customerName); | 328 | // params.put(HttpKey.BUYTIME, buyTime); |
287 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 329 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
288 | params.put(HttpKey.BUYADREES, buyAddress); | 330 | params.put(HttpKey.PRODUCTMODEL, productModel); |
289 | params.put(HttpKey.BUYTIME, buyTime); | 331 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
290 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 332 | params.put(HttpKey.MACADRESS, macAddress); |
291 | params.put(HttpKey.PRODUCTMODEL, productModel); | 333 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
334 | params.put(HttpKey.REGION, regionId); | ||
335 | if (salesId != null && !salesId.isEmpty()) { | ||
336 | params.put(HttpKey.SALESMANID, salesId); | ||
337 | } | ||
292 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 338 | |
293 | params.put(HttpKey.MACADRESS, macAddress); | 339 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
294 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 340 | |
295 | 341 | Log.e("test", "params" + params); | |
296 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 342 | HttpClient.getInstance().setTimeout(5 * 1000); |
297 | 343 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | |
298 | Log.e("test", "params" + params); | 344 | @Override |
299 | HttpClient.getInstance().setTimeout(5 * 1000); | 345 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
300 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 346 | JSONObject jsonObject = null; |
301 | @Override | 347 | closeProgress(); |
302 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 348 | try { |
303 | JSONObject jsonObject = null; | 349 | jsonObject = new JSONObject(new String(bytes)); |
304 | closeProgress(); | 350 | String status = jsonObject.optString("status"); |
305 | try { | 351 | if (status.equals("1")) { |
306 | jsonObject = new JSONObject(new String(bytes)); | 352 | Log.e("test", "onSuccess" + jsonObject); |
307 | String status = jsonObject.optString("status"); | 353 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
354 | SaveParam.getInstance().saveCustomizeParam(context, SaveParam.CARDPHONE, mobilePhone); | ||
308 | if (status.equals("1")) { | 355 | if (Content.cardintentflag == 1) { |
309 | Log.e("test", "onSuccess" + jsonObject); | 356 | Intent intent = new Intent(); |
310 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 357 | intent.setClass((Activity) context, TheStartPageActivity.class); |
311 | if (Content.cardintentflag == 1) { | 358 | ((Activity) context).startActivity(intent); |
312 | Intent intent = new Intent(); | 359 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
313 | intent.setClass((Activity) context, TheStartPageActivity.class); | 360 | ((Activity) context).finish(); |
314 | ((Activity) context).startActivity(intent); | 361 | } else if (Content.cardintentflag == 2) { |
315 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 362 | Intent intent = new Intent(); |
316 | ((Activity) context).finish(); | 363 | intent.setClass((Activity) context, BangDingCode.class); |
317 | } else if (Content.cardintentflag == 2) { | 364 | ((Activity) context).startActivity(intent); |
318 | Intent intent = new Intent(); | 365 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
319 | intent.setClass((Activity) context, BangDingCode.class); | 366 | ((Activity) context).finish(); |
320 | ((Activity) context).startActivity(intent); | 367 | |
321 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 368 | } |
322 | ((Activity) context).finish(); | 369 | |
323 | 370 | ||
324 | } | 371 | } else if (status.equals("2003")) { |
325 | 372 | IllegalDialog.getInstance().show(((FragmentActivity) context).getSupportFragmentManager(), "feifa"); | |
326 | 373 | ||
327 | } else if (status.equals("2003")){ | 374 | } else { |
328 | IllegalDialog.getInstance().show(((FragmentActivity) context).getSupportFragmentManager(),"feifa"); | 375 | SaveParam.getInstance().saveCustomizeParam((FragmentActivity) context, SaveParam.CARDPHONE, ""); |
329 | 376 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | |
330 | }else { | 377 | } |
331 | SaveParam.getInstance().saveCustomizeParam((FragmentActivity) context,SaveParam.CARDPHONE,""); | 378 | } catch (JSONException e) { |
332 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 379 | e.printStackTrace(); |
333 | } | 380 | } |
334 | } catch (JSONException e) { | 381 | |
335 | e.printStackTrace(); | 382 | |
336 | } | 383 | } |
337 | 384 | ||
338 | 385 | @Override | |
339 | } | 386 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
340 | 387 | Log.e("test", "onFailure" + (throwable)); | |
341 | @Override | 388 | closeProgress(); |
342 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 389 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
343 | Log.e("test", "onFailure" + (throwable)); | 390 | |
344 | closeProgress(); | 391 | } |
345 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 392 | }); |
346 | 393 | ||
347 | } | 394 | } |
348 | }); | 395 | |
349 | 396 | //获取保卡信息 | |
350 | } | 397 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { |
351 | 398 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | |
352 | //获取保卡信息 | 399 | false, true, null); |
353 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { | 400 | HttpClient.getInstance().setTimeout(5 * 1000); |
354 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 401 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
355 | false, true, null); | 402 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
356 | HttpClient.getInstance().setTimeout(5 * 1000); | 403 | @Override |
357 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 404 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
358 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 405 | closeProgress(); |
359 | @Override | 406 | // Log.e("test", "保卡信息" + new String(arg2)); |
360 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 407 | try { |
361 | closeProgress(); | 408 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
362 | // Log.e("test", "保卡信息" + new String(arg2)); | 409 | int status = jsonObject.optInt("status"); |
363 | try { | 410 | if (status == 1) { |
364 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 411 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
365 | int status = jsonObject.optInt("status"); | 412 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
366 | if (status == 1) { | 413 | Message msg = Message.obtain(); |
367 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 414 | msg.what = HttpCode.SUCHCARDINFO; |
368 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 415 | msg.obj = schoolInfoBeanList; |
369 | Message msg = Message.obtain(); | 416 | handler.sendMessage(msg); |
370 | msg.what = HttpCode.SUCHCARDINFO; | 417 | |
371 | msg.obj = schoolInfoBeanList; | 418 | |
372 | handler.sendMessage(msg); | 419 | } else { |
373 | 420 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
374 | 421 | ||
375 | } else { | 422 | } |
376 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 423 | } catch (JSONException e) { |
377 | 424 | e.printStackTrace(); | |
378 | } | 425 | } |
379 | } catch (JSONException e) { | 426 | |
380 | e.printStackTrace(); | 427 | } |
381 | } | 428 | |
382 | 429 | @Override | |
383 | } | 430 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
384 | 431 | closeProgress(); | |
385 | @Override | 432 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
386 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 433 | } |
387 | closeProgress(); | 434 | }); |
388 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 435 | } |
389 | } | 436 | |
390 | }); | 437 | //获取是否为样机信息 |
391 | } | 438 | public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { |
392 | 439 | HttpClient.getInstance().setTimeout(5 * 1000); | |
393 | //获取是否为样机信息 | 440 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
394 | public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { | 441 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
395 | HttpClient.getInstance().setTimeout(5 * 1000); | 442 | @Override |
396 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 443 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
397 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 444 | closeProgress(); |
398 | @Override | 445 | // Log.e("test", "保卡信息" + new String(arg2)); |
399 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 446 | Message msg = Message.obtain(); |
400 | closeProgress(); | 447 | msg.what = HttpCode.SUCHCARDINFOONE; |
401 | // Log.e("test", "保卡信息" + new String(arg2)); | 448 | msg.obj = new String(arg2); |
402 | Message msg = Message.obtain(); | 449 | handler.sendMessage(msg); |
403 | msg.what = HttpCode.SUCHCARDINFOONE; | 450 | |
404 | msg.obj = new String(arg2); | 451 | } |
405 | handler.sendMessage(msg); | 452 | |
406 | 453 | @Override | |
407 | } | 454 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
408 | 455 | closeProgress(); | |
409 | @Override | 456 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
410 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 457 | } |
411 | closeProgress(); | 458 | }); |
412 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 459 | } |
413 | } | 460 | |
461 | //验证注册激活码 | ||
462 | public void submitEcard(final Context mContext, String deviceNumber, String activationCode, final Handler handler) { | ||
463 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证注册激活码...", | ||
464 | false, true, null); | ||
465 | HttpClient.getInstance().setTimeout(5 * 1000); | ||
466 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | ||
467 | HttpClient.getInstance().get(HttpUrl.submitEcardURL + "?deviceNumber=" + deviceNumber + "&code=" + activationCode, new AsyncHttpResponseHandler() { | ||
468 | @Override | ||
469 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | ||
470 | closeProgress(); | ||
471 | // Log.e("test", "保卡信息" + new String(arg2)); | ||
472 | Message msg = Message.obtain(); | ||
473 | msg.what = HttpCode.ACTIVATION_SUCCESS; | ||
474 | try { | ||
475 | msg.obj = new JSONObject(new String(arg2)); | ||
476 | } catch (JSONException e) { | ||
477 | e.printStackTrace(); | ||
478 | } | ||
479 | handler.sendMessage(msg); | ||
480 | |||
481 | } | ||
482 | |||
483 | @Override | ||
484 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | ||
485 | closeProgress(); | ||
486 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | ||
487 | } | ||
488 | }); | ||
489 | } | ||
490 | |||
414 | }); | 491 | //修改账户电话 |
415 | } | 492 | public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { |
416 | 493 | RequestParams params = new RequestParams(); | |
417 | //修改账户电话 | 494 | params.put("userId", userId); |
418 | public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { | 495 | params.put("username", username); |
419 | RequestParams params = new RequestParams(); | 496 | params.put("authCode", authCode); |
420 | params.put("userId", userId); | 497 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
421 | params.put("username", username); | 498 | HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { |
422 | params.put("authCode", authCode); | 499 | @Override |
423 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 500 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
424 | HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { | 501 | try { |
425 | @Override | 502 | // Log.e("test", "保卡信息" + new String(bytes)); |
426 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 503 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
427 | try { | 504 | String status = jsonObject.optString("status"); |
428 | // Log.e("test", "保卡信息" + new String(bytes)); | 505 | if (status.equals("1")) { |
429 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 506 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
430 | String status = jsonObject.optString("status"); | 507 | SaveParam.getInstance().saveLoginParam(mContext, "username", username); |
431 | if (status.equals("1")) { | 508 | ((Activity) mContext).finish(); |
432 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 509 | } else if (status.equals("1001")) { |
433 | SaveParam.getInstance().saveLoginParam(mContext, "username", username); | 510 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
434 | ((Activity) mContext).finish(); | 511 | } else if (status.equals("1006")) { |
435 | } else if (status.equals("1001")) { | ||
436 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 512 | AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); |
437 | } | 513 | } else { |
438 | else if (status.equals("1006")) { | 514 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
439 | AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); | 515 | } |
440 | } else { | 516 | } catch (JSONException e) { |
441 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 517 | e.printStackTrace(); |
442 | } | 518 | } |
443 | } catch (JSONException e) { | 519 | } |
444 | e.printStackTrace(); | 520 | |
445 | } | 521 | @Override |
446 | } | 522 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
447 | 523 | //Log.e("test", "onFailure" + new String(bytes)); | |
448 | @Override | 524 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
449 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 525 | } |
450 | //Log.e("test", "onFailure" + new String(bytes)); | 526 | }); |
451 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 527 | } |
452 | } | 528 | |
453 | }); | 529 | //修改保卡信息电话 |
454 | } | 530 | public void changecardinfophone(final Context mContext, String userId, final String customerPhone, String authCode) { |
455 | 531 | RequestParams params = new RequestParams(); | |
456 | //修改保卡信息电话 | 532 | params.put("deviceNumber", userId); |
457 | public void changecardinfophone(final Context mContext, String userId, final String customerPhone, String authCode) { | 533 | params.put("customerPhone", customerPhone); |
458 | RequestParams params = new RequestParams(); | 534 | params.put("authCode", authCode); |
459 | params.put("deviceNumber", userId); | 535 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
460 | params.put("customerPhone", customerPhone); | 536 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
461 | params.put("authCode", authCode); | 537 | @Override |
462 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 538 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
463 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 539 | try { |
464 | @Override | 540 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
465 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 541 | String status = jsonObject.optString("status"); |
466 | try { | 542 | if (status.equals("1")) { |
467 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 543 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
468 | String status = jsonObject.optString("status"); | 544 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
469 | if (status.equals("1")) { | 545 | ((Activity) mContext).finish(); |
470 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 546 | } else if (status.equals("1001")) { |
471 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 547 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
472 | ((Activity) mContext).finish(); | 548 | } else { |
473 | } else if (status.equals("1001")) { | 549 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
474 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 550 | } |
475 | } else { | 551 | } catch (JSONException e) { |
476 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 552 | e.printStackTrace(); |
477 | } | 553 | } |
478 | } catch (JSONException e) { | 554 | } |
479 | e.printStackTrace(); | 555 | |
480 | } | 556 | @Override |
481 | } | 557 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
482 | 558 | // Log.e("test", "onFailure" + new String(bytes)); | |
483 | @Override | 559 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
484 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 560 | } |
485 | // Log.e("test", "onFailure" + new String(bytes)); | 561 | }); |
486 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 562 | } |
487 | } | 563 | |
488 | }); | 564 | //修改保卡信息地址 |
489 | } | 565 | public void changecardadressinfo(final Context mContext, String userId, final String customerPhone, String authCode, final String customerAddress) { |
490 | 566 | RequestParams params = new RequestParams(); | |
491 | //修改保卡信息地址 | 567 | params.put("deviceNumber", userId); |
492 | public void changecardadressinfo(final Context mContext, String userId, final String customerPhone, String authCode, final String customerAddress) { | 568 | params.put("customerPhone", customerPhone); |
493 | RequestParams params = new RequestParams(); | 569 | params.put("authCode", authCode); |
494 | params.put("deviceNumber", userId); | 570 | params.put("customerAddress", customerAddress); |
495 | params.put("customerPhone", customerPhone); | 571 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
496 | params.put("authCode", authCode); | 572 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
497 | params.put("customerAddress", customerAddress); | 573 | @Override |
498 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 574 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
499 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 575 | try { |
500 | @Override | 576 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
501 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 577 | String status = jsonObject.optString("status"); |
502 | try { | 578 | if (status.equals("1")) { |
503 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 579 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); |
504 | String status = jsonObject.optString("status"); | 580 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
505 | if (status.equals("1")) { | 581 | ((Activity) mContext).finish(); |
506 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); | 582 | } else if (status.equals("1001")) { |
507 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 583 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
508 | ((Activity) mContext).finish(); | 584 | } else { |
509 | } else if (status.equals("1001")) { | 585 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
510 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 586 | } |
511 | } else { | 587 | } catch (JSONException e) { |
512 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 588 | e.printStackTrace(); |
513 | } | 589 | } |
514 | } catch (JSONException e) { | 590 | } |
515 | e.printStackTrace(); | 591 | |
516 | } | 592 | @Override |
517 | } | 593 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
518 | 594 | // Log.e("test", "onFailure" + new String(bytes)); | |
519 | @Override | 595 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
520 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 596 | } |
521 | // Log.e("test", "onFailure" + new String(bytes)); | 597 | }); |
522 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 598 | } |
523 | } | 599 | |
524 | }); | 600 | //验证是否保卡信息 |
525 | } | 601 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { |
526 | 602 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | |
527 | //验证是否保卡信息 | 603 | false, true, null); |
528 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { | 604 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
529 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 605 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
530 | false, true, null); | 606 | @Override |
531 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 607 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
532 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 608 | // Log.e("test", "验证保卡" + new String(arg2)); |
533 | @Override | 609 | closeProgress(); |
534 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 610 | Message msg = Message.obtain(); |
535 | // Log.e("test", "验证保卡" + new String(arg2)); | 611 | msg.what = HttpCode.CHECKCARD; |
536 | closeProgress(); | 612 | msg.obj = new String(arg2); |
537 | Message msg = Message.obtain(); | 613 | handler.sendMessage(msg); |
538 | msg.what = HttpCode.CHECKCARD; | 614 | |
539 | msg.obj = new String(arg2); | 615 | |
540 | handler.sendMessage(msg); | 616 | } |
541 | 617 | ||
542 | 618 | @Override | |
543 | } | 619 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
544 | 620 | closeProgress(); | |
545 | @Override | 621 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
546 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 622 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
547 | closeProgress(); | 623 | } |
548 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 624 | }); |
549 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 625 | } |
550 | } | 626 | |
551 | }); | 627 | ///获取年级 |
552 | } | 628 | public void getgrade(final Context mContext, final Handler handler) { |
553 | 629 | HttpClient.getInstance().addHeader("Accept", "application/json"); | |
554 | ///获取年级 | 630 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
555 | public void getgrade(final Context mContext, final Handler handler) { | 631 | @Override |
556 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 632 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
557 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 633 | // Log.e("test", "年级" + new String(arg2)); |
558 | @Override | 634 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
559 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 635 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
560 | // Log.e("test", "年级" + new String(arg2)); | 636 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
561 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 637 | String name = gradeInfo.getData().get(i).getName(); |
562 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 638 | int id = gradeInfo.getData().get(i).getId(); |
563 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 639 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
564 | String name = gradeInfo.getData().get(i).getName(); | 640 | for (int j = 0; j < gradeinfoList.size(); j++) { |
565 | int id = gradeInfo.getData().get(i).getId(); | 641 | String secondname = gradeinfoList.get(j).getName(); |
566 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 642 | int secondid = gradeinfoList.get(j).getId(); |
567 | for (int j = 0; j < gradeinfoList.size(); j++) { | 643 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
568 | String secondname = gradeinfoList.get(j).getName(); | 644 | dataBean.setName(secondname); |
569 | int secondid = gradeinfoList.get(j).getId(); | 645 | dataBean.setId(secondid); |
570 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 646 | gradeInfoLists.add(dataBean); |
571 | dataBean.setName(secondname); | 647 | } |
572 | dataBean.setId(secondid); | 648 | |
573 | gradeInfoLists.add(dataBean); | 649 | } |
574 | } | 650 | |
575 | 651 | Message message = Message.obtain(); | |
576 | } | 652 | message.what = HttpCode.GRADER; |
577 | 653 | message.obj = gradeInfoLists; | |
578 | Message message = Message.obtain(); | 654 | handler.sendMessage(message); |
579 | message.what = HttpCode.GRADER; | 655 | |
580 | message.obj = gradeInfoLists; | 656 | |
581 | handler.sendMessage(message); | 657 | } |
582 | 658 | ||
583 | 659 | @Override | |
584 | } | 660 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
585 | 661 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
586 | @Override | 662 | } |
587 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 663 | }); |
588 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 664 | } |
589 | } | 665 | |
590 | }); | 666 | /** |
591 | } | 667 | * 获取学校 |
592 | 668 | * | |
593 | /** | 669 | * @param mContext |
594 | * 获取学校 | 670 | * @param regionId |
595 | * | 671 | * @param gradeId |
596 | * @param mContext | 672 | * @param handler |
597 | * @param regionId | 673 | */ |
598 | * @param gradeId | 674 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
599 | * @param handler | 675 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
600 | */ | 676 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
601 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 677 | @Override |
602 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 678 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
603 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 679 | // Log.e("test", "学校" + new String(arg2)); |
604 | @Override | 680 | try { |
605 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 681 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
606 | // Log.e("test", "学校" + new String(arg2)); | 682 | int status = jsonObject.optInt("status"); |
607 | try { | 683 | if (status == 1) { |
608 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 684 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
609 | int status = jsonObject.optInt("status"); | 685 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
610 | if (status == 1) { | 686 | Message message = Message.obtain(); |
611 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 687 | message.what = HttpCode.SCHOOL; |
612 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 688 | message.obj = schoolInfoBeanList; |
613 | Message message = Message.obtain(); | 689 | handler.sendMessage(message); |
614 | message.what = HttpCode.SCHOOL; | 690 | |
615 | message.obj = schoolInfoBeanList; | 691 | |
616 | handler.sendMessage(message); | 692 | } else { |
617 | 693 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
618 | 694 | ||
619 | } else { | 695 | } |
620 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 696 | } catch (JSONException e) { |
621 | 697 | e.printStackTrace(); | |
622 | } | 698 | } |
623 | } catch (JSONException e) { | 699 | |
624 | e.printStackTrace(); | 700 | } |
625 | } | 701 | |
626 | 702 | @Override | |
627 | } | 703 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
628 | 704 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
629 | @Override | 705 | } |
630 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 706 | }); |
631 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 707 | } |
632 | } | 708 | |
633 | }); | 709 | |
634 | } | 710 | /** |
635 | 711 | * 获取个人信息 | |
636 | 712 | * | |
637 | /** | 713 | * @param mContext |
638 | * 获取个人信息 | 714 | * @param userId |
639 | * | 715 | * @param handler |
640 | * @param mContext | 716 | */ |
641 | * @param userId | 717 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
642 | * @param handler | 718 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
643 | */ | 719 | // false, true, null); |
644 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { | 720 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
645 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 721 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
646 | // false, true, null); | 722 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
647 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 723 | @Override |
648 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 724 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
649 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 725 | closeProgress(); |
650 | @Override | 726 | Log.e("test", "个人信息" + new String(arg2)); |
651 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 727 | try { |
652 | closeProgress(); | 728 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
653 | Log.e("test", "个人信息" + new String(arg2)); | 729 | int status = jsonObject.optInt("status"); |
730 | Message message = Message.obtain(); | ||
654 | try { | 731 | if (status == 1) { |
655 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 732 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
656 | int status = jsonObject.optInt("status"); | 733 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
657 | Message message = Message.obtain(); | ||
658 | if (status == 1) { | 734 | message.what = HttpCode.GETINFO; |
659 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 735 | message.obj = pesonalInfoBeanList; |
660 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 736 | handler.sendMessage(message); |
661 | message.what = HttpCode.GETINFO; | 737 | } else if (status == 1011) { |
662 | message.obj = pesonalInfoBeanList; | 738 | message.what = HttpCode.RELOGIN; |
739 | handler.sendMessage(message); | ||
663 | handler.sendMessage(message); | 740 | } else { |
664 | } else if (status == 1011){ | 741 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
665 | message.what = HttpCode.RELOGIN; | 742 | |
666 | handler.sendMessage(message); | 743 | } |
667 | }else { | 744 | } catch (JSONException e) { |
668 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 745 | e.printStackTrace(); |
669 | 746 | } | |
670 | } | 747 | |
671 | } catch (JSONException e) { | 748 | |
672 | e.printStackTrace(); | 749 | } |
673 | } | 750 | |
674 | 751 | @Override | |
675 | 752 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
676 | } | 753 | closeProgress(); |
677 | 754 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
678 | @Override | 755 | } |
679 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 756 | }); |
680 | closeProgress(); | 757 | } |
681 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 758 | |
682 | } | 759 | //修改个人信息 |
683 | }); | 760 | public void changepresonalinfo(final Context mContext, Long id, int type |
684 | } | 761 | , String name, String birthday, final int gradeId, long regionId, |
685 | 762 | Object schoolId, String qq, String gender | |
686 | //修改个人信息 | 763 | , String regionName, String address, String devicenumber, final Handler handler) throws UnsupportedEncodingException { |
687 | public void changepresonalinfo(final Context mContext, Long id, int type | 764 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
688 | , String name, String birthday, final int gradeId, long regionId, | 765 | false, true, null); |
689 | Object schoolId, String qq, String gender | 766 | RequestParams params = new RequestParams(); |
690 | , String regionName, String address, String devicenumber, final Handler handler) throws UnsupportedEncodingException { | 767 | |
691 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 768 | params.put(HttpKey.USEID, id); |
692 | false, true, null); | 769 | params.put(HttpKey.TYPE, type); |
693 | RequestParams params = new RequestParams(); | 770 | params.put(HttpKey.NAME, name); |
694 | 771 | params.put(HttpKey.BIRDays, birthday); | |
695 | params.put(HttpKey.USEID, id); | 772 | params.put(HttpKey.GRADE, gradeId); |
696 | params.put(HttpKey.TYPE, type); | 773 | params.put(HttpKey.REGION, regionId); |
697 | params.put(HttpKey.NAME, name); | 774 | params.put(HttpKey.SCHOOL, schoolId); |
698 | params.put(HttpKey.BIRDays, birthday); | 775 | params.put(HttpKey.QQ, qq); |
699 | params.put(HttpKey.GRADE, gradeId); | 776 | params.put(HttpKey.GENDER, gender); |
700 | params.put(HttpKey.REGION, regionId); | 777 | params.put(HttpKey.REGIONNAME, regionName); |
701 | params.put(HttpKey.SCHOOL, schoolId); | 778 | params.put(HttpKey.ADDDRESS, address); |
702 | params.put(HttpKey.QQ, qq); | 779 | params.put(HttpKey.DEVINUMBER, devicenumber); |
703 | params.put(HttpKey.GENDER, gender); | 780 | Log.e("test", "个人信息" + params); |
704 | params.put(HttpKey.REGIONNAME, regionName); | 781 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
705 | params.put(HttpKey.ADDDRESS, address); | 782 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { |
706 | params.put(HttpKey.DEVINUMBER, devicenumber); | 783 | @Override |
707 | Log.e("test", "个人信息" + params); | 784 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
708 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 785 | super.onSuccess(statusCode, headers, response); |
709 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { | 786 | closeProgress(); |
710 | @Override | 787 | String status = response.optString("status"); |
711 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 788 | if (status.equals("1")) { |
712 | super.onSuccess(statusCode, headers, response); | 789 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
713 | closeProgress(); | 790 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.VIEGREADE, gradeId + ""); |
714 | String status = response.optString("status"); | 791 | Message message = Message.obtain(); |
715 | if (status.equals("1")) { | 792 | message.what = HttpCode.PESERNAOL; |
716 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 793 | message.obj = 1; |
717 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.VIEGREADE,gradeId+""); | 794 | handler.sendMessage(message); |
718 | Message message = Message.obtain(); | 795 | } else { |
719 | message.what = HttpCode.PESERNAOL; | 796 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
720 | message.obj = 1; | 797 | } |
721 | handler.sendMessage(message); | 798 | |
722 | } else { | 799 | } |
723 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 800 | |
724 | } | 801 | @Override |
725 | 802 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | |
726 | } | 803 | super.onFailure(statusCode, headers, throwable, errorResponse); |
727 | 804 | closeProgress(); | |
728 | @Override | 805 | Log.e("test", "onFailure" + errorResponse); |
729 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 806 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
730 | super.onFailure(statusCode, headers, throwable, errorResponse); | 807 | } |
731 | closeProgress(); | 808 | |
732 | Log.e("test", "onFailure" + errorResponse); | 809 | }); |
733 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 810 | } |
734 | } | 811 | |
735 | 812 | //提交注册信息 | |
736 | }); | 813 | public void subregisterinfo(final Context mContext, Long userId |
737 | } | 814 | , String name, int gradeId, long regionId, String regionName, String realName, String address, Object schoolId, String chinese, |
738 | 815 | String math, String english, String physics, String chemistry, | |
739 | //提交注册信息 | 816 | String history, String geography, String political, String biology, String science, final Handler handler) { |
740 | public void subregisterinfo(final Context mContext, Long userId | 817 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
741 | , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese, | 818 | false, true, null); |
742 | String math, String english, String physics, String chemistry, | 819 | RequestParams params = new RequestParams(); |
743 | String history, String geography, String political, String biology, String science, final Handler handler) { | 820 | |
744 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 821 | params.put(HttpKey.USEID, userId); |
745 | false, true, null); | 822 | params.put(HttpKey.NAME, name); |
746 | RequestParams params = new RequestParams(); | 823 | params.put(HttpKey.GRADE, gradeId); |
747 | 824 | params.put(HttpKey.REGION, regionId); | |
748 | params.put(HttpKey.USEID, userId); | 825 | params.put(HttpKey.SCHOOL, schoolId); |
749 | params.put(HttpKey.NAME, name); | 826 | params.put(HttpKey.REGIONNAME, regionName); |
750 | params.put(HttpKey.GRADE, gradeId); | 827 | params.put(HttpKey.MATH, math); |
751 | params.put(HttpKey.REGION, regionId); | 828 | params.put(HttpKey.ENGLISH, english); |
752 | params.put(HttpKey.SCHOOL, schoolId); | 829 | params.put(HttpKey.CHINESE, chinese); |
753 | params.put(HttpKey.REGIONNAME, regionName); | 830 | params.put(HttpKey.PHYSICES, physics); |
754 | params.put(HttpKey.MATH, math); | 831 | params.put(HttpKey.CHEMISTRY, chemistry); |
755 | params.put(HttpKey.ENGLISH, english); | 832 | params.put(HttpKey.HISTIRY, history); |
756 | params.put(HttpKey.CHINESE, chinese); | 833 | params.put(HttpKey.GEOGRAPHY, geography); |
757 | params.put(HttpKey.PHYSICES, physics); | 834 | params.put(HttpKey.POLITICAL, political); |
758 | params.put(HttpKey.CHEMISTRY, chemistry); | 835 | params.put(HttpKey.BIOLOGY, biology); |
759 | params.put(HttpKey.HISTIRY, history); | 836 | params.put(HttpKey.SCIENCE, science); |
837 | params.put(HttpKey.ADDDRESS, address); | ||
838 | params.put(HttpKey.REALNAME, realName); | ||
760 | params.put(HttpKey.GEOGRAPHY, geography); | 839 | |
761 | params.put(HttpKey.POLITICAL, political); | 840 | Log.e("test", "注册信息" + params); |
762 | params.put(HttpKey.BIOLOGY, biology); | 841 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
763 | params.put(HttpKey.SCIENCE, science); | 842 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { |
764 | 843 | @Override | |
765 | Log.e("test", "注册信息" + params); | 844 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
766 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 845 | super.onSuccess(statusCode, headers, response); |
767 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { | 846 | closeProgress(); |
768 | @Override | 847 | Message message = Message.obtain(); |
769 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 848 | message.what = HttpCode.REGISTERINFO_SUCESS; |
770 | super.onSuccess(statusCode, headers, response); | 849 | message.obj = new String(String.valueOf(response)); |
771 | closeProgress(); | 850 | handler.sendMessage(message); |
772 | Message message = Message.obtain(); | 851 | |
773 | message.what = HttpCode.REGISTERINFO_SUCESS; | 852 | } |
774 | message.obj = new String(String.valueOf(response)); | 853 | |
775 | handler.sendMessage(message); | 854 | @Override |
776 | 855 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | |
777 | } | 856 | super.onFailure(statusCode, headers, throwable, errorResponse); |
778 | 857 | closeProgress(); | |
779 | @Override | 858 | Log.e("test", "onFailure" + errorResponse); |
780 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 859 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
781 | super.onFailure(statusCode, headers, throwable, errorResponse); | 860 | } |
782 | closeProgress(); | 861 | |
783 | Log.e("test", "onFailure" + errorResponse); | 862 | }); |
784 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 863 | } |
785 | } | 864 | |
786 | 865 | //修改版本信息 | |
787 | }); | 866 | public void changepublishinfo(final Context mContext, String userId, String chinese, |
788 | } | 867 | String math, String english, String physics, String chemistry, |
789 | 868 | String history, String geography, String political, String biology, String science) { | |
790 | //修改版本信息 | 869 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存版本信息...", |
791 | public void changepublishinfo(final Context mContext, String userId, String chinese, | 870 | false, true, null); |
792 | String math, String english, String physics, String chemistry, | 871 | RequestParams params = new RequestParams(); |
793 | String history, String geography, String political, String biology, String science) { | 872 | params.put(HttpKey.USEID, userId); |
794 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存版本信息...", | 873 | params.put(HttpKey.CHINESE, chinese); |
795 | false, true, null); | 874 | params.put(HttpKey.MATH, math); |
796 | RequestParams params = new RequestParams(); | 875 | params.put(HttpKey.ENGLISH, english); |
797 | params.put(HttpKey.USEID, userId); | 876 | params.put(HttpKey.PHYSICES, physics); |
798 | params.put(HttpKey.CHINESE, chinese); | 877 | params.put(HttpKey.CHEMISTRY, chemistry); |
799 | params.put(HttpKey.MATH, math); | 878 | params.put(HttpKey.HISTIRY, history); |
800 | params.put(HttpKey.ENGLISH, english); | 879 | params.put(HttpKey.GEOGRAPHY, geography); |
801 | params.put(HttpKey.PHYSICES, physics); | 880 | params.put(HttpKey.POLITICAL, political); |
802 | params.put(HttpKey.CHEMISTRY, chemistry); | 881 | params.put(HttpKey.BIOLOGY, biology); |
803 | params.put(HttpKey.HISTIRY, history); | 882 | params.put(HttpKey.SCIENCE, science); |
804 | params.put(HttpKey.GEOGRAPHY, geography); | 883 | |
805 | params.put(HttpKey.POLITICAL, political); | 884 | Log.e("test", "版本信息信息" + params); |
806 | params.put(HttpKey.BIOLOGY, biology); | 885 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
807 | params.put(HttpKey.SCIENCE, science); | 886 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { |
808 | 887 | @Override | |
809 | Log.e("test", "版本信息信息" + params); | 888 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
810 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 889 | super.onSuccess(statusCode, headers, response); |
811 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { | 890 | closeProgress(); |
812 | @Override | 891 | String status = response.optString("status"); |
813 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 892 | if (status.equals("1")) { |
814 | super.onSuccess(statusCode, headers, response); | 893 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); |
815 | closeProgress(); | 894 | ((Activity) mContext).finish(); |
816 | String status = response.optString("status"); | 895 | } else { |
817 | if (status.equals("1")) { | 896 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
818 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); | 897 | } |
819 | ((Activity) mContext).finish(); | 898 | |
820 | } else { | 899 | } |
821 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 900 | |
822 | } | 901 | @Override |
823 | 902 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | |
824 | } | 903 | super.onFailure(statusCode, headers, throwable, errorResponse); |
825 | 904 | closeProgress(); | |
826 | @Override | 905 | Log.e("test", "onFailure" + errorResponse); |
827 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 906 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
828 | super.onFailure(statusCode, headers, throwable, errorResponse); | 907 | } |
829 | closeProgress(); | 908 | |
830 | Log.e("test", "onFailure" + errorResponse); | 909 | }); |
831 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 910 | } |
832 | } | 911 | |
833 | 912 | //修改个性签名 | |
834 | }); | 913 | public void changsignature(final Context mContext, Object userId, int type, final String signature) { |
835 | } | 914 | RequestParams params = new RequestParams(); |
836 | 915 | params.put("userId", userId); | |
837 | //修改个性签名 | 916 | params.put("type", type); |
838 | public void changsignature(final Context mContext, Object userId, int type, final String signature) { | 917 | params.put("signature", signature); |
839 | RequestParams params = new RequestParams(); | 918 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
840 | params.put("userId", userId); | 919 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
841 | params.put("type", type); | 920 | @Override |
842 | params.put("signature", signature); | 921 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
843 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 922 | try { |
844 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 923 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
845 | @Override | 924 | String status = jsonObject.optString("status"); |
846 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 925 | if (status.equals("1")) { |
847 | try { | 926 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
848 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 927 | } else { |
849 | String status = jsonObject.optString("status"); | 928 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
850 | if (status.equals("1")) { | 929 | } |
851 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 930 | } catch (JSONException e) { |
852 | } else { | 931 | e.printStackTrace(); |
853 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 932 | } |
854 | } | 933 | } |
855 | } catch (JSONException e) { | 934 | |
856 | e.printStackTrace(); | 935 | @Override |
857 | } | 936 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
858 | } | 937 | //Log.e("test", "onFailure" + new String(bytes)); |
859 | 938 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
860 | @Override | 939 | } |
861 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 940 | }); |
862 | //Log.e("test", "onFailure" + new String(bytes)); | 941 | } |
863 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 942 | |
864 | } | 943 | /** |
865 | }); | 944 | * 获取个性签名 |
866 | } | 945 | * |
867 | 946 | * @param mContext | |
868 | /** | 947 | * @param userId |
869 | * 获取个性签名 | 948 | * @param handler |
870 | * | 949 | */ |
871 | * @param mContext | 950 | public void getsignatures(final Context mContext, Object userId, int type, final Handler handler) { |
872 | * @param userId | 951 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
873 | * @param handler | 952 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
874 | */ | 953 | @Override |
875 | public void getsignatures(final Context mContext, Object userId, int type, final Handler handler) { | 954 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
876 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 955 | // Log.e("test", "个性签名" + new String(arg2)); |
877 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 956 | try { |
878 | @Override | 957 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
879 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 958 | int status = jsonObject.optInt("status"); |
880 | // Log.e("test", "个性签名" + new String(arg2)); | 959 | if (status == 1) { |
881 | try { | 960 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
882 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 961 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
883 | int status = jsonObject.optInt("status"); | 962 | Message message = Message.obtain(); |
884 | if (status == 1) { | 963 | message.what = HttpCode.SIGN; |
885 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 964 | message.obj = signInfoBeanList; |
886 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 965 | handler.sendMessage(message); |
887 | Message message = Message.obtain(); | 966 | |
888 | message.what = HttpCode.SIGN; | 967 | |
889 | message.obj = signInfoBeanList; | 968 | } else if (status == 1000) { |
890 | handler.sendMessage(message); | 969 | //AlertUtils.showToast(mContext, "您还没有签名哦"); |
891 | 970 | ||
892 | 971 | } else { | |
893 | } else if (status == 1000) { | 972 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
894 | //AlertUtils.showToast(mContext, "您还没有签名哦"); | 973 | } |
895 | 974 | } catch (JSONException e) { | |
896 | } else { | 975 | e.printStackTrace(); |
897 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 976 | } |
898 | } | 977 | |
899 | } catch (JSONException e) { | 978 | |
900 | e.printStackTrace(); | 979 | } |
901 | } | 980 | |
902 | 981 | @Override | |
903 | 982 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
904 | } | 983 | //Log.e("test", "失败原因" + arg3); |
905 | 984 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
906 | @Override | 985 | } |
907 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 986 | }); |
908 | //Log.e("test", "失败原因" + arg3); | 987 | } |
909 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 988 | |
910 | } | 989 | /** |
911 | }); | 990 | * 用户反馈 |
912 | } | 991 | * |
913 | 992 | * @param mContext | |
914 | /** | 993 | * @param userId |
915 | * 用户反馈 | 994 | * @param content |
916 | * | 995 | * @param contact |
917 | * @param mContext | 996 | * @param imgs |
918 | * @param userId | 997 | * @param feedtype |
919 | * @param content | 998 | * @throws UnsupportedEncodingException |
920 | * @param contact | 999 | */ |
921 | * @param imgs | 1000 | public void feedback(final Context mContext, String userId, String content, |
922 | * @param feedtype | 1001 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { |
923 | * @throws UnsupportedEncodingException | 1002 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
924 | */ | 1003 | false, true, null); |
925 | public void feedback(final Context mContext, String userId, String content, | 1004 | File file = new File(imgs); |
926 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { | 1005 | RequestParams params = new RequestParams(); |
927 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 1006 | try { |
928 | false, true, null); | 1007 | params.put("userId", userId); |
929 | File file = new File(imgs); | 1008 | params.put("content", content); |
930 | RequestParams params = new RequestParams(); | 1009 | params.put("contact", contact); |
931 | try { | 1010 | if (file.exists() && file.length() > 0) { |
932 | params.put("userId", userId); | 1011 | params.put("imgs", file); |
933 | params.put("content", content); | 1012 | } |
934 | params.put("contact", contact); | 1013 | params.put("feedtype", feedtype); |
935 | if (file.exists() && file.length() > 0) { | 1014 | } catch (FileNotFoundException e) { |
936 | params.put("imgs", file); | 1015 | e.printStackTrace(); |
937 | } | 1016 | } |
938 | params.put("feedtype", feedtype); | 1017 | Log.e("test", "onSuccess" + params); |
939 | } catch (FileNotFoundException e) { | 1018 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { |
940 | e.printStackTrace(); | 1019 | @Override |
941 | } | 1020 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
942 | Log.e("test", "onSuccess" + params); | 1021 | closeProgress(); |
943 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { | 1022 | // Log.e("test", "onSuccess" + new String(bytes)); |
944 | @Override | 1023 | try { |
945 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1024 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
946 | closeProgress(); | 1025 | String status = jsonObject.optString("status"); |
947 | // Log.e("test", "onSuccess" + new String(bytes)); | 1026 | if (status.equals("1")) { |
948 | try { | 1027 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); |
949 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1028 | ((Activity) mContext).finish(); |
950 | String status = jsonObject.optString("status"); | 1029 | } else { |
951 | if (status.equals("1")) { | 1030 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
952 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); | 1031 | } |
953 | ((Activity) mContext).finish(); | 1032 | } catch (JSONException e) { |
954 | } else { | 1033 | e.printStackTrace(); |
955 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1034 | } |
956 | } | 1035 | } |
957 | } catch (JSONException e) { | 1036 | |
958 | e.printStackTrace(); | 1037 | @Override |
959 | } | 1038 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
960 | } | 1039 | closeProgress(); |
961 | 1040 | //Log.e("test", "错误信息" + new String(bytes)); | |
962 | @Override | 1041 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
963 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1042 | |
964 | closeProgress(); | 1043 | } |
965 | //Log.e("test", "错误信息" + new String(bytes)); | 1044 | }); |
966 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1045 | |
967 | 1046 | } | |
968 | } | 1047 | |
969 | }); | 1048 | /** |
970 | 1049 | * 查询子账户信息 | |
971 | } | 1050 | * |
972 | 1051 | * @param mContext | |
973 | /** | 1052 | * @param userId |
974 | * 查询子账户信息 | 1053 | * @param handler |
975 | * | 1054 | */ |
976 | * @param mContext | 1055 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { |
977 | * @param userId | 1056 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", |
978 | * @param handler | 1057 | false, true, null); |
979 | */ | 1058 | |
980 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { | 1059 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); |
981 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", | 1060 | HttpClient.getInstance().setTimeout(5 * 1000); |
982 | false, true, null); | 1061 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
983 | 1062 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | |
984 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); | 1063 | @Override |
985 | HttpClient.getInstance().setTimeout(5 * 1000); | 1064 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
986 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1065 | closeProgress(); |
987 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 1066 | Log.e("test", "子账户信息" + new String(arg2)); |
988 | @Override | 1067 | try { |
989 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1068 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
990 | closeProgress(); | 1069 | int status = jsonObject.optInt("status"); |
991 | Log.e("test", "子账户信息" + new String(arg2)); | 1070 | if (status == 1) { |
992 | try { | 1071 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
993 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1072 | Log.e("test", "子账户信息" + childsInfo); |
994 | int status = jsonObject.optInt("status"); | 1073 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
995 | if (status == 1) { | 1074 | Log.e("test", "子账户信息" + schoolInfoBeanList); |
996 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 1075 | Message msg = Message.obtain(); |
997 | Log.e("test", "子账户信息" + childsInfo); | 1076 | msg.what = HttpCode.CHILDS_SUCESS; |
998 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 1077 | msg.obj = schoolInfoBeanList; |
999 | Log.e("test", "子账户信息" + schoolInfoBeanList); | 1078 | handler.sendMessage(msg); |
1000 | Message msg = Message.obtain(); | 1079 | |
1001 | msg.what = HttpCode.CHILDS_SUCESS; | 1080 | } else { |
1002 | msg.obj = schoolInfoBeanList; | 1081 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
1003 | handler.sendMessage(msg); | 1082 | |
1004 | 1083 | } | |
1005 | } else { | 1084 | } catch (JSONException e) { |
1006 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 1085 | e.printStackTrace(); |
1007 | 1086 | ||
1008 | } | 1087 | } |
1009 | } catch (JSONException e) { | 1088 | |
1010 | e.printStackTrace(); | 1089 | } |
1011 | 1090 | ||
1012 | } | 1091 | @Override |
1013 | 1092 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1014 | } | 1093 | closeProgress(); |
1015 | 1094 | // Log.e("test", "错误信息" + new String(arg2)); | |
1016 | @Override | 1095 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1017 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1096 | } |
1018 | closeProgress(); | 1097 | }); |
1019 | // Log.e("test", "错误信息" + new String(arg2)); | 1098 | |
1020 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1099 | } |
1021 | } | 1100 | |
1022 | }); | 1101 | /** |
1023 | 1102 | * 删除子账户信息 | |
1024 | } | 1103 | * |
1025 | 1104 | * @param mContext | |
1026 | /** | 1105 | * @param subAccountId |
1027 | * 删除子账户信息 | 1106 | */ |
1028 | * | 1107 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { |
1029 | * @param mContext | 1108 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
1030 | * @param subAccountId | 1109 | false, true, null); |
1031 | */ | 1110 | HttpClient.getInstance().setTimeout(5 * 1000); |
1032 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { | 1111 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1033 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 1112 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
1034 | false, true, null); | 1113 | @Override |
1035 | HttpClient.getInstance().setTimeout(5 * 1000); | 1114 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1036 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1115 | closeProgress(); |
1037 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 1116 | // Log.e("test", "子账户信息" + new String(arg2)); |
1038 | @Override | 1117 | try { |
1039 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1118 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1040 | closeProgress(); | 1119 | int status = jsonObject.optInt("status"); |
1041 | // Log.e("test", "子账户信息" + new String(arg2)); | 1120 | if (status == 1) { |
1042 | try { | 1121 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
1043 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1122 | ((Activity) mContext).finish(); |
1044 | int status = jsonObject.optInt("status"); | 1123 | } else { |
1045 | if (status == 1) { | 1124 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
1046 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 1125 | |
1047 | ((Activity) mContext).finish(); | 1126 | } |
1048 | } else { | 1127 | } catch (JSONException e) { |
1049 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 1128 | e.printStackTrace(); |
1050 | 1129 | } | |
1051 | } | 1130 | |
1052 | } catch (JSONException e) { | 1131 | } |
1053 | e.printStackTrace(); | 1132 | |
1054 | } | 1133 | @Override |
1055 | 1134 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1056 | } | 1135 | closeProgress(); |
1057 | 1136 | // Log.e("test", "错误信息" + new String(arg2)); | |
1058 | @Override | 1137 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1059 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1138 | } |
1060 | closeProgress(); | 1139 | }); |
1061 | // Log.e("test", "错误信息" + new String(arg2)); | 1140 | |
1062 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1141 | } |
1063 | } | 1142 | |
1064 | }); | 1143 | /** |
1065 | 1144 | * 添加子账户信息 | |
1066 | } | 1145 | */ |
1067 | 1146 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | |
1068 | /** | 1147 | String name, final Long grade, Object school, Long region |
1069 | * 添加子账户信息 | 1148 | , String deviceNumber, String regionName) { |
1070 | */ | 1149 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
1071 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 1150 | false, true, null); |
1072 | String name, final Long grade, Object school, Long region | 1151 | RequestParams params = new RequestParams(); |
1073 | , String deviceNumber, String regionName) { | 1152 | |
1074 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 1153 | params.put(HttpKey.PARENTID, parentId); |
1075 | false, true, null); | 1154 | params.put(HttpKey.IMAGE, image); |
1076 | RequestParams params = new RequestParams(); | 1155 | params.put(HttpKey.NAME, name); |
1077 | 1156 | params.put(HttpKey.GRADE, grade); | |
1078 | params.put(HttpKey.PARENTID, parentId); | 1157 | params.put(HttpKey.SCHOOL, school); |
1079 | params.put(HttpKey.IMAGE, image); | 1158 | params.put(HttpKey.REGION, region); |
1080 | params.put(HttpKey.NAME, name); | 1159 | params.put(HttpKey.DEVINUMBER, deviceNumber); |
1081 | params.put(HttpKey.GRADE, grade); | 1160 | params.put(HttpKey.REGIONNAME, regionName); |
1082 | params.put(HttpKey.SCHOOL, school); | 1161 | |
1083 | params.put(HttpKey.REGION, region); | 1162 | Log.e("test", "子账户信息" + params); |
1084 | params.put(HttpKey.DEVINUMBER, deviceNumber); | 1163 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
1085 | params.put(HttpKey.REGIONNAME, regionName); | 1164 | HttpClient.getInstance().setTimeout(5 * 1000); |
1086 | 1165 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | |
1087 | Log.e("test", "子账户信息" + params); | 1166 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
1088 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1167 | @Override |
1089 | HttpClient.getInstance().setTimeout(5 * 1000); | 1168 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1090 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1169 | closeProgress(); |
1091 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 1170 | |
1092 | @Override | 1171 | Log.e("test", "子账户信息" + new String(arg2)); |
1093 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1172 | try { |
1094 | closeProgress(); | 1173 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1095 | 1174 | int status = jsonObject.optInt("status"); | |
1096 | Log.e("test", "子账户信息" + new String(arg2)); | 1175 | if (status == 1) { |
1097 | try { | 1176 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
1098 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1177 | ((Activity) mContext).finish(); |
1099 | int status = jsonObject.optInt("status"); | 1178 | } else { |
1100 | if (status == 1) { | 1179 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
1101 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1180 | |
1102 | ((Activity) mContext).finish(); | 1181 | } |
1103 | } else { | 1182 | } catch (JSONException e) { |
1104 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1183 | e.printStackTrace(); |
1105 | 1184 | } | |
1106 | } | 1185 | |
1107 | } catch (JSONException e) { | 1186 | } |
1108 | e.printStackTrace(); | 1187 | |
1109 | } | 1188 | @Override |
1110 | 1189 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1111 | } | 1190 | closeProgress(); |
1112 | 1191 | // Log.e("test", "错误信息" + new String(arg2)); | |
1113 | @Override | 1192 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1114 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1193 | } |
1115 | closeProgress(); | 1194 | }); |
1116 | // Log.e("test", "错误信息" + new String(arg2)); | 1195 | |
1117 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1196 | } |
1118 | } | 1197 | |
1119 | }); | 1198 | /** |
1120 | 1199 | * 切换子账户信息 | |
1121 | } | 1200 | * |
1122 | 1201 | * @param mContext | |
1123 | /** | 1202 | * @param subAccountId |
1124 | * 切换子账户信息 | 1203 | */ |
1125 | * | 1204 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId |
1126 | * @param mContext | 1205 | , String deviceNumber, int type) { |
1127 | * @param subAccountId | 1206 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
1128 | */ | 1207 | false, true, null); |
1129 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId | 1208 | HttpClient.getInstance().setTimeout(5 * 1000); |
1130 | , String deviceNumber, int type) { | 1209 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1131 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1210 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId |
1132 | false, true, null); | 1211 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { |
1133 | HttpClient.getInstance().setTimeout(5 * 1000); | 1212 | @Override |
1134 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1213 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1135 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId | 1214 | closeProgress(); |
1136 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { | 1215 | // Log.e("test", "子账户信息" + new String(arg2)); |
1137 | @Override | 1216 | try { |
1138 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1217 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1139 | closeProgress(); | 1218 | int status = jsonObject.optInt("status"); |
1140 | // Log.e("test", "子账户信息" + new String(arg2)); | 1219 | if (status == 1) { |
1141 | try { | 1220 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
1142 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1221 | ((Activity) mContext).finish(); |
1143 | int status = jsonObject.optInt("status"); | 1222 | |
1144 | if (status == 1) { | 1223 | } else { |
1145 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1224 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
1146 | ((Activity) mContext).finish(); | 1225 | |
1147 | 1226 | } | |
1148 | } else { | 1227 | } catch (JSONException e) { |
1149 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1228 | e.printStackTrace(); |
1150 | 1229 | } | |
1151 | } | 1230 | |
1152 | } catch (JSONException e) { | 1231 | } |
1153 | e.printStackTrace(); | 1232 | |
1154 | } | 1233 | @Override |
1155 | 1234 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1156 | } | 1235 | closeProgress(); |
1157 | 1236 | //Log.e("test", "错误信息" + new String(arg2)); | |
1158 | @Override | 1237 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1159 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1238 | } |
1160 | closeProgress(); | 1239 | }); |
1161 | //Log.e("test", "错误信息" + new String(arg2)); | 1240 | |
1162 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1241 | } |
1163 | } | 1242 | |
1164 | }); | 1243 | /** |
1165 | 1244 | * 切换主账户信息 | |
1166 | } | 1245 | * |
1167 | 1246 | * @param mContext | |
1168 | /** | 1247 | * @param type |
1169 | * 切换主账户信息 | 1248 | */ |
1170 | * | 1249 | public void Accountinfo(final Context mContext, long userId |
1171 | * @param mContext | 1250 | , String deviceNumber, int type) { |
1172 | * @param type | 1251 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", |
1173 | */ | 1252 | false, true, null); |
1174 | public void Accountinfo(final Context mContext, long userId | 1253 | HttpClient.getInstance().setTimeout(5 * 1000); |
1175 | , String deviceNumber, int type) { | 1254 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1176 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", | 1255 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber |
1177 | false, true, null); | 1256 | + "&type=" + type, new AsyncHttpResponseHandler() { |
1178 | HttpClient.getInstance().setTimeout(5 * 1000); | 1257 | @Override |
1179 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1258 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1180 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber | 1259 | closeProgress(); |
1181 | + "&type=" + type, new AsyncHttpResponseHandler() { | 1260 | // Log.e("test", "子账户信息" + new String(arg2)); |
1182 | @Override | 1261 | try { |
1183 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1262 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1184 | closeProgress(); | 1263 | int status = jsonObject.optInt("status"); |
1185 | // Log.e("test", "子账户信息" + new String(arg2)); | 1264 | if (status == 1) { |
1186 | try { | 1265 | AlertUtils.showToast(mContext, "主账号切换成功!"); |
1187 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1266 | ((Activity) mContext).finish(); |
1188 | int status = jsonObject.optInt("status"); | 1267 | |
1189 | if (status == 1) { | 1268 | } else { |
1190 | AlertUtils.showToast(mContext, "主账号切换成功!"); | 1269 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); |
1191 | ((Activity) mContext).finish(); | 1270 | |
1192 | 1271 | } | |
1193 | } else { | 1272 | } catch (JSONException e) { |
1194 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); | 1273 | e.printStackTrace(); |
1195 | 1274 | } | |
1196 | } | 1275 | |
1197 | } catch (JSONException e) { | 1276 | } |
1198 | e.printStackTrace(); | 1277 | |
1199 | } | 1278 | @Override |
1200 | 1279 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1201 | } | 1280 | closeProgress(); |
1202 | 1281 | // Log.e("test", "错误信息" + new String(arg2)); | |
1203 | @Override | 1282 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1204 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1283 | } |
1205 | closeProgress(); | 1284 | }); |
1206 | // Log.e("test", "错误信息" + new String(arg2)); | 1285 | |
1207 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1286 | } |
1208 | } | 1287 | |
1209 | }); | 1288 | /** |
1210 | 1289 | * 头像拍张 | |
1211 | } | 1290 | * |
1212 | 1291 | * @param mContext | |
1213 | /** | 1292 | * @param userId |
1214 | * 头像拍张 | 1293 | * @param img |
1215 | * | 1294 | * @throws UnsupportedEncodingException |
1216 | * @param mContext | 1295 | */ |
1217 | * @param userId | 1296 | public void header(final Context mContext, String userId, String type, String img, final Handler handler) throws UnsupportedEncodingException { |
1218 | * @param img | 1297 | |
1219 | * @throws UnsupportedEncodingException | 1298 | File file = new File(img); |
1220 | */ | 1299 | if (file.exists() && file.length() > 0) { |
1221 | public void header(final Context mContext, String userId, String type, String img, final Handler handler) throws UnsupportedEncodingException { | 1300 | RequestParams params = new RequestParams(); |
1222 | 1301 | try { | |
1223 | File file = new File(img); | 1302 | params.put("userId", userId); |
1224 | if (file.exists() && file.length() > 0) { | 1303 | params.put("type", type); |
1225 | RequestParams params = new RequestParams(); | 1304 | params.put("img", file); |
1226 | try { | 1305 | } catch (FileNotFoundException e) { |
1227 | params.put("userId", userId); | 1306 | e.printStackTrace(); |
1228 | params.put("type", type); | 1307 | } |
1229 | params.put("img", file); | 1308 | Log.e("test", "params" + params); |
1230 | } catch (FileNotFoundException e) { | 1309 | HttpClient.getInstance().setTimeout(5 * 1000); |
1231 | e.printStackTrace(); | 1310 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { |
1232 | } | 1311 | @Override |
1233 | Log.e("test", "params" + params); | 1312 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
1234 | HttpClient.getInstance().setTimeout(5 * 1000); | 1313 | // Log.e("test", "onSuccess" + new String(bytes)); |
1235 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { | 1314 | try { |
1236 | @Override | 1315 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
1237 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1316 | String status = jsonObject.optString("status"); |
1238 | // Log.e("test", "onSuccess" + new String(bytes)); | 1317 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); |
1239 | try { | 1318 | String imagUrl = jsonObject1.optString("imgUrl"); |
1240 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1319 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); |
1241 | String status = jsonObject.optString("status"); | 1320 | if (status.equals("1")) { |
1242 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); | 1321 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
1243 | String imagUrl = jsonObject1.optString("imgUrl"); | 1322 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.PORTAIT, imagUrl); |
1244 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); | 1323 | Message msg = Message.obtain(); |
1245 | if (status.equals("1")) { | 1324 | msg.what = HttpCode.TOUXIANG; |
1246 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1325 | msg.obj = status; |
1247 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); | 1326 | handler.sendMessage(msg); |
1248 | Message msg = Message.obtain(); | 1327 | } else { |
1249 | msg.what = HttpCode.TOUXIANG; | 1328 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
1250 | msg.obj = status; | 1329 | } |
1251 | handler.sendMessage(msg); | 1330 | } catch (JSONException e) { |
1252 | } else { | 1331 | e.printStackTrace(); |
1253 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1332 | } |
1254 | } | 1333 | } |
1255 | } catch (JSONException e) { | 1334 | |
1256 | e.printStackTrace(); | 1335 | @Override |
1257 | } | 1336 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
1258 | } | 1337 | closeProgress(); |
1259 | 1338 | // Log.e("test", "错误信息" + new String(bytes)); | |
1260 | @Override | 1339 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1261 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1340 | |
1262 | closeProgress(); | 1341 | } |
1263 | // Log.e("test", "错误信息" + new String(bytes)); | 1342 | }); |
1264 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1343 | } else { |
1265 | 1344 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | |
1266 | } | 1345 | } |
1267 | }); | 1346 | } |
1268 | } else { | 1347 | |
1269 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 1348 | /** |
1270 | } | 1349 | * 头像默认 |
1271 | } | 1350 | * |
1272 | 1351 | * @param mContext | |
1273 | /** | 1352 | * @param userId |
1274 | * 头像默认 | 1353 | * @param |
1275 | * | 1354 | * @throws UnsupportedEncodingException |
1276 | * @param mContext | 1355 | */ |
1277 | * @param userId | 1356 | public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { |
1278 | * @param | 1357 | RequestParams params = new RequestParams(); |
1279 | * @throws UnsupportedEncodingException | 1358 | params.put("userId", userId); |
1280 | */ | 1359 | params.put("type", type); |
1281 | public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { | 1360 | params.put("defaultImg", defaultImg); |
1282 | RequestParams params = new RequestParams(); | 1361 | Log.e("test", "params" + params); |
1283 | params.put("userId", userId); | 1362 | HttpClient.getInstance().setTimeout(5 * 1000); |
1284 | params.put("type", type); | 1363 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { |
1285 | params.put("defaultImg", defaultImg); | 1364 | @Override |
1286 | Log.e("test", "params" + params); | 1365 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
1287 | HttpClient.getInstance().setTimeout(5 * 1000); | 1366 | //Log.e("test", "onSuccess" + new String(bytes)); |
1288 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { | 1367 | try { |
1289 | @Override | 1368 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
1290 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1369 | String status = jsonObject.optString("status"); |
1291 | //Log.e("test", "onSuccess" + new String(bytes)); | 1370 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); |
1292 | try { | 1371 | String imagUrl = jsonObject1.optString("imgUrl"); |
1293 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1372 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); |
1294 | String status = jsonObject.optString("status"); | 1373 | if (status.equals("1")) { |
1295 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); | 1374 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
1296 | String imagUrl = jsonObject1.optString("imgUrl"); | 1375 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.PORTAIT, imagUrl); |
1297 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); | 1376 | } else { |
1298 | if (status.equals("1")) { | 1377 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
1299 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1378 | } |
1300 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); | 1379 | } catch (JSONException e) { |
1301 | } else { | 1380 | e.printStackTrace(); |
1302 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1381 | } |
1303 | } | 1382 | } |
1304 | } catch (JSONException e) { | 1383 | |
1305 | e.printStackTrace(); | 1384 | @Override |
1306 | } | 1385 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
1307 | } | 1386 | closeProgress(); |
1308 | 1387 | //.e("test", "错误信息" + new String(bytes)); | |
1309 | @Override | 1388 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1310 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1389 | |
1311 | closeProgress(); | 1390 | } |
1312 | //.e("test", "错误信息" + new String(bytes)); | 1391 | }); |
1313 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1392 | } |
1314 | 1393 | ||
1315 | } | 1394 | /** |
1316 | }); | 1395 | * 检查注册信息是否完整 |
1317 | } | 1396 | * |
1318 | 1397 | * @param mContext | |
1319 | /** | 1398 | * @param userId |
1320 | * 检查注册信息是否完整 | 1399 | */ |
1321 | * | 1400 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { |
1322 | * @param mContext | 1401 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", |
1323 | * @param userId | 1402 | false, true, null); |
1324 | */ | 1403 | HttpClient.getInstance().setTimeout(5 * 1000); |
1325 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { | 1404 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1326 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", | 1405 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
1327 | false, true, null); | 1406 | @Override |
1328 | HttpClient.getInstance().setTimeout(5 * 1000); | 1407 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1329 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1408 | closeProgress(); |
1330 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1409 | //Log.e("test", "注册信息" + new String(arg2)); |
1331 | @Override | 1410 | Message msg = Message.obtain(); |
1332 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1411 | msg.what = HttpCode.REGISTER_SUCESS; |
1333 | closeProgress(); | 1412 | msg.obj = new String(arg2); |
1334 | //Log.e("test", "注册信息" + new String(arg2)); | 1413 | handler.sendMessage(msg); |
1335 | Message msg = Message.obtain(); | 1414 | |
1336 | msg.what = HttpCode.REGISTER_SUCESS; | 1415 | } |
1337 | msg.obj = new String(arg2); | 1416 | |
1338 | handler.sendMessage(msg); | 1417 | @Override |
1339 | 1418 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1340 | } | 1419 | closeProgress(); |
1341 | 1420 | // Log.e("test", "错误信息" + new String(arg2)); | |
1342 | @Override | 1421 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1343 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1422 | |
1344 | closeProgress(); | 1423 | } |
1345 | // Log.e("test", "错误信息" + new String(arg2)); | 1424 | }); |
1346 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1425 | |
1347 | 1426 | } | |
1348 | } | 1427 | |
1349 | }); | 1428 | /** |
1350 | 1429 | * 获取最近学习视频 | |
1351 | } | 1430 | * |
1352 | 1431 | * @param mContext | |
1353 | /** | 1432 | * @param userId |
1354 | * 获取最近学习视频 | 1433 | */ |
1355 | * | 1434 | public void getstuyvidioinfo(final Context mContext, Object userId, final Handler handler) { |
1356 | * @param mContext | 1435 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", |
1357 | * @param userId | 1436 | false, true, null); |
1358 | */ | 1437 | HttpClient.getInstance().setTimeout(5 * 1000); |
1359 | public void getstuyvidioinfo(final Context mContext, Object userId, final Handler handler) { | 1438 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1360 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", | 1439 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
1361 | false, true, null); | 1440 | @Override |
1362 | HttpClient.getInstance().setTimeout(5 * 1000); | 1441 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1363 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1442 | closeProgress(); |
1364 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1443 | //Log.e("test", "近学习视频" + new String(arg2)); |
1365 | @Override | 1444 | try { |
1366 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1445 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1367 | closeProgress(); | 1446 | int status = jsonObject.optInt("status"); |
1368 | //Log.e("test", "近学习视频" + new String(arg2)); | 1447 | if (status == 1) { |
1369 | try { | 1448 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 |
1370 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1449 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); |
1371 | int status = jsonObject.optInt("status"); | 1450 | Message msg = Message.obtain(); |
1372 | if (status == 1) { | 1451 | msg.what = HttpCode.GETVIDIO_SUCESS; |
1373 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 | 1452 | msg.obj = schoolInfoBeanList; |
1374 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); | 1453 | handler.sendMessage(msg); |
1375 | Message msg = Message.obtain(); | 1454 | |
1376 | msg.what = HttpCode.GETVIDIO_SUCESS; | 1455 | } else if (status == 1000) { |
1377 | msg.obj = schoolInfoBeanList; | 1456 | //AlertUtils.showToast(mContext, "暂无最近学习视频!"); |
1378 | handler.sendMessage(msg); | 1457 | |
1379 | 1458 | } else { | |
1380 | } else if (status == 1000){ | 1459 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1381 | //AlertUtils.showToast(mContext, "暂无最近学习视频!"); | 1460 | } |
1382 | 1461 | } catch (JSONException e) { | |
1383 | }else { | 1462 | e.printStackTrace(); |
1384 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1463 | |
1385 | } | 1464 | } |
1386 | } catch (JSONException e) { | 1465 | |
1387 | e.printStackTrace(); | 1466 | } |
1388 | 1467 | ||
1389 | } | 1468 | @Override |
1390 | 1469 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1391 | } | 1470 | closeProgress(); |
1392 | 1471 | // Log.e("test", "错误信息" + new String(arg2)); | |
1393 | @Override | 1472 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1394 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1473 | |
1395 | closeProgress(); | 1474 | } |
1396 | // Log.e("test", "错误信息" + new String(arg2)); | 1475 | }); |
1397 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1476 | |
1398 | 1477 | } | |
1399 | } | 1478 | |
1400 | }); | 1479 | |
1401 | 1480 | /** | |
1402 | } | 1481 | * 系统升级 |
1403 | 1482 | * | |
1404 | 1483 | * @param mContext | |
1405 | /** | 1484 | * @param pid appName |
1406 | * 系统升级 | 1485 | */ |
1407 | * | 1486 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
1408 | * @param mContext | 1487 | // mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", |
1409 | * @param pid appName | 1488 | // false, true, null); |
1410 | */ | 1489 | HttpClient.getInstance().setTimeout(5 * 1000); |
1411 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1490 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1412 | // mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", | 1491 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
1413 | // false, true, null); | 1492 | @Override |
1414 | HttpClient.getInstance().setTimeout(5 * 1000); | 1493 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1415 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1494 | //closeProgress(); |
1416 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1495 | // Log.e("test", "版本升级信息" + new String(arg2)); |
1417 | @Override | 1496 | Gson gson = new Gson(); |
1418 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1497 | List<AppVersion> applist = gson.fromJson(new String(arg2), |
1419 | //closeProgress(); | 1498 | new TypeToken<List<AppVersion>>() { |
1420 | // Log.e("test", "版本升级信息" + new String(arg2)); | 1499 | }.getType()); |
1421 | Gson gson = new Gson(); | 1500 | Log.e("test", "版本升级信息" + applist); |
1422 | List<AppVersion> applist = gson.fromJson(new String(arg2), | 1501 | Message msg = Message.obtain(); |
1423 | new TypeToken<List<AppVersion>>() {}.getType()); | 1502 | msg.what = HttpCode.APPUPDATE_SUCESS; |
1424 | Log.e("test", "版本升级信息" + applist); | 1503 | msg.obj = applist; |
1425 | Message msg = Message.obtain(); | 1504 | handler.sendMessage(msg); |
1426 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1505 | |
1427 | msg.obj = applist; | 1506 | |
1428 | handler.sendMessage(msg); | 1507 | } |
1429 | 1508 | ||
1430 | 1509 | @Override | |
1431 | 1510 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1432 | } | 1511 | //closeProgress(); |
1433 | 1512 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
1434 | @Override | 1513 | } |
1435 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1514 | }); |
1436 | //closeProgress(); | 1515 | |
1437 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1516 | } |
1438 | } | 1517 | |
1439 | }); | 1518 | //版本信息 |
1440 | 1519 | public void versioninfo(final Context mContext, String subjectName, final Handler handler) { | |
1441 | } | 1520 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1442 | 1521 | HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { | |
1443 | //版本信息 | 1522 | @Override |
1444 | public void versioninfo(final Context mContext, String subjectName, final Handler handler) { | 1523 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1445 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1524 | //Log.e("test", "版本信息" + new String(arg2)); |
1446 | HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { | 1525 | try { |
1447 | @Override | 1526 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1448 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1527 | int status = jsonObject.optInt("status"); |
1449 | //Log.e("test", "版本信息" + new String(arg2)); | 1528 | if (status == 1) { |
1450 | try { | 1529 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 |
1451 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1530 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); |
1452 | int status = jsonObject.optInt("status"); | 1531 | Message message = Message.obtain(); |
1453 | if (status == 1) { | 1532 | message.what = HttpCode.VERSION_SUCESS; |
1454 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 | 1533 | message.obj = versionInfoList; |
1455 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); | 1534 | handler.sendMessage(message); |
1456 | Message message = Message.obtain(); | 1535 | |
1457 | message.what = HttpCode.VERSION_SUCESS; | 1536 | } else if (status == 1000) { |
1458 | message.obj = versionInfoList; | 1537 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); |
1459 | handler.sendMessage(message); | 1538 | |
1460 | 1539 | } else { | |
1461 | } else if (status == 1000) { | 1540 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1462 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); | 1541 | } |
1463 | 1542 | } catch (JSONException e) { | |
1464 | } else { | 1543 | e.printStackTrace(); |
1465 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1544 | } |
1466 | } | 1545 | |
1467 | } catch (JSONException e) { | 1546 | |
1468 | e.printStackTrace(); | 1547 | } |
1469 | } | 1548 | |
1470 | 1549 | @Override | |
1471 | 1550 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1472 | } | 1551 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1473 | 1552 | } | |
1474 | @Override | 1553 | }); |
1475 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1554 | } |
1476 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1555 | |
1477 | } | 1556 | |
1478 | }); | 1557 | ///省级接口 |
1479 | } | 1558 | public void provices(final Context mContext, final Handler handler) { |
1480 | 1559 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | |
1481 | 1560 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | |
1482 | ///省级接口 | 1561 | @Override |
1483 | public void provices(final Context mContext, final Handler handler) { | 1562 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1484 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1563 | // Log.e("test", "省" + new String(arg2)); |
1485 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1564 | try { |
1486 | @Override | 1565 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1487 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1566 | int status = jsonObject.optInt("status"); |
1488 | // Log.e("test", "省" + new String(arg2)); | 1567 | if (status == 100) { |
1489 | try { | 1568 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
1490 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1569 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
1491 | int status = jsonObject.optInt("status"); | 1570 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
1492 | if (status == 100) { | 1571 | Message message = Message.obtain(); |
1493 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1572 | message.what = HttpCode.PROVICES; |
1494 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1573 | message.obj = provincesBeanList; |
1495 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1574 | handler.sendMessage(message); |
1496 | Message message = Message.obtain(); | 1575 | |
1497 | message.what = HttpCode.PROVICES; | 1576 | |
1498 | message.obj = provincesBeanList; | 1577 | } else { |
1499 | handler.sendMessage(message); | 1578 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1500 | 1579 | ||
1501 | 1580 | } | |
1502 | } else { | 1581 | } catch (JSONException e) { |
1503 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1582 | e.printStackTrace(); |
1504 | 1583 | } | |
1505 | } | 1584 | |
1506 | } catch (JSONException e) { | 1585 | |
1507 | e.printStackTrace(); | 1586 | } |
1508 | } | 1587 | |
1509 | 1588 | @Override | |
1510 | 1589 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1511 | } | 1590 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1512 | 1591 | } | |
1513 | @Override | 1592 | }); |
1514 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1593 | } |
1515 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1594 | |
1516 | } | 1595 | //获取版本信息接口 |
1517 | }); | 1596 | public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { |
1518 | } | 1597 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1519 | 1598 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { | |
1520 | //获取版本信息接口 | 1599 | @Override |
1521 | public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { | 1600 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1522 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1601 | // Log.e("test", "获取版本信息接口" + new String(arg2)); |
1523 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { | 1602 | try { |
1524 | @Override | 1603 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1525 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1604 | int status = jsonObject.optInt("status"); |
1526 | // Log.e("test", "获取版本信息接口" + new String(arg2)); | 1605 | if (status == 1) { |
1527 | try { | 1606 | Gson gson = new Gson(); |
1528 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1607 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); |
1529 | int status = jsonObject.optInt("status"); | 1608 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); |
1530 | if (status == 1) { | 1609 | Message message = Message.obtain(); |
1531 | Gson gson = new Gson(); | 1610 | message.what = HttpCode.PUBLISH_SUCESS; |
1532 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); | 1611 | message.obj = defautPublishInfoBeanList; |
1533 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); | 1612 | handler.sendMessage(message); |
1534 | Message message = Message.obtain(); | 1613 | |
1535 | message.what = HttpCode.PUBLISH_SUCESS; | 1614 | } else { |
1536 | message.obj = defautPublishInfoBeanList; | 1615 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1537 | handler.sendMessage(message); | 1616 | |
1538 | 1617 | } | |
1539 | } else { | 1618 | } catch (JSONException e) { |
1540 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1619 | e.printStackTrace(); |
1541 | 1620 | } | |
1542 | } | 1621 | |
1543 | } catch (JSONException e) { | 1622 | |
1544 | e.printStackTrace(); | 1623 | } |
1545 | } | 1624 | |
1546 | 1625 | @Override | |
1547 | 1626 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1548 | } | 1627 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1549 | 1628 | } | |
1550 | @Override | 1629 | }); |
1551 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1630 | } |
1552 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1631 | |
1553 | } | 1632 | |
1554 | }); | 1633 | //市级接口 |
1555 | } | 1634 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
1556 | 1635 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | |
1557 | 1636 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | |
1558 | //市级接口 | 1637 | @Override |
1559 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1638 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1560 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1639 | // Log.e("test", "市" + new String(arg2)); |
1561 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1640 | try { |
1562 | @Override | 1641 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1563 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1642 | int status = jsonObject.optInt("status"); |
1564 | // Log.e("test", "市" + new String(arg2)); | 1643 | if (status == 100) { |
1565 | try { | 1644 | Gson gson = new Gson(); |
1566 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1645 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
1567 | int status = jsonObject.optInt("status"); | 1646 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
1568 | if (status == 100) { | 1647 | Message message = Message.obtain(); |
1569 | Gson gson = new Gson(); | 1648 | message.what = HttpCode.CITYS; |
1570 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1649 | message.obj = cityInfoBeanList; |
1571 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1650 | handler.sendMessage(message); |
1572 | Message message = Message.obtain(); | 1651 | |
1573 | message.what = HttpCode.CITYS; | 1652 | } else { |
1574 | message.obj = cityInfoBeanList; | 1653 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1575 | handler.sendMessage(message); | 1654 | |
1576 | 1655 | } | |
1577 | } else { | 1656 | } catch (JSONException e) { |
1578 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1657 | e.printStackTrace(); |
1579 | 1658 | } | |
1580 | } | 1659 | |
1581 | } catch (JSONException e) { | 1660 | |
1582 | e.printStackTrace(); | 1661 | } |
1583 | } | 1662 | |
1584 | 1663 | @Override | |
1585 | 1664 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1586 | } | 1665 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1587 | 1666 | } | |
1588 | @Override | 1667 | }); |
1589 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1668 | } |
1590 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1669 | |
1591 | } | 1670 | //区县级接口 |
1592 | }); | 1671 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
1593 | } | 1672 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1594 | 1673 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | |
1595 | //区县级接口 | 1674 | @Override |
1596 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1675 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1597 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1676 | // Log.e("test", "区" + new String(arg2)); |
1598 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1677 | try { |
1599 | @Override | 1678 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1600 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1679 | int status = jsonObject.optInt("status"); |
1601 | // Log.e("test", "区" + new String(arg2)); | 1680 | if (status == 100) { |
1602 | try { | 1681 | Gson gson = new Gson(); |
1603 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1682 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
1604 | int status = jsonObject.optInt("status"); | 1683 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
1605 | if (status == 100) { | 1684 | Message message = Message.obtain(); |
1606 | Gson gson = new Gson(); | 1685 | message.what = HttpCode.COUNTRY; |
1607 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1686 | message.obj = countyInfoInfoBeanList; |
1608 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1687 | handler.sendMessage(message); |
1609 | Message message = Message.obtain(); | 1688 | } else { |
1610 | message.what = HttpCode.COUNTRY; | 1689 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1611 | message.obj = countyInfoInfoBeanList; | 1690 | |
1612 | handler.sendMessage(message); | 1691 | } |
1613 | } else { | 1692 | } catch (JSONException e) { |
1614 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1693 | e.printStackTrace(); |
1615 | 1694 | } | |
1616 | } | 1695 | |
1617 | } catch (JSONException e) { | 1696 | |
1618 | e.printStackTrace(); | 1697 | } |
1619 | } | 1698 | |
1620 | 1699 | @Override | |
1621 | 1700 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1622 | } | 1701 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1623 | 1702 | } | |
1624 | @Override | 1703 | }); |
1625 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1704 | } |
1626 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1705 | |
1627 | } | 1706 | |
1628 | }); | 1707 | private void closeProgress() { |
1629 | } | 1708 | try { |
1630 | 1709 | if (mProgress != null) { | |
1631 | 1710 | mProgress.dismiss(); | |
1632 | private void closeProgress() { | 1711 | mProgress = null; |
1633 | try { | 1712 | } |
1634 | if (mProgress != null) { | 1713 | } catch (Exception e) { |
1635 | mProgress.dismiss(); | 1714 | e.printStackTrace(); |
1636 | mProgress = null; | 1715 | } |
1637 | } | 1716 | } |
1638 | } catch (Exception e) { | 1717 | |
1639 | e.printStackTrace(); | 1718 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
1640 | } | 1719 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
1641 | } | 1720 | |
1642 | 1721 | HttpManager.getInstance().closeProgress(); | |
1643 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 1722 | } |
1644 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 1723 | |
1645 | 1724 | return false; | |
1646 | HttpManager.getInstance().closeProgress(); | 1725 | |
1647 | } | 1726 | } |
1648 | 1727 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | import com.hjx.personalcenter.BuildConfig; | 3 | import com.hjx.personalcenter.BuildConfig; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Created by h on 2017/8/15. | 6 | * Created by h on 2017/8/15. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | public class HttpUrl { | 9 | public class HttpUrl { |
10 | private final static String Enviroment = "DEVELOPMENT"; | 10 | private final static String Enviroment = "DEVELOPMENT"; |
11 | //BuildConfig.BUILD_TYPE.equals("release") ? "http://boss.hjx.com" : "http://boss.test.hjx.com" ; | 11 | //BuildConfig.BUILD_TYPE.equals("release") ? "http://boss.hjx.com" : "http://boss.test.hjx.com" ; |
12 | public static String GetDomain(){ | 12 | public static String GetDomain(){ |
13 | return BuildConfig.BUILD_TYPE.equals("release") ? "http://boss.hjx.com" : "http://boss.test.hjx.com" ; | 13 | return BuildConfig.BUILD_TYPE.equals("release") ? "http://boss.hjx.com" : "http://boss.test.hjx.com" ; |
14 | // return "http://boss.hjx.com" ; | ||
14 | } | 15 | } |
15 | 16 | ||
16 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 | 17 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 |
17 | public static String schoolUrl = GetDomain()+"/school/get";//学校 | 18 | public static String schoolUrl = GetDomain()+"/school/get";//学校 |
18 | public static String gradesUrl = GetDomain()+"/grades";//年级 | 19 | public static String gradesUrl = GetDomain()+"/grades";//年级 |
19 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 | 20 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 |
20 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 | 21 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 |
21 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 | 22 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 |
22 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ | 23 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ |
23 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 | 24 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 |
24 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 | 25 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 |
25 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 | 26 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 |
26 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 | 27 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 |
27 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 | 28 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 |
28 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 | 29 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 |
29 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 | 30 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 |
30 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 | 31 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 |
31 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 | 32 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 |
32 | public static String getpresonalinfo=GetDomain()+"/personal/get";//获取个人信息 | 33 | public static String getpresonalinfo=GetDomain()+"/personal/get";//获取个人信息 |
33 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 | 34 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 |
34 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 | 35 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 |
35 | public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 | 36 | public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 |
36 | public static String childUserURL=GetDomain()+"/childUser/info";//获取子账户信息 | 37 | public static String childUserURL=GetDomain()+"/childUser/info";//获取子账户信息 |
37 | public static String deletechildUserURL=GetDomain()+"/childUser/delete";//删除子账户 | 38 | public static String deletechildUserURL=GetDomain()+"/childUser/delete";//删除子账户 |
38 | public static String addchildUserURL=GetDomain()+"/childUser/addChildUser";//添加子账户 | 39 | public static String addchildUserURL=GetDomain()+"/childUser/addChildUser";//添加子账户 |
39 | public static String changechildUserURL=GetDomain()+"/childUser/update";//切换子账户 | 40 | public static String changechildUserURL=GetDomain()+"/childUser/update";//切换子账户 |
40 | public static String updateappURL=GetDomain()+"/general/release/version";//系统升级 | 41 | public static String updateappURL=GetDomain()+"/general/release/version";//系统升级 |
41 | public static String headerURL=GetDomain()+"/profile/picture/update";//头像上传 | 42 | public static String headerURL=GetDomain()+"/profile/picture/update";//头像上传 |
42 | public static String headerdefaultURL=GetDomain()+"/profile/picture/default";//默认头像上传 | 43 | public static String headerdefaultURL=GetDomain()+"/profile/picture/default";//默认头像上传 |
43 | public static String getversionURL=GetDomain()+"/press/list";//获取版本信息 | 44 | public static String getversionURL=GetDomain()+"/press/list";//获取版本信息 |
44 | public static String isRegisterInfoCompleteURL=GetDomain()+"/register/extrainfo/check";//注册信息是否完整 | 45 | public static String isRegisterInfoCompleteURL=GetDomain()+"/register/extrainfo/check";//注册信息是否完整 |
45 | public static String getpublishURL=GetDomain()+"/userPress/info";//获取版本信息 | 46 | public static String getpublishURL=GetDomain()+"/userPress/info";//获取版本信息 |
46 | public static String getvidioURL=GetDomain()+"/personal/video/recent";//获取最近学习视频 | 47 | public static String getvidioURL=GetDomain()+"/personal/video/recent";//获取最近学习视频 |
47 | public static String submitregisterURL=GetDomain()+"/register/extrainfo/submit";//提交注册信息 | 48 | public static String submitregisterURL=GetDomain()+"/register/extrainfo/submit";//提交注册信息 |
48 | public static String chagepublishURL=GetDomain()+"/userPress/update";//修改版本信息 | 49 | public static String chagepublishURL=GetDomain()+"/userPress/update";//修改版本信息 |
49 | public static String chageaccountphoneURL=GetDomain()+"/electronicCard/updateUserNameByUserId";//修改账户绑定 | 50 | public static String chageaccountphoneURL=GetDomain()+"/electronicCard/updateUserNameByUserId";//修改账户绑定 |
51 | public static String submitEcardURL=GetDomain()+"/ecard/submit";//修改账户绑定 | ||
52 | public static String getSalesInfo=GetDomain()+"/electronicCard/check/salesman";//获取营业员信息 | ||
50 | 53 | ||
51 | 54 | ||
52 | 55 | ||
53 | 56 | ||
54 | 57 | ||
55 | 58 | ||
56 | } | 59 | } |
57 | 60 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/PesonalInfo.java
1 | package com.hjx.personalcenter.model; | 1 | package com.hjx.personalcenter.model; |
2 | 2 | ||
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Created by h on 2017/8/22. | 6 | * Created by h on 2017/8/22. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | public class PesonalInfo implements Serializable{ | 9 | public class PesonalInfo implements Serializable{ |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * status : 1 | 12 | * status : 1 |
13 | * pageSize : 0 | 13 | * pageSize : 0 |
14 | * data : {"region":{"regionName":"闵行区","regionId":"310112"},"nickName":"1688kkkkkkkkk","gender":"female","school":{"schoolId":"499705","schoolName":"上海五中"},"grade":{"gradeName":"初中六年级","gradeId":"9"},"birthday":"2017-09-12","qq":"1666600"} | 14 | * data : {"region":{"regionName":"闵行区","regionId":"310112"},"nickName":"1688kkkkkkkkk","gender":"female","school":{"schoolId":"499705","schoolName":"上海五中"},"grade":{"gradeName":"初中六年级","gradeId":"9"},"birthday":"2017-09-12","qq":"1666600"} |
15 | * msg : success | 15 | * msg : success |
16 | * pageNum : 0 | 16 | * pageNum : 0 |
17 | */ | 17 | */ |
18 | 18 | ||
19 | private int status; | 19 | private int status; |
20 | private int pageSize; | 20 | private int pageSize; |
21 | private DataBean data; | 21 | private DataBean data; |
22 | private String msg; | 22 | private String msg; |
23 | private int pageNum; | 23 | private int pageNum; |
24 | 24 | ||
25 | public int getStatus() { | 25 | public int getStatus() { |
26 | return status; | 26 | return status; |
27 | } | 27 | } |
28 | 28 | ||
29 | public void setStatus(int status) { | 29 | public void setStatus(int status) { |
30 | this.status = status; | 30 | this.status = status; |
31 | } | 31 | } |
32 | 32 | ||
33 | public int getPageSize() { | 33 | public int getPageSize() { |
34 | return pageSize; | 34 | return pageSize; |
35 | } | 35 | } |
36 | 36 | ||
37 | public void setPageSize(int pageSize) { | 37 | public void setPageSize(int pageSize) { |
38 | this.pageSize = pageSize; | 38 | this.pageSize = pageSize; |
39 | } | 39 | } |
40 | 40 | ||
41 | public DataBean getData() { | 41 | public DataBean getData() { |
42 | return data; | 42 | return data; |
43 | } | 43 | } |
44 | 44 | ||
45 | public void setData(DataBean data) { | 45 | public void setData(DataBean data) { |
46 | this.data = data; | 46 | this.data = data; |
47 | } | 47 | } |
48 | 48 | ||
49 | public String getMsg() { | 49 | public String getMsg() { |
50 | return msg; | 50 | return msg; |
51 | } | 51 | } |
52 | 52 | ||
53 | public void setMsg(String msg) { | 53 | public void setMsg(String msg) { |
54 | this.msg = msg; | 54 | this.msg = msg; |
55 | } | 55 | } |
56 | 56 | ||
57 | public int getPageNum() { | 57 | public int getPageNum() { |
58 | return pageNum; | 58 | return pageNum; |
59 | } | 59 | } |
60 | 60 | ||
61 | public void setPageNum(int pageNum) { | 61 | public void setPageNum(int pageNum) { |
62 | this.pageNum = pageNum; | 62 | this.pageNum = pageNum; |
63 | } | 63 | } |
64 | 64 | ||
65 | public static class DataBean { | 65 | public static class DataBean { |
66 | /** | 66 | /** |
67 | * region : {"regionName":"闵行区","regionId":"310112"} | 67 | * region : {"regionName":"闵行区","regionId":"310112"} |
68 | * nickName : 1688kkkkkkkkk | 68 | * nickName : 1688kkkkkkkkk |
69 | * gender : female | 69 | * gender : female |
70 | * school : {"schoolId":"499705","schoolName":"上海五中"} | 70 | * school : {"schoolId":"499705","schoolName":"上海五中"} |
71 | * grade : {"gradeName":"初中六年级","gradeId":"9"} | 71 | * grade : {"gradeName":"初中六年级","gradeId":"9"} |
72 | * birthday : 2017-09-12 | 72 | * birthday : 2017-09-12 |
73 | * qq : 1666600 | 73 | * qq : 1666600 |
74 | */ | 74 | */ |
75 | 75 | ||
76 | private RegionBean region; | 76 | private RegionBean region; |
77 | private String nickName; | 77 | private String nickName; |
78 | private String gender; | 78 | private String gender; |
79 | 79 | ||
80 | public String getAddress() { | 80 | public String getAddress() { |
81 | return address; | 81 | return address; |
82 | } | 82 | } |
83 | 83 | ||
84 | public void setAddress(String address) { | 84 | public void setAddress(String address) { |
85 | this.address = address; | 85 | this.address = address; |
86 | } | 86 | } |
87 | 87 | ||
88 | private String address; | 88 | private String address; |
89 | private String realName; | ||
89 | private String portrait; | 90 | private String portrait; |
90 | private SchoolBean school; | 91 | private SchoolBean school; |
91 | private GradeBean grade; | 92 | private GradeBean grade; |
92 | private String birthday; | 93 | private String birthday; |
93 | private String qq; | 94 | private String qq; |
94 | public String getPortrait() { | 95 | public String getPortrait() { |
95 | return portrait; | 96 | return portrait; |
96 | } | 97 | } |
97 | 98 | ||
98 | public void setPortrait(String portrait) { | 99 | public void setPortrait(String portrait) { |
99 | this.portrait = portrait; | 100 | this.portrait = portrait; |
100 | } | 101 | } |
101 | public RegionBean getRegion() { | 102 | public RegionBean getRegion() { |
102 | return region; | 103 | return region; |
103 | } | 104 | } |
104 | 105 | ||
105 | public void setRegion(RegionBean region) { | 106 | public void setRegion(RegionBean region) { |
106 | this.region = region; | 107 | this.region = region; |
107 | } | 108 | } |
108 | 109 | ||
109 | public String getNickName() { | 110 | public String getNickName() { |
110 | return nickName; | 111 | return nickName; |
111 | } | 112 | } |
112 | 113 | ||
113 | public void setNickName(String nickName) { | 114 | public void setNickName(String nickName) { |
114 | this.nickName = nickName; | 115 | this.nickName = nickName; |
115 | } | 116 | } |
116 | 117 | ||
117 | public String getGender() { | 118 | public String getGender() { |
118 | return gender; | 119 | return gender; |
119 | } | 120 | } |
120 | 121 | ||
121 | public void setGender(String gender) { | 122 | public void setGender(String gender) { |
122 | this.gender = gender; | 123 | this.gender = gender; |
123 | } | 124 | } |
124 | 125 | ||
125 | public SchoolBean getSchool() { | 126 | public SchoolBean getSchool() { |
126 | return school; | 127 | return school; |
127 | } | 128 | } |
128 | 129 | ||
129 | public void setSchool(SchoolBean school) { | 130 | public void setSchool(SchoolBean school) { |
130 | this.school = school; | 131 | this.school = school; |
131 | } | 132 | } |
132 | 133 | ||
133 | public GradeBean getGrade() { | 134 | public GradeBean getGrade() { |
134 | return grade; | 135 | return grade; |
135 | } | 136 | } |
136 | 137 | ||
137 | public void setGrade(GradeBean grade) { | 138 | public void setGrade(GradeBean grade) { |
138 | this.grade = grade; | 139 | this.grade = grade; |
139 | } | 140 | } |
140 | 141 | ||
141 | public String getBirthday() { | 142 | public String getBirthday() { |
142 | return birthday; | 143 | return birthday; |
143 | } | 144 | } |
144 | 145 | ||
145 | public void setBirthday(String birthday) { | 146 | public void setBirthday(String birthday) { |
146 | this.birthday = birthday; | 147 | this.birthday = birthday; |
147 | } | 148 | } |
148 | 149 | ||
149 | public String getQq() { | 150 | public String getQq() { |
150 | return qq; | 151 | return qq; |
151 | } | 152 | } |
152 | 153 | ||
153 | public void setQq(String qq) { | 154 | public void setQq(String qq) { |
154 | this.qq = qq; | 155 | this.qq = qq; |
155 | } | 156 | } |
156 | 157 | ||
158 | public String getRealName() { | ||
159 | return realName; | ||
160 | } | ||
161 | |||
162 | public void setRealName(String realName) { | ||
163 | this.realName = realName; | ||
164 | } | ||
165 | |||
157 | public static class RegionBean { | 166 | public static class RegionBean { |
158 | /** | 167 | /** |
159 | * regionName : 闵行区 | 168 | * regionName : 闵行区 |
160 | * regionId : 310112 | 169 | * regionId : 310112 |
161 | */ | 170 | */ |
162 | 171 | ||
163 | private String regionName; | 172 | private String regionName; |
164 | private String regionId; | 173 | private String regionId; |
165 | 174 | ||
166 | public String getRegionName() { | 175 | public String getRegionName() { |
167 | return regionName; | 176 | return regionName; |
168 | } | 177 | } |
169 | 178 | ||
170 | public void setRegionName(String regionName) { | 179 | public void setRegionName(String regionName) { |
171 | this.regionName = regionName; | 180 | this.regionName = regionName; |
172 | } | 181 | } |
173 | 182 | ||
174 | public String getRegionId() { | 183 | public String getRegionId() { |
175 | return regionId; | 184 | return regionId; |
176 | } | 185 | } |
177 | 186 | ||
178 | public void setRegionId(String regionId) { | 187 | public void setRegionId(String regionId) { |
179 | this.regionId = regionId; | 188 | this.regionId = regionId; |
180 | } | 189 | } |
181 | } | 190 | } |
182 | 191 | ||
183 | public static class SchoolBean { | 192 | public static class SchoolBean { |
184 | /** | 193 | /** |
185 | * schoolId : 499705 | 194 | * schoolId : 499705 |
186 | * schoolName : 上海五中 | 195 | * schoolName : 上海五中 |
187 | */ | 196 | */ |
188 | 197 | ||
189 | private String schoolId; | 198 | private String schoolId; |
190 | private String schoolName; | 199 | private String schoolName; |
191 | 200 | ||
192 | public String getSchoolId() { | 201 | public String getSchoolId() { |
193 | return schoolId; | 202 | return schoolId; |
194 | } | 203 | } |
195 | 204 | ||
196 | public void setSchoolId(String schoolId) { | 205 | public void setSchoolId(String schoolId) { |
197 | this.schoolId = schoolId; | 206 | this.schoolId = schoolId; |
198 | } | 207 | } |
199 | 208 | ||
200 | public String getSchoolName() { | 209 | public String getSchoolName() { |
201 | return schoolName; | 210 | return schoolName; |
202 | } | 211 | } |
203 | 212 | ||
204 | public void setSchoolName(String schoolName) { | 213 | public void setSchoolName(String schoolName) { |
205 | this.schoolName = schoolName; | 214 | this.schoolName = schoolName; |
206 | } | 215 | } |
207 | } | 216 | } |
208 | 217 | ||
209 | public static class GradeBean { | 218 | public static class GradeBean { |
210 | /** | 219 | /** |
211 | * gradeName : 初中六年级 | 220 | * gradeName : 初中六年级 |
212 | * gradeId : 9 | 221 | * gradeId : 9 |
213 | */ | 222 | */ |
214 | 223 | ||
215 | private String gradeName; | 224 | private String gradeName; |
216 | private String gradeId; | 225 | private String gradeId; |
217 | 226 | ||
218 | public String getGradeName() { | 227 | public String getGradeName() { |
219 | return gradeName; | 228 | return gradeName; |
220 | } | 229 | } |
221 | 230 | ||
222 | public void setGradeName(String gradeName) { | 231 | public void setGradeName(String gradeName) { |
223 | this.gradeName = gradeName; | 232 | this.gradeName = gradeName; |
224 | } | 233 | } |
225 | 234 | ||
226 | public String getGradeId() { | 235 | public String getGradeId() { |
227 | return gradeId; | 236 | return gradeId; |
228 | } | 237 | } |
229 | 238 | ||
230 | public void setGradeId(String gradeId) { | 239 | public void setGradeId(String gradeId) { |
231 | this.gradeId = gradeId; | 240 | this.gradeId = gradeId; |
232 | } | 241 | } |
233 | } | 242 | } |
234 | } | 243 | } |
235 | } | 244 | } |
236 | 245 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/CenterService.java
1 | package com.hjx.personalcenter.service; | 1 | package com.hjx.personalcenter.service; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.IBinder; | 4 | import android.os.IBinder; |
5 | import android.os.RemoteException; | 5 | import android.os.RemoteException; |
6 | 6 | ||
7 | import com.google.gson.Gson; | 7 | import com.google.gson.Gson; |
8 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 8 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
9 | import com.hjx.personalcenter.db.SaveParam; | 9 | import com.hjx.personalcenter.db.SaveParam; |
10 | import com.hjx.personalcenter.model.CardInfo; | 10 | import com.hjx.personalcenter.model.CardInfo; |
11 | import com.hjx.personalcenter.model.LoginInfo; | 11 | import com.hjx.personalcenter.model.LoginInfo; |
12 | import com.hjx.personalcenter.model.UserInfoModer; | 12 | import com.hjx.personalcenter.model.UserInfoModer; |
13 | import com.hjx.personalcenter.util.GetDevicesUtil; | 13 | import com.hjx.personalcenter.util.GetDevicesUtil; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Created by h on 2017/9/1. | 16 | * Created by h on 2017/9/1. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | public class CenterService extends BaseService { | 19 | public class CenterService extends BaseService { |
20 | enum ACTIVITY_ACTION{ | 20 | enum ACTIVITY_ACTION{ |
21 | userinfo_activity | 21 | userinfo_activity |
22 | } | 22 | } |
23 | public CenterService(){ | 23 | public CenterService(){ |
24 | 24 | ||
25 | } | 25 | } |
26 | IPresonalInterface.Stub binder = new IPresonalInterface.Stub() { | 26 | IPresonalInterface.Stub binder = new IPresonalInterface.Stub() { |
27 | @Override | 27 | @Override |
28 | public String sayHello() throws RemoteException { | 28 | public String sayHello() throws RemoteException { |
29 | return "这是测试AIDL的方法"; | 29 | return "这是测试AIDL的方法"; |
30 | } | 30 | } |
31 | 31 | ||
32 | @Override | 32 | @Override |
33 | public String viewPage(String action) throws RemoteException { | 33 | public String viewPage(String action) throws RemoteException { |
34 | String result = null; | 34 | String result = null; |
35 | if(action.equals(ACTIVITY_ACTION.userinfo_activity.toString())){ | 35 | if(action.equals(ACTIVITY_ACTION.userinfo_activity.toString())){ |
36 | //登录界面 | 36 | //登录界面 |
37 | Intent intent = new Intent(); | 37 | Intent intent = new Intent(); |
38 | intent.setClass(CenterService.this, LoginAndRegisterActivity.class); | 38 | intent.setClass(CenterService.this, LoginAndRegisterActivity.class); |
39 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 39 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
40 | startActivity(intent); | 40 | startActivity(intent); |
41 | result= "跳转成功"; | 41 | result= "跳转成功"; |
42 | } | 42 | } |
43 | 43 | ||
44 | return result; | 44 | return result; |
45 | } | 45 | } |
46 | 46 | ||
47 | @Override | 47 | @Override |
48 | public String getSimpleUser() throws RemoteException { | 48 | public String getSimpleUser() throws RemoteException { |
49 | String logininfo = null; | 49 | String logininfo = null; |
50 | Gson gson = new Gson(); | 50 | Gson gson = new Gson(); |
51 | LoginInfo loginInfo = new LoginInfo(); | 51 | LoginInfo loginInfo = new LoginInfo(); |
52 | String islogin = SaveParam.getInstance().getLoginParam(getApplication(),"login"); | 52 | String islogin = SaveParam.getInstance().getLoginParam(getApplication(),"login"); |
53 | //子账户id | 53 | //子账户id |
54 | String childsidid = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CHILDSID); | 54 | String childsidid = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CHILDSID); |
55 | //账户类型 | 55 | //账户类型 |
56 | String accounts = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ACCOUNT); | 56 | String accounts = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ACCOUNT); |
57 | if ("true".equals(islogin)){ | 57 | if ("true".equals(islogin)){ |
58 | loginInfo.setUsername(SaveParam.getInstance().getLoginParam(getApplication(), "username")); | 58 | loginInfo.setUsername(SaveParam.getInstance().getLoginParam(getApplication(), "username")); |
59 | loginInfo.setPassword(SaveParam.getInstance().getLoginParam(getApplication(), "password")); | 59 | loginInfo.setPassword(SaveParam.getInstance().getLoginParam(getApplication(), "password")); |
60 | loginInfo.setAccess_token(SaveParam.getInstance().getLoginParam(getApplication(), "access_token")); | 60 | loginInfo.setAccess_token(SaveParam.getInstance().getLoginParam(getApplication(), "access_token")); |
61 | loginInfo.setLoginStatus(SaveParam.getInstance().getLoginParam(getApplication(), "login")); | 61 | loginInfo.setLoginStatus(SaveParam.getInstance().getLoginParam(getApplication(), "login")); |
62 | 62 | ||
63 | if ("2".equals(accounts)){ | 63 | if ("2".equals(accounts)){ |
64 | loginInfo.setUserId(childsidid); | 64 | loginInfo.setUserId(childsidid); |
65 | }else { | 65 | }else { |
66 | loginInfo.setUserId(SaveParam.getInstance().getLoginParam(getApplication(), "userId")); | 66 | loginInfo.setUserId(SaveParam.getInstance().getLoginParam(getApplication(), "userId")); |
67 | } | 67 | } |
68 | 68 | ||
69 | logininfo =gson.toJson(loginInfo); | 69 | logininfo =gson.toJson(loginInfo); |
70 | 70 | ||
71 | //Log.e("test","登录信息"+logininfo); | 71 | //Log.e("test","登录信息"+logininfo); |
72 | 72 | ||
73 | } | 73 | } |
74 | 74 | ||
75 | return logininfo; | 75 | return logininfo; |
76 | } | 76 | } |
77 | //保卡信息 | 77 | //保卡信息 |
78 | @Override | 78 | @Override |
79 | public String getcardUser() throws RemoteException { | 79 | public String getcardUser() throws RemoteException { |
80 | String results = null; | 80 | String results = null; |
81 | // CardInfo cardInfo = new CardInfo(); | 81 | // CardInfo cardInfo = new CardInfo(); |
82 | CardInfo.DataBean dataBean = new CardInfo.DataBean(); | 82 | CardInfo.DataBean dataBean = new CardInfo.DataBean(); |
83 | Gson gson = new Gson(); | 83 | Gson gson = new Gson(); |
84 | 84 | ||
85 | //获取设备信息 | 85 | //获取设备信息 |
86 | dataBean.setProductModel(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceModel()); | 86 | dataBean.setProductModel(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceModel()); |
87 | dataBean.setDeviceNumber(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceNumber()); | 87 | dataBean.setDeviceNumber(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceNumber()); |
88 | dataBean.setMacAddress(GetDevicesUtil.getDevicesInfo(getApplication()).getMac()); | 88 | dataBean.setMacAddress(GetDevicesUtil.getDevicesInfo(getApplication()).getMac()); |
89 | //获取保卡信息 | 89 | //获取保卡信息 |
90 | dataBean.setCustomerName(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CUNSTEMNAME)); | 90 | dataBean.setCustomerName(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CUNSTEMNAME)); |
91 | dataBean.setCustomerAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ADRESSCUNSTEM)); | 91 | dataBean.setCustomerAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ADRESSCUNSTEM)); |
92 | dataBean.setBuyTime(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTIME)); | 92 | dataBean.setBuyTime(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTIME)); |
93 | dataBean.setBuyAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPADRESS)); | 93 | dataBean.setBuyAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPADRESS)); |
94 | dataBean.setAlterSaleCall(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTLEPHONE)); | 94 | dataBean.setAlterSaleCall(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTLEPHONE)); |
95 | dataBean.setMobilePhone(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CARDPHONE)); | 95 | dataBean.setMobilePhone(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CARDPHONE)); |
96 | // cardInfo.setData(dataBean); | 96 | // cardInfo.setData(dataBean); |
97 | 97 | ||
98 | //Log.e("test","保卡信息"+results); | 98 | //Log.e("test","保卡信息"+results); |
99 | String yangji = SaveParam.getInstance().getLoginParam(getApplication(), SaveParam.YANGJI); | 99 | String yangji = SaveParam.getInstance().getLoginParam(getApplication(), SaveParam.YANGJI); |
100 | if ("1".equals(yangji)) { | 100 | if ("1".equals(yangji)) { |
101 | results = null; | 101 | results = null; |
102 | } else { | 102 | } else { |
103 | results = gson.toJson(dataBean); | 103 | results = gson.toJson(dataBean); |
104 | } | 104 | } |
105 | 105 | ||
106 | return results; | 106 | return results; |
107 | 107 | ||
108 | } | 108 | } |
109 | 109 | ||
110 | @Override | 110 | @Override |
111 | public String getUserInfo() throws RemoteException { | 111 | public String getUserInfo() throws RemoteException { |
112 | String userinfo = null; | 112 | String userinfo = null; |
113 | Gson gson = new Gson(); | 113 | Gson gson = new Gson(); |
114 | UserInfoModer userInfoModer = new UserInfoModer(); | 114 | UserInfoModer userInfoModer = new UserInfoModer(); |
115 | userInfoModer.setNickName(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTUSERNAME)); | 115 | userInfoModer.setNickName(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTUSERNAME)); |
116 | userInfoModer.setGrade(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTGRADES)); | 116 | userInfoModer.setGrade(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTGRADES)); |
117 | userInfoModer.setSchool(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSCHOOL)); | 117 | userInfoModer.setSchool(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSCHOOL)); |
118 | userInfoModer.setBirthday(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTCONSTELLATION)); | 118 | userInfoModer.setBirthday(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTCONSTELLATION)); |
119 | userInfoModer.setGender(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSEX)); | 119 | userInfoModer.setGender(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSEX)); |
120 | userInfoModer.setQq(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTQQ)); | 120 | userInfoModer.setQq(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTQQ)); |
121 | userInfoModer.setAddress(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTADRESS)); | 121 | userInfoModer.setAddress(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTADRESS)); |
122 | userInfoModer.setPortrait(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.PORTAIT)); | 122 | userInfoModer.setPortrait(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.PORTAIT)); |
123 | userInfoModer.setGradeid(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.GRADENS)); | 123 | userInfoModer.setGradeid(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.GRADENS)); |
124 | userInfoModer.setIsprototype(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.YANGJI)); | 124 | userInfoModer.setIsprototype(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.YANGJI)); |
125 | userinfo = gson.toJson(userInfoModer); | 125 | userinfo = gson.toJson(userInfoModer); |
126 | return userinfo; | 126 | return userinfo; |
127 | } | 127 | } |
128 | 128 | ||
129 | @Override | 129 | @Override |
130 | public String logout() throws RemoteException { | 130 | public String logout() throws RemoteException { |
131 | String visoninfo = SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.VERSIONINTEFACE); | 131 | String visoninfo = SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.VERSIONINTEFACE); |
132 | return visoninfo; | 132 | return visoninfo; |
133 | } | 133 | } |
134 | 134 | ||
135 | @Override | 135 | @Override |
136 | public String validateToken() throws RemoteException { | 136 | public String validateToken() throws RemoteException { |
137 | return null; | 137 | return null; |
138 | } | 138 | } |
139 | 139 | ||
140 | @Override | 140 | @Override |
141 | public String getDeviceID() throws RemoteException { | 141 | public String getDeviceID() throws RemoteException { |
142 | return null; | 142 | return null; |
143 | } | 143 | } |
144 | 144 | ||
145 | @Override | 145 | @Override |
146 | public String getChildsInfo() throws RemoteException { | 146 | public String getChildsInfo() throws RemoteException { |
147 | return null; | 147 | return null; |
148 | } | 148 | } |
149 | }; | 149 | }; |
150 | 150 | ||
151 | @Override | 151 | @Override |
152 | public IBinder onBind(Intent intent) { | 152 | public IBinder onBind(Intent intent) { |
153 | return binder; | 153 | return binder; |
154 | } | 154 | } |
155 | 155 | ||
156 | @Override | 156 | @Override |
157 | public void onDestroy() { | 157 | public void onDestroy() { |
158 | super.onDestroy(); | 158 | super.onDestroy(); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/thirdparty/SlidingTabLayout.java
1 | package com.hjx.personalcenter.thirdparty; | 1 | package com.hjx.personalcenter.thirdparty; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.content.Context; |
4 | import android.graphics.Bitmap; | 4 | import android.graphics.Bitmap; |
5 | import android.graphics.BitmapFactory; | 5 | import android.graphics.BitmapFactory; |
6 | import android.graphics.Canvas; | 6 | import android.graphics.Canvas; |
7 | import android.support.v4.view.ViewPager; | 7 | import android.support.v4.view.ViewPager; |
8 | import android.support.v4.view.ViewPager.OnPageChangeListener; | 8 | import android.support.v4.view.ViewPager.OnPageChangeListener; |
9 | import android.util.AttributeSet; | 9 | import android.util.AttributeSet; |
10 | import android.util.DisplayMetrics; | 10 | import android.util.DisplayMetrics; |
11 | import android.util.TypedValue; | 11 | import android.util.TypedValue; |
12 | import android.view.Gravity; | 12 | import android.view.Gravity; |
13 | import android.view.View; | 13 | import android.view.View; |
14 | import android.view.WindowManager; | 14 | import android.view.WindowManager; |
15 | import android.widget.HorizontalScrollView; | 15 | import android.widget.HorizontalScrollView; |
16 | import android.widget.LinearLayout; | 16 | import android.widget.LinearLayout; |
17 | import android.widget.TextView; | 17 | import android.widget.TextView; |
18 | 18 | ||
19 | import com.hjx.personalcenter.R; | 19 | import com.hjx.personalcenter.R; |
20 | import com.hjx.personalcenter.util.CropUtils; | ||
20 | 21 | ||
21 | import java.util.List; | 22 | import java.util.List; |
22 | 23 | ||
23 | /** | 24 | /** |
24 | * 首页滑动条 | 25 | * 首页滑动条 |
25 | * | 26 | * |
26 | * @author gaok | 27 | * @author gaok |
27 | * @date 2017/7/6 | 28 | * @date 2017/7/6 |
28 | */ | 29 | */ |
29 | public class SlidingTabLayout extends HorizontalScrollView { | 30 | public class SlidingTabLayout extends HorizontalScrollView { |
30 | private Context mContext; | 31 | private Context mContext; |
31 | private int selection = 0; | 32 | private int selection = 0; |
32 | /** | 33 | /** |
33 | * tab容器 | 34 | * tab容器 |
34 | */ | 35 | */ |
35 | private LinearLayout mItemsLayout; | 36 | private LinearLayout mItemsLayout; |
36 | /** | 37 | /** |
37 | * 指示器 | 38 | * 指示器 |
38 | */ | 39 | */ |
39 | private Bitmap mSlideIcon; | 40 | private Bitmap mSlideIcon; |
40 | /** | 41 | /** |
41 | * 指示器初始X偏移量 | 42 | * 指示器初始X偏移量 |
42 | */ | 43 | */ |
43 | private int mInitTranslationX; | 44 | private int mInitTranslationX; |
44 | /** | 45 | /** |
45 | * 指示器初始Y偏移量 | 46 | * 指示器初始Y偏移量 |
46 | */ | 47 | */ |
47 | private int mInitTranslationY; | 48 | private int mInitTranslationY; |
48 | /** | 49 | /** |
49 | * 滑动过程中指示器的水平偏移量 | 50 | * 滑动过程中指示器的水平偏移量 |
50 | */ | 51 | */ |
51 | private int mTranslationX; | 52 | private int mTranslationX; |
52 | /** | 53 | /** |
53 | * tab总数 | 54 | * tab总数 |
54 | */ | 55 | */ |
55 | private int mTotalItemsCount; | 56 | private int mTotalItemsCount; |
56 | /** | 57 | /** |
57 | * 指示器绘制数据的初始化标志 | 58 | * 指示器绘制数据的初始化标志 |
58 | */ | 59 | */ |
59 | private boolean isFirstTime = true; | 60 | private boolean isFirstTime = true; |
60 | /** | 61 | /** |
61 | * 页面可见的tab数量,默认4个 | 62 | * 页面可见的tab数量,默认4个 |
62 | */ | 63 | */ |
63 | private int VISIBLE_TAB_COUNT = 2; | 64 | private int VISIBLE_TAB_COUNT = 2; |
64 | /** | 65 | /** |
65 | * 移动到倒数第几个,容器开始滑动 | 66 | * 移动到倒数第几个,容器开始滑动 |
66 | */ | 67 | */ |
67 | private int START_SCROLL = 2; | 68 | private int START_SCROLL = 2; |
68 | /** | 69 | /** |
69 | * 标题正常时的颜色 | 70 | * 标题正常时的颜色 |
70 | */ | 71 | */ |
71 | private static final int COLOR_TEXT_NORMAL = 0xFF666666; | 72 | private static final int COLOR_TEXT_NORMAL = 0xFF666666; |
72 | /** | 73 | /** |
73 | * 标题选中时的颜色 | 74 | * 标题选中时的颜色 |
74 | */ | 75 | */ |
75 | private static final int COLOR_TEXT_HIGHLIGHTCOLOR = 0xFF21c4ff; | 76 | private static final int COLOR_TEXT_HIGHLIGHTCOLOR = 0xFF21c4ff; |
76 | private ViewPager mViewPager; | 77 | private ViewPager mViewPager; |
77 | private List<String> mTabTitles; | 78 | private List<String> mTabTitles; |
78 | private int mTabVisibleCount = VISIBLE_TAB_COUNT; | 79 | private int mTabVisibleCount = VISIBLE_TAB_COUNT; |
79 | private OnPageChangeListener onPageChangeListener; | 80 | private OnPageChangeListener onPageChangeListener; |
80 | 81 | ||
81 | public SlidingTabLayout(Context context) { | 82 | public SlidingTabLayout(Context context) { |
82 | this(context, null); | 83 | this(context, null); |
83 | } | 84 | } |
84 | 85 | ||
85 | public SlidingTabLayout(Context context, AttributeSet attrs) { | 86 | public SlidingTabLayout(Context context, AttributeSet attrs) { |
86 | super(context, attrs); | 87 | super(context, attrs); |
87 | this.mContext = context; | 88 | this.mContext = context; |
88 | this.mSlideIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.blank); | 89 | this.mSlideIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.blank); |
89 | this.mItemsLayout = new LinearLayout(context); | 90 | this.mItemsLayout = new LinearLayout(context); |
90 | initTabStripParams(); | 91 | initTabStripParams(); |
91 | addView(mItemsLayout, 0, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); | 92 | addView(mItemsLayout, 0, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); |
92 | } | 93 | } |
93 | 94 | ||
94 | public void scroll(int position, float positionOffset) { | 95 | public void scroll(int position, float positionOffset) { |
95 | int tabWidth = mItemsLayout.getChildAt(position).getWidth(); | 96 | int tabWidth = mItemsLayout.getChildAt(position).getWidth(); |
96 | mTranslationX = (int) ((position + positionOffset) * tabWidth); | 97 | mTranslationX = (int) ((position + positionOffset) * tabWidth); |
97 | 98 | ||
98 | // 容器滚动,当移动到倒数最后一个的时候,开始滚动 | 99 | // 容器滚动,当移动到倒数最后一个的时候,开始滚动 |
99 | if (positionOffset > 0 && position >= (VISIBLE_TAB_COUNT - START_SCROLL) && mTotalItemsCount > VISIBLE_TAB_COUNT) { | 100 | if (positionOffset > 0 && position >= (VISIBLE_TAB_COUNT - START_SCROLL) && mTotalItemsCount > VISIBLE_TAB_COUNT) { |
100 | if (VISIBLE_TAB_COUNT != 1) { | 101 | if (VISIBLE_TAB_COUNT != 1) { |
101 | //注意这里是整体滑动,使得tabs跟指示器保持相对静止 | 102 | //注意这里是整体滑动,使得tabs跟指示器保持相对静止 |
102 | this.scrollTo((position - (VISIBLE_TAB_COUNT - START_SCROLL)) * tabWidth + (int) (tabWidth * positionOffset), 0); | 103 | this.scrollTo((position - (VISIBLE_TAB_COUNT - START_SCROLL)) * tabWidth + (int) (tabWidth * positionOffset), 0); |
103 | } else | 104 | } else |
104 | // 为count为1时 的特殊处理 | 105 | // 为count为1时 的特殊处理 |
105 | { | 106 | { |
106 | this.scrollTo(position * tabWidth + (int) (tabWidth * positionOffset), 0); | 107 | this.scrollTo(position * tabWidth + (int) (tabWidth * positionOffset), 0); |
107 | } | 108 | } |
108 | } | 109 | } |
109 | invalidate(); | 110 | invalidate(); |
110 | } | 111 | } |
111 | 112 | ||
112 | private void initTabStripParams() { | 113 | private void initTabStripParams() { |
113 | mItemsLayout.setClipChildren(false); | 114 | mItemsLayout.setClipChildren(false); |
114 | mItemsLayout.setClipToPadding(false); | 115 | mItemsLayout.setClipToPadding(false); |
115 | mItemsLayout.setGravity(Gravity.BOTTOM); | 116 | mItemsLayout.setGravity(Gravity.BOTTOM); |
116 | mItemsLayout.setPadding(0, 0, 0, 0); | 117 | mItemsLayout.setPadding(0, 0, 0, 0); |
117 | } | 118 | } |
118 | 119 | ||
119 | /** | 120 | /** |
120 | * 绘制指示器 | 121 | * 绘制指示器 |
121 | */ | 122 | */ |
122 | @Override | 123 | @Override |
123 | protected void dispatchDraw(Canvas canvas) { | 124 | protected void dispatchDraw(Canvas canvas) { |
124 | canvas.save(); | 125 | canvas.save(); |
125 | // 平移到正确的位置 | 126 | // 平移到正确的位置 |
126 | canvas.translate(mInitTranslationX + mTranslationX, this.mInitTranslationY);//修正tabs的平移量 | 127 | canvas.translate(mInitTranslationX + mTranslationX, this.mInitTranslationY);//修正tabs的平移量 |
127 | canvas.drawBitmap(this.mSlideIcon, 0, 0, null); | 128 | canvas.drawBitmap(this.mSlideIcon, 0, 0, null); |
128 | canvas.restore(); | 129 | canvas.restore(); |
129 | super.dispatchDraw(canvas); | 130 | super.dispatchDraw(canvas); |
130 | } | 131 | } |
131 | 132 | ||
132 | @Override | 133 | @Override |
133 | protected void onLayout(boolean changed, int l, int t, int r, int b) { | 134 | protected void onLayout(boolean changed, int l, int t, int r, int b) { |
134 | super.onLayout(changed, l, t, r, b); | 135 | super.onLayout(changed, l, t, r, b); |
135 | if (isFirstTime && (mTotalItemsCount > 0) && getItemView(this.selection) != null) { | 136 | if (isFirstTime && (mTotalItemsCount > 0) && getItemView(this.selection) != null) { |
136 | View currentItemView = getItemView(this.selection); | 137 | View currentItemView = getItemView(this.selection); |
137 | this.mInitTranslationX = (currentItemView.getLeft() + currentItemView.getWidth() / 2 - this.mSlideIcon.getWidth() / 2); | 138 | this.mInitTranslationX = (currentItemView.getLeft() + currentItemView.getWidth() / 2 - this.mSlideIcon.getWidth() / 2); |
138 | this.mInitTranslationY = (b - t - this.mSlideIcon.getHeight()); | 139 | this.mInitTranslationY = (b - t - this.mSlideIcon.getHeight()); |
139 | isFirstTime = false; | 140 | isFirstTime = false; |
140 | } | 141 | } |
141 | } | 142 | } |
142 | 143 | ||
143 | public void setVisibleTabCount(int VISIBLE_TAB_COUNT) { | 144 | public void setVisibleTabCount(int VISIBLE_TAB_COUNT) { |
144 | this.VISIBLE_TAB_COUNT = VISIBLE_TAB_COUNT; | 145 | this.VISIBLE_TAB_COUNT = VISIBLE_TAB_COUNT; |
145 | } | 146 | } |
146 | 147 | ||
147 | public void setStartScroll(int START_SCROLL) { | 148 | public void setStartScroll(int START_SCROLL) { |
148 | this.START_SCROLL = START_SCROLL; | 149 | this.START_SCROLL = START_SCROLL; |
149 | } | 150 | } |
150 | 151 | ||
151 | public View getItemView(int itemPosition) { | 152 | public View getItemView(int itemPosition) { |
152 | if ((itemPosition >= 0) && (itemPosition < this.mTotalItemsCount)) { | 153 | if ((itemPosition >= 0) && (itemPosition < this.mTotalItemsCount)) { |
153 | return this.mItemsLayout.getChildAt(itemPosition); | 154 | return this.mItemsLayout.getChildAt(itemPosition); |
154 | } | 155 | } |
155 | return null; | 156 | return null; |
156 | } | 157 | } |
157 | 158 | ||
158 | public void setData(List<String> datas) { | 159 | public void setData(List<String> datas) { |
159 | mTotalItemsCount = 0; | 160 | mTotalItemsCount = 0; |
160 | // 如果传入的list有值,则移除布局文件中设置的view | 161 | // 如果传入的list有值,则移除布局文件中设置的view |
161 | if (datas != null && datas.size() > 0) { | 162 | if (datas != null && datas.size() > 0) { |
162 | this.mItemsLayout.removeAllViews(); | 163 | this.mItemsLayout.removeAllViews(); |
163 | this.mTabTitles = datas; | 164 | this.mTabTitles = datas; |
164 | 165 | ||
165 | for (String title : mTabTitles) { | 166 | for (String title : mTabTitles) { |
166 | // 添加view | 167 | // 添加view |
167 | this.mItemsLayout.addView(generateTextView(title)); | 168 | this.mItemsLayout.addView(generateTextView(title)); |
168 | mTotalItemsCount++; | 169 | mTotalItemsCount++; |
169 | } | 170 | } |
170 | // 设置item的click事件 | 171 | // 设置item的click事件 |
171 | setItemClickEvent(); | 172 | setItemClickEvent(); |
172 | } | 173 | } |
173 | } | 174 | } |
174 | 175 | ||
175 | /** | 176 | /** |
176 | * 对外的ViewPager的回调接口 | 177 | * 对外的ViewPager的回调接口 |
177 | * | 178 | * |
178 | * @author zhy | 179 | * @author zhy |
179 | */ | 180 | */ |
180 | public interface PageChangeListener { | 181 | public interface PageChangeListener { |
181 | void onPageScrolled(int position, float positionOffset, int positionOffsetPixels); | 182 | void onPageScrolled(int position, float positionOffset, int positionOffsetPixels); |
182 | 183 | ||
183 | void onPageSelected(int position); | 184 | void onPageSelected(int position); |
184 | 185 | ||
185 | void onPageScrollStateChanged(int state); | 186 | void onPageScrollStateChanged(int state); |
186 | } | 187 | } |
187 | 188 | ||
188 | // 设置关联的ViewPager | 189 | // 设置关联的ViewPager |
189 | public void setViewPager(ViewPager mViewPager, int pos) { | 190 | public void setViewPager(ViewPager mViewPager, int pos) { |
190 | this.mViewPager = mViewPager; | 191 | this.mViewPager = mViewPager; |
191 | 192 | ||
192 | mViewPager.addOnPageChangeListener(new OnPageChangeListener() { | 193 | mViewPager.addOnPageChangeListener(new OnPageChangeListener() { |
193 | @Override | 194 | @Override |
194 | public void onPageSelected(int position) { | 195 | public void onPageSelected(int position) { |
195 | // 设置字体颜色高亮 | 196 | // 设置字体颜色高亮 |
196 | resetTextViewColor(); | 197 | resetTextViewColor(); |
197 | highLightTextView(position); | 198 | highLightTextView(position); |
198 | 199 | ||
199 | // 回调 | 200 | // 回调 |
200 | if (onPageChangeListener != null) { | 201 | if (onPageChangeListener != null) { |
201 | onPageChangeListener.onPageSelected(position); | 202 | onPageChangeListener.onPageSelected(position); |
202 | } | 203 | } |
203 | } | 204 | } |
204 | 205 | ||
205 | @Override | 206 | @Override |
206 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | 207 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { |
207 | // 滚动 | 208 | // 滚动 |
208 | scroll(position, positionOffset); | 209 | scroll(position, positionOffset); |
209 | 210 | ||
210 | // 回调 | 211 | // 回调 |
211 | if (onPageChangeListener != null) { | 212 | if (onPageChangeListener != null) { |
212 | onPageChangeListener.onPageScrolled(position, positionOffset, positionOffsetPixels); | 213 | onPageChangeListener.onPageScrolled(position, positionOffset, positionOffsetPixels); |
213 | } | 214 | } |
214 | 215 | ||
215 | } | 216 | } |
216 | 217 | ||
217 | @Override | 218 | @Override |
218 | public void onPageScrollStateChanged(int state) { | 219 | public void onPageScrollStateChanged(int state) { |
219 | // 回调 | 220 | // 回调 |
220 | if (onPageChangeListener != null) { | 221 | if (onPageChangeListener != null) { |
221 | onPageChangeListener.onPageScrollStateChanged(state); | 222 | onPageChangeListener.onPageScrollStateChanged(state); |
222 | } | 223 | } |
223 | 224 | ||
224 | } | 225 | } |
225 | }); | 226 | }); |
226 | // 设置当前页 | 227 | // 设置当前页 |
227 | mViewPager.setCurrentItem(pos); | 228 | mViewPager.setCurrentItem(pos); |
228 | // 高亮 | 229 | // 高亮 |
229 | highLightTextView(pos); | 230 | highLightTextView(pos); |
230 | } | 231 | } |
231 | 232 | ||
232 | /** | 233 | /** |
233 | * 重置文本颜色 | 234 | * 重置文本颜色 |
234 | */ | 235 | */ |
235 | private void resetTextViewColor() { | 236 | private void resetTextViewColor() { |
236 | for (int i = 0; i < mItemsLayout.getChildCount(); i++) { | 237 | for (int i = 0; i < mItemsLayout.getChildCount(); i++) { |
237 | View view = mItemsLayout.getChildAt(i); | 238 | View view = mItemsLayout.getChildAt(i); |
238 | if (view instanceof TextView) { | 239 | if (view instanceof TextView) { |
239 | ((TextView) view).setTextColor(COLOR_TEXT_NORMAL); | 240 | ((TextView) view).setTextColor(COLOR_TEXT_NORMAL); |
240 | } | 241 | } |
241 | } | 242 | } |
242 | } | 243 | } |
243 | 244 | ||
244 | /** | 245 | /** |
245 | * 高亮文本 | 246 | * 高亮文本 |
246 | * | 247 | * |
247 | * @param position | 248 | * @param position |
248 | */ | 249 | */ |
249 | protected void highLightTextView(int position) { | 250 | protected void highLightTextView(int position) { |
250 | View view = mItemsLayout.getChildAt(position); | 251 | View view = mItemsLayout.getChildAt(position); |
251 | if (view instanceof TextView) { | 252 | if (view instanceof TextView) { |
252 | ((TextView) view).setTextColor(COLOR_TEXT_HIGHLIGHTCOLOR); | 253 | ((TextView) view).setTextColor(COLOR_TEXT_HIGHLIGHTCOLOR); |
253 | } | 254 | } |
254 | 255 | ||
255 | } | 256 | } |
256 | 257 | ||
257 | private void setItemClickEvent() { | 258 | private void setItemClickEvent() { |
258 | int cCount = mItemsLayout.getChildCount(); | 259 | int cCount = mItemsLayout.getChildCount(); |
259 | for (int i = 0; i < cCount; i++) { | 260 | for (int i = 0; i < cCount; i++) { |
260 | final int j = i; | 261 | final int j = i; |
261 | View view = mItemsLayout.getChildAt(i); | 262 | View view = mItemsLayout.getChildAt(i); |
262 | view.setOnClickListener(new OnClickListener() { | 263 | view.setOnClickListener(new OnClickListener() { |
263 | @Override | 264 | @Override |
264 | public void onClick(View v) { | 265 | public void onClick(View v) { |
265 | mViewPager.setCurrentItem(j); | 266 | mViewPager.setCurrentItem(j); |
266 | } | 267 | } |
267 | }); | 268 | }); |
268 | } | 269 | } |
269 | } | 270 | } |
270 | 271 | ||
271 | /** | 272 | /** |
272 | * 根据标题生成我们的TextView | 273 | * 根据标题生成我们的TextView |
273 | * | 274 | * |
274 | * @param text | 275 | * @param text |
275 | * @return | 276 | * @return |
276 | */ | 277 | */ |
277 | private TextView generateTextView(String text) { | 278 | private TextView generateTextView(String text) { |
278 | TextView tv = new TextView(getContext()); | 279 | TextView tv = new TextView(getContext()); |
279 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); | 280 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); |
280 | lp.width = getScreenWidth() / mTabVisibleCount; | 281 | lp.width = CropUtils.dp2px(getContext(),550) / mTabVisibleCount; |
281 | tv.setGravity(Gravity.CENTER); | 282 | tv.setGravity(Gravity.CENTER); |
282 | tv.setTextColor(COLOR_TEXT_NORMAL); | 283 | tv.setTextColor(COLOR_TEXT_NORMAL); |
283 | tv.setText(text); | 284 | tv.setText(text); |
284 | tv.setTextSize(TypedValue.TYPE_NULL, 34); | 285 | tv.setTextSize(TypedValue.TYPE_NULL, CropUtils.sp2px(getContext(),23)); |
285 | tv.setLayoutParams(lp); | 286 | tv.setLayoutParams(lp); |
286 | return tv; | 287 | return tv; |
287 | } | 288 | } |
288 | 289 | ||
289 | /** | 290 | /** |
290 | * 获得屏幕的宽度 | 291 | * 获得屏幕的宽度 |
291 | * | 292 | * |
292 | * @return | 293 | * @return |
293 | */ | 294 | */ |
294 | public int getScreenWidth() { | 295 | public int getScreenWidth() { |
295 | WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); | 296 | WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); |
296 | DisplayMetrics outMetrics = new DisplayMetrics(); | 297 | DisplayMetrics outMetrics = new DisplayMetrics(); |
297 | wm.getDefaultDisplay().getMetrics(outMetrics); | 298 | wm.getDefaultDisplay().getMetrics(outMetrics); |
298 | return outMetrics.widthPixels; | 299 | return outMetrics.widthPixels; |
299 | } | 300 | } |
300 | 301 | ||
301 | public LinearLayout getLinearLayout() { | 302 | public LinearLayout getLinearLayout() { |
302 | return mItemsLayout; | 303 | return mItemsLayout; |
303 | } | 304 | } |
304 | } | 305 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/update/DownloadService.java
1 | package com.hjx.personalcenter.update; | 1 | package com.hjx.personalcenter.update; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Created by l on 2017/7/17. | 4 | * Created by l on 2017/7/17. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | 7 | ||
8 | import android.app.IntentService; | 8 | import android.app.IntentService; |
9 | import android.content.Intent; | 9 | import android.content.Intent; |
10 | import android.os.Bundle; | 10 | import android.os.Bundle; |
11 | import android.os.ResultReceiver; | 11 | import android.os.ResultReceiver; |
12 | 12 | ||
13 | import java.io.BufferedInputStream; | 13 | import java.io.BufferedInputStream; |
14 | import java.io.FileOutputStream; | 14 | import java.io.FileOutputStream; |
15 | import java.io.IOException; | 15 | import java.io.IOException; |
16 | import java.io.InputStream; | 16 | import java.io.InputStream; |
17 | import java.io.OutputStream; | 17 | import java.io.OutputStream; |
18 | import java.net.HttpURLConnection; | ||
18 | import java.net.URL; | 19 | import java.net.URL; |
19 | import java.net.URLConnection; | 20 | import java.net.URLConnection; |
20 | 21 | ||
21 | public class DownloadService extends IntentService { | 22 | public class DownloadService extends IntentService { |
22 | public static final int UPDATE_PROGRESS = 8344; | 23 | public static final int UPDATE_PROGRESS = 8344; |
23 | public DownloadService() { | 24 | public DownloadService() { |
24 | super("DownloadService"); | 25 | super("DownloadService"); |
25 | } | 26 | } |
26 | @Override | 27 | @Override |
27 | protected void onHandleIntent(Intent intent) { | 28 | protected void onHandleIntent(Intent intent) { |
28 | String urlToDownload = intent.getStringExtra("url"); | 29 | String urlToDownload = intent.getStringExtra("url"); |
29 | String fileDestination = intent.getStringExtra("dest"); | 30 | String fileDestination = intent.getStringExtra("dest"); |
30 | ResultReceiver receiver = (ResultReceiver) intent.getParcelableExtra("receiver"); | 31 | ResultReceiver receiver = (ResultReceiver) intent.getParcelableExtra("receiver"); |
31 | try { | 32 | try { |
32 | URL url = new URL(urlToDownload); | 33 | URL url = new URL(urlToDownload); |
33 | URLConnection connection = url.openConnection(); | 34 | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
34 | connection.connect(); | 35 | connection.connect(); |
35 | // this will be useful so that you can show a typical 0-100% progress bar | 36 | // this will be useful so that you can show a typical 0-100% progress bar |
36 | int fileLength = connection.getContentLength(); | 37 | int fileLength = connection.getContentLength(); |
37 | // download the file | 38 | // download the file |
38 | InputStream input = new BufferedInputStream(connection.getInputStream()); | 39 | InputStream input = new BufferedInputStream(connection.getInputStream()); |
39 | OutputStream output = new FileOutputStream(fileDestination); | 40 | OutputStream output = new FileOutputStream(fileDestination); |
40 | byte data[] = new byte[100]; | 41 | byte data[] = new byte[1024]; |
41 | long total = 0; | 42 | long total = 0; |
42 | int count; | 43 | int count; |
43 | while ((count = input.read(data)) != -1) { | 44 | while ((count = input.read(data)) != -1) { |
44 | total += count; | 45 | total += count; |
45 | // publishing the progress.... | 46 | // publishing the progress.... |
46 | Bundle resultData = new Bundle(); | 47 | Bundle resultData = new Bundle(); |
47 | resultData.putInt("progress" ,(int) (total * 100 / fileLength)); | 48 | resultData.putInt("progress" , (int) (((float) total / fileLength) * 100));// 得到当前进度); |
48 | receiver.send(UPDATE_PROGRESS, resultData); | 49 | receiver.send(UPDATE_PROGRESS, resultData); |
49 | output.write(data, 0, count); | 50 | output.write(data, 0, count); |
50 | } | 51 | } |
51 | output.flush(); | 52 | output.flush(); |
52 | output.close(); | 53 | output.close(); |
53 | input.close(); | 54 | input.close(); |
54 | } catch (IOException e) { | 55 | } catch (IOException e) { |
55 | e.printStackTrace(); | 56 | e.printStackTrace(); |
56 | } | 57 | } |
57 | Bundle resultData = new Bundle(); | 58 | Bundle resultData = new Bundle(); |
58 | resultData.putInt("progress" ,100); | 59 | resultData.putInt("progress" ,100); |
59 | receiver.send(UPDATE_PROGRESS, resultData); | 60 | receiver.send(UPDATE_PROGRESS, resultData); |
60 | } | 61 | } |
61 | } | 62 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/update/UpdateChecker.java
1 | package com.hjx.personalcenter.update; | 1 | package com.hjx.personalcenter.update; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Created by l on 2017/7/17. | 4 | * Created by l on 2017/7/17. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | import android.app.Activity; | 7 | import android.app.Activity; |
8 | import android.app.AlertDialog; | ||
9 | import android.app.Dialog; | ||
8 | import android.app.ProgressDialog; | 10 | import android.app.ProgressDialog; |
9 | import android.content.Context; | 11 | import android.content.Context; |
10 | import android.content.DialogInterface; | 12 | import android.content.DialogInterface; |
11 | import android.content.Intent; | 13 | import android.content.Intent; |
12 | import android.content.pm.PackageManager; | 14 | import android.content.pm.PackageManager; |
13 | import android.net.Uri; | 15 | import android.net.Uri; |
14 | import android.os.Bundle; | 16 | import android.os.Bundle; |
15 | import android.os.Environment; | 17 | import android.os.Environment; |
16 | import android.os.Handler; | 18 | import android.os.Handler; |
17 | import android.os.Message; | 19 | import android.os.Message; |
18 | import android.os.ResultReceiver; | 20 | import android.os.ResultReceiver; |
19 | import android.support.v4.app.FragmentActivity; | 21 | import android.support.v4.app.FragmentActivity; |
20 | import android.view.View; | 22 | import android.view.View; |
21 | 23 | ||
22 | import com.hjx.personalcenter.http.HttpCode; | 24 | import com.hjx.personalcenter.http.HttpCode; |
23 | import com.hjx.personalcenter.http.HttpManager; | 25 | import com.hjx.personalcenter.http.HttpManager; |
24 | import com.hjx.personalcenter.model.AppVersion; | 26 | import com.hjx.personalcenter.model.AppVersion; |
25 | import com.mylhyl.circledialog.CircleDialog; | 27 | import com.mylhyl.circledialog.CircleDialog; |
26 | 28 | ||
27 | import java.io.File; | 29 | import java.io.File; |
28 | import java.util.ArrayList; | 30 | import java.util.ArrayList; |
29 | 31 | ||
30 | public class UpdateChecker{ | 32 | public class UpdateChecker{ |
31 | private static final String TAG = "UpdateChecker"; | 33 | private static final String TAG = "UpdateChecker"; |
32 | private Context mContext; | 34 | private Context mContext; |
33 | //检查版本信息的线程 | 35 | //检查版本信息的线程 |
34 | private Thread mThread; | 36 | private Thread mThread; |
35 | 37 | ||
36 | private ArrayList<AppVersion> mAppVersion; | 38 | private ArrayList<AppVersion> mAppVersion; |
37 | //下载apk的对话框 | 39 | //下载apk的对话框 |
38 | private ProgressDialog mProgressDialog; | 40 | private ProgressDialog mProgressDialog; |
39 | 41 | ||
40 | private File apkFile; | 42 | private File apkFile; |
41 | private int visncode; | 43 | private int visncode; |
42 | private String downUrl; | 44 | private String downUrl; |
43 | private String msgs; | 45 | private String msgs; |
44 | private String qiangzi; | 46 | private String qiangzi; |
45 | 47 | ||
46 | Handler handler = new Handler(){ | 48 | Handler handler = new Handler(){ |
47 | public void handleMessage(Message msg) { | 49 | public void handleMessage(Message msg) { |
48 | if (msg.what == HttpCode.APPUPDATE_SUCESS) { | 50 | if (msg.what == HttpCode.APPUPDATE_SUCESS) { |
49 | mAppVersion = (ArrayList<AppVersion>) msg.obj; | 51 | mAppVersion = (ArrayList<AppVersion>) msg.obj; |
50 | for (AppVersion appVersion : mAppVersion){ | 52 | for (AppVersion appVersion : mAppVersion){ |
51 | visncode = appVersion.getVersioncode(); | 53 | visncode = appVersion.getVersioncode(); |
52 | downUrl = appVersion.getUrl(); | 54 | downUrl = appVersion.getUrl(); |
53 | msgs = appVersion.getMsg(); | 55 | msgs = appVersion.getMsg(); |
54 | qiangzi = appVersion.getForceupdate(); | 56 | qiangzi = appVersion.getForceupdate(); |
55 | } | 57 | } |
56 | try{ | 58 | try{ |
57 | int versionCode = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionCode; | 59 | int versionCode = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionCode; |
58 | if (visncode > versionCode) { | 60 | if (visncode > versionCode) { |
59 | if("true".equals(qiangzi)){ | 61 | if("true".equals(qiangzi)){ |
60 | showForceUpdateDialog(); | 62 | showForceUpdateDialog(); |
61 | }else{ | 63 | }else{ |
62 | showUpdateDialog(); | 64 | showUpdateDialog(); |
63 | } | 65 | } |
64 | } else { | 66 | } else { |
65 | //Toast.makeText(mContext, "已经是最新版本", Toast.LENGTH_SHORT).show(); | 67 | //Toast.makeText(mContext, "已经是最新版本", Toast.LENGTH_SHORT).show(); |
66 | } | 68 | } |
67 | }catch (PackageManager.NameNotFoundException ignored) { | 69 | }catch (PackageManager.NameNotFoundException ignored) { |
68 | // | 70 | // |
69 | } | 71 | } |
70 | } | 72 | } |
71 | } | 73 | } |
72 | }; | 74 | }; |
73 | public UpdateChecker(Context context) { | 75 | public UpdateChecker(Context context) { |
74 | mContext = context; | 76 | mContext = context; |
75 | // instantiate it within the onCreate method | 77 | // instantiate it within the onCreate method |
76 | mProgressDialog = new ProgressDialog(context); | 78 | mProgressDialog = new ProgressDialog(context); |
77 | mProgressDialog.setMessage("正在下载"); | 79 | mProgressDialog.setMessage("正在下载"); |
78 | mProgressDialog.setIndeterminate(false); | 80 | mProgressDialog.setIndeterminate(false); |
79 | mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); | 81 | mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); |
80 | mProgressDialog.setCancelable(true); | 82 | mProgressDialog.setCancelable(false); |
81 | mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { | 83 | mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { |
82 | @Override | 84 | @Override |
83 | public void onCancel(DialogInterface dialog) { | 85 | public void onCancel(DialogInterface dialog) { |
84 | 86 | ||
85 | } | 87 | } |
86 | }); | 88 | }); |
87 | mProgressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { | 89 | mProgressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { |
88 | @Override | 90 | @Override |
89 | public void onDismiss(DialogInterface dialog) { | 91 | public void onDismiss(DialogInterface dialog) { |
90 | // TODO Auto-generated method stub | 92 | // TODO Auto-generated method stub |
91 | 93 | ||
92 | } | 94 | } |
93 | }); | 95 | }); |
94 | } | 96 | } |
95 | 97 | ||
96 | public void checkForUpdates() { | 98 | public void checkForUpdates() { |
97 | 99 | ||
98 | 100 | ||
99 | // mThread = new Thread() { | 101 | // mThread = new Thread() { |
100 | // @Override | 102 | // @Override |
101 | // public void run() { | 103 | // public void run() { |
102 | // try { | 104 | // try { |
103 | HttpManager.getInstance().updateAPP(mContext,"com.hjx.personalcenter","个人中心",handler); | 105 | HttpManager.getInstance().updateAPP(mContext,"com.hjx.personalcenter","个人中心",handler); |
104 | // }catch (Exception e){ | 106 | // }catch (Exception e){ |
105 | // e.printStackTrace(); | 107 | // e.printStackTrace(); |
106 | // } | 108 | // } |
107 | // | 109 | // |
108 | // } | 110 | // } |
109 | // }; | 111 | // }; |
110 | // mThread.start(); | 112 | // mThread.start(); |
111 | } | 113 | } |
112 | 114 | ||
113 | private void showForceUpdateDialog() { | 115 | private void showForceUpdateDialog() { |
114 | new CircleDialog.Builder((FragmentActivity)mContext) | 116 | AlertDialog.Builder builder = new AlertDialog.Builder( |
115 | .setCanceledOnTouchOutside(false) | 117 | mContext); |
116 | .setCancelable(false) | 118 | builder.setTitle("检查到新版本,是否更新?"); |
117 | .setWidth(0.5f) | 119 | builder.setMessage(msgs); |
118 | .setTitle("升级提示") | 120 | builder.setNegativeButton("退出", |
119 | .setText(msgs) | 121 | new android.content.DialogInterface.OnClickListener() { |
120 | .setNegative("取消", new View.OnClickListener() { | ||
121 | @Override | ||
122 | public void onClick(View v) { | ||
123 | ((Activity)mContext).finish(); | ||
124 | 122 | ||
123 | @Override | ||
124 | public void onClick(DialogInterface dialog, int which) { | ||
125 | System.exit(0); | ||
125 | } | 126 | } |
126 | }) | 127 | }); |
127 | .setPositive("确定", new View.OnClickListener() { | 128 | builder.setPositiveButton("立即更新", |
129 | new android.content.DialogInterface.OnClickListener() { | ||
130 | |||
128 | @Override | 131 | @Override |
129 | public void onClick(View v) { | 132 | public void onClick(DialogInterface dialog, int which) { |
130 | downLoadApk(); | 133 | downLoadApk(); |
131 | } | 134 | } |
132 | }) | 135 | }); |
133 | .show(); | 136 | Dialog dialog=builder.create(); |
137 | dialog.setCanceledOnTouchOutside(false); | ||
138 | dialog.show(); | ||
139 | |||
140 | // new CircleDialog.Builder((FragmentActivity)mContext) | ||
141 | // .setCanceledOnTouchOutside(false) | ||
142 | // .setCancelable(false) | ||
143 | // .setWidth(0.5f) | ||
144 | // .setTitle("升级提示") | ||
145 | // .setText(msgs) | ||
146 | // .setNegative("取消", new View.OnClickListener() { | ||
147 | // @Override | ||
148 | // public void onClick(View v) { | ||
149 | // ((Activity)mContext).finish(); | ||
150 | // | ||
151 | // } | ||
152 | // }) | ||
153 | // .setPositive("确定", new View.OnClickListener() { | ||
154 | // @Override | ||
155 | // public void onClick(View v) { | ||
156 | // downLoadApk(); | ||
157 | // } | ||
158 | // }) | ||
159 | // .show(); | ||
134 | } | 160 | } |
135 | 161 | ||
136 | private void showUpdateDialog() { | 162 | private void showUpdateDialog() { |
137 | new CircleDialog.Builder((FragmentActivity)mContext) | 163 | |
138 | .setCanceledOnTouchOutside(false) | 164 | AlertDialog.Builder builder = new AlertDialog.Builder( |
139 | .setCancelable(false) | 165 | mContext); |
140 | .setWidth(0.5f) | 166 | builder.setTitle("检查到新版本,是否更新?"); |
141 | .setTitle("升级提示") | 167 | builder.setMessage(msgs); |
142 | .setText(msgs) | 168 | builder.setNegativeButton("下次再说", null); |
143 | .setNegative("取消", null) | 169 | builder.setPositiveButton("立即更新", |
144 | .setPositive("确定", new View.OnClickListener() { | 170 | new android.content.DialogInterface.OnClickListener() { |
171 | |||
145 | @Override | 172 | @Override |
146 | public void onClick(View v) { | 173 | public void onClick(DialogInterface dialog, int which) { |
147 | downLoadApk(); | 174 | downLoadApk(); |
148 | } | 175 | } |
149 | }) | 176 | }); |
150 | .show(); | 177 | Dialog dialog=builder.create(); |
178 | dialog.setCanceledOnTouchOutside(false); | ||
179 | dialog.show(); | ||
151 | } | 180 | } |
152 | 181 | ||
153 | private void downLoadApk() { | 182 | private void downLoadApk() { |
154 | String apkUrl = downUrl; | 183 | String apkUrl = downUrl; |
155 | String dir = mContext.getExternalFilesDir( "apk").getAbsolutePath(); | 184 | String dir = mContext.getExternalFilesDir( "apk").getAbsolutePath(); |
156 | File folder = Environment.getExternalStoragePublicDirectory(dir); | 185 | File folder = Environment.getExternalStoragePublicDirectory(dir); |
157 | if(folder.exists() && folder.isDirectory()) { | 186 | if(folder.exists() && folder.isDirectory()) { |
158 | //do nothing | 187 | //do nothing |
159 | }else { | 188 | }else { |
160 | folder.mkdirs(); | 189 | folder.mkdirs(); |
161 | } | 190 | } |
162 | String filename = apkUrl.substring(apkUrl.lastIndexOf("/"),apkUrl.length()); | 191 | String filename = apkUrl.substring(apkUrl.lastIndexOf("/"),apkUrl.length()); |
163 | String destinationFilePath = dir + "/" + filename; | 192 | String destinationFilePath = dir + "/" + filename; |
164 | apkFile = new File(destinationFilePath); | 193 | apkFile = new File(destinationFilePath); |
165 | if("true".equals(qiangzi)){ | 194 | if("true".equals(qiangzi)){ |
166 | mProgressDialog.setCancelable(false); | 195 | mProgressDialog.setCancelable(false); |
167 | } | 196 | } |
168 | mProgressDialog.show(); | 197 | mProgressDialog.show(); |
169 | Intent intent = new Intent(mContext, DownloadService.class); | 198 | Intent intent = new Intent(mContext, DownloadService.class); |
170 | intent.putExtra("url", apkUrl); | 199 | intent.putExtra("url", apkUrl); |
171 | intent.putExtra("dest", destinationFilePath); | 200 | intent.putExtra("dest", destinationFilePath); |
172 | intent.putExtra("receiver", new DownloadReceiver(new Handler())); | 201 | intent.putExtra("receiver", new DownloadReceiver(new Handler())); |
173 | mContext.startService(intent); | 202 | mContext.startService(intent); |
174 | } | 203 | } |
175 | 204 | ||
176 | private class DownloadReceiver extends ResultReceiver{ | 205 | private class DownloadReceiver extends ResultReceiver{ |
177 | public DownloadReceiver(Handler handler) { | 206 | public DownloadReceiver(Handler handler) { |
178 | super(handler); | 207 | super(handler); |
179 | } | 208 | } |
180 | @Override | 209 | @Override |
181 | protected void onReceiveResult(int resultCode, Bundle resultData) { | 210 | protected void onReceiveResult(int resultCode, Bundle resultData) { |
182 | super.onReceiveResult(resultCode, resultData); | 211 | super.onReceiveResult(resultCode, resultData); |
183 | if (resultCode == DownloadService.UPDATE_PROGRESS) { | 212 | if (resultCode == DownloadService.UPDATE_PROGRESS) { |
184 | int progress = resultData.getInt("progress"); | 213 | int progress = resultData.getInt("progress"); |
185 | mProgressDialog.setProgress(progress); | 214 | mProgressDialog.setProgress(progress); |
186 | if (progress == 100) { | 215 | if (progress == 100) { |
187 | mProgressDialog.dismiss(); | 216 | mProgressDialog.dismiss(); |
188 | //如果没有设置SDCard写权限,或者没有sdcard,apk文件保存在内存中,需要授予权限才能安装 | 217 | //如果没有设置SDCard写权限,或者没有sdcard,apk文件保存在内存中,需要授予权限才能安装 |
189 | String[] command = {"chmod","777",apkFile.toString()}; | 218 | String[] command = {"chmod","777",apkFile.toString()}; |
190 | try{ | 219 | try{ |
191 | ProcessBuilder builder = new ProcessBuilder(command); | 220 | ProcessBuilder builder = new ProcessBuilder(command); |
192 | builder.start(); | 221 | builder.start(); |
193 | Intent intent = new Intent(Intent.ACTION_VIEW); | 222 | Intent intent = new Intent(Intent.ACTION_VIEW); |
194 | intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); | 223 | intent.setDataAndType(Uri.parse("file://" + apkFile.toString()), "application/vnd.android.package-archive"); |
195 | mContext.startActivity(intent); | 224 | mContext.startActivity(intent); |
196 | }catch (Exception e){ | 225 | }catch (Exception e){ |
197 | e.printStackTrace(); | 226 | e.printStackTrace(); |
198 | } | 227 | } |
199 | } | 228 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/CropUtils.java
1 | package com.hjx.personalcenter.util; | 1 | package com.hjx.personalcenter.util; |
2 | 2 | ||
3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
4 | import android.content.ContentUris; | 4 | import android.content.ContentUris; |
5 | import android.content.Context; | 5 | import android.content.Context; |
6 | import android.database.Cursor; | 6 | import android.database.Cursor; |
7 | import android.net.Uri; | 7 | import android.net.Uri; |
8 | import android.os.Build; | 8 | import android.os.Build; |
9 | import android.os.Environment; | 9 | import android.os.Environment; |
10 | import android.provider.DocumentsContract; | 10 | import android.provider.DocumentsContract; |
11 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
12 | import android.util.Log; | 12 | import android.util.Log; |
13 | 13 | ||
14 | import static android.content.ContentValues.TAG; | 14 | import static android.content.ContentValues.TAG; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Created by yf on 2016/2/23. | 17 | * Created by yf on 2016/2/23. |
18 | */ | 18 | */ |
19 | public class CropUtils { | 19 | public class CropUtils { |
20 | @SuppressLint("NewApi") | 20 | @SuppressLint("NewApi") |
21 | public static String getPath(final Context context, final Uri uri) { | 21 | public static String getPath(final Context context, final Uri uri) { |
22 | 22 | ||
23 | final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; | 23 | final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; |
24 | 24 | ||
25 | // DocumentProvider | 25 | // DocumentProvider |
26 | if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { | 26 | if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { |
27 | // ExternalStorageProvider | 27 | // ExternalStorageProvider |
28 | if (isExternalStorageDocument(uri)) { | 28 | if (isExternalStorageDocument(uri)) { |
29 | final String docId = DocumentsContract.getDocumentId(uri); | 29 | final String docId = DocumentsContract.getDocumentId(uri); |
30 | final String[] split = docId.split(":"); | 30 | final String[] split = docId.split(":"); |
31 | final String type = split[0]; | 31 | final String type = split[0]; |
32 | 32 | ||
33 | if ("primary".equalsIgnoreCase(type)) { | 33 | if ("primary".equalsIgnoreCase(type)) { |
34 | return Environment.getExternalStorageDirectory() + "/" + split[1]; | 34 | return Environment.getExternalStorageDirectory() + "/" + split[1]; |
35 | } | 35 | } |
36 | 36 | ||
37 | } | 37 | } |
38 | // DownloadsProvider | 38 | // DownloadsProvider |
39 | else if (isDownloadsDocument(uri)) { | 39 | else if (isDownloadsDocument(uri)) { |
40 | 40 | ||
41 | final String id = DocumentsContract.getDocumentId(uri); | 41 | final String id = DocumentsContract.getDocumentId(uri); |
42 | final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); | 42 | final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); |
43 | 43 | ||
44 | return getDataColumn(context, contentUri, null, null); | 44 | return getDataColumn(context, contentUri, null, null); |
45 | } | 45 | } |
46 | // MediaProvider | 46 | // MediaProvider |
47 | else if (isMediaDocument(uri)) { | 47 | else if (isMediaDocument(uri)) { |
48 | final String docId = DocumentsContract.getDocumentId(uri); | 48 | final String docId = DocumentsContract.getDocumentId(uri); |
49 | final String[] split = docId.split(":"); | 49 | final String[] split = docId.split(":"); |
50 | final String type = split[0]; | 50 | final String type = split[0]; |
51 | 51 | ||
52 | Uri contentUri = null; | 52 | Uri contentUri = null; |
53 | if ("image".equals(type)) { | 53 | if ("image".equals(type)) { |
54 | contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; | 54 | contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; |
55 | } else if ("video".equals(type)) { | 55 | } else if ("video".equals(type)) { |
56 | contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; | 56 | contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; |
57 | } else if ("audio".equals(type)) { | 57 | } else if ("audio".equals(type)) { |
58 | contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; | 58 | contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; |
59 | } | 59 | } |
60 | 60 | ||
61 | final String selection = "_id=?"; | 61 | final String selection = "_id=?"; |
62 | final String[] selectionArgs = new String[]{split[1]}; | 62 | final String[] selectionArgs = new String[]{split[1]}; |
63 | 63 | ||
64 | return getDataColumn(context, contentUri, selection, selectionArgs); | 64 | return getDataColumn(context, contentUri, selection, selectionArgs); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | // MediaStore (and general) | 67 | // MediaStore (and general) |
68 | else if ("content".equalsIgnoreCase(uri.getScheme())) { | 68 | else if ("content".equalsIgnoreCase(uri.getScheme())) { |
69 | return getDataColumn(context, uri, null, null); | 69 | return getDataColumn(context, uri, null, null); |
70 | } | 70 | } |
71 | // File | 71 | // File |
72 | else if ("file".equalsIgnoreCase(uri.getScheme())) { | 72 | else if ("file".equalsIgnoreCase(uri.getScheme())) { |
73 | return uri.getPath(); | 73 | return uri.getPath(); |
74 | } else { | 74 | } else { |
75 | String uriStr = uri.toString(); | 75 | String uriStr = uri.toString(); |
76 | String path = uriStr.substring(10, uriStr.length()); | 76 | String path = uriStr.substring(10, uriStr.length()); |
77 | if (path.startsWith("com.sec.android.gallery3d")) { | 77 | if (path.startsWith("com.sec.android.gallery3d")) { |
78 | Log.e(TAG, "It's auto backup pic path:" + uri.toString()); | 78 | Log.e(TAG, "It's auto backup pic path:" + uri.toString()); |
79 | return null; | 79 | return null; |
80 | } | 80 | } |
81 | String[] filePathColumn = {MediaStore.Images.Media.DATA}; | 81 | String[] filePathColumn = {MediaStore.Images.Media.DATA}; |
82 | Cursor cursor = context.getContentResolver().query(uri, filePathColumn, null, null, null); | 82 | Cursor cursor = context.getContentResolver().query(uri, filePathColumn, null, null, null); |
83 | if (cursor != null) { | 83 | if (cursor != null) { |
84 | cursor.moveToFirst(); | 84 | cursor.moveToFirst(); |
85 | } | 85 | } |
86 | int columnIndex = cursor.getColumnIndex(filePathColumn[0]); | 86 | int columnIndex = cursor.getColumnIndex(filePathColumn[0]); |
87 | String picturePath = cursor.getString(columnIndex); | 87 | String picturePath = cursor.getString(columnIndex); |
88 | cursor.close(); | 88 | cursor.close(); |
89 | return picturePath; | 89 | return picturePath; |
90 | } | 90 | } |
91 | 91 | ||
92 | return null; | 92 | return null; |
93 | } | 93 | } |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * Get the value of the data column for this Uri. This is useful for | 96 | * Get the value of the data column for this Uri. This is useful for |
97 | * MediaStore Uris, and other file-based ContentProviders. | 97 | * MediaStore Uris, and other file-based ContentProviders. |
98 | * | 98 | * |
99 | * @param context The context. | 99 | * @param context The context. |
100 | * @param uri The Uri to query. | 100 | * @param uri The Uri to query. |
101 | * @param selection (Optional) Filter used in the query. | 101 | * @param selection (Optional) Filter used in the query. |
102 | * @param selectionArgs (Optional) Selection arguments used in the query. | 102 | * @param selectionArgs (Optional) Selection arguments used in the query. |
103 | * @return The value of the _data column, which is typically a file path. | 103 | * @return The value of the _data column, which is typically a file path. |
104 | */ | 104 | */ |
105 | private static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { | 105 | private static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { |
106 | 106 | ||
107 | Cursor cursor = null; | 107 | Cursor cursor = null; |
108 | final String column = "_data"; | 108 | final String column = "_data"; |
109 | final String[] projection = {column}; | 109 | final String[] projection = {column}; |
110 | 110 | ||
111 | try { | 111 | try { |
112 | cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); | 112 | cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); |
113 | if (cursor != null && cursor.moveToFirst()) { | 113 | if (cursor != null && cursor.moveToFirst()) { |
114 | final int column_index = cursor.getColumnIndexOrThrow(column); | 114 | final int column_index = cursor.getColumnIndexOrThrow(column); |
115 | return cursor.getString(column_index); | 115 | return cursor.getString(column_index); |
116 | } | 116 | } |
117 | } finally { | 117 | } finally { |
118 | if (cursor != null) | 118 | if (cursor != null) |
119 | cursor.close(); | 119 | cursor.close(); |
120 | } | 120 | } |
121 | return null; | 121 | return null; |
122 | } | 122 | } |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * @param uri The Uri to check. | 125 | * @param uri The Uri to check. |
126 | * @return Whether the Uri authority is ExternalStorageProvider. | 126 | * @return Whether the Uri authority is ExternalStorageProvider. |
127 | */ | 127 | */ |
128 | private static boolean isExternalStorageDocument(Uri uri) { | 128 | private static boolean isExternalStorageDocument(Uri uri) { |
129 | return "com.android.externalstorage.documents".equals(uri.getAuthority()); | 129 | return "com.android.externalstorage.documents".equals(uri.getAuthority()); |
130 | } | 130 | } |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * @param uri The Uri to check. | 133 | * @param uri The Uri to check. |
134 | * @return Whether the Uri authority is DownloadsProvider. | 134 | * @return Whether the Uri authority is DownloadsProvider. |
135 | */ | 135 | */ |
136 | private static boolean isDownloadsDocument(Uri uri) { | 136 | private static boolean isDownloadsDocument(Uri uri) { |
137 | return "com.android.providers.downloads.documents".equals(uri.getAuthority()); | 137 | return "com.android.providers.downloads.documents".equals(uri.getAuthority()); |
138 | } | 138 | } |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * @param uri The Uri to check. | 141 | * @param uri The Uri to check. |
142 | * @return Whether the Uri authority is MediaProvider. | 142 | * @return Whether the Uri authority is MediaProvider. |
143 | */ | 143 | */ |
144 | private static boolean isMediaDocument(Uri uri) { | 144 | private static boolean isMediaDocument(Uri uri) { |
145 | return "com.android.providers.media.documents".equals(uri.getAuthority()); | 145 | return "com.android.providers.media.documents".equals(uri.getAuthority()); |
146 | } | 146 | } |
147 | 147 | ||
148 | |||
149 | /** | ||
150 | * dp转换成px | ||
151 | */ | ||
152 | public static int dp2px(Context context,float dpValue){ | ||
153 | float scale=context.getResources().getDisplayMetrics().density; | ||
154 | return (int)(dpValue*scale+0.5f); | ||
155 | } | ||
156 | /** | ||
157 | * sp转换成px | ||
158 | */ | ||
159 | public static int sp2px(Context context,float spValue){ | ||
160 | float fontScale=context.getResources().getDisplayMetrics().scaledDensity; | ||
161 | return (int) (spValue*fontScale+0.5f); | ||
162 | } | ||
148 | } | 163 | } |
149 | 164 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/GetDevicesUtil.java
1 | package com.hjx.personalcenter.util; | 1 | package com.hjx.personalcenter.util; |
2 | 2 | ||
3 | import android.app.Activity; | ||
3 | import android.content.Context; | 4 | import android.content.Context; |
4 | import android.os.Build; | 5 | import android.os.Build; |
6 | import android.os.Environment; | ||
7 | import android.os.StatFs; | ||
8 | import android.os.storage.StorageManager; | ||
9 | import android.os.storage.StorageVolume; | ||
5 | import android.util.Log; | 10 | import android.util.Log; |
11 | import android.widget.Toast; | ||
6 | 12 | ||
7 | import com.hjx.personalcenter.model.DeviceInfo; | 13 | import com.hjx.personalcenter.model.DeviceInfo; |
8 | 14 | ||
15 | import java.io.BufferedReader; | ||
16 | import java.io.File; | ||
9 | import java.io.FileReader; | 17 | import java.io.FileReader; |
18 | import java.io.IOException; | ||
10 | import java.io.InputStreamReader; | 19 | import java.io.InputStreamReader; |
11 | import java.io.LineNumberReader; | 20 | import java.io.LineNumberReader; |
12 | import java.io.Reader; | 21 | import java.io.Reader; |
22 | import java.lang.reflect.Field; | ||
23 | import java.lang.reflect.InvocationTargetException; | ||
24 | import java.lang.reflect.Method; | ||
25 | import java.net.NetworkInterface; | ||
26 | import java.net.SocketException; | ||
27 | import java.util.Collections; | ||
28 | import java.util.Enumeration; | ||
29 | import java.util.List; | ||
30 | import java.util.Locale; | ||
31 | import java.util.UUID; | ||
13 | 32 | ||
14 | 33 | ||
15 | public class GetDevicesUtil { | 34 | public class GetDevicesUtil { |
16 | private final static String LOG_TAG = "GetDevicesUtil"; | 35 | private final static String LOG_TAG = "GetDevicesUtil"; |
17 | 36 | ||
18 | public static DeviceInfo getDevicesInfo(Context context){ | 37 | public static DeviceInfo getDevicesInfo(Context context) { |
19 | DeviceInfo mDeviceInfo = new DeviceInfo(); | 38 | DeviceInfo mDeviceInfo = new DeviceInfo(); |
20 | initDevicesInfo(mDeviceInfo,context); | 39 | initDevicesInfo(mDeviceInfo, context); |
21 | 40 | ||
22 | return mDeviceInfo; | 41 | return mDeviceInfo; |
23 | } | 42 | } |
24 | 43 | ||
25 | public static void initDevicesInfo(DeviceInfo mDeviceInfo,Context context){ | 44 | public static void initDevicesInfo(DeviceInfo mDeviceInfo, Context context) { |
26 | //if (PermissionUtil.hasReadExternalStoragePermission((Activity) context)) | 45 | //if (PermissionUtil.hasReadExternalStoragePermission((Activity) context)) |
27 | mDeviceInfo.setDeviceModel(android.os.Build.MODEL); | 46 | if(android.os.Build.MODEL.equals("T8") && queryWithStorageManager(context)/(1024*1024*1024)>64){ |
28 | Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceModel()); | 47 | mDeviceInfo.setDeviceModel("T8 PRO"); |
29 | mDeviceInfo.setMac(getMacAddress(context)); | 48 | }else { |
30 | Log.e(LOG_TAG,"" + mDeviceInfo.getMac()); | 49 | mDeviceInfo.setDeviceModel(android.os.Build.MODEL); |
50 | } | ||
51 | Log.e(LOG_TAG, "" + mDeviceInfo.getDeviceModel()); | ||
52 | mDeviceInfo.setMac(getMacAddress(context)); | ||
53 | Log.e(LOG_TAG, "" + mDeviceInfo.getMac()); | ||
31 | 54 | ||
32 | mDeviceInfo.setDeviceNumber(getCPUSerial(context)); | 55 | mDeviceInfo.setDeviceNumber(getCPUSerial(context)); |
33 | Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceNumber()); | 56 | Log.e(LOG_TAG, "" + mDeviceInfo.getDeviceNumber()); |
34 | } | 57 | } |
35 | 58 | ||
36 | private static String getCPUSerial(Context context) { | 59 | private static String getCPUSerial(Context context) { |
37 | //String androidID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); | 60 | //String androidID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); |
38 | String cpuAddress = Build.SERIAL; | 61 | String cpuAddress = Build.SERIAL; |
39 | // String cpuAddress = null; | 62 | // String cpuAddress = null; |
40 | // TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); | 63 | // TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); |
41 | // //if (PermissionUtil.hasReadExternalStoragePermission((Activity) context)) | 64 | // //if (PermissionUtil.hasReadExternalStoragePermission((Activity) context)) |
42 | // if (mTelephony.getDeviceId() != null) { | 65 | // if (mTelephony.getDeviceId() != null) { |
43 | // cpuAddress = mTelephony.getDeviceId(); | 66 | // cpuAddress = mTelephony.getDeviceId(); |
44 | // } else { | 67 | // } else { |
45 | // //android.provider.Settings; | 68 | // //android.provider.Settings; |
46 | // cpuAddress = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID); | 69 | // cpuAddress = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID); |
47 | // } | 70 | // } |
48 | return cpuAddress; | 71 | return cpuAddress; |
49 | } | 72 | } |
50 | 73 | ||
51 | private static String getMacAddress(Context mContext){ | 74 | |
52 | 75 | public static String getMacAddress(Context context) { | |
53 | String str = ""; | 76 | // 如果是7.0以下, |
54 | String macSerial = ""; | 77 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
55 | try { | 78 | return getMacAddress6(context); |
56 | Process pp = Runtime.getRuntime().exec( | 79 | } else { |
57 | "cat /sys/class/net/wlan0/address "); | 80 | return getNewMac(); |
58 | InputStreamReader ir = new InputStreamReader(pp.getInputStream()); | 81 | } |
59 | LineNumberReader input = new LineNumberReader(ir); | 82 | } |
60 | 83 | ||
61 | for (; null != str;) { | 84 | |
62 | str = input.readLine(); | 85 | |
63 | if (str != null) { | 86 | private static String[] units = {"B", "KB", "MB", "GB", "TB"}; |
64 | macSerial = str.trim();// 去空格 | 87 | /** |
65 | break; | 88 | * 单位转换 |
66 | } | 89 | */ |
67 | } | 90 | private static String getUnit(float size) { |
68 | } catch (Exception ex) { | 91 | int index = 0; |
69 | ex.printStackTrace(); | 92 | while (size > 1024 && index < 4) { |
70 | } | 93 | size = size / 1024; |
71 | if (macSerial == null || "".equals(macSerial)) { | 94 | index++; |
72 | try { | 95 | } |
73 | return loadFileAsString("/sys/class/net/eth0/address") | 96 | return String.format(Locale.getDefault(), " %.2f %s", size, units[index]); |
74 | .toUpperCase().substring(0, 17); | 97 | } |
75 | } catch (Exception e) { | 98 | |
76 | e.printStackTrace(); | 99 | /** |
77 | 100 | * 获取总共容量大小,包括系统大小 | |
78 | } | 101 | */ |
79 | 102 | public static float queryWithStorageManager(Context context) { | |
80 | } | 103 | //5.0 查外置存储 |
81 | return macSerial; | 104 | StorageManager storageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE); |
82 | } | 105 | float unit = 1024; |
83 | 106 | int version = Build.VERSION.SDK_INT; | |
84 | public static String loadFileAsString(String fileName) throws Exception { | 107 | if (version < Build.VERSION_CODES.M) {//小于6.0 |
85 | FileReader reader = new FileReader(fileName); | 108 | try { |
86 | String text = loadReaderAsString(reader); | 109 | Method getVolumeList = StorageManager.class.getDeclaredMethod("getVolumeList"); |
87 | reader.close(); | 110 | StorageVolume[] volumeList = (StorageVolume[]) getVolumeList.invoke(storageManager); |
88 | return text; | 111 | long totalSize = 0, availableSize = 0; |
89 | } | 112 | if (volumeList != null) { |
90 | 113 | Method getPathFile = null; | |
91 | public static String loadReaderAsString(Reader reader) throws Exception { | 114 | for (StorageVolume volume : volumeList) { |
92 | StringBuilder builder = new StringBuilder(); | 115 | if (getPathFile == null) { |
93 | char[] buffer = new char[4096]; | 116 | getPathFile = volume.getClass().getDeclaredMethod("getPathFile"); |
94 | int readLength = reader.read(buffer); | 117 | } |
95 | while (readLength >= 0) { | 118 | File file = (File) getPathFile.invoke(volume); |
96 | builder.append(buffer, 0, readLength); | 119 | totalSize += file.getTotalSpace(); |
97 | readLength = reader.read(buffer); | 120 | availableSize += file.getUsableSpace(); |
98 | } | 121 | } |
99 | return builder.toString(); | 122 | } |
100 | } | 123 | Log.d("TAG", "totalSize = " + getUnit(totalSize) +"||"+totalSize+ " ,availableSize = " + getUnit(availableSize)); |
124 | return totalSize; | ||
125 | } catch (NoSuchMethodException e) { | ||
126 | e.printStackTrace(); | ||
127 | } catch (IllegalAccessException e) { | ||
128 | e.printStackTrace(); | ||
129 | } catch (InvocationTargetException e) { | ||
130 | e.printStackTrace(); | ||
131 | } | ||
132 | } else { | ||
133 | |||
134 | try { | ||
135 | Method getVolumes = StorageManager.class.getDeclaredMethod("getVolumes");//6.0 | ||
136 | List<Object> getVolumeInfo = (List<Object>) getVolumes.invoke(storageManager); | ||
137 | long total = 0L, used = 0L; | ||
138 | for (Object obj : getVolumeInfo) { | ||
139 | |||
140 | Field getType = obj.getClass().getField("type"); | ||
141 | int type = getType.getInt(obj); | ||
142 | |||
143 | Log.d("TAG", "type: " + type); | ||
144 | if (type == 1) {//TYPE_PRIVATE | ||
145 | |||
146 | long totalSize = 0L; | ||
147 | |||
148 | //获取内置内存总大小 | ||
149 | if (version >=26) {//8.0 | ||
150 | // unit = 1000; | ||
151 | // Method getFsUuid = obj.getClass().getDeclaredMethod("getFsUuid"); | ||
152 | // String fsUuid = (String) getFsUuid.invoke(obj); | ||
153 | // totalSize = getTotalSize(context, fsUuid);//8.0 以后使用 | ||
154 | } else if (version >= Build.VERSION_CODES.N_MR1) {//7.1.1 | ||
155 | Method getPrimaryStorageSize = StorageManager.class.getMethod("getPrimaryStorageSize");//5.0 6.0 7.0没有 | ||
156 | totalSize = (long) getPrimaryStorageSize.invoke(storageManager); | ||
157 | } | ||
158 | long systemSize = 0L; | ||
159 | |||
160 | Method isMountedReadable = obj.getClass().getDeclaredMethod("isMountedReadable"); | ||
161 | boolean readable = (boolean) isMountedReadable.invoke(obj); | ||
162 | if (readable) { | ||
163 | Method file = obj.getClass().getDeclaredMethod("getPath"); | ||
164 | File f = (File) file.invoke(obj); | ||
165 | |||
166 | if (totalSize == 0) { | ||
167 | totalSize = f.getTotalSpace(); | ||
168 | } | ||
169 | systemSize = totalSize - f.getTotalSpace(); | ||
170 | used += totalSize - f.getFreeSpace(); | ||
171 | total += totalSize; | ||
172 | } | ||
173 | Log.d("TAG", "设备内存大小:" + getUnit(totalSize) + "\n系统大小:" + getUnit(systemSize)); | ||
174 | Log.d("TAG", "totalSize = " + getUnit(totalSize) +"||"+totalSize+ " ,used(with system) = " + getUnit(used) + " ,free = " + getUnit(totalSize - used)); | ||
175 | return totalSize; | ||
176 | |||
177 | } else if (type == 0) {//TYPE_PUBLIC | ||
178 | // //外置存储 | ||
179 | // Method isMountedReadable = obj.getClass().getDeclaredMethod("isMountedReadable"); | ||
180 | // boolean readable = (boolean) isMountedReadable.invoke(obj); | ||
181 | // if (readable) { | ||
182 | // Method file = obj.getClass().getDeclaredMethod("getPath"); | ||
183 | // File f = (File) file.invoke(obj); | ||
184 | // used += f.getTotalSpace() - f.getFreeSpace(); | ||
185 | // total += f.getTotalSpace(); | ||
186 | // } | ||
187 | } else if (type == 2) {//TYPE_EMULATED | ||
188 | |||
189 | } | ||
190 | } | ||
191 | Log.d("TAG", "总内存 total = " + getUnit(total) +"||"+total+ "\n已用 used(with system) = " + getUnit(used) + "\n可用 available = " + getUnit(total - used)); | ||
192 | // return total; | ||
193 | Log.e("TAG", "缺少权限:permission.PACKAGE_USAGE_STATS"); | ||
194 | } catch (Exception e) { | ||
195 | e.printStackTrace(); | ||
196 | } | ||
197 | } | ||
198 | return 0; | ||
199 | } | ||
200 | |||
201 | |||
202 | |||
203 | /** | ||
204 | * 7.0以下获取 | ||
205 | * | ||
206 | * @param mContext | ||
207 | * @return | ||
208 | */ | ||
209 | private static String getMacAddress6(Context mContext) { | ||
210 | |||
211 | String str = ""; | ||
212 | String macSerial = ""; | ||
213 | try { | ||
214 | Process pp = Runtime.getRuntime().exec( | ||
215 | "cat /sys/class/net/wlan0/address "); | ||
216 | InputStreamReader ir = new InputStreamReader(pp.getInputStream()); | ||
217 | LineNumberReader input = new LineNumberReader(ir); | ||
218 | |||
219 | for (; null != str; ) { | ||
220 | str = input.readLine(); | ||
221 | if (str != null) { | ||
222 | macSerial = str.trim();// 去空格 | ||
223 | break; | ||
224 | } | ||
225 | } | ||
226 | } catch (Exception ex) { | ||
227 | ex.printStackTrace(); | ||
228 | } | ||
229 | if (macSerial == null || "".equals(macSerial)) { | ||
230 | try { | ||
231 | return loadFileAsString("/sys/class/net/eth0/address") | ||
232 | .toUpperCase().substring(0, 17); | ||
233 | } catch (Exception e) { | ||
234 | e.printStackTrace(); | ||
235 | |||
236 | } | ||
237 | |||
238 | } | ||
239 | return macSerial; | ||
240 | } | ||
241 | |||
242 | public static String loadFileAsString(String fileName) throws Exception { | ||
243 | FileReader reader = new FileReader(fileName); | ||
244 | String text = loadReaderAsString(reader); | ||
245 | reader.close(); | ||
246 | return text; | ||
247 | } | ||
248 | |||
249 | public static String loadReaderAsString(Reader reader) throws Exception { | ||
250 | StringBuilder builder = new StringBuilder(); | ||
251 | char[] buffer = new char[4096]; | ||
252 | int readLength = reader.read(buffer); | ||
253 | while (readLength >= 0) { | ||
254 | builder.append(buffer, 0, readLength); | ||
255 | readLength = reader.read(buffer); | ||
256 | } | ||
257 | return builder.toString(); | ||
258 | } | ||
259 | |||
260 | |||
261 | /** | ||
262 | * 7.0以上根据busybox获取本地Mac | ||
263 | * | ||
264 | * @return | ||
265 | */ | ||
266 | private static String getNewMac() { | ||
267 | try { | ||
268 | List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces()); | ||
269 | for (NetworkInterface nif : all) { | ||
270 | if (!nif.getName().equalsIgnoreCase("wlan0")) continue; | ||
271 | |||
272 | byte[] macBytes = nif.getHardwareAddress(); | ||
273 | if (macBytes == null) { | ||
274 | return null; | ||
275 | } | ||
276 | |||
277 | StringBuilder res1 = new StringBuilder(); | ||
278 | for (byte b : macBytes) { | ||
279 | res1.append(String.format("%02X:", b)); | ||
280 | } | ||
281 | |||
282 | if (res1.length() > 0) { | ||
283 | res1.deleteCharAt(res1.length() - 1); | ||
284 | } | ||
285 | return res1.toString(); | ||
286 | } | ||
287 | } catch (Exception ex) { | ||
288 | ex.printStackTrace(); | ||
289 | } | ||
290 | return null; | ||
291 | } | ||
292 | |||
101 | } | 293 | } |
102 | 294 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/PermissionUtil.java
1 | package com.hjx.personalcenter.util; | 1 | package com.hjx.personalcenter.util; |
2 | 2 | ||
3 | import android.Manifest; | 3 | import android.Manifest; |
4 | import android.app.Activity; | 4 | import android.app.Activity; |
5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
6 | import android.os.Build; | 6 | import android.os.Build; |
7 | import android.support.v4.app.ActivityCompat; | 7 | import android.support.v4.app.ActivityCompat; |
8 | import android.support.v4.content.ContextCompat; | 8 | import android.support.v4.content.ContextCompat; |
9 | import android.support.v4.util.SimpleArrayMap; | 9 | import android.support.v4.util.SimpleArrayMap; |
10 | import android.util.Log; | 10 | import android.util.Log; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * Created by yf on 2016/7/22 0022. | 13 | * Created by yf on 2016/7/22 0022. |
14 | */ | 14 | */ |
15 | public class PermissionUtil { | 15 | public class PermissionUtil { |
16 | public static final int REQUEST_SHOWCAMERA = 0; | 16 | public static final int REQUEST_SHOWCAMERA = 0; |
17 | public static final int READ_PHONE_STATE = 1; | 17 | public static final int WRITE_EXTERNAL_STORAGE = 1; |
18 | public static final int REQUEST_RECORD_AUDIO = 2; | 18 | public static final int REQUEST_RECORD_AUDIO = 2; |
19 | public static final int REQUEST_CONTACTS = 3; | 19 | public static final int REQUEST_CONTACTS = 3; |
20 | public static final int REQUEST_LOCATION = 4; | 20 | public static final int REQUEST_LOCATION = 4; |
21 | 21 | ||
22 | 22 | ||
23 | private static final SimpleArrayMap<String, Integer> MIN_SDK_PERMISSIONS; | 23 | private static final SimpleArrayMap<String, Integer> MIN_SDK_PERMISSIONS; |
24 | static { | 24 | static { |
25 | MIN_SDK_PERMISSIONS = new SimpleArrayMap<>(8); | 25 | MIN_SDK_PERMISSIONS = new SimpleArrayMap<>(8); |
26 | MIN_SDK_PERMISSIONS.put("com.android.voicemail.permission.ADD_VOICEMAIL", 14); | 26 | MIN_SDK_PERMISSIONS.put("com.android.voicemail.permission.ADD_VOICEMAIL", 14); |
27 | MIN_SDK_PERMISSIONS.put("android.permission.BODY_SENSORS", 20); | 27 | MIN_SDK_PERMISSIONS.put("android.permission.BODY_SENSORS", 20); |
28 | MIN_SDK_PERMISSIONS.put("android.permission.READ_CALL_LOG", 16); | 28 | MIN_SDK_PERMISSIONS.put("android.permission.READ_CALL_LOG", 16); |
29 | MIN_SDK_PERMISSIONS.put("android.permission.READ_EXTERNAL_STORAGE", 16); | 29 | MIN_SDK_PERMISSIONS.put("android.permission.READ_EXTERNAL_STORAGE", 16); |
30 | MIN_SDK_PERMISSIONS.put("android.permission.USE_SIP", 9); | 30 | MIN_SDK_PERMISSIONS.put("android.permission.USE_SIP", 9); |
31 | MIN_SDK_PERMISSIONS.put("android.permission.WRITE_CALL_LOG", 16); | 31 | MIN_SDK_PERMISSIONS.put("android.permission.WRITE_CALL_LOG", 16); |
32 | MIN_SDK_PERMISSIONS.put("android.permission.SYSTEM_ALERT_WINDOW", 23); | 32 | MIN_SDK_PERMISSIONS.put("android.permission.SYSTEM_ALERT_WINDOW", 23); |
33 | MIN_SDK_PERMISSIONS.put("android.permission.WRITE_SETTINGS", 23); | 33 | MIN_SDK_PERMISSIONS.put("android.permission.WRITE_SETTINGS", 23); |
34 | MIN_SDK_PERMISSIONS.put("android.permission.READ_PHONE_STATE", 23); | 34 | MIN_SDK_PERMISSIONS.put("android.permission.READ_PHONE_STATE", 23); |
35 | } | 35 | } |
36 | private static boolean permissionExists(String permission) { | 36 | private static boolean permissionExists(String permission) { |
37 | Integer minVersion = MIN_SDK_PERMISSIONS.get(permission); | 37 | Integer minVersion = MIN_SDK_PERMISSIONS.get(permission); |
38 | return minVersion == null || Build.VERSION.SDK_INT >= minVersion; | 38 | return minVersion == null || Build.VERSION.SDK_INT >= minVersion; |
39 | } | 39 | } |
40 | 40 | ||
41 | 41 | ||
42 | public static boolean hasCameraPermission(Activity activity){ | 42 | public static boolean hasCameraPermission(Activity activity){ |
43 | int hasPermission = ContextCompat.checkSelfPermission(activity, | 43 | int hasPermission = ContextCompat.checkSelfPermission(activity, |
44 | Manifest.permission.CAMERA); | 44 | Manifest.permission.CAMERA); |
45 | if(!permissionExists(Manifest.permission.CAMERA)){ | 45 | if(!permissionExists(Manifest.permission.CAMERA)){ |
46 | Log.e("permission","your system does not suppport"+ Manifest.permission.CAMERA+" permission"); | 46 | Log.e("permission","your system does not suppport"+ Manifest.permission.CAMERA+" permission"); |
47 | return false; | 47 | return false; |
48 | } | 48 | } |
49 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { | 49 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { |
50 | ActivityCompat.requestPermissions(activity, | 50 | ActivityCompat.requestPermissions(activity, |
51 | new String[]{Manifest.permission.CAMERA}, | 51 | new String[]{Manifest.permission.CAMERA}, |
52 | PermissionUtil.REQUEST_SHOWCAMERA); | 52 | PermissionUtil.REQUEST_SHOWCAMERA); |
53 | return false; | 53 | return false; |
54 | } | 54 | } |
55 | return true; | 55 | return true; |
56 | } | 56 | } |
57 | 57 | ||
58 | public static boolean hasReadExternalStoragePermission(Activity activity){ | 58 | public static boolean hasReadExternalStoragePermission(Activity activity){ |
59 | int hasPermission = ContextCompat.checkSelfPermission(activity, | 59 | int hasPermission = ContextCompat.checkSelfPermission(activity, |
60 | Manifest.permission.READ_PHONE_STATE); | 60 | Manifest.permission.WRITE_EXTERNAL_STORAGE); |
61 | if(!permissionExists(Manifest.permission.READ_PHONE_STATE)){ | 61 | if(!permissionExists(Manifest.permission.WRITE_EXTERNAL_STORAGE)){ |
62 | Log.e("permission","your system does not suppport "+ Manifest.permission.READ_PHONE_STATE+" permission"); | 62 | Log.e("permission","your system does not suppport "+ Manifest.permission.WRITE_EXTERNAL_STORAGE+" permission"); |
63 | return false; | 63 | return false; |
64 | } | 64 | } |
65 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { | 65 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { |
66 | ActivityCompat.requestPermissions(activity, | 66 | ActivityCompat.requestPermissions(activity, |
67 | new String[]{Manifest.permission.READ_PHONE_STATE}, | 67 | new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, |
68 | PermissionUtil.READ_PHONE_STATE); | 68 | PermissionUtil.WRITE_EXTERNAL_STORAGE); |
69 | return false; | 69 | return false; |
70 | } | 70 | } |
71 | return true; | 71 | return true; |
72 | } | 72 | } |
73 | public static boolean hasRecordAudioPermission(Activity activity){ | 73 | public static boolean hasRecordAudioPermission(Activity activity){ |
74 | int hasPermission = ContextCompat.checkSelfPermission(activity, | 74 | int hasPermission = ContextCompat.checkSelfPermission(activity, |
75 | Manifest.permission.RECORD_AUDIO); | 75 | Manifest.permission.RECORD_AUDIO); |
76 | if(!permissionExists(Manifest.permission.RECORD_AUDIO)){ | 76 | if(!permissionExists(Manifest.permission.RECORD_AUDIO)){ |
77 | Log.e("permission","your system does not suppport"+ Manifest.permission.RECORD_AUDIO+" permission"); | 77 | Log.e("permission","your system does not suppport"+ Manifest.permission.RECORD_AUDIO+" permission"); |
78 | return false; | 78 | return false; |
79 | } | 79 | } |
80 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { | 80 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { |
81 | ActivityCompat.requestPermissions(activity, | 81 | ActivityCompat.requestPermissions(activity, |
82 | new String[]{Manifest.permission.RECORD_AUDIO}, | 82 | new String[]{Manifest.permission.RECORD_AUDIO}, |
83 | PermissionUtil.REQUEST_RECORD_AUDIO); | 83 | PermissionUtil.REQUEST_RECORD_AUDIO); |
84 | return false; | 84 | return false; |
85 | } | 85 | } |
86 | return true; | 86 | return true; |
87 | } | 87 | } |
88 | 88 | ||
89 | public static boolean hasContactsPermission(Activity activity){ | 89 | public static boolean hasContactsPermission(Activity activity){ |
90 | int hasWPermission = ContextCompat.checkSelfPermission(activity, | 90 | int hasWPermission = ContextCompat.checkSelfPermission(activity, |
91 | Manifest.permission.WRITE_CONTACTS); | 91 | Manifest.permission.WRITE_CONTACTS); |
92 | int hasRPermission = ContextCompat.checkSelfPermission(activity, | 92 | int hasRPermission = ContextCompat.checkSelfPermission(activity, |
93 | Manifest.permission.READ_CONTACTS); | 93 | Manifest.permission.READ_CONTACTS); |
94 | 94 | ||
95 | if(hasRPermission== PackageManager.PERMISSION_GRANTED && hasWPermission== PackageManager.PERMISSION_GRANTED){ | 95 | if(hasRPermission== PackageManager.PERMISSION_GRANTED && hasWPermission== PackageManager.PERMISSION_GRANTED){ |
96 | return true; | 96 | return true; |
97 | } | 97 | } |
98 | ActivityCompat.requestPermissions(activity, | 98 | ActivityCompat.requestPermissions(activity, |
99 | new String[]{Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS}, | 99 | new String[]{Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS}, |
100 | PermissionUtil.REQUEST_CONTACTS); | 100 | PermissionUtil.REQUEST_CONTACTS); |
101 | return false; | 101 | return false; |
102 | } | 102 | } |
103 | public static boolean hasLocationPermission(Activity activity){ | 103 | public static boolean hasLocationPermission(Activity activity){ |
104 | int hasFPermission = ContextCompat.checkSelfPermission(activity, | 104 | int hasFPermission = ContextCompat.checkSelfPermission(activity, |
105 | Manifest.permission.ACCESS_FINE_LOCATION); | 105 | Manifest.permission.ACCESS_FINE_LOCATION); |
106 | int hasCPermission = ContextCompat.checkSelfPermission(activity, | 106 | int hasCPermission = ContextCompat.checkSelfPermission(activity, |
107 | Manifest.permission.ACCESS_COARSE_LOCATION); | 107 | Manifest.permission.ACCESS_COARSE_LOCATION); |
108 | 108 | ||
109 | if(hasFPermission== PackageManager.PERMISSION_GRANTED&&hasCPermission== PackageManager.PERMISSION_GRANTED){ | 109 | if(hasFPermission== PackageManager.PERMISSION_GRANTED&&hasCPermission== PackageManager.PERMISSION_GRANTED){ |
110 | return true; | 110 | return true; |
111 | } | 111 | } |
112 | ActivityCompat.requestPermissions(activity, | 112 | ActivityCompat.requestPermissions(activity, |
113 | new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, | 113 | new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, |
114 | PermissionUtil.REQUEST_LOCATION); | 114 | PermissionUtil.REQUEST_LOCATION); |
115 | return false; | 115 | return false; |
116 | } | 116 | } |
117 | 117 | ||
118 | } | 118 | } |
119 | 119 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/PhoneNumCheckUtils.java
1 | package com.hjx.personalcenter.util; | 1 | package com.hjx.personalcenter.util; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Created by l on 2017/7/18. | 4 | * Created by l on 2017/7/18. |
5 | */ | 5 | */ |
6 | import java.util.regex.Pattern; | 6 | import java.util.regex.Pattern; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * 手机号码或座机号码格式合法性验证 | 9 | * 手机号码或座机号码格式合法性验证 |
10 | * 判断手机号码是否合法(移动,联通,电信) | 10 | * 判断手机号码是否合法(移动,联通,电信) |
11 | * | 11 | * |
12 | * @author F | 12 | * @author F |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | public class PhoneNumCheckUtils { | 15 | public class PhoneNumCheckUtils { |
16 | 16 | ||
17 | private static final String PHONE_CALL_PATTERN = "^(\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(-\\d{1,4})?$"; | 17 | private static final String PHONE_CALL_PATTERN = "^(\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(-\\d{1,4})?$"; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * 中国电信号码格式验证 手机段: 133,153,180,181,189,177,1700,173 | 20 | * 中国电信号码格式验证 手机段: 133,153,180,181,189,177,1700,173,199 |
21 | * **/ | 21 | * **/ |
22 | private static final String CHINA_TELECOM_PATTERN = "(^1(33|53|7[37]|8[019])\\d{8}$)|(^1700\\d{7}$)"; | 22 | private static final String CHINA_TELECOM_PATTERN = "(^1(33|53|7[37]|8[019]|9[9])\\d{8}$)|(^1700\\d{7}$)"; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * 中国联通号码格式验证 手机段:130,131,132,155,156,185,186,145,176,1707,1708,1709 | 25 | * 中国联通号码格式验证 手机段:130,131,132,155,156,185,186,145,176,1707,1708,1709,166 |
26 | * **/ | 26 | * **/ |
27 | private static final String CHINA_UNICOM_PATTERN = "(^1(3[0-2]|4[5]|5[56]|7[6]|8[56])\\d{8}$)|(^170[7-9]\\d{7}$)"; | 27 | private static final String CHINA_UNICOM_PATTERN = "(^1(3[0-2]|4[5]|5[56]|6[6]|7[6]|8[56])\\d{8}$)|(^170[7-9]\\d{7}$)"; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * 中国移动号码格式验证 | 30 | * 中国移动号码格式验证 |
31 | * 手机段:134,135,136,137,138,139,150,151,152,157,158,159,182,183,184 | 31 | * 手机段:134,135,136,137,138,139,150,151,152,157,158,159,182,183,184 |
32 | * ,187,188,147,178,1705 | 32 | * ,187,188,147,178,1705,198 |
33 | * | 33 | * |
34 | **/ | 34 | **/ |
35 | private static final String CHINA_MOBILE_PATTERN = "(^1(3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478])\\d{8}$)|(^1705\\d{7}$)"; | 35 | private static final String CHINA_MOBILE_PATTERN = "(^1(3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478]|9[8])\\d{8}$)|(^1705\\d{7}$)"; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * 仅手机号格式校验 | 38 | * 仅手机号格式校验 |
39 | */ | 39 | */ |
40 | private static final String PHONE_PATTERN = new StringBuilder(300) | 40 | private static final String PHONE_PATTERN = new StringBuilder(300) |
41 | .append(CHINA_MOBILE_PATTERN).append("|") | 41 | .append(CHINA_MOBILE_PATTERN).append("|") |
42 | .append(CHINA_TELECOM_PATTERN).append("|") | 42 | .append(CHINA_TELECOM_PATTERN).append("|") |
43 | .append(CHINA_UNICOM_PATTERN).toString(); | 43 | .append(CHINA_UNICOM_PATTERN).toString(); |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * 手机和座机号格式校验 | 46 | * 手机和座机号格式校验 |
47 | */ | 47 | */ |
48 | private static final String PHONE_TEL_PATTERN = new StringBuilder(350) | 48 | private static final String PHONE_TEL_PATTERN = new StringBuilder(350) |
49 | .append(PHONE_PATTERN).append("|").append("(") | 49 | .append(PHONE_PATTERN).append("|").append("(") |
50 | .append(PHONE_CALL_PATTERN).append(")").toString(); | 50 | .append(PHONE_CALL_PATTERN).append(")").toString(); |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * 匹配多个号码以,、或空格隔开的格式,如 17750581369 | 53 | * 匹配多个号码以,、或空格隔开的格式,如 17750581369 |
54 | * 13306061248、(596)3370653,17750581369,13306061248 (0596)3370653 | 54 | * 13306061248、(596)3370653,17750581369,13306061248 (0596)3370653 |
55 | */ | 55 | */ |
56 | private static final String MULTI_PHONE_TEL_PATTERN = "^(?:(?:(?:(?:(?:(?:13[0-9])|(?:14[57])|(?:15[0-35-9])|(?:17[36-8])|(?:18[0-9]))\\d{8})|(?:170[057-9]\\d{7})|(?:\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(?:-\\d{1,4})?)[,\\s、])+)?(?:(?:(?:(?:13[0-9])|(?:14[57])|(?:15[0-35-9])|(?:17[36-8])|(?:18[0-9]))\\d{8})|(?:170[057-9]\\d{7})|(?:\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(?:-\\d{1,4})?)$"; | 56 | private static final String MULTI_PHONE_TEL_PATTERN = "^(?:(?:(?:(?:(?:(?:13[0-9])|(?:14[57])|(?:15[0-35-9])|(?:17[36-8])|(?:18[0-9]))\\d{8})|(?:170[057-9]\\d{7})|(?:\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(?:-\\d{1,4})?)[,\\s、])+)?(?:(?:(?:(?:13[0-9])|(?:14[57])|(?:15[0-35-9])|(?:17[36-8])|(?:18[0-9]))\\d{8})|(?:170[057-9]\\d{7})|(?:\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(?:-\\d{1,4})?)$"; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * 匹配多个号码以,、或空格隔开的格式,如 17750581369 | 59 | * 匹配多个号码以,、或空格隔开的格式,如 17750581369 |
60 | * 13306061248、(596)3370653,17750581369,13306061248 (0596)3370653 | 60 | * 13306061248、(596)3370653,17750581369,13306061248 (0596)3370653 |
61 | * | 61 | * |
62 | * @param input | 62 | * @param input |
63 | * @return | 63 | * @return |
64 | */ | 64 | */ |
65 | public static boolean checkMultiPhone(String input) { | 65 | public static boolean checkMultiPhone(String input) { |
66 | return match(MULTI_PHONE_TEL_PATTERN, input); | 66 | return match(MULTI_PHONE_TEL_PATTERN, input); |
67 | } | 67 | } |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * 仅手机号码校验 | 70 | * 仅手机号码校验 |
71 | * | 71 | * |
72 | * @param input | 72 | * @param input |
73 | * @return | 73 | * @return |
74 | */ | 74 | */ |
75 | public static boolean isPhone(String input) { | 75 | public static boolean isPhone(String input) { |
76 | return match(PHONE_PATTERN, input); | 76 | // return match(PHONE_PATTERN, input); |
77 | if(input.length()==11){ | ||
78 | return true; | ||
79 | }else{ | ||
80 | return false; | ||
81 | } | ||
77 | } | 82 | } |
78 | 83 | ||
79 | /** | 84 | /** |
80 | * 手机号或座机号校验 | 85 | * 手机号或座机号校验 |
81 | * | 86 | * |
82 | * @param input | 87 | * @param input |
83 | * @return | 88 | * @return |
84 | */ | 89 | */ |
85 | public static boolean isPhoneOrTel(String input) { | 90 | public static boolean isPhoneOrTel(String input) { |
86 | System.out.println(PHONE_TEL_PATTERN); | 91 | System.out.println(PHONE_TEL_PATTERN); |
87 | return match(PHONE_TEL_PATTERN, input); | 92 | return match(PHONE_TEL_PATTERN, input); |
88 | } | 93 | } |
89 | 94 | ||
90 | /** | 95 | /** |
91 | * 验证电话号码的格式 | 96 | * 验证电话号码的格式 |
92 | * | 97 | * |
93 | * @author F | 98 | * @author F |
94 | * @param str | 99 | * @param str |
95 | * 校验电话字符串 | 100 | * 校验电话字符串 |
96 | * @return 返回true,否则为false | 101 | * @return 返回true,否则为false |
97 | */ | 102 | */ |
98 | public static boolean isPhoneCallNum(String str) { | 103 | public static boolean isPhoneCallNum(String str) { |
99 | return match(PHONE_CALL_PATTERN, str); | 104 | return match(PHONE_CALL_PATTERN, str); |
100 | } | 105 | } |
101 | 106 | ||
102 | /** | 107 | /** |
103 | * 验证【电信】手机号码的格式 | 108 | * 验证【电信】手机号码的格式 |
104 | * | 109 | * |
105 | * @author F | 110 | * @author F |
106 | * @param str | 111 | * @param str |
107 | * 校验手机字符串 | 112 | * 校验手机字符串 |
108 | * @return 返回true,否则为false | 113 | * @return 返回true,否则为false |
109 | */ | 114 | */ |
110 | public static boolean isChinaTelecomPhoneNum(String str) { | 115 | public static boolean isChinaTelecomPhoneNum(String str) { |
111 | return match(CHINA_TELECOM_PATTERN, str); | 116 | return match(CHINA_TELECOM_PATTERN, str); |
112 | } | 117 | } |
113 | 118 | ||
114 | /** | 119 | /** |
115 | * 验证【联通】手机号码的格式 | 120 | * 验证【联通】手机号码的格式 |
116 | * | 121 | * |
117 | * @author F | 122 | * @author F |
118 | * @param str | 123 | * @param str |
119 | * 校验手机字符串 | 124 | * 校验手机字符串 |
120 | * @return 返回true,否则为false | 125 | * @return 返回true,否则为false |
121 | */ | 126 | */ |
122 | public static boolean isChinaUnicomPhoneNum(String str) { | 127 | public static boolean isChinaUnicomPhoneNum(String str) { |
123 | return match(CHINA_UNICOM_PATTERN, str); | 128 | return match(CHINA_UNICOM_PATTERN, str); |
124 | } | 129 | } |
125 | 130 | ||
126 | /** | 131 | /** |
127 | * 验证【移动】手机号码的格式 | 132 | * 验证【移动】手机号码的格式 |
128 | * | 133 | * |
129 | * @author F | 134 | * @author F |
130 | * @param str | 135 | * @param str |
131 | * 校验手机字符串 | 136 | * 校验手机字符串 |
132 | * @return 返回true,否则为false | 137 | * @return 返回true,否则为false |
133 | */ | 138 | */ |
134 | public static boolean isChinaMobilePhoneNum(String str) { | 139 | public static boolean isChinaMobilePhoneNum(String str) { |
135 | return match(CHINA_MOBILE_PATTERN, str); | 140 | return match(CHINA_MOBILE_PATTERN, str); |
136 | } | 141 | } |
137 | 142 | ||
138 | /** | 143 | /** |
139 | * 匹配函数 | 144 | * 匹配函数 |
140 | * | 145 | * |
141 | * @param regex | 146 | * @param regex |
142 | * @param input | 147 | * @param input |
143 | * @return | 148 | * @return |
144 | */ | 149 | */ |
145 | private static boolean match(String regex, String input) { | 150 | private static boolean match(String regex, String input) { |
146 | return Pattern.matches(regex, input); | 151 | return Pattern.matches(regex, input); |
147 | } | 152 | } |
148 | } | 153 | } |
149 | 154 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/VersionCodeUtils.java
File was created | 1 | package com.hjx.personalcenter.util; | |
2 | |||
3 | import android.content.Context; | ||
4 | import android.content.pm.PackageManager; | ||
5 | |||
6 | import com.hjx.personalcenter.activity.MyApplication; | ||
7 | |||
8 | /** | ||
9 | * Created by liujiaqi on 2018/4/11. | ||
10 | */ | ||
11 | |||
12 | public class VersionCodeUtils { | ||
13 | /** | ||
14 | * 获取当前本地apk的版本 | ||
15 | * | ||
16 | * @return | ||
17 | */ | ||
18 | public static int getVersionCode() { | ||
19 | int versionCode = 0; | ||
20 | try { | ||
21 | //获取软件版本号,对应AndroidManifest.xml下android:versionCode | ||
22 | versionCode = MyApplication.getInstance().getPackageManager(). | ||
23 | getPackageInfo(MyApplication.getInstance().getPackageName(), 0).versionCode; | ||
24 | } catch (PackageManager.NameNotFoundException e) { | ||
25 | e.printStackTrace(); | ||
26 | } | ||
27 | return versionCode; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * 获取版本号名称 | ||
32 | * | ||
33 | * @return | ||
34 | */ | ||
35 | public static String getVerName() { | ||
36 | String verName = ""; | ||
37 | try { | ||
38 | verName = MyApplication.getInstance().getPackageManager(). | ||
39 | getPackageInfo(MyApplication.getInstance().getPackageName(), 0).versionName; | ||
40 | } catch (PackageManager.NameNotFoundException e) { | ||
41 | e.printStackTrace(); | ||
42 | } | ||
43 | return verName; | ||
44 | } | ||
45 | } | ||
1 | package com.hjx.personalcenter.util; | 46 |
PersonalCenter/app/src/main/res/drawable/blue_btn_bg_normal.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:shape="rectangle" > | 3 | android:shape="rectangle" > |
4 | 4 | ||
5 | <solid android:color="@color/login_text_blue" /> | 5 | <solid android:color="@color/login_text_blue" /> |
6 | 6 | ||
7 | <corners | 7 | <corners |
8 | android:bottomLeftRadius="8dp" | 8 | android:radius="30dp"/> |
9 | android:bottomRightRadius="8dp" | ||
10 | android:topLeftRadius="8dp" | ||
11 | android:topRightRadius="8dp" /> | ||
12 | 9 | ||
13 | <stroke | 10 | <stroke |
14 | android:width="1px" | 11 | android:width="1px" |
15 | android:color="@color/login_text_blue" /> | 12 | android:color="@color/login_text_blue" /> |
16 | 13 | ||
17 | </shape> | 14 | </shape> |
PersonalCenter/app/src/main/res/drawable/blue_btn_bg_pressed.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:shape="rectangle" > | 3 | android:shape="rectangle" > |
4 | 4 | ||
5 | <solid android:color="@color/login_text_blue" /> | 5 | <solid android:color="@color/login_text_blue" /> |
6 | 6 | ||
7 | <corners | 7 | <corners |
8 | android:bottomLeftRadius="8dp" | 8 | android:radius="30dp"/> |
9 | android:bottomRightRadius="8dp" | ||
10 | android:topLeftRadius="8dp" | ||
11 | android:topRightRadius="8dp" /> | ||
12 | 9 | ||
13 | <stroke | 10 | <stroke |
14 | android:width="1px" | 11 | android:width="1px" |
15 | android:color="@color/login_text_blue" /> | 12 | android:color="@color/login_text_blue" /> |
16 | 13 | ||
17 | </shape> | 14 | </shape> |
PersonalCenter/app/src/main/res/drawable/code_bg.xml
File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | android:shape="rectangle" > | ||
4 | |||
5 | <solid android:color="@color/input_bg"/> | ||
6 | |||
7 | <corners android:radius="30dip"/> | ||
8 | <!--显示一条虚线,破折线的宽度为dashWith,破折线之间的空隙的宽度为dashGap,当dashGap=0dp时,为实线 --> | ||
9 | <stroke | ||
10 | android:dashGap="0dp" | ||
11 | android:dashWidth="2dp" | ||
12 | android:width="1.5dp" | ||
13 | android:color="@color/login_text_blue" /> | ||
14 | </shape> |
PersonalCenter/app/src/main/res/drawable/input_bg.xml
File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | android:shape="rectangle" > | ||
4 | |||
5 | <solid android:color="@color/input_bg"/> | ||
6 | |||
7 | <corners android:radius="30dip"/> | ||
8 | |||
9 | </shape> |
PersonalCenter/app/src/main/res/drawable/white_cycle_bg.xml
File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | android:shape="rectangle" > | ||
4 | |||
5 | <solid android:color="@color/white"/> | ||
6 | |||
7 | <corners android:radius="20dip"/> | ||
8 | |||
9 | </shape> |
PersonalCenter/app/src/main/res/layout/activity_changepsword.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:background="#ffffffff" | 5 | android:background="@mipmap/main_bg" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | 7 | ||
8 | <RelativeLayout | 8 | <RelativeLayout |
9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
12 | android:background="@color/login_text_blue" | 12 | android:background="@color/login_text_blue" |
13 | android:minHeight="50dp"> | 13 | android:minHeight="50dp"> |
14 | 14 | ||
15 | <ImageView | 15 | <ImageView |
16 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
17 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
19 | android:layout_centerVertical="true" | 19 | android:layout_centerVertical="true" |
20 | android:paddingLeft="20dp" | 20 | android:paddingLeft="20dp" |
21 | android:paddingRight="20dp" | 21 | android:paddingRight="20dp" |
22 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
23 | 23 | ||
24 | <TextView | 24 | <TextView |
25 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
29 | android:text="修改密码" | 29 | android:text="修改密码" |
30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
32 | </RelativeLayout> | 32 | </RelativeLayout> |
33 | 33 | ||
34 | <RelativeLayout | 34 | <LinearLayout |
35 | android:layout_width="match_parent" | 35 | android:layout_width="550dp" |
36 | android:layout_height="match_parent" | 36 | android:layout_height="600dp" |
37 | android:layout_below="@id/title" | 37 | android:layout_centerInParent="true" |
38 | android:background="#ffffffff" | 38 | android:layout_marginTop="20dp" |
39 | android:orientation="vertical" | 39 | android:background="@drawable/white_cycle_bg" |
40 | android:paddingLeft="250dp" | 40 | android:paddingLeft="30dp" |
41 | android:paddingRight="250dp"> | 41 | android:paddingRight="30dp" |
42 | 42 | android:orientation="vertical"> | |
43 | <RelativeLayout | 43 | |
44 | <ImageView | ||
45 | android:id="@+id/iv_logo" | ||
46 | android:layout_width="wrap_content" | ||
47 | android:layout_height="wrap_content" | ||
48 | android:layout_gravity="center_horizontal" | ||
49 | android:layout_marginTop="15dp" | ||
50 | android:src="@mipmap/logo" /> | ||
51 | |||
52 | |||
53 | <LinearLayout | ||
44 | android:id="@+id/pwd_rl" | 54 | android:id="@+id/pwd_rl" |
45 | android:layout_width="match_parent" | 55 | android:layout_width="match_parent" |
46 | android:layout_height="wrap_content" | 56 | android:layout_height="wrap_content" |
47 | android:layout_marginTop="100dp"> | 57 | android:layout_marginTop="30dp" |
58 | android:background="@drawable/input_bg" | ||
59 | android:gravity="center_horizontal" | ||
60 | android:orientation="horizontal" | ||
61 | android:paddingRight="10dp"> | ||
48 | 62 | ||
49 | <EditText | 63 | <EditText |
50 | android:id="@+id/et_oldpassword" | 64 | android:id="@+id/et_oldpassword" |
51 | style="@style/login_register_edit_style" | 65 | style="@style/login_register_edit_style" |
52 | android:hint="输入原密码" | 66 | android:hint="输入原密码" |
53 | android:inputType="textPassword" /> | 67 | android:imeOptions="actionNext" |
68 | android:inputType="textPassword" | ||
69 | android:maxLength="11" /> | ||
54 | 70 | ||
55 | </RelativeLayout> | 71 | <ImageButton |
72 | android:id="@+id/oldpassword_delete_btn" | ||
73 | android:layout_width="50dp" | ||
74 | android:layout_height="match_parent" | ||
75 | android:background="@null" | ||
76 | android:src="@mipmap/delete_btn" | ||
77 | android:visibility="invisible" /> | ||
78 | </LinearLayout> | ||
56 | 79 | ||
57 | 80 | ||
58 | <TextView | 81 | <LinearLayout |
59 | android:id="@+id/oldpassword_error_hint" | ||
60 | style="@style/registererrhint_style" | ||
61 | android:layout_below="@id/pwd_rl" /> | ||
62 | <RelativeLayout | ||
63 | android:id="@+id/et_newpassworda" | ||
64 | android:layout_width="match_parent" | 82 | android:layout_width="match_parent" |
65 | android:layout_below="@id/pwd_rl" | 83 | android:layout_height="wrap_content" |
66 | android:layout_marginTop="30dp" | 84 | android:layout_below="@id/rl_authcode" |
67 | android:layout_height="wrap_content"> | 85 | android:background="@drawable/input_bg" |
86 | android:gravity="center_vertical" | ||
87 | android:layout_marginTop="40dp"> | ||
88 | |||
68 | <EditText | 89 | <EditText |
69 | android:id="@+id/et_newpassword" | 90 | android:id="@+id/et_newpassword" |
70 | style="@style/login_register_edit_style" | 91 | style="@style/login_register_edit_style" |
71 | android:hint="密码为英文和数字组成,最少8位" | 92 | android:hint="密码为英文和数字组成,最少8位" |
72 | android:inputType="textPassword" /> | 93 | android:inputType="textPassword" /> |
94 | |||
73 | <ImageView | 95 | <ImageView |
74 | android:id="@+id/iv_pwd_change" | 96 | android:id="@+id/iv_pwd_change" |
75 | android:padding="10dp" | ||
76 | android:layout_width="40dp" | 97 | android:layout_width="40dp" |
77 | android:layout_marginRight="10dp" | ||
78 | android:layout_height="wrap_content" | 98 | android:layout_height="wrap_content" |
79 | android:layout_alignParentRight="true" | 99 | android:layout_alignParentRight="true" |
80 | android:layout_centerVertical="true" | 100 | android:layout_centerVertical="true" |
101 | android:layout_marginLeft="10dp" | ||
102 | android:layout_marginRight="15dp" | ||
103 | android:padding="10dp" | ||
81 | android:src="@mipmap/pwd_hide" /> | 104 | android:src="@mipmap/pwd_hide" /> |
105 | </LinearLayout> | ||
82 | 106 | ||
83 | </RelativeLayout> | ||
84 | 107 | ||
85 | 108 | ||
109 | <LinearLayout | ||
110 | android:id="@+id/et_again_newpassword_layout" | ||
111 | android:layout_width="match_parent" | ||
112 | android:layout_height="wrap_content" | ||
113 | android:layout_marginTop="40dp" | ||
114 | android:background="@drawable/input_bg" | ||
115 | android:gravity="center_vertical" | ||
116 | android:orientation="horizontal"> | ||
86 | 117 | ||
87 | <TextView | 118 | <EditText |
88 | android:id="@+id/newpassword_error_hint" | 119 | android:id="@+id/et_again_newpassword" |
89 | style="@style/registererrhint_style" | 120 | style="@style/login_register_edit_style" |
90 | android:layout_below="@id/et_newpassworda" /> | 121 | android:layout_below="@id/pwd_rl" |
122 | android:hint="再次输入新密码" | ||
123 | android:inputType="textPassword" /> | ||
91 | 124 | ||
92 | <EditText | 125 | <ImageView |
93 | android:id="@+id/et_again_newpassword" | 126 | android:id="@+id/iv_newpwd_change" |
94 | style="@style/login_register_edit_style" | 127 | android:layout_width="40dp" |
95 | android:layout_below="@id/et_newpassworda" | 128 | android:layout_height="wrap_content" |
96 | android:layout_marginTop="30dp" | 129 | android:layout_alignParentRight="true" |
97 | android:hint="再次输入新密码" | 130 | android:layout_centerVertical="true" |
98 | android:inputType="textPassword" /> | 131 | android:layout_marginLeft="10dp" |
132 | android:layout_marginRight="15dp" | ||
133 | android:padding="10dp" | ||
134 | android:src="@mipmap/pwd_hide" /> | ||
135 | </LinearLayout> | ||
99 | 136 | ||
100 | <TextView | 137 | <TextView |
101 | android:id="@+id/again_newpassword_error_hint" | 138 | android:id="@+id/again_newpassword_error_hint" |
102 | style="@style/registererrhint_style" | 139 | style="@style/registererrhint_style" |
103 | android:layout_below="@id/et_again_newpassword" /> | 140 | android:layout_below="@id/et_again_newpassword" /> |
104 | 141 | ||
105 | <Button | 142 | <Button |
PersonalCenter/app/src/main/res/layout/activity_electronic_look_cardinfo.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:orientation="vertical"> | 5 | android:orientation="vertical"> |
6 | 6 | ||
7 | <RelativeLayout | 7 | <RelativeLayout |
8 | android:id="@+id/title" | 8 | android:id="@+id/title" |
9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
11 | android:background="@color/login_text_blue" | 11 | android:background="@color/login_text_blue" |
12 | android:minHeight="50dp"> | 12 | android:minHeight="50dp"> |
13 | 13 | ||
14 | <ImageView | 14 | <ImageView |
15 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
16 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
17 | android:layout_height="wrap_content" | 17 | android:layout_height="wrap_content" |
18 | android:layout_centerVertical="true" | 18 | android:layout_centerVertical="true" |
19 | android:paddingLeft="20dp" | 19 | android:paddingLeft="20dp" |
20 | android:paddingRight="20dp" | 20 | android:paddingRight="20dp" |
21 | android:src="@mipmap/title_back" /> | 21 | android:src="@mipmap/title_back" /> |
22 | 22 | ||
23 | <TextView | 23 | <TextView |
24 | android:id="@+id/menu_title" | 24 | android:id="@+id/menu_title" |
25 | android:layout_width="wrap_content" | 25 | android:layout_width="wrap_content" |
26 | android:layout_height="wrap_content" | 26 | android:layout_height="wrap_content" |
27 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
28 | android:text="@string/string_electroniccard_info_look" | 28 | android:text="@string/string_electroniccard_info_look" |
29 | android:textColor="@android:color/white" | 29 | android:textColor="@android:color/white" |
30 | android:textSize="22sp" /> | 30 | android:textSize="22sp" /> |
31 | </RelativeLayout> | 31 | </RelativeLayout> |
32 | 32 | ||
33 | <LinearLayout | 33 | <LinearLayout |
34 | android:layout_width="match_parent" | 34 | android:layout_width="match_parent" |
35 | android:layout_height="wrap_content" | 35 | android:layout_height="wrap_content" |
36 | android:layout_margin="20dp" | 36 | android:layout_margin="20dp" |
37 | android:background="@mipmap/cardbackgrangd" | 37 | android:background="@mipmap/cardbackgrangd" |
38 | android:gravity="center" | 38 | android:gravity="center" |
39 | android:orientation="vertical"> | 39 | android:orientation="vertical"> |
40 | 40 | ||
41 | <LinearLayout | 41 | <LinearLayout |
42 | android:layout_width="match_parent" | 42 | android:layout_width="match_parent" |
43 | android:layout_height="wrap_content" | 43 | android:layout_height="wrap_content" |
44 | android:layout_marginTop="70dp" | 44 | android:layout_marginTop="70dp" |
45 | android:gravity="center_vertical" | 45 | android:gravity="center_vertical" |
46 | android:orientation="horizontal"> | 46 | android:orientation="horizontal"> |
47 | 47 | ||
48 | <LinearLayout | 48 | <LinearLayout |
49 | android:layout_width="0dp" | 49 | android:layout_width="0dp" |
50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
51 | android:layout_marginLeft="200dp" | 51 | android:layout_marginLeft="200dp" |
52 | android:layout_weight="1" | 52 | android:layout_weight="1" |
53 | android:gravity="center_vertical"> | 53 | android:gravity="center_vertical"> |
54 | 54 | ||
55 | <ImageView | 55 | <ImageView |
56 | android:layout_width="wrap_content" | 56 | android:layout_width="wrap_content" |
57 | android:layout_height="wrap_content" | 57 | android:layout_height="wrap_content" |
58 | android:src="@mipmap/logo_info" /> | 58 | android:src="@mipmap/logo_info" /> |
59 | 59 | ||
60 | <TextView | 60 | <TextView |
61 | android:layout_width="wrap_content" | 61 | android:layout_width="wrap_content" |
62 | android:layout_height="wrap_content" | 62 | android:layout_height="wrap_content" |
63 | android:layout_marginLeft="50dp" | 63 | android:layout_marginLeft="50dp" |
64 | android:background="@null" | 64 | android:background="@null" |
65 | android:text="电子保卡" | 65 | android:text="电子保卡" |
66 | android:textColor="@color/electronic_card" | 66 | android:textColor="@color/electronic_card" |
67 | android:textSize="22sp" /> | 67 | android:textSize="22sp" /> |
68 | 68 | ||
69 | </LinearLayout> | 69 | </LinearLayout> |
70 | 70 | ||
71 | <LinearLayout | 71 | <LinearLayout |
72 | android:layout_width="0dp" | 72 | android:layout_width="0dp" |
73 | android:layout_height="80dp" | 73 | android:layout_height="80dp" |
74 | android:layout_weight="1" | 74 | android:layout_weight="1" |
75 | android:layout_marginLeft="80dp" | 75 | android:layout_marginLeft="80dp" |
76 | android:gravity="center_vertical"> | 76 | android:gravity="center_vertical"> |
77 | 77 | ||
78 | <TextView | 78 | <TextView |
79 | android:layout_width="wrap_content" | 79 | android:layout_width="wrap_content" |
80 | android:layout_height="wrap_content" | 80 | android:layout_height="wrap_content" |
81 | android:text="客户姓名" | 81 | android:text="客户姓名" |
82 | android:textSize="22sp" /> | 82 | android:textSize="22sp" /> |
83 | 83 | ||
84 | <TextView | 84 | <TextView |
85 | android:id="@+id/iv_card_username" | 85 | android:id="@+id/iv_card_username" |
86 | android:layout_width="wrap_content" | 86 | android:layout_width="wrap_content" |
87 | android:layout_height="wrap_content" | 87 | android:layout_height="wrap_content" |
88 | android:layout_marginLeft="60dp" | 88 | android:layout_marginLeft="60dp" |
89 | android:text="" | 89 | android:text="" |
90 | android:textSize="22sp" /> | 90 | android:textSize="22sp" /> |
91 | 91 | ||
92 | </LinearLayout> | 92 | </LinearLayout> |
93 | 93 | ||
94 | </LinearLayout> | 94 | </LinearLayout> |
95 | 95 | ||
96 | <LinearLayout | 96 | <LinearLayout |
97 | android:layout_width="match_parent" | 97 | android:layout_width="match_parent" |
98 | android:layout_height="wrap_content" | 98 | android:layout_height="wrap_content" |
99 | android:gravity="center_vertical" | 99 | android:gravity="center_vertical" |
100 | android:orientation="horizontal"> | 100 | android:orientation="horizontal"> |
101 | 101 | ||
102 | <LinearLayout | 102 | <LinearLayout |
103 | android:layout_width="0dp" | 103 | android:layout_width="0dp" |
104 | android:layout_height="60dp" | 104 | android:layout_height="60dp" |
105 | android:layout_weight="1" | 105 | android:layout_weight="1" |
106 | android:layout_marginLeft="200dp" | 106 | android:layout_marginLeft="200dp" |
107 | android:gravity="center_vertical"> | 107 | android:gravity="center_vertical"> |
108 | 108 | ||
109 | <TextView | 109 | <TextView |
110 | android:layout_width="wrap_content" | 110 | android:layout_width="wrap_content" |
111 | android:layout_height="wrap_content" | 111 | android:layout_height="wrap_content" |
112 | android:text="产品型号" | 112 | android:text="产品型号" |
113 | android:textSize="22sp" /> | 113 | android:textSize="22sp" /> |
114 | 114 | ||
115 | <TextView | 115 | <TextView |
116 | android:id="@+id/tv_card_deviceModel" | 116 | android:id="@+id/tv_card_deviceModel" |
117 | android:layout_width="wrap_content" | 117 | android:layout_width="wrap_content" |
118 | android:layout_height="wrap_content" | 118 | android:layout_height="wrap_content" |
119 | android:layout_marginLeft="50dp" | 119 | android:layout_marginLeft="50dp" |
120 | android:text="" | 120 | android:text="" |
121 | android:textSize="22sp" /> | 121 | android:textSize="22sp" /> |
122 | 122 | ||
123 | 123 | ||
124 | </LinearLayout> | 124 | </LinearLayout> |
125 | 125 | ||
126 | <LinearLayout | 126 | <LinearLayout |
127 | android:layout_width="0dp" | 127 | android:layout_width="0dp" |
128 | android:layout_height="60dp" | 128 | android:layout_height="60dp" |
129 | android:layout_weight="1" | 129 | android:layout_weight="1" |
130 | android:layout_marginLeft="80dp" | 130 | android:layout_marginLeft="80dp" |
131 | android:gravity="center_vertical"> | 131 | android:gravity="center_vertical"> |
132 | 132 | ||
133 | <TextView | 133 | <TextView |
134 | android:layout_width="wrap_content" | 134 | android:layout_width="wrap_content" |
135 | android:layout_height="wrap_content" | 135 | android:layout_height="wrap_content" |
136 | android:text="客户地址" | 136 | android:text="客户地址" |
137 | android:textSize="22sp" /> | 137 | android:textSize="22sp" /> |
138 | 138 | ||
139 | <TextView | 139 | <TextView |
140 | android:id="@+id/tv_card_adress" | 140 | android:id="@+id/tv_card_adress" |
141 | android:layout_width="wrap_content" | 141 | android:layout_width="wrap_content" |
142 | android:layout_height="wrap_content" | 142 | android:layout_height="wrap_content" |
143 | android:layout_marginLeft="60dp" | 143 | android:layout_marginLeft="60dp" |
144 | android:text="" | 144 | android:text="" |
145 | android:textSize="22sp" /> | 145 | android:textSize="22sp" /> |
146 | <TextView | 146 | <TextView |
147 | android:id="@+id/tv_card_adress_change" | 147 | android:id="@+id/tv_card_adress_change" |
148 | android:layout_width="wrap_content" | 148 | android:layout_width="wrap_content" |
149 | android:layout_height="wrap_content" | 149 | android:layout_height="wrap_content" |
150 | android:layout_marginLeft="18dp" | 150 | android:layout_marginLeft="18dp" |
151 | android:background="@drawable/corcle_blue_bg" | 151 | android:background="@drawable/corcle_blue_bg" |
152 | android:text="修改" | 152 | android:text="修改" |
153 | android:paddingLeft="5dp" | 153 | android:paddingLeft="5dp" |
154 | android:paddingRight="5dp" | 154 | android:paddingRight="5dp" |
155 | android:visibility="gone" | ||
155 | android:textColor="@color/login_text_blue" | 156 | android:textColor="@color/login_text_blue" |
156 | android:textSize="18sp" /> | 157 | android:textSize="18sp" /> |
157 | 158 | ||
158 | 159 | ||
159 | </LinearLayout> | 160 | </LinearLayout> |
160 | 161 | ||
161 | </LinearLayout> | 162 | </LinearLayout> |
162 | 163 | ||
163 | <LinearLayout | 164 | <LinearLayout |
164 | android:layout_width="match_parent" | 165 | android:layout_width="match_parent" |
165 | android:layout_height="wrap_content" | 166 | android:layout_height="wrap_content" |
166 | android:gravity="center_vertical" | 167 | android:gravity="center_vertical" |
167 | android:orientation="horizontal"> | 168 | android:orientation="horizontal"> |
168 | 169 | ||
169 | <LinearLayout | 170 | <LinearLayout |
170 | android:layout_width="0dp" | 171 | android:layout_width="0dp" |
171 | android:layout_height="60dp" | 172 | android:layout_height="60dp" |
172 | android:layout_weight="1" | 173 | android:layout_weight="1" |
173 | android:layout_marginLeft="200dp" | 174 | android:layout_marginLeft="200dp" |
174 | android:gravity="center_vertical"> | 175 | android:gravity="center_vertical"> |
175 | 176 | ||
176 | <TextView | 177 | <TextView |
177 | android:layout_width="wrap_content" | 178 | android:layout_width="wrap_content" |
178 | android:layout_height="wrap_content" | 179 | android:layout_height="wrap_content" |
179 | android:text="MAC地址" | 180 | android:text="MAC地址" |
180 | android:textSize="22sp" /> | 181 | android:textSize="22sp" /> |
181 | 182 | ||
182 | <TextView | 183 | <TextView |
183 | android:id="@+id/tv_card_mac" | 184 | android:id="@+id/tv_card_mac" |
184 | android:layout_width="wrap_content" | 185 | android:layout_width="wrap_content" |
185 | android:layout_height="wrap_content" | 186 | android:layout_height="wrap_content" |
186 | android:layout_marginLeft="50dp" | 187 | android:layout_marginLeft="50dp" |
187 | android:text="" | 188 | android:text="" |
188 | android:textSize="22sp" /> | 189 | android:textSize="22sp" /> |
189 | 190 | ||
190 | </LinearLayout> | 191 | </LinearLayout> |
191 | 192 | ||
192 | <LinearLayout | 193 | <LinearLayout |
193 | android:layout_width="0dp" | 194 | android:layout_width="0dp" |
194 | android:layout_height="60dp" | 195 | android:layout_height="60dp" |
195 | android:layout_weight="1" | 196 | android:layout_weight="1" |
196 | android:layout_marginLeft="80dp" | 197 | android:layout_marginLeft="80dp" |
197 | android:gravity="center_vertical"> | 198 | android:gravity="center_vertical"> |
198 | 199 | ||
199 | <TextView | 200 | <TextView |
200 | android:layout_width="wrap_content" | 201 | android:layout_width="wrap_content" |
201 | android:layout_height="wrap_content" | 202 | android:layout_height="wrap_content" |
202 | android:text="购买时间" | 203 | android:text="购买时间" |
203 | android:textSize="22sp" /> | 204 | android:textSize="22sp" /> |
204 | 205 | ||
205 | <TextView | 206 | <TextView |
206 | android:id="@+id/tv_card_time" | 207 | android:id="@+id/tv_card_time" |
207 | android:layout_width="wrap_content" | 208 | android:layout_width="wrap_content" |
208 | android:layout_height="wrap_content" | 209 | android:layout_height="wrap_content" |
209 | android:layout_marginLeft="60dp" | 210 | android:layout_marginLeft="60dp" |
210 | android:text="" | 211 | android:text="" |
211 | android:textSize="22sp" /> | 212 | android:textSize="22sp" /> |
212 | </LinearLayout> | 213 | </LinearLayout> |
213 | 214 | ||
214 | </LinearLayout> | 215 | </LinearLayout> |
215 | 216 | ||
216 | <LinearLayout | 217 | <LinearLayout |
217 | android:layout_width="match_parent" | 218 | android:layout_width="match_parent" |
218 | android:layout_height="wrap_content" | 219 | android:layout_height="wrap_content" |
219 | android:gravity="center_vertical" | 220 | android:gravity="center_vertical" |
220 | android:orientation="horizontal"> | 221 | android:orientation="horizontal"> |
221 | 222 | ||
222 | <LinearLayout | 223 | <LinearLayout |
223 | android:layout_width="0dp" | 224 | android:layout_width="0dp" |
224 | android:layout_height="60dp" | 225 | android:layout_height="60dp" |
225 | android:layout_weight="1" | 226 | android:layout_weight="1" |
226 | android:layout_marginLeft="200dp" | 227 | android:layout_marginLeft="200dp" |
227 | android:gravity="center_vertical"> | 228 | android:gravity="center_vertical"> |
228 | 229 | ||
229 | <TextView | 230 | <TextView |
230 | android:layout_width="wrap_content" | 231 | android:layout_width="wrap_content" |
231 | android:layout_height="wrap_content" | 232 | android:layout_height="wrap_content" |
232 | android:text="机身编码" | 233 | android:text="机身编码" |
233 | android:textSize="22sp" /> | 234 | android:textSize="22sp" /> |
234 | 235 | ||
235 | <TextView | 236 | <TextView |
236 | android:id="@+id/tv_card_deviceNumber" | 237 | android:id="@+id/tv_card_deviceNumber" |
237 | android:layout_width="wrap_content" | 238 | android:layout_width="wrap_content" |
238 | android:layout_height="wrap_content" | 239 | android:layout_height="wrap_content" |
239 | android:layout_marginLeft="50dp" | 240 | android:layout_marginLeft="50dp" |
240 | android:hint="" | 241 | android:hint="" |
241 | android:textSize="22sp" /> | 242 | android:textSize="22sp" /> |
242 | 243 | ||
243 | </LinearLayout> | 244 | </LinearLayout> |
244 | 245 | ||
245 | <LinearLayout | 246 | <LinearLayout |
246 | android:layout_width="0dp" | 247 | android:layout_width="0dp" |
247 | android:layout_height="60dp" | 248 | android:layout_height="60dp" |
248 | android:layout_weight="1" | 249 | android:layout_weight="1" |
249 | android:layout_marginLeft="80dp" | 250 | android:layout_marginLeft="80dp" |
250 | android:gravity="center_vertical"> | 251 | android:gravity="center_vertical"> |
251 | 252 | ||
252 | <TextView | 253 | <TextView |
253 | android:layout_width="wrap_content" | 254 | android:layout_width="wrap_content" |
254 | android:layout_height="wrap_content" | 255 | android:layout_height="wrap_content" |
255 | android:text="购买地址" | 256 | android:text="购买地址" |
256 | android:textSize="22sp" /> | 257 | android:textSize="22sp" /> |
257 | 258 | ||
258 | <TextView | 259 | <TextView |
259 | android:id="@+id/tv_card_shopAdress" | 260 | android:id="@+id/tv_card_shopAdress" |
260 | android:layout_width="wrap_content" | 261 | android:layout_width="wrap_content" |
261 | android:layout_height="wrap_content" | 262 | android:layout_height="wrap_content" |
262 | android:layout_marginLeft="60dp" | 263 | android:layout_marginLeft="60dp" |
263 | android:text="" | 264 | android:text="" |
264 | android:textSize="22sp" /> | 265 | android:textSize="22sp" /> |
265 | </LinearLayout> | 266 | </LinearLayout> |
266 | 267 | ||
267 | </LinearLayout> | 268 | </LinearLayout> |
268 | 269 | ||
269 | <LinearLayout | 270 | <LinearLayout |
270 | android:layout_width="match_parent" | 271 | android:layout_width="match_parent" |
271 | android:layout_height="wrap_content" | 272 | android:layout_height="wrap_content" |
272 | android:gravity="center_vertical" | 273 | android:gravity="center_vertical" |
273 | android:layout_marginBottom="30dp" | 274 | android:layout_marginBottom="30dp" |
274 | android:orientation="horizontal"> | 275 | android:orientation="horizontal"> |
275 | 276 | ||
276 | <LinearLayout | 277 | <LinearLayout |
277 | android:layout_width="0dp" | 278 | android:layout_width="0dp" |
278 | android:layout_height="60dp" | 279 | android:layout_height="60dp" |
279 | android:layout_weight="1" | 280 | android:layout_weight="1" |
280 | android:layout_marginLeft="200dp" | 281 | android:layout_marginLeft="200dp" |
281 | android:gravity="center_vertical"> | 282 | android:gravity="center_vertical"> |
282 | 283 | ||
283 | <TextView | 284 | <TextView |
284 | android:layout_width="wrap_content" | 285 | android:layout_width="wrap_content" |
285 | android:layout_height="wrap_content" | 286 | android:layout_height="wrap_content" |
286 | android:text="手机号码" | 287 | android:text="手机号码" |
287 | android:textSize="22sp" /> | 288 | android:textSize="22sp" /> |
288 | 289 | ||
289 | <TextView | 290 | <TextView |
290 | android:id="@+id/tv_card_phone" | 291 | android:id="@+id/tv_card_phone" |
291 | android:layout_width="wrap_content" | 292 | android:layout_width="wrap_content" |
292 | android:layout_height="wrap_content" | 293 | android:layout_height="wrap_content" |
293 | android:layout_marginLeft="50dp" | 294 | android:layout_marginLeft="50dp" |
294 | android:text="" | 295 | android:text="" |
295 | android:textSize="22sp" /> | 296 | android:textSize="22sp" /> |
296 | <TextView | 297 | <TextView |
297 | android:id="@+id/tv_card_phone_change" | 298 | android:id="@+id/tv_card_phone_change" |
298 | android:layout_width="wrap_content" | 299 | android:layout_width="wrap_content" |
299 | android:layout_height="wrap_content" | 300 | android:layout_height="wrap_content" |
300 | android:layout_marginLeft="18dp" | 301 | android:layout_marginLeft="18dp" |
301 | android:background="@drawable/corcle_blue_bg" | 302 | android:background="@drawable/corcle_blue_bg" |
302 | android:text="修改" | 303 | android:text="修改" |
304 | android:visibility="gone" | ||
303 | android:visibility="gone" | 305 | android:paddingLeft="5dp" |
304 | android:paddingLeft="5dp" | 306 | android:paddingRight="5dp" |
305 | android:paddingRight="5dp" | 307 | android:textColor="@color/login_text_blue" |
306 | android:textColor="@color/login_text_blue" | 308 | android:textSize="18sp" /> |
307 | android:textSize="18sp" /> | 309 | |
308 | 310 | ||
309 | 311 | </LinearLayout> | |
310 | </LinearLayout> | 312 | |
311 | 313 | <LinearLayout | |
312 | <LinearLayout | 314 | android:layout_width="0dp" |
313 | android:layout_width="0dp" | 315 | android:layout_height="60dp" |
314 | android:layout_height="60dp" | 316 | android:layout_weight="1" |
315 | android:layout_weight="1" | 317 | android:layout_marginLeft="80dp" |
316 | android:layout_marginLeft="80dp" | 318 | android:gravity="center_vertical"> |
317 | android:gravity="center_vertical"> | 319 | |
318 | 320 | <TextView | |
319 | <TextView | 321 | android:layout_width="wrap_content" |
320 | android:layout_width="wrap_content" | 322 | android:layout_height="wrap_content" |
321 | android:layout_height="wrap_content" | 323 | android:text="本地售后电话" |
322 | android:text="本地售后电话" | 324 | android:textSize="22sp" /> |
323 | android:textSize="22sp" /> | 325 | |
324 | 326 | <TextView | |
325 | <TextView | 327 | android:id="@+id/tv_card_tleNember" |
326 | android:id="@+id/tv_card_tleNember" | 328 | android:layout_width="wrap_content" |
327 | android:layout_width="wrap_content" | 329 | android:layout_height="wrap_content" |
328 | android:layout_height="wrap_content" | 330 | android:layout_marginLeft="60dp" |
329 | android:layout_marginLeft="60dp" | 331 | android:text="" |
330 | android:text="" | 332 | android:textSize="22sp" /> |
331 | android:textSize="22sp" /> | 333 | |
332 | 334 | </LinearLayout> | |
333 | </LinearLayout> | 335 | |
334 | 336 | </LinearLayout> | |
335 | </LinearLayout> | 337 | </LinearLayout> |
336 | </LinearLayout> | 338 | |
337 | 339 | <LinearLayout | |
338 | <LinearLayout | 340 | android:layout_width="match_parent" |
339 | android:layout_width="match_parent" | 341 | android:layout_height="wrap_content" |
340 | android:layout_height="wrap_content" | 342 | android:layout_marginTop="5dp" |
341 | android:layout_marginTop="5dp" | 343 | android:gravity="center" |
342 | android:gravity="center" | 344 | android:orientation="vertical"> |
343 | android:orientation="vertical"> | 345 | |
344 | 346 | <TextView | |
345 | <TextView | 347 | android:layout_width="wrap_content" |
346 | android:layout_width="wrap_content" | 348 | android:layout_height="wrap_content" |
347 | android:layout_height="wrap_content" | 349 | android:layout_marginTop="5dp" |
348 | android:layout_marginTop="5dp" | 350 | android:text="@string/electronic_card" |
349 | android:text="@string/electronic_card" | 351 | android:textColor="@color/electronic_text" |
350 | android:textColor="@color/electronic_text" | 352 | android:textSize="18sp" /> |
351 | android:textSize="18sp" /> | 353 | |
352 | 354 | ||
353 | 355 | ||
354 | 356 | </LinearLayout> | |
355 | </LinearLayout> | 357 | <LinearLayout |
356 | <LinearLayout | 358 | android:layout_width="match_parent" |
357 | android:layout_width="match_parent" | 359 | android:layout_height="wrap_content" |
358 | android:layout_height="wrap_content" | 360 | android:layout_marginTop="5dp" |
359 | android:layout_marginTop="30dp" | 361 | android:gravity="center" |
360 | android:gravity="center" | 362 | android:orientation="horizontal"> |
361 | android:orientation="horizontal"> | 363 | |
362 | 364 | <ImageView | |
363 | <ImageView | 365 | android:layout_width="wrap_content" |
364 | android:layout_width="wrap_content" | 366 | android:layout_height="wrap_content" |
365 | android:layout_height="wrap_content" | 367 | android:src="@mipmap/phone"/> |
366 | android:src="@mipmap/phone"/> | 368 | <TextView |
369 | android:id="@+id/service_phone" | ||
367 | <TextView | 370 | android:layout_width="wrap_content" |
368 | android:layout_width="wrap_content" | 371 | android:layout_height="wrap_content" |
369 | android:layout_height="wrap_content" | 372 | android:textSize="30sp" |
370 | android:textSize="30sp" | 373 | android:layout_marginLeft="5dp" |
371 | android:layout_marginLeft="5dp" | 374 | android:textColor="@color/login_text_blue" |
372 | android:textColor="@color/login_text_blue" | 375 | android:text="400-800-3813"/> |
373 | android:text="4006-123-678"/> | 376 | |
374 | 377 | ||
375 | 378 | </LinearLayout> | |
376 | </LinearLayout> | 379 | |
377 | 380 | <ImageView | |
378 | 381 | android:layout_width="wrap_content" | |
382 | android:layout_height="wrap_content" | ||
383 | android:src="@mipmap/public_qa_code" | ||
384 | android:layout_gravity="center_horizontal" | ||
385 | android:layout_marginTop="5dp"/> | ||
386 | <TextView | ||
387 | android:layout_width="wrap_content" | ||
388 | android:layout_height="wrap_content" | ||
389 | android:layout_marginTop="5dp" | ||
390 | android:text="关注好记星微信公众号" | ||
391 | android:textColor="@color/electronic_text" | ||
392 | android:textSize="16sp" | ||
393 | android:layout_gravity="center_horizontal"/> | ||
379 | 394 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/activity_electroniccard_info.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
6 | android:background="@mipmap/main_bg" | ||
6 | android:orientation="vertical"> | 7 | android:orientation="vertical"> |
7 | 8 | ||
8 | <RelativeLayout | 9 | <RelativeLayout |
9 | android:id="@+id/title" | 10 | android:id="@+id/title" |
10 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
11 | android:layout_height="wrap_content" | 12 | android:layout_height="wrap_content" |
12 | android:background="@color/login_text_blue" | 13 | android:background="@color/login_text_blue" |
13 | android:minHeight="50dp"> | 14 | android:minHeight="50dp"> |
14 | 15 | ||
15 | <ImageView | 16 | <ImageView |
16 | android:id="@+id/iv_card_back" | 17 | android:id="@+id/iv_card_back" |
17 | android:layout_width="wrap_content" | 18 | android:layout_width="wrap_content" |
18 | android:layout_height="wrap_content" | 19 | android:layout_height="wrap_content" |
19 | android:layout_centerVertical="true" | 20 | android:layout_centerVertical="true" |
20 | android:paddingLeft="20dp" | 21 | android:paddingLeft="20dp" |
21 | android:paddingRight="20dp" | 22 | android:paddingRight="20dp" |
22 | android:src="@mipmap/title_back" /> | 23 | android:src="@mipmap/title_back" /> |
23 | 24 | ||
24 | <TextView | 25 | <TextView |
25 | android:id="@+id/menu_title" | 26 | android:id="@+id/menu_title" |
26 | android:layout_width="wrap_content" | 27 | android:layout_width="wrap_content" |
27 | android:layout_height="wrap_content" | 28 | android:layout_height="wrap_content" |
28 | android:layout_centerInParent="true" | 29 | android:layout_centerInParent="true" |
29 | android:text="@string/change_electroniccard_info_fill" | 30 | android:text="@string/change_electroniccard_info_fill" |
30 | android:textColor="@android:color/white" | 31 | android:textColor="@android:color/white" |
31 | android:textSize="22sp" /> | 32 | android:textSize="22sp" /> |
32 | </RelativeLayout> | 33 | </RelativeLayout> |
33 | 34 | ||
34 | <ImageView | 35 | <!-- <ImageView |
35 | android:layout_width="wrap_content" | 36 | android:layout_width="wrap_content" |
36 | android:layout_height="wrap_content" | 37 | android:layout_height="wrap_content" |
37 | android:layout_gravity="center" | 38 | android:layout_gravity="center" |
38 | android:layout_marginTop="20dp" | 39 | android:layout_marginTop="20dp" |
39 | android:src="@mipmap/change_info_icon" /> | 40 | android:src="@mipmap/change_info_icon" />--> |
41 | |||
40 | 42 | ||
41 | <LinearLayout | 43 | <LinearLayout |
42 | android:layout_width="wrap_content" | 44 | android:layout_width="match_parent" |
43 | android:layout_height="wrap_content" | 45 | android:layout_height="580dp" |
44 | android:layout_marginTop="60dp" | 46 | android:layout_centerInParent="true" |
45 | android:orientation="horizontal"> | 47 | android:layout_marginLeft="100dp" |
48 | android:layout_marginRight="100dp" | ||
49 | android:background="@drawable/white_cycle_bg" | ||
50 | android:gravity="center_horizontal" | ||
51 | android:orientation="vertical" | ||
52 | android:paddingLeft="20dp" | ||
53 | android:paddingRight="20dp"> | ||
54 | |||
55 | <ImageView | ||
56 | android:id="@+id/iv_logo" | ||
57 | android:layout_width="wrap_content" | ||
58 | android:layout_height="wrap_content" | ||
59 | android:layout_gravity="center_horizontal" | ||
60 | android:layout_marginTop="10dp" | ||
61 | android:src="@mipmap/logo" /> | ||
46 | 62 | ||
47 | <View | 63 | <LinearLayout |
48 | android:layout_width="450dp" | 64 | android:layout_width="wrap_content" |
49 | android:layout_height="0.7dp" | 65 | android:layout_height="wrap_content" |
50 | android:layout_marginLeft="150dp" | 66 | android:layout_marginTop="20dp" |
51 | android:background="@color/cutoff_line"> | 67 | android:orientation="horizontal"> |
52 | 68 | ||
53 | </View> | 69 | <View |
70 | android:layout_width="450dp" | ||
71 | android:layout_height="0.7dp" | ||
72 | android:background="@color/cutoff_line"> | ||
54 | 73 | ||
55 | <View | 74 | </View> |
56 | android:layout_width="450dp" | ||
57 | android:layout_height="0.7dp" | ||
58 | android:layout_marginLeft="80dp" | ||
59 | android:background="@color/cutoff_line"> | ||
60 | 75 | ||
61 | </View> | 76 | <View |
77 | android:layout_width="500dp" | ||
78 | android:layout_height="0.7dp" | ||
79 | android:layout_marginLeft="80dp" | ||
80 | android:background="@color/cutoff_line"> | ||
62 | 81 | ||
82 | </View> | ||
63 | 83 | ||
64 | </LinearLayout> | ||
65 | 84 | ||
66 | <LinearLayout | 85 | </LinearLayout> |
67 | android:layout_width="match_parent" | ||
68 | android:layout_height="wrap_content" | ||
69 | android:layout_marginLeft="200dp" | ||
70 | android:gravity="center_vertical" | ||
71 | android:orientation="horizontal"> | ||
72 | 86 | ||
73 | <LinearLayout | 87 | <LinearLayout |
74 | android:layout_width="0dp" | 88 | android:layout_width="match_parent" |
75 | android:layout_height="80dp" | 89 | android:layout_height="wrap_content" |
76 | android:layout_weight="1" | 90 | android:layout_marginLeft="20dp" |
77 | android:gravity="center_vertical" | 91 | android:gravity="center_vertical" |
78 | android:focusable="true" | 92 | android:orientation="horizontal"> |
79 | android:focusableInTouchMode="true"> | 93 | |
80 | 94 | <LinearLayout | |
81 | <TextView | 95 | android:layout_width="0dp" |
82 | android:layout_width="wrap_content" | 96 | android:layout_height="80dp" |
83 | android:layout_height="wrap_content" | 97 | android:layout_weight="1" |
84 | android:text="客户姓名" | 98 | android:focusable="true" |
85 | android:textSize="22sp" /> | 99 | android:focusableInTouchMode="true" |
86 | 100 | android:gravity="center_vertical"> | |
87 | <EditText | 101 | |
88 | android:id="@+id/et_edit_username" | 102 | <TextView |
89 | android:layout_width="wrap_content" | 103 | android:layout_width="wrap_content" |
90 | android:layout_height="wrap_content" | 104 | android:layout_height="wrap_content" |
91 | android:layout_marginLeft="50dp" | 105 | android:text="客户姓名" |
92 | android:background="@null" | 106 | android:textSize="22sp" /> |
93 | android:padding="20dp" | 107 | |
94 | android:textColor="@color/login_text_black" | 108 | <EditText |
95 | android:hint="请输入" | 109 | android:id="@+id/et_edit_username" |
96 | android:textSize="22sp" /> | 110 | android:layout_width="wrap_content" |
111 | android:layout_height="wrap_content" | ||
112 | android:layout_marginLeft="50dp" | ||
113 | android:background="@null" | ||
114 | android:hint="请输入" | ||
115 | android:padding="20dp" | ||
116 | android:textColor="@color/login_text_black" | ||
117 | android:textSize="22sp" /> | ||
118 | |||
119 | </LinearLayout> | ||
120 | |||
121 | <LinearLayout | ||
122 | android:layout_width="0dp" | ||
123 | android:layout_height="80dp" | ||
124 | android:layout_weight="1" | ||
125 | android:gravity="center_vertical"> | ||
126 | |||
127 | <TextView | ||
128 | android:layout_width="150dp" | ||
129 | android:layout_height="wrap_content" | ||
130 | android:text="购买地址" | ||
131 | android:textSize="22sp" /> | ||
132 | |||
133 | <TextView | ||
134 | android:id="@+id/tv_edit_adress_shop" | ||
135 | android:layout_width="wrap_content" | ||
136 | android:layout_height="wrap_content" | ||
137 | android:layout_marginLeft="20dp" | ||
138 | android:hint="请选择地区" | ||
139 | android:padding="20dp" | ||
140 | android:textColor="@color/login_text_black" | ||
141 | android:textSize="22sp" /> | ||
142 | |||
143 | <ImageView | ||
144 | android:id="@+id/shopdizhi" | ||
145 | android:layout_width="wrap_content" | ||
146 | android:layout_height="wrap_content" | ||
147 | android:layout_marginLeft="60dp" | ||
148 | android:padding="20dp" | ||
149 | android:src="@mipmap/xiajiantou"> | ||
150 | |||
151 | </ImageView> | ||
152 | </LinearLayout> | ||
97 | 153 | ||
98 | </LinearLayout> | 154 | </LinearLayout> |
99 | 155 | ||
100 | <LinearLayout | 156 | <LinearLayout |
101 | android:layout_width="0dp" | 157 | android:layout_width="wrap_content" |
102 | android:layout_height="80dp" | 158 | android:layout_height="wrap_content" |
103 | android:layout_weight="1" | 159 | android:orientation="horizontal"> |
104 | android:gravity="center_vertical"> | ||
105 | |||
106 | <TextView | ||
107 | android:layout_width="150dp" | ||
108 | android:layout_height="wrap_content" | ||
109 | android:text="购买地址" | ||
110 | android:textSize="22sp" /> | ||
111 | |||
112 | <TextView | ||
113 | android:id="@+id/tv_edit_adress_shop" | ||
114 | android:layout_width="wrap_content" | ||
115 | android:layout_height="wrap_content" | ||
116 | android:layout_marginLeft="20dp" | ||
117 | android:padding="20dp" | ||
118 | android:textColor="@color/login_text_black" | ||
119 | android:hint="请选择地区" | ||
120 | android:textSize="22sp" /> | ||
121 | |||
122 | <ImageView | ||
123 | android:id="@+id/shopdizhi" | ||
124 | android:layout_width="wrap_content" | ||
125 | android:layout_height="wrap_content" | ||
126 | android:padding="20dp" | ||
127 | android:layout_marginLeft="60dp" | ||
128 | android:src="@mipmap/xiajiantou"> | ||
129 | |||
130 | </ImageView> | ||
131 | </LinearLayout> | ||
132 | |||
133 | </LinearLayout> | ||
134 | |||
135 | <LinearLayout | ||
136 | android:layout_width="wrap_content" | ||
137 | android:layout_height="wrap_content" | ||
138 | android:orientation="horizontal"> | ||
139 | |||
140 | <View | ||
141 | android:layout_width="450dp" | ||
142 | android:layout_height="0.7dp" | ||
143 | android:layout_marginLeft="150dp" | ||
144 | android:background="@color/cutoff_line"> | ||
145 | |||
146 | </View> | ||
147 | |||
148 | <View | ||
149 | android:layout_width="450dp" | ||
150 | android:layout_height="0.7dp" | ||
151 | android:layout_marginLeft="80dp" | ||
152 | android:background="@color/cutoff_line"> | ||
153 | |||
154 | </View> | ||
155 | 160 | ||
161 | <View | ||
162 | android:layout_width="450dp" | ||
163 | android:layout_height="0.7dp" | ||
164 | android:background="@color/cutoff_line"> | ||
156 | 165 | ||
157 | </LinearLayout> | 166 | </View> |
158 | 167 | ||
159 | <LinearLayout | 168 | <View |
160 | android:layout_width="match_parent" | 169 | android:layout_width="500dp" |
161 | android:layout_height="wrap_content" | 170 | android:layout_height="0.7dp" |
162 | android:layout_marginLeft="200dp" | 171 | android:layout_marginLeft="80dp" |
163 | android:gravity="center_vertical" | 172 | android:background="@color/cutoff_line"> |
164 | android:orientation="horizontal"> | ||
165 | 173 | ||
166 | <LinearLayout | 174 | </View> |
167 | android:layout_width="0dp" | ||
168 | android:layout_height="80dp" | ||
169 | android:layout_weight="1" | ||
170 | android:gravity="center_vertical"> | ||
171 | |||
172 | <TextView | ||
173 | android:layout_width="wrap_content" | ||
174 | android:layout_height="wrap_content" | ||
175 | android:text="客户地址" | ||
176 | android:textSize="22sp" /> | ||
177 | |||
178 | <TextView | ||
179 | android:id="@+id/tv_edit_adress_custem" | ||
180 | android:layout_width="wrap_content" | ||
181 | android:layout_height="wrap_content" | ||
182 | android:layout_marginLeft="50dp" | ||
183 | android:textColor="@color/login_text_black" | ||
184 | android:hint="请选择地区" | ||
185 | android:padding="20dp" | ||
186 | android:textSize="22sp" /> | ||
187 | |||
188 | <ImageView | ||
189 | android:id="@+id/cunstomdizhi" | ||
190 | android:layout_width="wrap_content" | ||
191 | android:layout_height="wrap_content" | ||
192 | android:layout_marginLeft="60dp" | ||
193 | android:padding="20dp" | ||
194 | android:src="@mipmap/xiajiantou"> | ||
195 | |||
196 | </ImageView> | ||
197 | 175 | ||
198 | 176 | ||
199 | </LinearLayout> | 177 | </LinearLayout> |
200 | 178 | ||
201 | <LinearLayout | 179 | <LinearLayout |
202 | android:layout_width="0dp" | 180 | android:layout_width="match_parent" |
203 | android:layout_height="80dp" | 181 | android:layout_height="wrap_content" |
204 | android:layout_weight="1" | 182 | android:layout_marginLeft="20dp" |
205 | android:gravity="center_vertical"> | 183 | android:gravity="center_vertical" |
206 | 184 | android:orientation="horizontal"> | |
207 | <TextView | 185 | |
208 | android:layout_width="150dp" | 186 | <LinearLayout |
209 | android:layout_height="wrap_content" | 187 | android:layout_width="0dp" |
210 | android:text=" " | 188 | android:layout_height="80dp" |
211 | android:textColor="@color/white" | 189 | android:layout_weight="1" |
212 | android:textSize="22sp" /> | 190 | android:gravity="center_vertical"> |
213 | 191 | ||
214 | <EditText | 192 | <TextView |
215 | android:id="@+id/et_edit_store" | 193 | android:layout_width="wrap_content" |
216 | android:layout_width="wrap_content" | 194 | android:layout_height="wrap_content" |
217 | android:layout_height="wrap_content" | 195 | android:text="客户地址" |
218 | android:layout_marginLeft="20dp" | 196 | android:textSize="22sp" /> |
219 | android:background="@null" | 197 | |
220 | android:padding="20dp" | 198 | <TextView |
221 | android:textColor="@color/login_text_black" | 199 | android:id="@+id/tv_edit_adress_custem" |
222 | android:hint="请输入商店名称" | 200 | android:layout_width="wrap_content" |
223 | android:textSize="22sp" /> | 201 | android:layout_height="wrap_content" |
202 | android:layout_marginLeft="50dp" | ||
203 | android:hint="请选择地区" | ||
204 | android:padding="20dp" | ||
205 | android:textColor="@color/login_text_black" | ||
206 | android:textSize="22sp" /> | ||
207 | |||
208 | <ImageView | ||
209 | android:id="@+id/cunstomdizhi" | ||
210 | android:layout_width="wrap_content" | ||
211 | android:layout_height="wrap_content" | ||
212 | android:layout_marginLeft="60dp" | ||
213 | android:padding="20dp" | ||
214 | android:src="@mipmap/xiajiantou"> | ||
215 | |||
216 | </ImageView> | ||
217 | |||
218 | |||
219 | </LinearLayout> | ||
220 | |||
221 | <LinearLayout | ||
222 | android:layout_width="0dp" | ||
223 | android:layout_height="80dp" | ||
224 | android:layout_weight="1" | ||
225 | android:gravity="center_vertical"> | ||
226 | |||
227 | <TextView | ||
228 | android:layout_width="150dp" | ||
229 | android:layout_height="wrap_content" | ||
230 | android:text=" " | ||
231 | android:textColor="@color/white" | ||
232 | android:textSize="22sp" /> | ||
233 | |||
234 | <EditText | ||
235 | android:id="@+id/et_edit_store" | ||
236 | android:layout_width="wrap_content" | ||
237 | android:layout_height="wrap_content" | ||
238 | android:layout_marginLeft="20dp" | ||
239 | android:background="@null" | ||
240 | android:hint="请输入商店名称" | ||
241 | android:padding="20dp" | ||
242 | android:textColor="@color/login_text_black" | ||
243 | android:textSize="22sp" /> | ||
244 | |||
245 | </LinearLayout> | ||
224 | 246 | ||
225 | </LinearLayout> | 247 | </LinearLayout> |
226 | 248 | ||
227 | </LinearLayout> | 249 | <LinearLayout |
228 | 250 | android:layout_width="wrap_content" | |
229 | <LinearLayout | 251 | android:layout_height="wrap_content" |
230 | android:layout_width="wrap_content" | ||
231 | android:layout_height="wrap_content" | ||
232 | |||
233 | android:orientation="horizontal"> | ||
234 | |||
235 | <View | ||
236 | android:layout_width="450dp" | ||
237 | android:layout_height="0.7dp" | ||
238 | android:layout_marginLeft="150dp" | ||
239 | android:background="@color/cutoff_line"> | ||
240 | |||
241 | </View> | ||
242 | 252 | ||
243 | <View | 253 | android:orientation="horizontal"> |
244 | android:layout_width="450dp" | ||
245 | android:layout_height="0.7dp" | ||
246 | android:layout_marginLeft="80dp" | ||
247 | android:background="@color/cutoff_line"> | ||
248 | 254 | ||
249 | </View> | 255 | <View |
256 | android:layout_width="450dp" | ||
257 | android:layout_height="0.7dp" | ||
258 | android:background="@color/cutoff_line"> | ||
250 | 259 | ||
260 | </View> | ||
251 | 261 | ||
252 | </LinearLayout> | 262 | <View |
263 | android:layout_width="500dp" | ||
264 | android:layout_height="0.7dp" | ||
265 | android:layout_marginLeft="80dp" | ||
266 | android:background="@color/cutoff_line"> | ||
253 | 267 | ||
254 | <LinearLayout | 268 | </View> |
255 | android:layout_width="match_parent" | ||
256 | android:layout_height="wrap_content" | ||
257 | android:layout_marginLeft="200dp" | ||
258 | android:gravity="center_vertical" | ||
259 | android:orientation="horizontal"> | ||
260 | 269 | ||
261 | <LinearLayout | ||
262 | android:layout_width="0dp" | ||
263 | android:layout_height="80dp" | ||
264 | android:layout_weight="1" | ||
265 | android:gravity="center_vertical"> | ||
266 | |||
267 | <TextView | ||
268 | android:layout_width="wrap_content" | ||
269 | android:layout_height="wrap_content" | ||
270 | android:text=" " | ||
271 | android:textColor="@color/white" | ||
272 | android:textSize="22sp" /> | ||
273 | |||
274 | <EditText | ||
275 | android:id="@+id/et_edit_adress_detail" | ||
276 | android:layout_width="wrap_content" | ||
277 | android:layout_height="wrap_content" | ||
278 | android:layout_marginLeft="100dp" | ||
279 | android:background="@null" | ||
280 | android:padding="20dp" | ||
281 | android:textColor="@color/login_text_black" | ||
282 | android:hint="请输入详细地址" | ||
283 | android:textSize="22sp" /> | ||
284 | 270 | ||
285 | </LinearLayout> | 271 | </LinearLayout> |
286 | 272 | ||
287 | <LinearLayout | 273 | <LinearLayout |
288 | android:layout_width="0dp" | 274 | android:layout_width="match_parent" |
289 | android:layout_height="80dp" | 275 | android:layout_height="wrap_content" |
290 | android:layout_weight="1" | 276 | android:layout_marginLeft="20dp" |
291 | android:gravity="center_vertical"> | 277 | android:gravity="center_vertical" |
292 | 278 | android:orientation="horizontal"> | |
293 | <TextView | 279 | |
294 | android:layout_width="150dp" | 280 | <LinearLayout |
295 | android:layout_height="wrap_content" | 281 | android:layout_width="0dp" |
296 | android:text="本地售后电话" | 282 | android:layout_height="80dp" |
297 | android:textSize="22sp" /> | 283 | android:layout_weight="1" |
298 | 284 | android:gravity="center_vertical"> | |
299 | <EditText | 285 | |
300 | android:id="@+id/et_edit_telphone" | 286 | <TextView |
301 | android:layout_width="wrap_content" | 287 | android:layout_width="wrap_content" |
302 | android:layout_height="wrap_content" | 288 | android:layout_height="wrap_content" |
PersonalCenter/app/src/main/res/layout/activity_electroniccard_validation.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:background="#ffffffff" | 5 | android:background="@mipmap/main_bg" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | |||
7 | <RelativeLayout | 8 | <RelativeLayout |
8 | android:id="@+id/title" | 9 | android:id="@+id/title" |
9 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
10 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
11 | android:background="@color/login_text_blue" | 12 | android:background="@color/login_text_blue" |
12 | android:minHeight="50dp" > | 13 | android:minHeight="50dp"> |
13 | 14 | ||
14 | <ImageView | 15 | <ImageView |
15 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
16 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
17 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
18 | android:layout_centerVertical="true" | 19 | android:layout_centerVertical="true" |
19 | android:paddingLeft="20dp" | 20 | android:paddingLeft="20dp" |
20 | android:paddingRight="20dp" | 21 | android:paddingRight="20dp" |
21 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
22 | 23 | ||
23 | <TextView | 24 | <TextView |
24 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
25 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
26 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
27 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
28 | android:text="@string/string_electroniccard_info_title" | 29 | android:text="@string/string_electroniccard_info_title" |
29 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
30 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
31 | </RelativeLayout> | 32 | </RelativeLayout> |
32 | <RelativeLayout | 33 | |
33 | android:layout_width="match_parent" | 34 | <LinearLayout |
34 | android:layout_height="match_parent" | 35 | android:layout_width="550dp" |
35 | android:layout_below="@id/title" | 36 | android:layout_height="wrap_content" |
36 | android:background="#ffffffff" | 37 | android:layout_centerInParent="true" |
38 | android:background="@drawable/white_cycle_bg" | ||
37 | android:orientation="vertical" | 39 | android:orientation="vertical" |
38 | android:paddingLeft="250dp" | 40 | android:paddingLeft="30dp" |
39 | android:paddingRight="250dp" > | 41 | android:paddingRight="30dp"> |
40 | 42 | ||
41 | <EditText | 43 | <ImageView |
42 | android:id="@+id/et_phonenumber" | 44 | android:id="@+id/iv_logo" |
43 | style="@style/login_register_edit_style" | 45 | android:layout_width="wrap_content" |
44 | android:layout_marginTop="150dp" | 46 | android:layout_height="wrap_content" |
45 | android:hint="手机号" | 47 | android:layout_gravity="center_horizontal" |
46 | android:inputType="phone" /> | 48 | android:layout_marginTop="15dp" |
49 | android:src="@mipmap/logo" /> | ||
47 | 50 | ||
48 | <TextView | ||
49 | android:id="@+id/phonenumber_error_hint" | ||
50 | style="@style/registererrhint_style" | ||
51 | android:layout_below="@id/et_phonenumber" /> | ||
52 | 51 | ||
53 | <LinearLayout | 52 | |
54 | android:id="@+id/rl_authcode" | 53 | <LinearLayout |
55 | android:layout_width="match_parent" | 54 | android:id="@+id/activation_code_layout" |
56 | android:layout_height="wrap_content" | 55 | android:layout_width="match_parent" |
57 | android:layout_below="@id/et_phonenumber" | 56 | android:layout_height="wrap_content" |
58 | android:layout_marginTop="30dp" | 57 | android:gravity="center_horizontal" |
59 | android:orientation="horizontal"> | 58 | android:background="@drawable/input_bg" |
60 | 59 | android:layout_marginTop="20dp" | |
61 | <EditText | 60 | android:paddingRight="10dp" |
62 | android:id="@+id/et_authcode" | 61 | android:visibility="gone" |
63 | style="@style/login_register_edit_rect_style" | 62 | android:orientation="horizontal"> |
64 | android:layout_marginRight="-4px" | 63 | |
65 | android:layout_weight="1" | 64 | <EditText |
66 | android:hint="验证码" | 65 | android:id="@+id/activation_code" |
67 | android:numeric="integer" /> | 66 | style="@style/login_register_edit_style" |
67 | android:hint="请输入注册激活码" | ||
68 | android:maxLength="11" | ||
69 | android:inputType="phone" /> | ||
70 | <ImageButton | ||
71 | android:id="@+id/activation_code_delete_btn" | ||
72 | android:layout_width="50dp" | ||
73 | android:layout_height="match_parent" | ||
74 | android:src="@mipmap/delete_btn" | ||
75 | android:visibility="invisible" | ||
76 | android:background="@null"/> | ||
77 | </LinearLayout> | ||
78 | |||
79 | <LinearLayout | ||
80 | android:id="@+id/et_phonenumber_layout" | ||
81 | android:layout_width="match_parent" | ||
82 | android:layout_height="wrap_content" | ||
83 | android:gravity="center_horizontal" | ||
84 | android:background="@drawable/input_bg" | ||
85 | android:layout_marginTop="30dp" | ||
86 | android:paddingRight="10dp" | ||
87 | android:orientation="horizontal"> | ||
88 | |||
89 | <EditText | ||
90 | android:id="@+id/et_phonenumber" | ||
91 | style="@style/login_register_edit_style" | ||
92 | android:hint="手机号" | ||
93 | android:maxLength="11" | ||
94 | android:inputType="phone" /> | ||
95 | <ImageButton | ||
96 | android:id="@+id/phone_delete_btn" | ||
97 | android:layout_width="50dp" | ||
98 | android:layout_height="match_parent" | ||
99 | android:src="@mipmap/delete_btn" | ||
100 | android:visibility="invisible" | ||
101 | android:background="@null"/> | ||
102 | </LinearLayout> | ||
103 | |||
104 | |||
105 | <LinearLayout | ||
106 | android:id="@+id/rl_authcode" | ||
107 | android:layout_width="match_parent" | ||
108 | android:layout_height="wrap_content" | ||
109 | android:layout_below="@id/et_phonenumber_layout" | ||
110 | android:layout_marginTop="30dp" | ||
111 | android:paddingRight="7dp" | ||
112 | android:visibility="gone" | ||
113 | android:background="@drawable/input_bg" | ||
114 | android:orientation="horizontal"> | ||
115 | |||
116 | <EditText | ||
117 | android:id="@+id/et_authcode" | ||
118 | style="@style/login_register_edit_rect_style" | ||
119 | android:layout_marginRight="-4px" | ||
120 | android:layout_weight="1" | ||
121 | android:hint="验证码" | ||
122 | android:maxLength="6" | ||
123 | android:numeric="integer" /> | ||
124 | |||
125 | <ImageButton | ||
126 | android:id="@+id/code_delete_btn" | ||
127 | android:layout_width="50dp" | ||
128 | android:layout_height="match_parent" | ||
129 | android:src="@mipmap/delete_btn" | ||
130 | android:visibility="invisible" | ||
131 | android:background="@null"/> | ||
132 | <Button | ||
133 | android:id="@+id/btn_authcode" | ||
134 | android:layout_width="match_parent" | ||
135 | android:layout_height="wrap_content" | ||
136 | style="?android:attr/borderlessButtonStyle" | ||
137 | android:layout_weight="2" | ||
138 | android:text="获取验证码" | ||
139 | android:maxLines="1" | ||
140 | android:background="@drawable/code_bg" | ||
141 | android:textSize="18sp" | ||
142 | android:padding="8dp" | ||
143 | android:textColor="@color/login_text_blue" /> | ||
144 | </LinearLayout> | ||
145 | |||
146 | <TextView | ||
147 | android:id="@+id/authcode_error_hint" | ||
148 | style="@style/registererrhint_style" | ||
149 | android:layout_below="@id/rl_authcode" /> | ||
150 | |||
151 | <TextView | ||
152 | android:id="@+id/password_error_hint" | ||
153 | style="@style/registererrhint_style" | ||
154 | android:layout_below="@id/pwd_rl" /> | ||
68 | 155 | ||
69 | <Button | 156 | <Button |
70 | android:id="@+id/btn_authcode" | 157 | android:id="@+id/btn_card_valiyanzhen" |
71 | style="@style/login_register_btn_authcode_rect_style" | 158 | style="@style/button_login_register_style" |
72 | android:layout_marginLeft="0px" | 159 | android:layout_below="@id/rl_authcode" |
73 | android:layout_marginTop="0px" | 160 | android:layout_marginTop="30dp" |
74 | android:layout_weight="2" | 161 | android:layout_marginBottom="40dp" |
PersonalCenter/app/src/main/res/layout/activity_forgetpsword.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:background="#ffffffff" | 5 | android:background="@mipmap/main_bg" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | 7 | ||
8 | <RelativeLayout | 8 | <RelativeLayout |
9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
12 | android:background="@color/login_text_blue" | 12 | android:background="@color/login_text_blue" |
13 | android:minHeight="50dp"> | 13 | android:minHeight="50dp"> |
14 | 14 | ||
15 | <ImageView | 15 | <ImageView |
16 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
17 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
19 | android:layout_centerVertical="true" | 19 | android:layout_centerVertical="true" |
20 | android:paddingLeft="20dp" | 20 | android:paddingLeft="20dp" |
21 | android:paddingRight="20dp" | 21 | android:paddingRight="20dp" |
22 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
23 | 23 | ||
24 | <TextView | 24 | <TextView |
25 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
29 | android:text="@string/string_menu_title" | 29 | android:text="@string/string_menu_title" |
30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
32 | </RelativeLayout> | 32 | </RelativeLayout> |
33 | 33 | ||
34 | <RelativeLayout | 34 | <!--<RelativeLayout--> |
35 | android:layout_width="match_parent" | 35 | <!--android:layout_width="match_parent"--> |
36 | android:layout_height="match_parent" | 36 | <!--android:layout_height="match_parent"--> |
37 | android:layout_below="@id/title" | 37 | <!--android:layout_below="@id/title">--> |
38 | android:background="#ffffffff" | 38 | |
39 | android:orientation="vertical" | 39 | |
40 | android:paddingLeft="250dp" | 40 | <LinearLayout |
41 | android:paddingRight="250dp"> | 41 | android:layout_width="550dp" |
42 | 42 | android:layout_height="600dp" | |
43 | <EditText | 43 | android:layout_centerInParent="true" |
44 | android:id="@+id/et_phonenumber" | 44 | android:layout_marginTop="20dp" |
45 | style="@style/login_register_edit_style" | 45 | android:background="@drawable/white_cycle_bg" |
46 | android:layout_marginTop="150dp" | 46 | android:paddingLeft="30dp" |
47 | android:hint="手机号" | 47 | android:paddingRight="30dp" |
48 | android:inputType="phone" /> | 48 | android:orientation="vertical"> |
49 | |||
50 | <ImageView | ||
51 | android:id="@+id/iv_logo" | ||
52 | android:layout_width="wrap_content" | ||
53 | android:layout_height="wrap_content" | ||
54 | android:layout_gravity="center_horizontal" | ||
55 | android:layout_marginTop="15dp" | ||
56 | android:src="@mipmap/logo" /> | ||
57 | |||
58 | <LinearLayout | ||
59 | android:id="@+id/et_phonenumber_layout" | ||
60 | android:layout_width="match_parent" | ||
61 | android:layout_height="wrap_content" | ||
62 | android:layout_marginTop="10dp" | ||
63 | android:background="@drawable/input_bg" | ||
64 | android:gravity="center_horizontal" | ||
65 | android:orientation="horizontal" | ||
66 | android:paddingRight="10dp"> | ||
67 | |||
68 | <EditText | ||
69 | android:id="@+id/et_phonenumber" | ||
70 | style="@style/login_register_edit_style" | ||
71 | android:hint="手机号" | ||
72 | android:imeOptions="actionNext" | ||
73 | android:inputType="phone" | ||
74 | android:maxLength="11" /> | ||
75 | |||
76 | <ImageButton | ||
77 | android:id="@+id/phone_delete_btn" | ||
78 | android:layout_width="50dp" | ||
79 | android:layout_height="match_parent" | ||
80 | android:background="@null" | ||
81 | android:src="@mipmap/delete_btn" | ||
82 | android:visibility="invisible" /> | ||
83 | </LinearLayout> | ||
49 | 84 | ||
50 | <TextView | 85 | <TextView |
51 | android:id="@+id/phonenumber_error_hint" | 86 | android:id="@+id/phonenumber_error_hint" |
52 | style="@style/registererrhint_style" | 87 | style="@style/registererrhint_style" |
53 | android:layout_below="@id/et_phonenumber" /> | 88 | android:layout_below="@id/et_phonenumber_layout" /> |
54 | 89 | ||
55 | <LinearLayout | 90 | <LinearLayout |
56 | android:id="@+id/rl_authcode" | 91 | android:id="@+id/rl_authcode" |
57 | android:layout_width="match_parent" | 92 | android:layout_width="match_parent" |
58 | android:layout_height="wrap_content" | 93 | android:layout_height="wrap_content" |
59 | android:layout_below="@id/et_phonenumber" | 94 | android:layout_below="@id/et_phonenumber_layout" |
60 | android:layout_marginTop="30dp" | 95 | android:layout_marginTop="10dp" |
61 | android:orientation="horizontal"> | 96 | android:background="@drawable/input_bg" |
97 | android:orientation="horizontal" | ||
98 | android:paddingRight="7dp"> | ||
62 | 99 | ||
63 | <EditText | 100 | <EditText |
64 | android:id="@+id/et_authcode" | 101 | android:id="@+id/et_authcode" |
65 | style="@style/login_register_edit_rect_style" | 102 | style="@style/login_register_edit_rect_style" |
66 | android:layout_marginRight="-4px" | 103 | android:layout_marginRight="-4px" |
67 | android:layout_weight="1" | 104 | android:layout_weight="1" |
68 | android:hint="验证码" | 105 | android:hint="验证码" |
106 | android:maxLength="6" | ||
69 | android:numeric="integer" /> | 107 | android:numeric="integer" /> |
70 | 108 | ||
109 | <ImageButton | ||
110 | android:id="@+id/code_delete_btn" | ||
111 | android:layout_width="50dp" | ||
112 | android:layout_height="match_parent" | ||
113 | android:background="@null" | ||
114 | android:src="@mipmap/delete_btn" | ||
115 | android:visibility="invisible" /> | ||
116 | |||
71 | <Button | 117 | <Button |
72 | android:id="@+id/btn_authcode" | 118 | android:id="@+id/btn_authcode" |
73 | style="@style/login_register_btn_authcode_rect_style" | 119 | style="?android:attr/borderlessButtonStyle" |
74 | android:layout_marginLeft="0px" | 120 | android:layout_width="match_parent" |
75 | android:layout_marginTop="0px" | 121 | android:layout_height="wrap_content" |
76 | android:layout_weight="2" | 122 | android:layout_weight="2" |
123 | android:background="@drawable/code_bg" | ||
124 | android:maxLines="1" | ||
125 | android:padding="8dp" | ||
77 | android:text="获取验证码" | 126 | android:text="获取验证码" |
78 | android:textColor="@color/btn_text_color" /> | 127 | android:textColor="@color/login_text_blue" |
128 | android:textSize="18sp" /> | ||
79 | </LinearLayout> | 129 | </LinearLayout> |
80 | 130 | ||
81 | <TextView | 131 | <TextView |
82 | android:id="@+id/authcode_error_hint" | 132 | android:id="@+id/authcode_error_hint" |
83 | style="@style/registererrhint_style" | 133 | style="@style/registererrhint_style" |
84 | android:layout_below="@id/rl_authcode" /> | 134 | android:layout_below="@id/rl_authcode" /> |
85 | 135 | ||
86 | <RelativeLayout | 136 | |
137 | <LinearLayout | ||
87 | android:id="@+id/pwd_rl" | 138 | android:id="@+id/pwd_rl" |
88 | android:layout_width="match_parent" | 139 | android:layout_width="match_parent" |
89 | android:layout_height="wrap_content" | 140 | android:layout_height="wrap_content" |
90 | android:layout_below="@id/rl_authcode" | 141 | android:layout_below="@id/rl_authcode" |
91 | android:layout_marginTop="30dp"> | 142 | android:background="@drawable/input_bg" |
143 | android:gravity="center_vertical" | ||
144 | android:layout_marginTop="10dp"> | ||
92 | 145 | ||
93 | <EditText | 146 | <EditText |
94 | android:id="@+id/et_newpassword" | 147 | android:id="@+id/et_newpassword" |
95 | style="@style/login_register_edit_style" | 148 | style="@style/login_register_edit_style" |
96 | android:hint="密码为英文和数字组成,最少8位" | 149 | android:hint="密码为英文和数字组成,最少8位" |
97 | android:inputType="textPassword" /> | 150 | android:inputType="textPassword" /> |
98 | 151 | ||
99 | <ImageView | 152 | <ImageView |
100 | android:id="@+id/iv_pwd_change" | 153 | android:id="@+id/iv_pwd_change" |
101 | android:padding="10dp" | ||
102 | android:layout_marginRight="10dp" | ||
103 | android:layout_marginLeft="10dp" | ||
104 | android:layout_width="40dp" | 154 | android:layout_width="40dp" |
105 | android:layout_height="wrap_content" | 155 | android:layout_height="wrap_content" |
106 | android:layout_alignParentRight="true" | 156 | android:layout_alignParentRight="true" |
107 | android:layout_centerVertical="true" | 157 | android:layout_centerVertical="true" |
108 | android:src="@mipmap/pwd_hide"/> | 158 | android:layout_marginLeft="10dp" |
109 | </RelativeLayout> | 159 | android:layout_marginRight="15dp" |
160 | android:padding="10dp" | ||
161 | android:src="@mipmap/pwd_hide" /> | ||
162 | </LinearLayout> | ||
110 | 163 | ||
111 | <TextView | 164 | <TextView |
112 | android:id="@+id/newpassword_error_hint" | 165 | android:id="@+id/newpassword_error_hint" |
113 | style="@style/registererrhint_style" | 166 | style="@style/registererrhint_style" |
114 | android:layout_below="@id/pwd_rl" /> | 167 | android:layout_below="@id/pwd_rl" /> |
115 | 168 | ||
116 | <EditText | 169 | |
117 | android:id="@+id/et_again_newpassword" | 170 | |
118 | style="@style/login_register_edit_style" | 171 | <LinearLayout |
119 | android:layout_below="@id/pwd_rl" | 172 | android:id="@+id/et_again_newpassword_layout" |
120 | android:layout_marginTop="30dp" | 173 | android:layout_width="match_parent" |
121 | android:hint="再次输入新密码" | 174 | android:layout_height="wrap_content" |
122 | android:inputType="textPassword" /> | 175 | android:layout_marginTop="10dp" |
176 | android:background="@drawable/input_bg" | ||
177 | android:gravity="center_vertical" | ||
178 | android:orientation="horizontal"> | ||
179 | |||
180 | <EditText | ||
181 | android:id="@+id/et_again_newpassword" | ||
182 | style="@style/login_register_edit_style" | ||
183 | android:layout_below="@id/pwd_rl" | ||
184 | android:hint="再次输入新密码" | ||
185 | android:inputType="textPassword" /> | ||
186 | |||
187 | <ImageView | ||
188 | android:id="@+id/iv_newpwd_change" | ||
189 | android:layout_width="40dp" | ||
190 | android:layout_height="wrap_content" | ||
191 | android:layout_alignParentRight="true" | ||
192 | android:layout_centerVertical="true" | ||
193 | android:layout_marginLeft="10dp" | ||
194 | android:layout_marginRight="15dp" | ||
195 | android:padding="10dp" | ||
196 | android:src="@mipmap/pwd_hide" /> | ||
197 | </LinearLayout> | ||
198 | |||
199 | |||
123 | 200 | ||
124 | <TextView | 201 | <TextView |
125 | android:id="@+id/again_newpassword_error_hint" | 202 | android:id="@+id/again_newpassword_error_hint" |
126 | style="@style/registererrhint_style" | 203 | style="@style/registererrhint_style" |
127 | android:layout_below="@id/et_again_newpassword" /> | 204 | android:layout_below="@id/et_again_newpassword" /> |
128 | 205 | ||
129 | <Button | 206 | <Button |
130 | android:id="@+id/btn_ok" | 207 | android:id="@+id/btn_ok" |
131 | style="@style/button_login_register_style" | 208 | style="@style/button_login_register_style" |
132 | android:layout_below="@id/et_again_newpassword" | 209 | android:layout_below="@id/et_again_newpassword" |
133 | android:layout_marginTop="30dp" | 210 | android:layout_marginTop="20dp" |
134 | android:text="确 定" /> | 211 | android:text="确 定" /> |
PersonalCenter/app/src/main/res/layout/activity_loginandregister.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:tools="http://schemas.android.com/tools" | 3 | xmlns:tools="http://schemas.android.com/tools" |
4 | android:id="@android:id/tabhost" | 4 | android:id="@android:id/tabhost" |
5 | android:layout_width="fill_parent" | 5 | android:layout_width="fill_parent" |
6 | android:layout_height="fill_parent" | 6 | android:layout_height="fill_parent" |
7 | android:background="@color/white"> | 7 | android:background="@mipmap/main_bg"> |
8 | |||
9 | |||
10 | <ImageView | ||
11 | android:id="@+id/iv_logo" | ||
12 | android:layout_width="wrap_content" | ||
13 | android:layout_height="wrap_content" | ||
14 | android:layout_centerHorizontal="true" | ||
15 | android:layout_marginTop="55dp" | ||
16 | android:layout_marginBottom="0dp" | ||
17 | android:src="@mipmap/logo" /> | ||
18 | 8 | ||
19 | <LinearLayout | 9 | <LinearLayout |
20 | android:layout_width="wrap_content" | 10 | android:layout_width="550dp" |
21 | android:layout_height="wrap_content" | 11 | android:layout_height="600dp" |
22 | android:layout_below="@+id/iv_logo" | 12 | android:orientation="vertical" |
23 | android:orientation="vertical"> | 13 | android:layout_centerInParent="true" |
24 | 14 | android:background="@drawable/white_cycle_bg"> | |
15 | <ImageView | ||
16 | android:id="@+id/iv_logo" | ||
17 | android:layout_width="wrap_content" | ||
18 | android:layout_height="wrap_content" | ||
19 | android:layout_marginTop="25dp" | ||
20 | android:layout_gravity="center_horizontal" | ||
21 | android:src="@mipmap/logo" /> | ||
25 | <com.hjx.personalcenter.thirdparty.SlidingTabLayout | 22 | <com.hjx.personalcenter.thirdparty.SlidingTabLayout |
26 | android:id="@+id/TabLayout_id" | 23 | android:id="@+id/TabLayout_id" |
27 | android:layout_width="match_parent" | 24 | android:layout_width="match_parent" |
28 | android:layout_height="50dp"> | 25 | android:layout_height="50dp"> |
29 | </com.hjx.personalcenter.thirdparty.SlidingTabLayout> | 26 | </com.hjx.personalcenter.thirdparty.SlidingTabLayout> |
30 | 27 | ||
31 | <android.support.v4.view.ViewPager | 28 | <android.support.v4.view.ViewPager |
32 | android:id="@+id/viewpager_login" | 29 | android:id="@+id/viewpager_login" |
PersonalCenter/app/src/main/res/layout/activity_main.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | ||
6 | android:background="@color/white" | 5 | android:background="@color/white" |
7 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
8 | 7 | ||
9 | <RelativeLayout | 8 | <RelativeLayout |
10 | android:id="@+id/title" | 9 | android:id="@+id/title" |
11 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
12 | android:layout_height="50dp" | 11 | android:layout_height="50dp" |
13 | android:background="@color/login_text_blue"> | 12 | android:background="@color/login_text_blue"> |
14 | 13 | ||
15 | <ImageView | 14 | <ImageView |
16 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
17 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
18 | android:layout_height="match_parent" | 17 | android:layout_height="match_parent" |
19 | android:paddingLeft="20dp" | 18 | android:paddingLeft="20dp" |
20 | android:paddingRight="20dp" | 19 | android:paddingRight="20dp" |
21 | android:visibility="gone" | 20 | android:visibility="gone" |
22 | android:src="@mipmap/title_back" /> | 21 | android:src="@mipmap/title_back" /> |
23 | 22 | ||
24 | <TextView | 23 | <TextView |
25 | android:id="@+id/menu_title" | 24 | android:id="@+id/menu_title" |
26 | android:layout_width="wrap_content" | 25 | android:layout_width="wrap_content" |
27 | android:layout_height="match_parent" | 26 | android:layout_height="match_parent" |
28 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
29 | android:gravity="center_vertical" | 28 | android:gravity="center_vertical" |
30 | android:text="@string/titel_preson" | 29 | android:text="@string/titel_preson" |
31 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
32 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
33 | 32 | ||
34 | <ImageView | 33 | <ImageView |
35 | android:id="@+id/iv_setting" | 34 | android:id="@+id/iv_setting" |
36 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
37 | android:layout_height="match_parent" | 36 | android:layout_height="match_parent" |
38 | android:layout_marginRight="10dp" | 37 | android:layout_marginRight="10dp" |
39 | android:layout_toLeftOf="@+id/iv_skin" | 38 | android:layout_toLeftOf="@+id/iv_switch" |
40 | android:gravity="center_vertical" | 39 | android:gravity="center_vertical" |
41 | android:padding="10dp" | 40 | android:padding="10dp" |
42 | android:src="@mipmap/shezhi1" | 41 | android:src="@mipmap/shezhi1" |
43 | android:textColor="@android:color/white" | 42 | android:textColor="@android:color/white" |
44 | android:textSize="22sp" /> | 43 | android:textSize="22sp" /> |
45 | 44 | ||
46 | <ImageView | 45 | <ImageView |
47 | android:id="@+id/iv_skin" | 46 | android:id="@+id/iv_switch" |
48 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
49 | android:layout_height="match_parent" | 48 | android:layout_height="match_parent" |
50 | android:layout_marginRight="10dp" | 49 | android:layout_marginRight="10dp" |
51 | android:layout_toLeftOf="@+id/iv_imformatioan" | 50 | android:layout_toLeftOf="@+id/iv_imformatioan" |
52 | android:gravity="center_vertical" | 51 | android:gravity="center_vertical" |
53 | android:padding="10dp" | 52 | android:padding="10dp" |
54 | android:src="@mipmap/pifu" | 53 | android:src="@mipmap/switch_btn" |
55 | android:textColor="@android:color/white" | 54 | android:textColor="@android:color/white" |
56 | android:visibility="gone" | ||
57 | android:textSize="22sp" /> | 55 | android:textSize="22sp" /> |
58 | 56 | ||
59 | <ImageView | 57 | <ImageView |
60 | android:id="@+id/iv_imformatioan" | 58 | android:id="@+id/iv_imformatioan" |
61 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
62 | android:layout_height="match_parent" | 60 | android:layout_height="match_parent" |
63 | android:layout_alignParentRight="true" | 61 | android:layout_alignParentRight="true" |
64 | android:layout_marginRight="10dp" | 62 | android:layout_marginRight="10dp" |
65 | android:gravity="center_vertical" | 63 | android:gravity="center_vertical" |
66 | android:padding="10dp" | 64 | android:padding="10dp" |
67 | android:src="@mipmap/fankui1" | 65 | android:src="@mipmap/fankui1" |
68 | android:textColor="@android:color/white" | 66 | android:textColor="@android:color/white" |
69 | android:textSize="22sp" /> | 67 | android:textSize="22sp" /> |
70 | 68 | ||
71 | 69 | ||
72 | </RelativeLayout> | 70 | </RelativeLayout> |
73 | 71 | ||
74 | <LinearLayout | 72 | <LinearLayout |
75 | android:layout_width="match_parent" | 73 | android:layout_width="match_parent" |
76 | android:layout_height="match_parent"> | 74 | android:layout_height="match_parent"> |
77 | 75 | ||
78 | <LinearLayout | 76 | <LinearLayout |
79 | android:layout_width="0dp" | 77 | android:layout_width="0dp" |
80 | android:layout_height="match_parent" | 78 | android:layout_height="match_parent" |
81 | android:layout_weight="1.2" | 79 | android:layout_weight="1.2" |
82 | android:orientation="vertical" | 80 | android:orientation="vertical" |
83 | android:background="@mipmap/head_bg"> | 81 | android:background="@mipmap/head_bg"> |
84 | <RelativeLayout | 82 | <RelativeLayout |
85 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
86 | android:layout_marginTop="118dp" | 84 | android:layout_marginTop="118dp" |
87 | android:layout_height="250sp"> | 85 | android:layout_height="250sp"> |
88 | 86 | ||
89 | <LinearLayout | 87 | <LinearLayout |
90 | android:id="@+id/ssss" | 88 | android:id="@+id/ssss" |
91 | android:layout_width="match_parent" | 89 | android:layout_width="match_parent" |
92 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
93 | android:layout_marginTop="28dp" | 91 | android:layout_marginTop="28dp" |
94 | android:gravity="center" | 92 | android:gravity="center" |
95 | android:orientation="horizontal"> | 93 | android:orientation="horizontal"> |
96 | <com.hjx.personalcenter.View.RoundImageView60dip | 94 | <com.hjx.personalcenter.View.RoundImageView60dip |
97 | android:id="@+id/iv_head" | 95 | android:id="@+id/iv_head" |
98 | android:layout_width="70dp" | 96 | android:layout_width="90dp" |
99 | android:layout_height="70dp" | 97 | android:layout_height="90dp" |
100 | android:scaleType="centerCrop" | 98 | android:scaleType="centerCrop" |
101 | android:background="@mipmap/header_default" | 99 | android:background="@mipmap/header_default" /> |
102 | /> | ||
103 | 100 | ||
104 | <TextView | 101 | <TextView |
105 | android:layout_width="wrap_content" | 102 | android:layout_width="wrap_content" |
106 | android:layout_height="wrap_content" | 103 | android:layout_height="wrap_content" |
107 | android:layout_marginLeft="18dp" | 104 | android:layout_marginLeft="18dp" |
108 | android:layout_marginTop="20dp" | 105 | android:layout_marginTop="20dp" |
109 | android:background="@drawable/corcle_blue_bg" | 106 | android:background="@drawable/corcle_blue_bg" |
110 | android:paddingLeft="5dp" | 107 | android:paddingLeft="5dp" |
111 | android:paddingRight="5dp" | 108 | android:paddingRight="5dp" |
112 | android:gravity="center_vertical" | 109 | android:gravity="center_vertical" |
113 | android:text="签到" | 110 | android:text="签到" |
114 | android:textColor="@color/login_text_blue" | 111 | android:textColor="@color/login_text_blue" |
115 | android:visibility="gone" | 112 | android:visibility="gone" |
116 | android:textSize="18sp" /> | 113 | android:textSize="18sp" /> |
117 | 114 | ||
118 | </LinearLayout> | 115 | </LinearLayout> |
119 | 116 | ||
120 | <LinearLayout | 117 | <LinearLayout |
121 | android:id="@+id/sssssss" | 118 | android:id="@+id/sssssss" |
122 | android:layout_width="match_parent" | 119 | android:layout_width="match_parent" |
123 | android:layout_height="wrap_content" | 120 | android:layout_height="wrap_content" |
124 | android:layout_marginLeft="20dp" | 121 | android:layout_marginLeft="20dp" |
125 | android:layout_below="@id/ssss" | 122 | android:layout_below="@id/ssss" |
126 | android:layout_marginTop="25dp" | 123 | android:layout_marginTop="25dp" |
127 | android:gravity="center" | 124 | android:gravity="center" |
128 | android:orientation="horizontal"> | 125 | android:orientation="horizontal"> |
129 | 126 | ||
130 | <TextView | 127 | <TextView |
131 | android:id="@+id/tv_username" | 128 | android:id="@+id/tv_username" |
132 | android:layout_width="wrap_content" | 129 | android:layout_width="wrap_content" |
133 | android:layout_height="wrap_content" | 130 | android:layout_height="wrap_content" |
134 | android:text="" | 131 | android:text="" |
135 | android:gravity="center" | 132 | android:gravity="center" |
136 | android:textSize="22sp" /> | 133 | android:textSize="22sp" /> |
137 | <TextView | 134 | <TextView |
138 | android:id="@+id/tv_yangji" | 135 | android:id="@+id/tv_yangji" |
139 | android:layout_marginLeft="5dp" | 136 | android:layout_marginLeft="5dp" |
140 | android:layout_width="wrap_content" | 137 | android:layout_width="wrap_content" |
141 | android:layout_height="wrap_content" | 138 | android:layout_height="wrap_content" |
142 | android:text="(样机)" | 139 | android:text="(样机)" |
143 | android:textSize="20dp" | 140 | android:textSize="20dp" |
144 | android:visibility="gone"/> | 141 | android:visibility="gone"/> |
145 | 142 | ||
146 | <ImageView | 143 | <ImageView |
147 | android:id="@+id/iv_sex" | 144 | android:id="@+id/iv_sex" |
148 | android:layout_width="wrap_content" | 145 | android:layout_width="wrap_content" |
149 | android:layout_height="wrap_content" | 146 | android:layout_height="wrap_content" |
150 | android:layout_gravity="center_vertical" | 147 | android:layout_gravity="center_vertical" |
151 | android:layout_marginLeft="5dp" | 148 | android:layout_marginLeft="5dp" |
152 | android:src="@mipmap/men" /> | 149 | android:src="@mipmap/men" /> |
153 | 150 | ||
154 | </LinearLayout> | 151 | </LinearLayout> |
155 | 152 | ||
156 | <LinearLayout | 153 | <LinearLayout |
157 | android:layout_below="@id/sssssss" | 154 | android:layout_below="@id/sssssss" |
158 | android:layout_width="match_parent" | 155 | android:layout_width="match_parent" |
159 | android:layout_height="wrap_content" | 156 | android:layout_height="wrap_content" |
160 | android:layout_marginLeft="20dp" | 157 | android:layout_marginLeft="20dp" |
161 | android:layout_marginTop="10dp" | 158 | android:layout_marginTop="10dp" |
162 | android:gravity="center" | 159 | android:gravity="center" |
163 | android:orientation="horizontal"> | 160 | android:orientation="horizontal"> |
164 | 161 | ||
165 | <TextView | 162 | <TextView |
166 | android:id="@+id/tv_sign" | 163 | android:id="@+id/tv_sign" |
167 | android:layout_height="wrap_content" | 164 | android:layout_height="wrap_content" |
168 | android:layout_width="wrap_content" | 165 | android:layout_width="wrap_content" |
169 | android:hint="请输入个性签名" | 166 | android:hint="请输入个性签名" |
170 | android:maxLines="3" | 167 | android:maxLines="3" |
171 | android:padding="10dp" | 168 | android:padding="10dp" |
172 | android:gravity="center" | 169 | android:gravity="center" |
173 | android:maxLength="40" | 170 | android:maxLength="40" |
174 | android:ellipsize="end" | 171 | android:ellipsize="end" |
175 | android:textSize="16sp" | 172 | android:textSize="16sp" |
176 | android:drawableRight="@mipmap/gerenxinxibianji"/> | 173 | android:drawableRight="@mipmap/gerenxinxibianji"/> |
177 | 174 | ||
178 | <ImageView | 175 | <ImageView |
179 | android:id="@+id/iv_sign" | 176 | android:id="@+id/iv_sign" |
180 | android:layout_width="wrap_content" | 177 | android:layout_width="wrap_content" |
181 | android:layout_height="wrap_content" | 178 | android:layout_height="wrap_content" |
182 | android:scaleType="center" | 179 | android:scaleType="center" |
183 | android:padding="10dp" | 180 | android:padding="10dp" |
184 | android:visibility="gone" | 181 | android:visibility="gone" |
185 | android:src="@mipmap/gerenxinxibianji" /> | 182 | android:src="@mipmap/gerenxinxibianji" /> |
186 | 183 | ||
187 | 184 | ||
188 | </LinearLayout> | 185 | </LinearLayout> |
189 | </RelativeLayout> | 186 | </RelativeLayout> |
190 | <View | 187 | <View |
191 | android:layout_width="match_parent" | 188 | android:layout_width="match_parent" |
192 | android:layout_height="0.7dp" | 189 | android:layout_height="0.7dp" |
193 | android:background="@color/cutoff_line" | 190 | android:background="@color/cutoff_line" |
194 | android:visibility="gone"> | 191 | android:visibility="gone"> |
195 | 192 | ||
196 | </View> | 193 | </View> |
197 | 194 | ||
198 | <LinearLayout | 195 | <LinearLayout |
199 | android:layout_width="match_parent" | 196 | android:layout_width="match_parent" |
200 | android:layout_height="50dp" | 197 | android:layout_height="50dp" |
201 | android:orientation="vertical" | 198 | android:orientation="vertical" |
202 | android:visibility="invisible"> | 199 | android:visibility="invisible"> |
203 | 200 | ||
204 | <LinearLayout | 201 | <LinearLayout |
205 | android:layout_width="match_parent" | 202 | android:layout_width="match_parent" |
206 | android:layout_height="wrap_content" | 203 | android:layout_height="wrap_content" |
207 | android:gravity="center_vertical" | 204 | android:gravity="center_vertical" |
208 | android:orientation="horizontal"> | 205 | android:orientation="horizontal"> |
209 | 206 | ||
210 | <ImageView | 207 | <ImageView |
211 | android:layout_width="0dp" | 208 | android:layout_width="0dp" |
212 | android:layout_height="wrap_content" | 209 | android:layout_height="wrap_content" |
213 | android:layout_weight="1" | 210 | android:layout_weight="1" |
214 | android:paddingTop="20dp" | 211 | android:paddingTop="20dp" |
215 | android:paddingBottom="20dp" | 212 | android:paddingBottom="20dp" |
216 | android:src="@mipmap/wodecuoti1" /> | 213 | android:src="@mipmap/wodecuoti1" /> |
217 | 214 | ||
218 | <TextView | 215 | <TextView |
219 | android:id="@+id/linel_mycuoti" | 216 | android:id="@+id/linel_mycuoti" |
220 | android:layout_width="0dp" | 217 | android:layout_width="0dp" |
221 | android:layout_height="wrap_content" | 218 | android:layout_height="wrap_content" |
222 | android:layout_weight="1" | 219 | android:layout_weight="1" |
223 | android:paddingTop="20dp" | 220 | android:paddingTop="20dp" |
224 | android:paddingBottom="20dp" | 221 | android:paddingBottom="20dp" |
225 | android:text="我的错题" | 222 | android:text="我的错题" |
226 | android:textSize="20sp" /> | 223 | android:textSize="20sp" /> |
227 | <View | 224 | <View |
228 | android:layout_width="1dp" | 225 | android:layout_width="1dp" |
229 | android:layout_height="match_parent" | 226 | android:layout_height="match_parent" |
230 | android:background="@color/cutoff_line"> | 227 | android:background="@color/cutoff_line"> |
231 | 228 | ||
232 | </View> | 229 | </View> |
233 | 230 | ||
234 | <ImageView | 231 | <ImageView |
235 | android:layout_width="0dp" | 232 | android:layout_width="0dp" |
236 | android:layout_height="wrap_content" | 233 | android:layout_height="wrap_content" |
237 | android:layout_weight="1" | 234 | android:layout_weight="1" |
238 | android:paddingTop="20dp" | 235 | android:paddingTop="20dp" |
239 | android:paddingBottom="20dp" | 236 | android:paddingBottom="20dp" |
240 | android:src="@mipmap/wodebiji1" /> | 237 | android:src="@mipmap/wodebiji1" /> |
241 | <TextView | 238 | <TextView |
242 | android:id="@+id/linel_mynote" | 239 | android:id="@+id/linel_mynote" |
243 | android:layout_width="0dp" | 240 | android:layout_width="0dp" |
244 | android:layout_height="wrap_content" | 241 | android:layout_height="wrap_content" |
245 | android:layout_weight="1" | 242 | android:layout_weight="1" |
246 | android:paddingTop="20dp" | 243 | android:paddingTop="20dp" |
247 | android:paddingBottom="20dp" | 244 | android:paddingBottom="20dp" |
248 | android:text="我的笔记" | 245 | android:text="我的笔记" |
249 | android:textSize="20sp" /> | 246 | android:textSize="20sp" /> |
250 | 247 | ||
251 | </LinearLayout> | 248 | </LinearLayout> |
252 | <View | 249 | <View |
253 | android:layout_width="match_parent" | 250 | android:layout_width="match_parent" |
254 | android:layout_height="1dp" | 251 | android:layout_height="1dp" |
255 | android:background="@color/cutoff_line"> | 252 | android:background="@color/cutoff_line"> |
256 | 253 | ||
257 | </View> | 254 | </View> |
258 | <LinearLayout | 255 | <LinearLayout |
259 | android:layout_width="match_parent" | 256 | android:layout_width="match_parent" |
260 | android:layout_height="wrap_content" | 257 | android:layout_height="wrap_content" |
261 | android:gravity="center_vertical" | 258 | android:gravity="center_vertical" |
262 | android:orientation="horizontal"> | 259 | android:orientation="horizontal"> |
263 | 260 | ||
264 | <ImageView | 261 | <ImageView |
265 | android:layout_width="0dp" | 262 | android:layout_width="0dp" |
266 | android:layout_height="wrap_content" | 263 | android:layout_height="wrap_content" |
267 | android:layout_weight="1" | 264 | android:layout_weight="1" |
268 | android:paddingTop="20dp" | 265 | android:paddingTop="20dp" |
269 | android:paddingBottom="20dp" | 266 | android:paddingBottom="20dp" |
270 | android:src="@mipmap/wodeshoucang" /> | 267 | android:src="@mipmap/wodeshoucang" /> |
271 | 268 | ||
272 | <TextView | 269 | <TextView |
273 | android:id="@+id/linel_mycollege" | 270 | android:id="@+id/linel_mycollege" |
274 | android:layout_width="0dp" | 271 | android:layout_width="0dp" |
275 | android:layout_height="wrap_content" | 272 | android:layout_height="wrap_content" |
276 | android:layout_weight="1" | 273 | android:layout_weight="1" |
277 | android:paddingTop="20dp" | 274 | android:paddingTop="20dp" |
278 | android:paddingBottom="20dp" | 275 | android:paddingBottom="20dp" |
279 | android:text="我的收藏" | 276 | android:text="我的收藏" |
280 | android:textSize="20sp" /> | 277 | android:textSize="20sp" /> |
281 | <View | 278 | <View |
282 | android:layout_width="1dp" | 279 | android:layout_width="1dp" |
283 | android:layout_height="match_parent" | 280 | android:layout_height="match_parent" |
284 | android:background="@color/cutoff_line"> | 281 | android:background="@color/cutoff_line"> |
285 | 282 | ||
286 | </View> | 283 | </View> |
287 | 284 | ||
288 | <ImageView | 285 | <ImageView |
289 | android:layout_width="0dp" | 286 | android:layout_width="0dp" |
290 | android:layout_height="wrap_content" | 287 | android:layout_height="wrap_content" |
291 | android:layout_weight="1" | 288 | android:layout_weight="1" |
292 | android:paddingTop="20dp" | 289 | android:paddingTop="20dp" |
293 | android:paddingBottom="20dp" | 290 | android:paddingBottom="20dp" |
294 | android:src="@mipmap/wodebanji1" /> | 291 | android:src="@mipmap/wodebanji1" /> |
295 | <TextView | 292 | <TextView |
296 | android:id="@+id/linel_myclass" | 293 | android:id="@+id/linel_myclass" |
297 | android:layout_width="0dp" | 294 | android:layout_width="0dp" |
298 | android:layout_height="wrap_content" | 295 | android:layout_height="wrap_content" |
299 | android:layout_weight="1" | 296 | android:layout_weight="1" |
300 | android:text="我的生词" | 297 | android:text="我的生词" |
301 | android:paddingTop="20dp" | 298 | android:paddingTop="20dp" |
302 | android:paddingBottom="20dp" | 299 | android:paddingBottom="20dp" |
303 | android:textSize="20sp" /> | 300 | android:textSize="20sp" /> |
304 | 301 | ||
305 | </LinearLayout> | 302 | </LinearLayout> |
306 | 303 | ||
307 | <View | 304 | <View |
308 | android:layout_width="match_parent" | 305 | android:layout_width="match_parent" |
309 | android:layout_height="0.7dp" | 306 | android:layout_height="0.7dp" |
310 | android:background="@color/cutoff_line"> | 307 | android:background="@color/cutoff_line"> |
311 | 308 | ||
312 | </View> | 309 | </View> |
313 | 310 | ||
314 | </LinearLayout> | 311 | </LinearLayout> |
315 | <LinearLayout | 312 | <LinearLayout |
316 | android:layout_width="wrap_content" | 313 | android:layout_width="wrap_content" |
317 | android:layout_height="wrap_content" | 314 | android:layout_height="wrap_content" |
318 | android:paddingTop="10dp" | 315 | android:paddingTop="10dp" |
319 | android:paddingLeft="10dp" | 316 | android:paddingLeft="10dp" |
320 | android:paddingRight="10dp" | 317 | android:paddingRight="10dp" |
321 | android:layout_gravity="center" | 318 | android:layout_gravity="center" |
322 | android:layout_marginTop="150dp"> | 319 | android:layout_marginTop="150dp"> |
323 | <TextView | 320 | <TextView |
324 | android:id="@+id/iv_look_card" | 321 | android:id="@+id/iv_look_card" |
325 | android:layout_width="wrap_content" | 322 | android:layout_width="wrap_content" |
326 | android:layout_height="wrap_content" | 323 | android:layout_height="40dp" |
324 | android:gravity="center" | ||
327 | android:textColor="@color/bgstudy_baoka" | 325 | android:textColor="@color/bgstudy_baoka" |
328 | android:text="好记星电子产品保修卡" /> | 326 | android:text="好记星电子产品保修卡" /> |
329 | <ImageView | 327 | <ImageView |
330 | android:layout_width="wrap_content" | 328 | android:layout_width="wrap_content" |
331 | android:layout_height="wrap_content" | 329 | android:layout_height="wrap_content" |
332 | android:layout_gravity="center_vertical" | 330 | android:layout_gravity="center_vertical" |
333 | android:src="@mipmap/ahah" /> | 331 | android:src="@mipmap/ahah" /> |
334 | </LinearLayout> | 332 | </LinearLayout> |
335 | 333 | ||
336 | <!-- | 334 | <!-- |
337 | <LinearLayout | 335 | <LinearLayout |
338 | android:layout_marginTop="10dp" | 336 | android:layout_marginTop="10dp" |
339 | android:layout_width="match_parent" | 337 | android:layout_width="match_parent" |
340 | android:layout_height="100dp" | 338 | android:layout_height="100dp" |
341 | android:gravity="bottom" | 339 | android:gravity="bottom" |
342 | android:background="@mipmap/xiaoguanggao"> | 340 | android:background="@mipmap/xiaoguanggao"> |
343 | 341 | ||
344 | </LinearLayout>--> | 342 | </LinearLayout>--> |
345 | 343 | ||
346 | 344 | ||
347 | </LinearLayout> | 345 | </LinearLayout> |
348 | 346 | ||
349 | 347 | ||
350 | <View | 348 | <View |
351 | android:layout_width="0.7dp" | 349 | android:layout_width="0.7dp" |
352 | android:layout_height="match_parent" | 350 | android:layout_height="match_parent" |
353 | android:background="@color/cutoff_line"> | 351 | android:background="@color/cutoff_line"> |
354 | 352 | ||
355 | </View> | 353 | </View> |
356 | 354 | ||
357 | <LinearLayout | 355 | <LinearLayout |
358 | android:layout_width="0dp" | 356 | android:layout_width="0dp" |
359 | android:layout_height="match_parent" | 357 | android:layout_height="match_parent" |
360 | android:layout_weight="2.8" | 358 | android:layout_weight="2.8" |
361 | android:orientation="vertical"> | 359 | android:orientation="vertical"> |
362 | 360 | ||
363 | <LinearLayout | 361 | <LinearLayout |
364 | android:layout_width="match_parent" | 362 | android:layout_width="match_parent" |
365 | android:layout_height="wrap_content" | 363 | android:layout_height="wrap_content" |
366 | android:layout_margin="10dp" | 364 | android:layout_margin="10dp" |
367 | android:gravity="center_vertical" | 365 | android:gravity="center_vertical" |
368 | android:orientation="horizontal"> | 366 | android:orientation="horizontal"> |
369 | 367 | ||
370 | <View | 368 | <View |
371 | android:layout_width="5dp" | 369 | android:layout_width="5dp" |
372 | android:layout_height="20dp" | 370 | android:layout_height="20dp" |
373 | android:background="@color/login_text_blue"> | 371 | android:background="@color/login_text_blue"> |
374 | 372 | ||
375 | </View> | 373 | </View> |
376 | 374 | ||
377 | <TextView | 375 | <TextView |
378 | android:layout_width="0dp" | 376 | android:layout_width="0dp" |
379 | android:layout_height="wrap_content" | 377 | android:layout_height="wrap_content" |
380 | android:layout_marginLeft="5dp" | 378 | android:layout_marginLeft="5dp" |
381 | android:layout_weight="5" | 379 | android:layout_weight="5" |
382 | android:text="个人信息" | 380 | android:text="个人信息" |
383 | android:textSize="22sp" /> | 381 | android:textSize="22sp" /> |
384 | 382 | ||
385 | <TextView | 383 | <TextView |
386 | android:layout_width="0dp" | 384 | android:layout_width="0dp" |
387 | android:layout_height="wrap_content" | 385 | android:layout_height="wrap_content" |
388 | android:layout_marginLeft="10dp" | 386 | android:layout_marginLeft="10dp" |
389 | android:layout_weight="0.1" | 387 | android:layout_weight="0.1" |
390 | android:text="" | 388 | android:text="" |
391 | android:textSize="18sp" /> | 389 | android:textSize="18sp" /> |
392 | 390 | ||
393 | <ImageView | 391 | <ImageView |
394 | android:id="@+id/tv_edit_presoninfo" | 392 | android:id="@+id/tv_edit_presoninfo" |
395 | android:padding="10dp" | 393 | android:padding="10dp" |
396 | android:layout_width="0dp" | 394 | android:layout_width="0dp" |
397 | android:layout_height="wrap_content" | 395 | android:layout_height="wrap_content" |
398 | android:layout_weight="0.4" | 396 | android:layout_weight="0.4" |
399 | android:src="@mipmap/gerenxinxibianji" /> | 397 | android:src="@mipmap/gerenxinxibianji" /> |
400 | 398 | ||
401 | 399 | ||
402 | </LinearLayout> | 400 | </LinearLayout> |
403 | 401 | ||
404 | <LinearLayout | 402 | <LinearLayout |
405 | android:layout_width="match_parent" | 403 | android:layout_width="match_parent" |
406 | android:layout_height="wrap_content" | 404 | android:layout_height="wrap_content" |
407 | android:layout_marginLeft="50dp" | 405 | android:layout_marginLeft="50dp" |
408 | android:orientation="vertical"> | 406 | android:orientation="vertical"> |
409 | 407 | ||
410 | <LinearLayout | 408 | <LinearLayout |
411 | android:layout_width="match_parent" | 409 | android:layout_width="match_parent" |
412 | android:layout_height="wrap_content" | 410 | android:layout_height="wrap_content" |
413 | android:gravity="center_vertical" | 411 | android:gravity="center_vertical" |
414 | android:orientation="horizontal"> | 412 | android:orientation="horizontal"> |
415 | 413 | ||
416 | <TextView | 414 | <TextView |
417 | android:layout_width="0dp" | 415 | android:layout_width="0dp" |
418 | android:layout_height="wrap_content" | 416 | android:layout_height="wrap_content" |
419 | android:textColor="@color/login_edittext_hint" | 417 | android:textColor="@color/login_edittext_hint" |
420 | android:layout_weight="1" | 418 | android:layout_weight="1" |
421 | android:text="昵称" | 419 | android:text="昵称" |
422 | android:textSize="20sp" /> | 420 | android:textSize="20sp" /> |
423 | 421 | ||
424 | <TextView | 422 | <TextView |
425 | android:id="@+id/tv_username1" | 423 | android:id="@+id/tv_username1" |
426 | android:layout_width="0dp" | 424 | android:layout_width="0dp" |
427 | android:layout_height="wrap_content" | 425 | android:layout_height="wrap_content" |
428 | android:layout_weight="2" | 426 | android:layout_weight="2" |
429 | android:hint="未填写" | 427 | android:hint="未填写" |
430 | android:textSize="20sp" /> | 428 | android:textSize="20sp" /> |
431 | 429 | ||
432 | <TextView | 430 | <TextView |
433 | android:layout_width="1dp" | 431 | android:layout_width="1dp" |
434 | android:layout_height="wrap_content" | 432 | android:layout_height="wrap_content" |
435 | android:layout_weight="1" | 433 | android:layout_weight="1" |
436 | android:textColor="@color/login_edittext_hint" | 434 | android:textColor="@color/login_edittext_hint" |
437 | android:text="星座" | 435 | android:text="星座" |
438 | android:textSize="20sp" /> | 436 | android:textSize="20sp" /> |
439 | 437 | ||
440 | <TextView | 438 | <TextView |
441 | android:id="@+id/tv_mygad" | 439 | android:id="@+id/tv_mygad" |
442 | android:layout_width="0dp" | 440 | android:layout_width="0dp" |
443 | android:layout_height="wrap_content" | 441 | android:layout_height="wrap_content" |
444 | android:layout_weight="2" | 442 | android:layout_weight="2" |
445 | android:hint="未填写" | 443 | android:hint="未填写" |
446 | android:textSize="20sp" /> | 444 | android:textSize="20sp" /> |
447 | </LinearLayout> | 445 | </LinearLayout> |
448 | 446 | ||
449 | <LinearLayout | 447 | <LinearLayout |
450 | android:layout_width="match_parent" | 448 | android:layout_width="match_parent" |
451 | android:layout_height="wrap_content" | 449 | android:layout_height="wrap_content" |
452 | android:layout_marginTop="15dp" | 450 | android:layout_marginTop="15dp" |
453 | android:gravity="center_vertical" | 451 | android:gravity="center_vertical" |
454 | android:orientation="horizontal"> | 452 | android:orientation="horizontal"> |
455 | 453 | ||
456 | <TextView | 454 | <TextView |
457 | android:layout_width="0dp" | 455 | android:layout_width="0dp" |
458 | android:layout_height="wrap_content" | 456 | android:layout_height="wrap_content" |
459 | android:textColor="@color/login_edittext_hint" | 457 | android:textColor="@color/login_edittext_hint" |
460 | android:layout_weight="1" | 458 | android:layout_weight="1" |
461 | android:text="性别" | 459 | android:text="性别" |
462 | android:textSize="20sp" /> | 460 | android:textSize="20sp" /> |
463 | 461 | ||
464 | <TextView | 462 | <TextView |
465 | android:id="@+id/tv_sex" | 463 | android:id="@+id/tv_sex" |
466 | android:layout_width="0dp" | 464 | android:layout_width="0dp" |
467 | android:layout_height="wrap_content" | 465 | android:layout_height="wrap_content" |
468 | android:layout_weight="2" | 466 | android:layout_weight="2" |
469 | android:hint="未填写" | 467 | android:hint="未填写" |
470 | android:textSize="20sp" /> | 468 | android:textSize="20sp" /> |
471 | 469 | ||
472 | <TextView | 470 | <TextView |
473 | android:layout_width="1dp" | 471 | android:layout_width="1dp" |
474 | android:layout_height="wrap_content" | 472 | android:layout_height="wrap_content" |
475 | android:textColor="@color/login_edittext_hint" | 473 | android:textColor="@color/login_edittext_hint" |
476 | android:layout_weight="1" | 474 | android:layout_weight="1" |
477 | android:text="地区" | 475 | android:text="地区" |
478 | android:textSize="20sp" /> | 476 | android:textSize="20sp" /> |
479 | 477 | ||
480 | <TextView | 478 | <TextView |
481 | android:id="@+id/tv_useinfo_adress" | 479 | android:id="@+id/tv_useinfo_adress" |
482 | android:layout_width="0dp" | 480 | android:layout_width="0dp" |
483 | android:layout_height="wrap_content" | 481 | android:layout_height="wrap_content" |
484 | android:layout_weight="2" | 482 | android:layout_weight="2" |
485 | android:hint="未填写" | 483 | android:hint="未填写" |
486 | android:maxLines="2" | 484 | android:maxLines="2" |
487 | android:ellipsize="end" | 485 | android:ellipsize="end" |
488 | android:textSize="20sp" /> | 486 | android:textSize="20sp" /> |
489 | </LinearLayout> | 487 | </LinearLayout> |
490 | 488 | ||
491 | <LinearLayout | 489 | <LinearLayout |
492 | android:layout_width="match_parent" | 490 | android:layout_width="match_parent" |
493 | android:layout_height="wrap_content" | 491 | android:layout_height="wrap_content" |
494 | android:layout_marginTop="15dp" | 492 | android:layout_marginTop="15dp" |
495 | android:gravity="center_vertical" | 493 | android:gravity="center_vertical" |
496 | android:orientation="horizontal"> | 494 | android:orientation="horizontal"> |
497 | 495 | ||
498 | <TextView | 496 | <TextView |
499 | android:layout_width="0dp" | 497 | android:layout_width="0dp" |
500 | android:layout_height="wrap_content" | 498 | android:layout_height="wrap_content" |
501 | android:layout_weight="1" | 499 | android:layout_weight="1" |
502 | android:text="生日" | 500 | android:text="生日" |
503 | android:textColor="@color/login_edittext_hint" | 501 | android:textColor="@color/login_edittext_hint" |
504 | 502 | ||
505 | android:textSize="20sp" /> | 503 | android:textSize="20sp" /> |
506 | 504 | ||
507 | <TextView | 505 | <TextView |
508 | android:id="@+id/tv_useinfo_birthday" | 506 | android:id="@+id/tv_useinfo_birthday" |
509 | android:layout_width="0dp" | 507 | android:layout_width="0dp" |
510 | android:layout_height="wrap_content" | 508 | android:layout_height="wrap_content" |
511 | android:layout_weight="2" | 509 | android:layout_weight="2" |
512 | android:hint="未填写" | 510 | android:hint="未填写" |
513 | android:textSize="20sp" /> | 511 | android:textSize="20sp" /> |
514 | 512 | ||
515 | <TextView | 513 | <TextView |
516 | android:layout_width="1dp" | 514 | android:layout_width="1dp" |
517 | android:layout_height="wrap_content" | 515 | android:layout_height="wrap_content" |
518 | android:layout_weight="1" | 516 | android:layout_weight="1" |
519 | android:textColor="@color/login_edittext_hint" | 517 | android:textColor="@color/login_edittext_hint" |
520 | 518 | ||
521 | android:text="学校" | 519 | android:text="学校" |
522 | android:textSize="20sp" /> | 520 | android:textSize="20sp" /> |
523 | 521 | ||
524 | <TextView | 522 | <TextView |
525 | android:id="@+id/tv_useinfo_school" | 523 | android:id="@+id/tv_useinfo_school" |
526 | android:layout_width="0dp" | 524 | android:layout_width="0dp" |
527 | android:layout_height="wrap_content" | 525 | android:layout_height="wrap_content" |
528 | android:layout_weight="2" | 526 | android:layout_weight="2" |
527 | android:maxLines="1" | ||
528 | android:ellipsize="end" | ||
529 | android:hint="未填写" | 529 | android:hint="未填写" |
530 | android:textSize="20sp" /> | 530 | android:textSize="20sp" /> |
531 | </LinearLayout> | 531 | </LinearLayout> |
532 | 532 | ||
533 | <LinearLayout | 533 | <LinearLayout |
534 | android:layout_width="match_parent" | 534 | android:layout_width="match_parent" |
535 | android:layout_height="wrap_content" | 535 | android:layout_height="wrap_content" |
536 | android:layout_marginTop="15dp" | 536 | android:layout_marginTop="15dp" |
537 | android:gravity="center_vertical" | 537 | android:gravity="center_vertical" |
538 | android:orientation="horizontal"> | 538 | android:orientation="horizontal"> |
539 | 539 | ||
540 | <TextView | 540 | <TextView |
541 | android:layout_width="0dp" | 541 | android:layout_width="0dp" |
542 | android:layout_height="wrap_content" | 542 | android:layout_height="wrap_content" |
543 | android:layout_weight="1" | 543 | android:layout_weight="1" |
544 | android:textColor="@color/login_edittext_hint" | 544 | android:textColor="@color/login_edittext_hint" |
545 | android:text=" Q Q" | 545 | android:text=" Q Q" |
546 | android:textSize="20sp" /> | 546 | android:textSize="20sp" /> |
547 | 547 | ||
548 | <TextView | 548 | <TextView |
549 | android:id="@+id/tv_useinfo_qq" | 549 | android:id="@+id/tv_useinfo_qq" |
550 | android:layout_width="0dp" | 550 | android:layout_width="0dp" |
551 | android:layout_height="wrap_content" | 551 | android:layout_height="wrap_content" |
552 | android:layout_weight="2" | 552 | android:layout_weight="2" |
553 | android:hint="未填写" | 553 | android:hint="未填写" |
554 | android:textSize="20sp" /> | 554 | android:textSize="20sp" /> |
555 | 555 | ||
556 | <TextView | 556 | <TextView |
557 | android:layout_width="1dp" | 557 | android:layout_width="1dp" |
558 | android:layout_height="wrap_content" | 558 | android:layout_height="wrap_content" |
559 | android:layout_weight="1" | 559 | android:layout_weight="1" |
560 | android:text="年级" | 560 | android:text="年级" |
561 | android:textColor="@color/login_edittext_hint" | 561 | android:textColor="@color/login_edittext_hint" |
562 | 562 | ||
563 | android:textSize="20sp" /> | 563 | android:textSize="20sp" /> |
564 | 564 | ||
565 | <TextView | 565 | <TextView |
566 | android:id="@+id/tv_useinfo_gender" | 566 | android:id="@+id/tv_useinfo_gender" |
567 | android:layout_width="0dp" | 567 | android:layout_width="0dp" |
568 | android:layout_height="wrap_content" | 568 | android:layout_height="wrap_content" |
569 | android:layout_weight="2" | 569 | android:layout_weight="2" |
570 | android:hint="未填写" | 570 | android:hint="未填写" |
571 | android:textSize="20sp" /> | 571 | android:textSize="20sp" /> |
572 | </LinearLayout> | 572 | </LinearLayout> |
573 | 573 | ||
574 | 574 | ||
575 | </LinearLayout> | 575 | </LinearLayout> |
576 | <View | 576 | <View |
577 | android:layout_width="match_parent" | 577 | android:layout_width="match_parent" |
578 | android:layout_height="0.7dp" | 578 | android:layout_height="0.7dp" |
579 | android:layout_marginTop="40dp" | 579 | android:layout_marginTop="40dp" |
580 | android:background="@color/cutoff_line"> | 580 | android:background="@color/cutoff_line"> |
581 | 581 | ||
582 | </View> | 582 | </View> |
583 | <LinearLayout | 583 | <LinearLayout |
584 | android:layout_width="match_parent" | 584 | android:layout_width="match_parent" |
585 | android:layout_height="wrap_content" | 585 | android:layout_height="wrap_content" |
586 | android:layout_margin="10dp" | 586 | android:layout_margin="10dp" |
587 | android:gravity="center_vertical" | 587 | android:gravity="center_vertical" |
588 | android:orientation="horizontal"> | 588 | android:orientation="horizontal"> |
589 | 589 | ||
590 | <View | 590 | <View |
591 | android:layout_width="5dp" | 591 | android:layout_width="5dp" |
592 | android:layout_height="20dp" | 592 | android:layout_height="20dp" |
593 | android:background="@color/login_text_blue"> | 593 | android:background="@color/login_text_blue"> |
594 | 594 | ||
595 | </View> | 595 | </View> |
596 | 596 | ||
597 | <TextView | 597 | <TextView |
598 | android:layout_width="wrap_content" | 598 | android:layout_width="wrap_content" |
599 | android:layout_height="wrap_content" | 599 | android:layout_height="wrap_content" |
600 | android:layout_marginLeft="5dp" | 600 | android:layout_marginLeft="5dp" |
601 | android:text="版本信息" | 601 | android:text="版本信息" |
602 | android:textSize="22sp" /> | 602 | android:textSize="22sp" /> |
603 | 603 | ||
604 | </LinearLayout> | 604 | </LinearLayout> |
605 | 605 | ||
606 | <LinearLayout | 606 | <LinearLayout |
607 | android:layout_width="wrap_content" | 607 | android:layout_width="wrap_content" |
608 | android:layout_height="wrap_content" | 608 | android:layout_height="wrap_content" |
609 | android:orientation="vertical" | 609 | android:orientation="vertical" |
610 | android:gravity="center"> | 610 | android:gravity="center"> |
611 | 611 | ||
612 | 612 | ||
613 | <GridView | 613 | <GridView |
614 | android:id="@+id/id_recyclerview_pubish" | 614 | android:id="@+id/id_recyclerview_pubish" |
615 | android:layout_margin="3dp" | 615 | android:layout_margin="3dp" |
616 | android:layout_width="match_parent" | 616 | android:layout_width="match_parent" |
617 | android:layout_height="wrap_content" | 617 | android:layout_height="wrap_content" |
618 | android:gravity="center_vertical" | 618 | android:gravity="center_vertical" |
619 | android:verticalSpacing="20dp" | 619 | android:verticalSpacing="20dp" |
620 | android:numColumns="5"> | 620 | android:numColumns="5"> |
621 | 621 | ||
622 | </GridView> | 622 | </GridView> |
623 | 623 | ||
624 | 624 | ||
625 | </LinearLayout> | 625 | </LinearLayout> |
626 | 626 | ||
627 | 627 | ||
628 | </LinearLayout> | 628 | </LinearLayout> |
629 | <LinearLayout | 629 | <LinearLayout |
630 | android:layout_width="0dp" | 630 | android:layout_width="0dp" |
631 | android:layout_height="match_parent" | 631 | android:layout_height="match_parent" |
632 | android:layout_weight="1" | 632 | android:layout_weight="1" |
633 | android:background="@color/bgstudy_laout" | 633 | android:background="@color/bgstudy_laout" |
634 | android:orientation="vertical"> | 634 | android:orientation="vertical"> |
635 | <LinearLayout | 635 | <LinearLayout |
636 | android:layout_width="match_parent" | 636 | android:layout_width="match_parent" |
637 | android:layout_height="wrap_content" | 637 | android:layout_height="wrap_content" |
638 | android:layout_margin="20dp" | 638 | android:layout_margin="20dp" |
639 | android:gravity="center_vertical" | 639 | android:gravity="center_vertical" |
640 | android:orientation="horizontal"> | 640 | android:orientation="horizontal"> |
641 | 641 | ||
642 | <View | 642 | <View |
643 | android:layout_width="5dp" | 643 | android:layout_width="5dp" |
644 | android:layout_height="20dp" | 644 | android:layout_height="20dp" |
645 | android:background="@color/login_text_blue"> | 645 | android:background="@color/login_text_blue"> |
646 | 646 | ||
647 | </View> | 647 | </View> |
648 | 648 | ||
649 | <TextView | 649 | <TextView |
650 | android:layout_width="wrap_content" | 650 | android:layout_width="wrap_content" |
651 | android:layout_height="wrap_content" | 651 | android:layout_height="wrap_content" |
652 | android:layout_marginLeft="5dp" | 652 | android:layout_marginLeft="5dp" |
653 | android:text="最近学习" | 653 | android:text="最近学习" |
654 | android:textSize="22sp" /> | 654 | android:textSize="22sp" /> |
655 | 655 | ||
656 | </LinearLayout> | 656 | </LinearLayout> |
657 | 657 | ||
658 | <LinearLayout | 658 | <LinearLayout |
659 | android:layout_width="match_parent" | 659 | android:layout_width="match_parent" |
660 | android:layout_height="match_parent" | 660 | android:layout_height="match_parent" |
661 | android:gravity="center" | 661 | android:gravity="center" |
662 | android:orientation="vertical" | 662 | android:orientation="vertical"> |
663 | > | ||
664 | <LinearLayout | 663 | <LinearLayout |
665 | android:id="@+id/view_novedeo" | 664 | android:id="@+id/view_novedeo" |
666 | android:layout_width="match_parent" | 665 | android:layout_width="match_parent" |
667 | android:layout_height="match_parent" | 666 | android:layout_height="match_parent" |
668 | android:gravity="center" | 667 | android:gravity="center" |
669 | android:orientation="vertical"> | 668 | android:orientation="vertical"> |
670 | <ImageView | 669 | <ImageView |
671 | android:layout_width="wrap_content" | 670 | android:layout_width="wrap_content" |
672 | android:layout_height="wrap_content" | 671 | android:layout_height="wrap_content" |
673 | android:src="@mipmap/nostudy"/> | 672 | android:src="@mipmap/nostudy"/> |
674 | <TextView | 673 | <TextView |
675 | android:layout_width="wrap_content" | 674 | android:layout_width="wrap_content" |
676 | android:layout_height="wrap_content" | 675 | android:layout_height="wrap_content" |
677 | android:layout_marginTop="20dp" | 676 | android:layout_marginTop="20dp" |
678 | android:text="小主人最近还没有学习哦" | 677 | android:text="小主人最近还没有学习哦" |
679 | android:textSize="14sp" /> | 678 | android:textSize="14sp" /> |
680 | <TextView | 679 | <TextView |
681 | android:layout_width="wrap_content" | 680 | android:layout_width="wrap_content" |
682 | android:layout_height="wrap_content" | 681 | android:layout_height="wrap_content" |
683 | android:text="快去学习吧" | 682 | android:text="快去学习吧" |
684 | android:textSize="14sp" /> | 683 | android:textSize="14sp" /> |
685 | </LinearLayout> | 684 | </LinearLayout> |
686 | <android.support.v7.widget.RecyclerView | 685 | <android.support.v7.widget.RecyclerView |
687 | android:id="@+id/id_recyclerview_horizontal" | 686 | android:id="@+id/id_recyclerview_horizontal" |
688 | android:layout_width="wrap_content" | 687 | android:layout_width="wrap_content" |
689 | android:layout_height="wrap_content" | 688 | android:layout_height="wrap_content" |
690 | android:layout_marginLeft="20dp" | 689 | android:layout_marginLeft="20dp" |
691 | android:layout_gravity="top" | 690 | android:layout_gravity="top" |
692 | android:scrollbars="none" /> | 691 | android:scrollbars="none" /> |
693 | </LinearLayout> | 692 | </LinearLayout> |
694 | 693 | ||
695 | </LinearLayout> | 694 | </LinearLayout> |
696 | 695 | ||
697 | 696 | ||
698 | </LinearLayout> | 697 | </LinearLayout> |
699 | 698 |
PersonalCenter/app/src/main/res/layout/activity_ok_cardinfo.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:orientation="vertical"> | 5 | android:orientation="vertical"> |
6 | 6 | ||
7 | <RelativeLayout | 7 | <RelativeLayout |
8 | android:id="@+id/title" | 8 | android:id="@+id/title" |
9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
11 | android:background="@color/login_text_blue" | 11 | android:background="@color/login_text_blue" |
12 | android:minHeight="50dp"> | 12 | android:minHeight="50dp"> |
13 | 13 | ||
14 | <ImageView | 14 | <ImageView |
15 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
16 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
17 | android:layout_height="wrap_content" | 17 | android:layout_height="wrap_content" |
18 | android:layout_centerVertical="true" | 18 | android:layout_centerVertical="true" |
19 | android:paddingLeft="20dp" | 19 | android:paddingLeft="20dp" |
20 | android:paddingRight="20dp" | 20 | android:paddingRight="20dp" |
21 | android:src="@mipmap/title_back" /> | 21 | android:src="@mipmap/title_back" /> |
22 | 22 | ||
23 | <TextView | 23 | <TextView |
24 | android:id="@+id/menu_title" | 24 | android:id="@+id/menu_title" |
25 | android:layout_width="wrap_content" | 25 | android:layout_width="wrap_content" |
26 | android:layout_height="wrap_content" | 26 | android:layout_height="wrap_content" |
27 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
28 | android:text="@string/string_electroniccard_info_ok" | 28 | android:text="@string/string_electroniccard_info_ok" |
29 | android:textColor="@android:color/white" | 29 | android:textColor="@android:color/white" |
30 | android:textSize="22sp" /> | 30 | android:textSize="22sp" /> |
31 | </RelativeLayout> | 31 | </RelativeLayout> |
32 | 32 | ||
33 | <LinearLayout | 33 | <LinearLayout |
34 | android:layout_width="match_parent" | 34 | android:layout_width="match_parent" |
35 | android:layout_height="wrap_content" | 35 | android:layout_height="wrap_content" |
36 | android:layout_marginTop="50dp" | 36 | android:layout_marginTop="50dp" |
37 | android:layout_marginLeft="20dp" | 37 | android:layout_marginLeft="20dp" |
38 | android:layout_marginRight="20dp" | 38 | android:layout_marginRight="20dp" |
39 | android:layout_marginBottom="30dp" | 39 | android:layout_marginBottom="30dp" |
40 | android:background="@mipmap/cardbackgrangd" | 40 | android:background="@mipmap/cardbackgrangd" |
41 | android:gravity="center" | 41 | android:gravity="center" |
42 | android:orientation="vertical"> | 42 | android:orientation="vertical"> |
43 | 43 | ||
44 | <LinearLayout | 44 | <LinearLayout |
45 | android:layout_width="match_parent" | 45 | android:layout_width="match_parent" |
46 | android:layout_height="wrap_content" | 46 | android:layout_height="wrap_content" |
47 | android:layout_marginTop="50dp" | 47 | android:layout_marginTop="50dp" |
48 | android:gravity="center_vertical" | 48 | android:gravity="center_vertical" |
49 | android:orientation="horizontal"> | 49 | android:orientation="horizontal"> |
50 | 50 | ||
51 | <LinearLayout | 51 | <LinearLayout |
52 | android:layout_width="0dp" | 52 | android:layout_width="0dp" |
53 | android:layout_weight="1" | 53 | android:layout_weight="1" |
54 | android:layout_height="wrap_content" | 54 | android:layout_height="wrap_content" |
55 | android:layout_marginLeft="200dp" | 55 | android:layout_marginLeft="200dp" |
56 | android:gravity="center_vertical"> | 56 | android:gravity="center_vertical"> |
57 | 57 | ||
58 | <ImageView | 58 | <ImageView |
59 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
60 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
61 | android:src="@mipmap/logo_info" /> | 61 | android:src="@mipmap/logo_info" /> |
62 | 62 | ||
63 | <TextView | 63 | <TextView |
64 | android:layout_width="wrap_content" | 64 | android:layout_width="wrap_content" |
65 | android:layout_height="wrap_content" | 65 | android:layout_height="wrap_content" |
66 | android:layout_marginLeft="50dp" | 66 | android:layout_marginLeft="50dp" |
67 | android:background="@null" | 67 | android:background="@null" |
68 | android:text="电子保卡" | 68 | android:text="电子保卡" |
69 | android:textColor="@color/electronic_card" | 69 | android:textColor="@color/electronic_card" |
70 | android:textSize="22sp" /> | 70 | android:textSize="22sp" /> |
71 | 71 | ||
72 | </LinearLayout> | 72 | </LinearLayout> |
73 | 73 | ||
74 | <LinearLayout | 74 | <LinearLayout |
75 | android:id="@+id/salesperson_phone_layout" | ||
75 | android:layout_width="0dp" | 76 | android:layout_width="0dp" |
76 | android:layout_weight="1" | 77 | android:layout_weight="1" |
77 | android:layout_height="80dp" | 78 | android:layout_height="60dp" |
78 | android:layout_marginLeft="80dp" | 79 | android:layout_marginLeft="80dp" |
79 | android:gravity="center_vertical"> | 80 | android:gravity="center_vertical"> |
80 | 81 | ||
81 | <TextView | 82 | <TextView |
82 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
83 | android:layout_height="wrap_content" | 84 | android:layout_height="wrap_content" |
84 | android:text="客户姓名" | 85 | android:text="导购员手机号" |
85 | android:textSize="22sp" /> | 86 | android:textSize="22sp" /> |
86 | 87 | ||
87 | <TextView | 88 | <TextView |
88 | android:id="@+id/iv_card_username" | 89 | android:id="@+id/tv_salesperson_phone" |
89 | android:layout_width="wrap_content" | 90 | android:layout_width="wrap_content" |
90 | android:layout_height="wrap_content" | 91 | android:layout_height="wrap_content" |
91 | android:layout_marginLeft="80dp" | 92 | android:layout_marginLeft="40dp" |
93 | android:background="@null" | ||
92 | android:text="" | 94 | android:text="" |
93 | android:textSize="22sp" /> | 95 | android:textSize="22sp" /> |
94 | 96 | ||
95 | </LinearLayout> | 97 | </LinearLayout> |
96 | 98 | ||
97 | </LinearLayout> | 99 | </LinearLayout> |
98 | 100 | ||
99 | <LinearLayout | 101 | <LinearLayout |
100 | android:layout_width="match_parent" | 102 | android:layout_width="match_parent" |
101 | android:layout_height="wrap_content" | 103 | android:layout_height="wrap_content" |
102 | android:gravity="center_vertical" | 104 | android:gravity="center_vertical" |
103 | android:orientation="horizontal"> | 105 | android:orientation="horizontal"> |
104 | 106 | ||
105 | <LinearLayout | 107 | <LinearLayout |
106 | android:layout_width="0dp" | 108 | android:layout_width="0dp" |
107 | android:layout_weight="1" | 109 | android:layout_weight="1" |
108 | android:layout_height="60dp" | 110 | android:layout_height="60dp" |
109 | android:layout_marginLeft="200dp" | 111 | android:layout_marginLeft="200dp" |
110 | android:gravity="center_vertical"> | 112 | android:gravity="center_vertical"> |
111 | 113 | ||
112 | <TextView | 114 | <TextView |
113 | android:layout_width="wrap_content" | 115 | android:layout_width="wrap_content" |
114 | android:layout_height="wrap_content" | 116 | android:layout_height="wrap_content" |
115 | android:text="产品型号" | 117 | android:text="产品型号" |
116 | android:textSize="22sp" /> | 118 | android:textSize="22sp" /> |
117 | 119 | ||
118 | <TextView | 120 | <TextView |
119 | android:id="@+id/tv_card_deviceModel" | 121 | android:id="@+id/tv_card_deviceModel" |
120 | android:layout_width="wrap_content" | 122 | android:layout_width="wrap_content" |
121 | android:layout_height="wrap_content" | 123 | android:layout_height="wrap_content" |
122 | android:layout_marginLeft="50dp" | 124 | android:layout_marginLeft="50dp" |
123 | android:text="" | 125 | android:text="" |
124 | android:textSize="22sp" /> | 126 | android:textSize="22sp" /> |
125 | 127 | ||
126 | 128 | ||
127 | </LinearLayout> | 129 | </LinearLayout> |
128 | 130 | ||
131 | |||
129 | <LinearLayout | 132 | <LinearLayout |
130 | android:layout_width="0dp" | 133 | android:layout_width="0dp" |
131 | android:layout_weight="1" | 134 | android:layout_weight="1" |
132 | android:layout_height="60dp" | 135 | android:layout_height="60dp" |
133 | android:layout_marginLeft="80dp" | 136 | android:layout_marginLeft="80dp" |
134 | android:gravity="center_vertical"> | 137 | android:gravity="center_vertical"> |
135 | 138 | ||
136 | <TextView | 139 | <TextView |
137 | android:layout_width="wrap_content" | 140 | android:layout_width="wrap_content" |
138 | android:layout_height="wrap_content" | 141 | android:layout_height="wrap_content" |
139 | android:text="客户地址" | 142 | android:text="客户姓名" |
140 | android:textSize="22sp" /> | 143 | android:textSize="22sp" /> |
141 | 144 | ||
142 | <TextView | 145 | <TextView |
143 | android:id="@+id/tv_card_adress" | 146 | android:id="@+id/iv_card_username" |
144 | android:layout_width="wrap_content" | 147 | android:layout_width="wrap_content" |
145 | android:layout_height="wrap_content" | 148 | android:layout_height="wrap_content" |
146 | android:layout_marginLeft="80dp" | 149 | android:layout_marginLeft="83dp" |
147 | android:background="@null" | ||
148 | android:text="" | 150 | android:text="" |
149 | android:textSize="22sp" /> | 151 | android:textSize="22sp" /> |
150 | 152 | ||
151 | </LinearLayout> | 153 | </LinearLayout> |
152 | 154 | ||
155 | |||
153 | </LinearLayout> | 156 | </LinearLayout> |
154 | 157 | ||
155 | <LinearLayout | 158 | <LinearLayout |
156 | android:layout_width="match_parent" | 159 | android:layout_width="match_parent" |
157 | android:layout_height="wrap_content" | 160 | android:layout_height="wrap_content" |
158 | android:gravity="center_vertical" | 161 | android:gravity="center_vertical" |
159 | android:orientation="horizontal"> | 162 | android:orientation="horizontal"> |
160 | 163 | ||
161 | <LinearLayout | 164 | <LinearLayout |
162 | android:layout_width="0dp" | 165 | android:layout_width="0dp" |
163 | android:layout_weight="1" | 166 | android:layout_weight="1" |
164 | android:layout_height="60dp" | 167 | android:layout_height="60dp" |
165 | android:layout_marginLeft="200dp" | 168 | android:layout_marginLeft="200dp" |
166 | android:gravity="center_vertical"> | 169 | android:gravity="center_vertical"> |
167 | 170 | ||
168 | <TextView | 171 | <TextView |
169 | android:layout_width="wrap_content" | 172 | android:layout_width="wrap_content" |
170 | android:layout_height="wrap_content" | 173 | android:layout_height="wrap_content" |
171 | android:text="MAC地址" | 174 | android:text="MAC地址" |
172 | android:textSize="22sp" /> | 175 | android:textSize="22sp" /> |
173 | 176 | ||
174 | <TextView | 177 | <TextView |
175 | android:id="@+id/tv_card_mac" | 178 | android:id="@+id/tv_card_mac" |
176 | android:layout_width="wrap_content" | 179 | android:layout_width="wrap_content" |
177 | android:layout_height="wrap_content" | 180 | android:layout_height="wrap_content" |
178 | android:layout_marginLeft="50dp" | 181 | android:layout_marginLeft="50dp" |
179 | android:background="@null" | 182 | android:background="@null" |
180 | android:text="" | 183 | android:text="" |
181 | android:textSize="22sp" /> | 184 | android:textSize="22sp" /> |
182 | 185 | ||
183 | </LinearLayout> | 186 | </LinearLayout> |
184 | 187 | ||
185 | <LinearLayout | 188 | <LinearLayout |
186 | android:layout_width="0dp" | 189 | android:layout_width="0dp" |
187 | android:layout_weight="1" | 190 | android:layout_weight="1" |
188 | android:layout_height="60dp" | 191 | android:layout_height="60dp" |
189 | android:layout_marginLeft="80dp" | 192 | android:layout_marginLeft="80dp" |
190 | android:gravity="center_vertical"> | 193 | android:gravity="center_vertical"> |
191 | 194 | ||
192 | <TextView | 195 | <TextView |
193 | android:layout_width="wrap_content" | 196 | android:layout_width="wrap_content" |
194 | android:layout_height="wrap_content" | 197 | android:layout_height="wrap_content" |
195 | android:text="购买时间" | 198 | android:text="客户地址" |
196 | android:textSize="22sp" /> | 199 | android:textSize="22sp" /> |
197 | 200 | ||
198 | <TextView | 201 | <TextView |
199 | android:id="@+id/tv_card_time" | 202 | android:id="@+id/tv_card_adress" |
200 | android:layout_width="wrap_content" | 203 | android:layout_width="wrap_content" |
201 | android:layout_height="wrap_content" | 204 | android:layout_height="wrap_content" |
202 | android:layout_marginLeft="80dp" | 205 | android:layout_marginLeft="83dp" |
203 | android:background="@null" | 206 | android:background="@null" |
204 | android:text="" | 207 | android:text="" |
205 | android:textSize="22sp" /> | 208 | android:textSize="22sp" /> |
209 | |||
206 | </LinearLayout> | 210 | </LinearLayout> |
207 | 211 | ||
212 | |||
213 | |||
208 | </LinearLayout> | 214 | </LinearLayout> |
209 | 215 | ||
210 | <LinearLayout | 216 | <LinearLayout |
211 | android:layout_width="match_parent" | 217 | android:layout_width="match_parent" |
212 | android:layout_height="wrap_content" | 218 | android:layout_height="wrap_content" |
213 | android:gravity="center_vertical" | 219 | android:gravity="center_vertical" |
214 | android:orientation="horizontal"> | 220 | android:orientation="horizontal"> |
215 | 221 | ||
216 | <LinearLayout | 222 | <LinearLayout |
217 | android:layout_width="0dp" | 223 | android:layout_width="0dp" |
218 | android:layout_weight="1" | 224 | android:layout_weight="1" |
219 | android:layout_height="60dp" | 225 | android:layout_height="60dp" |
220 | android:layout_marginLeft="200dp" | 226 | android:layout_marginLeft="200dp" |
221 | android:gravity="center_vertical"> | 227 | android:gravity="center_vertical"> |
222 | 228 | ||
223 | <TextView | 229 | <TextView |
224 | android:layout_width="wrap_content" | 230 | android:layout_width="wrap_content" |
225 | android:layout_height="wrap_content" | 231 | android:layout_height="wrap_content" |
226 | android:text="机身编码" | 232 | android:text="机身编码" |
227 | android:textSize="22sp" /> | 233 | android:textSize="22sp" /> |
228 | 234 | ||
229 | <TextView | 235 | <TextView |
230 | android:id="@+id/tv_card_deviceNumber" | 236 | android:id="@+id/tv_card_deviceNumber" |
231 | android:layout_width="wrap_content" | 237 | android:layout_width="wrap_content" |
232 | android:layout_height="wrap_content" | 238 | android:layout_height="wrap_content" |
233 | android:layout_marginLeft="50dp" | 239 | android:layout_marginLeft="50dp" |
234 | android:hint="" | 240 | android:hint="" |
235 | android:textSize="22sp" /> | 241 | android:textSize="22sp" /> |
236 | 242 | ||
237 | </LinearLayout> | 243 | </LinearLayout> |
238 | 244 | ||
239 | <LinearLayout | 245 | <LinearLayout |
240 | android:layout_width="0dp" | 246 | android:layout_width="0dp" |
241 | android:layout_weight="1" | 247 | android:layout_weight="1" |
242 | android:layout_height="60dp" | 248 | android:layout_height="60dp" |
243 | android:layout_marginLeft="80dp" | 249 | android:layout_marginLeft="80dp" |
244 | android:gravity="center_vertical"> | 250 | android:gravity="center_vertical"> |
245 | 251 | ||
246 | <TextView | 252 | <TextView |
247 | android:layout_width="wrap_content" | 253 | android:layout_width="wrap_content" |
248 | android:layout_height="wrap_content" | 254 | android:layout_height="wrap_content" |
249 | android:text="购买地址" | 255 | android:text="购买地址" |
250 | android:textSize="22sp" /> | 256 | android:textSize="22sp" /> |
251 | 257 | ||
252 | <TextView | 258 | <TextView |
253 | android:id="@+id/tv_card_shopAdress" | 259 | android:id="@+id/tv_card_shopAdress" |
254 | android:layout_width="wrap_content" | 260 | android:layout_width="wrap_content" |
255 | android:layout_height="wrap_content" | 261 | android:layout_height="wrap_content" |
256 | android:layout_marginLeft="80dp" | 262 | android:layout_marginLeft="83dp" |
257 | android:text="" | 263 | android:text="" |
258 | android:textSize="22sp" /> | 264 | android:textSize="22sp" /> |
259 | </LinearLayout> | 265 | </LinearLayout> |
260 | 266 | ||
261 | </LinearLayout> | 267 | </LinearLayout> |
262 | 268 | ||
263 | <LinearLayout | 269 | <LinearLayout |
264 | android:layout_width="match_parent" | 270 | android:layout_width="match_parent" |
265 | android:layout_height="wrap_content" | 271 | android:layout_height="wrap_content" |
266 | android:gravity="center_vertical" | 272 | android:gravity="center_vertical" |
267 | android:layout_marginBottom="30dp" | 273 | android:layout_marginBottom="30dp" |
268 | android:orientation="horizontal"> | 274 | android:orientation="horizontal"> |
269 | 275 | ||
270 | <LinearLayout | 276 | <LinearLayout |
271 | android:layout_width="0dp" | 277 | android:layout_width="0dp" |
272 | android:layout_weight="1" | 278 | android:layout_weight="1" |
273 | android:layout_height="60dp" | 279 | android:layout_height="60dp" |
274 | android:layout_marginLeft="200dp" | 280 | android:layout_marginLeft="200dp" |
275 | android:gravity="center_vertical"> | 281 | android:gravity="center_vertical"> |
276 | 282 | ||
277 | <TextView | 283 | <TextView |
278 | android:layout_width="wrap_content" | 284 | android:layout_width="wrap_content" |
279 | android:layout_height="wrap_content" | 285 | android:layout_height="wrap_content" |
280 | android:text="手机号码" | 286 | android:text="手机号码" |
281 | android:textSize="22sp" /> | 287 | android:textSize="22sp" /> |
282 | 288 | ||
283 | <TextView | 289 | <TextView |
284 | android:id="@+id/tv_card_phone" | 290 | android:id="@+id/tv_card_phone" |
285 | android:layout_width="wrap_content" | 291 | android:layout_width="wrap_content" |
286 | android:layout_height="wrap_content" | 292 | android:layout_height="wrap_content" |
287 | android:layout_marginLeft="50dp" | 293 | android:layout_marginLeft="50dp" |
288 | android:text="" | 294 | android:text="" |
289 | android:textSize="22sp" /> | 295 | android:textSize="22sp" /> |
290 | 296 | ||
291 | 297 | ||
292 | </LinearLayout> | 298 | </LinearLayout> |
293 | 299 | ||
294 | <LinearLayout | 300 | <LinearLayout |
295 | android:layout_width="0dp" | 301 | android:layout_width="0dp" |
296 | android:layout_weight="1" | 302 | android:layout_weight="1" |
297 | android:layout_height="60dp" | 303 | android:layout_height="60dp" |
298 | android:layout_marginLeft="80dp" | 304 | android:layout_marginLeft="80dp" |
299 | android:gravity="center_vertical"> | 305 | android:gravity="center_vertical"> |
300 | 306 | ||
301 | <TextView | 307 | <TextView |
302 | android:layout_width="wrap_content" | 308 | android:layout_width="wrap_content" |
303 | android:layout_height="wrap_content" | 309 | android:layout_height="wrap_content" |
304 | android:text="本地售后电话" | 310 | android:text="本地售后电话" |
305 | android:textSize="22sp" /> | 311 | android:textSize="22sp" /> |
306 | 312 | ||
307 | <TextView | 313 | <TextView |
308 | android:id="@+id/tv_card_tleNember" | 314 | android:id="@+id/tv_card_tleNember" |
309 | android:layout_width="wrap_content" | 315 | android:layout_width="wrap_content" |
310 | android:layout_height="wrap_content" | 316 | android:layout_height="wrap_content" |
311 | android:layout_marginLeft="40dp" | 317 | android:layout_marginLeft="40dp" |
312 | android:background="@null" | 318 | android:background="@null" |
313 | android:text="" | 319 | android:text="" |
314 | android:textSize="22sp" /> | 320 | android:textSize="22sp" /> |
315 | 321 | ||
316 | </LinearLayout> | 322 | </LinearLayout> |
317 | 323 | ||
318 | </LinearLayout> | 324 | </LinearLayout> |
319 | </LinearLayout> | 325 | </LinearLayout> |
320 | 326 | ||
321 | <LinearLayout | 327 | <LinearLayout |
322 | android:layout_width="match_parent" | 328 | android:layout_width="match_parent" |
323 | android:layout_height="wrap_content" | 329 | android:layout_height="wrap_content" |
324 | android:layout_marginTop="5dp" | 330 | android:layout_marginTop="5dp" |
325 | android:gravity="center" | 331 | android:gravity="center" |
326 | android:orientation="vertical"> | 332 | android:orientation="vertical"> |
327 | 333 | ||
328 | <TextView | 334 | <TextView |
329 | android:layout_width="wrap_content" | 335 | android:layout_width="wrap_content" |
330 | android:layout_height="wrap_content" | 336 | android:layout_height="wrap_content" |
331 | android:layout_marginTop="5dp" | 337 | android:layout_marginTop="5dp" |
332 | android:text="@string/electronic_card3" | 338 | android:text="@string/electronic_card3" |
333 | android:textColor="@color/electronic_text" | 339 | android:textColor="@color/electronic_text" |
334 | android:textSize="18sp" /> | 340 | android:textSize="18sp" /> |
335 | 341 | ||
336 | <TextView | 342 | <TextView |
337 | android:layout_width="wrap_content" | 343 | android:layout_width="wrap_content" |
338 | android:layout_height="wrap_content" | 344 | android:layout_height="wrap_content" |
339 | android:layout_marginTop="5dp" | 345 | android:layout_marginTop="5dp" |
340 | android:text="@string/electronic_card4" | 346 | android:text="@string/electronic_card4" |
341 | android:textColor="@color/electronic_text" | 347 | android:textColor="@color/electronic_text" |
342 | android:textSize="18sp" /> | 348 | android:textSize="18sp" /> |
343 | 349 | ||
344 | 350 | ||
345 | </LinearLayout> | 351 | </LinearLayout> |
346 | 352 | ||
347 | <LinearLayout | 353 | <LinearLayout |
348 | android:layout_width="match_parent" | 354 | android:layout_width="match_parent" |
349 | android:layout_height="wrap_content" | 355 | android:layout_height="wrap_content" |
350 | android:layout_marginTop="30dp" | 356 | android:layout_marginTop="30dp" |
351 | android:gravity="center"> | 357 | android:gravity="center"> |
352 | 358 | ||
353 | <Button | 359 | <Button |
354 | android:id="@+id/btn_bangding" | 360 | android:id="@+id/btn_bangding" |
355 | android:layout_width="300dp" | 361 | android:layout_width="300dp" |
356 | android:layout_height="wrap_content" | 362 | android:layout_height="wrap_content" |
357 | android:background="@drawable/selector_blue_btn_bg" | 363 | android:background="@drawable/selector_blue_btn_bg" |
358 | android:text="@string/bangding" | 364 | android:text="@string/bangding" |
359 | android:textColor="@color/white" | 365 | android:textColor="@color/white" |
360 | android:textSize="23sp" | 366 | android:textSize="23sp" |
361 | android:visibility="gone"/> | 367 | android:visibility="gone"/> |
362 | 368 | ||
363 | <Button | 369 | <Button |
364 | android:id="@+id/btn_finish" | 370 | android:id="@+id/btn_finish" |
365 | android:layout_width="300dp" | 371 | android:layout_width="300dp" |
366 | android:layout_height="wrap_content" | 372 | android:layout_height="wrap_content" |
367 | android:background="@drawable/selector_blue_btn_bg" | 373 | android:background="@drawable/selector_blue_btn_bg" |
368 | android:text="@string/finish" | 374 | android:text="@string/finish" |
369 | android:textColor="@color/white" | 375 | android:textColor="@color/white" |
370 | android:textSize="23sp" /> | 376 | android:textSize="23sp" /> |
371 | 377 | ||
372 | 378 | ||
373 | </LinearLayout> | 379 | </LinearLayout> |
374 | 380 | ||
375 | 381 |
PersonalCenter/app/src/main/res/layout/activity_registerinfo.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent"> | 4 | android:layout_height="match_parent" |
5 | android:background="@mipmap/main_bg"> | ||
6 | |||
5 | <RelativeLayout | 7 | <RelativeLayout |
6 | android:id="@+id/title" | 8 | android:id="@+id/title" |
7 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
8 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
9 | android:background="@color/login_text_blue" | 11 | android:background="@color/login_text_blue" |
10 | android:minHeight="50dp" > | 12 | android:minHeight="50dp"> |
11 | 13 | ||
12 | <ImageView | 14 | <ImageView |
13 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
14 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
15 | android:layout_height="wrap_content" | 17 | android:layout_height="wrap_content" |
16 | android:layout_centerVertical="true" | 18 | android:layout_centerVertical="true" |
17 | android:paddingLeft="20dp" | 19 | android:paddingLeft="20dp" |
18 | android:paddingRight="20dp" | 20 | android:paddingRight="20dp" |
19 | android:visibility="gone" | 21 | android:src="@mipmap/title_back" |
20 | android:src="@mipmap/title_back" /> | 22 | android:visibility="gone" /> |
21 | 23 | ||
22 | <TextView | 24 | <TextView |
23 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
24 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
25 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
26 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
27 | android:text="@string/string_regist_info" | 29 | android:text="@string/string_regist_info" |
28 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
29 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
30 | </RelativeLayout> | 32 | </RelativeLayout> |
33 | |||
31 | <LinearLayout | 34 | <LinearLayout |
32 | android:layout_width="match_parent" | 35 | android:layout_width="550dp" |
33 | android:layout_height="match_parent" | 36 | android:layout_height="wrap_content" |
34 | android:layout_below="@id/title" | 37 | android:layout_centerInParent="true" |
35 | android:background="#ffffffff" | 38 | android:background="@drawable/white_cycle_bg" |
36 | android:orientation="vertical" | 39 | android:orientation="vertical" |
37 | android:paddingLeft="250dp" | 40 | android:paddingLeft="30dp" |
38 | android:paddingRight="250dp"> | 41 | android:paddingRight="30dp" |
39 | <EditText | 42 | android:paddingTop="30dp"> |
40 | android:id="@+id/et_username" | 43 | |
41 | style="@style/login_register_edit_style" | 44 | <LinearLayout |
42 | android:layout_marginTop="100dp" | 45 | android:id="@+id/et_username_layout" |
43 | android:textColor="@color/login_text_black" | 46 | android:layout_width="match_parent" |
44 | android:hint="@string/string_regist_username" /> | 47 | android:layout_height="wrap_content" |
45 | <TextView | 48 | android:background="@drawable/input_bg" |
46 | android:id="@+id/et_region" | 49 | android:gravity="center_horizontal" |
47 | style="@style/login_register_edit_style" | 50 | android:orientation="horizontal" |
48 | android:layout_marginTop="30dp" | 51 | android:layout_marginBottom="20dp" |
49 | android:textColor="@color/login_text_black" | 52 | android:paddingRight="10dp"> |
50 | android:hint="@string/string_regist_region" /> | 53 | |
54 | <EditText | ||
55 | android:id="@+id/et_username" | ||
56 | style="@style/login_register_edit_style" | ||
57 | android:hint="@string/string_regist_username" | ||
58 | android:textColor="@color/login_text_black" /> | ||
59 | <ImageButton | ||
60 | android:id="@+id/username_delete_btn" | ||
61 | android:layout_width="50dp" | ||
62 | android:layout_height="match_parent" | ||
63 | android:src="@mipmap/delete_btn" | ||
64 | android:visibility="invisible" | ||
65 | android:background="@null"/> | ||
66 | </LinearLayout> | ||
67 | <LinearLayout | ||
68 | android:id="@+id/et_nickname_layout" | ||
69 | android:layout_width="match_parent" | ||
70 | android:layout_height="wrap_content" | ||
71 | android:background="@drawable/input_bg" | ||
72 | android:gravity="center_horizontal" | ||
73 | android:orientation="horizontal" | ||
74 | android:paddingRight="10dp"> | ||
75 | |||
76 | <EditText | ||
77 | android:id="@+id/et_nickname" | ||
78 | style="@style/login_register_edit_style" | ||
79 | android:hint="@string/string_regist_nickname" | ||
80 | android:textColor="@color/login_text_black" /> | ||
81 | <ImageButton | ||
82 | android:id="@+id/nickname_delete_btn" | ||
83 | android:layout_width="50dp" | ||
84 | android:layout_height="match_parent" | ||
85 | android:src="@mipmap/delete_btn" | ||
86 | android:visibility="invisible" | ||
87 | android:background="@null"/> | ||
88 | </LinearLayout> | ||
89 | |||
90 | |||
91 | <LinearLayout | ||
92 | android:id="@+id/et_grade_layout" | ||
93 | android:layout_width="match_parent" | ||
94 | android:layout_height="wrap_content" | ||
95 | android:layout_marginTop="20dp" | ||
96 | android:background="@drawable/input_bg" | ||
97 | android:gravity="center_horizontal" | ||
98 | android:orientation="horizontal" | ||
99 | android:paddingRight="10dp"> | ||
100 | |||
101 | <TextView | ||
102 | android:id="@+id/et_grade" | ||
103 | style="@style/login_register_edit_style" | ||
104 | android:hint="@string/string_regist_grade" | ||
105 | android:textColor="@color/login_text_black" /> | ||
106 | |||
107 | </LinearLayout> | ||
108 | |||
109 | <LinearLayout | ||
110 | android:id="@+id/et_region_layout" | ||
111 | android:layout_width="match_parent" | ||
112 | android:layout_height="wrap_content" | ||
113 | android:layout_marginTop="20dp" | ||
114 | android:background="@drawable/input_bg" | ||
115 | android:gravity="center_horizontal" | ||
116 | android:orientation="horizontal" | ||
117 | android:paddingRight="10dp"> | ||
118 | |||
119 | <TextView | ||
120 | android:id="@+id/et_region" | ||
121 | style="@style/login_register_edit_style" | ||
122 | android:hint="@string/string_regist_region" | ||
123 | android:textColor="@color/login_text_black" /> | ||
124 | |||
125 | </LinearLayout> | ||
126 | |||
127 | <LinearLayout | ||
128 | android:id="@+id/et_address_layout" | ||
129 | android:layout_width="match_parent" | ||
130 | android:layout_height="wrap_content" | ||
131 | android:layout_marginTop="20dp" | ||
132 | android:background="@drawable/input_bg" | ||
133 | android:gravity="center_horizontal" | ||
134 | android:orientation="horizontal" | ||
135 | android:paddingRight="10dp"> | ||
136 | |||
137 | <EditText | ||
138 | android:id="@+id/et_address" | ||
139 | style="@style/login_register_edit_style" | ||
140 | android:hint="@string/string_regist_address" | ||
141 | android:textColor="@color/login_text_black" /> | ||
142 | <ImageButton | ||
143 | android:id="@+id/address_delete_btn" | ||
144 | android:layout_width="50dp" | ||
145 | android:layout_height="match_parent" | ||
146 | android:src="@mipmap/delete_btn" | ||
147 | android:visibility="invisible" | ||
148 | android:background="@null"/> | ||
149 | </LinearLayout> | ||
150 | |||
151 | <LinearLayout | ||
152 | android:id="@+id/et_school_layout" | ||
153 | android:layout_width="match_parent" | ||
154 | android:layout_height="wrap_content" | ||
155 | android:layout_marginTop="20dp" | ||
156 | android:background="@drawable/input_bg" | ||
157 | android:gravity="center_horizontal" | ||
158 | android:orientation="horizontal" | ||
159 | android:paddingRight="10dp"> | ||
160 | |||
161 | <TextView | ||
162 | android:id="@+id/et_school" | ||
163 | style="@style/login_register_edit_style" | ||
164 | android:hint="@string/string_regist_school" | ||
165 | android:textColor="@color/login_text_black" /> | ||
166 | |||
167 | </LinearLayout> | ||
51 | 168 | ||
52 | <TextView | ||
53 | android:id="@+id/et_grade" | ||
54 | style="@style/login_register_edit_style" | ||
55 | android:layout_marginTop="30dp" | ||
56 | android:textColor="@color/login_text_black" | ||
57 | android:hint="@string/string_regist_grade" /> | ||
58 | 169 | ||
59 | <TextView | ||
60 | android:id="@+id/et_school" | ||
61 | style="@style/login_register_edit_style" | ||
62 | android:layout_marginTop="30dp" | ||
63 | android:textColor="@color/login_text_black" | ||
64 | android:hint="@string/string_regist_school" /> |
PersonalCenter/app/src/main/res/layout/activity_start_page.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:orientation="vertical" | 3 | android:orientation="vertical" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
6 | android:background="@mipmap/startpage"> | 6 | android:background="@mipmap/startpage"> |
7 | <RelativeLayout | 7 | <ImageButton |
8 | android:layout_width="wrap_content" | ||
9 | android:layout_height="wrap_content" | ||
10 | android:layout_alignParentBottom="true" | ||
11 | android:paddingLeft="250dp" | ||
12 | android:paddingRight="250dp"> | ||
13 | <Button | ||
14 | android:id="@+id/btn_start" | 8 | android:id="@+id/btn_start" |
15 | style="@style/button_login_register_style" | 9 | android:layout_width="wrap_content" |
16 | android:layout_marginBottom="50dp" | 10 | android:layout_height="wrap_content" |
17 | android:text="@string/string_start_page" /> | 11 | android:layout_centerHorizontal="true" |
18 | </RelativeLayout> | 12 | android:layout_alignParentBottom="true" |
19 | 13 | android:background="@mipmap/start_btn_bg" | |
14 | android:layout_marginBottom="50dp" /> | ||
20 | 15 |
PersonalCenter/app/src/main/res/layout/dialog_layout.xml
File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | android:layout_width="match_parent" | ||
4 | android:layout_height="match_parent" | ||
5 | android:background="@null" | ||
6 | android:gravity="center" | ||
7 | android:orientation="vertical" > | ||
8 | |||
9 | <LinearLayout | ||
10 | android:layout_width="300dp" | ||
11 | android:layout_height="wrap_content" | ||
12 | android:background="@drawable/white_cycle_bg" | ||
13 | android:orientation="vertical" > | ||
14 | <TextView | ||
15 | android:id="@+id/dialog_title" | ||
16 | android:layout_width="match_parent" | ||
17 | android:layout_height="wrap_content" | ||
18 | android:gravity="center" | ||
19 | android:paddingTop="19dip" | ||
20 | android:text="快捷切换中小学桌面" | ||
21 | android:textColor="@color/login_text_black" | ||
22 | android:textSize="20sp" /> | ||
23 | |||
24 | <View | ||
25 | android:layout_width="match_parent" | ||
26 | android:layout_height="0.5dp" | ||
27 | android:layout_marginLeft="20dp" | ||
28 | android:layout_marginRight="20dp" | ||
29 | android:layout_marginTop="20dp" | ||
30 | android:background="@color/line_bg"/> | ||
31 | |||
32 | <LinearLayout | ||
33 | android:layout_width="match_parent" | ||
34 | android:layout_height="wrap_content" | ||
35 | android:orientation="horizontal" > | ||
36 | |||
37 | <Button | ||
38 | android:id="@+id/middle_btn" | ||
39 | style="?android:attr/borderlessButtonStyle" | ||
40 | android:layout_width="match_parent" | ||
41 | android:layout_height="wrap_content" | ||
42 | android:layout_weight="1" | ||
43 | android:background="@drawable/white_cycle_bg" | ||
44 | android:gravity="center" | ||
45 | android:paddingBottom="10dp" | ||
46 | android:paddingTop="10dp" | ||
47 | android:text="中学桌面" | ||
48 | android:textColor="@color/login_text_black" | ||
49 | android:textSize="18sp" /> | ||
50 | |||
51 | <View | ||
52 | android:layout_width="0.5dp" | ||
53 | android:layout_height="match_parent" | ||
54 | android:layout_marginTop="5dp" | ||
55 | android:layout_marginBottom="5dp" | ||
56 | android:background="@color/line_bg" | ||
57 | android:orientation="horizontal" /> | ||
58 | |||
59 | <Button | ||
60 | android:id="@+id/primary_btn" | ||
61 | style="?android:attr/borderlessButtonStyle" | ||
62 | android:layout_width="match_parent" | ||
63 | android:layout_height="wrap_content" | ||
64 | android:layout_weight="1" | ||
65 | android:background="@drawable/white_cycle_bg" | ||
66 | android:gravity="center" | ||
67 | android:paddingBottom="10dp" | ||
68 | android:paddingTop="10dp" | ||
69 | android:text="小学桌面" | ||
70 | android:textColor="@color/login_text_black" | ||
71 | android:textSize="18sp" /> | ||
72 | </LinearLayout> | ||
73 | </LinearLayout> | ||
74 | |||
75 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_presonal_info.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
6 | android:background="@mipmap/main_bg" | ||
6 | android:orientation="vertical"> | 7 | android:orientation="vertical"> |
8 | |||
7 | <RelativeLayout | 9 | <RelativeLayout |
8 | android:id="@+id/title" | 10 | android:id="@+id/title" |
9 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
10 | android:layout_height="50dp" | 12 | android:layout_height="50dp" |
11 | android:background="@color/login_text_blue"> | 13 | android:background="@color/login_text_blue"> |
12 | 14 | ||
13 | <ImageView | 15 | <ImageView |
14 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
15 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
16 | android:layout_height="match_parent" | 18 | android:layout_height="match_parent" |
17 | android:paddingLeft="20dp" | 19 | android:paddingLeft="20dp" |
18 | android:paddingRight="20dp" | 20 | android:paddingRight="20dp" |
19 | android:src="@mipmap/title_back" /> | 21 | android:src="@mipmap/title_back" /> |
20 | 22 | ||
21 | <TextView | 23 | <TextView |
22 | android:id="@+id/menu_title" | 24 | android:id="@+id/menu_title" |
23 | android:layout_width="wrap_content" | 25 | android:layout_width="wrap_content" |
24 | android:layout_height="match_parent" | 26 | android:layout_height="match_parent" |
25 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
26 | android:gravity="center_vertical" | 28 | android:gravity="center_vertical" |
27 | android:text="@string/changge_preson" | 29 | android:text="@string/changge_preson" |
28 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
29 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
32 | |||
30 | <TextView | 33 | <TextView |
31 | android:id="@+id/presonal_sub" | 34 | android:id="@+id/presonal_sub" |
32 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
33 | android:layout_height="match_parent" | 36 | android:layout_height="match_parent" |
37 | android:layout_alignParentRight="true" | ||
38 | android:gravity="center_vertical" | ||
34 | android:paddingLeft="20dp" | 39 | android:paddingLeft="20dp" |
35 | android:paddingRight="20dp" | 40 | android:paddingRight="20dp" |
36 | android:gravity="center_vertical" | ||
37 | android:layout_alignParentRight="true" | ||
38 | android:text="保存" | 41 | android:text="保存" |
39 | android:textColor="@android:color/white" | 42 | android:textColor="@android:color/white" |
40 | android:textSize="22sp" /> | 43 | android:textSize="22sp" /> |
41 | 44 | ||
42 | 45 | ||
43 | </RelativeLayout> | 46 | </RelativeLayout> |
44 | 47 | ||
45 | |||
46 | <LinearLayout | 48 | <LinearLayout |
47 | android:layout_width="match_parent" | 49 | android:layout_width="match_parent" |
48 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
49 | android:layout_marginTop="50dp" | 51 | android:layout_marginLeft="100dp" |
50 | android:orientation="horizontal"> | 52 | android:layout_marginRight="100dp" |
51 | <LinearLayout | 53 | android:layout_marginTop="60dp" |
52 | android:layout_width="0dp" | 54 | android:padding="50dp" |
53 | android:layout_weight="1" | 55 | android:background="@drawable/white_cycle_bg" |
54 | android:gravity="right" | 56 | android:orientation="vertical"> |
55 | android:layout_marginRight="50dp" | ||
56 | android:orientation="vertical" | ||
57 | android:layout_height="match_parent"> | ||
58 | <TextView | ||
59 | android:id="@+id/tv_presonal" | ||
60 | android:layout_width="wrap_content" | ||
61 | android:layout_height="wrap_content" | ||
62 | android:textSize="22sp" | ||
63 | android:textColor="@color/login_edittext_pressed" | ||
64 | android:text="个人信息"/> | ||
65 | <View | ||
66 | android:layout_width="90dp" | ||
67 | android:layout_height="3dp" | ||
68 | android:layout_marginTop="5dp" | ||
69 | android:background="@color/login_edittext_pressed" | ||
70 | /> | ||
71 | |||
72 | 57 | ||
73 | </LinearLayout> | ||
74 | <LinearLayout | 58 | <LinearLayout |
75 | android:id="@+id/tv_version" | 59 | android:layout_width="match_parent" |
76 | android:layout_width="0dp" | 60 | android:layout_height="wrap_content" |
77 | android:layout_weight="1" | 61 | android:orientation="horizontal"> |
78 | android:gravity="left" | 62 | |
79 | android:layout_marginLeft="50dp" | 63 | <LinearLayout |
80 | android:layout_height="match_parent"> | 64 | android:layout_width="0dp" |
81 | <TextView | 65 | android:layout_height="match_parent" |
82 | android:textSize="22sp" | 66 | android:layout_marginRight="50dp" |
83 | android:layout_width="wrap_content" | 67 | android:layout_weight="1" |
84 | android:layout_height="wrap_content" | 68 | android:gravity="right" |
85 | android:text="版本信息"/> | 69 | android:orientation="vertical"> |
70 | |||
71 | <TextView | ||
72 | android:id="@+id/tv_presonal" | ||
73 | android:layout_width="wrap_content" | ||
74 | android:layout_height="wrap_content" | ||
75 | android:text="个人信息" | ||
76 | android:textColor="@color/login_edittext_pressed" | ||
77 | android:textSize="22sp" /> | ||
78 | |||
79 | <View | ||
80 | android:layout_width="90dp" | ||
81 | android:layout_height="3dp" | ||
82 | android:layout_marginTop="5dp" | ||
83 | android:background="@color/login_edittext_pressed" /> | ||
84 | |||
85 | |||
86 | </LinearLayout> | ||
87 | |||
88 | <LinearLayout | ||
89 | android:id="@+id/tv_version" | ||
90 | android:layout_width="0dp" | ||
91 | android:layout_height="match_parent" | ||
92 | android:layout_marginLeft="50dp" | ||
93 | android:layout_weight="1" | ||
94 | android:gravity="left"> | ||
86 | 95 | ||
87 | </LinearLayout> | 96 | <TextView |
97 | android:layout_width="wrap_content" | ||
98 | android:layout_height="wrap_content" | ||
99 | android:text="版本信息" | ||
100 | android:textSize="22sp" /> | ||
88 | 101 | ||
89 | </LinearLayout> | 102 | </LinearLayout> |
90 | 103 | ||
104 | </LinearLayout> | ||
91 | 105 | ||
92 | <LinearLayout | ||
93 | android:layout_width="wrap_content" | ||
94 | android:layout_height="wrap_content" | ||
95 | android:layout_marginTop="80dp" | ||
96 | android:orientation="horizontal"> | ||
97 | 106 | ||
98 | <View | 107 | <LinearLayout |
99 | android:layout_width="450dp" | 108 | android:layout_width="wrap_content" |
100 | android:layout_height="0.7dp" | 109 | android:layout_height="wrap_content" |
101 | android:layout_marginLeft="150dp" | 110 | android:layout_marginTop="50dp" |
102 | android:background="@color/cutoff_line"> | 111 | android:orientation="horizontal"> |
103 | 112 | ||
104 | </View> | 113 | <View |
114 | android:layout_width="0dp" | ||
115 | android:layout_height="0.7dp" | ||
116 | android:layout_weight="1" | ||
117 | android:background="@color/cutoff_line"> | ||
105 | 118 | ||
106 | <View | 119 | </View> |
107 | android:layout_width="450dp" | ||
108 | android:layout_height="0.7dp" | ||
109 | android:layout_marginLeft="80dp" | ||
110 | android:background="@color/cutoff_line"> | ||
111 | 120 | ||
112 | </View> | 121 | <View |
122 | android:layout_width="0dp" | ||
123 | android:layout_height="0.7dp" | ||
124 | android:layout_marginLeft="50dp" | ||
125 | android:layout_weight="1" | ||
126 | android:background="@color/cutoff_line"> | ||
113 | 127 | ||
128 | </View> | ||
114 | 129 | ||
115 | </LinearLayout> | ||
116 | 130 | ||
117 | <LinearLayout | 131 | </LinearLayout> |
118 | android:layout_width="match_parent" | ||
119 | android:layout_height="wrap_content" | ||
120 | android:layout_marginLeft="200dp" | ||
121 | android:gravity="center_vertical" | ||
122 | android:orientation="horizontal"> | ||
123 | 132 | ||
124 | <LinearLayout | 133 | <LinearLayout |
125 | android:layout_width="0dp" | 134 | android:layout_width="match_parent" |
126 | android:layout_height="80dp" | 135 | android:layout_height="wrap_content" |
127 | android:layout_weight="1" | 136 | android:layout_marginLeft="30dp" |
128 | android:gravity="center_vertical" | 137 | android:gravity="center_vertical" |
129 | android:focusable="true" | 138 | android:orientation="horizontal"> |
130 | android:focusableInTouchMode="true"> | 139 | |
131 | 140 | <LinearLayout | |
132 | <TextView | 141 | android:layout_width="0dp" |
133 | android:layout_width="wrap_content" | 142 | android:layout_height="80dp" |
134 | android:layout_height="wrap_content" | 143 | android:layout_weight="1" |
135 | android:text="昵称" | 144 | android:focusable="true" |
136 | android:textColor="@color/electronic_text" | 145 | android:focusableInTouchMode="true" |
137 | android:textSize="22sp" /> | 146 | android:gravity="center_vertical"> |
138 | 147 | ||
139 | <EditText | 148 | <TextView |
140 | android:id="@+id/tv_username1" | 149 | android:layout_width="wrap_content" |
141 | android:layout_width="wrap_content" | 150 | android:layout_height="wrap_content" |
142 | android:layout_height="wrap_content" | 151 | android:text="昵称" |
143 | android:layout_marginLeft="50dp" | 152 | android:textColor="@color/electronic_text" |
144 | android:textColor="@color/login_text_black" | 153 | android:textSize="22sp" /> |
145 | android:background="@null" | 154 | |
146 | android:hint="请输入12个以内的中文或英文字符" | 155 | <EditText |
147 | android:textSize="22sp" /> | 156 | android:id="@+id/tv_username1" |
157 | android:layout_width="wrap_content" | ||
158 | android:layout_height="wrap_content" | ||
159 | android:layout_marginLeft="50dp" | ||
160 | android:background="@null" | ||
161 | android:hint="请输入12个以内的中文或英文字符" | ||
162 | android:textColor="@color/login_text_black" | ||
163 | android:textSize="22sp" /> | ||
164 | |||
165 | </LinearLayout> | ||
166 | |||
167 | <LinearLayout | ||
168 | android:layout_width="0dp" | ||
169 | android:layout_height="80dp" | ||
170 | android:layout_weight="1" | ||
171 | android:layout_marginLeft="40dp" | ||
172 | android:gravity="center_vertical"> | ||
173 | |||
174 | <TextView | ||
175 | android:layout_width="wrap_content" | ||
176 | android:layout_height="wrap_content" | ||
177 | android:text="地区" | ||
178 | android:textColor="@color/electronic_text" | ||
179 | android:textSize="22sp" /> | ||
180 | |||
181 | <TextView | ||
182 | android:id="@+id/tv_useinfo_adress" | ||
183 | android:layout_width="0dp" | ||
184 | android:layout_height="wrap_content" | ||
185 | android:layout_marginLeft="50dp" | ||
186 | android:layout_weight="1" | ||
187 | android:hint="请选择" | ||
188 | android:textColor="@color/login_text_black" | ||
189 | android:textSize="22sp" /> | ||
190 | |||
191 | <ImageView | ||
192 | android:id="@+id/my_adress" | ||
193 | android:layout_width="wrap_content" | ||
194 | android:layout_height="wrap_content" | ||
195 | android:layout_marginRight="20dp" | ||
196 | android:padding="20dp" | ||
197 | android:src="@mipmap/xiajiantou"> | ||
198 | |||
199 | </ImageView> | ||
200 | </LinearLayout> | ||
148 | 201 | ||
149 | </LinearLayout> | 202 | </LinearLayout> |
150 | 203 | ||
151 | <LinearLayout | 204 | <LinearLayout |
152 | android:layout_width="0dp" | 205 | android:layout_width="wrap_content" |
153 | android:layout_height="80dp" | 206 | android:layout_height="wrap_content" |
154 | android:layout_weight="1" | 207 | android:orientation="horizontal"> |
155 | android:gravity="center_vertical"> | ||
156 | |||
157 | <TextView | ||
158 | android:layout_width="wrap_content" | ||
159 | android:layout_height="wrap_content" | ||
160 | android:text="地区" | ||
161 | android:textColor="@color/electronic_text" | ||
162 | android:textSize="22sp" /> | ||
163 | |||
164 | <TextView | ||
165 | android:id="@+id/tv_useinfo_adress" | ||
166 | android:layout_width="wrap_content" | ||
167 | android:layout_height="wrap_content" | ||
168 | android:layout_marginLeft="50dp" | ||
169 | android:textColor="@color/login_text_black" | ||
170 | android:hint="请选择" | ||
171 | android:textSize="22sp" /> | ||
172 | |||
173 | <ImageView | ||
174 | android:id="@+id/my_adress" | ||
175 | android:padding="20dp" | ||
176 | android:layout_width="wrap_content" | ||
177 | android:layout_height="wrap_content" | ||
178 | android:layout_marginLeft="150dp" | ||
179 | android:src="@mipmap/xiajiantou"> | ||
180 | |||
181 | </ImageView> | ||
182 | </LinearLayout> | ||
183 | |||
184 | </LinearLayout> | ||
185 | |||
186 | <LinearLayout | ||
187 | android:layout_width="wrap_content" | ||
188 | android:layout_height="wrap_content" | ||
189 | android:orientation="horizontal"> | ||
190 | |||
191 | <View | ||
192 | android:layout_width="450dp" | ||
193 | android:layout_height="0.7dp" | ||
194 | android:layout_marginLeft="150dp" | ||
195 | android:background="@color/cutoff_line"> | ||
196 | |||
197 | </View> | ||
198 | |||
199 | <View | ||
200 | android:layout_width="450dp" | ||
201 | android:layout_height="0.7dp" | ||
202 | android:layout_marginLeft="80dp" | ||
203 | android:background="@color/cutoff_line"> | ||
204 | |||
205 | </View> | ||
206 | |||
207 | 208 | ||
208 | </LinearLayout> | 209 | <View |
210 | android:layout_width="0dp" | ||
211 | android:layout_height="0.7dp" | ||
212 | android:layout_weight="1" | ||
213 | android:background="@color/cutoff_line"> | ||
209 | 214 | ||
210 | <LinearLayout | 215 | </View> |
211 | android:layout_width="match_parent" | ||
212 | android:layout_height="wrap_content" | ||
213 | android:layout_marginLeft="200dp" | ||
214 | android:gravity="center_vertical" | ||
215 | android:orientation="horizontal"> | ||
216 | 216 | ||
217 | <LinearLayout | 217 | <View |
218 | android:layout_width="0dp" | 218 | android:layout_width="0dp" |
219 | android:layout_height="80dp" | 219 | android:layout_height="0.7dp" |
220 | android:layout_weight="1" | ||
221 | android:gravity="center_vertical"> | ||
222 | |||
223 | <TextView | ||
224 | android:layout_width="wrap_content" | ||
225 | android:layout_height="wrap_content" | ||
226 | android:text="性别" | ||
227 | android:textColor="@color/electronic_text" | ||
228 | android:textSize="22sp" /> | ||
229 | |||
230 | <TextView | ||
231 | android:id="@+id/tv_sex" | ||
232 | android:layout_width="wrap_content" | ||
233 | android:layout_height="wrap_content" | ||
234 | android:layout_marginLeft="50dp" | 220 | android:layout_marginLeft="50dp" |
235 | android:textColor="@color/login_text_black" | 221 | android:layout_weight="1" |
236 | android:hint="请选择" | 222 | android:background="@color/cutoff_line"> |
237 | android:textSize="22sp" /> | ||
238 | 223 | ||
239 | <ImageView | 224 | </View> |
240 | android:id="@+id/my_sex" | ||
241 | android:padding="20dp" | ||
242 | android:layout_width="wrap_content" | ||
243 | android:layout_height="wrap_content" | ||
244 | android:layout_marginLeft="150dp" | ||
245 | android:src="@mipmap/xiajiantou"> | ||
246 | |||
247 | </ImageView> | ||
248 | 225 | ||
249 | 226 | ||
250 | </LinearLayout> | 227 | </LinearLayout> |
251 | 228 | ||
252 | <LinearLayout | 229 | <LinearLayout |
253 | android:layout_width="0dp" | 230 | android:layout_width="match_parent" |
254 | android:layout_height="80dp" | 231 | android:layout_height="wrap_content" |
255 | android:layout_weight="1" | 232 | android:layout_marginLeft="30dp" |
256 | android:gravity="center_vertical"> | 233 | android:gravity="center_vertical" |
257 | 234 | android:orientation="horizontal"> | |
258 | <TextView | 235 | |
259 | android:layout_width="wrap_content" | 236 | <LinearLayout |
260 | android:layout_height="wrap_content" | 237 | android:layout_width="0dp" |
261 | android:text=" " | 238 | android:layout_height="80dp" |
262 | android:textColor="@color/white" | 239 | android:layout_weight="1" |
263 | android:textSize="22sp" /> | 240 | android:gravity="center_vertical"> |
264 | 241 | ||
265 | <EditText | 242 | <TextView |
266 | android:id="@+id/tv_useinfo_adress1" | 243 | android:layout_width="wrap_content" |
267 | android:layout_width="wrap_content" | 244 | android:layout_height="wrap_content" |
268 | android:layout_height="wrap_content" | 245 | android:text="性别" |
269 | android:layout_marginLeft="50dp" | 246 | android:textColor="@color/electronic_text" |
270 | android:textColor="@color/login_text_black" | 247 | android:textSize="22sp" /> |
271 | android:background="@null" | 248 | |
272 | android:hint="请输入详细地址" | 249 | <TextView |
273 | android:textSize="22sp" /> | 250 | android:id="@+id/tv_sex" |
251 | android:layout_width="0dp" | ||
252 | android:layout_height="wrap_content" | ||
253 | android:layout_weight="1" | ||
254 | android:layout_marginLeft="50dp" | ||
255 | android:hint="请选择" | ||
256 | android:textColor="@color/login_text_black" | ||
257 | android:textSize="22sp" /> | ||
258 | |||
259 | <ImageView | ||
260 | android:id="@+id/my_sex" | ||
261 | android:layout_width="wrap_content" | ||
262 | android:layout_height="wrap_content" | ||
263 | android:padding="20dp" | ||
264 | android:layout_marginRight="50dp" | ||
265 | android:src="@mipmap/xiajiantou"> | ||
266 | |||
267 | </ImageView> | ||
268 | |||
269 | |||
270 | </LinearLayout> | ||
271 | |||
272 | <LinearLayout | ||
273 | android:layout_width="0dp" | ||
274 | android:layout_height="80dp" | ||
275 | android:layout_weight="1" | ||
276 | android:gravity="center_vertical"> | ||
277 | |||
278 | <TextView | ||
279 | android:layout_width="wrap_content" | ||
280 | android:layout_height="wrap_content" | ||
281 | android:text=" " | ||
282 | android:textColor="@color/white" | ||
283 | android:textSize="22sp" /> | ||
284 | |||
285 | <EditText | ||
286 | android:id="@+id/tv_useinfo_adress1" | ||
287 | android:layout_width="wrap_content" | ||
288 | android:layout_height="wrap_content" | ||
289 | android:layout_marginLeft="70dp" | ||
290 | android:background="@null" | ||
291 | android:hint="请输入详细地址" | ||
292 | android:textColor="@color/login_text_black" | ||
293 | android:textSize="22sp" /> | ||
294 | |||
295 | </LinearLayout> | ||
274 | 296 | ||
275 | </LinearLayout> | 297 | </LinearLayout> |
276 | 298 | ||
277 | </LinearLayout> | 299 | <LinearLayout |
278 | 300 | android:layout_width="wrap_content" | |
279 | <LinearLayout | 301 | android:layout_height="wrap_content" |
280 | android:layout_width="wrap_content" | ||
281 | android:layout_height="wrap_content" | ||
282 | |||
283 | android:orientation="horizontal"> | ||
284 | 302 | ||
285 | <View | 303 | android:orientation="horizontal"> |
286 | android:layout_width="450dp" | ||
287 | android:layout_height="0.7dp" | ||
288 | android:layout_marginLeft="150dp" | ||
289 | android:background="@color/cutoff_line"> | ||
290 | 304 | ||
291 | </View> | 305 | <View |
306 | android:layout_width="0dp" | ||
307 | android:layout_height="0.7dp" | ||
308 | android:layout_weight="1" | ||
309 | android:background="@color/cutoff_line"> | ||
292 | 310 | ||
293 | <View | 311 | </View> |
294 | android:layout_width="450dp" | ||
295 | android:layout_height="0.7dp" | ||
296 | android:layout_marginLeft="80dp" | ||
297 | android:background="@color/cutoff_line"> | ||
298 | 312 | ||
299 | </View> | 313 | <View |
314 | android:layout_width="0dp" | ||
315 | android:layout_height="0.7dp" | ||
316 | android:layout_marginLeft="50dp" | ||
317 | android:layout_weight="1" | ||
318 | android:background="@color/cutoff_line"> | ||
300 | 319 | ||
320 | </View> | ||
301 | 321 | ||
302 | </LinearLayout> | ||
303 | 322 | ||
304 | <LinearLayout | ||
305 | android:layout_width="match_parent" | ||
306 | android:layout_height="wrap_content" | ||
307 | android:layout_marginLeft="200dp" | ||
308 | android:gravity="center_vertical" | ||
309 | android:orientation="horizontal"> | ||
310 | |||
311 | |||
312 | <LinearLayout | ||
313 | android:layout_width="0dp" | ||
314 | android:layout_height="80dp" | ||
315 | android:layout_weight="1" | ||
316 | android:gravity="center_vertical"> | ||
317 | |||
318 | <TextView | ||
319 | android:layout_width="wrap_content" | ||
320 | android:layout_height="wrap_content" | ||
321 | android:text="生日" | ||
322 | android:textColor="@color/electronic_text" | ||
323 | android:textSize="22sp" /> | ||
324 | |||
325 | <TextView | ||
326 | android:id="@+id/tv_useinfo_birthday" | ||
327 | android:layout_width="wrap_content" | ||
328 | android:layout_height="wrap_content" | ||
329 | android:layout_marginLeft="50dp" | ||
330 | android:hint="请选择" | ||
331 | android:textColor="@color/login_text_black" | ||
332 | android:textSize="22sp" /> | ||
333 | |||
334 | <ImageView | ||
335 | android:id="@+id/my_bthday" | ||
336 | android:padding="20dp" | ||
337 | android:layout_width="wrap_content" | ||
338 | android:layout_height="wrap_content" | ||
339 | android:layout_marginLeft="150dp" | ||
340 | android:textColor="@color/login_text_black" | ||
341 | android:src="@mipmap/xiajiantou"/> | ||
342 | </LinearLayout> | ||
343 | <LinearLayout | ||
344 | android:layout_width="0dp" | ||
345 | android:layout_height="80dp" | ||
346 | android:layout_weight="1" | ||
347 | android:gravity="center_vertical"> | ||
348 | |||
349 | <TextView | ||
350 | android:layout_width="wrap_content" | ||
351 | android:layout_height="wrap_content" | ||
352 | android:text="年级" | ||
353 | android:textColor="@color/electronic_text" | ||
354 | android:textSize="22sp" /> | ||
355 | |||
356 | <TextView | ||
357 | android:id="@+id/tv_useinfo_gender" | ||
358 | android:layout_width="wrap_content" | ||
359 | android:layout_height="wrap_content" | ||
360 | android:layout_marginLeft="50dp" | ||
361 | android:hint="请选择" | ||
362 | android:textColor="@color/login_text_black" | ||
363 | android:textSize="22sp" /> | ||
364 | |||
365 | <ImageView | ||
366 | android:id="@+id/my_grade" | ||
367 | android:padding="20dp" | ||
368 | android:layout_width="wrap_content" | ||
369 | android:layout_height="wrap_content" | ||
370 | android:layout_marginLeft="150dp" | ||
371 | android:src="@mipmap/xiajiantou"/> | ||
372 | </LinearLayout> | 323 | </LinearLayout> |
373 | 324 | ||
374 | </LinearLayout> | 325 | <LinearLayout |
326 | android:layout_width="match_parent" | ||
327 | android:layout_height="wrap_content" | ||
328 | android:layout_marginLeft="30dp" | ||
329 | android:gravity="center_vertical" | ||
330 | android:orientation="horizontal"> | ||
331 | |||
332 |
PersonalCenter/app/src/main/res/layout/fragment_loginandregister_login.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:background="#ffffffff" | 5 | android:background="#00ffffff" |
6 | android:orientation="vertical" | 6 | android:orientation="vertical" |
7 | android:paddingLeft="300dp" | 7 | android:paddingLeft="30dp" |
8 | android:paddingRight="300dp" > | 8 | android:paddingRight="30dp"> |
9 | 9 | ||
10 | 10 | ||
11 | <EditText | 11 | <LinearLayout |
12 | android:id="@+id/et_phonenumber" | 12 | android:id="@+id/et_phonenumber_layout" |
13 | style="@style/login_register_edit_style" | 13 | android:layout_width="match_parent" |
14 | android:layout_height="wrap_content" | ||
14 | android:layout_marginTop="20dp" | 15 | android:layout_marginTop="20dp" |
15 | android:textColor="@color/login_text_black" | 16 | android:background="@drawable/input_bg" |
16 | android:inputType="phone" | 17 | android:gravity="center_horizontal" |
17 | android:hint="手机号" /> | 18 | android:orientation="horizontal" |
18 | 19 | android:paddingRight="10dp"> | |
19 | <EditText | 20 | |
20 | android:id="@+id/et_password" | 21 | <EditText |
21 | style="@style/login_register_edit_style" | 22 | android:id="@+id/et_phonenumber" |
22 | android:layout_below="@id/et_phonenumber" | 23 | style="@style/login_register_edit_style" |
23 | android:layout_marginTop="30dp" | 24 | android:hint="手机号" |
24 | android:textColor="@color/login_text_black" | 25 | android:maxLength="11" |
25 | android:hint="密码" | 26 | android:imeOptions="actionNext" |
26 | android:inputType="textPassword" /> | 27 | android:inputType="phone" /> |
28 | |||
29 | <ImageButton | ||
30 | android:id="@+id/phone_delete_btn" | ||
31 | android:layout_width="50dp" | ||
32 | android:layout_height="match_parent" | ||
33 | android:background="@null" | ||
34 | android:src="@mipmap/delete_btn" | ||
35 | android:visibility="invisible" /> | ||
36 | </LinearLayout> | ||
37 | |||
38 | <LinearLayout | ||
39 | android:id="@+id/et_password_layout" | ||
40 | android:layout_width="match_parent" | ||
41 | android:layout_height="wrap_content" | ||
42 | android:layout_below="@id/et_phonenumber_layout" | ||
43 | android:layout_marginTop="50dp" | ||
44 | android:background="@drawable/input_bg" | ||
45 | android:gravity="center_horizontal" | ||
46 | android:orientation="horizontal" | ||
47 | android:paddingRight="10dp"> | ||
48 | |||
49 | <EditText | ||
50 | android:id="@+id/et_password" | ||
51 | style="@style/login_register_edit_style" | ||
52 | android:hint="密码" | ||
53 | android:maxLength="20" | ||
54 | android:inputType="textPassword" | ||
55 | android:textColor="@color/login_text_black" /> | ||
56 | |||
57 | <ImageButton | ||
58 | android:id="@+id/password_delete_btn" | ||
59 | android:layout_width="50dp" | ||
60 | android:layout_height="match_parent" | ||
61 | android:background="@null" | ||
62 | android:src="@mipmap/delete_btn" | ||
63 | android:visibility="invisible" /> | ||
64 | </LinearLayout> | ||
27 | 65 | ||
28 | <Button | 66 | <Button |
29 | android:id="@+id/btn_login" | 67 | android:id="@+id/btn_login" |
30 | style="@style/button_login_register_style" | 68 | style="@style/button_login_register_style" |
31 | android:layout_below="@id/et_password" | 69 | android:layout_below="@id/et_password_layout" |
32 | android:layout_marginTop="30dp" | 70 | android:layout_marginTop="90dp" |
33 | android:text="登 录" /> | 71 | android:text="登 录" /> |
34 | 72 | ||
35 | <TextView | 73 | <TextView |
36 | android:id="@+id/tv_forget_pwd" | 74 | android:id="@+id/tv_forget_pwd" |
37 | style="@style/text_forget_pwd_style" | 75 | style="@style/text_forget_pwd_style" |
38 | android:layout_alignParentRight="true" | 76 | android:layout_alignParentRight="true" |
39 | android:layout_below="@id/btn_login" | 77 | android:layout_below="@id/btn_login" |
40 | android:layout_marginTop="15dp" | 78 | android:layout_marginTop="15dp" |
41 | android:text="@string/forget_pwd" | 79 | android:text="@string/forget_pwd" |
42 | android:textColor="@color/btn_text_color" /> | 80 | android:textColor="@color/btn_text_color" /> |
43 | 81 | ||
44 | </RelativeLayout> | 82 | </RelativeLayout> |
PersonalCenter/app/src/main/res/layout/fragment_loginandregister_register.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:background="#ffffffff" | 5 | android:background="#00ffffff" |
6 | android:orientation="vertical" | 6 | android:orientation="vertical" |
7 | android:paddingLeft="300dp" | 7 | android:paddingLeft="30dp" |
8 | android:paddingRight="300dp"> | 8 | android:paddingRight="30dp"> |
9 | 9 | ||
10 | <EditText | 10 | <LinearLayout |
11 | android:id="@+id/et_phonenumber" | 11 | android:id="@+id/et_phonenumber_layout" |
12 | style="@style/login_register_edit_style" | 12 | android:layout_width="match_parent" |
13 | android:layout_height="wrap_content" | ||
14 | android:gravity="center_horizontal" | ||
15 | android:background="@drawable/input_bg" | ||
13 | android:layout_marginTop="20dp" | 16 | android:layout_marginTop="20dp" |
14 | android:hint="手机号" | 17 | android:paddingRight="10dp" |
15 | android:inputType="phone" /> | 18 | android:orientation="horizontal"> |
16 | 19 | ||
17 | <TextView | 20 | <EditText |
18 | android:id="@+id/phonenumber_error_hint" | 21 | android:id="@+id/et_phonenumber" |
19 | style="@style/registererrhint_style" | 22 | style="@style/login_register_edit_style" |
20 | android:layout_below="@id/et_phonenumber" /> | 23 | android:hint="手机号" |
24 | android:maxLength="11" | ||
25 | android:inputType="phone" /> | ||
26 | <ImageButton | ||
27 | android:id="@+id/phone_delete_btn" | ||
28 | android:layout_width="50dp" | ||
29 | android:layout_height="match_parent" | ||
30 | android:src="@mipmap/delete_btn" | ||
31 | android:visibility="invisible" | ||
32 | android:background="@null"/> | ||
33 | </LinearLayout> | ||
21 | 34 | ||
22 | <LinearLayout | 35 | <LinearLayout |
23 | android:id="@+id/rl_authcode" | 36 | android:id="@+id/rl_authcode" |
24 | android:layout_width="match_parent" | 37 | android:layout_width="match_parent" |
25 | android:layout_height="wrap_content" | 38 | android:layout_height="wrap_content" |
26 | android:layout_below="@id/et_phonenumber" | 39 | android:layout_below="@id/et_phonenumber_layout" |
27 | android:layout_marginTop="30dp" | 40 | android:layout_marginTop="30dp" |
41 | android:paddingRight="7dp" | ||
42 | android:background="@drawable/input_bg" | ||
28 | android:orientation="horizontal"> | 43 | android:orientation="horizontal"> |
29 | 44 | ||
30 | <EditText | 45 | <EditText |
31 | android:id="@+id/et_authcode" | 46 | android:id="@+id/et_authcode" |
32 | style="@style/login_register_edit_rect_style" | 47 | style="@style/login_register_edit_rect_style" |
33 | android:layout_marginRight="-4px" | 48 | android:layout_marginRight="-4px" |
34 | android:layout_weight="1" | 49 | android:layout_weight="1" |
35 | android:hint="验证码" | 50 | android:hint="验证码" |
51 | android:maxLength="6" | ||
36 | android:numeric="integer" /> | 52 | android:numeric="integer" /> |
37 | 53 | ||
54 | <ImageButton | ||
55 | android:id="@+id/code_delete_btn" | ||
56 | android:layout_width="50dp" | ||
57 | android:layout_height="match_parent" | ||
58 | android:src="@mipmap/delete_btn" | ||
59 | android:visibility="invisible" | ||
60 | android:background="@null"/> | ||
38 | <Button | 61 | <Button |
39 | android:id="@+id/btn_authcode" | 62 | android:id="@+id/btn_authcode" |
40 | style="@style/login_register_btn_authcode_rect_style" | 63 | android:layout_width="match_parent" |
64 | android:layout_height="wrap_content" | ||
65 | style="?android:attr/borderlessButtonStyle" | ||
41 | android:layout_weight="2" | 66 | android:layout_weight="2" |
42 | android:text="获取验证码" | 67 | android:text="获取验证码" |
43 | android:textColor="@color/btn_text_color" /> | 68 | android:maxLines="1" |
69 | android:background="@drawable/code_bg" | ||
70 | android:textSize="18sp" | ||
71 | android:padding="8dp" | ||
72 | android:textColor="@color/login_text_blue" /> | ||
44 | </LinearLayout> | 73 | </LinearLayout> |
45 | 74 | ||
46 | <TextView | 75 | <TextView |
47 | android:id="@+id/authcode_error_hint" | 76 | android:id="@+id/authcode_error_hint" |
48 | style="@style/registererrhint_style" | 77 | style="@style/registererrhint_style" |
49 | android:layout_below="@id/rl_authcode" /> | 78 | android:layout_below="@id/rl_authcode" /> |
50 | 79 | ||
51 | <RelativeLayout | 80 | <LinearLayout |
52 | android:id="@+id/pwd_rl" | 81 | android:id="@+id/pwd_rl" |
53 | android:layout_width="match_parent" | 82 | android:layout_width="match_parent" |
54 | android:layout_height="wrap_content" | 83 | android:layout_height="wrap_content" |
55 | android:layout_below="@id/rl_authcode" | 84 | android:layout_below="@id/rl_authcode" |
85 | android:background="@drawable/input_bg" | ||
86 | android:gravity="center_vertical" | ||
56 | android:layout_marginTop="30dp"> | 87 | android:layout_marginTop="30dp"> |
57 | 88 | ||
58 | <EditText | 89 | <EditText |
59 | android:id="@+id/et_password" | 90 | android:id="@+id/et_password" |
60 | style="@style/login_register_edit_style" | 91 | style="@style/login_register_edit_style" |
61 | android:hint="密码为英文和数字组成,最少8位" | 92 | android:hint="密码为英文和数字组成,最少8位" |
62 | android:inputType="textPassword" /> | 93 | android:inputType="textPassword" /> |
63 | 94 | ||
64 | <ImageView | 95 | <ImageView |
65 | android:id="@+id/iv_pwd_change" | 96 | android:id="@+id/iv_pwd_change" |
66 | android:padding="10dp" | ||
67 | android:layout_marginRight="10dp" | ||
68 | android:layout_marginLeft="10dp" | ||
69 | android:layout_width="40dp" | 97 | android:layout_width="40dp" |
70 | android:layout_height="wrap_content" | 98 | android:layout_height="wrap_content" |
71 | android:layout_alignParentRight="true" | 99 | android:layout_alignParentRight="true" |
72 | android:layout_centerVertical="true" | 100 | android:layout_centerVertical="true" |
101 | android:layout_marginLeft="10dp" | ||
102 | android:layout_marginRight="15dp" | ||
103 | android:padding="10dp" | ||
73 | android:src="@mipmap/pwd_hide" /> | 104 | android:src="@mipmap/pwd_hide" /> |
74 | </RelativeLayout> | 105 | </LinearLayout> |
75 | 106 | ||
76 | <TextView | 107 | <TextView |
77 | android:id="@+id/password_error_hint" | 108 | android:id="@+id/password_error_hint" |
78 | style="@style/registererrhint_style" | 109 | style="@style/registererrhint_style" |
79 | android:layout_below="@id/pwd_rl" /> | 110 | android:layout_below="@id/pwd_rl" /> |
80 | 111 | ||
81 | <Button | 112 | <Button |
82 | android:id="@+id/btn_register" | 113 | android:id="@+id/btn_register" |
83 | style="@style/button_login_register_style" | 114 | style="@style/button_login_register_style" |
84 | android:layout_below="@id/pwd_rl" | 115 | android:layout_below="@id/pwd_rl" |
85 | android:layout_marginTop="30dp" | 116 | android:layout_marginTop="30dp" |
PersonalCenter/app/src/main/res/layout/sales_dialog_layout.xml
File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | android:layout_width="match_parent" | ||
4 | android:layout_height="match_parent" | ||
5 | android:background="@null" | ||
6 | android:gravity="center" | ||
7 | android:orientation="vertical" > | ||
8 | |||
9 | <LinearLayout | ||
10 | android:layout_width="400dp" | ||
11 | android:layout_height="wrap_content" | ||
12 | android:background="@drawable/white_cycle_bg" | ||
13 | android:orientation="vertical" > | ||
14 | <TextView | ||
15 | android:layout_width="match_parent" | ||
16 | android:layout_height="wrap_content" | ||
17 | android:gravity="center" | ||
18 | android:paddingTop="19dip" | ||
19 | android:lineSpacingExtra="5dp" | ||
20 | android:text="温馨提示" | ||
21 | android:textColor="@color/login_text_black" | ||
22 | android:textSize="22sp" /> | ||
23 | |||
24 | <TextView | ||
25 | android:id="@+id/dialog_title" | ||
26 | android:layout_width="match_parent" | ||
27 | android:layout_height="wrap_content" | ||
28 | android:gravity="center" | ||
29 | android:paddingTop="19dip" | ||
30 | android:lineSpacingExtra="5dp" | ||
31 | android:text="该导购员还未在系统中注册,您确定继续\n注册电子保卡?" | ||
32 | android:textColor="@color/login_text_black" | ||
33 | android:textSize="19sp" /> | ||
34 | |||
35 | <View | ||
36 | android:layout_width="match_parent" | ||
37 | android:layout_height="0.5dp" | ||
38 | android:layout_marginLeft="20dp" | ||
39 | android:layout_marginRight="20dp" | ||
40 | android:layout_marginTop="20dp" | ||
41 | android:background="@color/line_bg"/> | ||
42 | |||
43 | <LinearLayout | ||
44 | android:layout_width="match_parent" | ||
45 | android:layout_height="wrap_content" | ||
46 | android:orientation="horizontal" > | ||
47 | |||
48 | <Button | ||
49 | android:id="@+id/cancel_btn" | ||
50 | style="?android:attr/borderlessButtonStyle" | ||
51 | android:layout_width="match_parent" | ||
52 | android:layout_height="wrap_content" | ||
53 | android:layout_weight="1" | ||
54 | android:background="@drawable/white_cycle_bg" | ||
55 | android:gravity="center" | ||
56 | android:paddingBottom="10dp" | ||
57 | android:paddingTop="10dp" | ||
58 | android:text="取消" | ||
59 | android:textColor="@color/login_text_black" | ||
60 | android:textSize="18sp" /> | ||
61 | |||
62 | <View | ||
63 | android:layout_width="0.5dp" | ||
64 | android:layout_height="match_parent" | ||
65 | android:layout_marginTop="5dp" | ||
66 | android:layout_marginBottom="5dp" | ||
67 | android:background="@color/line_bg" | ||
68 | android:orientation="horizontal" /> | ||
69 | |||
70 | <Button | ||
71 | android:id="@+id/go_btn" | ||
72 | style="?android:attr/borderlessButtonStyle" | ||
73 | android:layout_width="match_parent" | ||
74 | android:layout_height="wrap_content" | ||
75 | android:layout_weight="1" | ||
76 | android:background="@drawable/white_cycle_bg" | ||
77 | android:gravity="center" | ||
78 | android:paddingBottom="10dp" | ||
79 | android:paddingTop="10dp" | ||
80 | android:text="继续" | ||
81 | android:textColor="@color/login_text_black" | ||
82 | android:textSize="18sp" /> | ||
83 | </LinearLayout> | ||
84 | </LinearLayout> | ||
85 | |||
86 | </LinearLayout> |
PersonalCenter/app/src/main/res/mipmap-hdpi/delete_btn.png
1.13 KB
PersonalCenter/app/src/main/res/mipmap-hdpi/public_qa_code.png
14.1 KB
PersonalCenter/app/src/main/res/mipmap-hdpi/start_btn_bg.png
7.02 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/main_bg.png
1.7 MB
PersonalCenter/app/src/main/res/mipmap-xhdpi/startpage.jpg
137 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/startpage.png
718 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/switch_btn.png
1.7 KB
PersonalCenter/app/src/main/res/values/colors.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <resources> | 2 | <resources> |
3 | <color name="colorPrimary">#3F51B5</color> | 3 | <color name="colorPrimary">#3F51B5</color> |
4 | <color name="colorPrimaryDark">#303F9F</color> | 4 | <color name="colorPrimaryDark">#303F9F</color> |
5 | <color name="colorAccent">#FF4081</color> | 5 | <color name="colorAccent">#FF4081</color> |
6 | <color name="white">#ffffffff</color> | 6 | <color name="white">#ffffffff</color> |
7 | <color name="login_edittext_hint">#afafaf</color> | 7 | <color name="login_edittext_hint">#afafaf</color> |
8 | <color name="login_text_blue">#1cb8ff</color> | 8 | <color name="login_text_blue">#1cb8ff</color> |
9 | <color name="login_text_black">#313131</color> | 9 | <color name="login_text_black">#313131</color> |
10 | <color name="login_edittext_normal">#d4d4d4</color> | 10 | <color name="login_edittext_normal">#d4d4d4</color> |
11 | <color name="error_hint">#ED1c24</color> | 11 | <color name="error_hint">#ED1c24</color> |
12 | <color name="login_edittext_pressed">#1cb8ff</color> | 12 | <color name="login_edittext_pressed">#1cb8ff</color> |
13 | <color name="cutoff_line">#CCCCCC</color> | 13 | <color name="cutoff_line">#CCCCCC</color> |
14 | <color name="input_bg">#f4f1ec</color> | ||
14 | <color name="electronic_card">#ff480f</color> | 15 | <color name="electronic_card">#ff480f</color> |
15 | <color name="electronic_text">#afafaf</color> | 16 | <color name="electronic_text">#afafaf</color> |
16 | <color name="backgerangde_laout">#eeeeee</color> | 17 | <color name="backgerangde_laout">#eeeeee</color> |
17 | <color name="bgstudy_laout">#F0F0F0</color> | 18 | <color name="bgstudy_laout">#F0F0F0</color> |
18 | <color name="bgstudy_baoka">#0088c6</color> | 19 | <color name="bgstudy_baoka">#0088c6</color> |
19 | 20 | <color name="main_bg">#441cb8ff</color> | |
21 | <color name="line_bg">#d5d5d5</color> | ||
20 | 22 | ||
21 | 23 | ||
22 | </resources> | 24 | </resources> |
23 | 25 |
PersonalCenter/app/src/main/res/values/strings.xml
1 | <resources> | 1 | <resources> |
2 | <string name="app_name">个人中心</string> | 2 | <string name="app_name">个人中心</string> |
3 | 3 | ||
4 | 4 | ||
5 | 5 | ||
6 | //登录注册 | 6 | //登录注册 |
7 | <string name="cancel">取 消</string> | 7 | <string name="cancel">取 消</string> |
8 | <string name="ok">确 定</string> | 8 | <string name="ok">确 定</string> |
9 | <string name="forget_pwd">忘记密码</string> | 9 | <string name="forget_pwd">忘记密码</string> |
10 | <string name="string_menu_title">忘记密码</string> | 10 | <string name="string_menu_title">忘记密码</string> |
11 | <string name="string_regist_info">填写注册信息</string> | 11 | <string name="string_regist_info">填写注册信息</string> |
12 | <string name="string_textbook_info">选择教材版本</string> | 12 | <string name="string_textbook_info">选择教材版本</string> |
13 | <string name="string_regist_username">用户名</string> | 13 | <string name="string_regist_username">姓名</string> |
14 | <string name="string_regist_nickname">昵称</string> | ||
14 | <string name="string_regist_region">地区</string> | 15 | <string name="string_regist_region">地区</string> |
16 | <string name="string_regist_address">家庭地址</string> | ||
15 | <string name="string_regist_grade">年级</string> | 17 | <string name="string_regist_grade">年级</string> |
16 | <string name="string_regist_school">学校</string> | 18 | <string name="string_regist_school">学校</string> |
17 | <string name="string_regist_next">下一步</string> | 19 | <string name="string_regist_next">下一步</string> |
18 | <string name="string_start_page">开始学习体验</string> | 20 | <string name="string_start_page">开始学习体验</string> |
19 | <string name="bangding">绑定家长控制</string> | 21 | <string name="bangding">绑定家长控制</string> |
20 | <string name="finish">完成</string> | 22 | <string name="finish">完成</string> |
21 | <string name="account_management">账户管理</string> | 23 | <string name="account_management">账户管理</string> |
22 | <string name="changge_preson">修改个人信息</string> | 24 | <string name="changge_preson">修改个人信息</string> |
25 | <string name="static_str">15811111111</string> | ||
23 | 26 | ||
24 | //电子保卡 | 27 | //电子保卡 |
25 | <string name="string_electroniccard_info_title">填写保卡信息</string> | 28 | <string name="string_electroniccard_info_title">填写保卡信息</string> |
26 | <string name="string_electroniccard_info_fill">填写电子保卡</string> | 29 | <string name="string_electroniccard_info_fill">填写电子保卡</string> |
27 | <string name="change_electroniccard_info_fill">修改保卡信息</string> | 30 | <string name="change_electroniccard_info_fill">修改保卡信息</string> |
28 | <string name="string_electroniccard_info_change">修改保卡信息</string> | 31 | <string name="string_electroniccard_info_change">修改保卡信息</string> |
29 | <string name="string_electroniccard_info_ok">确认保卡信息</string> | 32 | <string name="string_electroniccard_info_ok">确认保卡信息</string> |
30 | <string name="string_electroniccard_info_look">好记星-电子保卡</string> | 33 | <string name="string_electroniccard_info_look">好记星-电子保卡</string> |
31 | <string name="string_electroniccard_change_bangding">更换绑定</string> | 34 | <string name="string_electroniccard_change_bangding">更换绑定</string> |
32 | <string name="electronic_card">温馨提示:若您想修改的相关信息请拨打客服电话</string> | 35 | <string name="electronic_card">温馨提示:若您想修改相关信息请拨打客服电话</string> |
33 | <string name="electronic_card1">请先填写《好记星-电子保卡》信息</string> | 36 | <string name="electronic_card1">请先填写《好记星-电子保卡》信息</string> |
34 | <string name="electronic_card2">该信息是本产品的三包证明,为维护您的合法权益,请认真填写</string> | 37 | <string name="electronic_card2">该信息是本产品的三包证明,为维护您的合法权益,请认真填写</string> |
35 | <string name="electronic_card3">您已填写完《好记星-电子保卡》信息</string> | 38 | <string name="electronic_card3">您已填写完《好记星-电子保卡》信息</string> |
36 | <string name="electronic_card4">您也可以设置家长管理,用手机及时了解和管理孩子的学习情况</string> | 39 | <string name="electronic_card4">您也可以设置家长管理,用手机及时了解和管理孩子的学习情况</string> |
37 | 40 | ||
38 | //意见反馈 | 41 | //意见反馈 |
39 | <string name="feedback">写下您对我们产品的意见吧,我们将努力完善,最多输入500字。</string> | 42 | <string name="feedback">写下您对我们产品的意见吧,我们将努力完善,最多输入500字。</string> |
40 | <string name="qq">QQ或手机号码</string> | 43 | <string name="qq">QQ或手机号码</string> |
41 | <string name="hint">留下您的联系方式,方便与您沟通。</string> | 44 | <string name="hint">留下您的联系方式,方便与您沟通。</string> |
42 | 45 | ||
43 | 46 | ||
44 | //个人中心 | 47 | //个人中心 |
45 | <string name="titel_preson">个人中心</string> | 48 | <string name="titel_preson">个人中心</string> |
46 | 49 | ||
47 | 50 | ||
48 | 51 | ||
49 | </resources> | 52 | </resources> |
50 | 53 |
PersonalCenter/app/src/main/res/values/styles.xml
1 | <resources> | 1 | <resources> |
2 | 2 | ||
3 | <!-- Base application theme. --> | 3 | <!-- Base application theme. --> |
4 | <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | 4 | <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> |
5 | <!-- Customize your theme here. --> | 5 | <!-- Customize your theme here. --> |
6 | <item name="colorPrimary">@color/colorPrimary</item> | 6 | <item name="colorPrimary">@color/colorPrimary</item> |
7 | <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | 7 | <item name="colorPrimaryDark">@color/colorPrimaryDark</item> |
8 | <item name="android:windowFullscreen">true</item> | 8 | <item name="android:windowFullscreen">true</item> |
9 | </style> | 9 | </style> |
10 | 10 | ||
11 | <style name="login_register_edit_style"> | 11 | <style name="login_register_edit_style"> |
12 | <item name="android:textSize">19sp</item> | 12 | <item name="android:textSize">19sp</item> |
13 | <item name="android:singleLine">true</item> | 13 | <item name="android:singleLine">true</item> |
14 | <item name="android:background">@drawable/selector_edittext_bg</item> | 14 | <item name="android:background">@null</item> |
15 | <item name="android:layout_width">match_parent</item> | 15 | <item name="android:layout_width">0dp</item> |
16 | <item name="android:layout_weight">1</item> | ||
16 | <item name="android:layout_height">wrap_content</item> | 17 | <item name="android:layout_height">wrap_content</item> |
17 | <item name="android:textColorHint">@color/login_edittext_hint</item> | 18 | <item name="android:textColorHint">@color/login_edittext_hint</item> |
18 | <item name="android:padding">10dp</item> | 19 | <item name="android:paddingRight">30dp</item> |
20 | <item name="android:paddingTop">15dp</item> | ||
21 | <item name="android:paddingLeft">30dp</item> | ||
22 | <item name="android:paddingBottom">15dp</item> | ||
19 | </style> | 23 | </style> |
20 | 24 | ||
21 | <style name="login_register_edit_rect_style"> | 25 | <style name="login_register_edit_rect_style"> |
22 | <item name="android:textSize">19sp</item> | 26 | <item name="android:textSize">19sp</item> |
23 | <item name="android:singleLine">true</item> | 27 | <item name="android:singleLine">true</item> |
24 | <item name="android:background">@drawable/selector_edittext_rect_bg</item> | 28 | <item name="android:background">@null</item> |
25 | <item name="android:layout_width">match_parent</item> | 29 | <item name="android:layout_width">match_parent</item> |
26 | <item name="android:layout_height">wrap_content</item> | 30 | <item name="android:layout_height">wrap_content</item> |
27 | <item name="android:textColorHint">@color/login_edittext_hint</item> | 31 | <item name="android:textColorHint">@color/login_edittext_hint</item> |
28 | <item name="android:paddingRight">10dp</item> | 32 | <item name="android:paddingRight">10dp</item> |
29 | <item name="android:paddingTop">10dp</item> | 33 | <item name="android:paddingTop">15dp</item> |
30 | <item name="android:paddingLeft">10dp</item> | 34 | <item name="android:paddingLeft">30dp</item> |
31 | <item name="android:paddingBottom">12dp</item> | 35 | <item name="android:paddingBottom">15dp</item> |
32 | </style> | 36 | </style> |
33 | 37 | ||
34 | <style name="login_register_btn_authcode_rect_style"> | 38 | <style name="login_register_btn_authcode_rect_style"> |
35 | <item name="android:textSize">19sp</item> | 39 | <item name="android:textSize">19sp</item> |
36 | <item name="android:singleLine">true</item> | 40 | <item name="android:singleLine">true</item> |
37 | <item name="android:background">@drawable/btn_rect_normal</item> | 41 | <item name="android:background">@drawable/code_bg</item> |
38 | <item name="android:layout_width">match_parent</item> | 42 | <item name="android:layout_width">match_parent</item> |
39 | <item name="android:layout_height">wrap_content</item> | 43 | <item name="android:layout_height">wrap_content</item> |
40 | <item name="android:textColorHint">@color/login_edittext_hint</item> | 44 | <item name="android:textColorHint">@color/login_edittext_hint</item> |
41 | <item name="android:padding">10dp</item> | 45 | <item name="android:padding">10dp</item> |
42 | </style> | 46 | </style> |
43 | <style name="text_login_register_style" > | 47 | <style name="text_login_register_style" > |
44 | <item name="android:layout_width">wrap_content</item> | 48 | <item name="android:layout_width">wrap_content</item> |
45 | <item name="android:layout_height">wrap_content</item> | 49 | <item name="android:layout_height">wrap_content</item> |
46 | <item name="android:textSize">22sp</item> | 50 | <item name="android:textSize">22sp</item> |
47 | <item name="android:gravity">center</item> | 51 | <item name="android:gravity">center</item> |
48 | <item name="android:padding">10dp</item> | 52 | <item name="android:padding">10dp</item> |
49 | 53 | ||
50 | </style> | 54 | </style> |
51 | <style name="button_login_register_style" parent="@style/Widget.AppCompat.Button.Borderless"> | 55 | <style name="button_login_register_style" parent="@style/Widget.AppCompat.Button.Borderless"> |
52 | <item name="android:layout_width">match_parent</item> | 56 | <item name="android:layout_width">match_parent</item> |
53 | <item name="android:layout_height">wrap_content</item> | 57 | <item name="android:layout_height">wrap_content</item> |
54 | <item name="android:background">@drawable/selector_blue_btn_bg</item> | 58 | <item name="android:background">@drawable/selector_blue_btn_bg</item> |
55 | <item name="android:textSize">23sp</item> | 59 | <item name="android:textSize">25sp</item> |
56 | <item name="android:gravity">center</item> | 60 | <item name="android:gravity">center</item> |
57 | <item name="android:padding">10dp</item> | 61 | <item name="android:padding">12dp</item> |
58 | <item name="android:textColor">@android:color/white</item> | 62 | <item name="android:textColor">@android:color/white</item> |
59 | </style> | 63 | </style> |
60 | <style name="text_forget_pwd_style" > | 64 | <style name="text_forget_pwd_style" > |
61 | <item name="android:layout_width">wrap_content</item> | 65 | <item name="android:layout_width">wrap_content</item> |
62 | <item name="android:layout_height">wrap_content</item> | 66 | <item name="android:layout_height">wrap_content</item> |
63 | <item name="android:textSize">18sp</item> | 67 | <item name="android:textSize">18sp</item> |
64 | <item name="android:gravity">center</item> | 68 | <item name="android:gravity">center</item> |
65 | <item name="android:padding">8dp</item> | 69 | <item name="android:padding">8dp</item> |
66 | </style> | 70 | </style> |
67 | <style name="registererrhint_style"> | 71 | <style name="registererrhint_style"> |
68 | <item name="android:textSize">14dip</item> | 72 | <item name="android:textSize">14dip</item> |
69 | <item name="android:layout_width">match_parent</item> | 73 | <item name="android:layout_width">match_parent</item> |
70 | <item name="android:layout_height">wrap_content</item> | 74 | <item name="android:layout_height">wrap_content</item> |
71 | <item name="android:textColor">@color/error_hint</item> | 75 | <item name="android:textColor">@color/error_hint</item> |
72 | <item name="android:layout_marginTop">5dip</item> | 76 | <item name="android:layout_marginTop">5dip</item> |
73 | </style> | 77 | </style> |
74 | <style name="iv_pwd_change_style"> | 78 | <style name="iv_pwd_change_style"> |
75 | <item name="android:layout_width">wrap_content</item> | 79 | <item name="android:layout_width">wrap_content</item> |
76 | <item name="android:layout_height">wrap_content</item> | 80 | <item name="android:layout_height">wrap_content</item> |
77 | <item name="android:background">@mipmap/pwd_hide</item> | 81 | <item name="android:background">@mipmap/pwd_hide</item> |
78 | <item name="android:layout_alignParentRight">true</item> | 82 | <item name="android:layout_alignParentRight">true</item> |
79 | <item name="android:layout_centerVertical">true</item> | 83 | <item name="android:layout_centerVertical">true</item> |
80 | <item name="android:layout_marginRight">15dp</item> | 84 | <item name="android:layout_marginRight">15dp</item> |
81 | </style> | 85 | </style> |
82 | <style name="dialogWindowAnim" parent="android:Animation" mce_bogus="1"> | 86 | <style name="dialogWindowAnim" parent="android:Animation" mce_bogus="1"> |
83 | <item name="android:windowEnterAnimation">@anim/dialog_enter_anim</item> | 87 | <item name="android:windowEnterAnimation">@anim/dialog_enter_anim</item> |
84 | <item name="android:windowExitAnimation">@anim/dialog_exit_anim</item> | 88 | <item name="android:windowExitAnimation">@anim/dialog_exit_anim</item> |
85 | </style> | 89 | </style> |
86 | 90 | ||
91 | <style name="CustomDialog" parent="@android:style/Theme.Dialog"> | ||
92 | <item name="android:windowFrame">@null</item> | ||
93 | <item name="android:windowIsFloating">true</item> | ||
94 | <item name="android:windowContentOverlay">@null</item> | ||
95 | <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item> | ||
96 | <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item> | ||
97 | </style> | ||
98 | <style name="CustomHintDialog" parent="@style/CustomDialog"> | ||
99 | <item name="android:windowBackground">@android:color/transparent</item> | ||
100 | <item name="android:windowNoTitle">true</item> | ||
101 | </style> | ||
87 | 102 | ||
88 | 103 | ||
89 | 104 | ||
90 | </resources> | 105 | </resources> |
91 | 106 |
PersonalCenter/app/src/main/res/xml/rc_file_path.xml
File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | <paths> | ||
3 | <external-path name="rc_external_path" path=""/> | ||
4 | </paths> |