Commit 29ad76f4f231b3e93f31c1e0e964ebb36d5618d7
1 parent
1ab8c79994
Exists in
master
AIDL数据共享
Showing
19 changed files
with
368 additions
and
110 deletions
Show diff stats
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"> | 3 | <component name="EntryPointsManager"> |
4 | <entry_points version="2.0" /> | 4 | <entry_points version="2.0" /> |
5 | </component> | 5 | </component> |
6 | <component name="NullableNotNullManager"> | 6 | <component name="NullableNotNullManager"> |
7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> | 7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> |
8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> | 8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> |
9 | <option name="myNullables"> | 9 | <option name="myNullables"> |
10 | <value> | 10 | <value> |
11 | <list size="4"> | 11 | <list size="4"> |
12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | 12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> |
13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | 13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> |
14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | 14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> |
15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | 15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> |
16 | </list> | 16 | </list> |
17 | </value> | 17 | </value> |
18 | </option> | 18 | </option> |
19 | <option name="myNotNulls"> | 19 | <option name="myNotNulls"> |
20 | <value> | 20 | <value> |
21 | <list size="4"> | 21 | <list size="4"> |
22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | 22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> |
23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | 23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> |
24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | 24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> |
25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | 25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> |
26 | </list> | 26 | </list> |
27 | </value> | 27 | </value> |
28 | </option> | 28 | </option> |
29 | </component> | 29 | </component> |
30 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> | 30 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> |
31 | <OptionsSetting value="true" id="Add" /> | 31 | <OptionsSetting value="true" id="Add" /> |
32 | <OptionsSetting value="true" id="Remove" /> | 32 | <OptionsSetting value="true" id="Remove" /> |
33 | <OptionsSetting value="true" id="Checkout" /> | 33 | <OptionsSetting value="true" id="Checkout" /> |
34 | <OptionsSetting value="true" id="Update" /> | 34 | <OptionsSetting value="true" id="Update" /> |
35 | <OptionsSetting value="true" id="Status" /> | 35 | <OptionsSetting value="true" id="Status" /> |
36 | <OptionsSetting value="true" id="Edit" /> | 36 | <OptionsSetting value="true" id="Edit" /> |
37 | <ConfirmationsSetting value="0" id="Add" /> | 37 | <ConfirmationsSetting value="0" id="Add" /> |
38 | <ConfirmationsSetting value="0" id="Remove" /> | 38 | <ConfirmationsSetting value="0" id="Remove" /> |
39 | </component> | 39 | </component> |
40 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 40 | <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"> |
41 | <output url="file://$PROJECT_DIR$/build/classes" /> | 41 | <output url="file://$PROJECT_DIR$/build/classes" /> |
42 | </component> | 42 | </component> |
43 | <component name="ProjectType"> | 43 | <component name="ProjectType"> |
44 | <option name="id" value="Android" /> | 44 | <option name="id" value="Android" /> |
45 | </component> | 45 | </component> |
46 | </project> | 46 | </project> |
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 25 |
10 | versionCode 1 | 10 | versionCode 1 |
11 | versionName "1.0.0" | 11 | versionName "1.0.0" |
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 | sourceSets { | 21 | sourceSets { |
22 | main { | 22 | main { |
23 | jniLibs.srcDirs = ['libs'] | 23 | jniLibs.srcDirs = ['libs'] |
24 | } | 24 | } |
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | dependencies { | 28 | dependencies { |
29 | compile fileTree(include: ['*.jar'], dir: 'libs') | 29 | compile fileTree(include: ['*.jar'], dir: 'libs') |
30 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | 30 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { |
31 | exclude group: 'com.android.support', module: 'support-annotations' | 31 | exclude group: 'com.android.support', module: 'support-annotations' |
32 | }) | 32 | }) |
33 | compile 'com.tencent.bugly:crashreport:latest.release' | 33 | compile 'com.tencent.bugly:crashreport:latest.release' |
34 | compile 'org.apache.httpcomponents:httpcore:4.4.1' | 34 | compile 'org.apache.httpcomponents:httpcore:4.4.1' |
35 | compile 'org.apache.httpcomponents:httpclient:4.5' | 35 | compile 'org.apache.httpcomponents:httpclient:4.5' |
36 | compile 'com.android.support:appcompat-v7:25.3.1' | 36 | compile 'com.android.support:appcompat-v7:25.3.1' |
37 | testCompile 'junit:junit:4.12' | 37 | testCompile 'junit:junit:4.12' |
38 | compile project(':circledialog') | 38 | compile project(':circledialog') |
39 | compile project(':pickerview') | 39 | compile project(':pickerview') |
40 | compile files('libs/android-async-http-1.4.8.jar') | 40 | compile files('libs/android-async-http-1.4.8.jar') |
41 | compile 'com.google.code.gson:gson:2.7' | 41 | compile 'com.google.code.gson:gson:2.7' |
42 | compile 'com.zaaach:toprightmenu:1.0' | 42 | compile 'com.zaaach:toprightmenu:1.0' |
43 | compile 'com.facebook.fresco:fresco:1.1.0' | 43 | compile 'com.facebook.fresco:fresco:1.1.0' |
44 | compile'com.android.support:recyclerview-v7:25.+' | 44 | compile 'com.android.support:recyclerview-v7:25.+' |
45 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' | 45 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' |
46 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' | 46 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' |
47 | compile 'com.google.zxing:core:3.3.0' | ||
48 | compile 'com.google.zxing:android-core:3.3.0' | ||
47 | } | 49 | } |
48 | 50 |
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 | 4 | ||
5 | <application | 5 | <application |
6 | android:name=".activity.MyApplication" | 6 | android:name=".activity.MyApplication" |
7 | android:allowBackup="true" | 7 | android:allowBackup="true" |
8 | android:icon="@mipmap/ic_launcher" | 8 | android:icon="@mipmap/ic_launcher" |
9 | android:label="@string/app_name" | 9 | android:label="@string/app_name" |
10 | android:supportsRtl="true" | 10 | android:supportsRtl="true" |
11 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> | 11 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> |
12 | <activity | 12 | <activity |
13 | android:name=".activity.MainActivity" | 13 | android:name=".activity.MainActivity" |
14 | android:launchMode="singleTask" | 14 | android:launchMode="singleTask" |
15 | android:screenOrientation="landscape"> | 15 | android:screenOrientation="landscape"> |
16 | </activity> | 16 | </activity> |
17 | <activity | 17 | <activity |
18 | android:name=".activity.LoginAndRegisterActivity" | 18 | android:name=".activity.LoginAndRegisterActivity" |
19 | android:launchMode="singleTask" | 19 | android:launchMode="singleTask" |
20 | 20 | ||
21 | android:screenOrientation="landscape"> | 21 | android:screenOrientation="landscape"> |
22 | <intent-filter> | 22 | <intent-filter> |
23 | <action android:name="android.intent.action.MAIN" /> | 23 | <action android:name="android.intent.action.MAIN" /> |
24 | 24 | ||
25 | <category android:name="android.intent.category.LAUNCHER" /> | 25 | <category android:name="android.intent.category.LAUNCHER" /> |
26 | </intent-filter> | 26 | </intent-filter> |
27 | 27 | ||
28 | </activity> | 28 | </activity> |
29 | <activity | 29 | <activity |
30 | android:name=".activity.ForgotPasswordActivity" | 30 | android:name=".activity.ForgotPasswordActivity" |
31 | android:launchMode="singleTask" | 31 | android:launchMode="singleTask" |
32 | android:screenOrientation="landscape"> | 32 | android:screenOrientation="landscape"> |
33 | 33 | ||
34 | </activity> | 34 | </activity> |
35 | <activity | 35 | <activity |
36 | android:name=".activity.ChangePasswordActivity" | 36 | android:name=".activity.ChangePasswordActivity" |
37 | android:launchMode="singleTask" | 37 | android:launchMode="singleTask" |
38 | android:screenOrientation="landscape"> | 38 | android:screenOrientation="landscape"> |
39 | 39 | ||
40 | </activity> | 40 | </activity> |
41 | <activity | 41 | <activity |
42 | android:name=".activity.RegisterInfoActivity" | 42 | android:name=".activity.RegisterInfoActivity" |
43 | android:launchMode="singleTask" | 43 | android:launchMode="singleTask" |
44 | android:screenOrientation="landscape"> | 44 | android:screenOrientation="landscape"> |
45 | 45 | ||
46 | </activity> | 46 | </activity> |
47 | <activity | 47 | <activity |
48 | android:name=".activity.ElectronicCardValidationActivity" | 48 | android:name=".activity.ElectronicCardValidationActivity" |
49 | android:launchMode="singleTask" | 49 | android:launchMode="singleTask" |
50 | android:screenOrientation="landscape"> | 50 | android:screenOrientation="landscape"> |
51 | 51 | ||
52 | </activity> | 52 | </activity> |
53 | <activity | 53 | <activity |
54 | android:name=".activity.ChangeBangDingActivity" | 54 | android:name=".activity.ChangeBangDingActivity" |
55 | android:launchMode="singleTask" | 55 | android:launchMode="singleTask" |
56 | android:screenOrientation="landscape"> | 56 | android:screenOrientation="landscape"> |
57 | 57 | ||
58 | </activity> | 58 | </activity> |
59 | <activity | 59 | <activity |
60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" | 60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" |
61 | android:launchMode="singleTask" | 61 | android:launchMode="singleTask" |
62 | android:screenOrientation="landscape"> | 62 | android:screenOrientation="landscape"> |
63 | 63 | ||
64 | </activity> | 64 | </activity> |
65 | <activity | 65 | <activity |
66 | android:name=".activity.ChangeEletronicCardPhoneActivity" | 66 | android:name=".activity.ChangeEletronicCardPhoneActivity" |
67 | android:launchMode="singleTask" | 67 | android:launchMode="singleTask" |
68 | android:screenOrientation="landscape"> | 68 | android:screenOrientation="landscape"> |
69 | 69 | ||
70 | </activity> | 70 | </activity> |
71 | <activity | 71 | <activity |
72 | android:name=".activity.ChoiseTextBookActivity" | 72 | android:name=".activity.ChoiseTextBookActivity" |
73 | android:launchMode="singleTask" | 73 | android:launchMode="singleTask" |
74 | android:screenOrientation="landscape"> | 74 | android:screenOrientation="landscape"> |
75 | 75 | ||
76 | </activity> | 76 | </activity> |
77 | <activity | 77 | <activity |
78 | android:name=".activity.TheStartPageActivity" | 78 | android:name=".activity.TheStartPageActivity" |
79 | android:launchMode="singleTask" | 79 | android:launchMode="singleTask" |
80 | android:screenOrientation="landscape"> | 80 | android:screenOrientation="landscape"> |
81 | 81 | ||
82 | </activity> | 82 | </activity> |
83 | <activity | 83 | <activity |
84 | android:name=".activity.ElectronicCardEditInfoActivity" | 84 | android:name=".activity.ElectronicCardEditInfoActivity" |
85 | android:launchMode="singleTask" | 85 | android:launchMode="singleTask" |
86 | android:screenOrientation="landscape"> | 86 | android:screenOrientation="landscape"> |
87 | 87 | ||
88 | </activity> | 88 | </activity> |
89 | <activity | 89 | <activity |
90 | android:name=".activity.ElectronicCardInfoOKActivity" | 90 | android:name=".activity.ElectronicCardInfoOKActivity" |
91 | android:launchMode="singleTask" | 91 | android:launchMode="singleTask" |
92 | android:screenOrientation="landscape"> | 92 | android:screenOrientation="landscape"> |
93 | 93 | ||
94 | </activity> | 94 | </activity> |
95 | <activity | 95 | <activity |
96 | android:name=".activity.ElectronicCardLookInfoActivity" | 96 | android:name=".activity.ElectronicCardLookInfoActivity" |
97 | android:launchMode="singleTask" | 97 | android:launchMode="singleTask" |
98 | android:screenOrientation="landscape"> | 98 | android:screenOrientation="landscape"> |
99 | 99 | ||
100 | </activity> | 100 | </activity> |
101 | <activity | 101 | <activity |
102 | android:name=".activity.FeedBackActivity" | 102 | android:name=".activity.FeedBackActivity" |
103 | android:launchMode="singleTask" | 103 | android:launchMode="singleTask" |
104 | android:screenOrientation="landscape"> | 104 | android:screenOrientation="landscape"> |
105 | 105 | ||
106 | </activity> | 106 | </activity> |
107 | <activity | 107 | <activity |
108 | android:name=".activity.AccountManagementActivity" | 108 | android:name=".activity.AccountManagementActivity" |
109 | android:launchMode="singleTask" | 109 | android:launchMode="singleTask" |
110 | android:screenOrientation="landscape"> | 110 | android:screenOrientation="landscape"> |
111 | 111 | ||
112 | </activity> | 112 | </activity> |
113 | <activity | 113 | <activity |
114 | android:name=".activity.ChangePresonalInfoActivity" | 114 | android:name=".activity.ChangePresonalInfoActivity" |
115 | android:launchMode="singleTask" | 115 | android:launchMode="singleTask" |
116 | android:screenOrientation="landscape"> | 116 | android:screenOrientation="landscape"> |
117 | 117 | ||
118 | </activity> | 118 | </activity> |
119 | <activity | ||
120 | android:name=".activity.BangDingCode" | ||
121 | android:launchMode="singleTask" | ||
122 | android:screenOrientation="landscape"> | ||
123 | |||
124 | </activity> | ||
125 | <service | ||
126 | android:name="com.hjx.personalcenter.service.TestService" | ||
127 | android:process=":remote" | ||
128 | > | ||
129 | <intent-filter> | ||
130 | <action android:name="com.hjx.personalcenter.service.GetLoginInfoService"> | ||
131 | |||
132 | </action> | ||
133 | </intent-filter> | ||
134 | </service> | ||
135 | |||
119 | </application> | 136 | </application> |
120 | <!--权限--> | 137 | <!--权限--> |
121 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 138 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
122 | <uses-permission android:name="android.permission.CAMERA" /> | 139 | <uses-permission android:name="android.permission.CAMERA" /> |
123 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 140 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
124 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | 141 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
125 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 142 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
126 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 143 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
127 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 144 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
128 | <uses-permission android:name="android.permission.CALL_PHONE" /> | 145 | <uses-permission android:name="android.permission.CALL_PHONE" /> |
129 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 146 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
130 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | 147 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> |
131 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 148 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
132 | <uses-permission android:name="android.permission.INTERNET" /> | 149 | <uses-permission android:name="android.permission.INTERNET" /> |
133 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 150 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
134 | <uses-permission android:name="android.permission.READ_LOGS" /> | 151 | <uses-permission android:name="android.permission.READ_LOGS" /> |
135 | 152 | ||
136 | </manifest> | 153 | </manifest> |
PersonalCenter/app/src/main/aidl/com/hjx/personalcenter/service/IPresonalInterface.aidl
File was created | 1 | // IPresonalInterface.aidl | |
2 | package com.hjx.personalcenter.service; | ||
3 | |||
4 | // Declare any non-default types here with import statements | ||
5 | |||
6 | interface IPresonalInterface { | ||
7 | String sayHello(); | ||
8 | } | ||
9 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/BangDingCode.java
File was created | 1 | package com.hjx.personalcenter.activity; | |
2 | |||
3 | import android.app.Activity; | ||
4 | import android.graphics.Bitmap; | ||
5 | import android.os.Bundle; | ||
6 | import android.util.DisplayMetrics; | ||
7 | import android.widget.ImageView; | ||
8 | import android.widget.LinearLayout; | ||
9 | |||
10 | import com.hjx.personalcenter.R; | ||
11 | import com.hjx.personalcenter.util.FileUtil; | ||
12 | import com.hjx.personalcenter.util.QRCodeUtil; | ||
13 | |||
14 | import java.io.File; | ||
15 | |||
16 | /** | ||
17 | * Created by h on 2017/8/31. | ||
18 | */ | ||
19 | |||
20 | public class BangDingCode extends Activity{ | ||
21 | private ImageView EQpicture; | ||
22 | File file; | ||
23 | @Override | ||
24 | protected void onCreate(Bundle savedInstanceState) { | ||
25 | super.onCreate(savedInstanceState); | ||
26 | setContentView(R.layout.activity_binding_code); | ||
27 | EQpicture = (ImageView) findViewById(R.id.EQpicture); | ||
28 | EQPicture(); | ||
29 | |||
30 | |||
31 | } | ||
32 | public void EQPicture() { | ||
33 | DisplayMetrics dm = new DisplayMetrics(); | ||
34 | getWindowManager().getDefaultDisplay().getMetrics(dm); | ||
35 | int screenHeight = dm.heightPixels;//屏幕高度 | ||
36 | //设置二维码外布局占屏幕高宽 | ||
37 | LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) EQpicture.getLayoutParams(); | ||
38 | layoutParams.width = screenHeight * 17 / 30; | ||
39 | layoutParams.height = screenHeight * 19 / 30; | ||
40 | EQpicture.setLayoutParams(layoutParams); | ||
41 | //生成占屏幕一定比例 的二维码存储在本地并显示 | ||
42 | file = new File(FileUtil.getCachePath(this), "user-code.jpg"); | ||
43 | Bitmap bitmap = QRCodeUtil.createQRImage("www.baidu.com", screenHeight * 15 / 30, screenHeight * 15 / 30, null, file.getPath()); | ||
44 | if (bitmap != null) { | ||
45 | EQpicture.setImageBitmap(bitmap); | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 |
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.app.Activity; | 3 | import android.app.Activity; |
4 | import android.content.Intent; | ||
4 | import android.os.Bundle; | 5 | import android.os.Bundle; |
5 | import android.view.View; | 6 | import android.view.View; |
6 | import android.widget.Button; | 7 | import android.widget.Button; |
7 | import android.widget.ImageView; | 8 | import android.widget.ImageView; |
8 | import android.widget.TextView; | 9 | import android.widget.TextView; |
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 | import com.hjx.personalcenter.http.HttpManager; | 13 | import com.hjx.personalcenter.http.HttpManager; |
13 | import com.hjx.personalcenter.util.GetDevicesUtil; | 14 | import com.hjx.personalcenter.util.GetDevicesUtil; |
14 | 15 | ||
15 | /**确认保卡信息 | 16 | /**确认保卡信息 |
16 | * Created by h on 2017/8/11. | 17 | * Created by h on 2017/8/11. |
17 | */ | 18 | */ |
18 | 19 | ||
19 | public class ElectronicCardInfoOKActivity extends Activity implements View.OnClickListener { | 20 | public class ElectronicCardInfoOKActivity extends Activity implements View.OnClickListener { |
20 | private Button btn_finish; | 21 | private Button btn_finish,btn_bangding; |
21 | private ImageView iv_last_step; | 22 | private ImageView iv_last_step; |
22 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; | 23 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; |
23 | @Override | 24 | @Override |
24 | protected void onCreate(Bundle savedInstanceState) { | 25 | protected void onCreate(Bundle savedInstanceState) { |
25 | super.onCreate(savedInstanceState); | 26 | super.onCreate(savedInstanceState); |
26 | setContentView(R.layout.activity_ok_cardinfo); | 27 | setContentView(R.layout.activity_ok_cardinfo); |
27 | initView(); | 28 | initView(); |
28 | initData(); | 29 | initData(); |
29 | initLister(); | 30 | initLister(); |
30 | } | 31 | } |
31 | private void initView() { | 32 | private void initView() { |
32 | btn_finish = (Button) findViewById(R.id.btn_finish); | 33 | btn_finish = (Button) findViewById(R.id.btn_finish); |
33 | iv_last_step = (ImageView) findViewById(R.id.cancel); | 34 | iv_last_step = (ImageView) findViewById(R.id.cancel); |
34 | usename = (TextView) findViewById(R.id.iv_card_username); | 35 | usename = (TextView) findViewById(R.id.iv_card_username); |
35 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 36 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
36 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 37 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
37 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 38 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
38 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 39 | shoptime = (TextView) findViewById(R.id.tv_card_time); |
39 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 40 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
40 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 41 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
41 | phone = (TextView) findViewById(R.id.tv_card_phone); | 42 | phone = (TextView) findViewById(R.id.tv_card_phone); |
42 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 43 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
44 | btn_bangding = (Button) findViewById(R.id.btn_bangding); | ||
43 | } | 45 | } |
44 | 46 | ||
45 | private void initData() { | 47 | private void initData() { |
46 | //获取设备信息 | 48 | //获取设备信息 |
47 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 49 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
48 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 50 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
49 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 51 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
50 | //获取保卡信息 | 52 | //获取保卡信息 |
51 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | 53 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); |
52 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | 54 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); |
53 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | 55 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); |
54 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | 56 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); |
55 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | 57 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); |
56 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | 58 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); |
57 | 59 | ||
58 | 60 | ||
59 | } | 61 | } |
60 | 62 | ||
61 | private void initLister() { | 63 | private void initLister() { |
62 | iv_last_step.setOnClickListener(this); | 64 | iv_last_step.setOnClickListener(this); |
63 | btn_finish.setOnClickListener(this); | 65 | btn_finish.setOnClickListener(this); |
66 | btn_bangding.setOnClickListener(this); | ||
64 | } | 67 | } |
65 | 68 | ||
66 | @Override | 69 | @Override |
67 | public void onClick(View v) { | 70 | public void onClick(View v) { |
68 | switch (v.getId()){ | 71 | switch (v.getId()){ |
69 | case R.id.btn_finish: | 72 | case R.id.btn_finish: |
70 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 73 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
71 | long auserID = 0; | 74 | long auserID = 0; |
72 | try { | 75 | try { |
73 | auserID = Long.parseLong(userID); | 76 | auserID = Long.parseLong(userID); |
74 | } catch (NumberFormatException e) { | 77 | } catch (NumberFormatException e) { |
75 | e.printStackTrace(); | 78 | e.printStackTrace(); |
76 | } | 79 | } |
77 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), | 80 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), |
78 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), | 81 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), |
79 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), | 82 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), |
80 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), | 83 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), |
81 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | 84 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); |
82 | break; | 85 | break; |
86 | case R.id.btn_bangding: | ||
87 | Intent intent = new Intent(); | ||
88 | intent.setClass(ElectronicCardInfoOKActivity.this, BangDingCode.class); | ||
89 | startActivity(intent); | ||
90 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
91 | |||
92 | break; | ||
83 | case R.id.cancel: | 93 | case R.id.cancel: |
84 | finish(); | 94 | finish(); |
85 | break; | 95 | break; |
86 | } | 96 | } |
87 | } | 97 | } |
88 | 98 | ||
89 | 99 | ||
90 | } | 100 | } |
91 | 101 |
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.app.Activity; | 3 | import android.app.Activity; |
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.text.TextUtils; | 7 | import android.text.TextUtils; |
8 | import android.text.method.HideReturnsTransformationMethod; | 8 | import android.text.method.HideReturnsTransformationMethod; |
9 | import android.text.method.PasswordTransformationMethod; | 9 | import android.text.method.PasswordTransformationMethod; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.widget.Button; | 11 | import android.widget.Button; |
12 | import android.widget.EditText; | 12 | import android.widget.EditText; |
13 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
14 | 14 | ||
15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.http.HttpCode; | 16 | import com.hjx.personalcenter.http.HttpCode; |
17 | import com.hjx.personalcenter.http.HttpManager; | 17 | import com.hjx.personalcenter.http.HttpManager; |
18 | import com.hjx.personalcenter.util.AlertUtils; | 18 | import com.hjx.personalcenter.util.AlertUtils; |
19 | import com.hjx.personalcenter.util.Judgment; | 19 | import com.hjx.personalcenter.util.Judgment; |
20 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 20 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
22 | 22 | ||
23 | import org.json.JSONException; | 23 | import org.json.JSONException; |
24 | import org.json.JSONObject; | 24 | import org.json.JSONObject; |
25 | 25 | ||
26 | /**忘记密码 | 26 | /** |
27 | * 忘记密码 | ||
27 | * Created by h on 2017/6/17. | 28 | * Created by h on 2017/6/17. |
28 | */ | 29 | */ |
29 | 30 | ||
30 | public class ForgotPasswordActivity extends Activity implements View.OnClickListener { | 31 | public class ForgotPasswordActivity extends Activity implements View.OnClickListener { |
31 | private ImageView back_forgit,iv_pwd_change; | 32 | private ImageView back_forgit, iv_pwd_change; |
32 | private EditText forot_pwd_phone,forot_pwd_anthcode,forot_pwd_pwd,forot_pwd_pwd2; | 33 | private EditText forot_pwd_phone, forot_pwd_anthcode, forot_pwd_pwd, forot_pwd_pwd2; |
33 | private Button forot_pwd_sub,forot_pwd_getanthcode; | 34 | private Button forot_pwd_sub, forot_pwd_getanthcode; |
34 | private String forot_pwd_phone1; | 35 | private String forot_pwd_phone1; |
35 | private String forot_pwd_anthcode1; | 36 | private String forot_pwd_anthcode1; |
36 | private String forot_pwd_pwd3; | 37 | private String forot_pwd_pwd3; |
37 | private String forot_pwd_pwd4; | 38 | private String forot_pwd_pwd4; |
38 | private String typeStr = "login"; | 39 | private String typeStr = "login"; |
39 | private int i = 0; | 40 | private int i = 0; |
40 | private Thread thread; | 41 | private Thread thread; |
41 | public static Boolean showPassword = false; | 42 | public static Boolean showPassword = false; |
42 | 43 | ||
43 | Handler handler = new Handler() { | 44 | Handler handler = new Handler() { |
44 | @Override | 45 | @Override |
45 | public void handleMessage(Message msg) { | 46 | public void handleMessage(Message msg) { |
46 | super.handleMessage(msg); | 47 | super.handleMessage(msg); |
47 | try { | 48 | try { |
48 | JSONObject jsonObject; | 49 | JSONObject jsonObject; |
49 | String status; | 50 | String status; |
50 | switch (msg.what) { | 51 | switch (msg.what) { |
51 | case HttpCode.PASSWORD_SUCESS: | 52 | case HttpCode.PASSWORD_SUCESS: |
52 | jsonObject = (JSONObject) msg.obj; | 53 | jsonObject = (JSONObject) msg.obj; |
53 | status = jsonObject.getString("status"); | 54 | status = jsonObject.getString("status"); |
54 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 55 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
55 | if (status.equals("100")) { | 56 | if (status.equals("100")) { |
56 | AlertUtils.showToast(ForgotPasswordActivity.this,"密码修改成功"); | 57 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改成功"); |
57 | } | 58 | } |
58 | 59 | ||
59 | break; | 60 | break; |
60 | case HttpCode.PASSWORD_FAIL: | 61 | case HttpCode.PASSWORD_FAIL: |
61 | jsonObject = (JSONObject) msg.obj; | 62 | jsonObject = (JSONObject) msg.obj; |
62 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); | 63 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); |
63 | break; | 64 | break; |
64 | case HttpCode.AUTHCODE_SUCESS1: | 65 | case HttpCode.AUTHCODE_SUCESS1: |
65 | jsonObject = (JSONObject) msg.obj; | 66 | jsonObject = (JSONObject) msg.obj; |
66 | status = jsonObject.optString("status"); | 67 | status = jsonObject.optString("status"); |
67 | if (status.equals("100")) { | 68 | if (status.equals("100")) { |
68 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); | 69 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); |
69 | } | 70 | } |
70 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 71 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
71 | break; | 72 | break; |
72 | case HttpCode.AUTHCODE_FAIL1: | 73 | case HttpCode.AUTHCODE_FAIL1: |
73 | jsonObject = (JSONObject) msg.obj; | 74 | jsonObject = (JSONObject) msg.obj; |
74 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); | 75 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); |
75 | break; | 76 | break; |
76 | case HttpCode.IS_REFISTER: | 77 | case HttpCode.IS_REFISTER: |
77 | jsonObject = (JSONObject) msg.obj; | 78 | jsonObject = (JSONObject) msg.obj; |
78 | status = jsonObject.getString("status"); | 79 | status = jsonObject.getString("status"); |
79 | if (status.equals("true")) { | 80 | if (status.equals("true")) { |
80 | getauthcode(); | 81 | getauthcode(); |
81 | // i = 60; | ||
82 | // new Thread(new ForgotPassword.ThreadShow()).start(); | ||
83 | 82 | ||
84 | }else { | 83 | } else { |
85 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); | 84 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); |
86 | } | 85 | } |
87 | break; | 86 | break; |
88 | case 1: | 87 | case 1: |
89 | forot_pwd_getanthcode.setEnabled(false); | 88 | forot_pwd_getanthcode.setEnabled(false); |
90 | forot_pwd_getanthcode.setClickable(false); | 89 | forot_pwd_getanthcode.setClickable(false); |
91 | forot_pwd_getanthcode.setText(Integer.toString(i--)+" s"); | 90 | forot_pwd_getanthcode.setText(Integer.toString(i--) + " s"); |
92 | if (i<=0){ | 91 | if (i <= 0) { |
93 | forot_pwd_getanthcode.setEnabled(true); | 92 | forot_pwd_getanthcode.setEnabled(true); |
94 | forot_pwd_getanthcode.setClickable(true); | 93 | forot_pwd_getanthcode.setClickable(true); |
95 | forot_pwd_getanthcode.setText("获取验证码"); | 94 | forot_pwd_getanthcode.setText("获取验证码"); |
96 | 95 | ||
97 | } | 96 | } |
98 | break; | 97 | break; |
99 | } | 98 | } |
100 | } catch (JSONException e) { | 99 | } catch (JSONException e) { |
101 | e.printStackTrace(); | 100 | e.printStackTrace(); |
102 | } | 101 | } |
103 | } | 102 | } |
104 | }; | 103 | }; |
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_forgetpsword); | 108 | setContentView(R.layout.activity_forgetpsword); |
109 | initView(); | 109 | initView(); |
110 | setLister(); | 110 | setLister(); |
111 | } | 111 | } |
112 | |||
112 | //获取验证码 | 113 | //获取验证码 |
113 | private void getauthcode() { | 114 | private void getauthcode() { |
114 | forot_pwd_anthcode.requestFocus(); | 115 | forot_pwd_anthcode.requestFocus(); |
115 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); | 116 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); |
116 | i = 60; | 117 | i = 60; |
117 | if(thread == null){ | 118 | if (thread == null) { |
118 | thread = new Thread( new ThreadShow()); | 119 | thread = new Thread(new ThreadShow()); |
119 | thread.start(); | 120 | thread.start(); |
121 | |||
120 | } | 122 | } |
121 | 123 | ||
122 | } | 124 | } |
123 | 125 | ||
124 | private void initView() { | 126 | private void initView() { |
125 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); | 127 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); |
126 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); | 128 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); |
127 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); | 129 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); |
128 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); | 130 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); |
129 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); | 131 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); |
130 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); | 132 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); |
131 | iv_pwd_change=(ImageView) findViewById(R.id.iv_pwd_change); | 133 | iv_pwd_change = (ImageView) findViewById(R.id.iv_pwd_change); |
132 | back_forgit= (ImageView) findViewById(R.id.cancel); | 134 | back_forgit = (ImageView) findViewById(R.id.cancel); |
133 | } | 135 | } |
136 | |||
134 | private void setLister() { | 137 | private void setLister() { |
135 | iv_pwd_change.setOnClickListener(this); | 138 | iv_pwd_change.setOnClickListener(this); |
136 | back_forgit.setOnClickListener(this); | 139 | back_forgit.setOnClickListener(this); |
137 | forot_pwd_sub.setOnClickListener(this); | 140 | forot_pwd_sub.setOnClickListener(this); |
138 | forot_pwd_getanthcode.setOnClickListener(this); | 141 | forot_pwd_getanthcode.setOnClickListener(this); |
139 | 142 | ||
140 | } | 143 | } |
141 | 144 | ||
142 | 145 | ||
143 | @Override | 146 | @Override |
144 | public void onClick(View view) { | 147 | public void onClick(View view) { |
145 | switch (view.getId()){ | 148 | switch (view.getId()) { |
146 | case R.id.btn_ok: | 149 | case R.id.btn_ok: |
147 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 150 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
148 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); | 151 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); |
149 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); | 152 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); |
150 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); | 153 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); |
151 | if (TextUtils.isEmpty(forot_pwd_phone1)|| | 154 | if (TextUtils.isEmpty(forot_pwd_phone1) || |
152 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ | 155 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)) { |
153 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); | 156 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); |
154 | return; | 157 | return; |
155 | }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ | 158 | } else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)) { |
156 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); | 159 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); |
157 | 160 | ||
158 | } | 161 | } else if (forot_pwd_pwd3.length() < 8 || forot_pwd_pwd4.length() < 8) { |
159 | else if(forot_pwd_pwd3.length()<8||forot_pwd_pwd4.length()<8){ | ||
160 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); | 162 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); |
161 | }else if(!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)||!forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ | 163 | } else if (!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER) || !forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)) { |
162 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); | 164 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); |
163 | } | 165 | } else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)) { |
164 | else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)){ | ||
165 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); | 166 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); |
166 | return; | 167 | return; |
167 | }else { | 168 | } else { |
168 | //忘记密码接口 | 169 | //忘记密码接口 |
169 | HttpManager.getInstance().forgetpassword(this,forot_pwd_phone1,forot_pwd_pwd3,forot_pwd_anthcode1,handler); | 170 | HttpManager.getInstance().forgetpassword(this, forot_pwd_phone1, forot_pwd_pwd3, forot_pwd_anthcode1, handler); |
170 | } | 171 | } |
171 | break; | 172 | break; |
172 | case R.id.btn_authcode: | 173 | case R.id.btn_authcode: |
173 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 174 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
174 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ | 175 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)) { |
175 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); | 176 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); |
176 | }else { | 177 | } else { |
177 | forot_pwd_anthcode.requestFocus(); | 178 | forot_pwd_anthcode.requestFocus(); |
178 | ifregister(); | 179 | ifregister(); |
179 | 180 | ||
180 | } | 181 | } |
181 | 182 | ||
182 | break; | 183 | break; |
183 | case R.id.iv_pwd_change: | 184 | case R.id.iv_pwd_change: |
184 | if(showPassword){//显示密码 | 185 | if (showPassword) {//显示密码 |
185 | showPassword = !showPassword; | 186 | showPassword = !showPassword; |
186 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); | 187 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); |
187 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 188 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
188 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 189 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
189 | }else{//隐藏密码 | 190 | } else {//隐藏密码 |
190 | showPassword = !showPassword; | 191 | showPassword = !showPassword; |
191 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); | 192 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); |
192 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 193 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
193 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 194 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
194 | } | 195 | } |
195 | break; | 196 | break; |
196 | 197 | ||
197 | case R.id.cancel: | 198 | case R.id.cancel: |
198 | finish(); | 199 | finish(); |
199 | break; | 200 | break; |
200 | } | 201 | } |
201 | } | 202 | } |
203 | |||
202 | //是否注册 | 204 | //是否注册 |
203 | private void ifregister() { | 205 | private void ifregister() { |
204 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 206 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
205 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); | 207 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); |
206 | } | 208 | } |
209 | |||
207 | // 线程类 定时器 | 210 | // 线程类 定时器 |
208 | class ThreadShow implements Runnable { | 211 | class ThreadShow implements Runnable { |
209 | 212 | ||
210 | @Override | 213 | @Override |
211 | public void run() { | 214 | public void run() { |
212 | // TODO Auto-generated method stub | 215 | // TODO Auto-generated method stub |
213 | while (true) { | 216 | while (true) { |
214 | try { | 217 | try { |
215 | Thread.sleep(1000); | 218 | Thread.sleep(1000); |
219 | // thread.interrupt(); | ||
216 | Message msg = new Message(); | 220 | Message msg = new Message(); |
217 | msg.what = 1; | 221 | msg.what = 1; |
218 | handler.sendMessage(msg); | 222 | handler.sendMessage(msg); |
219 | System.out.println("send..."); | 223 | System.out.println("内存泄露..."); |
220 | } catch (Exception e) { | 224 | } catch (Exception e) { |
221 | // TODO Auto-generated catch block | 225 | // TODO Auto-generated catch block |
222 | e.printStackTrace(); | 226 | e.printStackTrace(); |
223 | System.out.println("thread error..."); | 227 | System.out.println("thread error..."); |
224 | } | 228 | } |
225 | } | 229 | } |
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.content.Context; | 3 | import android.content.Context; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
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.os.Handler; | 9 | import android.os.Handler; |
10 | import android.os.Message; | 10 | import android.os.Message; |
11 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
12 | import android.support.annotation.NonNull; | 12 | import android.support.annotation.NonNull; |
13 | import android.support.v4.content.FileProvider; | 13 | import android.support.v4.content.FileProvider; |
14 | import android.support.v7.app.AppCompatActivity; | 14 | import android.support.v7.app.AppCompatActivity; |
15 | import android.support.v7.widget.LinearLayoutManager; | 15 | import android.support.v7.widget.LinearLayoutManager; |
16 | import android.support.v7.widget.RecyclerView; | 16 | import android.support.v7.widget.RecyclerView; |
17 | import android.view.KeyEvent; | 17 | import android.view.KeyEvent; |
18 | import android.view.View; | 18 | import android.view.View; |
19 | import android.widget.ImageView; | 19 | import android.widget.ImageView; |
20 | import android.widget.LinearLayout; | 20 | import android.widget.LinearLayout; |
21 | import android.widget.TextView; | 21 | import android.widget.TextView; |
22 | import android.widget.Toast; | 22 | import android.widget.Toast; |
23 | 23 | ||
24 | import com.facebook.drawee.backends.pipeline.Fresco; | 24 | import com.facebook.drawee.backends.pipeline.Fresco; |
25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
27 | import com.facebook.drawee.generic.RoundingParams; | 27 | import com.facebook.drawee.generic.RoundingParams; |
28 | import com.facebook.drawee.interfaces.DraweeController; | 28 | import com.facebook.drawee.interfaces.DraweeController; |
29 | import com.facebook.drawee.view.SimpleDraweeView; | 29 | import com.facebook.drawee.view.SimpleDraweeView; |
30 | import com.hjx.personalcenter.R; | 30 | import com.hjx.personalcenter.R; |
31 | import com.hjx.personalcenter.adapter.GalleryAdapter; | 31 | import com.hjx.personalcenter.adapter.GalleryAdapter; |
32 | import com.hjx.personalcenter.customdialog.HeadDialog; | 32 | import com.hjx.personalcenter.customdialog.HeadDialog; |
33 | import com.hjx.personalcenter.db.SaveParam; | 33 | import com.hjx.personalcenter.db.SaveParam; |
34 | import com.hjx.personalcenter.http.HttpCode; | 34 | import com.hjx.personalcenter.http.HttpCode; |
35 | import com.hjx.personalcenter.http.HttpManager; | 35 | import com.hjx.personalcenter.http.HttpManager; |
36 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 36 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
37 | import com.hjx.personalcenter.model.PesonalInfo; | 37 | import com.hjx.personalcenter.model.PesonalInfo; |
38 | import com.hjx.personalcenter.model.SignInfo; | 38 | import com.hjx.personalcenter.model.SignInfo; |
39 | import com.hjx.personalcenter.update.UpdateChecker; | 39 | import com.hjx.personalcenter.update.UpdateChecker; |
40 | import com.hjx.personalcenter.util.AlertUtils; | 40 | import com.hjx.personalcenter.util.AlertUtils; |
41 | import com.hjx.personalcenter.util.CropUtils; | 41 | import com.hjx.personalcenter.util.CropUtils; |
42 | import com.hjx.personalcenter.util.DialogPermission; | 42 | import com.hjx.personalcenter.util.DialogPermission; |
43 | import com.hjx.personalcenter.util.FileUtil; | 43 | import com.hjx.personalcenter.util.FileUtil; |
44 | import com.hjx.personalcenter.util.PermissionUtil; | 44 | import com.hjx.personalcenter.util.PermissionUtil; |
45 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 45 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
46 | import com.mylhyl.circledialog.CircleDialog; | 46 | import com.mylhyl.circledialog.CircleDialog; |
47 | import com.mylhyl.circledialog.callback.ConfigInput; | 47 | import com.mylhyl.circledialog.callback.ConfigInput; |
48 | import com.mylhyl.circledialog.params.InputParams; | 48 | import com.mylhyl.circledialog.params.InputParams; |
49 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 49 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
50 | import com.zaaach.toprightmenu.MenuItem; | 50 | import com.zaaach.toprightmenu.MenuItem; |
51 | import com.zaaach.toprightmenu.TopRightMenu; | 51 | import com.zaaach.toprightmenu.TopRightMenu; |
52 | 52 | ||
53 | import java.io.File; | 53 | import java.io.File; |
54 | import java.util.ArrayList; | 54 | import java.util.ArrayList; |
55 | import java.util.Arrays; | 55 | import java.util.Arrays; |
56 | import java.util.List; | 56 | import java.util.List; |
57 | 57 | ||
58 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 58 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
59 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; | 59 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; |
60 | private TextView tv_edit_presoninfo, tv_sign, | 60 | private TextView tv_edit_presoninfo, tv_sign, |
61 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 61 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
62 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; | 62 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; |
63 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; | 63 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; |
64 | private TopRightMenu mTopRightMenu; | 64 | private TopRightMenu mTopRightMenu; |
65 | //水平滑动 | 65 | //水平滑动 |
66 | private RecyclerView mRecyclerView; | 66 | private RecyclerView mRecyclerView; |
67 | private GalleryAdapter RecyclerViewadapter; | 67 | private GalleryAdapter RecyclerViewadapter; |
68 | private List<Integer> mDatas = new ArrayList<Integer>(Arrays.asList(R.mipmap.default_avatar2, | 68 | private List<Integer> mDatas = new ArrayList<Integer>(Arrays.asList(R.mipmap.default_avatar2, |
69 | R.mipmap.default_avatar2, R.mipmap.default_avatar2, R.mipmap.default_avatar2)); | 69 | R.mipmap.default_avatar2, R.mipmap.default_avatar2, R.mipmap.default_avatar2)); |
70 | private boolean showIcon = true; | 70 | private boolean showIcon = true; |
71 | private boolean dimBg = true; | 71 | private boolean dimBg = true; |
72 | private boolean needAnim = true; | 72 | private boolean needAnim = true; |
73 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 73 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
74 | private static final int REQUEST_CODE_ALBUM = 2; | 74 | private static final int REQUEST_CODE_ALBUM = 2; |
75 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 75 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
76 | SimpleDraweeView mSimpleDraweeView; | 76 | SimpleDraweeView mSimpleDraweeView; |
77 | private File file; | 77 | private File file; |
78 | private Uri uri; | 78 | private Uri uri; |
79 | Handler handler = new Handler(){ | 79 | Handler handler = new Handler(){ |
80 | @Override | 80 | @Override |
81 | public void handleMessage(Message msg) { | 81 | public void handleMessage(Message msg) { |
82 | super.handleMessage(msg); | 82 | super.handleMessage(msg); |
83 | switch (msg.what){ | 83 | switch (msg.what){ |
84 | case HttpCode.GETINFO: | 84 | case HttpCode.GETINFO: |
85 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; | 85 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; |
86 | tv_username.setText(cardinfoBean.getNickName()); | 86 | tv_username.setText(cardinfoBean.getNickName()); |
87 | tv_username1.setText(cardinfoBean.getNickName()); | 87 | tv_username1.setText(cardinfoBean.getNickName()); |
88 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 88 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
89 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 89 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
90 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 90 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
91 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 91 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
92 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 92 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
93 | String sex = cardinfoBean.getGender(); | 93 | String sex = cardinfoBean.getGender(); |
94 | if ("0".equals(sex)){ | 94 | if ("0".equals(sex)){ |
95 | tv_sex.setText("男"); | 95 | tv_sex.setText("男"); |
96 | iv_sex.setImageResource(R.mipmap.men); | 96 | iv_sex.setImageResource(R.mipmap.men); |
97 | }else { | 97 | }else { |
98 | tv_sex.setText("女"); | 98 | tv_sex.setText("女"); |
99 | iv_sex.setImageResource(R.mipmap.women); | 99 | iv_sex.setImageResource(R.mipmap.women); |
100 | } | 100 | } |
101 | break; | 101 | break; |
102 | case HttpCode.SIGN: | 102 | case HttpCode.SIGN: |
103 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; | 103 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; |
104 | if (dataBean.getSignature()==null){ | 104 | if (dataBean.getSignature()==null){ |
105 | tv_sign.setText("你还未设置个性签名"); | 105 | tv_sign.setText("你还未设置个性签名"); |
106 | }else { | 106 | }else { |
107 | tv_sign.setText(dataBean.getSignature()); | 107 | tv_sign.setText(dataBean.getSignature()); |
108 | } | 108 | } |
109 | 109 | ||
110 | break; | 110 | break; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | }; | 113 | }; |
114 | 114 | ||
115 | @Override | 115 | @Override |
116 | protected void onCreate(Bundle savedInstanceState) { | 116 | protected void onCreate(Bundle savedInstanceState) { |
117 | super.onCreate(savedInstanceState); | 117 | super.onCreate(savedInstanceState); |
118 | Fresco.initialize(this); | 118 | Fresco.initialize(this); |
119 | setContentView(R.layout.activity_main); | 119 | setContentView(R.layout.activity_main); |
120 | initView(); | 120 | initView(); |
121 | initData(); | 121 | initData(); |
122 | initLister(); | 122 | initLister(); |
123 | updateVersion(); | 123 | updateVersion(); |
124 | } | 124 | } |
125 | //////版本更新 | 125 | //////版本更新 |
126 | private void updateVersion() { | 126 | private void updateVersion() { |
127 | UpdateChecker updateChecker = new UpdateChecker(this); | 127 | UpdateChecker updateChecker = new UpdateChecker(this); |
128 | updateChecker.checkForUpdates(); | 128 | updateChecker.checkForUpdates(); |
129 | 129 | ||
130 | 130 | ||
131 | } | 131 | } |
132 | 132 | ||
133 | private void initView() { | 133 | private void initView() { |
134 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 134 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
135 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); | 135 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); |
136 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); | 136 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); |
137 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 137 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
138 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 138 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
139 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 139 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
140 | //头像 | 140 | //头像 |
141 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 141 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
142 | //初始化个人信息 | 142 | //初始化个人信息 |
143 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 143 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
144 | tv_username = (TextView) findViewById(R.id.tv_username); | 144 | tv_username = (TextView) findViewById(R.id.tv_username); |
145 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 145 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
146 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 146 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
147 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 147 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
148 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 148 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
149 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 149 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
150 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 150 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
151 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 151 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
152 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 152 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
153 | //跳转其他应用 | 153 | //跳转其他应用 |
154 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); | 154 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); |
155 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); | 155 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); |
156 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); | 156 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); |
157 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); | 157 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); |
158 | // | 158 | // |
159 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 159 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
160 | 160 | ||
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | private void initData() { | 164 | private void initData() { |
165 | //加载最近学习视频 | 165 | //加载最近学习视频 |
166 | 166 | ||
167 | 167 | ||
168 | //设置布局管理器 | 168 | //设置布局管理器 |
169 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 169 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
170 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 170 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
171 | mRecyclerView.setLayoutManager(linearLayoutManager); | 171 | mRecyclerView.setLayoutManager(linearLayoutManager); |
172 | //设置适配器 | 172 | //设置适配器 |
173 | RecyclerViewadapter = new GalleryAdapter(this, mDatas); | 173 | RecyclerViewadapter = new GalleryAdapter(this, mDatas); |
174 | mRecyclerView.setAdapter(RecyclerViewadapter); | 174 | mRecyclerView.setAdapter(RecyclerViewadapter); |
175 | 175 | ||
176 | //加载个人信息 | 176 | //加载个人信息 |
177 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); | 177 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); |
178 | if (xiongzuo==null){ | 178 | if (xiongzuo==null){ |
179 | tv_mygad.setText(""); | 179 | tv_mygad.setText(""); |
180 | }else { | 180 | }else { |
181 | tv_mygad.setText(xiongzuo); | 181 | tv_mygad.setText(xiongzuo); |
182 | } | 182 | } |
183 | //加载版本信息 | 183 | //加载版本信息 |
184 | 184 | ||
185 | 185 | ||
186 | //获取个性签名 | 186 | //获取个性签名 |
187 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 187 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
188 | String typeaccount = SaveParam.getInstance().getLoginParam(this,SaveParam.ACCOUNT); | ||
188 | try { | 189 | try { |
189 | long auserID = Long.parseLong(userID); | 190 | long auserID = Long.parseLong(userID); |
190 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,handler); | 191 | int typeaccount1=Integer.parseInt(typeaccount); |
192 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,typeaccount1,handler); | ||
191 | 193 | ||
192 | } catch (NumberFormatException e) { | 194 | } catch (NumberFormatException e) { |
193 | e.printStackTrace(); | 195 | e.printStackTrace(); |
194 | } | 196 | } |
195 | 197 | ||
196 | 198 | ||
197 | 199 | ||
198 | //初始化图片 | 200 | //初始化图片 |
199 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 201 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
200 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 202 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
201 | uri = Uri.fromFile(file); | 203 | uri = Uri.fromFile(file); |
202 | } else { | 204 | } else { |
203 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 205 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
204 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 206 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
205 | } | 207 | } |
206 | 208 | ||
207 | } | 209 | } |
208 | 210 | ||
209 | private void initLister() { | 211 | private void initLister() { |
210 | iv_imformatioan.setOnClickListener(this); | 212 | iv_imformatioan.setOnClickListener(this); |
211 | iv_look_card.setOnClickListener(this); | 213 | iv_look_card.setOnClickListener(this); |
212 | tv_edit_presoninfo.setOnClickListener(this); | 214 | tv_edit_presoninfo.setOnClickListener(this); |
213 | iv_setting.setOnClickListener(this); | 215 | iv_setting.setOnClickListener(this); |
214 | iv_sign.setOnClickListener(this); | 216 | iv_sign.setOnClickListener(this); |
215 | mSimpleDraweeView.setOnClickListener(this); | 217 | mSimpleDraweeView.setOnClickListener(this); |
216 | linel_mycuoti.setOnClickListener(this); | 218 | linel_mycuoti.setOnClickListener(this); |
217 | linel_mynote.setOnClickListener(this); | 219 | linel_mynote.setOnClickListener(this); |
218 | linel_mycollege.setOnClickListener(this); | 220 | linel_mycollege.setOnClickListener(this); |
219 | linel_myclass.setOnClickListener(this); | 221 | linel_myclass.setOnClickListener(this); |
220 | 222 | ||
221 | } | 223 | } |
222 | 224 | ||
223 | @Override | 225 | @Override |
224 | public void onClick(View v) { | 226 | public void onClick(View v) { |
225 | switch (v.getId()) { | 227 | switch (v.getId()) { |
226 | case R.id.iv_imformatioan: | 228 | case R.id.iv_imformatioan: |
227 | Intent intent = new Intent(); | 229 | Intent intent = new Intent(); |
228 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 230 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
229 | startActivity(intent); | 231 | startActivity(intent); |
230 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 232 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
231 | break; | 233 | break; |
232 | case R.id.iv_look_card: | 234 | case R.id.iv_look_card: |
233 | Intent lookintent = new Intent(); | 235 | Intent lookintent = new Intent(); |
234 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 236 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
235 | startActivity(lookintent); | 237 | startActivity(lookintent); |
236 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 238 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
237 | break; | 239 | break; |
238 | case R.id.tv_edit_presoninfo: | 240 | case R.id.tv_edit_presoninfo: |
239 | Intent editintent = new Intent(); | 241 | Intent editintent = new Intent(); |
240 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 242 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
241 | startActivity(editintent); | 243 | startActivity(editintent); |
242 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 244 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
243 | break; | 245 | break; |
244 | case R.id.iv_head: | 246 | case R.id.iv_head: |
245 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 247 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
246 | break; | 248 | break; |
247 | case R.id.iv_setting: | 249 | case R.id.iv_setting: |
248 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 250 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
249 | List<MenuItem> menuItems = new ArrayList<>(); | 251 | List<MenuItem> menuItems = new ArrayList<>(); |
250 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 252 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); |
251 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 253 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); |
252 | mTopRightMenu | 254 | mTopRightMenu |
253 | .setHeight(150) //默认高度480 | 255 | .setHeight(150) //默认高度480 |
254 | .setWidth(320) //默认宽度wrap_content | 256 | .setWidth(320) //默认宽度wrap_content |
255 | .showIcon(showIcon) //显示菜单图标,默认为true | 257 | .showIcon(showIcon) //显示菜单图标,默认为true |
256 | .dimBackground(dimBg) //背景变暗,默认为true | 258 | .dimBackground(dimBg) //背景变暗,默认为true |
257 | .needAnimationStyle(needAnim) //显示动画,默认为true | 259 | .needAnimationStyle(needAnim) //显示动画,默认为true |
258 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 260 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
259 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 261 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
260 | @Override | 262 | @Override |
261 | public void onMenuItemClick(int position) { | 263 | public void onMenuItemClick(int position) { |
262 | switch (position) { | 264 | switch (position) { |
263 | case 0: | 265 | case 0: |
264 | //清除数据 | 266 | //清除数据 |
265 | SaveParam.getInstance().clearData(MainActivity.this); | 267 | SaveParam.getInstance().clearData(MainActivity.this); |
266 | Intent settingintent = new Intent(); | 268 | Intent settingintent = new Intent(); |
267 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 269 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
268 | startActivity(settingintent); | 270 | startActivity(settingintent); |
269 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 271 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
272 | finish(); | ||
270 | break; | 273 | break; |
271 | case 1: | 274 | case 1: |
272 | Intent accontMintent = new Intent(); | 275 | Intent accontMintent = new Intent(); |
273 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 276 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
274 | startActivity(accontMintent); | 277 | startActivity(accontMintent); |
275 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 278 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
276 | break; | 279 | break; |
277 | } | 280 | } |
278 | } | 281 | } |
279 | }) | 282 | }) |
280 | .addMenuList(menuItems) | 283 | .addMenuList(menuItems) |
281 | .showAsDropDown(iv_setting, -250, 0); | 284 | .showAsDropDown(iv_setting, -250, 0); |
282 | break; | 285 | break; |
283 | case R.id.iv_sign: | 286 | case R.id.iv_sign: |
284 | new CircleDialog.Builder(this) | 287 | new CircleDialog.Builder(this) |
285 | .setCanceledOnTouchOutside(false) | 288 | .setCanceledOnTouchOutside(false) |
286 | .setCancelable(true) | 289 | .setCancelable(true) |
287 | .setTitle("个性签名") | 290 | .setTitle("个性签名") |
288 | .setInputHint("请输入个性签名") | 291 | .setInputHint("请输入个性签名") |
289 | .setWidth(0.5f) | 292 | .setWidth(0.5f) |
290 | .configInput(new ConfigInput() { | 293 | .configInput(new ConfigInput() { |
291 | @Override | 294 | @Override |
292 | public void onConfig(InputParams params) { | 295 | public void onConfig(InputParams params) { |
293 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 296 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
294 | } | 297 | } |
295 | }) | 298 | }) |
296 | .setNegative("取消", null) | 299 | .setNegative("取消", null) |
297 | .setPositiveInput("确定", new OnInputClickListener() { | 300 | .setPositiveInput("确定", new OnInputClickListener() { |
298 | @Override | 301 | @Override |
299 | public void onClick(String text, View v) { | 302 | public void onClick(String text, View v) { |
300 | if (text.equals("")) { | 303 | if (text.equals("")) { |
301 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 304 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
302 | } else { | 305 | } else { |
303 | try { | 306 | try { |
307 | String typeaccount = SaveParam.getInstance().getLoginParam(MainActivity.this,SaveParam.ACCOUNT); | ||
304 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); | 308 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); |
305 | long auserID = Long.parseLong(userID); | 309 | long auserID = Long.parseLong(userID); |
306 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,text); | 310 | int typeaccount1=Integer.parseInt(typeaccount); |
311 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,typeaccount1,text); | ||
307 | } catch (NumberFormatException e) { | 312 | } catch (NumberFormatException e) { |
308 | e.printStackTrace(); | 313 | e.printStackTrace(); |
309 | } | 314 | } |
310 | 315 | ||
311 | tv_sign.setText(text); | 316 | tv_sign.setText(text); |
312 | } | 317 | } |
313 | 318 | ||
314 | } | 319 | } |
315 | }) | 320 | }) |
316 | .show(); | 321 | .show(); |
317 | break; | 322 | break; |
318 | case R.id.linel_mycuoti: | 323 | case R.id.linel_mycuoti: |
319 | AlertUtils.showToast(this, "hhahahah "); | 324 | AlertUtils.showToast(this, "hhahahah "); |
320 | break; | 325 | break; |
321 | case R.id.linel_mynote: | 326 | case R.id.linel_mynote: |
322 | AlertUtils.showToast(this, "hhahahah "); | 327 | AlertUtils.showToast(this, "hhahahah "); |
323 | break; | 328 | break; |
324 | case R.id.linel_mycollege: | 329 | case R.id.linel_mycollege: |
325 | AlertUtils.showToast(this, "hhahahah "); | 330 | AlertUtils.showToast(this, "hhahahah "); |
326 | break; | 331 | break; |
327 | case R.id.linel_myclass: | 332 | case R.id.linel_myclass: |
328 | AlertUtils.showToast(this, "hhahahah "); | 333 | AlertUtils.showToast(this, "hhahahah "); |
329 | break; | 334 | break; |
330 | } | 335 | } |
331 | 336 | ||
332 | } | 337 | } |
333 | 338 | ||
334 | @Override | 339 | @Override |
335 | protected void onResume() { | 340 | protected void onResume() { |
336 | super.onResume(); | 341 | super.onResume(); |
337 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 342 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
343 | String typeaccount = SaveParam.getInstance().getLoginParam(this,SaveParam.ACCOUNT); | ||
338 | try { | 344 | try { |
339 | long auserID = Long.parseLong(userID); | 345 | long auserID = Long.parseLong(userID); |
346 | int typeaccount1=Integer.parseInt(typeaccount); | ||
340 | //获取个人信息 | 347 | //获取个人信息 |
341 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,handler); | 348 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,typeaccount1,handler); |
342 | 349 | ||
343 | } catch (NumberFormatException e) { | 350 | } catch (NumberFormatException e) { |
344 | e.printStackTrace(); | 351 | e.printStackTrace(); |
345 | } | 352 | } |
346 | 353 | ||
347 | } | 354 | } |
348 | 355 | ||
349 | //回调头像监听 | 356 | //回调头像监听 |
350 | @Override | 357 | @Override |
351 | public void heard(Context context, View v,int headpitiaon) { | 358 | public void heard(Context context, View v,int headpitiaon) { |
352 | String picUrl; | 359 | String picUrl; |
353 | switch (v.getId()){ | 360 | switch (v.getId()){ |
354 | //选择默认图片 | 361 | //选择默认图片 |
355 | case R.id.oktakephone: | 362 | case R.id.oktakephone: |
356 | if (headpitiaon==1){ | 363 | if (headpitiaon==1){ |
357 | mSimpleDraweeView.setImageDrawable(null); | 364 | mSimpleDraweeView.setImageDrawable(null); |
358 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 365 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
359 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; | 366 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; |
360 | }else if (headpitiaon==2){ | 367 | }else if (headpitiaon==2){ |
361 | mSimpleDraweeView.setImageDrawable(null); | 368 | mSimpleDraweeView.setImageDrawable(null); |
362 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 369 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
363 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; | 370 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; |
364 | }else if (headpitiaon==3){ | 371 | }else if (headpitiaon==3){ |
365 | mSimpleDraweeView.setImageDrawable(null); | 372 | mSimpleDraweeView.setImageDrawable(null); |
366 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 373 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
367 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; | 374 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; |
368 | }else if (headpitiaon==4){ | 375 | }else if (headpitiaon==4){ |
369 | mSimpleDraweeView.setImageDrawable(null); | 376 | mSimpleDraweeView.setImageDrawable(null); |
370 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 377 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
371 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png "; | 378 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png "; |
372 | }else if (headpitiaon==0){ | 379 | }else if (headpitiaon==0){ |
373 | AlertUtils.showToast(this, "你还没有设置头像 "); | 380 | AlertUtils.showToast(this, "你还没有设置头像 "); |
374 | } | 381 | } |
375 | break; | 382 | break; |
376 | case R.id.canceltakephone: | 383 | case R.id.canceltakephone: |
377 | 384 | ||
378 | break; | 385 | break; |
379 | //拍摄和相册 | 386 | //拍摄和相册 |
380 | case R.id.take_pic: | 387 | case R.id.take_pic: |
381 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 388 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
382 | uploadAvatarFromPhotoRequest(); | 389 | uploadAvatarFromPhotoRequest(); |
383 | } | 390 | } |
384 | 391 | ||
385 | break; | 392 | break; |
386 | case R.id.xiangce: | 393 | case R.id.xiangce: |
387 | uploadAvatarFromAlbumRequest(); | 394 | uploadAvatarFromAlbumRequest(); |
388 | break; | 395 | break; |
389 | 396 | ||
390 | } | 397 | } |
391 | 398 | ||
392 | } | 399 | } |
393 | 400 | ||
394 | //照相 | 401 | //照相 |
395 | private void uploadAvatarFromPhotoRequest() { | 402 | private void uploadAvatarFromPhotoRequest() { |
396 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 403 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
397 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 404 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
398 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 405 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
399 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 406 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
400 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 407 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
401 | } | 408 | } |
402 | 409 | ||
403 | //选择图库 | 410 | //选择图库 |
404 | private void uploadAvatarFromAlbumRequest() { | 411 | private void uploadAvatarFromAlbumRequest() { |
405 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 412 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
406 | photoPickerIntent.setType("image/*"); | 413 | photoPickerIntent.setType("image/*"); |
407 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 414 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
408 | } | 415 | } |
409 | //回掉 | 416 | //回掉 |
410 | @Override | 417 | @Override |
411 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 418 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
412 | super.onActivityResult(requestCode, resultCode, data); | 419 | super.onActivityResult(requestCode, resultCode, data); |
413 | if (resultCode != -1) { | 420 | if (resultCode != -1) { |
414 | return; | 421 | return; |
415 | } | 422 | } |
416 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 423 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
417 | Uri newUri; | 424 | Uri newUri; |
418 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 425 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
419 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 426 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
420 | } else { | 427 | } else { |
421 | newUri = data.getData(); | 428 | newUri = data.getData(); |
422 | } | 429 | } |
423 | if (newUri != null) { | 430 | if (newUri != null) { |
424 | startPhotoZoom(newUri); | 431 | startPhotoZoom(newUri); |
425 | } else { | 432 | } else { |
426 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 433 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
427 | } | 434 | } |
428 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 435 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
429 | startPhotoZoom(uri); | 436 | startPhotoZoom(uri); |
430 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 437 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
431 | uploadAvatarFromPhoto(); | 438 | uploadAvatarFromPhoto(); |
432 | } | 439 | } |
433 | } | 440 | } |
434 | 441 | ||
435 | private void uploadAvatarFromPhoto() { | 442 | private void uploadAvatarFromPhoto() { |
436 | compressAndUploadAvatar(file.getPath()); | 443 | compressAndUploadAvatar(file.getPath()); |
437 | 444 | ||
438 | } | 445 | } |
439 | private void compressAndUploadAvatar(String fileSrc) { | 446 | private void compressAndUploadAvatar(String fileSrc) { |
440 | 447 | ||
441 | 448 | ||
442 | //上传到服务器 | 449 | //上传到服务器 |
443 | 450 | ||
444 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 451 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
445 | String mimeType = "image/*"; | 452 | String mimeType = "image/*"; |
446 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 453 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
447 | //String fileName = cover.getName(); | 454 | //String fileName = cover.getName(); |
448 | //HttpManager.getInstance().header(this, fileSrc); | 455 | //HttpManager.getInstance().header(this, fileSrc); |
449 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 456 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
450 | //Fresco设置圆形头像 | 457 | //Fresco设置圆形头像 |
451 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 458 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
452 | GenericDraweeHierarchy hierarchy = builder | 459 | GenericDraweeHierarchy hierarchy = builder |
453 | .setDesiredAspectRatio(1f) | 460 | .setDesiredAspectRatio(1f) |
454 | .setFailureImage(R.mipmap.blank) | 461 | .setFailureImage(R.mipmap.blank) |
455 | //圆形头像 | 462 | //圆形头像 |
456 | .setRoundingParams(RoundingParams.asCircle()) | 463 | .setRoundingParams(RoundingParams.asCircle()) |
457 | .build(); | 464 | .build(); |
458 | 465 | ||
459 | //加载本地图片 | 466 | //加载本地图片 |
460 | Uri uri = Uri.fromFile(cover); | 467 | Uri uri = Uri.fromFile(cover); |
461 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 468 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
462 | .setOldController(mSimpleDraweeView.getController()) | 469 | .setOldController(mSimpleDraweeView.getController()) |
463 | .setUri(uri) | 470 | .setUri(uri) |
464 | .build(); | 471 | .build(); |
465 | mSimpleDraweeView.setHierarchy(hierarchy); | 472 | mSimpleDraweeView.setHierarchy(hierarchy); |
466 | mSimpleDraweeView.setController(controller); | 473 | mSimpleDraweeView.setController(controller); |
467 | 474 | ||
468 | } | 475 | } |
469 | 476 | ||
470 | public void startPhotoZoom(Uri uri) { | 477 | public void startPhotoZoom(Uri uri) { |
471 | Intent intent = new Intent("com.android.camera.action.CROP"); | 478 | Intent intent = new Intent("com.android.camera.action.CROP"); |
472 | intent.setDataAndType(uri, "image/*"); | 479 | intent.setDataAndType(uri, "image/*"); |
473 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 480 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
474 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 481 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
475 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 482 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
476 | intent.putExtra("aspectY", 1);// x:y=1:1 | 483 | intent.putExtra("aspectY", 1);// x:y=1:1 |
477 | // intent.putExtra("outputX", 400);//图片输出大小 | 484 | // intent.putExtra("outputX", 400);//图片输出大小 |
478 | // intent.putExtra("outputY", 400); | 485 | // intent.putExtra("outputY", 400); |
479 | intent.putExtra("output", Uri.fromFile(file)); | 486 | intent.putExtra("output", Uri.fromFile(file)); |
480 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 487 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
481 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 488 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
482 | } | 489 | } |
483 | 490 | ||
484 | @Override | 491 | @Override |
485 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 492 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
486 | switch (requestCode) { | 493 | switch (requestCode) { |
487 | 494 | ||
488 | case PermissionUtil.REQUEST_SHOWCAMERA: | 495 | case PermissionUtil.REQUEST_SHOWCAMERA: |
489 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 496 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
490 | // Permission Granted | 497 | // Permission Granted |
491 | uploadAvatarFromPhotoRequest(); | 498 | uploadAvatarFromPhotoRequest(); |
492 | 499 | ||
493 | } else { | 500 | } else { |
494 | if (!SharedPreferenceMark.getHasShowCamera()) { | 501 | if (!SharedPreferenceMark.getHasShowCamera()) { |
495 | SharedPreferenceMark.setHasShowCamera(true); | 502 | SharedPreferenceMark.setHasShowCamera(true); |
496 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 503 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
497 | 504 | ||
498 | } else { | 505 | } else { |
499 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 506 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
500 | .show(); | 507 | .show(); |
501 | } | 508 | } |
502 | } | 509 | } |
503 | break; | 510 | break; |
504 | default: | 511 | default: |
505 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 512 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
506 | } | 513 | } |
507 | } | 514 | } |
508 | private long exitTime = 0; | 515 | private long exitTime = 0; |
509 | @Override | 516 | @Override |
510 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 517 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
511 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 518 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
512 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 519 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
513 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 520 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
514 | Toast.LENGTH_SHORT).show(); | 521 | Toast.LENGTH_SHORT).show(); |
515 | exitTime = System.currentTimeMillis(); | 522 | exitTime = System.currentTimeMillis(); |
516 | } else { | 523 | } else { |
517 | finish(); | 524 | finish(); |
518 | System.exit(0); | 525 | System.exit(0); |
519 | } | 526 | } |
520 | return false; | 527 | return false; |
521 | } | 528 | } |
522 | return super.onKeyDown(keyCode, event); | 529 | return super.onKeyDown(keyCode, event); |
523 | } | 530 | } |
524 | } | 531 | } |
525 | 532 |
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.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
6 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
7 | import android.view.KeyEvent; | 7 | import android.view.KeyEvent; |
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.TextView; | 11 | import android.widget.TextView; |
12 | 12 | ||
13 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
14 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 14 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
15 | import com.hjx.personalcenter.customdialog.CountryDialog; | 15 | import com.hjx.personalcenter.customdialog.CountryDialog; |
16 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 16 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
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.HttpManager; | 21 | import com.hjx.personalcenter.http.HttpManager; |
22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
23 | import com.hjx.personalcenter.model.CityInfo; | 23 | import com.hjx.personalcenter.model.CityInfo; |
24 | import com.hjx.personalcenter.model.CountyInfo; | 24 | import com.hjx.personalcenter.model.CountyInfo; |
25 | import com.hjx.personalcenter.model.GradeInfo; | 25 | import com.hjx.personalcenter.model.GradeInfo; |
26 | import com.hjx.personalcenter.model.ProvinceInfo; | 26 | import com.hjx.personalcenter.model.ProvinceInfo; |
27 | import com.hjx.personalcenter.model.SchoolInfo; | 27 | import com.hjx.personalcenter.model.SchoolInfo; |
28 | import com.hjx.personalcenter.util.AlertUtils; | 28 | import com.hjx.personalcenter.util.AlertUtils; |
29 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
29 | 30 | ||
30 | import java.util.ArrayList; | 31 | import java.util.ArrayList; |
31 | 32 | ||
32 | /**填写注册信息 熊巍 | 33 | /**填写注册信息 熊巍 |
33 | * Created by h on 2017/8/9. | 34 | * Created by h on 2017/8/9. |
34 | */ | 35 | */ |
35 | 36 | ||
36 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener,DialogCallBack.GradeCallBack,DialogCallBack.ProvincesCallBack | 37 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener,DialogCallBack.GradeCallBack,DialogCallBack.ProvincesCallBack |
37 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack,DialogCallBack.SchoolCallBack{ | 38 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack,DialogCallBack.SchoolCallBack{ |
38 | private EditText et_username; | 39 | private EditText et_username; |
39 | private TextView et_region,et_grade,et_school; | 40 | private TextView et_region,et_grade,et_school; |
40 | private Button btn_ok; | 41 | private Button btn_ok; |
41 | 42 | ||
42 | @Override | 43 | @Override |
43 | protected void onCreate(Bundle savedInstanceState) { | 44 | protected void onCreate(Bundle savedInstanceState) { |
44 | super.onCreate(savedInstanceState); | 45 | super.onCreate(savedInstanceState); |
45 | setContentView(R.layout.activity_registerinfo); | 46 | setContentView(R.layout.activity_registerinfo); |
46 | initView(); | 47 | initView(); |
47 | initData(); | 48 | initData(); |
48 | initLister(); | 49 | initLister(); |
49 | } | 50 | } |
50 | 51 | ||
51 | private void initView() { | 52 | private void initView() { |
52 | et_username = (EditText) findViewById(R.id.et_username); | 53 | et_username = (EditText) findViewById(R.id.et_username); |
53 | et_region = (TextView) findViewById(R.id.et_region); | 54 | et_region = (TextView) findViewById(R.id.et_region); |
54 | et_grade = (TextView) findViewById(R.id.et_grade); | 55 | et_grade = (TextView) findViewById(R.id.et_grade); |
55 | et_school = (TextView) findViewById(R.id.et_school); | 56 | et_school = (TextView) findViewById(R.id.et_school); |
56 | btn_ok = (Button) findViewById(R.id.btn_ok); | 57 | btn_ok = (Button) findViewById(R.id.btn_ok); |
57 | 58 | ||
58 | 59 | ||
59 | } | 60 | } |
60 | 61 | ||
61 | private void initData() { | 62 | private void initData() { |
62 | if (Content.accountflag ==2){ | 63 | if (Content.accountflag ==2){ |
63 | btn_ok.setText("提交"); | 64 | btn_ok.setText("提交"); |
64 | 65 | ||
65 | } | 66 | } |
66 | 67 | ||
67 | } | 68 | } |
68 | 69 | ||
69 | private void initLister() { | 70 | private void initLister() { |
70 | et_region.setOnClickListener(this); | 71 | et_region.setOnClickListener(this); |
71 | et_grade.setOnClickListener(this); | 72 | et_grade.setOnClickListener(this); |
72 | et_school.setOnClickListener(this); | 73 | et_school.setOnClickListener(this); |
73 | btn_ok.setOnClickListener(this); | 74 | btn_ok.setOnClickListener(this); |
74 | 75 | ||
75 | 76 | ||
76 | } | 77 | } |
77 | 78 | ||
78 | @Override | 79 | @Override |
79 | public void onClick(View v) { | 80 | public void onClick(View v) { |
80 | String register1 = et_username.getText().toString().trim(); | 81 | String register1 = et_username.getText().toString().trim(); |
81 | String register2 = et_region.getText().toString().trim(); | 82 | String register2 = et_region.getText().toString().trim(); |
82 | String register3 = et_grade.getText().toString().trim(); | 83 | String register3 = et_grade.getText().toString().trim(); |
83 | String register4 = et_school.getText().toString().trim(); | 84 | String register4 = et_school.getText().toString().trim(); |
84 | switch (v.getId()){ | 85 | switch (v.getId()){ |
85 | case R.id.et_region: | 86 | case R.id.et_region: |
86 | choiseregion(); | 87 | choiseregion(); |
87 | break; | 88 | break; |
88 | case R.id.et_grade: | 89 | case R.id.et_grade: |
89 | choisegrade(); | 90 | choisegrade(); |
90 | break; | 91 | break; |
91 | case R.id.et_school: | 92 | case R.id.et_school: |
92 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ | 93 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ |
93 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); | 94 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); |
94 | return; | 95 | return; |
95 | }else { | 96 | }else { |
96 | choiseschool(); | 97 | choiseschool(); |
97 | } | 98 | } |
98 | 99 | ||
99 | break; | 100 | break; |
100 | case R.id.btn_ok: | 101 | case R.id.btn_ok: |
101 | if (TextUtils.isEmpty(register1) || | 102 | if (TextUtils.isEmpty(register1) || |
102 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ | 103 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ |
103 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | 104 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
104 | return; | 105 | return; |
105 | }else{ | 106 | }else{ |
107 | String register5 = et_username.getText().toString().trim(); | ||
108 | String register6 = et_region.getText().toString().trim(); | ||
109 | String register7 = et_grade.getText().toString().trim(); | ||
110 | String register8 = et_school.getText().toString().trim(); | ||
106 | if (Content.accountflag ==2){ | 111 | if (Content.accountflag ==2){ |
107 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 112 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
108 | String register5 = et_username.getText().toString().trim(); | 113 | String grade = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADENS); |
109 | String register6 = et_region.getText().toString().trim(); | 114 | String School = SaveParam.getInstance().getLoginParam(this,SaveParam.SCHOOOlID); |
110 | String register7 = et_grade.getText().toString().trim(); | 115 | if (TextUtils.isEmpty(register8)){ |
111 | String register8 = et_school.getText().toString().trim(); | 116 | School = "0"; |
117 | } | ||
118 | String regionId = SaveParam.getInstance().getLoginParam(this, SaveParam.COUNTRY); | ||
119 | String regionId1 = SaveParam.getInstance().getLoginParam(this, SaveParam.CITYS); | ||
120 | String devicenumber =GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | ||
121 | if (regionId == null) { | ||
122 | regionId = regionId1; | ||
123 | } | ||
124 | |||
112 | try { | 125 | try { |
113 | long auserID = Long.parseLong(userID); | 126 | long auserID = Long.parseLong(userID); |
127 | long grades = Long.parseLong(grade); | ||
128 | long Schools = Long.parseLong(School); | ||
129 | long regionIds = Long.parseLong(regionId); | ||
114 | 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", | 130 | 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", |
115 | register5,register7,register8,register6); | 131 | register5,grades,Schools,regionIds,devicenumber,register6); |
116 | 132 | ||
117 | } catch (NumberFormatException e) { | 133 | } catch (NumberFormatException e) { |
118 | e.printStackTrace(); | 134 | e.printStackTrace(); |
119 | } | 135 | } |
120 | 136 | ||
121 | }else { | 137 | }else { |
122 | saveinfo(); | 138 | saveinfo(); |
123 | Intent intent = new Intent(); | 139 | Intent intent = new Intent(); |
124 | intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class); | 140 | intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class); |
125 | startActivity(intent); | 141 | startActivity(intent); |
126 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 142 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
127 | } | 143 | } |
128 | 144 | ||
129 | } | 145 | } |
130 | 146 | ||
131 | break; | 147 | break; |
132 | } | 148 | } |
133 | 149 | ||
134 | } | 150 | } |
135 | //保存个人信息 | 151 | //保存个人信息 |
136 | private void saveinfo() { | 152 | private void saveinfo() { |
137 | String register1 = et_username.getText().toString().trim(); | 153 | String register1 = et_username.getText().toString().trim(); |
138 | String register2 = et_region.getText().toString().trim(); | 154 | String register2 = et_region.getText().toString().trim(); |
139 | String register3 = et_grade.getText().toString().trim(); | 155 | String register3 = et_grade.getText().toString().trim(); |
140 | String register4 = et_school.getText().toString().trim(); | 156 | String register4 = et_school.getText().toString().trim(); |
141 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register1); | 157 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register1); |
142 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register2); | 158 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register2); |
143 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register3); | 159 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register3); |
144 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register4); | 160 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register4); |
145 | 161 | ||
146 | } | 162 | } |
147 | 163 | ||
148 | //选择地区 | 164 | //选择地区 |
149 | private void choiseregion() { | 165 | private void choiseregion() { |
150 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 166 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
151 | 167 | ||
152 | } | 168 | } |
153 | //选择年级 | 169 | //选择年级 |
154 | private void choisegrade() { | 170 | private void choisegrade() { |
155 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); | 171 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); |
156 | 172 | ||
157 | } | 173 | } |
158 | //选择学校 | 174 | //选择学校 |
159 | private void choiseschool() { | 175 | private void choiseschool() { |
160 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); | 176 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); |
161 | 177 | ||
162 | } | 178 | } |
163 | 179 | ||
164 | 180 | ||
165 | @Override | 181 | @Override |
166 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 182 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
167 | String regionName = data.get(position).getRegionName(); | 183 | String regionName = data.get(position).getRegionName(); |
168 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 184 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
169 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 185 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
170 | 186 | ||
171 | 187 | ||
172 | } | 188 | } |
173 | @Override | 189 | @Override |
174 | public boolean onKeyUp(int keyCode, KeyEvent event) { | 190 | public boolean onKeyUp(int keyCode, KeyEvent event) { |
175 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 191 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
176 | finish(); | 192 | finish(); |
177 | 193 | ||
178 | } | 194 | } |
179 | return super.onKeyUp(keyCode, event); | 195 | return super.onKeyUp(keyCode, event); |
180 | } | 196 | } |
181 | 197 | ||
182 | @Override | 198 | @Override |
183 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 199 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
184 | String regionName = data.get(position).getName(); | 200 | String regionName = data.get(position).getName(); |
185 | et_grade.setText(regionName); | 201 | et_grade.setText(regionName); |
186 | 202 | ||
187 | } | 203 | } |
188 | 204 | ||
189 | @Override | 205 | @Override |
190 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 206 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
191 | String regionName = data.get(position).getRegionName(); | 207 | String regionName = data.get(position).getRegionName(); |
192 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 208 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
193 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 209 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
194 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 210 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
195 | et_region.setText(""); | 211 | et_region.setText(""); |
196 | et_region.setText(provice+regionName); | 212 | et_region.setText(provice+regionName); |
197 | 213 | ||
198 | } | 214 | } |
199 | 215 | ||
200 | @Override | 216 | @Override |
201 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 217 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
202 | String regionName = data.get(position).getRegionName(); | 218 | String regionName = data.get(position).getRegionName(); |
203 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 219 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
204 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 220 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
205 | et_region.setText(""); | 221 | et_region.setText(""); |
206 | et_region.setText(provices+citys+regionName); | 222 | et_region.setText(provices+citys+regionName); |
207 | 223 | ||
208 | } | 224 | } |
209 | 225 | ||
210 | @Override | 226 | @Override |
211 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 227 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
212 | String regionName = data.get(position).getSchoolName(); | 228 | String regionName = data.get(position).getSchoolName(); |
213 | et_school.setText(regionName); | 229 | et_school.setText(regionName); |
214 | 230 | ||
215 | } | 231 | } |
216 | } | 232 | } |
217 | 233 |
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.TextUtils; | 9 | import android.text.TextUtils; |
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.Button; | 13 | import android.widget.Button; |
14 | import android.widget.EditText; | 14 | import android.widget.EditText; |
15 | import android.widget.TextView; | 15 | import android.widget.TextView; |
16 | import android.widget.Toast; | 16 | import android.widget.Toast; |
17 | 17 | ||
18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; | 19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; |
20 | import com.hjx.personalcenter.activity.MainActivity; | 20 | import com.hjx.personalcenter.activity.MainActivity; |
21 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 21 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
22 | import com.hjx.personalcenter.db.SaveParam; | ||
22 | import com.hjx.personalcenter.http.HttpCode; | 23 | import com.hjx.personalcenter.http.HttpCode; |
23 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
24 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
25 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 26 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
26 | 27 | ||
27 | import org.json.JSONException; | 28 | import org.json.JSONException; |
28 | import org.json.JSONObject; | 29 | import org.json.JSONObject; |
29 | 30 | ||
30 | /** | 31 | /** |
31 | * 登录 | 32 | * 登录 |
32 | * Created by h on 2017/8/8. | 33 | * Created by h on 2017/8/8. |
33 | */ | 34 | */ |
34 | 35 | ||
35 | public class LoginFragment extends Fragment implements View.OnClickListener { | 36 | public class LoginFragment extends Fragment implements View.OnClickListener { |
36 | private View mView; | 37 | private View mView; |
37 | private int type; | 38 | private int type; |
38 | private TextView tv_forget_pwd; | 39 | private TextView tv_forget_pwd; |
39 | private Button btn_login; | 40 | private Button btn_login; |
40 | private EditText phonenumber,login_pwwd; | 41 | private EditText phonenumber,login_pwwd; |
41 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 42 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
42 | Intent intent = new Intent(); | 43 | Intent intent = new Intent(); |
43 | public static LoginFragment newInstance(int type) { | 44 | public static LoginFragment newInstance(int type) { |
44 | LoginFragment fragment = new LoginFragment(); | 45 | LoginFragment fragment = new LoginFragment(); |
45 | Bundle bundle = new Bundle(); | 46 | Bundle bundle = new Bundle(); |
46 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 47 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
47 | fragment.setArguments(bundle); | 48 | fragment.setArguments(bundle); |
48 | return fragment; | 49 | return fragment; |
49 | 50 | ||
50 | } | 51 | } |
51 | Handler handler = new Handler(){ | 52 | Handler handler = new Handler(){ |
52 | @Override | 53 | @Override |
53 | public void handleMessage(Message msg) { | 54 | public void handleMessage(Message msg) { |
54 | super.handleMessage(msg); | 55 | super.handleMessage(msg); |
55 | 56 | ||
56 | switch (msg.what){ | 57 | switch (msg.what){ |
57 | case HttpCode.LOGIN_SUCESS: | 58 | case HttpCode.LOGIN_SUCESS: |
58 | JSONObject jsonObject; | 59 | JSONObject jsonObject; |
59 | String status; | 60 | String status; |
60 | try { | 61 | try { |
61 | jsonObject = new JSONObject((String) msg.obj); | 62 | jsonObject = new JSONObject((String) msg.obj); |
62 | status = jsonObject.getString("status"); | 63 | status = jsonObject.getString("status"); |
63 | if (status.equals("100")) { | 64 | if (status.equals("100")) { |
64 | String access_token = jsonObject.getString("access_token"); | 65 | String access_token = jsonObject.getString("access_token"); |
65 | String userId = jsonObject.getString("userId"); | 66 | String userId = jsonObject.getString("userId"); |
66 | final String name = phonenumber.getText().toString().trim(); | 67 | final String name = phonenumber.getText().toString().trim(); |
67 | final String pwd = login_pwwd.getText().toString().trim(); | 68 | final String pwd = login_pwwd.getText().toString().trim(); |
68 | // //登录成功,保存登录数据并且获取个人信息 | 69 | // |
69 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, "true", userId); | ||
70 | try { | 70 | try { |
71 | long auserID = Long.parseLong(userId); | 71 | long auserID = Long.parseLong(userId); |
72 | //是否填写保卡 | 72 | //是否填写保卡 |
73 | HttpManager.getInstance().cardinfocheck(getActivity(),auserID,handler); | 73 | HttpManager.getInstance().cardinfocheck(getActivity(),auserID,handler); |
74 | //登录成功,保存登录数据并且获取个人信息 | ||
75 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, "true", userId); | ||
76 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.ACCOUNT,"1"); | ||
74 | } catch (NumberFormatException e) { | 77 | } catch (NumberFormatException e) { |
75 | e.printStackTrace(); | 78 | e.printStackTrace(); |
76 | } | 79 | } |
77 | 80 | ||
78 | 81 | ||
79 | } else if (status.equals("200")) { | 82 | } else if (status.equals("200")) { |
80 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); | 83 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); |
81 | return; | 84 | return; |
82 | } else if (status.equals("204")) { | 85 | } else if (status.equals("204")) { |
83 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); | 86 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); |
84 | } else { | 87 | } else { |
85 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); | 88 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); |
86 | 89 | ||
87 | 90 | ||
88 | } | 91 | } |
89 | } catch (JSONException e) { | 92 | } catch (JSONException e) { |
90 | e.printStackTrace(); | 93 | e.printStackTrace(); |
91 | } | 94 | } |
92 | break; | 95 | break; |
93 | case HttpCode.CHECKCARD: | 96 | case HttpCode.CHECKCARD: |
94 | try { | 97 | try { |
95 | jsonObject = new JSONObject( (String) msg.obj); | 98 | jsonObject = new JSONObject( (String) msg.obj); |
96 | status = jsonObject.optString("status"); | 99 | status = jsonObject.optString("status"); |
97 | if (status.equals("1")){ | 100 | if (status.equals("1")){ |
98 | Intent intent = new Intent(); | 101 | Intent intent = new Intent(); |
99 | intent.setClass(getActivity(), MainActivity.class); | 102 | intent.setClass(getActivity(), MainActivity.class); |
100 | getActivity().startActivity(intent); | 103 | getActivity().startActivity(intent); |
101 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 104 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
102 | }else if(status.equals("2001")){ | 105 | }else if(status.equals("2001")){ |
103 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); | 106 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); |
104 | }else{ | 107 | }else{ |
105 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | 108 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); |
106 | } | 109 | } |
107 | 110 | ||
108 | } catch (JSONException e) { | 111 | } catch (JSONException e) { |
109 | e.printStackTrace(); | 112 | e.printStackTrace(); |
110 | } | 113 | } |
111 | 114 | ||
112 | break; | 115 | break; |
113 | } | 116 | } |
114 | } | 117 | } |
115 | }; | 118 | }; |
116 | 119 | ||
117 | @Override | 120 | @Override |
118 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 121 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
119 | if (mView == null) { | 122 | if (mView == null) { |
120 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); | 123 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); |
121 | initView(mView); | 124 | initView(mView); |
122 | initData(); | 125 | initData(); |
123 | setLister(); | 126 | setLister(); |
124 | 127 | ||
125 | 128 | ||
126 | } | 129 | } |
127 | return mView; | 130 | return mView; |
128 | } | 131 | } |
129 | //初始化 | 132 | //初始化 |
130 | private void initView(View mView) { | 133 | private void initView(View mView) { |
131 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); | 134 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); |
132 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); | 135 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); |
133 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); | 136 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); |
134 | btn_login = (Button) mView.findViewById(R.id.btn_login); | 137 | btn_login = (Button) mView.findViewById(R.id.btn_login); |
135 | 138 | ||
136 | } | 139 | } |
137 | private void initData() { | 140 | private void initData() { |
138 | } | 141 | } |
139 | private void setLister() { | 142 | private void setLister() { |
140 | tv_forget_pwd.setOnClickListener(this); | 143 | tv_forget_pwd.setOnClickListener(this); |
141 | btn_login.setOnClickListener(this); | 144 | btn_login.setOnClickListener(this); |
142 | } | 145 | } |
143 | 146 | ||
144 | 147 | ||
145 | @Override | 148 | @Override |
146 | public void onClick(View v) { | 149 | public void onClick(View v) { |
147 | switch (v.getId()){ | 150 | switch (v.getId()){ |
148 | case R.id.tv_forget_pwd: | 151 | case R.id.tv_forget_pwd: |
149 | intent.setClass(getActivity(),ForgotPasswordActivity.class); | 152 | intent.setClass(getActivity(),ForgotPasswordActivity.class); |
150 | startActivity(intent); | 153 | startActivity(intent); |
151 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 154 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
152 | break; | 155 | break; |
153 | case R.id.btn_login: | 156 | case R.id.btn_login: |
154 | login(); | 157 | login(); |
155 | break; | 158 | break; |
156 | } | 159 | } |
157 | 160 | ||
158 | } | 161 | } |
159 | 162 | ||
160 | private void login() { | 163 | private void login() { |
161 | final String name = phonenumber.getText().toString().trim(); | 164 | final String name = phonenumber.getText().toString().trim(); |
162 | final String pwd = login_pwwd.getText().toString().trim(); | 165 | final String pwd = login_pwwd.getText().toString().trim(); |
163 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { | 166 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { |
164 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); | 167 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); |
165 | return; | 168 | return; |
166 | }else if (!PhoneNumCheckUtils.isPhone(name)){ | 169 | }else if (!PhoneNumCheckUtils.isPhone(name)){ |
167 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); | 170 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); |
168 | }else { | 171 | }else { |
169 | //登录接口 | 172 | //登录接口 |
170 | HttpManager.getInstance().login(name,pwd, getActivity(),handler); | 173 | HttpManager.getInstance().login(name,pwd, getActivity(),handler); |
171 | } | 174 | } |
172 | 175 | ||
173 | 176 | ||
174 | } | 177 | } |
175 | } | 178 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.graphics.Color; | 4 | import android.graphics.Color; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
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.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.AdapterView; | 12 | import android.widget.AdapterView; |
13 | import android.widget.EditText; | 13 | import android.widget.EditText; |
14 | import android.widget.TextView; | 14 | import android.widget.TextView; |
15 | 15 | ||
16 | import com.bigkoo.pickerview.TimePickerView; | 16 | import com.bigkoo.pickerview.TimePickerView; |
17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 18 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
19 | import com.hjx.personalcenter.customdialog.CountryDialog; | 19 | import com.hjx.personalcenter.customdialog.CountryDialog; |
20 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 20 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
21 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 21 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
22 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 22 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
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.interfaces.DialogCallBack; | 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
26 | import com.hjx.personalcenter.model.ChangeInfo; | 26 | import com.hjx.personalcenter.model.ChangeInfo; |
27 | import com.hjx.personalcenter.model.CityInfo; | 27 | import com.hjx.personalcenter.model.CityInfo; |
28 | import com.hjx.personalcenter.model.CountyInfo; | 28 | import com.hjx.personalcenter.model.CountyInfo; |
29 | import com.hjx.personalcenter.model.GradeInfo; | 29 | import com.hjx.personalcenter.model.GradeInfo; |
30 | import com.hjx.personalcenter.model.ProvinceInfo; | 30 | import com.hjx.personalcenter.model.ProvinceInfo; |
31 | import com.hjx.personalcenter.model.SchoolInfo; | 31 | import com.hjx.personalcenter.model.SchoolInfo; |
32 | import com.hjx.personalcenter.util.AlertUtils; | 32 | import com.hjx.personalcenter.util.AlertUtils; |
33 | import com.hjx.personalcenter.util.BrithdayStar; | 33 | import com.hjx.personalcenter.util.BrithdayStar; |
34 | import com.mylhyl.circledialog.CircleDialog; | 34 | import com.mylhyl.circledialog.CircleDialog; |
35 | import com.mylhyl.circledialog.callback.ConfigDialog; | 35 | import com.mylhyl.circledialog.callback.ConfigDialog; |
36 | import com.mylhyl.circledialog.params.DialogParams; | 36 | import com.mylhyl.circledialog.params.DialogParams; |
37 | 37 | ||
38 | import org.apache.http.util.TextUtils; | 38 | import org.apache.http.util.TextUtils; |
39 | 39 | ||
40 | import java.io.UnsupportedEncodingException; | 40 | import java.io.UnsupportedEncodingException; |
41 | import java.text.SimpleDateFormat; | 41 | import java.text.SimpleDateFormat; |
42 | import java.util.ArrayList; | 42 | import java.util.ArrayList; |
43 | import java.util.Date; | 43 | import java.util.Date; |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * Created by h on 2017/8/12. | 46 | * Created by h on 2017/8/12. |
47 | */ | 47 | */ |
48 | 48 | ||
49 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 49 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
50 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 50 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
51 | private View mView; | 51 | private View mView; |
52 | private int type; | 52 | private int type; |
53 | private TimePickerView pvTime; | 53 | private TimePickerView pvTime; |
54 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; | 54 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
55 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; | 55 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; |
56 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 56 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
57 | 57 | ||
58 | public static PresonInfoFragment newInstance(int type) { | 58 | public static PresonInfoFragment newInstance(int type) { |
59 | PresonInfoFragment fragment = new PresonInfoFragment(); | 59 | PresonInfoFragment fragment = new PresonInfoFragment(); |
60 | Bundle bundle = new Bundle(); | 60 | Bundle bundle = new Bundle(); |
61 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 61 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
62 | fragment.setArguments(bundle); | 62 | fragment.setArguments(bundle); |
63 | return fragment; | 63 | return fragment; |
64 | 64 | ||
65 | } | 65 | } |
66 | 66 | ||
67 | @Override | 67 | @Override |
68 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 68 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
69 | if (mView == null) { | 69 | if (mView == null) { |
70 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 70 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
71 | initView(mView); | 71 | initView(mView); |
72 | initData(); | 72 | initData(); |
73 | setLister(); | 73 | setLister(); |
74 | initTimePicker(); | 74 | initTimePicker(); |
75 | 75 | ||
76 | 76 | ||
77 | } | 77 | } |
78 | return mView; | 78 | return mView; |
79 | } | 79 | } |
80 | 80 | ||
81 | //初始化 | 81 | //初始化 |
82 | private void initView(View mView) { | 82 | private void initView(View mView) { |
83 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 83 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
84 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 84 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
85 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 85 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
86 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 86 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
87 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 87 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
88 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 88 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
89 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 89 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
90 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 90 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
91 | 91 | ||
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
95 | private void initData() { | 95 | private void initData() { |
96 | } | 96 | } |
97 | 97 | ||
98 | private void setLister() { | 98 | private void setLister() { |
99 | tv_sex.setOnClickListener(this); | 99 | tv_sex.setOnClickListener(this); |
100 | tv_useinfo_adress.setOnClickListener(this); | 100 | tv_useinfo_adress.setOnClickListener(this); |
101 | tv_useinfo_birthday.setOnClickListener(this); | 101 | tv_useinfo_birthday.setOnClickListener(this); |
102 | tv_useinfo_school.setOnClickListener(this); | 102 | tv_useinfo_school.setOnClickListener(this); |
103 | tv_useinfo_gender.setOnClickListener(this); | 103 | tv_useinfo_gender.setOnClickListener(this); |
104 | } | 104 | } |
105 | 105 | ||
106 | @Override | 106 | @Override |
107 | public void onClick(View v) { | 107 | public void onClick(View v) { |
108 | String presonal1 = tv_username1.getText().toString().trim(); | 108 | String presonal1 = tv_username1.getText().toString().trim(); |
109 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | 109 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); |
110 | String presonal3 = tv_sex.getText().toString().trim(); | 110 | String presonal3 = tv_sex.getText().toString().trim(); |
111 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | 111 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); |
112 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | 112 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); |
113 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | 113 | String presonal6 = tv_useinfo_school.getText().toString().trim(); |
114 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | 114 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); |
115 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | 115 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); |
116 | switch (v.getId()) { | 116 | switch (v.getId()) { |
117 | case R.id.tv_sex: | 117 | case R.id.tv_sex: |
118 | final String[] items = {"男", "女"}; | 118 | final String[] items = {"男", "女"}; |
119 | new CircleDialog.Builder(getActivity()) | 119 | new CircleDialog.Builder(getActivity()) |
120 | .configDialog(new ConfigDialog() { | 120 | .configDialog(new ConfigDialog() { |
121 | @Override | 121 | @Override |
122 | public void onConfig(DialogParams params) { | 122 | public void onConfig(DialogParams params) { |
123 | //增加弹出动画 | 123 | //增加弹出动画 |
124 | params.gravity = Gravity.CENTER; | 124 | params.gravity = Gravity.CENTER; |
125 | } | 125 | } |
126 | }) | 126 | }) |
127 | .setTitle("请选择性别") | 127 | .setTitle("请选择性别") |
128 | .setWidth(0.5f) | 128 | .setWidth(0.5f) |
129 | .setItems(items, new AdapterView.OnItemClickListener() { | 129 | .setItems(items, new AdapterView.OnItemClickListener() { |
130 | @Override | 130 | @Override |
131 | public void onItemClick(AdapterView<?> parent, View view, int | 131 | public void onItemClick(AdapterView<?> parent, View view, int |
132 | position, long id) { | 132 | position, long id) { |
133 | switch (position) { | 133 | switch (position) { |
134 | case 0: | 134 | case 0: |
135 | tv_sex.setText("男"); | 135 | tv_sex.setText("男"); |
136 | break; | 136 | break; |
137 | case 1: | 137 | case 1: |
138 | tv_sex.setText("女"); | 138 | tv_sex.setText("女"); |
139 | break; | 139 | break; |
140 | } | 140 | } |
141 | 141 | ||
142 | } | 142 | } |
143 | }) | 143 | }) |
144 | .show(); | 144 | .show(); |
145 | break; | 145 | break; |
146 | case R.id.tv_useinfo_adress: | 146 | case R.id.tv_useinfo_adress: |
147 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); | 147 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
148 | break; | 148 | break; |
149 | case R.id.tv_useinfo_birthday: | 149 | case R.id.tv_useinfo_birthday: |
150 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 150 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
151 | break; | 151 | break; |
152 | case R.id.tv_useinfo_school: | 152 | case R.id.tv_useinfo_school: |
153 | if (TextUtils.isEmpty(presonal4) || | 153 | if (TextUtils.isEmpty(presonal4) || |
154 | TextUtils.isEmpty(presonal7)) { | 154 | TextUtils.isEmpty(presonal7)) { |
155 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | 155 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); |
156 | return; | 156 | return; |
157 | } else { | 157 | } else { |
158 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | 158 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | break; | 162 | break; |
163 | case R.id.tv_useinfo_gender: | 163 | case R.id.tv_useinfo_gender: |
164 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); | 164 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
165 | break; | 165 | break; |
166 | case R.id.presonal_sub: | 166 | case R.id.presonal_sub: |
167 | if (TextUtils.isEmpty(presonal1) || | 167 | if (TextUtils.isEmpty(presonal1) || |
168 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || | 168 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || |
169 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || | 169 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || |
170 | TextUtils.isEmpty(presonal8)) { | 170 | TextUtils.isEmpty(presonal8)) { |
171 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); | 171 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
172 | return; | 172 | return; |
173 | } else { | 173 | } else { |
174 | 174 | ||
175 | int a = 0, b = 0; | 175 | int a = 0, b = 0; |
176 | long c = 0; | 176 | long c = 0; |
177 | //保存星座 | 177 | //保存星座 |
178 | BrithdayStar brithdayStar = new BrithdayStar(); | 178 | BrithdayStar brithdayStar = new BrithdayStar(); |
179 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | 179 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); |
180 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); | 180 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); |
181 | 181 | ||
182 | ChangeInfo changeinfo = new ChangeInfo(); | 182 | ChangeInfo changeinfo = new ChangeInfo(); |
183 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); | 183 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); |
184 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 184 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
185 | if (regionId == null) { | 185 | if (regionId == null) { |
186 | regionId = regionId1; | 186 | regionId = regionId1; |
187 | } | 187 | } |
188 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 188 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
189 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | 189 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); |
190 | if (TextUtils.isEmpty(presonal6)){ | ||
191 | schoolid = "0"; | ||
192 | } | ||
190 | ChangeInfo.SchoolBean changeinfo2 = new ChangeInfo.SchoolBean(); | 193 | ChangeInfo.SchoolBean changeinfo2 = new ChangeInfo.SchoolBean(); |
191 | try { | 194 | try { |
192 | a = Integer.parseInt(regionId); | 195 | a = Integer.parseInt(regionId); |
193 | b = Integer.parseInt(grade); | 196 | b = Integer.parseInt(grade); |
194 | c = Long.parseLong(schoolid); | 197 | c = Long.parseLong(schoolid); |
195 | } catch (NumberFormatException e) { | 198 | } catch (NumberFormatException e) { |
196 | e.printStackTrace(); | 199 | e.printStackTrace(); |
197 | } | 200 | } |
198 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 201 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
199 | 202 | ||
200 | changeinfo.setId(userID); | 203 | changeinfo.setId(userID); |
201 | changeinfo.setNickname(presonal1); | 204 | changeinfo.setNickname(presonal1); |
202 | changeinfo.setRegionId(a); | 205 | changeinfo.setRegionId(a); |
203 | changeinfo.setGradeId(b); | 206 | changeinfo.setGradeId(b); |
204 | changeinfo2.setSchoolId(c); | 207 | changeinfo2.setSchoolId(c); |
205 | if ("男".equals(presonal3)) { | 208 | if ("男".equals(presonal3)) { |
206 | changeinfo.setGender("0"); | 209 | changeinfo.setGender("0"); |
207 | } else { | 210 | } else { |
208 | changeinfo.setGender("1"); | 211 | changeinfo.setGender("1"); |
209 | } | 212 | } |
210 | changeinfo.setBirthday(presonal5); | 213 | changeinfo.setBirthday(presonal5); |
211 | ChangeInfo.ContactBean changeinfo1 = new ChangeInfo.ContactBean(); | 214 | ChangeInfo.ContactBean changeinfo1 = new ChangeInfo.ContactBean(); |
212 | changeinfo1.setQq(presonal8); | 215 | changeinfo1.setQq(presonal8); |
213 | changeinfo.setRegionName(presonal4 + presonal2); | 216 | changeinfo.setRegionName(presonal4 + presonal2); |
214 | changeinfo.setSchool(changeinfo2); | 217 | changeinfo.setSchool(changeinfo2); |
215 | changeinfo.setContact(changeinfo1); | 218 | changeinfo.setContact(changeinfo1); |
216 | 219 | ||
217 | try { | 220 | try { |
218 | //提交个人信息 | 221 | //提交个人信息 |
219 | HttpManager.getInstance().changepresonalinfo(getActivity(), changeinfo); | 222 | HttpManager.getInstance().changepresonalinfo(getActivity(), changeinfo); |
220 | } catch (UnsupportedEncodingException e) { | 223 | } catch (UnsupportedEncodingException e) { |
221 | e.printStackTrace(); | 224 | e.printStackTrace(); |
222 | } | 225 | } |
223 | 226 | ||
224 | 227 | ||
225 | break; | 228 | break; |
226 | } | 229 | } |
227 | } | 230 | } |
228 | } | 231 | } |
229 | 232 | ||
230 | //自定义时间选择器 | 233 | //自定义时间选择器 |
231 | private void initTimePicker() { | 234 | private void initTimePicker() { |
232 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 235 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
233 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 236 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
234 | // Calendar selectedDate = Calendar.getInstance(); | 237 | // Calendar selectedDate = Calendar.getInstance(); |
235 | // Calendar startDate = Calendar.getInstance(); | 238 | // Calendar startDate = Calendar.getInstance(); |
236 | // startDate.set(1900, 1, 1); | 239 | // startDate.set(1900, 1, 1); |
237 | // Calendar endDate = Calendar.getInstance(); | 240 | // Calendar endDate = Calendar.getInstance(); |
238 | // endDate.set(2100, 1, 1); | 241 | // endDate.set(2100, 1, 1); |
239 | //时间选择器 | 242 | //时间选择器 |
240 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 243 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
241 | @Override | 244 | @Override |
242 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 245 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
243 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 246 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
244 | /*btn_Time.setText(getTime(date));*/ | 247 | /*btn_Time.setText(getTime(date));*/ |
245 | TextView btn = (TextView) v; | 248 | TextView btn = (TextView) v; |
246 | btn.setText(getTime(date)); | 249 | btn.setText(getTime(date)); |
247 | } | 250 | } |
248 | }) | 251 | }) |
249 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 252 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
250 | .setType(new boolean[]{true, true, true, false, false, false}) | 253 | .setType(new boolean[]{true, true, true, false, false, false}) |
251 | .setLabel("", "", "", "", "", "") | 254 | .setLabel("", "", "", "", "", "") |
252 | .isCenterLabel(false) | 255 | .isCenterLabel(false) |
253 | .setDividerColor(Color.DKGRAY) | 256 | .setDividerColor(Color.DKGRAY) |
254 | .setContentSize(21) | 257 | .setContentSize(21) |
255 | // .setDate(selectedDate) | 258 | // .setDate(selectedDate) |
256 | // .setRangDate(startDate, endDate) | 259 | // .setRangDate(startDate, endDate) |
257 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 260 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
258 | .setDecorView(null) | 261 | .setDecorView(null) |
259 | .setTitleText("购买日期") | 262 | .setTitleText("购买日期") |
260 | .setTitleSize(22) | 263 | .setTitleSize(22) |
261 | .setCancelColor(Color.GRAY) | 264 | .setCancelColor(Color.GRAY) |
262 | .setSubCalSize(22) | 265 | .setSubCalSize(22) |
263 | .setDividerColor(Color.GRAY) | 266 | .setDividerColor(Color.GRAY) |
264 | .setSubmitColor(Color.GRAY) | 267 | .setSubmitColor(Color.GRAY) |
265 | .build(); | 268 | .build(); |
266 | } | 269 | } |
267 | 270 | ||
268 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 271 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
269 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 272 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
270 | return format.format(date); | 273 | return format.format(date); |
271 | } | 274 | } |
272 | 275 | ||
273 | @Override | 276 | @Override |
274 | public void onAttach(Activity activity) { | 277 | public void onAttach(Activity activity) { |
275 | super.onAttach(activity); | 278 | super.onAttach(activity); |
276 | View rootView = activity.getWindow().getDecorView(); | 279 | View rootView = activity.getWindow().getDecorView(); |
277 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | 280 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); |
278 | sub.setOnClickListener(this); | 281 | sub.setOnClickListener(this); |
279 | } | 282 | } |
280 | 283 | ||
281 | @Override | 284 | @Override |
282 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 285 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
283 | String regionName = data.get(position).getRegionName(); | 286 | String regionName = data.get(position).getRegionName(); |
284 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 287 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
285 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | 288 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); |
286 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | 289 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); |
287 | tv_useinfo_adress.setText(""); | 290 | tv_useinfo_adress.setText(""); |
288 | tv_useinfo_adress.setText(provice + regionName); | 291 | tv_useinfo_adress.setText(provice + regionName); |
289 | 292 | ||
290 | 293 | ||
291 | } | 294 | } |
292 | 295 | ||
293 | @Override | 296 | @Override |
294 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 297 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
295 | String regionName = data.get(position).getRegionName(); | 298 | String regionName = data.get(position).getRegionName(); |
296 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 299 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
297 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); | 300 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); |
298 | tv_useinfo_adress.setText(""); | 301 | tv_useinfo_adress.setText(""); |
299 | tv_useinfo_adress.setText(provices + citys + regionName); | 302 | tv_useinfo_adress.setText(provices + citys + regionName); |
300 | 303 | ||
301 | } | 304 | } |
302 | 305 | ||
303 | @Override | 306 | @Override |
304 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 307 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
305 | String regionName = data.get(position).getName(); | 308 | String regionName = data.get(position).getName(); |
306 | tv_useinfo_gender.setText(regionName); | 309 | tv_useinfo_gender.setText(regionName); |
307 | } | 310 | } |
308 | 311 | ||
309 | @Override | 312 | @Override |
310 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 313 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
311 | String regionName = data.get(position).getRegionName(); | 314 | String regionName = data.get(position).getRegionName(); |
312 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); | 315 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); |
313 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); | 316 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); |
314 | 317 | ||
315 | } | 318 | } |
316 | 319 | ||
317 | @Override | 320 | @Override |
318 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 321 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
319 | String regionName = data.get(position).getSchoolName(); | 322 | String regionName = data.get(position).getSchoolName(); |
320 | tv_useinfo_school.setText(regionName); | 323 | tv_useinfo_school.setText(regionName); |
321 | 324 | ||
322 | 325 | ||
323 | } | 326 | } |
324 | } | 327 | } |
325 | 328 |
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 | //提交子账户信息 | 32 | //提交子账户信息 |
33 | public static String PARENTID = "parentId"; | 33 | public static String PARENTID = "parentId"; |
34 | public static String IMAGE = "image"; | 34 | public static String IMAGE = "image"; |
35 | public static String NAME = "name"; | 35 | public static String NAME = "name"; |
36 | public static String GRADE = "grade"; | 36 | public static String GRADE = "gradeId"; |
37 | public static String SCHOOL = "school"; | 37 | public static String SCHOOL = "schoolId"; |
38 | public static String REGION = "region"; | 38 | public static String REGION = "regionId"; |
39 | public static String DEVINUMBER = "deviceNumber"; | ||
40 | public static String REGIONNAME = "regionName"; | ||
39 | 41 | ||
40 | 42 | ||
41 | 43 | ||
42 | 44 | ||
43 | 45 | ||
44 | 46 | ||
45 | 47 | ||
46 | } | 48 | } |
47 | 49 |
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.Handler; | 7 | import android.os.Handler; |
8 | import android.os.Message; | 8 | import android.os.Message; |
9 | import android.provider.Settings; | 9 | import android.provider.Settings; |
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.Gravity; | 12 | import android.view.Gravity; |
13 | import android.view.View; | 13 | import android.view.View; |
14 | import android.widget.Toast; | 14 | import android.widget.Toast; |
15 | 15 | ||
16 | import com.google.gson.Gson; | 16 | import com.google.gson.Gson; |
17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 18 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
19 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 19 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.gson.GsonTool; | 21 | import com.hjx.personalcenter.gson.GsonTool; |
22 | import com.hjx.personalcenter.model.AppVersion; | 22 | import com.hjx.personalcenter.model.AppVersion; |
23 | import com.hjx.personalcenter.model.CardInfo; | 23 | import com.hjx.personalcenter.model.CardInfo; |
24 | import com.hjx.personalcenter.model.ChildsInfo; | 24 | import com.hjx.personalcenter.model.ChildsInfo; |
25 | import com.hjx.personalcenter.model.CityInfo; | 25 | import com.hjx.personalcenter.model.CityInfo; |
26 | import com.hjx.personalcenter.model.CountyInfo; | 26 | import com.hjx.personalcenter.model.CountyInfo; |
27 | import com.hjx.personalcenter.model.GradeInfo; | 27 | import com.hjx.personalcenter.model.GradeInfo; |
28 | import com.hjx.personalcenter.model.PesonalInfo; | 28 | import com.hjx.personalcenter.model.PesonalInfo; |
29 | import com.hjx.personalcenter.model.ProvinceInfo; | 29 | import com.hjx.personalcenter.model.ProvinceInfo; |
30 | import com.hjx.personalcenter.model.SchoolInfo; | 30 | import com.hjx.personalcenter.model.SchoolInfo; |
31 | import com.hjx.personalcenter.model.SignInfo; | 31 | import com.hjx.personalcenter.model.SignInfo; |
32 | import com.hjx.personalcenter.util.AlertUtils; | 32 | import com.hjx.personalcenter.util.AlertUtils; |
33 | import com.hjx.personalcenter.util.DialogPermission; | 33 | import com.hjx.personalcenter.util.DialogPermission; |
34 | import com.loopj.android.http.AsyncHttpResponseHandler; | 34 | import com.loopj.android.http.AsyncHttpResponseHandler; |
35 | import com.loopj.android.http.JsonHttpResponseHandler; | 35 | import com.loopj.android.http.JsonHttpResponseHandler; |
36 | import com.loopj.android.http.RequestParams; | 36 | import com.loopj.android.http.RequestParams; |
37 | import com.mylhyl.circledialog.CircleDialog; | 37 | import com.mylhyl.circledialog.CircleDialog; |
38 | import com.mylhyl.circledialog.callback.ConfigText; | 38 | import com.mylhyl.circledialog.callback.ConfigText; |
39 | import com.mylhyl.circledialog.params.TextParams; | 39 | import com.mylhyl.circledialog.params.TextParams; |
40 | 40 | ||
41 | import org.apache.http.Header; | 41 | import org.apache.http.Header; |
42 | import org.apache.http.entity.ByteArrayEntity; | 42 | import org.apache.http.entity.ByteArrayEntity; |
43 | import org.apache.http.message.BasicHeader; | 43 | import org.apache.http.message.BasicHeader; |
44 | import org.apache.http.protocol.HTTP; | 44 | import org.apache.http.protocol.HTTP; |
45 | import org.json.JSONException; | 45 | import org.json.JSONException; |
46 | import org.json.JSONObject; | 46 | import org.json.JSONObject; |
47 | 47 | ||
48 | import java.io.UnsupportedEncodingException; | 48 | import java.io.UnsupportedEncodingException; |
49 | import java.util.ArrayList; | 49 | import java.util.ArrayList; |
50 | import java.util.List; | 50 | import java.util.List; |
51 | 51 | ||
52 | public class HttpManager { | 52 | public class HttpManager { |
53 | private static HttpManager instance; | 53 | private static HttpManager instance; |
54 | private ProgressDialog mProgress = null; | 54 | private ProgressDialog mProgress = null; |
55 | 55 | ||
56 | public static HttpManager getInstance() { | 56 | public static HttpManager getInstance() { |
57 | if (instance == null) { | 57 | if (instance == null) { |
58 | instance = new HttpManager(); | 58 | instance = new HttpManager(); |
59 | } | 59 | } |
60 | return instance; | 60 | return instance; |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | //登录接口 | 64 | //登录接口 |
65 | 65 | ||
66 | public void login(final String username, final String password, final Context mContext, final Handler handler) { | 66 | public void login(final String username, final String password, final Context mContext, final Handler handler) { |
67 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 67 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
68 | false, true, null); | 68 | false, true, null); |
69 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 69 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
70 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 70 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
71 | @Override | 71 | @Override |
72 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 72 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
73 | closeProgress(); | 73 | closeProgress(); |
74 | Message msg = Message.obtain(); | 74 | Message msg = Message.obtain(); |
75 | msg.what = HttpCode.LOGIN_SUCESS; | 75 | msg.what = HttpCode.LOGIN_SUCESS; |
76 | msg.obj = new String(arg2); | 76 | msg.obj = new String(arg2); |
77 | handler.sendMessage(msg); | 77 | handler.sendMessage(msg); |
78 | 78 | ||
79 | 79 | ||
80 | } | 80 | } |
81 | 81 | ||
82 | @Override | 82 | @Override |
83 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 83 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
84 | closeProgress(); | 84 | closeProgress(); |
85 | new CircleDialog.Builder((FragmentActivity) mContext) | 85 | new CircleDialog.Builder((FragmentActivity) mContext) |
86 | .setCanceledOnTouchOutside(false) | 86 | .setCanceledOnTouchOutside(false) |
87 | .setCancelable(false) | 87 | .setCancelable(false) |
88 | .setWidth(0.5f) | 88 | .setWidth(0.5f) |
89 | .configText(new ConfigText() { | 89 | .configText(new ConfigText() { |
90 | @Override | 90 | @Override |
91 | public void onConfig(TextParams params) { | 91 | public void onConfig(TextParams params) { |
92 | params.gravity = Gravity.CENTER; | 92 | params.gravity = Gravity.CENTER; |
93 | params.padding = new int[]{50, 50, 50, 50}; | 93 | params.padding = new int[]{50, 50, 50, 50}; |
94 | } | 94 | } |
95 | }) | 95 | }) |
96 | .setText("当前无网络,请检查网络设置") | 96 | .setText("当前无网络,请检查网络设置") |
97 | .setNegative("继续使用", null) | 97 | .setNegative("继续使用", null) |
98 | .setPositive("设置网络", new View.OnClickListener() { | 98 | .setPositive("设置网络", new View.OnClickListener() { |
99 | @Override | 99 | @Override |
100 | public void onClick(View v) { | 100 | public void onClick(View v) { |
101 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 101 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
102 | mContext.startActivity(intent); | 102 | mContext.startActivity(intent); |
103 | } | 103 | } |
104 | }) | 104 | }) |
105 | .show(); | 105 | .show(); |
106 | } | 106 | } |
107 | }); | 107 | }); |
108 | } | 108 | } |
109 | 109 | ||
110 | //注册接口 | 110 | //注册接口 |
111 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 111 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
112 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 112 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
113 | false, true, null); | 113 | false, true, null); |
114 | JSONObject jsonObject = new JSONObject(); | 114 | JSONObject jsonObject = new JSONObject(); |
115 | ByteArrayEntity entity = null; | 115 | ByteArrayEntity entity = null; |
116 | try { | 116 | try { |
117 | jsonObject.put(HttpKey.USERNAME, username); | 117 | jsonObject.put(HttpKey.USERNAME, username); |
118 | jsonObject.put(HttpKey.PASSWORD, password); | 118 | jsonObject.put(HttpKey.PASSWORD, password); |
119 | jsonObject.put(HttpKey.SMSCODE, smscode); | 119 | jsonObject.put(HttpKey.SMSCODE, smscode); |
120 | jsonObject.put(HttpKey.SOURCE, source); | 120 | jsonObject.put(HttpKey.SOURCE, source); |
121 | Log.e("test", "jsonObject" + jsonObject); | 121 | Log.e("test", "jsonObject" + jsonObject); |
122 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 122 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
123 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 123 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
124 | } catch (JSONException e) { | 124 | } catch (JSONException e) { |
125 | e.printStackTrace(); | 125 | e.printStackTrace(); |
126 | } catch (UnsupportedEncodingException e) { | 126 | } catch (UnsupportedEncodingException e) { |
127 | e.printStackTrace(); | 127 | e.printStackTrace(); |
128 | } | 128 | } |
129 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 129 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
130 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 130 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
131 | @Override | 131 | @Override |
132 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 132 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
133 | super.onSuccess(statusCode, headers, response); | 133 | super.onSuccess(statusCode, headers, response); |
134 | closeProgress(); | 134 | closeProgress(); |
135 | Log.e("test", "onSuccess" + response); | 135 | Log.e("test", "onSuccess" + response); |
136 | Message msg = Message.obtain(); | 136 | Message msg = Message.obtain(); |
137 | msg.what = HttpCode.REGISTERED_SUCESS; | 137 | msg.what = HttpCode.REGISTERED_SUCESS; |
138 | msg.obj = response; | 138 | msg.obj = response; |
139 | handler.sendMessage(msg); | 139 | handler.sendMessage(msg); |
140 | 140 | ||
141 | } | 141 | } |
142 | 142 | ||
143 | @Override | 143 | @Override |
144 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 144 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
145 | super.onFailure(statusCode, headers, throwable, errorResponse); | 145 | super.onFailure(statusCode, headers, throwable, errorResponse); |
146 | closeProgress(); | 146 | closeProgress(); |
147 | Log.e("test", "onFailure" + errorResponse); | 147 | Log.e("test", "onFailure" + errorResponse); |
148 | new CircleDialog.Builder((FragmentActivity) context) | 148 | new CircleDialog.Builder((FragmentActivity) context) |
149 | .setCanceledOnTouchOutside(false) | 149 | .setCanceledOnTouchOutside(false) |
150 | .setCancelable(false) | 150 | .setCancelable(false) |
151 | .setWidth(0.5f) | 151 | .setWidth(0.5f) |
152 | .configText(new ConfigText() { | 152 | .configText(new ConfigText() { |
153 | @Override | 153 | @Override |
154 | public void onConfig(TextParams params) { | 154 | public void onConfig(TextParams params) { |
155 | params.gravity = Gravity.CENTER; | 155 | params.gravity = Gravity.CENTER; |
156 | params.padding = new int[]{50, 50, 50, 50}; | 156 | params.padding = new int[]{50, 50, 50, 50}; |
157 | } | 157 | } |
158 | }) | 158 | }) |
159 | .setText("当前无网络,请检查网络设置") | 159 | .setText("当前无网络,请检查网络设置") |
160 | .setNegative("继续使用", null) | 160 | .setNegative("继续使用", null) |
161 | .setPositive("设置网络", new View.OnClickListener() { | 161 | .setPositive("设置网络", new View.OnClickListener() { |
162 | @Override | 162 | @Override |
163 | public void onClick(View v) { | 163 | public void onClick(View v) { |
164 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 164 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
165 | context.startActivity(intent); | 165 | context.startActivity(intent); |
166 | } | 166 | } |
167 | }) | 167 | }) |
168 | .show(); | 168 | .show(); |
169 | } | 169 | } |
170 | 170 | ||
171 | }); | 171 | }); |
172 | } | 172 | } |
173 | 173 | ||
174 | //注册验证码 | 174 | //注册验证码 |
175 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 175 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
176 | RequestParams params = new RequestParams(); | 176 | RequestParams params = new RequestParams(); |
177 | params.put(HttpKey.TYPE, type); | 177 | params.put(HttpKey.TYPE, type); |
178 | params.put(HttpKey.MOBIL, mobile); | 178 | params.put(HttpKey.MOBIL, mobile); |
179 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 179 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
180 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 180 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
181 | 181 | ||
182 | @Override | 182 | @Override |
183 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 183 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
184 | Log.e("test", "onSuccess-----" + response); | 184 | Log.e("test", "onSuccess-----" + response); |
185 | Message msg = Message.obtain(); | 185 | Message msg = Message.obtain(); |
186 | msg.what = HttpCode.AUTHCODE_SUCESS; | 186 | msg.what = HttpCode.AUTHCODE_SUCESS; |
187 | msg.obj = response; | 187 | msg.obj = response; |
188 | handler.sendMessage(msg); | 188 | handler.sendMessage(msg); |
189 | } | 189 | } |
190 | 190 | ||
191 | @Override | 191 | @Override |
192 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 192 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
193 | new CircleDialog.Builder((FragmentActivity) mContext) | 193 | new CircleDialog.Builder((FragmentActivity) mContext) |
194 | .setCanceledOnTouchOutside(false) | 194 | .setCanceledOnTouchOutside(false) |
195 | .setCancelable(false) | 195 | .setCancelable(false) |
196 | .setWidth(0.5f) | 196 | .setWidth(0.5f) |
197 | .configText(new ConfigText() { | 197 | .configText(new ConfigText() { |
198 | @Override | 198 | @Override |
199 | public void onConfig(TextParams params) { | 199 | public void onConfig(TextParams params) { |
200 | params.gravity = Gravity.CENTER; | 200 | params.gravity = Gravity.CENTER; |
201 | params.padding = new int[]{50, 50, 50, 50}; | 201 | params.padding = new int[]{50, 50, 50, 50}; |
202 | } | 202 | } |
203 | }) | 203 | }) |
204 | .setText("当前无网络,请检查网络设置") | 204 | .setText("当前无网络,请检查网络设置") |
205 | .setNegative("继续使用", null) | 205 | .setNegative("继续使用", null) |
206 | .setPositive("设置网络", new View.OnClickListener() { | 206 | .setPositive("设置网络", new View.OnClickListener() { |
207 | @Override | 207 | @Override |
208 | public void onClick(View v) { | 208 | public void onClick(View v) { |
209 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 209 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
210 | mContext.startActivity(intent); | 210 | mContext.startActivity(intent); |
211 | } | 211 | } |
212 | }) | 212 | }) |
213 | .show(); | 213 | .show(); |
214 | } | 214 | } |
215 | }); | 215 | }); |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | //手机号是否注册 | 219 | //手机号是否注册 |
220 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 220 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
221 | RequestParams params = new RequestParams(); | 221 | RequestParams params = new RequestParams(); |
222 | params.put(HttpKey.USERNAME, mobile); | 222 | params.put(HttpKey.USERNAME, mobile); |
223 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 223 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
224 | @Override | 224 | @Override |
225 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 225 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
226 | Log.e("test", "isregistered" + response.toString()); | 226 | Log.e("test", "isregistered" + response.toString()); |
227 | Message msg = Message.obtain(); | 227 | Message msg = Message.obtain(); |
228 | msg.what = HttpCode.IS_REFISTER; | 228 | msg.what = HttpCode.IS_REFISTER; |
229 | msg.obj = response; | 229 | msg.obj = response; |
230 | handler.sendMessage(msg); | 230 | handler.sendMessage(msg); |
231 | 231 | ||
232 | } | 232 | } |
233 | 233 | ||
234 | @Override | 234 | @Override |
235 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 235 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
236 | new CircleDialog.Builder((FragmentActivity) mContext) | 236 | new CircleDialog.Builder((FragmentActivity) mContext) |
237 | .setCanceledOnTouchOutside(false) | 237 | .setCanceledOnTouchOutside(false) |
238 | .setCancelable(false) | 238 | .setCancelable(false) |
239 | .setWidth(0.5f) | 239 | .setWidth(0.5f) |
240 | .configText(new ConfigText() { | 240 | .configText(new ConfigText() { |
241 | @Override | 241 | @Override |
242 | public void onConfig(TextParams params) { | 242 | public void onConfig(TextParams params) { |
243 | params.gravity = Gravity.CENTER; | 243 | params.gravity = Gravity.CENTER; |
244 | params.padding = new int[]{50, 50, 50, 50}; | 244 | params.padding = new int[]{50, 50, 50, 50}; |
245 | } | 245 | } |
246 | }) | 246 | }) |
247 | .setText("当前无网络,请检查网络设置") | 247 | .setText("当前无网络,请检查网络设置") |
248 | .setNegative("继续使用", null) | 248 | .setNegative("继续使用", null) |
249 | .setPositive("设置网络", new View.OnClickListener() { | 249 | .setPositive("设置网络", new View.OnClickListener() { |
250 | @Override | 250 | @Override |
251 | public void onClick(View v) { | 251 | public void onClick(View v) { |
252 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 252 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
253 | mContext.startActivity(intent); | 253 | mContext.startActivity(intent); |
254 | } | 254 | } |
255 | }) | 255 | }) |
256 | .show(); | 256 | .show(); |
257 | 257 | ||
258 | } | 258 | } |
259 | }); | 259 | }); |
260 | } | 260 | } |
261 | 261 | ||
262 | //修改密码 | 262 | //修改密码 |
263 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 263 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
264 | RequestParams params = new RequestParams(); | 264 | RequestParams params = new RequestParams(); |
265 | params.put(HttpKey.USERNAME, username); | 265 | params.put(HttpKey.USERNAME, username); |
266 | params.put(HttpKey.OLDPASS, old_pwd1); | 266 | params.put(HttpKey.OLDPASS, old_pwd1); |
267 | params.put(HttpKey.NEWPASS, newpassword3); | 267 | params.put(HttpKey.NEWPASS, newpassword3); |
268 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 268 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
269 | HttpClient.getInstance().setTimeout(10 * 1000); | 269 | HttpClient.getInstance().setTimeout(10 * 1000); |
270 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 270 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
271 | @Override | 271 | @Override |
272 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 272 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
273 | try { | 273 | try { |
274 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 274 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
275 | String status = jsonObject.optString("status"); | 275 | String status = jsonObject.optString("status"); |
276 | if (status.equals("100")) { | 276 | if (status.equals("100")) { |
277 | Log.e("test", "onSuccess" + new String(bytes)); | 277 | Log.e("test", "onSuccess" + new String(bytes)); |
278 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 278 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
279 | SaveParam.getInstance().clearData((Activity) context); | 279 | SaveParam.getInstance().clearData((Activity) context); |
280 | Intent intent = new Intent(); | 280 | Intent intent = new Intent(); |
281 | intent.setClass(context, LoginAndRegisterActivity.class); | 281 | intent.setClass(context, LoginAndRegisterActivity.class); |
282 | ((Activity) context).startActivity(intent); | 282 | ((Activity) context).startActivity(intent); |
283 | ((Activity) context).finish(); | 283 | ((Activity) context).finish(); |
284 | }else{ | 284 | } else { |
285 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 285 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
286 | } | 286 | } |
287 | } catch (JSONException e) { | 287 | } catch (JSONException e) { |
288 | e.printStackTrace(); | 288 | e.printStackTrace(); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
292 | @Override | 292 | @Override |
293 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 293 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
294 | Log.e("test", "onFailure" + new String(bytes)); | 294 | Log.e("test", "onFailure" + new String(bytes)); |
295 | new CircleDialog.Builder((FragmentActivity) context) | 295 | new CircleDialog.Builder((FragmentActivity) context) |
296 | .setCanceledOnTouchOutside(false) | 296 | .setCanceledOnTouchOutside(false) |
297 | .setCancelable(false) | 297 | .setCancelable(false) |
298 | .setWidth(0.5f) | 298 | .setWidth(0.5f) |
299 | .configText(new ConfigText() { | 299 | .configText(new ConfigText() { |
300 | @Override | 300 | @Override |
301 | public void onConfig(TextParams params) { | 301 | public void onConfig(TextParams params) { |
302 | params.gravity = Gravity.CENTER; | 302 | params.gravity = Gravity.CENTER; |
303 | params.padding = new int[]{50, 50, 50, 50}; | 303 | params.padding = new int[]{50, 50, 50, 50}; |
304 | } | 304 | } |
305 | }) | 305 | }) |
306 | .setText("当前无网络,请检查网络设置") | 306 | .setText("当前无网络,请检查网络设置") |
307 | .setNegative("继续使用", null) | 307 | .setNegative("继续使用", null) |
308 | .setPositive("设置网络", new View.OnClickListener() { | 308 | .setPositive("设置网络", new View.OnClickListener() { |
309 | @Override | 309 | @Override |
310 | public void onClick(View v) { | 310 | public void onClick(View v) { |
311 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 311 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
312 | context.startActivity(intent); | 312 | context.startActivity(intent); |
313 | } | 313 | } |
314 | }) | 314 | }) |
315 | .show(); | 315 | .show(); |
316 | } | 316 | } |
317 | }); | 317 | }); |
318 | 318 | ||
319 | } | 319 | } |
320 | 320 | ||
321 | //忘记密码 | 321 | //忘记密码 |
322 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 322 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
323 | RequestParams params = new RequestParams(); | 323 | RequestParams params = new RequestParams(); |
324 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 324 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
325 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 325 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
326 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 326 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
327 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 327 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
328 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 328 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
329 | @Override | 329 | @Override |
330 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 330 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
331 | try { | 331 | try { |
332 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 332 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
333 | String status = jsonObject.optString("status"); | 333 | String status = jsonObject.optString("status"); |
334 | if (status.equals("100")) { | 334 | if (status.equals("100")) { |
335 | Log.e("test", "onSuccess" + new String(bytes)); | 335 | Log.e("test", "onSuccess" + new String(bytes)); |
336 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 336 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
337 | ((Activity) context).finish(); | 337 | ((Activity) context).finish(); |
338 | }else{ | 338 | } else { |
339 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 339 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
340 | } | 340 | } |
341 | } catch (JSONException e) { | 341 | } catch (JSONException e) { |
342 | e.printStackTrace(); | 342 | e.printStackTrace(); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
346 | @Override | 346 | @Override |
347 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 347 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
348 | Log.e("test", "onFailure" + new String(bytes)); | 348 | Log.e("test", "onFailure" + new String(bytes)); |
349 | new CircleDialog.Builder((FragmentActivity) context) | 349 | new CircleDialog.Builder((FragmentActivity) context) |
350 | .setCanceledOnTouchOutside(false) | 350 | .setCanceledOnTouchOutside(false) |
351 | .setCancelable(false) | 351 | .setCancelable(false) |
352 | .setWidth(0.5f) | 352 | .setWidth(0.5f) |
353 | .configText(new ConfigText() { | 353 | .configText(new ConfigText() { |
354 | @Override | 354 | @Override |
355 | public void onConfig(TextParams params) { | 355 | public void onConfig(TextParams params) { |
356 | params.gravity = Gravity.CENTER; | 356 | params.gravity = Gravity.CENTER; |
357 | params.padding = new int[]{50, 50, 50, 50}; | 357 | params.padding = new int[]{50, 50, 50, 50}; |
358 | } | 358 | } |
359 | }) | 359 | }) |
360 | .setText("当前无网络,请检查网络设置") | 360 | .setText("当前无网络,请检查网络设置") |
361 | .setNegative("继续使用", null) | 361 | .setNegative("继续使用", null) |
362 | .setPositive("设置网络", new View.OnClickListener() { | 362 | .setPositive("设置网络", new View.OnClickListener() { |
363 | @Override | 363 | @Override |
364 | public void onClick(View v) { | 364 | public void onClick(View v) { |
365 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 365 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
366 | context.startActivity(intent); | 366 | context.startActivity(intent); |
367 | } | 367 | } |
368 | }) | 368 | }) |
369 | .show(); | 369 | .show(); |
370 | } | 370 | } |
371 | }); | 371 | }); |
372 | 372 | ||
373 | } | 373 | } |
374 | 374 | ||
375 | //保存用户登录信息 | 375 | //保存用户登录信息 |
376 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { | 376 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { |
377 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 377 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
378 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 378 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
379 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 379 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
380 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); | 380 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); |
381 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 381 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
382 | 382 | ||
383 | 383 | ||
384 | } | 384 | } |
385 | 385 | ||
386 | //提交保卡信息 | 386 | //提交保卡信息 |
387 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 387 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
388 | String buyAddress, String buyTime, String alterSaleCall, | 388 | String buyAddress, String buyTime, String alterSaleCall, |
389 | String productModel, String deviceNumber, String macAddress, | 389 | String productModel, String deviceNumber, String macAddress, |
390 | String mobilePhone) { | 390 | String mobilePhone) { |
391 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 391 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
392 | false, true, null); | 392 | false, true, null); |
393 | RequestParams params = new RequestParams(); | 393 | RequestParams params = new RequestParams(); |
394 | 394 | ||
395 | params.put(HttpKey.USEID, userId); | 395 | params.put(HttpKey.USEID, userId); |
396 | params.put(HttpKey.CUSTOMENAME, customerName); | 396 | params.put(HttpKey.CUSTOMENAME, customerName); |
397 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 397 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
398 | params.put(HttpKey.BUYADREES, buyAddress); | 398 | params.put(HttpKey.BUYADREES, buyAddress); |
399 | params.put(HttpKey.BUYTIME, buyTime); | 399 | params.put(HttpKey.BUYTIME, buyTime); |
400 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 400 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
401 | params.put(HttpKey.PRODUCTMODEL, productModel); | 401 | params.put(HttpKey.PRODUCTMODEL, productModel); |
402 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 402 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
403 | params.put(HttpKey.MACADRESS, macAddress); | 403 | params.put(HttpKey.MACADRESS, macAddress); |
404 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 404 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
405 | 405 | ||
406 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 406 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
407 | 407 | ||
408 | Log.e("test", "params" + params); | 408 | Log.e("test", "params" + params); |
409 | HttpClient.getInstance().setTimeout(5 * 1000); | 409 | HttpClient.getInstance().setTimeout(5 * 1000); |
410 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 410 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
411 | @Override | 411 | @Override |
412 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 412 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
413 | JSONObject jsonObject = null; | 413 | JSONObject jsonObject = null; |
414 | closeProgress(); | 414 | closeProgress(); |
415 | try { | 415 | try { |
416 | jsonObject = new JSONObject(new String(bytes)); | 416 | jsonObject = new JSONObject(new String(bytes)); |
417 | String status = jsonObject.optString("status"); | 417 | String status = jsonObject.optString("status"); |
418 | if (status.equals("1")) { | 418 | if (status.equals("1")) { |
419 | Log.e("test", "onSuccess" + jsonObject); | 419 | Log.e("test", "onSuccess" + jsonObject); |
420 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 420 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
421 | Intent intent = new Intent(); | 421 | Intent intent = new Intent(); |
422 | intent.setClass((Activity) context, TheStartPageActivity.class); | 422 | intent.setClass((Activity) context, TheStartPageActivity.class); |
423 | ((Activity) context).startActivity(intent); | 423 | ((Activity) context).startActivity(intent); |
424 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 424 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
425 | ((Activity) context).finish(); | 425 | ((Activity) context).finish(); |
426 | } else { | 426 | } else { |
427 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 427 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
428 | } | 428 | } |
429 | } catch (JSONException e) { | 429 | } catch (JSONException e) { |
430 | e.printStackTrace(); | 430 | e.printStackTrace(); |
431 | } | 431 | } |
432 | 432 | ||
433 | 433 | ||
434 | } | 434 | } |
435 | 435 | ||
436 | @Override | 436 | @Override |
437 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 437 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
438 | Log.e("test", "onFailure" + (throwable)); | 438 | Log.e("test", "onFailure" + (throwable)); |
439 | closeProgress(); | 439 | closeProgress(); |
440 | new CircleDialog.Builder((FragmentActivity) context) | 440 | new CircleDialog.Builder((FragmentActivity) context) |
441 | .setCanceledOnTouchOutside(false) | 441 | .setCanceledOnTouchOutside(false) |
442 | .setCancelable(false) | 442 | .setCancelable(false) |
443 | .setWidth(0.5f) | 443 | .setWidth(0.5f) |
444 | .configText(new ConfigText() { | 444 | .configText(new ConfigText() { |
445 | @Override | 445 | @Override |
446 | public void onConfig(TextParams params) { | 446 | public void onConfig(TextParams params) { |
447 | params.gravity = Gravity.CENTER; | 447 | params.gravity = Gravity.CENTER; |
448 | params.padding = new int[]{50, 50, 50, 50}; | 448 | params.padding = new int[]{50, 50, 50, 50}; |
449 | } | 449 | } |
450 | }) | 450 | }) |
451 | .setText("当前无网络,请检查网络设置") | 451 | .setText("当前无网络,请检查网络设置") |
452 | .setNegative("继续使用", null) | 452 | .setNegative("继续使用", null) |
453 | .setPositive("设置网络", new View.OnClickListener() { | 453 | .setPositive("设置网络", new View.OnClickListener() { |
454 | @Override | 454 | @Override |
455 | public void onClick(View v) { | 455 | public void onClick(View v) { |
456 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 456 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
457 | context.startActivity(intent); | 457 | context.startActivity(intent); |
458 | } | 458 | } |
459 | }) | 459 | }) |
460 | .show(); | 460 | .show(); |
461 | 461 | ||
462 | } | 462 | } |
463 | }); | 463 | }); |
464 | 464 | ||
465 | } | 465 | } |
466 | 466 | ||
467 | //获取保卡信息 | 467 | //获取保卡信息 |
468 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { | 468 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { |
469 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 469 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
470 | false, true, null); | 470 | false, true, null); |
471 | HttpClient.getInstance().setTimeout(5 * 1000); | 471 | HttpClient.getInstance().setTimeout(5 * 1000); |
472 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 472 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
473 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { | 473 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { |
474 | @Override | 474 | @Override |
475 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 475 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
476 | closeProgress(); | 476 | closeProgress(); |
477 | Log.e("test", "保卡信息" + new String(arg2)); | 477 | Log.e("test", "保卡信息" + new String(arg2)); |
478 | try { | 478 | try { |
479 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 479 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
480 | int status = jsonObject.optInt("status"); | 480 | int status = jsonObject.optInt("status"); |
481 | if (status == 1) { | 481 | if (status == 1) { |
482 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 482 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
483 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 483 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
484 | Message msg = Message.obtain(); | 484 | Message msg = Message.obtain(); |
485 | msg.what = HttpCode.SUCHCARDINFO; | 485 | msg.what = HttpCode.SUCHCARDINFO; |
486 | msg.obj = schoolInfoBeanList; | 486 | msg.obj = schoolInfoBeanList; |
487 | handler.sendMessage(msg); | 487 | handler.sendMessage(msg); |
488 | 488 | ||
489 | 489 | ||
490 | } else { | 490 | } else { |
491 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 491 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
492 | 492 | ||
493 | } | 493 | } |
494 | } catch (JSONException e) { | 494 | } catch (JSONException e) { |
495 | e.printStackTrace(); | 495 | e.printStackTrace(); |
496 | } | 496 | } |
497 | 497 | ||
498 | } | 498 | } |
499 | 499 | ||
500 | @Override | 500 | @Override |
501 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 501 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
502 | closeProgress(); | 502 | closeProgress(); |
503 | new CircleDialog.Builder((FragmentActivity) mContext) | 503 | new CircleDialog.Builder((FragmentActivity) mContext) |
504 | .setCanceledOnTouchOutside(false) | 504 | .setCanceledOnTouchOutside(false) |
505 | .setCancelable(false) | 505 | .setCancelable(false) |
506 | .setWidth(0.5f) | 506 | .setWidth(0.5f) |
507 | .configText(new ConfigText() { | 507 | .configText(new ConfigText() { |
508 | @Override | 508 | @Override |
509 | public void onConfig(TextParams params) { | 509 | public void onConfig(TextParams params) { |
510 | params.gravity = Gravity.CENTER; | 510 | params.gravity = Gravity.CENTER; |
511 | params.padding = new int[]{50, 50, 50, 50}; | 511 | params.padding = new int[]{50, 50, 50, 50}; |
512 | } | 512 | } |
513 | }) | 513 | }) |
514 | .setText("当前无网络,请检查网络设置") | 514 | .setText("当前无网络,请检查网络设置") |
515 | .setNegative("继续使用", null) | 515 | .setNegative("继续使用", null) |
516 | .setPositive("设置网络", new View.OnClickListener() { | 516 | .setPositive("设置网络", new View.OnClickListener() { |
517 | @Override | 517 | @Override |
518 | public void onClick(View v) { | 518 | public void onClick(View v) { |
519 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 519 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
520 | mContext.startActivity(intent); | 520 | mContext.startActivity(intent); |
521 | } | 521 | } |
522 | }) | 522 | }) |
523 | .show(); | 523 | .show(); |
524 | } | 524 | } |
525 | }); | 525 | }); |
526 | } | 526 | } |
527 | 527 | ||
528 | //修改保卡信息电话 | 528 | //修改保卡信息电话 |
529 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { | 529 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { |
530 | RequestParams params = new RequestParams(); | 530 | RequestParams params = new RequestParams(); |
531 | params.put("userId", userId); | 531 | params.put("userId", userId); |
532 | params.put("customerPhone", customerPhone); | 532 | params.put("customerPhone", customerPhone); |
533 | params.put("authCode", authCode); | 533 | params.put("authCode", authCode); |
534 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 534 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
535 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 535 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
536 | @Override | 536 | @Override |
537 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 537 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
538 | try { | 538 | try { |
539 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 539 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
540 | String status = jsonObject.optString("status"); | 540 | String status = jsonObject.optString("status"); |
541 | if (status.equals("1")) { | 541 | if (status.equals("1")) { |
542 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 542 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
543 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 543 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
544 | ((Activity) mContext).finish(); | 544 | ((Activity) mContext).finish(); |
545 | } else if (status.equals("1001")) { | 545 | } else if (status.equals("1001")) { |
546 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 546 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
547 | } else { | 547 | } else { |
548 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 548 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
549 | } | 549 | } |
550 | } catch (JSONException e) { | 550 | } catch (JSONException e) { |
551 | e.printStackTrace(); | 551 | e.printStackTrace(); |
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | @Override | 555 | @Override |
556 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 556 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
557 | Log.e("test", "onFailure" + new String(bytes)); | 557 | Log.e("test", "onFailure" + new String(bytes)); |
558 | new CircleDialog.Builder((FragmentActivity) mContext) | 558 | new CircleDialog.Builder((FragmentActivity) mContext) |
559 | .setCanceledOnTouchOutside(false) | 559 | .setCanceledOnTouchOutside(false) |
560 | .setCancelable(false) | 560 | .setCancelable(false) |
561 | .setWidth(0.5f) | 561 | .setWidth(0.5f) |
562 | .configText(new ConfigText() { | 562 | .configText(new ConfigText() { |
563 | @Override | 563 | @Override |
564 | public void onConfig(TextParams params) { | 564 | public void onConfig(TextParams params) { |
565 | params.gravity = Gravity.CENTER; | 565 | params.gravity = Gravity.CENTER; |
566 | params.padding = new int[]{50, 50, 50, 50}; | 566 | params.padding = new int[]{50, 50, 50, 50}; |
567 | } | 567 | } |
568 | }) | 568 | }) |
569 | .setText("当前无网络,请检查网络设置") | 569 | .setText("当前无网络,请检查网络设置") |
570 | .setNegative("继续使用", null) | 570 | .setNegative("继续使用", null) |
571 | .setPositive("设置网络", new View.OnClickListener() { | 571 | .setPositive("设置网络", new View.OnClickListener() { |
572 | @Override | 572 | @Override |
573 | public void onClick(View v) { | 573 | public void onClick(View v) { |
574 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 574 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
575 | mContext.startActivity(intent); | 575 | mContext.startActivity(intent); |
576 | } | 576 | } |
577 | }) | 577 | }) |
578 | .show(); | 578 | .show(); |
579 | } | 579 | } |
580 | }); | 580 | }); |
581 | } | 581 | } |
582 | 582 | ||
583 | //修改保卡信息地址 | 583 | //修改保卡信息地址 |
584 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { | 584 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { |
585 | RequestParams params = new RequestParams(); | 585 | RequestParams params = new RequestParams(); |
586 | params.put("userId", userId); | 586 | params.put("userId", userId); |
587 | params.put("customerPhone", customerPhone); | 587 | params.put("customerPhone", customerPhone); |
588 | params.put("authCode", authCode); | 588 | params.put("authCode", authCode); |
589 | params.put("customerAddress", customerAddress); | 589 | params.put("customerAddress", customerAddress); |
590 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 590 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
591 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 591 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
592 | @Override | 592 | @Override |
593 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 593 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
594 | try { | 594 | try { |
595 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 595 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
596 | String status = jsonObject.optString("status"); | 596 | String status = jsonObject.optString("status"); |
597 | if (status.equals("1")) { | 597 | if (status.equals("1")) { |
598 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 598 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
599 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 599 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
600 | ((Activity) mContext).finish(); | 600 | ((Activity) mContext).finish(); |
601 | } else { | 601 | } else { |
602 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 602 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
603 | } | 603 | } |
604 | } catch (JSONException e) { | 604 | } catch (JSONException e) { |
605 | e.printStackTrace(); | 605 | e.printStackTrace(); |
606 | } | 606 | } |
607 | } | 607 | } |
608 | 608 | ||
609 | @Override | 609 | @Override |
610 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 610 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
611 | Log.e("test", "onFailure" + new String(bytes)); | 611 | Log.e("test", "onFailure" + new String(bytes)); |
612 | new CircleDialog.Builder((FragmentActivity) mContext) | 612 | new CircleDialog.Builder((FragmentActivity) mContext) |
613 | .setCanceledOnTouchOutside(false) | 613 | .setCanceledOnTouchOutside(false) |
614 | .setCancelable(false) | 614 | .setCancelable(false) |
615 | .setWidth(0.5f) | 615 | .setWidth(0.5f) |
616 | .configText(new ConfigText() { | 616 | .configText(new ConfigText() { |
617 | @Override | 617 | @Override |
618 | public void onConfig(TextParams params) { | 618 | public void onConfig(TextParams params) { |
619 | params.gravity = Gravity.CENTER; | 619 | params.gravity = Gravity.CENTER; |
620 | params.padding = new int[]{50, 50, 50, 50}; | 620 | params.padding = new int[]{50, 50, 50, 50}; |
621 | } | 621 | } |
622 | }) | 622 | }) |
623 | .setText("当前无网络,请检查网络设置") | 623 | .setText("当前无网络,请检查网络设置") |
624 | .setNegative("继续使用", null) | 624 | .setNegative("继续使用", null) |
625 | .setPositive("设置网络", new View.OnClickListener() { | 625 | .setPositive("设置网络", new View.OnClickListener() { |
626 | @Override | 626 | @Override |
627 | public void onClick(View v) { | 627 | public void onClick(View v) { |
628 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 628 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
629 | mContext.startActivity(intent); | 629 | mContext.startActivity(intent); |
630 | } | 630 | } |
631 | }) | 631 | }) |
632 | .show(); | 632 | .show(); |
633 | } | 633 | } |
634 | }); | 634 | }); |
635 | } | 635 | } |
636 | 636 | ||
637 | //验证是否保卡信息 | 637 | //验证是否保卡信息 |
638 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { | 638 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { |
639 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 639 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
640 | false, true, null); | 640 | false, true, null); |
641 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 641 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
642 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { | 642 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { |
643 | @Override | 643 | @Override |
644 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 644 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
645 | Log.e("test", "---" + new String(arg2)); | 645 | Log.e("test", "---" + new String(arg2)); |
646 | closeProgress(); | 646 | closeProgress(); |
647 | try { | 647 | Message msg = Message.obtain(); |
648 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 648 | msg.what = HttpCode.CHECKCARD; |
649 | int status = jsonObject.optInt("status"); | 649 | msg.obj = new String(arg2); |
650 | if (status == 1) { | 650 | handler.sendMessage(msg); |
651 | Message msg = Message.obtain(); | ||
652 | msg.what = HttpCode.CHECKCARD; | ||
653 | msg.obj = new String(arg2); | ||
654 | handler.sendMessage(msg); | ||
655 | |||
656 | |||
657 | } else { | ||
658 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | ||
659 | 651 | ||
660 | } | ||
661 | } catch (JSONException e) { | ||
662 | e.printStackTrace(); | ||
663 | } | ||
664 | 652 | ||
665 | } | 653 | } |
666 | 654 | ||
667 | @Override | 655 | @Override |
668 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 656 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
669 | closeProgress(); | 657 | closeProgress(); |
670 | new CircleDialog.Builder((FragmentActivity) mContext) | 658 | new CircleDialog.Builder((FragmentActivity) mContext) |
671 | .setCanceledOnTouchOutside(false) | 659 | .setCanceledOnTouchOutside(false) |
672 | .setCancelable(false) | 660 | .setCancelable(false) |
673 | .setWidth(0.5f) | 661 | .setWidth(0.5f) |
674 | .configText(new ConfigText() { | 662 | .configText(new ConfigText() { |
675 | @Override | 663 | @Override |
676 | public void onConfig(TextParams params) { | 664 | public void onConfig(TextParams params) { |
677 | params.gravity = Gravity.CENTER; | 665 | params.gravity = Gravity.CENTER; |
678 | params.padding = new int[]{50, 50, 50, 50}; | 666 | params.padding = new int[]{50, 50, 50, 50}; |
679 | } | 667 | } |
680 | }) | 668 | }) |
681 | .setText("当前无网络,请检查网络设置") | 669 | .setText("当前无网络,请检查网络设置") |
682 | .setNegative("继续使用", null) | 670 | .setNegative("继续使用", null) |
683 | .setPositive("设置网络", new View.OnClickListener() { | 671 | .setPositive("设置网络", new View.OnClickListener() { |
684 | @Override | 672 | @Override |
685 | public void onClick(View v) { | 673 | public void onClick(View v) { |
686 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 674 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
687 | mContext.startActivity(intent); | 675 | mContext.startActivity(intent); |
688 | } | 676 | } |
689 | }) | 677 | }) |
690 | .show(); | 678 | .show(); |
691 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 679 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
692 | } | 680 | } |
693 | }); | 681 | }); |
694 | } | 682 | } |
695 | 683 | ||
696 | ///获取年级 | 684 | ///获取年级 |
697 | public void getgrade(final Context mContext, final Handler handler) { | 685 | public void getgrade(final Context mContext, final Handler handler) { |
698 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 686 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
699 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 687 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
700 | @Override | 688 | @Override |
701 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 689 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
702 | Log.e("test", "年级" + new String(arg2)); | 690 | Log.e("test", "年级" + new String(arg2)); |
703 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 691 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
704 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 692 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
705 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 693 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
706 | String name = gradeInfo.getData().get(i).getName(); | 694 | String name = gradeInfo.getData().get(i).getName(); |
707 | int id = gradeInfo.getData().get(i).getId(); | 695 | int id = gradeInfo.getData().get(i).getId(); |
708 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 696 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
709 | for (int j = 0; j < gradeinfoList.size(); j++) { | 697 | for (int j = 0; j < gradeinfoList.size(); j++) { |
710 | String secondname = gradeinfoList.get(j).getName(); | 698 | String secondname = gradeinfoList.get(j).getName(); |
711 | int secondid = gradeinfoList.get(j).getId(); | 699 | int secondid = gradeinfoList.get(j).getId(); |
712 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 700 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
713 | dataBean.setName(secondname); | 701 | dataBean.setName(secondname); |
714 | dataBean.setId(secondid); | 702 | dataBean.setId(secondid); |
715 | gradeInfoLists.add(dataBean); | 703 | gradeInfoLists.add(dataBean); |
716 | } | 704 | } |
717 | 705 | ||
718 | } | 706 | } |
719 | 707 | ||
720 | Message message = Message.obtain(); | 708 | Message message = Message.obtain(); |
721 | message.what = HttpCode.GRADER; | 709 | message.what = HttpCode.GRADER; |
722 | message.obj = gradeInfoLists; | 710 | message.obj = gradeInfoLists; |
723 | handler.sendMessage(message); | 711 | handler.sendMessage(message); |
724 | 712 | ||
725 | 713 | ||
726 | } | 714 | } |
727 | 715 | ||
728 | @Override | 716 | @Override |
729 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 717 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
730 | new CircleDialog.Builder((FragmentActivity) mContext) | 718 | new CircleDialog.Builder((FragmentActivity) mContext) |
731 | .setCanceledOnTouchOutside(false) | 719 | .setCanceledOnTouchOutside(false) |
732 | .setCancelable(false) | 720 | .setCancelable(false) |
733 | .setWidth(0.5f) | 721 | .setWidth(0.5f) |
734 | .configText(new ConfigText() { | 722 | .configText(new ConfigText() { |
735 | @Override | 723 | @Override |
736 | public void onConfig(TextParams params) { | 724 | public void onConfig(TextParams params) { |
737 | params.gravity = Gravity.CENTER; | 725 | params.gravity = Gravity.CENTER; |
738 | params.padding = new int[]{50, 50, 50, 50}; | 726 | params.padding = new int[]{50, 50, 50, 50}; |
739 | } | 727 | } |
740 | }) | 728 | }) |
741 | .setText("当前无网络,请检查网络设置") | 729 | .setText("当前无网络,请检查网络设置") |
742 | .setNegative("继续使用", null) | 730 | .setNegative("继续使用", null) |
743 | .setPositive("设置网络", new View.OnClickListener() { | 731 | .setPositive("设置网络", new View.OnClickListener() { |
744 | @Override | 732 | @Override |
745 | public void onClick(View v) { | 733 | public void onClick(View v) { |
746 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 734 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
747 | mContext.startActivity(intent); | 735 | mContext.startActivity(intent); |
748 | } | 736 | } |
749 | }) | 737 | }) |
750 | .show(); | 738 | .show(); |
751 | } | 739 | } |
752 | }); | 740 | }); |
753 | } | 741 | } |
754 | 742 | ||
755 | /** | 743 | /** |
756 | * 获取学校 | 744 | * 获取学校 |
757 | * | 745 | * |
758 | * @param mContext | 746 | * @param mContext |
759 | * @param regionId | 747 | * @param regionId |
760 | * @param gradeId | 748 | * @param gradeId |
761 | * @param handler | 749 | * @param handler |
762 | */ | 750 | */ |
763 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 751 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
764 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 752 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
765 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 753 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
766 | @Override | 754 | @Override |
767 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 755 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
768 | Log.e("test", "学校" + new String(arg2)); | 756 | Log.e("test", "学校" + new String(arg2)); |
769 | try { | 757 | try { |
770 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 758 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
771 | int status = jsonObject.optInt("status"); | 759 | int status = jsonObject.optInt("status"); |
772 | if (status == 1) { | 760 | if (status == 1) { |
773 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 761 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
774 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 762 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
775 | Message message = Message.obtain(); | 763 | Message message = Message.obtain(); |
776 | message.what = HttpCode.SCHOOL; | 764 | message.what = HttpCode.SCHOOL; |
777 | message.obj = schoolInfoBeanList; | 765 | message.obj = schoolInfoBeanList; |
778 | handler.sendMessage(message); | 766 | handler.sendMessage(message); |
779 | 767 | ||
780 | 768 | ||
781 | } else { | 769 | } else { |
782 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 770 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
783 | 771 | ||
784 | } | 772 | } |
785 | } catch (JSONException e) { | 773 | } catch (JSONException e) { |
786 | e.printStackTrace(); | 774 | e.printStackTrace(); |
787 | } | 775 | } |
788 | 776 | ||
789 | } | 777 | } |
790 | 778 | ||
791 | @Override | 779 | @Override |
792 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 780 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
793 | new CircleDialog.Builder((FragmentActivity) mContext) | 781 | new CircleDialog.Builder((FragmentActivity) mContext) |
794 | .setCanceledOnTouchOutside(false) | 782 | .setCanceledOnTouchOutside(false) |
795 | .setCancelable(false) | 783 | .setCancelable(false) |
796 | .setWidth(0.5f) | 784 | .setWidth(0.5f) |
797 | .configText(new ConfigText() { | 785 | .configText(new ConfigText() { |
798 | @Override | 786 | @Override |
799 | public void onConfig(TextParams params) { | 787 | public void onConfig(TextParams params) { |
800 | params.gravity = Gravity.CENTER; | 788 | params.gravity = Gravity.CENTER; |
801 | params.padding = new int[]{50, 50, 50, 50}; | 789 | params.padding = new int[]{50, 50, 50, 50}; |
802 | } | 790 | } |
803 | }) | 791 | }) |
804 | .setText("当前无网络,请检查网络设置") | 792 | .setText("当前无网络,请检查网络设置") |
805 | .setNegative("继续使用", null) | 793 | .setNegative("继续使用", null) |
806 | .setPositive("设置网络", new View.OnClickListener() { | 794 | .setPositive("设置网络", new View.OnClickListener() { |
807 | @Override | 795 | @Override |
808 | public void onClick(View v) { | 796 | public void onClick(View v) { |
809 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 797 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
810 | mContext.startActivity(intent); | 798 | mContext.startActivity(intent); |
811 | } | 799 | } |
812 | }) | 800 | }) |
813 | .show(); | 801 | .show(); |
814 | } | 802 | } |
815 | }); | 803 | }); |
816 | } | 804 | } |
817 | 805 | ||
818 | 806 | ||
819 | /** | 807 | /** |
820 | * 获取个人信息 | 808 | * 获取个人信息 |
821 | * | 809 | * |
822 | * @param mContext | 810 | * @param mContext |
823 | * @param userId | 811 | * @param userId |
824 | * @param handler | 812 | * @param handler |
825 | */ | 813 | */ |
826 | public void getpresonalinfo(final Context mContext, long userId, final Handler handler) { | 814 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
827 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 815 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
828 | false, true, null); | 816 | false, true, null); |
829 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 817 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
830 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 818 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
831 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { | 819 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
832 | @Override | 820 | @Override |
833 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 821 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
834 | closeProgress(); | 822 | closeProgress(); |
835 | Log.e("test", "个人信息" + new String(arg2)); | 823 | Log.e("test", "个人信息" + new String(arg2)); |
836 | try { | 824 | try { |
837 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 825 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
838 | int status = jsonObject.optInt("status"); | 826 | int status = jsonObject.optInt("status"); |
839 | if (status == 1) { | 827 | if (status == 1) { |
840 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 828 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
841 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 829 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
842 | Message message = Message.obtain(); | 830 | Message message = Message.obtain(); |
843 | message.what = HttpCode.GETINFO; | 831 | message.what = HttpCode.GETINFO; |
844 | message.obj = pesonalInfoBeanList; | 832 | message.obj = pesonalInfoBeanList; |
845 | handler.sendMessage(message); | 833 | handler.sendMessage(message); |
846 | 834 | ||
847 | 835 | ||
848 | } else { | 836 | } else { |
849 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 837 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
850 | 838 | ||
851 | } | 839 | } |
852 | } catch (JSONException e) { | 840 | } catch (JSONException e) { |
853 | e.printStackTrace(); | 841 | e.printStackTrace(); |
854 | } | 842 | } |
855 | 843 | ||
856 | 844 | ||
857 | } | 845 | } |
858 | 846 | ||
859 | @Override | 847 | @Override |
860 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 848 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
861 | closeProgress(); | 849 | closeProgress(); |
862 | new CircleDialog.Builder((FragmentActivity) mContext) | 850 | new CircleDialog.Builder((FragmentActivity) mContext) |
863 | .setCanceledOnTouchOutside(false) | 851 | .setCanceledOnTouchOutside(false) |
864 | .setCancelable(false) | 852 | .setCancelable(false) |
865 | .setWidth(0.5f) | 853 | .setWidth(0.5f) |
866 | .configText(new ConfigText() { | 854 | .configText(new ConfigText() { |
867 | @Override | 855 | @Override |
868 | public void onConfig(TextParams params) { | 856 | public void onConfig(TextParams params) { |
869 | params.gravity = Gravity.CENTER; | 857 | params.gravity = Gravity.CENTER; |
870 | params.padding = new int[]{50, 50, 50, 50}; | 858 | params.padding = new int[]{50, 50, 50, 50}; |
871 | } | 859 | } |
872 | }) | 860 | }) |
873 | .setText("当前无网络,请检查网络设置") | 861 | .setText("当前无网络,请检查网络设置") |
874 | .setNegative("继续使用", null) | 862 | .setNegative("继续使用", null) |
875 | .setPositive("设置网络", new View.OnClickListener() { | 863 | .setPositive("设置网络", new View.OnClickListener() { |
876 | @Override | 864 | @Override |
877 | public void onClick(View v) { | 865 | public void onClick(View v) { |
878 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 866 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
879 | mContext.startActivity(intent); | 867 | mContext.startActivity(intent); |
880 | } | 868 | } |
881 | }) | 869 | }) |
882 | .show(); | 870 | .show(); |
883 | } | 871 | } |
884 | }); | 872 | }); |
885 | } | 873 | } |
886 | 874 | ||
887 | //修改个人信息 | 875 | //修改个人信息 |
888 | public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException { | 876 | public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException { |
889 | Gson gson = new Gson(); | 877 | Gson gson = new Gson(); |
890 | String jsonObject = gson.toJson(object); | 878 | String jsonObject = gson.toJson(object); |
891 | Log.e("test", "onSuccess" + jsonObject); | 879 | Log.e("test", "onSuccess" + jsonObject); |
892 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 880 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
893 | false, true, null); | 881 | false, true, null); |
894 | ByteArrayEntity entity = null; | 882 | ByteArrayEntity entity = null; |
895 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); | 883 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); |
896 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 884 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
897 | 885 | ||
898 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 886 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
899 | HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() { | 887 | HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() { |
900 | @Override | 888 | @Override |
901 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 889 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
902 | super.onSuccess(statusCode, headers, response); | 890 | super.onSuccess(statusCode, headers, response); |
903 | closeProgress(); | 891 | closeProgress(); |
904 | String status = response.optString("status"); | 892 | String status = response.optString("status"); |
905 | if (status.equals("1")) { | 893 | if (status.equals("1")) { |
906 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 894 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
907 | ((Activity) mContext).finish(); | 895 | ((Activity) mContext).finish(); |
908 | } else { | 896 | } else { |
909 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 897 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
910 | } | 898 | } |
911 | Log.e("test", "onSuccess" + response); | 899 | Log.e("test", "onSuccess" + response); |
912 | 900 | ||
913 | } | 901 | } |
914 | 902 | ||
915 | @Override | 903 | @Override |
916 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 904 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
917 | super.onFailure(statusCode, headers, throwable, errorResponse); | 905 | super.onFailure(statusCode, headers, throwable, errorResponse); |
918 | closeProgress(); | 906 | closeProgress(); |
919 | Log.e("test", "onFailure" + errorResponse); | 907 | Log.e("test", "onFailure" + errorResponse); |
920 | new CircleDialog.Builder((FragmentActivity) mContext) | 908 | new CircleDialog.Builder((FragmentActivity) mContext) |
921 | .setCanceledOnTouchOutside(false) | 909 | .setCanceledOnTouchOutside(false) |
922 | .setCancelable(false) | 910 | .setCancelable(false) |
923 | .setWidth(0.5f) | 911 | .setWidth(0.5f) |
924 | .configText(new ConfigText() { | 912 | .configText(new ConfigText() { |
925 | @Override | 913 | @Override |
926 | public void onConfig(TextParams params) { | 914 | public void onConfig(TextParams params) { |
927 | params.gravity = Gravity.CENTER; | 915 | params.gravity = Gravity.CENTER; |
928 | params.padding = new int[]{50, 50, 50, 50}; | 916 | params.padding = new int[]{50, 50, 50, 50}; |
929 | } | 917 | } |
930 | }) | 918 | }) |
931 | .setText("当前无网络,请检查网络设置") | 919 | .setText("当前无网络,请检查网络设置") |
932 | .setNegative("继续使用", null) | 920 | .setNegative("继续使用", null) |
933 | .setPositive("设置网络", new View.OnClickListener() { | 921 | .setPositive("设置网络", new View.OnClickListener() { |
934 | @Override | 922 | @Override |
935 | public void onClick(View v) { | 923 | public void onClick(View v) { |
936 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 924 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
937 | mContext.startActivity(intent); | 925 | mContext.startActivity(intent); |
938 | } | 926 | } |
939 | }) | 927 | }) |
940 | .show(); | 928 | .show(); |
941 | } | 929 | } |
942 | 930 | ||
943 | }); | 931 | }); |
944 | } | 932 | } |
945 | 933 | ||
946 | //修改个性签名 | 934 | //修改个性签名 |
947 | public void changsignature(final Context mContext, long userId, final String signature) { | 935 | public void changsignature(final Context mContext, long userId, int type, final String signature) { |
948 | RequestParams params = new RequestParams(); | 936 | RequestParams params = new RequestParams(); |
949 | params.put("userId", userId); | 937 | params.put("userId", userId); |
938 | params.put("type", type); | ||
950 | params.put("signature", signature); | 939 | params.put("signature", signature); |
951 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 940 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
952 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 941 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
953 | @Override | 942 | @Override |
954 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 943 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
955 | try { | 944 | try { |
956 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 945 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
957 | String status = jsonObject.optString("status"); | 946 | String status = jsonObject.optString("status"); |
958 | if (status.equals("1")) { | 947 | if (status.equals("1")) { |
959 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 948 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
960 | } else { | 949 | } else { |
961 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 950 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
962 | } | 951 | } |
963 | } catch (JSONException e) { | 952 | } catch (JSONException e) { |
964 | e.printStackTrace(); | 953 | e.printStackTrace(); |
965 | } | 954 | } |
966 | } | 955 | } |
967 | 956 | ||
968 | @Override | 957 | @Override |
969 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 958 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
970 | Log.e("test", "onFailure" + new String(bytes)); | 959 | Log.e("test", "onFailure" + new String(bytes)); |
971 | new CircleDialog.Builder((FragmentActivity) mContext) | 960 | new CircleDialog.Builder((FragmentActivity) mContext) |
972 | .setCanceledOnTouchOutside(false) | 961 | .setCanceledOnTouchOutside(false) |
973 | .setCancelable(false) | 962 | .setCancelable(false) |
974 | .setWidth(0.5f) | 963 | .setWidth(0.5f) |
975 | .configText(new ConfigText() { | 964 | .configText(new ConfigText() { |
976 | @Override | 965 | @Override |
977 | public void onConfig(TextParams params) { | 966 | public void onConfig(TextParams params) { |
978 | params.gravity = Gravity.CENTER; | 967 | params.gravity = Gravity.CENTER; |
979 | params.padding = new int[]{50, 50, 50, 50}; | 968 | params.padding = new int[]{50, 50, 50, 50}; |
980 | } | 969 | } |
981 | }) | 970 | }) |
982 | .setText("当前无网络,请检查网络设置") | 971 | .setText("当前无网络,请检查网络设置") |
983 | .setNegative("继续使用", null) | 972 | .setNegative("继续使用", null) |
984 | .setPositive("设置网络", new View.OnClickListener() { | 973 | .setPositive("设置网络", new View.OnClickListener() { |
985 | @Override | 974 | @Override |
986 | public void onClick(View v) { | 975 | public void onClick(View v) { |
987 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 976 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
988 | mContext.startActivity(intent); | 977 | mContext.startActivity(intent); |
989 | } | 978 | } |
990 | }) | 979 | }) |
991 | .show(); | 980 | .show(); |
992 | } | 981 | } |
993 | }); | 982 | }); |
994 | } | 983 | } |
995 | 984 | ||
996 | /** | 985 | /** |
997 | * 获取个性签名 | 986 | * 获取个性签名 |
998 | * | 987 | * |
999 | * @param mContext | 988 | * @param mContext |
1000 | * @param userId | 989 | * @param userId |
1001 | * @param handler | 990 | * @param handler |
1002 | */ | 991 | */ |
1003 | public void getsignatures(final Context mContext, long userId, final Handler handler) { | 992 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { |
1004 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 993 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1005 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId, new AsyncHttpResponseHandler() { | 994 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
1006 | @Override | 995 | @Override |
1007 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 996 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1008 | Log.e("test", "个性签名" + new String(arg2)); | 997 | Log.e("test", "个性签名" + new String(arg2)); |
1009 | try { | 998 | try { |
1010 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 999 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1011 | int status = jsonObject.optInt("status"); | 1000 | int status = jsonObject.optInt("status"); |
1012 | if (status == 1) { | 1001 | if (status == 1) { |
1013 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 1002 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
1014 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 1003 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
1015 | Message message = Message.obtain(); | 1004 | Message message = Message.obtain(); |
1016 | message.what = HttpCode.SIGN; | 1005 | message.what = HttpCode.SIGN; |
1017 | message.obj = signInfoBeanList; | 1006 | message.obj = signInfoBeanList; |
1018 | handler.sendMessage(message); | 1007 | handler.sendMessage(message); |
1019 | 1008 | ||
1020 | 1009 | ||
1021 | } else { | 1010 | } else { |
1022 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1011 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1023 | 1012 | ||
1024 | } | 1013 | } |
1025 | } catch (JSONException e) { | 1014 | } catch (JSONException e) { |
1026 | e.printStackTrace(); | 1015 | e.printStackTrace(); |
1027 | } | 1016 | } |
1028 | 1017 | ||
1029 | 1018 | ||
1030 | } | 1019 | } |
1031 | 1020 | ||
1032 | @Override | 1021 | @Override |
1033 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1022 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1034 | Log.e("test", "失败原因" + arg3); | 1023 | Log.e("test", "失败原因" + arg3); |
1035 | new CircleDialog.Builder((FragmentActivity) mContext) | 1024 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1036 | .setCanceledOnTouchOutside(false) | ||
1037 | .setCancelable(false) | ||
1038 | .setWidth(0.5f) | ||
1039 | .configText(new ConfigText() { | ||
1040 | @Override | ||
1041 | public void onConfig(TextParams params) { | ||
1042 | params.gravity = Gravity.CENTER; | ||
1043 | params.padding = new int[]{50, 50, 50, 50}; | ||
1044 | } | ||
1045 | }) | ||
1046 | .setText("当前无网络,请检查网络设置") | ||
1047 | .setNegative("继续使用", null) | ||
1048 | .setPositive("设置网络", new View.OnClickListener() { | ||
1049 | @Override | ||
1050 | public void onClick(View v) { | ||
1051 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | ||
1052 | mContext.startActivity(intent); | ||
1053 | } | ||
1054 | }) | ||
1055 | .show(); | ||
1056 | } | 1025 | } |
1057 | }); | 1026 | }); |
1058 | } | 1027 | } |
1059 | 1028 | ||
1060 | /** | 1029 | /** |
1061 | * 用户反馈 | 1030 | * 用户反馈 |
1062 | * | 1031 | * |
1063 | * @param mContext | 1032 | * @param mContext |
1064 | * @param object | 1033 | * @param object |
1065 | * @throws UnsupportedEncodingException | 1034 | * @throws UnsupportedEncodingException |
1066 | */ | 1035 | */ |
1067 | public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException { | 1036 | public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException { |
1068 | Gson gson = new Gson(); | 1037 | Gson gson = new Gson(); |
1069 | String jsonObject = gson.toJson(object); | 1038 | String jsonObject = gson.toJson(object); |
1070 | Log.e("test", "onSuccess" + jsonObject); | 1039 | Log.e("test", "onSuccess" + jsonObject); |
1071 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 1040 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
1072 | false, true, null); | 1041 | false, true, null); |
1073 | ByteArrayEntity entity = null; | 1042 | ByteArrayEntity entity = null; |
1074 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); | 1043 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); |
1075 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 1044 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
1076 | 1045 | ||
1077 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1046 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
1078 | HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() { | 1047 | HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() { |
1079 | @Override | 1048 | @Override |
1080 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 1049 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
1081 | super.onSuccess(statusCode, headers, response); | 1050 | super.onSuccess(statusCode, headers, response); |
1082 | closeProgress(); | 1051 | closeProgress(); |
1083 | String status = response.optString("status"); | 1052 | String status = response.optString("status"); |
1084 | if (status.equals("1")) { | 1053 | if (status.equals("1")) { |
1085 | Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show(); | 1054 | Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show(); |
1086 | ((Activity) mContext).finish(); | 1055 | ((Activity) mContext).finish(); |
1087 | } else { | 1056 | } else { |
1088 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1057 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
1089 | } | 1058 | } |
1090 | Log.e("test", "onSuccess" + response); | 1059 | Log.e("test", "onSuccess" + response); |
1091 | 1060 | ||
1092 | } | 1061 | } |
1093 | 1062 | ||
1094 | @Override | 1063 | @Override |
1095 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 1064 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
1096 | super.onFailure(statusCode, headers, throwable, errorResponse); | 1065 | super.onFailure(statusCode, headers, throwable, errorResponse); |
1097 | closeProgress(); | 1066 | closeProgress(); |
1098 | Log.e("test", "onFailure" + errorResponse); | 1067 | Log.e("test", "onFailure" + errorResponse); |
1099 | new CircleDialog.Builder((FragmentActivity) mContext) | 1068 | new CircleDialog.Builder((FragmentActivity) mContext) |
1100 | .setCanceledOnTouchOutside(false) | 1069 | .setCanceledOnTouchOutside(false) |
1101 | .setCancelable(false) | 1070 | .setCancelable(false) |
1102 | .setWidth(0.5f) | 1071 | .setWidth(0.5f) |
1103 | .configText(new ConfigText() { | 1072 | .configText(new ConfigText() { |
1104 | @Override | 1073 | @Override |
1105 | public void onConfig(TextParams params) { | 1074 | public void onConfig(TextParams params) { |
1106 | params.gravity = Gravity.CENTER; | 1075 | params.gravity = Gravity.CENTER; |
1107 | params.padding = new int[]{50, 50, 50, 50}; | 1076 | params.padding = new int[]{50, 50, 50, 50}; |
1108 | } | 1077 | } |
1109 | }) | 1078 | }) |
1110 | .setText("当前无网络,请检查网络设置") | 1079 | .setText("当前无网络,请检查网络设置") |
1111 | .setNegative("继续使用", null) | 1080 | .setNegative("继续使用", null) |
1112 | .setPositive("设置网络", new View.OnClickListener() { | 1081 | .setPositive("设置网络", new View.OnClickListener() { |
1113 | @Override | 1082 | @Override |
1114 | public void onClick(View v) { | 1083 | public void onClick(View v) { |
1115 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1084 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1116 | mContext.startActivity(intent); | 1085 | mContext.startActivity(intent); |
1117 | } | 1086 | } |
1118 | }) | 1087 | }) |
1119 | .show(); | 1088 | .show(); |
1120 | } | 1089 | } |
1121 | 1090 | ||
1122 | }); | 1091 | }); |
1123 | } | 1092 | } |
1124 | 1093 | ||
1125 | /** | 1094 | /** |
1126 | * 查询子账户信息 | 1095 | * 查询子账户信息 |
1127 | * | 1096 | * |
1128 | * @param mContext | 1097 | * @param mContext |
1129 | * @param userId | 1098 | * @param userId |
1130 | * @param handler | 1099 | * @param handler |
1131 | */ | 1100 | */ |
1132 | public void getchildAccountinfo(final Context mContext, long userId, final Handler handler) { | 1101 | public void getchildAccountinfo(final Context mContext, long userId, final Handler handler) { |
1133 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", | 1102 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", |
1134 | false, true, null); | 1103 | false, true, null); |
1135 | HttpClient.getInstance().setTimeout(5 * 1000); | 1104 | HttpClient.getInstance().setTimeout(5 * 1000); |
1136 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1105 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1137 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1106 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
1138 | @Override | 1107 | @Override |
1139 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1108 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1140 | closeProgress(); | 1109 | closeProgress(); |
1141 | Log.e("test", "子账户信息" + new String(arg2)); | 1110 | Log.e("test", "子账户信息" + new String(arg2)); |
1142 | try { | 1111 | try { |
1143 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1112 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1144 | int status = jsonObject.optInt("status"); | 1113 | int status = jsonObject.optInt("status"); |
1145 | if (status == 0) { | 1114 | if (status == 0) { |
1146 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 1115 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
1147 | } else if (status == 1000) { | 1116 | } else if (status == 1000) { |
1148 | AlertUtils.showToast(mContext, "你好,你还未添加子账号,子账号为空!"); | 1117 | AlertUtils.showToast(mContext, "你好,你还未添加子账号,子账号为空!"); |
1149 | } else { | 1118 | } else { |
1150 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 1119 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
1151 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 1120 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
1152 | Message msg = Message.obtain(); | 1121 | Message msg = Message.obtain(); |
1153 | msg.what = HttpCode.CHILDS_SUCESS; | 1122 | msg.what = HttpCode.CHILDS_SUCESS; |
1154 | msg.obj = schoolInfoBeanList; | 1123 | msg.obj = schoolInfoBeanList; |
1155 | handler.sendMessage(msg); | 1124 | handler.sendMessage(msg); |
1156 | 1125 | ||
1157 | } | 1126 | } |
1158 | } catch (JSONException e) { | 1127 | } catch (JSONException e) { |
1159 | e.printStackTrace(); | 1128 | e.printStackTrace(); |
1160 | } | 1129 | } |
1161 | 1130 | ||
1162 | } | 1131 | } |
1163 | 1132 | ||
1164 | @Override | 1133 | @Override |
1165 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1134 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1166 | closeProgress(); | 1135 | closeProgress(); |
1167 | Log.e("test", "错误信息" + new String(arg2)); | 1136 | Log.e("test", "错误信息" + new String(arg2)); |
1168 | new CircleDialog.Builder((FragmentActivity) mContext) | 1137 | new CircleDialog.Builder((FragmentActivity) mContext) |
1169 | .setCanceledOnTouchOutside(false) | 1138 | .setCanceledOnTouchOutside(false) |
1170 | .setCancelable(false) | 1139 | .setCancelable(false) |
1171 | .setWidth(0.5f) | 1140 | .setWidth(0.5f) |
1172 | .configText(new ConfigText() { | 1141 | .configText(new ConfigText() { |
1173 | @Override | 1142 | @Override |
1174 | public void onConfig(TextParams params) { | 1143 | public void onConfig(TextParams params) { |
1175 | params.gravity = Gravity.CENTER; | 1144 | params.gravity = Gravity.CENTER; |
1176 | params.padding = new int[]{50, 50, 50, 50}; | 1145 | params.padding = new int[]{50, 50, 50, 50}; |
1177 | } | 1146 | } |
1178 | }) | 1147 | }) |
1179 | .setText("当前无网络,请检查网络设置") | 1148 | .setText("当前无网络,请检查网络设置") |
1180 | .setNegative("继续使用", null) | 1149 | .setNegative("继续使用", null) |
1181 | .setPositive("设置网络", new View.OnClickListener() { | 1150 | .setPositive("设置网络", new View.OnClickListener() { |
1182 | @Override | 1151 | @Override |
1183 | public void onClick(View v) { | 1152 | public void onClick(View v) { |
1184 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1153 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1185 | mContext.startActivity(intent); | 1154 | mContext.startActivity(intent); |
1186 | } | 1155 | } |
1187 | }) | 1156 | }) |
1188 | .show(); | 1157 | .show(); |
1189 | } | 1158 | } |
1190 | }); | 1159 | }); |
1191 | 1160 | ||
1192 | } | 1161 | } |
1193 | 1162 | ||
1194 | /** | 1163 | /** |
1195 | * 删除子账户信息 | 1164 | * 删除子账户信息 |
1196 | * | 1165 | * |
1197 | * @param mContext | 1166 | * @param mContext |
1198 | * @param subAccountId | 1167 | * @param subAccountId |
1199 | */ | 1168 | */ |
1200 | public void deletechildAccountinfo(final Context mContext, long subAccountId) { | 1169 | public void deletechildAccountinfo(final Context mContext, long subAccountId) { |
1201 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 1170 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
1202 | false, true, null); | 1171 | false, true, null); |
1203 | HttpClient.getInstance().setTimeout(5 * 1000); | 1172 | HttpClient.getInstance().setTimeout(5 * 1000); |
1204 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1173 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1205 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 1174 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
1206 | @Override | 1175 | @Override |
1207 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1176 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1208 | closeProgress(); | 1177 | closeProgress(); |
1209 | Log.e("test", "子账户信息" + new String(arg2)); | 1178 | Log.e("test", "子账户信息" + new String(arg2)); |
1210 | try { | 1179 | try { |
1211 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1180 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1212 | int status = jsonObject.optInt("status"); | 1181 | int status = jsonObject.optInt("status"); |
1213 | if (status == 1) { | 1182 | if (status == 1) { |
1214 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 1183 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
1215 | } else { | 1184 | } else { |
1216 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 1185 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
1217 | 1186 | ||
1218 | } | 1187 | } |
1219 | } catch (JSONException e) { | 1188 | } catch (JSONException e) { |
1220 | e.printStackTrace(); | 1189 | e.printStackTrace(); |
1221 | } | 1190 | } |
1222 | 1191 | ||
1223 | } | 1192 | } |
1224 | 1193 | ||
1225 | @Override | 1194 | @Override |
1226 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1195 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1227 | closeProgress(); | 1196 | closeProgress(); |
1228 | Log.e("test", "错误信息" + new String(arg2)); | 1197 | Log.e("test", "错误信息" + new String(arg2)); |
1229 | new CircleDialog.Builder((FragmentActivity) mContext) | 1198 | new CircleDialog.Builder((FragmentActivity) mContext) |
1230 | .setCanceledOnTouchOutside(false) | 1199 | .setCanceledOnTouchOutside(false) |
1231 | .setCancelable(false) | 1200 | .setCancelable(false) |
1232 | .setWidth(0.5f) | 1201 | .setWidth(0.5f) |
1233 | .configText(new ConfigText() { | 1202 | .configText(new ConfigText() { |
1234 | @Override | 1203 | @Override |
1235 | public void onConfig(TextParams params) { | 1204 | public void onConfig(TextParams params) { |
1236 | params.gravity = Gravity.CENTER; | 1205 | params.gravity = Gravity.CENTER; |
1237 | params.padding = new int[]{50, 50, 50, 50}; | 1206 | params.padding = new int[]{50, 50, 50, 50}; |
1238 | } | 1207 | } |
1239 | }) | 1208 | }) |
1240 | .setText("当前无网络,请检查网络设置") | 1209 | .setText("当前无网络,请检查网络设置") |
1241 | .setNegative("继续使用", null) | 1210 | .setNegative("继续使用", null) |
1242 | .setPositive("设置网络", new View.OnClickListener() { | 1211 | .setPositive("设置网络", new View.OnClickListener() { |
1243 | @Override | 1212 | @Override |
1244 | public void onClick(View v) { | 1213 | public void onClick(View v) { |
1245 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1214 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1246 | mContext.startActivity(intent); | 1215 | mContext.startActivity(intent); |
1247 | } | 1216 | } |
1248 | }) | 1217 | }) |
1249 | .show(); | 1218 | .show(); |
1250 | } | 1219 | } |
1251 | }); | 1220 | }); |
1252 | 1221 | ||
1253 | } | 1222 | } |
1254 | 1223 | ||
1255 | /** | 1224 | /** |
1256 | * 添加子账户信息 | 1225 | * 添加子账户信息 |
1257 | */ | 1226 | */ |
1258 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 1227 | public void addchildAccountinfo(final Context mContext, long parentId, String image, |
1259 | String name, String grade, String school, String region) { | 1228 | String name, Long grade, Long school, Long region |
1229 | , String deviceNumber, String regionName) { | ||
1260 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 1230 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
1261 | false, true, null); | 1231 | false, true, null); |
1262 | RequestParams params = new RequestParams(); | 1232 | RequestParams params = new RequestParams(); |
1263 | 1233 | ||
1264 | params.put(HttpKey.PARENTID, parentId); | 1234 | params.put(HttpKey.PARENTID, parentId); |
1265 | params.put(HttpKey.IMAGE, image); | 1235 | params.put(HttpKey.IMAGE, image); |
1266 | params.put(HttpKey.NAME, name); | 1236 | params.put(HttpKey.NAME, name); |
1267 | params.put(HttpKey.GRADE, grade); | 1237 | params.put(HttpKey.GRADE, grade); |
1268 | params.put(HttpKey.SCHOOL, school); | 1238 | params.put(HttpKey.SCHOOL, school); |
1269 | params.put(HttpKey.REGION, region); | 1239 | params.put(HttpKey.REGION, region); |
1240 | params.put(HttpKey.DEVINUMBER, deviceNumber); | ||
1241 | params.put(HttpKey.REGIONNAME, regionName); | ||
1270 | 1242 | ||
1271 | 1243 | Log.e("test", "子账户信息" + params); | |
1272 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1244 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
1273 | HttpClient.getInstance().setTimeout(5 * 1000); | 1245 | HttpClient.getInstance().setTimeout(5 * 1000); |
1274 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1246 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1275 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 1247 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
1276 | @Override | 1248 | @Override |
1277 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1249 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1278 | closeProgress(); | 1250 | closeProgress(); |
1279 | 1251 | ||
1280 | Log.e("test", "子账户信息" + new String(arg2)); | 1252 | Log.e("test", "子账户信息" + new String(arg2)); |
1281 | try { | 1253 | try { |
1282 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1254 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1283 | int status = jsonObject.optInt("status"); | 1255 | int status = jsonObject.optInt("status"); |
1284 | if (status == 1) { | 1256 | if (status == 1) { |
1285 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1257 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
1286 | ((Activity) mContext).finish(); | 1258 | ((Activity) mContext).finish(); |
1287 | } else { | 1259 | } else { |
1288 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1260 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
1289 | 1261 | ||
1290 | } | 1262 | } |
1291 | } catch (JSONException e) { | 1263 | } catch (JSONException e) { |
1292 | e.printStackTrace(); | 1264 | e.printStackTrace(); |
1293 | } | 1265 | } |
1294 | 1266 | ||
1295 | } | 1267 | } |
1296 | 1268 | ||
1297 | @Override | 1269 | @Override |
1298 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1270 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1299 | closeProgress(); | 1271 | closeProgress(); |
1300 | Log.e("test", "错误信息" + new String(arg2)); | 1272 | Log.e("test", "错误信息" + new String(arg2)); |
1301 | new CircleDialog.Builder((FragmentActivity) mContext) | 1273 | new CircleDialog.Builder((FragmentActivity) mContext) |
1302 | .setCanceledOnTouchOutside(false) | 1274 | .setCanceledOnTouchOutside(false) |
1303 | .setCancelable(false) | 1275 | .setCancelable(false) |
1304 | .setWidth(0.5f) | 1276 | .setWidth(0.5f) |
1305 | .configText(new ConfigText() { | 1277 | .configText(new ConfigText() { |
1306 | @Override | 1278 | @Override |
1307 | public void onConfig(TextParams params) { | 1279 | public void onConfig(TextParams params) { |
1308 | params.gravity = Gravity.CENTER; | 1280 | params.gravity = Gravity.CENTER; |
1309 | params.padding = new int[]{50, 50, 50, 50}; | 1281 | params.padding = new int[]{50, 50, 50, 50}; |
1310 | } | 1282 | } |
1311 | }) | 1283 | }) |
1312 | .setText("当前无网络,请检查网络设置") | 1284 | .setText("当前无网络,请检查网络设置") |
1313 | .setNegative("继续使用", null) | 1285 | .setNegative("继续使用", null) |
1314 | .setPositive("设置网络", new View.OnClickListener() { | 1286 | .setPositive("设置网络", new View.OnClickListener() { |
1315 | @Override | 1287 | @Override |
1316 | public void onClick(View v) { | 1288 | public void onClick(View v) { |
1317 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1289 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1318 | mContext.startActivity(intent); | 1290 | mContext.startActivity(intent); |
1319 | } | 1291 | } |
1320 | }) | 1292 | }) |
1321 | .show(); | 1293 | .show(); |
1322 | } | 1294 | } |
1323 | }); | 1295 | }); |
1324 | 1296 | ||
1325 | } | 1297 | } |
1326 | 1298 | ||
1327 | /** | 1299 | /** |
1328 | * 切换子账户信息 | 1300 | * 切换子账户信息 |
1329 | * | 1301 | * |
1330 | * @param mContext | 1302 | * @param mContext |
1331 | * @param subAccountId | 1303 | * @param subAccountId |
1332 | */ | 1304 | */ |
1333 | public void changechildAccountinfo(final Context mContext, long subAccountId, long userId) { | 1305 | public void changechildAccountinfo(final Context mContext, long subAccountId, long userId) { |
1334 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1306 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
1335 | false, true, null); | 1307 | false, true, null); |
1336 | HttpClient.getInstance().setTimeout(5 * 1000); | 1308 | HttpClient.getInstance().setTimeout(5 * 1000); |
1337 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1309 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1338 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId, new AsyncHttpResponseHandler() { | 1310 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId, new AsyncHttpResponseHandler() { |
1339 | @Override | 1311 | @Override |
1340 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1312 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1341 | closeProgress(); | 1313 | closeProgress(); |
1342 | Log.e("test", "子账户信息" + new String(arg2)); | 1314 | Log.e("test", "子账户信息" + new String(arg2)); |
1343 | try { | 1315 | try { |
1344 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1316 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1345 | int status = jsonObject.optInt("status"); | 1317 | int status = jsonObject.optInt("status"); |
1346 | if (status == 1) { | 1318 | if (status == 1) { |
1347 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1319 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
1348 | 1320 | ||
1349 | } else { | 1321 | } else { |
1350 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1322 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
1351 | 1323 | ||
1352 | } | 1324 | } |
1353 | } catch (JSONException e) { | 1325 | } catch (JSONException e) { |
1354 | e.printStackTrace(); | 1326 | e.printStackTrace(); |
1355 | } | 1327 | } |
1356 | 1328 | ||
1357 | } | 1329 | } |
1358 | 1330 | ||
1359 | @Override | 1331 | @Override |
1360 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1332 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1361 | closeProgress(); | 1333 | closeProgress(); |
1362 | Log.e("test", "错误信息" + new String(arg2)); | 1334 | Log.e("test", "错误信息" + new String(arg2)); |
1363 | new CircleDialog.Builder((FragmentActivity) mContext) | 1335 | new CircleDialog.Builder((FragmentActivity) mContext) |
1364 | .setCanceledOnTouchOutside(false) | 1336 | .setCanceledOnTouchOutside(false) |
1365 | .setCancelable(false) | 1337 | .setCancelable(false) |
1366 | .setWidth(0.5f) | 1338 | .setWidth(0.5f) |
1367 | .configText(new ConfigText() { | 1339 | .configText(new ConfigText() { |
1368 | @Override | 1340 | @Override |
1369 | public void onConfig(TextParams params) { | 1341 | public void onConfig(TextParams params) { |
1370 | params.gravity = Gravity.CENTER; | 1342 | params.gravity = Gravity.CENTER; |
1371 | params.padding = new int[]{50, 50, 50, 50}; | 1343 | params.padding = new int[]{50, 50, 50, 50}; |
1372 | } | 1344 | } |
1373 | }) | 1345 | }) |
1374 | .setText("当前无网络,请检查网络设置") | 1346 | .setText("当前无网络,请检查网络设置") |
1375 | .setNegative("继续使用", null) | 1347 | .setNegative("继续使用", null) |
1376 | .setPositive("设置网络", new View.OnClickListener() { | 1348 | .setPositive("设置网络", new View.OnClickListener() { |
1377 | @Override | 1349 | @Override |
1378 | public void onClick(View v) { | 1350 | public void onClick(View v) { |
1379 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1351 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1380 | mContext.startActivity(intent); | 1352 | mContext.startActivity(intent); |
1381 | } | 1353 | } |
1382 | }) | 1354 | }) |
1383 | .show(); | 1355 | .show(); |
1384 | } | 1356 | } |
1385 | }); | 1357 | }); |
1386 | 1358 | ||
1387 | } | 1359 | } |
1388 | 1360 | ||
1389 | /** | 1361 | /** |
1390 | * 系统升级 | 1362 | * 系统升级 |
1391 | * | 1363 | * |
1392 | * @param mContext | 1364 | * @param mContext |
1393 | * @param pid appName | 1365 | * @param pid appName |
1394 | */ | 1366 | */ |
1395 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1367 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
1396 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1368 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
1397 | false, true, null); | 1369 | false, true, null); |
1398 | HttpClient.getInstance().setTimeout(5 * 1000); | 1370 | HttpClient.getInstance().setTimeout(5 * 1000); |
1399 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1371 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1400 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1372 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
1401 | @Override | 1373 | @Override |
1402 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1374 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1403 | closeProgress(); | 1375 | closeProgress(); |
1404 | Log.e("test", "版本升级信息" + new String(arg2)); | 1376 | Log.e("test", "版本升级信息" + new String(arg2)); |
1405 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 | 1377 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 |
1406 | Message msg = Message.obtain(); | 1378 | Message msg = Message.obtain(); |
1407 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1379 | msg.what = HttpCode.APPUPDATE_SUCESS; |
1408 | msg.obj = appVersion; | 1380 | msg.obj = appVersion; |
1409 | handler.sendMessage(msg); | 1381 | handler.sendMessage(msg); |
1410 | 1382 | ||
1411 | 1383 | ||
1412 | } | 1384 | } |
1413 | 1385 | ||
1414 | @Override | 1386 | @Override |
1415 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1387 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1416 | closeProgress(); | 1388 | closeProgress(); |
1417 | Log.e("test", "错误信息" + new String(arg2)); | 1389 | Log.e("test", "错误信息" + new String(arg2)); |
1418 | new CircleDialog.Builder((FragmentActivity) mContext) | 1390 | new CircleDialog.Builder((FragmentActivity) mContext) |
1419 | .setCanceledOnTouchOutside(false) | 1391 | .setCanceledOnTouchOutside(false) |
1420 | .setCancelable(false) | 1392 | .setCancelable(false) |
1421 | .setWidth(0.5f) | 1393 | .setWidth(0.5f) |
1422 | .configText(new ConfigText() { | 1394 | .configText(new ConfigText() { |
1423 | @Override | 1395 | @Override |
1424 | public void onConfig(TextParams params) { | 1396 | public void onConfig(TextParams params) { |
1425 | params.gravity = Gravity.CENTER; | 1397 | params.gravity = Gravity.CENTER; |
1426 | params.padding = new int[]{50, 50, 50, 50}; | 1398 | params.padding = new int[]{50, 50, 50, 50}; |
1427 | } | 1399 | } |
1428 | }) | 1400 | }) |
1429 | .setText("当前无网络,请检查网络设置") | 1401 | .setText("当前无网络,请检查网络设置") |
1430 | .setNegative("继续使用", null) | 1402 | .setNegative("继续使用", null) |
1431 | .setPositive("设置网络", new View.OnClickListener() { | 1403 | .setPositive("设置网络", new View.OnClickListener() { |
1432 | @Override | 1404 | @Override |
1433 | public void onClick(View v) { | 1405 | public void onClick(View v) { |
1434 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1406 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1435 | mContext.startActivity(intent); | 1407 | mContext.startActivity(intent); |
1436 | } | 1408 | } |
1437 | }) | 1409 | }) |
1438 | .show(); | 1410 | .show(); |
1439 | } | 1411 | } |
1440 | }); | 1412 | }); |
1441 | 1413 | ||
1442 | } | 1414 | } |
1443 | 1415 | ||
1444 | 1416 | ||
1445 | ///省级接口 | 1417 | ///省级接口 |
1446 | public void provices(final Context mContext, final Handler handler) { | 1418 | public void provices(final Context mContext, final Handler handler) { |
1447 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1419 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1448 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1420 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
1449 | @Override | 1421 | @Override |
1450 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1422 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1451 | Log.e("test", "省" + new String(arg2)); | 1423 | Log.e("test", "省" + new String(arg2)); |
1452 | try { | 1424 | try { |
1453 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1425 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1454 | int status = jsonObject.optInt("status"); | 1426 | int status = jsonObject.optInt("status"); |
1455 | if (status == 100) { | 1427 | if (status == 100) { |
1456 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1428 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
1457 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1429 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
1458 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1430 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
1459 | Message message = Message.obtain(); | 1431 | Message message = Message.obtain(); |
1460 | message.what = HttpCode.PROVICES; | 1432 | message.what = HttpCode.PROVICES; |
1461 | message.obj = provincesBeanList; | 1433 | message.obj = provincesBeanList; |
1462 | handler.sendMessage(message); | 1434 | handler.sendMessage(message); |
1463 | 1435 | ||
1464 | 1436 | ||
1465 | } else { | 1437 | } else { |
1466 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1438 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1467 | 1439 | ||
1468 | } | 1440 | } |
1469 | } catch (JSONException e) { | 1441 | } catch (JSONException e) { |
1470 | e.printStackTrace(); | 1442 | e.printStackTrace(); |
1471 | } | 1443 | } |
1472 | 1444 | ||
1473 | 1445 | ||
1474 | } | 1446 | } |
1475 | 1447 | ||
1476 | @Override | 1448 | @Override |
1477 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1449 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1478 | new CircleDialog.Builder((FragmentActivity) mContext) | 1450 | new CircleDialog.Builder((FragmentActivity) mContext) |
1479 | .setCanceledOnTouchOutside(false) | 1451 | .setCanceledOnTouchOutside(false) |
1480 | .setCancelable(false) | 1452 | .setCancelable(false) |
1481 | .setWidth(0.5f) | 1453 | .setWidth(0.5f) |
1482 | .configText(new ConfigText() { | 1454 | .configText(new ConfigText() { |
1483 | @Override | 1455 | @Override |
1484 | public void onConfig(TextParams params) { | 1456 | public void onConfig(TextParams params) { |
1485 | params.gravity = Gravity.CENTER; | 1457 | params.gravity = Gravity.CENTER; |
1486 | params.padding = new int[]{50, 50, 50, 50}; | 1458 | params.padding = new int[]{50, 50, 50, 50}; |
1487 | } | 1459 | } |
1488 | }) | 1460 | }) |
1489 | .setText("当前无网络,请检查网络设置") | 1461 | .setText("当前无网络,请检查网络设置") |
1490 | .setNegative("继续使用", null) | 1462 | .setNegative("继续使用", null) |
1491 | .setPositive("设置网络", new View.OnClickListener() { | 1463 | .setPositive("设置网络", new View.OnClickListener() { |
1492 | @Override | 1464 | @Override |
1493 | public void onClick(View v) { | 1465 | public void onClick(View v) { |
1494 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1466 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1495 | mContext.startActivity(intent); | 1467 | mContext.startActivity(intent); |
1496 | } | 1468 | } |
1497 | }) | 1469 | }) |
1498 | .show(); | 1470 | .show(); |
1499 | } | 1471 | } |
1500 | }); | 1472 | }); |
1501 | } | 1473 | } |
1502 | 1474 | ||
1503 | //市级接口 | 1475 | //市级接口 |
1504 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1476 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
1505 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1477 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1506 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1478 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
1507 | @Override | 1479 | @Override |
1508 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1480 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1509 | Log.e("test", "市" + new String(arg2)); | 1481 | Log.e("test", "市" + new String(arg2)); |
1510 | try { | 1482 | try { |
1511 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1483 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1512 | int status = jsonObject.optInt("status"); | 1484 | int status = jsonObject.optInt("status"); |
1513 | if (status == 100) { | 1485 | if (status == 100) { |
1514 | Gson gson = new Gson(); | 1486 | Gson gson = new Gson(); |
1515 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1487 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
1516 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1488 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
1517 | Message message = Message.obtain(); | 1489 | Message message = Message.obtain(); |
1518 | message.what = HttpCode.CITYS; | 1490 | message.what = HttpCode.CITYS; |
1519 | message.obj = cityInfoBeanList; | 1491 | message.obj = cityInfoBeanList; |
1520 | handler.sendMessage(message); | 1492 | handler.sendMessage(message); |
1521 | 1493 | ||
1522 | } else { | 1494 | } else { |
1523 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1495 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1524 | 1496 | ||
1525 | } | 1497 | } |
1526 | } catch (JSONException e) { | 1498 | } catch (JSONException e) { |
1527 | e.printStackTrace(); | 1499 | e.printStackTrace(); |
1528 | } | 1500 | } |
1529 | 1501 | ||
1530 | 1502 | ||
1531 | } | 1503 | } |
1532 | 1504 | ||
1533 | @Override | 1505 | @Override |
1534 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1506 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1535 | new CircleDialog.Builder((FragmentActivity) mContext) | 1507 | new CircleDialog.Builder((FragmentActivity) mContext) |
1536 | .setCanceledOnTouchOutside(false) | 1508 | .setCanceledOnTouchOutside(false) |
1537 | .setCancelable(false) | 1509 | .setCancelable(false) |
1538 | .setWidth(0.5f) | 1510 | .setWidth(0.5f) |
1539 | .configText(new ConfigText() { | 1511 | .configText(new ConfigText() { |
1540 | @Override | 1512 | @Override |
1541 | public void onConfig(TextParams params) { | 1513 | public void onConfig(TextParams params) { |
1542 | params.gravity = Gravity.CENTER; | 1514 | params.gravity = Gravity.CENTER; |
1543 | params.padding = new int[]{50, 50, 50, 50}; | 1515 | params.padding = new int[]{50, 50, 50, 50}; |
1544 | } | 1516 | } |
1545 | }) | 1517 | }) |
1546 | .setText("当前无网络,请检查网络设置") | 1518 | .setText("当前无网络,请检查网络设置") |
1547 | .setNegative("继续使用", null) | 1519 | .setNegative("继续使用", null) |
1548 | .setPositive("设置网络", new View.OnClickListener() { | 1520 | .setPositive("设置网络", new View.OnClickListener() { |
1549 | @Override | 1521 | @Override |
1550 | public void onClick(View v) { | 1522 | public void onClick(View v) { |
1551 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1523 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1552 | mContext.startActivity(intent); | 1524 | mContext.startActivity(intent); |
1553 | } | 1525 | } |
1554 | }) | 1526 | }) |
1555 | .show(); | 1527 | .show(); |
1556 | } | 1528 | } |
1557 | }); | 1529 | }); |
1558 | } | 1530 | } |
1559 | 1531 | ||
1560 | //区县级接口 | 1532 | //区县级接口 |
1561 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1533 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
1562 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1534 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1563 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1535 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
1564 | @Override | 1536 | @Override |
1565 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1537 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1566 | Log.e("test", "区" + new String(arg2)); | 1538 | Log.e("test", "区" + new String(arg2)); |
1567 | try { | 1539 | try { |
1568 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1540 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1569 | int status = jsonObject.optInt("status"); | 1541 | int status = jsonObject.optInt("status"); |
1570 | if (status == 100) { | 1542 | if (status == 100) { |
1571 | Gson gson = new Gson(); | 1543 | Gson gson = new Gson(); |
1572 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1544 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
1573 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1545 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
1574 | Message message = Message.obtain(); | 1546 | Message message = Message.obtain(); |
1575 | message.what = HttpCode.COUNTRY; | 1547 | message.what = HttpCode.COUNTRY; |
1576 | message.obj = countyInfoInfoBeanList; | 1548 | message.obj = countyInfoInfoBeanList; |
1577 | handler.sendMessage(message); | 1549 | handler.sendMessage(message); |
1578 | } else { | 1550 | } else { |
1579 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1551 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1580 | 1552 | ||
1581 | } | 1553 | } |
1582 | } catch (JSONException e) { | 1554 | } catch (JSONException e) { |
1583 | e.printStackTrace(); | 1555 | e.printStackTrace(); |
1584 | } | 1556 | } |
1585 | 1557 | ||
1586 | 1558 | ||
1587 | } | 1559 | } |
1588 | 1560 | ||
1589 | @Override | 1561 | @Override |
1590 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1562 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1591 | new CircleDialog.Builder((FragmentActivity) mContext) | 1563 | new CircleDialog.Builder((FragmentActivity) mContext) |
1592 | .setCanceledOnTouchOutside(false) | 1564 | .setCanceledOnTouchOutside(false) |
1593 | .setCancelable(false) | 1565 | .setCancelable(false) |
1594 | .setWidth(0.5f) | 1566 | .setWidth(0.5f) |
1595 | .configText(new ConfigText() { | 1567 | .configText(new ConfigText() { |
1596 | @Override | 1568 | @Override |
1597 | public void onConfig(TextParams params) { | 1569 | public void onConfig(TextParams params) { |
1598 | params.gravity = Gravity.CENTER; | 1570 | params.gravity = Gravity.CENTER; |
1599 | params.padding = new int[]{50, 50, 50, 50}; | 1571 | params.padding = new int[]{50, 50, 50, 50}; |
1600 | } | 1572 | } |
1601 | }) | 1573 | }) |
1602 | .setText("当前无网络,请检查网络设置") | 1574 | .setText("当前无网络,请检查网络设置") |
1603 | .setNegative("继续使用", null) | 1575 | .setNegative("继续使用", null) |
1604 | .setPositive("设置网络", new View.OnClickListener() { | 1576 | .setPositive("设置网络", new View.OnClickListener() { |
1605 | @Override | 1577 | @Override |
1606 | public void onClick(View v) { | 1578 | public void onClick(View v) { |
1607 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1579 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1608 | mContext.startActivity(intent); | 1580 | mContext.startActivity(intent); |
1609 | } | 1581 | } |
1610 | }) | 1582 | }) |
1611 | .show(); | 1583 | .show(); |
1612 | } | 1584 | } |
1613 | }); | 1585 | }); |
1614 | } | 1586 | } |
1615 | 1587 | ||
1616 | 1588 | ||
1617 | private void closeProgress() { | 1589 | private void closeProgress() { |
1618 | try { | 1590 | try { |
1619 | if (mProgress != null) { | 1591 | if (mProgress != null) { |
1620 | mProgress.dismiss(); | 1592 | mProgress.dismiss(); |
1621 | mProgress = null; | 1593 | mProgress = null; |
1622 | } | 1594 | } |
1623 | } catch (Exception e) { | 1595 | } catch (Exception e) { |
1624 | e.printStackTrace(); | 1596 | e.printStackTrace(); |
1625 | } | 1597 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/TestService.java
File was created | 1 | package com.hjx.personalcenter.service; | |
2 | |||
3 | import android.app.Service; | ||
4 | import android.content.Intent; | ||
5 | import android.os.IBinder; | ||
6 | import android.os.RemoteException; | ||
7 | |||
8 | /** | ||
9 | * Created by h on 2017/9/1. | ||
10 | */ | ||
11 | |||
12 | public class TestService extends Service { | ||
13 | public TestService(){ | ||
14 | |||
15 | } | ||
16 | IPresonalInterface.Stub binder = new IPresonalInterface.Stub() { | ||
17 | @Override | ||
18 | public String sayHello() throws RemoteException { | ||
19 | return "这是测试AIDL的方法"; | ||
20 | } | ||
21 | }; | ||
22 | |||
23 | @Override | ||
24 | public IBinder onBind(Intent intent) { | ||
25 | return binder; | ||
26 | } | ||
27 | } | ||
28 |
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.content.Context; | 3 | import android.content.Context; |
4 | import android.net.wifi.WifiInfo; | 4 | import android.net.wifi.WifiInfo; |
5 | import android.net.wifi.WifiManager; | 5 | import android.net.wifi.WifiManager; |
6 | import android.util.Log; | 6 | import android.util.Log; |
7 | 7 | ||
8 | import com.hjx.personalcenter.model.DeviceInfo; | 8 | import com.hjx.personalcenter.model.DeviceInfo; |
9 | 9 | ||
10 | 10 | ||
11 | public class GetDevicesUtil { | 11 | public class GetDevicesUtil { |
12 | private final static String LOG_TAG = "GetDevicesUtil"; | 12 | private final static String LOG_TAG = "GetDevicesUtil"; |
13 | 13 | ||
14 | public static String getDevicesJson(Context context){ | ||
15 | DeviceInfo mDeviceInfo = new DeviceInfo(); | ||
16 | initDevicesInfo(mDeviceInfo,context); | ||
17 | |||
18 | StringBuilder sb = new StringBuilder(); | ||
19 | sb.append("\"devices\":[{"); | ||
20 | sb.append("\"deviceNumber\":").append("\"").append( mDeviceInfo.getDeviceNumber()).append("\","); | ||
21 | sb.append("\"deviceModel\":").append("\"").append(mDeviceInfo.getDeviceModel()).append("\","); | ||
22 | sb.append("\"mac\":").append("\"").append(mDeviceInfo.getMac()).append("\","); | ||
23 | sb.append("}]"); | ||
24 | Log.i(LOG_TAG, sb.toString()); | ||
25 | return sb.toString(); | ||
26 | } | ||
27 | |||
28 | public static DeviceInfo getDevicesInfo(Context context){ | 14 | public static DeviceInfo getDevicesInfo(Context context){ |
29 | DeviceInfo mDeviceInfo = new DeviceInfo(); | 15 | DeviceInfo mDeviceInfo = new DeviceInfo(); |
30 | initDevicesInfo(mDeviceInfo,context); | 16 | initDevicesInfo(mDeviceInfo,context); |
31 | 17 | ||
32 | return mDeviceInfo; | 18 | return mDeviceInfo; |
33 | } | 19 | } |
34 | 20 | ||
35 | public static void initDevicesInfo(DeviceInfo mDeviceInfo,Context context){ | 21 | public static void initDevicesInfo(DeviceInfo mDeviceInfo,Context context){ |
36 | mDeviceInfo.setDeviceModel(android.os.Build.MODEL); | 22 | mDeviceInfo.setDeviceModel(android.os.Build.MODEL); |
37 | Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceModel()); | 23 | Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceModel()); |
38 | mDeviceInfo.setMac(getMacAddress(context)); | 24 | mDeviceInfo.setMac(getMacAddress(context)); |
39 | Log.e(LOG_TAG,"" + mDeviceInfo.getMac()); | 25 | Log.e(LOG_TAG,"" + mDeviceInfo.getMac()); |
40 | 26 | ||
41 | mDeviceInfo.setDeviceNumber(getCPUSerial(context)); | 27 | mDeviceInfo.setDeviceNumber(getCPUSerial(context)); |
42 | Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceModel()); | 28 | Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceNumber()); |
43 | } | 29 | } |
44 | 30 | ||
45 | private static String getCPUSerial(Context context) { | 31 | private static String getCPUSerial(Context context) { |
46 | return MachineUtil.getMachineCode(context); | 32 | return MachineUtil.getMachineCode(context); |
47 | } | 33 | } |
48 | 34 | ||
49 | private static String getMacAddress(Context mContext){ | 35 | private static String getMacAddress(Context mContext){ |
50 | 36 | ||
51 | String ret = null; | 37 | String ret = null; |
52 | try { | 38 | try { |
53 | WifiManager manager = (WifiManager)mContext.getSystemService(Context.WIFI_SERVICE); | 39 | WifiManager manager = (WifiManager)mContext.getSystemService(Context.WIFI_SERVICE); |
54 | WifiInfo info = manager.getConnectionInfo(); | 40 | WifiInfo info = manager.getConnectionInfo(); |
55 | ret = info.getMacAddress(); | 41 | ret = info.getMacAddress(); |
56 | } catch (Exception e) { | 42 | } catch (Exception e) { |
57 | Log.e(LOG_TAG, "get wifi address wrong", e); | 43 | Log.e(LOG_TAG, "get wifi address wrong", e); |
58 | } | 44 | } |
59 | Log.i(LOG_TAG, "wifi address is" + ret); | 45 | Log.i(LOG_TAG, "wifi address is" + ret); |
60 | return ret; | 46 | return ret; |
61 | } | 47 | } |
62 | } | 48 | } |
63 | 49 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/MachineUtil.java
1 | package com.hjx.personalcenter.util; | 1 | package com.hjx.personalcenter.util; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.content.Context; |
4 | import android.os.Build; | 4 | import android.os.Build; |
5 | import android.provider.Settings; | ||
5 | import android.telephony.TelephonyManager; | 6 | import android.telephony.TelephonyManager; |
6 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
7 | 8 | ||
8 | import java.io.InputStreamReader; | 9 | import java.io.InputStreamReader; |
9 | import java.io.LineNumberReader; | 10 | import java.io.LineNumberReader; |
10 | 11 | ||
11 | public class MachineUtil { | 12 | public class MachineUtil { |
12 | 13 | ||
13 | public static String getMachineCode(Context context) { | 14 | public static String getMachineCode(Context context) { |
14 | String cpuAddress = null; | 15 | String cpuAddress = null; |
15 | try{ | 16 | try{ |
16 | // PmpsManager pmps = new PmpsManager(); | 17 | // PmpsManager pmps = new PmpsManager(); |
17 | // cpuAddress = pmps.getDeviceId(context); | 18 | // cpuAddress = pmps.getDeviceId(context); |
18 | }catch(Exception e){ | 19 | }catch(Exception e){ |
19 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("mac地址获取失败"); | 20 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("mac地址获取失败"); |
20 | }catch(NoClassDefFoundError e){ | 21 | }catch(NoClassDefFoundError e){ |
21 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("设备不是好记星"); | 22 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("设备不是好记星"); |
22 | } | 23 | } |
23 | if(!TextUtils.isEmpty(cpuAddress) && !"A818A81800".equals(cpuAddress)){ | 24 | if(!TextUtils.isEmpty(cpuAddress) && !"A818A81800".equals(cpuAddress)){ |
24 | //Log.e("=========.MACHINE.=========", "function 1 get device id:"+cpuAddress); | 25 | //Log.e("=========.MACHINE.=========", "function 1 get device id:"+cpuAddress); |
25 | return cpuAddress; | 26 | return cpuAddress; |
26 | } | 27 | } |
27 | 28 | ||
28 | try{ | 29 | try{ |
29 | cpuAddress = android.provider.Settings.System.getString(context.getContentResolver(), "serial_number").trim(); | 30 | cpuAddress = android.provider.Settings.System.getString(context.getContentResolver(), "serial_number").trim(); |
30 | }catch(Exception e){ | 31 | }catch(Exception e){ |
31 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 2 get device id error"); | 32 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 2 get device id error"); |
32 | } | 33 | } |
33 | if(!TextUtils.isEmpty(cpuAddress)){ | 34 | if(!TextUtils.isEmpty(cpuAddress)){ |
34 | //Log.e("=========.MACHINE.=========", "function 2 get device id:"+cpuAddress); | 35 | //Log.e("=========.MACHINE.=========", "function 2 get device id:"+cpuAddress); |
35 | return cpuAddress; | 36 | return cpuAddress; |
36 | } | 37 | } |
37 | 38 | ||
38 | try { | 39 | try { |
39 | if("Top".equals(Build.MODEL)){ | 40 | if("Top".equals(Build.MODEL)){ |
40 | String str = "", strCPU = ""; | 41 | String str = "", strCPU = ""; |
41 | // 读取CPU信息 | 42 | // 读取CPU信息 |
42 | Process pp = Runtime.getRuntime().exec("cat/proc/cpuinfo"); | 43 | Process pp = Runtime.getRuntime().exec("cat/proc/cpuinfo"); |
43 | InputStreamReader ir = new InputStreamReader(pp.getInputStream()); | 44 | InputStreamReader ir = new InputStreamReader(pp.getInputStream()); |
44 | LineNumberReader input = new LineNumberReader(ir); | 45 | LineNumberReader input = new LineNumberReader(ir); |
45 | // 查找CPU序列号 | 46 | // 查找CPU序列号 |
46 | for (int i = 1; i < 100; i++) { | 47 | for (int i = 1; i < 100; i++) { |
47 | str = input.readLine(); | 48 | str = input.readLine(); |
48 | if (str != null) { | 49 | if (str != null) { |
49 | // 查找到序列号所在行 | 50 | // 查找到序列号所在行 |
50 | if (str.indexOf("Serial") > -1) { | 51 | if (str.indexOf("Serial") > -1) { |
51 | // 提取序列号 | 52 | // 提取序列号 |
52 | strCPU = str.substring(str.indexOf(":") + 1, str.length()); | 53 | strCPU = str.substring(str.indexOf(":") + 1, str.length()); |
53 | cpuAddress = strCPU.trim(); | 54 | cpuAddress = strCPU.trim(); |
54 | break; | 55 | break; |
55 | } | 56 | } |
56 | } else { | 57 | } else { |
57 | break; | 58 | break; |
58 | } | 59 | } |
59 | } | 60 | } |
60 | } | 61 | } |
61 | } catch (Exception e) { | 62 | } catch (Exception e) { |
62 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 3 get device id error"); | 63 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 3 get device id error"); |
63 | } | 64 | } |
64 | if(!TextUtils.isEmpty(cpuAddress)){ | 65 | if(!TextUtils.isEmpty(cpuAddress)){ |
65 | //Log.e("=========.MACHINE.=========", "function 3 get device id:"+cpuAddress); | 66 | //Log.e("=========.MACHINE.=========", "function 3 get device id:"+cpuAddress); |
66 | return cpuAddress; | 67 | return cpuAddress; |
67 | } | 68 | } |
68 | 69 | ||
69 | try{ | 70 | try{ |
70 | cpuAddress = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); | 71 | TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); |
72 | if (mTelephony.getDeviceId() != null) { | ||
73 | cpuAddress = mTelephony.getDeviceId(); | ||
74 | } else { | ||
75 | //android.provider.Settings; | ||
76 | cpuAddress = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID); | ||
77 | } | ||
78 | //cpuAddress = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); | ||
71 | }catch(Exception e){ | 79 | }catch(Exception e){ |
72 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 4 get device id error"); | 80 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 4 get device id error"); |
73 | } | 81 | } |
74 | if(!TextUtils.isEmpty(cpuAddress)){ | 82 | if(!TextUtils.isEmpty(cpuAddress)){ |
75 | //Log.e("=========.MACHINE.=========", "function 4 get device id:"+cpuAddress); | 83 | //Log.e("=========.MACHINE.=========", "function 4 get device id:"+cpuAddress); |
76 | return cpuAddress; | 84 | return cpuAddress; |
77 | } | 85 | } |
78 | 86 | ||
79 | cpuAddress = "unknown"; | 87 | cpuAddress = "unknown"; |
80 | return cpuAddress; | 88 | return cpuAddress; |
81 | } | 89 | } |
82 | } | 90 | } |
83 | 91 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/QRCodeUtil.java
File was created | 1 | package com.hjx.personalcenter.util; | |
2 | |||
3 | /** | ||
4 | * Created by liujiaqi on 2016/12/6. | ||
5 | */ | ||
6 | |||
7 | import android.graphics.Bitmap; | ||
8 | import android.graphics.BitmapFactory; | ||
9 | import android.graphics.Canvas; | ||
10 | |||
11 | import com.google.zxing.BarcodeFormat; | ||
12 | import com.google.zxing.EncodeHintType; | ||
13 | import com.google.zxing.WriterException; | ||
14 | import com.google.zxing.common.BitMatrix; | ||
15 | import com.google.zxing.qrcode.QRCodeWriter; | ||
16 | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; | ||
17 | |||
18 | import java.io.FileInputStream; | ||
19 | import java.io.FileOutputStream; | ||
20 | import java.io.IOException; | ||
21 | import java.util.HashMap; | ||
22 | import java.util.Map; | ||
23 | |||
24 | /** | ||
25 | * 二维码生成工具类 | ||
26 | */ | ||
27 | public class QRCodeUtil { | ||
28 | /** | ||
29 | * 生成二维码Bitmap | ||
30 | * | ||
31 | * @param content 内容 | ||
32 | * @param widthPix 图片宽度 | ||
33 | * @param heightPix 图片高度 | ||
34 | * @param logoBm 二维码中心的Logo图标(可以为null) | ||
35 | * @param filePath 用于存储二维码图片的文件路径 | ||
36 | */ | ||
37 | public static Bitmap createQRImage(String content, int widthPix, int heightPix, Bitmap logoBm, String filePath) { | ||
38 | Bitmap bitmap=null; | ||
39 | try { | ||
40 | if (content == null || "".equals(content)) { | ||
41 | return null; | ||
42 | } | ||
43 | |||
44 | //配置参数 | ||
45 | Map<EncodeHintType, Object> hints = new HashMap<>(); | ||
46 | hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); | ||
47 | //容错级别 | ||
48 | hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); | ||
49 | //设置空白边距的宽度 | ||
50 | // hints.put(EncodeHintType.MARGIN, 2); //default is 4 | ||
51 | |||
52 | // 图像数据转换,使用了矩阵转换 | ||
53 | BitMatrix bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, widthPix, heightPix, hints); | ||
54 | int[] pixels = new int[widthPix * heightPix]; | ||
55 | // 下面这里按照二维码的算法,逐个生成二维码的图片, | ||
56 | // 两个for循环是图片横列扫描的结果 | ||
57 | for (int y = 0; y < heightPix; y++) { | ||
58 | for (int x = 0; x < widthPix; x++) { | ||
59 | if (bitMatrix.get(x, y)) { | ||
60 | pixels[y * widthPix + x] = 0xff000000; | ||
61 | } else { | ||
62 | pixels[y * widthPix + x] = 0xffffffff; | ||
63 | } | ||
64 | } | ||
65 | } | ||
66 | |||
67 | // 生成二维码图片的格式,使用ARGB_8888 | ||
68 | bitmap = Bitmap.createBitmap(widthPix, heightPix, Bitmap.Config.ARGB_8888); | ||
69 | bitmap.setPixels(pixels, 0, widthPix, 0, 0, widthPix, heightPix); | ||
70 | |||
71 | if (logoBm != null) { | ||
72 | bitmap = addLogo(bitmap, logoBm); | ||
73 | } | ||
74 | |||
75 | //必须使用compress方法将bitmap保存到文件中再进行读取。直接返回的bitmap是没有任何压缩的,内存消耗巨大! | ||
76 | if (bitmap != null) { | ||
77 | bitmap.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(filePath)); | ||
78 | bitmap= BitmapFactory.decodeStream(new FileInputStream(filePath)); | ||
79 | } | ||
80 | |||
81 | } catch (WriterException | IOException e) { | ||
82 | e.printStackTrace(); | ||
83 | } | ||
84 | |||
85 | return bitmap; | ||
86 | } | ||
87 | |||
88 | /** | ||
89 | * 在二维码中间添加Logo图案 | ||
90 | */ | ||
91 | private static Bitmap addLogo(Bitmap src, Bitmap logo) { | ||
92 | if (src == null) { | ||
93 | return null; | ||
94 | } | ||
95 | |||
96 | if (logo == null) { | ||
97 | return src; | ||
98 | } | ||
99 | |||
100 | //获取图片的宽高 | ||
101 | int srcWidth = src.getWidth(); | ||
102 | int srcHeight = src.getHeight(); | ||
103 | int logoWidth = logo.getWidth(); | ||
104 | int logoHeight = logo.getHeight(); | ||
105 | |||
106 | if (srcWidth == 0 || srcHeight == 0) { | ||
107 | return null; | ||
108 | } | ||
109 | |||
110 | if (logoWidth == 0 || logoHeight == 0) { | ||
111 | return src; | ||
112 | } | ||
113 | |||
114 | //logo大小为二维码整体大小的1/5 | ||
115 | float scaleFactor = srcWidth * 1.0f / 5 / logoWidth; | ||
116 | Bitmap bitmap = Bitmap.createBitmap(srcWidth, srcHeight, Bitmap.Config.ARGB_8888); | ||
117 | try { | ||
118 | Canvas canvas = new Canvas(bitmap); | ||
119 | canvas.drawBitmap(src, 0, 0, null); | ||
120 | canvas.scale(scaleFactor, scaleFactor, srcWidth / 2, srcHeight / 2); | ||
121 | canvas.drawBitmap(logo, (srcWidth - logoWidth) / 2, (srcHeight - logoHeight) / 2, null); | ||
122 | |||
123 | canvas.save(Canvas.ALL_SAVE_FLAG); | ||
124 | canvas.restore(); | ||
125 | } catch (Exception e) { | ||
126 | bitmap = null; | ||
127 | e.getStackTrace(); | ||
128 | } | ||
129 | |||
130 | return bitmap; | ||
131 | } | ||
132 | |||
133 | } |
PersonalCenter/app/src/main/res/layout/activity_binding_code.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:orientation="vertical" | ||
4 | android:layout_width="match_parent" | ||
5 | android:gravity="center" | ||
6 | android:layout_height="match_parent"> | ||
7 | <ImageView | ||
8 | android:id="@+id/EQpicture" | ||
9 | android:layout_width="wrap_content" | ||
10 | android:layout_height="wrap_content" /> | ||
11 | |||
12 | </LinearLayout> |
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:textColor="@color/btn_text_color" | 82 | android:textColor="@color/btn_text_color" |
83 | android:textSize="22sp" /> | 83 | android:textSize="22sp" /> |
84 | 84 | ||
85 | <TextView | 85 | <TextView |
86 | android:id="@+id/iv_card_username" | 86 | android:id="@+id/iv_card_username" |
87 | android:layout_width="wrap_content" | 87 | android:layout_width="wrap_content" |
88 | android:layout_height="wrap_content" | 88 | android:layout_height="wrap_content" |
89 | android:layout_marginLeft="60dp" | 89 | android:layout_marginLeft="60dp" |
90 | android:text="" | 90 | android:text="" |
91 | android:textColor="@color/btn_text_color" | 91 | android:textColor="@color/btn_text_color" |
92 | android:textSize="22sp" /> | 92 | android:textSize="22sp" /> |
93 | 93 | ||
94 | </LinearLayout> | 94 | </LinearLayout> |
95 | 95 | ||
96 | </LinearLayout> | 96 | </LinearLayout> |
97 | 97 | ||
98 | <LinearLayout | 98 | <LinearLayout |
99 | android:layout_width="match_parent" | 99 | android:layout_width="match_parent" |
100 | android:layout_height="wrap_content" | 100 | android:layout_height="wrap_content" |
101 | android:gravity="center_vertical" | 101 | android:gravity="center_vertical" |
102 | android:orientation="horizontal"> | 102 | android:orientation="horizontal"> |
103 | 103 | ||
104 | <LinearLayout | 104 | <LinearLayout |
105 | android:layout_width="0dp" | 105 | android:layout_width="0dp" |
106 | android:layout_height="60dp" | 106 | android:layout_height="60dp" |
107 | android:layout_weight="1" | 107 | android:layout_weight="1" |
108 | android:layout_marginLeft="200dp" | 108 | android:layout_marginLeft="200dp" |
109 | android:gravity="center_vertical"> | 109 | android:gravity="center_vertical"> |
110 | 110 | ||
111 | <TextView | 111 | <TextView |
112 | android:layout_width="wrap_content" | 112 | android:layout_width="wrap_content" |
113 | android:layout_height="wrap_content" | 113 | android:layout_height="wrap_content" |
114 | android:text="产品型号" | 114 | android:text="产品型号" |
115 | android:textColor="@color/btn_text_color" | 115 | android:textColor="@color/btn_text_color" |
116 | android:textSize="22sp" /> | 116 | android:textSize="22sp" /> |
117 | 117 | ||
118 | <TextView | 118 | <TextView |
119 | android:id="@+id/tv_card_deviceModel" | 119 | android:id="@+id/tv_card_deviceModel" |
120 | android:layout_width="wrap_content" | 120 | android:layout_width="wrap_content" |
121 | android:layout_height="wrap_content" | 121 | android:layout_height="wrap_content" |
122 | android:layout_marginLeft="50dp" | 122 | android:layout_marginLeft="50dp" |
123 | android:text="" | 123 | android:text="" |
124 | android:textSize="22sp" /> | 124 | android:textSize="22sp" /> |
125 | 125 | ||
126 | 126 | ||
127 | </LinearLayout> | 127 | </LinearLayout> |
128 | 128 | ||
129 | <LinearLayout | 129 | <LinearLayout |
130 | android:layout_width="0dp" | 130 | android:layout_width="0dp" |
131 | android:layout_height="60dp" | 131 | android:layout_height="60dp" |
132 | android:layout_weight="1" | 132 | android:layout_weight="1" |
133 | android:layout_marginLeft="80dp" | 133 | android:layout_marginLeft="80dp" |
134 | android:gravity="center_vertical"> | 134 | android:gravity="center_vertical"> |
135 | 135 | ||
136 | <TextView | 136 | <TextView |
137 | android:layout_width="wrap_content" | 137 | android:layout_width="wrap_content" |
138 | android:layout_height="wrap_content" | 138 | android:layout_height="wrap_content" |
139 | android:textColor="@color/btn_text_color" | 139 | android:textColor="@color/btn_text_color" |
140 | android:text="客户地址" | 140 | android:text="客户地址" |
141 | android:textSize="22sp" /> | 141 | android:textSize="22sp" /> |
142 | 142 | ||
143 | <TextView | 143 | <TextView |
144 | android:id="@+id/tv_card_adress" | 144 | android:id="@+id/tv_card_adress" |
145 | android:layout_width="wrap_content" | 145 | android:layout_width="wrap_content" |
146 | android:layout_height="wrap_content" | 146 | android:layout_height="wrap_content" |
147 | android:layout_marginLeft="60dp" | 147 | android:layout_marginLeft="60dp" |
148 | android:text="" | 148 | android:text="" |
149 | android:textSize="22sp" /> | 149 | android:textSize="22sp" /> |
150 | <TextView | 150 | <TextView |
151 | android:id="@+id/tv_card_adress_change" | 151 | android:id="@+id/tv_card_adress_change" |
152 | android:layout_width="wrap_content" | 152 | android:layout_width="wrap_content" |
153 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
154 | android:layout_marginLeft="18dp" | 154 | android:layout_marginLeft="18dp" |
155 | android:background="@drawable/corcle_black_bg" | 155 | android:background="@drawable/corcle_black_bg" |
156 | android:text="修改" | 156 | android:text="修改" |
157 | android:paddingLeft="5dp" | 157 | android:paddingLeft="5dp" |
158 | android:paddingRight="5dp" | 158 | android:paddingRight="5dp" |
159 | android:textColor="@color/login_text_blue" | 159 | android:textColor="@color/login_text_blue" |
160 | android:textSize="18sp" /> | 160 | android:textSize="18sp" /> |
161 | 161 | ||
162 | 162 | ||
163 | </LinearLayout> | 163 | </LinearLayout> |
164 | 164 | ||
165 | </LinearLayout> | 165 | </LinearLayout> |
166 | 166 | ||
167 | <LinearLayout | 167 | <LinearLayout |
168 | android:layout_width="match_parent" | 168 | android:layout_width="match_parent" |
169 | android:layout_height="wrap_content" | 169 | android:layout_height="wrap_content" |
170 | android:gravity="center_vertical" | 170 | android:gravity="center_vertical" |
171 | android:orientation="horizontal"> | 171 | android:orientation="horizontal"> |
172 | 172 | ||
173 | <LinearLayout | 173 | <LinearLayout |
174 | android:layout_width="0dp" | 174 | android:layout_width="0dp" |
175 | android:layout_height="60dp" | 175 | android:layout_height="60dp" |
176 | android:layout_weight="1" | 176 | android:layout_weight="1" |
177 | android:layout_marginLeft="200dp" | 177 | android:layout_marginLeft="200dp" |
178 | android:gravity="center_vertical"> | 178 | android:gravity="center_vertical"> |
179 | 179 | ||
180 | <TextView | 180 | <TextView |
181 | android:layout_width="wrap_content" | 181 | android:layout_width="wrap_content" |
182 | android:layout_height="wrap_content" | 182 | android:layout_height="wrap_content" |
183 | android:textColor="@color/btn_text_color" | 183 | android:textColor="@color/btn_text_color" |
184 | android:text="MAC地址" | 184 | android:text="MAC地址" |
185 | android:textSize="22sp" /> | 185 | android:textSize="22sp" /> |
186 | 186 | ||
187 | <TextView | 187 | <TextView |
188 | android:id="@+id/tv_card_mac" | 188 | android:id="@+id/tv_card_mac" |
189 | android:layout_width="wrap_content" | 189 | android:layout_width="wrap_content" |
190 | android:layout_height="wrap_content" | 190 | android:layout_height="wrap_content" |
191 | android:layout_marginLeft="50dp" | 191 | android:layout_marginLeft="50dp" |
192 | android:background="@null" | 192 | android:background="@null" |
193 | android:text="" | 193 | android:text="" |
194 | android:textSize="22sp" /> | 194 | android:textSize="22sp" /> |
195 | 195 | ||
196 | </LinearLayout> | 196 | </LinearLayout> |
197 | 197 | ||
198 | <LinearLayout | 198 | <LinearLayout |
199 | android:layout_width="0dp" | 199 | android:layout_width="0dp" |
200 | android:layout_height="60dp" | 200 | android:layout_height="60dp" |
201 | android:layout_weight="1" | 201 | android:layout_weight="1" |
202 | android:layout_marginLeft="80dp" | 202 | android:layout_marginLeft="80dp" |
203 | android:gravity="center_vertical"> | 203 | android:gravity="center_vertical"> |
204 | 204 | ||
205 | <TextView | 205 | <TextView |
206 | android:layout_width="wrap_content" | 206 | android:layout_width="wrap_content" |
207 | android:layout_height="wrap_content" | 207 | android:layout_height="wrap_content" |
208 | android:text="购买时间" | 208 | android:text="购买时间" |
209 | android:textColor="@color/btn_text_color" | 209 | android:textColor="@color/btn_text_color" |
210 | android:textSize="22sp" /> | 210 | android:textSize="22sp" /> |
211 | 211 | ||
212 | <TextView | 212 | <TextView |
213 | android:id="@+id/tv_card_time" | 213 | android:id="@+id/tv_card_time" |
214 | android:layout_width="wrap_content" | 214 | android:layout_width="wrap_content" |
215 | android:layout_height="wrap_content" | 215 | android:layout_height="wrap_content" |
216 | android:layout_marginLeft="60dp" | 216 | android:layout_marginLeft="60dp" |
217 | android:background="@null" | 217 | android:background="@null" |
218 | android:text="" | 218 | android:text="" |
219 | android:textColor="@color/btn_text_color" | 219 | android:textColor="@color/btn_text_color" |
220 | android:textSize="22sp" /> | 220 | android:textSize="22sp" /> |
221 | </LinearLayout> | 221 | </LinearLayout> |
222 | 222 | ||
223 | </LinearLayout> | 223 | </LinearLayout> |
224 | 224 | ||
225 | <LinearLayout | 225 | <LinearLayout |
226 | android:layout_width="match_parent" | 226 | android:layout_width="match_parent" |
227 | android:layout_height="wrap_content" | 227 | android:layout_height="wrap_content" |
228 | android:gravity="center_vertical" | 228 | android:gravity="center_vertical" |
229 | android:orientation="horizontal"> | 229 | android:orientation="horizontal"> |
230 | 230 | ||
231 | <LinearLayout | 231 | <LinearLayout |
232 | android:layout_width="0dp" | 232 | android:layout_width="0dp" |
233 | android:layout_height="60dp" | 233 | android:layout_height="60dp" |
234 | android:layout_weight="1" | 234 | android:layout_weight="1" |
235 | android:layout_marginLeft="200dp" | 235 | android:layout_marginLeft="200dp" |
236 | android:gravity="center_vertical"> | 236 | android:gravity="center_vertical"> |
237 | 237 | ||
238 | <TextView | 238 | <TextView |
239 | android:layout_width="wrap_content" | 239 | android:layout_width="wrap_content" |
240 | android:layout_height="wrap_content" | 240 | android:layout_height="wrap_content" |
241 | android:text="机身编码" | 241 | android:text="机身编码" |
242 | android:textColor="@color/btn_text_color" | 242 | android:textColor="@color/btn_text_color" |
243 | android:textSize="22sp" /> | 243 | android:textSize="22sp" /> |
244 | 244 | ||
245 | <TextView | 245 | <TextView |
246 | android:id="@+id/tv_card_deviceNumber" | 246 | android:id="@+id/tv_card_deviceNumber" |
247 | android:layout_width="wrap_content" | 247 | android:layout_width="wrap_content" |
248 | android:layout_height="wrap_content" | 248 | android:layout_height="wrap_content" |
249 | android:layout_marginLeft="50dp" | 249 | android:layout_marginLeft="50dp" |
250 | android:hint="" | 250 | android:hint="" |
251 | android:textSize="22sp" /> | 251 | android:textSize="22sp" /> |
252 | 252 | ||
253 | </LinearLayout> | 253 | </LinearLayout> |
254 | 254 | ||
255 | <LinearLayout | 255 | <LinearLayout |
256 | android:layout_width="0dp" | 256 | android:layout_width="0dp" |
257 | android:layout_height="60dp" | 257 | android:layout_height="60dp" |
258 | android:layout_weight="1" | 258 | android:layout_weight="1" |
259 | android:layout_marginLeft="80dp" | 259 | android:layout_marginLeft="80dp" |
260 | android:gravity="center_vertical"> | 260 | android:gravity="center_vertical"> |
261 | 261 | ||
262 | <TextView | 262 | <TextView |
263 | android:layout_width="wrap_content" | 263 | android:layout_width="wrap_content" |
264 | android:layout_height="wrap_content" | 264 | android:layout_height="wrap_content" |
265 | android:text="购买地址" | 265 | android:text="购买地址" |
266 | android:textColor="@color/btn_text_color" | 266 | android:textColor="@color/btn_text_color" |
267 | android:textSize="22sp" /> | 267 | android:textSize="22sp" /> |
268 | 268 | ||
269 | <TextView | 269 | <TextView |
270 | android:id="@+id/tv_card_shopAdress" | 270 | android:id="@+id/tv_card_shopAdress" |
271 | android:layout_width="wrap_content" | 271 | android:layout_width="wrap_content" |
272 | android:layout_height="wrap_content" | 272 | android:layout_height="wrap_content" |
273 | android:layout_marginLeft="60dp" | 273 | android:layout_marginLeft="60dp" |
274 | android:text="" | 274 | android:text="" |
275 | android:textColor="@color/btn_text_color" | 275 | android:textColor="@color/btn_text_color" |
276 | android:textSize="22sp" /> | 276 | android:textSize="22sp" /> |
277 | </LinearLayout> | 277 | </LinearLayout> |
278 | 278 | ||
279 | </LinearLayout> | 279 | </LinearLayout> |
280 | 280 | ||
281 | <LinearLayout | 281 | <LinearLayout |
282 | android:layout_width="match_parent" | 282 | android:layout_width="match_parent" |
283 | android:layout_height="wrap_content" | 283 | android:layout_height="wrap_content" |
284 | android:gravity="center_vertical" | 284 | android:gravity="center_vertical" |
285 | android:layout_marginBottom="30dp" | 285 | android:layout_marginBottom="30dp" |
286 | android:orientation="horizontal"> | 286 | android:orientation="horizontal"> |
287 | 287 | ||
288 | <LinearLayout | 288 | <LinearLayout |
289 | android:layout_width="0dp" | 289 | android:layout_width="0dp" |
290 | android:layout_height="60dp" | 290 | android:layout_height="60dp" |
291 | android:layout_weight="1" | 291 | android:layout_weight="1" |
292 | android:layout_marginLeft="200dp" | 292 | android:layout_marginLeft="200dp" |
293 | android:gravity="center_vertical"> | 293 | android:gravity="center_vertical"> |
294 | 294 | ||
295 | <TextView | 295 | <TextView |
296 | android:layout_width="wrap_content" | 296 | android:layout_width="wrap_content" |
297 | android:layout_height="wrap_content" | 297 | android:layout_height="wrap_content" |
298 | android:text="手机号码" | 298 | android:text="手机号码" |
299 | android:textColor="@color/btn_text_color" | 299 | android:textColor="@color/btn_text_color" |
300 | android:textSize="22sp" /> | 300 | android:textSize="22sp" /> |
301 | 301 | ||
302 | <TextView | 302 | <TextView |
303 | android:id="@+id/tv_card_phone" | 303 | android:id="@+id/tv_card_phone" |
304 | android:layout_width="wrap_content" | 304 | android:layout_width="wrap_content" |
305 | android:layout_height="wrap_content" | 305 | android:layout_height="wrap_content" |
306 | android:layout_marginLeft="50dp" | 306 | android:layout_marginLeft="50dp" |
307 | android:text="" | 307 | android:text="" |
308 | android:textSize="22sp" /> | 308 | android:textSize="22sp" /> |
309 | <TextView | 309 | <TextView |
310 | android:id="@+id/tv_card_phone_change" | 310 | android:id="@+id/tv_card_phone_change" |
311 | android:layout_width="wrap_content" | 311 | android:layout_width="wrap_content" |
312 | android:layout_height="wrap_content" | 312 | android:layout_height="wrap_content" |
313 | android:layout_marginLeft="18dp" | 313 | android:layout_marginLeft="18dp" |
314 | android:background="@drawable/corcle_black_bg" | 314 | android:background="@drawable/corcle_black_bg" |
315 | android:text="修改" | 315 | android:text="修改" |
316 | android:paddingLeft="5dp" | 316 | android:paddingLeft="5dp" |
317 | android:paddingRight="5dp" | 317 | android:paddingRight="5dp" |
318 | android:textColor="@color/login_text_blue" | 318 | android:textColor="@color/login_text_blue" |
319 | android:textSize="18sp" /> | 319 | android:textSize="18sp" /> |
320 | 320 | ||
321 | 321 | ||
322 | </LinearLayout> | 322 | </LinearLayout> |
323 | 323 | ||
324 | <LinearLayout | 324 | <LinearLayout |
325 | android:layout_width="0dp" | 325 | android:layout_width="0dp" |
326 | android:layout_height="60dp" | 326 | android:layout_height="60dp" |
327 | android:layout_weight="1" | 327 | android:layout_weight="1" |
328 | android:layout_marginLeft="80dp" | 328 | android:layout_marginLeft="80dp" |
329 | android:gravity="center_vertical"> | 329 | android:gravity="center_vertical"> |
330 | 330 | ||
331 | <TextView | 331 | <TextView |
332 | android:layout_width="wrap_content" | 332 | android:layout_width="wrap_content" |
333 | android:layout_height="wrap_content" | 333 | android:layout_height="wrap_content" |
334 | android:textColor="@color/btn_text_color" | 334 | android:textColor="@color/btn_text_color" |
335 | android:text="本地售后电话" | 335 | android:text="本地售后电话" |
336 | android:textSize="22sp" /> | 336 | android:textSize="22sp" /> |
337 | 337 | ||
338 | <TextView | 338 | <TextView |
339 | android:id="@+id/tv_card_tleNember" | 339 | android:id="@+id/tv_card_tleNember" |
340 | android:layout_width="wrap_content" | 340 | android:layout_width="wrap_content" |
341 | android:layout_height="wrap_content" | 341 | android:layout_height="wrap_content" |
342 | android:layout_marginLeft="60dp" | 342 | android:layout_marginLeft="60dp" |
343 | android:background="@null" | 343 | android:background="@null" |
344 | android:text="" | 344 | android:text="" |
345 | android:textSize="22sp" /> | 345 | android:textSize="22sp" /> |
346 | 346 | ||
347 | </LinearLayout> | 347 | </LinearLayout> |
348 | 348 | ||
349 | </LinearLayout> | 349 | </LinearLayout> |
350 | </LinearLayout> | 350 | </LinearLayout> |
351 | 351 | ||
352 | <LinearLayout | 352 | <LinearLayout |
353 | android:layout_width="match_parent" | 353 | android:layout_width="match_parent" |
354 | android:layout_height="wrap_content" | 354 | android:layout_height="wrap_content" |
355 | android:layout_marginTop="5dp" | 355 | android:layout_marginTop="5dp" |
356 | android:gravity="center" | 356 | android:gravity="center" |
357 | android:orientation="vertical"> | 357 | android:orientation="vertical"> |
358 | 358 | ||
359 | <TextView | 359 | <TextView |
360 | android:layout_width="wrap_content" | 360 | android:layout_width="wrap_content" |
361 | android:layout_height="wrap_content" | 361 | android:layout_height="wrap_content" |
362 | android:layout_marginTop="5dp" | 362 | android:layout_marginTop="5dp" |
363 | android:text="@string/electronic_card" | 363 | android:text="@string/electronic_card" |
364 | android:textColor="@color/electronic_text" | 364 | android:textColor="@color/electronic_text" |
365 | android:textSize="18sp" /> | 365 | android:textSize="18sp" /> |
366 | 366 | ||
367 | 367 | ||
368 | 368 | ||
369 | </LinearLayout> | 369 | </LinearLayout> |
370 | <LinearLayout | 370 | <LinearLayout |
371 | android:layout_width="match_parent" | 371 | android:layout_width="match_parent" |
372 | android:layout_height="wrap_content" | 372 | android:layout_height="wrap_content" |
373 | android:layout_marginTop="30dp" | 373 | android:layout_marginTop="30dp" |
374 | android:gravity="center" | 374 | android:gravity="center" |
375 | android:orientation="horizontal"> | 375 | android:orientation="horizontal"> |
376 | 376 | ||
377 | <ImageView | 377 | <ImageView |
378 | android:layout_width="wrap_content" | 378 | android:layout_width="wrap_content" |
379 | android:layout_height="wrap_content" | 379 | android:layout_height="wrap_content" |
380 | android:src="@mipmap/phone"/> | 380 | android:src="@mipmap/phone"/> |
381 | <TextView | 381 | <TextView |
382 | android:layout_width="wrap_content" | 382 | android:layout_width="wrap_content" |
383 | android:layout_height="wrap_content" | 383 | android:layout_height="wrap_content" |
384 | android:textSize="30sp" | 384 | android:textSize="30sp" |
385 | android:layout_marginLeft="5dp" | 385 | android:layout_marginLeft="5dp" |
386 | android:textColor="@color/login_text_blue" | 386 | android:textColor="@color/login_text_blue" |
387 | android:text="400-400-000"/> | 387 | android:text="4006-123-678"/> |
388 | 388 | ||
389 | 389 | ||
390 | </LinearLayout> | 390 | </LinearLayout> |
391 | 391 | ||
392 | 392 | ||
393 | 393 | ||
394 | </LinearLayout> | 394 | </LinearLayout> |