Commit 1ab8c799948e751fb22b8417aae4a47642d2de94

Authored by xiongwei
1 parent c7ea65ea71
Exists in master

个人信息,获取个人信息,个性签名,账户管理等等,接口的重新调试

Showing 19 changed files with 316 additions and 133 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_7" 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_8" 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 45 debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
46 releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
46 } 47 }
47 48
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 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
6 <application 5 <application
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 </application> 119 </application>
120 <!--权限--> 120 <!--权限-->
121 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
121 <uses-permission android:name="android.permission.CAMERA" /> 122 <uses-permission android:name="android.permission.CAMERA" />
122 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 123 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
123 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 124 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
124 <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> 125 <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
125 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 126 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
126 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 127 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
127 <uses-permission android:name="android.permission.CALL_PHONE" /> 128 <uses-permission android:name="android.permission.CALL_PHONE" />
128 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 129 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
129 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> 130 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
130 <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> 131 <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
131 <uses-permission android:name="android.permission.INTERNET" /> 132 <uses-permission android:name="android.permission.INTERNET" />
132 <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 133 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
133 <uses-permission android:name="android.permission.READ_LOGS" /> 134 <uses-permission android:name="android.permission.READ_LOGS" />
134 135
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/AccountManagementActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.os.Handler; 5 import android.os.Handler;
6 import android.os.Message; 6 import android.os.Message;
7 import android.support.v7.app.AppCompatActivity; 7 import android.support.v7.app.AppCompatActivity;
8 import android.support.v7.widget.LinearLayoutManager; 8 import android.support.v7.widget.LinearLayoutManager;
9 import android.support.v7.widget.RecyclerView; 9 import android.support.v7.widget.RecyclerView;
10 import android.view.View; 10 import android.view.View;
11 import android.widget.ImageView; 11 import android.widget.ImageView;
12 import android.widget.LinearLayout; 12 import android.widget.LinearLayout;
13 import android.widget.TextView; 13 import android.widget.TextView;
14 14
15 import com.hjx.personalcenter.R; 15 import com.hjx.personalcenter.R;
16 import com.hjx.personalcenter.adapter.AccountChildsAdapter; 16 import com.hjx.personalcenter.adapter.AccountChildsAdapter;
17 import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; 17 import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem;
18 import com.hjx.personalcenter.db.Content; 18 import com.hjx.personalcenter.db.Content;
19 import com.hjx.personalcenter.db.SaveParam; 19 import com.hjx.personalcenter.db.SaveParam;
20 import com.hjx.personalcenter.http.HttpCode; 20 import com.hjx.personalcenter.http.HttpCode;
21 import com.hjx.personalcenter.http.HttpManager; 21 import com.hjx.personalcenter.http.HttpManager;
22 import com.hjx.personalcenter.model.ChildsInfo; 22 import com.hjx.personalcenter.model.ChildsInfo;
23 23
24 import java.util.ArrayList; 24 import java.util.ArrayList;
25 import java.util.List; 25 import java.util.List;
26 26
27 /**账户管理 熊巍 27 /**账户管理 熊巍
28 * Created by h on 2017/8/12. 28 * Created by h on 2017/8/12.
29 */ 29 */
30 30
31 public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener { 31 public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener {
32 private TextView changbangding,changpassword,usernames, 32 private TextView changbangding,changpassword,usernames,
33 tv_username,tv_grade,tv_school,tv_adress, tv_delete; 33 tv_username,tv_grade,tv_school,tv_adress, tv_delete;
34 private ImageView iv_account_head,cancel; 34 private ImageView iv_account_head,cancel;
35 private RecyclerView listview; 35 private RecyclerView listview;
36 private LinearLayout add_accunt; 36 private LinearLayout add_accunt;
37 private AccountChildsAdapter childsAdapter; 37 private AccountChildsAdapter childsAdapter;
38 private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); 38 private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>();
39 Handler handler = new Handler(){ 39 Handler handler = new Handler(){
40 @Override 40 @Override
41 public void handleMessage(Message msg) { 41 public void handleMessage(Message msg) {
42 super.handleMessage(msg); 42 super.handleMessage(msg);
43 switch (msg.what){ 43 switch (msg.what){
44 case HttpCode.CHILDS_SUCESS: 44 case HttpCode.CHILDS_SUCESS:
45 data.clear(); 45 data.clear();
46 data.addAll( (List<ChildsInfo.DataBean>)msg.obj); 46 data.addAll( (List<ChildsInfo.DataBean>)msg.obj);
47 childsAdapter.notifyDataSetChanged(); 47 childsAdapter.notifyDataSetChanged();
48 break; 48 break;
49 } 49 }
50 } 50 }
51 }; 51 };
52 @Override 52 @Override
53 protected void onCreate(Bundle savedInstanceState) { 53 protected void onCreate(Bundle savedInstanceState) {
54 super.onCreate(savedInstanceState); 54 super.onCreate(savedInstanceState);
55 setContentView(R.layout.activity_account_management); 55 setContentView(R.layout.activity_account_management);
56 String userID = SaveParam.getInstance().getLoginParam(this,"userId"); 56 String userID = SaveParam.getInstance().getLoginParam(this,"userId");
57 try { 57 try {
58 long auserID = Long.parseLong(userID); 58 long auserID = Long.parseLong(userID);
59 HttpManager.getInstance().getchildAccountinfo(this,auserID,handler); 59 HttpManager.getInstance().getchildAccountinfo(this,auserID,handler);
60 60
61 } catch (NumberFormatException e) { 61 } catch (NumberFormatException e) {
62 e.printStackTrace(); 62 e.printStackTrace();
63 } 63 }
64 64
65 initView(); 65 initView();
66 initData(); 66 initData();
67 initLister(); 67 initLister();
68 } 68 }
69 69
70 private void initView() { 70 private void initView() {
71 changbangding = (TextView) findViewById(R.id.changBangding); 71 changbangding = (TextView) findViewById(R.id.changBangding);
72 changpassword = (TextView) findViewById(R.id.changpassword); 72 changpassword = (TextView) findViewById(R.id.changpassword);
73 usernames = (TextView) findViewById(R.id.cunt_username); 73 usernames = (TextView) findViewById(R.id.cunt_username);
74 tv_username = (TextView) findViewById(R.id.tv_account_name); 74 tv_username = (TextView) findViewById(R.id.tv_account_name);
75 tv_grade = (TextView) findViewById(R.id.tv_account_grade); 75 tv_grade = (TextView) findViewById(R.id.tv_account_grade);
76 tv_school = (TextView) findViewById(R.id.tv_account_school); 76 tv_school = (TextView) findViewById(R.id.tv_account_school);
77 tv_adress = (TextView) findViewById(R.id.tv_account_adress); 77 tv_adress = (TextView) findViewById(R.id.tv_account_adress);
78 tv_delete = (TextView) findViewById(R.id.tv_account_delete); 78 tv_delete = (TextView) findViewById(R.id.tv_account_delete);
79 iv_account_head = (ImageView) findViewById(R.id.tv_account_head); 79 iv_account_head = (ImageView) findViewById(R.id.tv_account_head);
80 cancel = (ImageView) findViewById(R.id.cancel); 80 cancel = (ImageView) findViewById(R.id.cancel);
81 add_accunt = (LinearLayout) findViewById(R.id.add_account); 81 add_accunt = (LinearLayout) findViewById(R.id.add_account);
82
83
84 listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); 82 listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal);
85 } 83 }
86 84
87 private void initData() { 85 private void initData() {
86 if (Content.changgeaccountflag ==1){
87 tv_delete.setText("使用中");
88 tv_delete.setEnabled(true);
89 }
88 String cunt_username = SaveParam.getInstance().getLoginParam(this,"username"); 90 String cunt_username = SaveParam.getInstance().getLoginParam(this,"username");
89 String tv_usernames = SaveParam.getInstance().getLoginParam(this,SaveParam.USERNAME); 91 String tv_usernames = SaveParam.getInstance().getLoginParam(this,SaveParam.USERNAME);
90 String tv_grades = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADES); 92 String tv_grades = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADES);
91 String tv_schools = SaveParam.getInstance().getLoginParam(this,SaveParam.SCHOOL); 93 String tv_schools = SaveParam.getInstance().getLoginParam(this,SaveParam.SCHOOL);
92 String tv_adresss = SaveParam.getInstance().getLoginParam(this,SaveParam.ADRESS); 94 String tv_adresss = SaveParam.getInstance().getLoginParam(this,SaveParam.ADRESS);
93 usernames.setText(cunt_username); 95 usernames.setText(cunt_username);
94 tv_username.setText(tv_usernames); 96 tv_username.setText(tv_usernames);
95 tv_grade.setText(tv_grades); 97 tv_grade.setText(tv_grades);
96 tv_school.setText(tv_schools); 98 tv_school.setText(tv_schools);
97 tv_adress.setText(tv_adresss); 99 tv_adress.setText(tv_adresss);
98 100
99 LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); 101 LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
100 linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); 102 linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
101 listview.setLayoutManager(linearLayoutManager); 103 listview.setLayoutManager(linearLayoutManager);
102 childsAdapter = new AccountChildsAdapter(data,this); 104 childsAdapter = new AccountChildsAdapter(data,this);
103 listview.addItemDecoration(new RecyclerViewSpaceItem(10)); 105 listview.addItemDecoration(new RecyclerViewSpaceItem(10));
104 listview.setAdapter(childsAdapter); 106 listview.setAdapter(childsAdapter);
105 107
106 } 108 }
107 109
108 private void initLister() { 110 private void initLister() {
109 changbangding.setOnClickListener(this); 111 changbangding.setOnClickListener(this);
110 changpassword.setOnClickListener(this); 112 changpassword.setOnClickListener(this);
111 tv_delete.setOnClickListener(this); 113 tv_delete.setOnClickListener(this);
112 cancel.setOnClickListener(this); 114 cancel.setOnClickListener(this);
113 add_accunt.setOnClickListener(this); 115 add_accunt.setOnClickListener(this);
114 116
115 117
116 } 118 }
117 119
118 @Override 120 @Override
119 public void onClick(View v) { 121 public void onClick(View v) {
120 switch (v.getId()){ 122 switch (v.getId()){
121 case R.id.changBangding: 123 case R.id.changBangding:
122 Intent changebangding = new Intent(); 124 Intent changebangding = new Intent();
123 changebangding.setClass(AccountManagementActivity.this,ChangeBangDingActivity.class); 125 changebangding.setClass(AccountManagementActivity.this,ChangeBangDingActivity.class);
124 startActivity(changebangding); 126 startActivity(changebangding);
125 overridePendingTransition(R.anim.rightin, R.anim.rightout); 127 overridePendingTransition(R.anim.rightin, R.anim.rightout);
126 break; 128 break;
127 case R.id.changpassword: 129 case R.id.changpassword:
128 Content.authcodeflag = 1; 130 Content.authcodeflag = 1;
129 Intent changpwd = new Intent(); 131 Intent changpwd = new Intent();
130 changpwd.setClass(AccountManagementActivity.this,ChangePasswordActivity.class); 132 changpwd.setClass(AccountManagementActivity.this,ChangePasswordActivity.class);
131 startActivity(changpwd); 133 startActivity(changpwd);
132 overridePendingTransition(R.anim.rightin, R.anim.rightout); 134 overridePendingTransition(R.anim.rightin, R.anim.rightout);
133 break; 135 break;
134 case R.id.add_account: 136 case R.id.add_account:
135
136 Content.accountflag = 2; 137 Content.accountflag = 2;
137 Intent account = new Intent(); 138 Intent account = new Intent();
138 account.setClass(AccountManagementActivity.this,RegisterInfoActivity.class); 139 account.setClass(AccountManagementActivity.this,RegisterInfoActivity.class);
139 startActivity(account); 140 startActivity(account);
140 overridePendingTransition(R.anim.rightin, R.anim.rightout); 141 overridePendingTransition(R.anim.rightin, R.anim.rightout);
141 142
142 break; 143 break;
144 case R.id.tv_account_delete:
145 Content.changgeaccountflag =1;
146 SaveParam.getInstance().saveLoginParam(this,SaveParam.ACCOUNT,"1");
147
148 break;
143 case R.id.cancel: 149 case R.id.cancel:
144 finish(); 150 finish();
145 break; 151 break;
152
146 } 153 }
147 154
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeEletronicCardPhoneActivity.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 5
6 import com.hjx.personalcenter.R; 6 import com.hjx.personalcenter.R;
7 7
8 /** 8 /**
9 * Created by h on 2017/8/9. 9 * Created by h on 2017/8/9.
10 */ 10 */
11 11
12 public class ChangeEletronicCardPhoneActivity extends Activity { 12 public class ChangeEletronicCardPhoneActivity extends Activity {
13
14
13 @Override 15 @Override
14 protected void onCreate(Bundle savedInstanceState) { 16 protected void onCreate(Bundle savedInstanceState) {
15 super.onCreate(savedInstanceState); 17 super.onCreate(savedInstanceState);
16 setContentView(R.layout.activity_electronicard_phone); 18 setContentView(R.layout.activity_electronicard_phone);
17 } 19 }
18 } 20 }
19 21
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangePresonalInfoActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.os.Bundle; 3 import android.os.Bundle;
4 import android.support.v4.app.Fragment; 4 import android.support.v4.app.Fragment;
5 import android.support.v4.view.ViewPager; 5 import android.support.v4.view.ViewPager;
6 import android.support.v7.app.AppCompatActivity; 6 import android.support.v7.app.AppCompatActivity;
7 import android.view.View;
8 import android.widget.ImageView;
7 import android.widget.TextView; 9 import android.widget.TextView;
8 10
9 import com.hjx.personalcenter.R; 11 import com.hjx.personalcenter.R;
10 import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; 12 import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter;
11 import com.hjx.personalcenter.fragment.PresonInfoFragment; 13 import com.hjx.personalcenter.fragment.PresonInfoFragment;
12 import com.hjx.personalcenter.fragment.VersionsInfoFragment; 14 import com.hjx.personalcenter.fragment.VersionsInfoFragment;
13 import com.hjx.personalcenter.thirdparty.SlidingTabLayout; 15 import com.hjx.personalcenter.thirdparty.SlidingTabLayout;
14 16
15 import java.util.ArrayList; 17 import java.util.ArrayList;
16 import java.util.Arrays; 18 import java.util.Arrays;
17 import java.util.List; 19 import java.util.List;
18 20
19 /** 21 /**
20 * Created by h on 2017/8/12. 22 * Created by h on 2017/8/12.
21 */ 23 */
22 24
23 public class ChangePresonalInfoActivity extends AppCompatActivity { 25 public class ChangePresonalInfoActivity extends AppCompatActivity implements View.OnClickListener {
24 private ViewPager viewPager; 26 private ViewPager viewPager;
25 private SlidingTabLayout tableLayout; 27 private SlidingTabLayout tableLayout;
26 private TextView subsave; 28 private TextView subsave;
29 private ImageView cancel;
27 private List<Fragment> presoninfo; 30 private List<Fragment> presoninfo;
28 private LoginAndRegisterAdapter presoninfodapter; 31 private LoginAndRegisterAdapter presoninfodapter;
29 private List<String> title = Arrays.asList("个人信息", "版本信息"); 32 private List<String> title = Arrays.asList("个人信息", "版本信息");
30 @Override 33 @Override
31 protected void onCreate(Bundle savedInstanceState) { 34 protected void onCreate(Bundle savedInstanceState) {
32 super.onCreate(savedInstanceState); 35 super.onCreate(savedInstanceState);
33 setContentView(R.layout.activity_change_preson_info); 36 setContentView(R.layout.activity_change_preson_info);
34 initView(); 37 initView();
35 initData(); 38 initData();
36 setLister(); 39 setLister();
37 40
38 } 41 }
39 private void initView() { 42 private void initView() {
40 viewPager = (ViewPager) findViewById(R.id.viewpager_login); 43 viewPager = (ViewPager) findViewById(R.id.viewpager_login);
41 tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); 44 tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id);
45 cancel = (ImageView) findViewById(R.id.cancel);
42 subsave = (TextView) findViewById(R.id.presonal_sub); 46 subsave = (TextView) findViewById(R.id.presonal_sub);
43 } 47 }
44 48
45 private void initData() { 49 private void initData() {
46 presoninfo = new ArrayList<>(); 50 presoninfo = new ArrayList<>();
47 for (int i = 0; i < title.size(); i++) { 51 for (int i = 0; i < title.size(); i++) {
48 if (title.get(i).equals("个人信息")) { 52 if (title.get(i).equals("个人信息")) {
49 presoninfo.add(PresonInfoFragment.newInstance(i + 1)); 53 presoninfo.add(PresonInfoFragment.newInstance(i + 1));
50 } else { 54 } else {
51 presoninfo.add(VersionsInfoFragment.newInstance(i + 1)); 55 presoninfo.add(VersionsInfoFragment.newInstance(i + 1));
52 } 56 }
53 } 57 }
54 58
55 59
56 //设置Tab上的标题 60 //设置Tab上的标题
57 tableLayout.setData(title); 61 tableLayout.setData(title);
58 //设置关联的ViewPager 62 //设置关联的ViewPager
59 tableLayout.setViewPager(viewPager, 0); 63 tableLayout.setViewPager(viewPager, 0);
60 presoninfodapter = new LoginAndRegisterAdapter(presoninfo, getSupportFragmentManager()); 64 presoninfodapter = new LoginAndRegisterAdapter(presoninfo, getSupportFragmentManager());
61 //给ViewPager设置适配器 65 //给ViewPager设置适配器
62 viewPager.setAdapter(presoninfodapter); 66 viewPager.setAdapter(presoninfodapter);
63 //设置滑动时数据不丢失 67 //设置滑动时数据不丢失
64 viewPager.setOffscreenPageLimit(1); 68 viewPager.setOffscreenPageLimit(1);
65 //将TabLayout和ViewPager关联起来。 69 //将TabLayout和ViewPager关联起来。
66 } 70 }
67 71
68 private void setLister() { 72 private void setLister() {
73 cancel.setOnClickListener(this);
69 } 74 }
70 75
76 @Override
77 public void onClick(View v) {
78 switch (v.getId()){
79 case R.id.cancel:
80 finish();
81 break;
82 }
83
84 }
71 } 85 }
72 86
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.os.Handler; 5 import android.os.Handler;
6 import android.os.Message; 6 import android.os.Message;
7 import android.support.v7.app.AppCompatActivity; 7 import android.support.v7.app.AppCompatActivity;
8 import android.view.View; 8 import android.view.View;
9 import android.widget.Button; 9 import android.widget.Button;
10 import android.widget.GridView; 10 import android.widget.GridView;
11 import android.widget.ImageView;
11 import android.widget.SimpleAdapter; 12 import android.widget.SimpleAdapter;
12 13
13 import com.hjx.personalcenter.R; 14 import com.hjx.personalcenter.R;
14 import com.hjx.personalcenter.customdialog.ElectronicCardDialog; 15 import com.hjx.personalcenter.customdialog.ElectronicCardDialog;
15 import com.hjx.personalcenter.db.SaveParam; 16 import com.hjx.personalcenter.db.SaveParam;
16 import com.hjx.personalcenter.http.HttpCode; 17 import com.hjx.personalcenter.http.HttpCode;
17 import com.hjx.personalcenter.http.HttpManager; 18 import com.hjx.personalcenter.http.HttpManager;
18 19
19 import org.json.JSONException; 20 import org.json.JSONException;
20 import org.json.JSONObject; 21 import org.json.JSONObject;
21 22
22 import java.util.ArrayList; 23 import java.util.ArrayList;
23 import java.util.HashMap; 24 import java.util.HashMap;
24 import java.util.List; 25 import java.util.List;
25 import java.util.Map; 26 import java.util.Map;
26 27
27 /**选择教材 28 /**选择教材
28 * Created by h on 2017/8/10. 29 * Created by h on 2017/8/10.
29 */ 30 */
30 31
31 public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener { 32 public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener {
32 private GridView gridView; 33 private GridView gridView;
33 private Button btn_ok; 34 private Button btn_ok;
35 private ImageView cancel;
34 private List<Map<String, Object>> data_list; 36 private List<Map<String, Object>> data_list;
35 private SimpleAdapter sim_adapter; 37 private SimpleAdapter sim_adapter;
36 // 图片封装为一个数组 38 // 图片封装为一个数组
37 private int[] icon = { R.mipmap.ic_launcher, R.mipmap.ic_launcher, 39 private int[] icon = { R.mipmap.ic_launcher, R.mipmap.ic_launcher,
38 R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, 40 R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher,
39 R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, 41 R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher,
40 R.mipmap.ic_launcher}; 42 R.mipmap.ic_launcher};
41 private String[] subject = { "语文", "数学", "英语", "物理", "化学", "生物", "政治", 43 private String[] subject = { "语文", "数学", "英语", "物理", "化学", "生物", "政治",
42 "历史", "地理" }; 44 "历史", "地理" };
43 private String[] publish = { "人民教育出版社", "人民教育出版社", "人民教育出版社", 45 private String[] publish = { "人民教育出版社", "人民教育出版社", "人民教育出版社",
44 "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社", 46 "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社",
45 "人民教育出版社", "人民教育出版社" }; 47 "人民教育出版社", "人民教育出版社" };
46 48
47 49
48 Handler handler = new Handler(){ 50 Handler handler = new Handler(){
49 @Override 51 @Override
50 public void handleMessage(Message msg) { 52 public void handleMessage(Message msg) {
51 super.handleMessage(msg); 53 super.handleMessage(msg);
52 JSONObject jsonObject; 54 JSONObject jsonObject;
53 String status; 55 String status;
54 switch (msg.what){ 56 switch (msg.what){
55 case HttpCode.CHECKCARD: 57 case HttpCode.CHECKCARD:
56 try { 58 try {
57 jsonObject = new JSONObject( (String) msg.obj); 59 jsonObject = new JSONObject( (String) msg.obj);
58 status = jsonObject.optString("status"); 60 status = jsonObject.optString("status");
59 if (status.equals("1")){ 61 if (status.equals("1")){
60 Intent intent = new Intent(); 62 Intent intent = new Intent();
61 intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); 63 intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class);
62 ChoiseTextBookActivity.this.startActivity(intent); 64 ChoiseTextBookActivity.this.startActivity(intent);
63 overridePendingTransition(R.anim.rightin, R.anim.rightout); 65 overridePendingTransition(R.anim.rightin, R.anim.rightout);
64 finish(); 66 finish();
65 }else if(status.equals("2001")){ 67 }else if(status.equals("2001")){
66 ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); 68 ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog");
67 } 69 }
68 70
69 } catch (JSONException e) { 71 } catch (JSONException e) {
70 e.printStackTrace(); 72 e.printStackTrace();
71 } 73 }
72 74
73 break; 75 break;
74 76
75 } 77 }
76 78
77 } 79 }
78 }; 80 };
79 81
80 @Override 82 @Override
81 protected void onCreate(Bundle savedInstanceState) { 83 protected void onCreate(Bundle savedInstanceState) {
82 super.onCreate(savedInstanceState); 84 super.onCreate(savedInstanceState);
83 setContentView(R.layout.activity_choisetextbook); 85 setContentView(R.layout.activity_choisetextbook);
84 initView(); 86 initView();
85 initData(); 87 initData();
86 initLister(); 88 initLister();
87 } 89 }
88 90
89 private void initView() { 91 private void initView() {
90 gridView = (GridView) findViewById(R.id.grideview); 92 gridView = (GridView) findViewById(R.id.grideview);
93 cancel = (ImageView) findViewById(R.id.cancel);
91 btn_ok = (Button) findViewById(R.id.btn_ok); 94 btn_ok = (Button) findViewById(R.id.btn_ok);
92 } 95 }
93 96
94 private void initData() { 97 private void initData() {
95 data_list = new ArrayList<Map<String, Object>>(); 98 data_list = new ArrayList<Map<String, Object>>();
96 getData(); 99 getData();
97 String [] from ={"image","text","text1"}; 100 String [] from ={"image","text","text1"};
98 int [] to = {R.id.image,R.id.text}; 101 int [] to = {R.id.image,R.id.text};
99 sim_adapter = new SimpleAdapter(this, data_list, R.layout.activity_choisetextbook_items, from, to); 102 sim_adapter = new SimpleAdapter(this, data_list, R.layout.activity_choisetextbook_items, from, to);
100 //配置适配器 103 //配置适配器
101 gridView.setAdapter(sim_adapter); 104 gridView.setAdapter(sim_adapter);
102 105
103 } 106 }
104 107
105 private void initLister() { 108 private void initLister() {
106 btn_ok.setOnClickListener(this); 109 btn_ok.setOnClickListener(this);
110 cancel.setOnClickListener(this);
107 111
108 } 112 }
109 public List<Map<String, Object>> getData(){ 113 public List<Map<String, Object>> getData(){
110 //cion和iconName的长度是相同的,这里任选其一都可以 114 //cion和iconName的长度是相同的,这里任选其一都可以
111 for(int i=0;i<icon.length;i++){ 115 for(int i=0;i<icon.length;i++){
112 Map<String, Object> map = new HashMap<String, Object>(); 116 Map<String, Object> map = new HashMap<String, Object>();
113 map.put("image", icon[i]); 117 map.put("image", icon[i]);
114 map.put("text", subject[i]); 118 map.put("text", subject[i]);
115 map.put("text1", publish[i]); 119 map.put("text1", publish[i]);
116 data_list.add(map); 120 data_list.add(map);
117 } 121 }
118 122
119 return data_list; 123 return data_list;
120 } 124 }
121 125
122 @Override 126 @Override
123 public void onClick(View v) { 127 public void onClick(View v) {
124 switch (v.getId()){ 128 switch (v.getId()){
125 case R.id.btn_ok: 129 case R.id.btn_ok:
126 String userID = SaveParam.getInstance().getLoginParam(this,"userId"); 130 String userID = SaveParam.getInstance().getLoginParam(this,"userId");
127 try { 131 try {
128 long auserID = Long.parseLong(userID); 132 long auserID = Long.parseLong(userID);
129 HttpManager.getInstance().cardinfocheck(this,auserID,handler); 133 HttpManager.getInstance().cardinfocheck(this,auserID,handler);
130 } catch (NumberFormatException e) { 134 } catch (NumberFormatException e) {
131 e.printStackTrace(); 135 e.printStackTrace();
132 } 136 }
133 137
134 break; 138 break;
139 case R.id.cancel:
140 finish();
141 break;
135 } 142 }
136 143
137 } 144 }
138 } 145 }
139 146
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardValidationActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Intent; 4 import android.content.Intent;
5 import android.os.Bundle; 5 import android.os.Bundle;
6 import android.os.Handler; 6 import android.os.Handler;
7 import android.os.Message; 7 import android.os.Message;
8 import android.text.TextUtils; 8 import android.text.TextUtils;
9 import android.view.View; 9 import android.view.View;
10 import android.widget.Button; 10 import android.widget.Button;
11 import android.widget.EditText; 11 import android.widget.EditText;
12 import android.widget.ImageView;
12 import android.widget.TextView; 13 import android.widget.TextView;
13 14
14 import com.hjx.personalcenter.R; 15 import com.hjx.personalcenter.R;
15 import com.hjx.personalcenter.db.Content; 16 import com.hjx.personalcenter.db.Content;
16 import com.hjx.personalcenter.db.SaveParam; 17 import com.hjx.personalcenter.db.SaveParam;
17 import com.hjx.personalcenter.http.HttpCode; 18 import com.hjx.personalcenter.http.HttpCode;
18 import com.hjx.personalcenter.http.HttpManager; 19 import com.hjx.personalcenter.http.HttpManager;
19 import com.hjx.personalcenter.util.AlertUtils; 20 import com.hjx.personalcenter.util.AlertUtils;
20 import com.hjx.personalcenter.util.PhoneNumCheckUtils; 21 import com.hjx.personalcenter.util.PhoneNumCheckUtils;
21 22
22 import org.json.JSONObject; 23 import org.json.JSONObject;
23 24
24 /** 25 /**
25 * Created by h on 2017/8/9. 26 * Created by h on 2017/8/9.
26 */ 27 */
27 28
28 public class ElectronicCardValidationActivity extends Activity implements View.OnClickListener { 29 public class ElectronicCardValidationActivity extends Activity implements View.OnClickListener {
29 private Button btn_card_valiyanzhen,get_authcode; 30 private Button btn_card_valiyanzhen,get_authcode;
30 private EditText phonenumber,anth_6num;//;//密码 31 private EditText phonenumber,anth_6num;//;//密码
31 private TextView menu_title; 32 private TextView menu_title;
33 private ImageView cancel;
32 private int i = 0; 34 private int i = 0;
33 private Thread thread; 35 private Thread thread;
34 private String sourceStr ="android"; 36 private String sourceStr ="android";
35 private String typeStr = "register"; 37 private String typeStr = "register";
36 String authcode = ""; 38 String authcode = "";
37 Handler handler = new Handler() { 39 Handler handler = new Handler() {
38 @Override 40 @Override
39 public void handleMessage(Message msg) { 41 public void handleMessage(Message msg) {
40 super.handleMessage(msg); 42 super.handleMessage(msg);
41 JSONObject jsonObject; 43 JSONObject jsonObject;
42 String status; 44 String status;
43 switch (msg.what) { 45 switch (msg.what) {
44 case HttpCode.AUTHCODE_SUCESS: 46 case HttpCode.AUTHCODE_SUCESS:
45 jsonObject = (JSONObject) msg.obj; 47 jsonObject = (JSONObject) msg.obj;
46 status = jsonObject.optString("status"); 48 status = jsonObject.optString("status");
47 authcode = jsonObject.optString("jsessionid"); 49 authcode = jsonObject.optString("jsessionid");
48 if (status.equals("100")) { 50 if (status.equals("100")) {
49 AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); 51 AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功");
50 } 52 }
51 53
52 break; 54 break;
53 case HttpCode.AUTHCODE_FAIL: 55 case HttpCode.AUTHCODE_FAIL:
54 AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); 56 AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败");
55 break; 57 break;
56 case 1: 58 case 1:
57 get_authcode.setEnabled(false); 59 get_authcode.setEnabled(false);
58 get_authcode.setClickable(false); 60 get_authcode.setClickable(false);
59 get_authcode.setText(Integer.toString(i--)+" s"); 61 get_authcode.setText(Integer.toString(i--)+" s");
60 if (i<=0){ 62 if (i<=0){
61 get_authcode.setEnabled(true); 63 get_authcode.setEnabled(true);
62 get_authcode.setClickable(true); 64 get_authcode.setClickable(true);
63 get_authcode.setText("获取验证码"); 65 get_authcode.setText("获取验证码");
64 } 66 }
65 break; 67 break;
66 } 68 }
67 } 69 }
68 }; 70 };
69 @Override 71 @Override
70 protected void onCreate(Bundle savedInstanceState) { 72 protected void onCreate(Bundle savedInstanceState) {
71 super.onCreate(savedInstanceState); 73 super.onCreate(savedInstanceState);
72 setContentView(R.layout.activity_electroniccard_validation); 74 setContentView(R.layout.activity_electroniccard_validation);
73 initView(); 75 initView();
74 initData(); 76 initData();
75 initLister(); 77 initLister();
76 } 78 }
77 79
78 private void initView() { 80 private void initView() {
79 btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); 81 btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen);
80 get_authcode = (Button) findViewById(R.id.btn_authcode); 82 get_authcode = (Button) findViewById(R.id.btn_authcode);
81 anth_6num = (EditText) findViewById(R.id.et_authcode); 83 anth_6num = (EditText) findViewById(R.id.et_authcode);
82 phonenumber = (EditText) findViewById(R.id.et_phonenumber); 84 phonenumber = (EditText) findViewById(R.id.et_phonenumber);
83 menu_title = (TextView) findViewById(R.id.menu_title); 85 menu_title = (TextView) findViewById(R.id.menu_title);
86 cancel = (ImageView) findViewById(R.id.cancel);
84 } 87 }
85 88
86 private void initData() { 89 private void initData() {
87 if (Content.authcodeflag==1){ 90 if (Content.authcodeflag==1){
88 menu_title.setText("更换绑定"); 91 menu_title.setText("更换绑定");
89 btn_card_valiyanzhen.setText("确定"); 92 btn_card_valiyanzhen.setText("确定");
90 93
91 }else if (Content.authcodeflag==2){ 94 }else if (Content.authcodeflag==2){
92 menu_title.setText("修改保卡信息"); 95 menu_title.setText("修改保卡信息");
93 btn_card_valiyanzhen.setText("确定"); 96 btn_card_valiyanzhen.setText("确定");
94 97
95 }else { 98 }else {
96 menu_title.setText("填写保卡信息"); 99 menu_title.setText("填写保卡信息");
97 btn_card_valiyanzhen.setText("下一步"); 100 btn_card_valiyanzhen.setText("下一步");
98 } 101 }
99 102
100 103
101 104
102 } 105 }
103 106
104 private void initLister() { 107 private void initLister() {
105 get_authcode.setOnClickListener(this); 108 get_authcode.setOnClickListener(this);
106 btn_card_valiyanzhen.setOnClickListener(this); 109 btn_card_valiyanzhen.setOnClickListener(this);
110 cancel.setOnClickListener(this);
107 111
108 } 112 }
109 113
110 @Override 114 @Override
111 public void onClick(View v) { 115 public void onClick(View v) {
112 switch (v.getId()){ 116 switch (v.getId()){
113 case R.id.btn_card_valiyanzhen: 117 case R.id.btn_card_valiyanzhen:
114 118
115 String usernameStr = phonenumber.getText().toString().trim(); 119 String usernameStr = phonenumber.getText().toString().trim();
116 String authcodeStr = anth_6num.getText().toString().trim(); 120 String authcodeStr = anth_6num.getText().toString().trim();
117 if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { 121 if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) {
118 AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); 122 AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空");
119 return; 123 return;
120 } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ 124 } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){
121 AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); 125 AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误");
122 126
123 }else if (!authcode.equals(authcodeStr)){ 127 }else if (!authcode.equals(authcodeStr)){
124 AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); 128 AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确");
125 }else { 129 }else {
126 String userID = SaveParam.getInstance().getLoginParam(this,"userId"); 130 String userID = SaveParam.getInstance().getLoginParam(this,"userId");
127 int auserID = 0; 131 int auserID = 0;
128 try { 132 try {
129 auserID = Integer.parseInt(userID); 133 auserID = Integer.parseInt(userID);
130 } catch (NumberFormatException e) { 134 } catch (NumberFormatException e) {
131 e.printStackTrace(); 135 e.printStackTrace();
132 } 136 }
133 if (Content.authcodeflag==1){ 137 if (Content.authcodeflag==1){
134 //修改账户手机号 138 //修改账户手机号
135 HttpManager.getInstance().changecardinfophone(this, 139 HttpManager.getInstance().changecardinfophone(this,
136 auserID,usernameStr,authcodeStr); 140 auserID,usernameStr,authcodeStr);
137 141
138 142
139 }else if (Content.authcodeflag==2){ 143 }else if (Content.authcodeflag==2){
140 //修改保卡手机号 144 //修改保卡手机号
141 HttpManager.getInstance().changecardinfophone(this, 145 HttpManager.getInstance().changecardinfophone(this,
142 auserID,usernameStr,authcodeStr); 146 auserID,usernameStr,authcodeStr);
143 }else { 147 }else {
144 String phone =phonenumber.getText().toString().trim(); 148 String phone =phonenumber.getText().toString().trim();
145 SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone ); 149 SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone );
146 Intent intent = new Intent(); 150 Intent intent = new Intent();
147 intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); 151 intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class);
148 startActivity(intent); 152 startActivity(intent);
149 overridePendingTransition(R.anim.rightin, R.anim.rightout); 153 overridePendingTransition(R.anim.rightin, R.anim.rightout);
150 } 154 }
151 // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); 155 // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim());
152 // Intent intent = new Intent(); 156 // Intent intent = new Intent();
153 // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); 157 // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class);
154 // startActivity(intent); 158 // startActivity(intent);
155 // overridePendingTransition(R.anim.rightin, R.anim.rightout); 159 // overridePendingTransition(R.anim.rightin, R.anim.rightout);
156 } 160 }
157 break; 161 break;
158 case R.id.btn_authcode: 162 case R.id.btn_authcode:
159 String usernameStr1 = phonenumber.getText().toString().trim(); 163 String usernameStr1 = phonenumber.getText().toString().trim();
160 if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ 164 if (!PhoneNumCheckUtils.isPhone(usernameStr1)){
161 AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); 165 AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号");
162 }else { 166 }else {
163 anth_6num.requestFocus(); 167 anth_6num.requestFocus();
164 HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); 168 HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this);
165 i = 60; 169 i = 60;
166 if(thread == null){ 170 if(thread == null){
167 thread = new Thread( new ThreadShow()); 171 thread = new Thread( new ThreadShow());
168 thread.start(); 172 thread.start();
169 } 173 }
170 174
171 } 175 }
172 176
173 break; 177 break;
178 case R.id.cancel:
179 finish();
180 break;
174 } 181 }
175 } 182 }
176 // 线程类 定时器 183 // 线程类 定时器
177 class ThreadShow implements Runnable { 184 class ThreadShow implements Runnable {
178 185
179 @Override 186 @Override
180 public void run() { 187 public void run() {
181 // TODO Auto-generated method stub 188 // TODO Auto-generated method stub
182 while (true) { 189 while (true) {
183 try { 190 try {
184 Thread.sleep(1000); 191 Thread.sleep(1000);
185 Message msg = new Message(); 192 Message msg = new Message();
186 msg.what = 1; 193 msg.what = 1;
187 handler.sendMessage(msg); 194 handler.sendMessage(msg);
188 System.out.println("send..."); 195 System.out.println("send...");
189 } catch (Exception e) { 196 } catch (Exception e) {
190 // TODO Auto-generated catch block 197 // TODO Auto-generated catch block
191 e.printStackTrace(); 198 e.printStackTrace();
192 System.out.println("thread error..."); 199 System.out.println("thread error...");
193 } 200 }
194 } 201 }
195 } 202 }
196 } 203 }
197 } 204 }
198 205
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MyApplication.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.app.Application; 3 import android.app.Application;
4 import android.content.Context; 4 import android.content.Context;
5 5
6 import com.facebook.drawee.backends.pipeline.Fresco; 6 import com.facebook.drawee.backends.pipeline.Fresco;
7 import com.hjx.personalcenter.util.ImageCache; 7 import com.hjx.personalcenter.util.ImageCache;
8 import com.squareup.leakcanary.LeakCanary;
8 import com.tencent.bugly.crashreport.CrashReport; 9 import com.tencent.bugly.crashreport.CrashReport;
9 10
10 /** 11 /**
11 * Created by ${yf} on 2017/2/16. 12 * Created by ${yf} on 2017/2/16.
12 */ 13 */
13 14
14 public class MyApplication extends Application { 15 public class MyApplication extends Application {
15 16
16 private ImageCache mImageCache; 17 private ImageCache mImageCache;
17 private static Context context; 18 private static Context context;
18 private static MyApplication instance; 19 private static MyApplication instance;
19 @Override 20 @Override
20 public void onCreate() { 21 public void onCreate() {
21 super.onCreate(); 22 super.onCreate();
22 context = getApplicationContext(); 23 context = getApplicationContext();
24 //c初始化内存检测
25 LeakCanary.install(this);
23 //初始化Fresco 26 //初始化Fresco
24 Fresco.initialize(this); 27 Fresco.initialize(this);
25 mImageCache = new ImageCache(); 28 mImageCache = new ImageCache();
26 instance = this; 29 instance = this;
27 CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false); 30 CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false);
28 } 31 }
29 public ImageCache getImageCache() { 32 public ImageCache getImageCache() {
30 return mImageCache; 33 return mImageCache;
31 } 34 }
32 35
33 public static Context getContext() { 36 public static Context getContext() {
34 return context; 37 return context;
35 } 38 }
36 public static MyApplication getInstance() { 39 public static MyApplication getInstance() {
37 return instance; 40 return instance;
38 } 41 }
39 } 42 }
40 43
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/AccountChildsAdapter.java
1 package com.hjx.personalcenter.adapter; 1 package com.hjx.personalcenter.adapter;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.support.v4.app.FragmentActivity; 4 import android.support.v4.app.FragmentActivity;
5 import android.support.v7.widget.RecyclerView; 5 import android.support.v7.widget.RecyclerView;
6 import android.view.LayoutInflater; 6 import android.view.LayoutInflater;
7 import android.view.View; 7 import android.view.View;
8 import android.view.ViewGroup; 8 import android.view.ViewGroup;
9 import android.widget.TextView; 9 import android.widget.TextView;
10 10
11 import com.facebook.drawee.view.SimpleDraweeView; 11 import com.facebook.drawee.view.SimpleDraweeView;
12 import com.hjx.personalcenter.R; 12 import com.hjx.personalcenter.R;
13 import com.hjx.personalcenter.db.Content;
14 import com.hjx.personalcenter.db.SaveParam;
13 import com.hjx.personalcenter.http.HttpManager; 15 import com.hjx.personalcenter.http.HttpManager;
14 import com.hjx.personalcenter.model.ChildsInfo; 16 import com.hjx.personalcenter.model.ChildsInfo;
15 import com.mylhyl.circledialog.CircleDialog; 17 import com.mylhyl.circledialog.CircleDialog;
16 18
17 import java.util.ArrayList; 19 import java.util.ArrayList;
18 import java.util.List; 20 import java.util.List;
19 21
20 /** 22 /**
21 * Created by h on 2017/8/26. 23 * Created by h on 2017/8/26.
22 */ 24 */
23 25
24 public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> { 26 public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> {
25 private List<ChildsInfo.DataBean> specailList; 27 private List<ChildsInfo.DataBean> specailList;
26 private LayoutInflater mInflater; 28 private LayoutInflater mInflater;
27 private Context mContext ; 29 private Context mContext ;
28 30
29 public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) { 31 public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) {
30 this.mContext = context; 32 this.mContext = context;
31 this.specailList = specailList; 33 this.specailList = specailList;
32 mInflater = LayoutInflater.from(context); 34 mInflater = LayoutInflater.from(context);
33 } 35 }
34 36
35 public OnItemClickListener mOnItemClickListener; 37 public OnItemClickListener mOnItemClickListener;
36 38
37 public interface OnItemClickListener { 39 public interface OnItemClickListener {
38 void onItemClick(View view, int position); 40 void onItemClick(View view, int position);
39 } 41 }
40 42
41 public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { 43 public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) {
42 this.mOnItemClickListener = mOnItemClickLitener; 44 this.mOnItemClickListener = mOnItemClickLitener;
43 } 45 }
44 46
45 public void setList(List<ChildsInfo.DataBean> list) { 47 public void setList(List<ChildsInfo.DataBean> list) {
46 this.specailList = list; 48 this.specailList = list;
47 notifyDataSetChanged(); 49 notifyDataSetChanged();
48 } 50 }
49 51
50 @Override 52 @Override
51 public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) { 53 public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) {
52 View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false); 54 View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false);
53
54 AccountChildsHolder holder = new AccountChildsHolder(view); 55 AccountChildsHolder holder = new AccountChildsHolder(view);
55 return holder; 56 return holder;
56 } 57 }
57 58
58 @Override 59 @Override
59 public void onBindViewHolder(AccountChildsHolder holder, int position) { 60 public void onBindViewHolder(AccountChildsHolder holder, int position) {
60 final ChildsInfo.DataBean bean = specailList.get(position); 61 final ChildsInfo.DataBean bean = specailList.get(position);
61 if (bean != null) { 62 if (bean != null) {
62 holder.mSimpleDraweeView.setImageURI(bean.getImage()); 63 holder.mSimpleDraweeView.setImageURI(bean.getImage());
63 holder.iv_child_name.setText(bean.getName()); 64 holder.iv_child_name.setText(bean.getName());
64 holder.iv_child_grade.setText(bean.getGrade()); 65 holder.iv_child_grade.setText(bean.getGrade());
65 holder.iv_child_school.setText(bean.getSchool()); 66 holder.iv_child_school.setText(bean.getSchool());
66 holder.iv_child_adress.setText(bean.getRegion()); 67 holder.iv_child_adress.setText(bean.getRegion());
67 holder.delete_account.setOnClickListener(new View.OnClickListener() { 68 holder.delete_account.setOnClickListener(new View.OnClickListener() {
68 @Override 69 @Override
69 public void onClick(View v) { 70 public void onClick(View v) {
70 new CircleDialog.Builder((FragmentActivity)mContext) 71 new CircleDialog.Builder((FragmentActivity)mContext)
71 .setCanceledOnTouchOutside(false) 72 .setCanceledOnTouchOutside(false)
72 .setWidth(0.4f) 73 .setWidth(0.4f)
73 .setCancelable(false) 74 .setCancelable(false)
74 .setText("您确定删除该子账户?") 75 .setText("您确定删除该子账户?")
75 .setNegative("取消", null) 76 .setNegative("取消", null)
76 .setPositive("确定", new View.OnClickListener() { 77 .setPositive("确定", new View.OnClickListener() {
77 @Override 78 @Override
78 public void onClick(View v) { 79 public void onClick(View v) {
79 HttpManager.getInstance().deletechildAccountinfo(mContext,bean.getSubAccountId()); 80 HttpManager.getInstance().deletechildAccountinfo(mContext,bean.getSubAccountId());
80 } 81 }
81 }) 82 })
82 .show(); 83 .show();
83 84
84 85
85 86
86 } 87 }
87 }); 88 });
88 holder.chang_account.setOnClickListener(new View.OnClickListener() { 89 holder.chang_account.setOnClickListener(new View.OnClickListener() {
89 @Override 90 @Override
90 public void onClick(View v) { 91 public void onClick(View v) {
91 new CircleDialog.Builder((FragmentActivity)mContext) 92 new CircleDialog.Builder((FragmentActivity)mContext)
92 .setCanceledOnTouchOutside(false) 93 .setCanceledOnTouchOutside(false)
93 .setWidth(0.4f) 94 .setWidth(0.4f)
94 .setCancelable(false) 95 .setCancelable(false)
95 .setText("您确定切换为该子账户?") 96 .setText("您确定切换为该子账户?")
96 .setNegative("取消", null) 97 .setNegative("取消", null)
97 .setPositive("确定", new View.OnClickListener() { 98 .setPositive("确定", new View.OnClickListener() {
98 @Override 99 @Override
99 public void onClick(View v) { 100 public void onClick(View v) {
101 Content.changgeaccountflag =2;
102 SaveParam.getInstance().saveLoginParam(mContext,SaveParam.ACCOUNT,"2");
100 HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId()); 103 HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId());
101 } 104 }
102 }) 105 })
103 .show(); 106 .show();
104 107
105 } 108 }
106 }); 109 });
107 110
108 } 111 }
109 112
110 113
111 } 114 }
112 115
113 @Override 116 @Override
114 public int getItemCount() { 117 public int getItemCount() {
115 return specailList.size(); 118 return specailList.size();
116 } 119 }
117 120
118 class AccountChildsHolder extends RecyclerView.ViewHolder { 121 class AccountChildsHolder extends RecyclerView.ViewHolder {
119 SimpleDraweeView mSimpleDraweeView; 122 SimpleDraweeView mSimpleDraweeView;
120 TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, 123 TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress,
121 delete_account,chang_account; 124 delete_account,chang_account;
122 public AccountChildsHolder(View itemView) { 125 public AccountChildsHolder(View itemView) {
123 super(itemView); 126 super(itemView);
124 mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); 127 mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head);
125 iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); 128 iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name);
126 iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); 129 iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade);
127 iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); 130 iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school);
128 iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); 131 iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress);
129 delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); 132 delete_account = (TextView) itemView.findViewById(R.id.delete_child_account);
130 chang_account = (TextView) itemView.findViewById(R.id.chang_account); 133 chang_account = (TextView) itemView.findViewById(R.id.chang_account);
134 if (Content.changgeaccountflag==2){
135 chang_account.setText("使用中");
136 chang_account.setEnabled(true);
137 }
131 138
132 } 139 }
133 } 140 }
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/Content.java
1 package com.hjx.personalcenter.db; 1 package com.hjx.personalcenter.db;
2 2
3 /** 3 /**
4 * Created by h on 2017/8/17. 4 * Created by h on 2017/8/17.
5 */ 5 */
6 6
7 public class Content { 7 public class Content {
8 public static int authcodeflag;//1是进入填写保卡信息验证,2是修改保卡手机号验证,3是更改绑定验证 8 public static int authcodeflag;//1是进入填写保卡信息验证,2是修改保卡手机号验证,3是更改绑定验证
9 public static int adressflag;//1购买地址,2客户地址 9 public static int adressflag;//1购买地址,2客户地址
10 public static int accountflag;//1主账户注册信息,2子账户注册信息 10 public static int accountflag;//1主账户注册信息,2子账户注册信息
11 public static int changgeaccountflag;//账户切换成功标志
11 } 12 }
12 13
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
1 package com.hjx.personalcenter.db; 1 package com.hjx.personalcenter.db;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Context; 4 import android.content.Context;
5 import android.content.SharedPreferences; 5 import android.content.SharedPreferences;
6 6
7 public class SaveParam { 7 public class SaveParam {
8 8
9 private static SaveParam instance; 9 private static SaveParam instance;
10 public static SaveParam getInstance(){ 10 public static SaveParam getInstance(){
11 if (instance==null){ 11 if (instance==null){
12 instance = new SaveParam(); 12 instance = new SaveParam();
13 } 13 }
14 return instance; 14 return instance;
15 } 15 }
16 16
17 public static String GRADENS = "gradens";//年级id 17 public static String GRADENS = "gradens";//年级id
18 public static String SCHOOOlID = "schoolid";//年级id 18 public static String SCHOOOlID = "schoolid";//年级id
19 //个人信息 19 //个人信息
20 public static String USERNAME = "usernames";//昵称 20 public static String USERNAME = "usernames";//昵称
21 public static String ADRESS = "adress";//地址 21 public static String ADRESS = "adress";//地址
22 public static String GRADES = "gadens";//年级 22 public static String GRADES = "gadens";//年级
23 public static String SCHOOL = "school";//学校 23 public static String SCHOOL = "school";//学校
24 public static String CONSTELLATION = "constellations";//星座 24 public static String CONSTELLATION = "constellations";//星座
25 25
26 //电子保卡信息 26 //电子保卡信息
27 public static String CARDPHONE = "cardphone";//保卡手机号 27 public static String CARDPHONE = "cardphone";//保卡手机号
28 public static String CUNSTEMNAME = "cunstemname";//客户姓名 28 public static String CUNSTEMNAME = "cunstemname";//客户姓名
29 public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 29 public static String ADRESSCUNSTEM = "adresscunstem";//客户地址
30 public static String SHOPTIME = "shoptime";//购买时间 30 public static String SHOPTIME = "shoptime";//购买时间
31 public static String SHOPADRESS = "shopadress";//购买地址 31 public static String SHOPADRESS = "shopadress";//购买地址
32 public static String SHOPTLEPHONE = "shoptlephone";//售后电话 32 public static String SHOPTLEPHONE = "shoptlephone";//售后电话
33 33
34 //省市区参数、 34 //省市区参数、
35 public static String PROVINCES = "provinces";//省 35 public static String PROVINCES = "provinces";//省
36 public static String CITYS = "citys";//市 36 public static String CITYS = "citys";//市
37 public static String COUNTRY = "country";//区 37 public static String COUNTRY = "country";//区
38 38
39 //账户管理
40 public static String ACCOUNT = "account";//账户类型
41
39 42
40 public void saveLoginParam(Context context,String spname, String spstr) { 43 public void saveLoginParam(Context context,String spname, String spstr) {
41 SharedPreferences sp = context.getSharedPreferences("loginparam", 44 SharedPreferences sp = context.getSharedPreferences("loginparam",
42 Activity.MODE_PRIVATE); 45 Activity.MODE_PRIVATE);
43 46
44 sp.edit().putString(spname, spstr).commit(); 47 sp.edit().putString(spname, spstr).commit();
45 } 48 }
46 49
47 50
48 public String getLoginParam(Context context,String spname) { 51 public String getLoginParam(Context context,String spname) {
49 SharedPreferences sp = context.getSharedPreferences("loginparam", 52 SharedPreferences sp = context.getSharedPreferences("loginparam",
50 Activity.MODE_PRIVATE); 53 Activity.MODE_PRIVATE);
51 String param = sp.getString(spname, null); 54 String param = sp.getString(spname, null);
52 return param; 55 return param;
53 } 56 }
54 public void clearData(Context context) { 57 public void clearData(Context context) {
55 SharedPreferences sp = context.getSharedPreferences("loginparam", 58 SharedPreferences sp = context.getSharedPreferences("loginparam",
56 Activity.MODE_PRIVATE); 59 Activity.MODE_PRIVATE);
57 sp.edit().clear().commit(); 60 sp.edit().clear().commit();
58 } 61 }
59 62
60 public void saveCustomizeParam(Context context,String spname, String spstr) { 63 public void saveCustomizeParam(Context context,String spname, String spstr) {
61 SharedPreferences sp = context.getSharedPreferences("presoninfo", 64 SharedPreferences sp = context.getSharedPreferences("presoninfo",
62 Activity.MODE_PRIVATE); 65 Activity.MODE_PRIVATE);
63 66
64 sp.edit().putString(spname, spstr).commit(); 67 sp.edit().putString(spname, spstr).commit();
65 68
66 } 69 }
67 70
68 public String getCustomizeParam(Context context,String spname) { 71 public String getCustomizeParam(Context context,String spname) {
69 SharedPreferences sp = context.getSharedPreferences("presoninfo", 72 SharedPreferences sp = context.getSharedPreferences("presoninfo",
70 Activity.MODE_PRIVATE); 73 Activity.MODE_PRIVATE);
71 String param = sp.getString(spname, null); 74 String param = sp.getString(spname, null);
72 return param; 75 return param;
73 } 76 }
74 77
75 public void clearCustomizeParam(Context context ){ 78 public void clearCustomizeParam(Context context ){
76 SharedPreferences sp = context.getSharedPreferences("presoninfo", 79 SharedPreferences sp = context.getSharedPreferences("presoninfo",
77 Activity.MODE_PRIVATE); 80 Activity.MODE_PRIVATE);
78 sp.edit().clear().commit(); 81 sp.edit().clear().commit();
79 } 82 }
80 } 83 }
81 84
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.GRADENS); 189 String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID);
190 ChangeInfo.SchoolBean changeinfo2 = new ChangeInfo.SchoolBean(); 190 ChangeInfo.SchoolBean changeinfo2 = new ChangeInfo.SchoolBean();
191 try { 191 try {
192 a = Integer.parseInt(regionId); 192 a = Integer.parseInt(regionId);
193 b = Integer.parseInt(grade); 193 b = Integer.parseInt(grade);
194 c = Long.parseLong(schoolid); 194 c = Long.parseLong(schoolid);
195 } catch (NumberFormatException e) { 195 } catch (NumberFormatException e) {
196 e.printStackTrace(); 196 e.printStackTrace();
197 } 197 }
198 String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); 198 String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId");
199 199
200 changeinfo.setId(userID); 200 changeinfo.setId(userID);
201 changeinfo.setNickname(presonal1); 201 changeinfo.setNickname(presonal1);
202 changeinfo.setRegionId(a); 202 changeinfo.setRegionId(a);
203 changeinfo.setGradeId(b); 203 changeinfo.setGradeId(b);
204 changeinfo2.setSchoolId(c); 204 changeinfo2.setSchoolId(c);
205 if ("男".equals(presonal3)) { 205 if ("男".equals(presonal3)) {
206 changeinfo.setGender("0"); 206 changeinfo.setGender("0");
207 } else { 207 } else {
208 changeinfo.setGender("1"); 208 changeinfo.setGender("1");
209 } 209 }
210 changeinfo.setBirthday(presonal5); 210 changeinfo.setBirthday(presonal5);
211 ChangeInfo.ContactBean changeinfo1 = new ChangeInfo.ContactBean(); 211 ChangeInfo.ContactBean changeinfo1 = new ChangeInfo.ContactBean();
212 changeinfo1.setQq(presonal8); 212 changeinfo1.setQq(presonal8);
213 changeinfo.setRegionName(presonal4 + presonal2); 213 changeinfo.setRegionName(presonal4 + presonal2);
214 changeinfo.setSchool(changeinfo2); 214 changeinfo.setSchool(changeinfo2);
215 changeinfo.setContact(changeinfo1); 215 changeinfo.setContact(changeinfo1);
216 216
217 try { 217 try {
218 //提交个人信息 218 //提交个人信息
219 HttpManager.getInstance().changepresonalinfo(getActivity(), changeinfo); 219 HttpManager.getInstance().changepresonalinfo(getActivity(), changeinfo);
220 } catch (UnsupportedEncodingException e) { 220 } catch (UnsupportedEncodingException e) {
221 e.printStackTrace(); 221 e.printStackTrace();
222 } 222 }
223 223
224 224
225 break; 225 break;
226 } 226 }
227 } 227 }
228 } 228 }
229 229
230 //自定义时间选择器 230 //自定义时间选择器
231 private void initTimePicker() { 231 private void initTimePicker() {
232 //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) 232 //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释)
233 //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 233 //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11
234 // Calendar selectedDate = Calendar.getInstance(); 234 // Calendar selectedDate = Calendar.getInstance();
235 // Calendar startDate = Calendar.getInstance(); 235 // Calendar startDate = Calendar.getInstance();
236 // startDate.set(1900, 1, 1); 236 // startDate.set(1900, 1, 1);
237 // Calendar endDate = Calendar.getInstance(); 237 // Calendar endDate = Calendar.getInstance();
238 // endDate.set(2100, 1, 1); 238 // endDate.set(2100, 1, 1);
239 //时间选择器 239 //时间选择器
240 pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { 240 pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() {
241 @Override 241 @Override
242 public void onTimeSelect(Date date, View v) {//选中事件回调 242 public void onTimeSelect(Date date, View v) {//选中事件回调
243 // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null 243 // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null
244 /*btn_Time.setText(getTime(date));*/ 244 /*btn_Time.setText(getTime(date));*/
245 TextView btn = (TextView) v; 245 TextView btn = (TextView) v;
246 btn.setText(getTime(date)); 246 btn.setText(getTime(date));
247 } 247 }
248 }) 248 })
249 //年月日时分秒 的显示与否,不设置则默认全部显示 249 //年月日时分秒 的显示与否,不设置则默认全部显示
250 .setType(new boolean[]{true, true, true, false, false, false}) 250 .setType(new boolean[]{true, true, true, false, false, false})
251 .setLabel("", "", "", "", "", "") 251 .setLabel("", "", "", "", "", "")
252 .isCenterLabel(false) 252 .isCenterLabel(false)
253 .setDividerColor(Color.DKGRAY) 253 .setDividerColor(Color.DKGRAY)
254 .setContentSize(21) 254 .setContentSize(21)
255 // .setDate(selectedDate) 255 // .setDate(selectedDate)
256 // .setRangDate(startDate, endDate) 256 // .setRangDate(startDate, endDate)
257 .setBackgroundId(0x80000000) //设置外部遮罩颜色 257 .setBackgroundId(0x80000000) //设置外部遮罩颜色
258 .setDecorView(null) 258 .setDecorView(null)
259 .setTitleText("购买日期") 259 .setTitleText("购买日期")
260 .setTitleSize(22) 260 .setTitleSize(22)
261 .setCancelColor(Color.GRAY) 261 .setCancelColor(Color.GRAY)
262 .setSubCalSize(22) 262 .setSubCalSize(22)
263 .setDividerColor(Color.GRAY) 263 .setDividerColor(Color.GRAY)
264 .setSubmitColor(Color.GRAY) 264 .setSubmitColor(Color.GRAY)
265 .build(); 265 .build();
266 } 266 }
267 267
268 private String getTime(Date date) {//可根据需要自行截取数据显示 268 private String getTime(Date date) {//可根据需要自行截取数据显示
269 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); 269 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
270 return format.format(date); 270 return format.format(date);
271 } 271 }
272 272
273 @Override 273 @Override
274 public void onAttach(Activity activity) { 274 public void onAttach(Activity activity) {
275 super.onAttach(activity); 275 super.onAttach(activity);
276 View rootView = activity.getWindow().getDecorView(); 276 View rootView = activity.getWindow().getDecorView();
277 TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); 277 TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub);
278 sub.setOnClickListener(this); 278 sub.setOnClickListener(this);
279 } 279 }
280 280
281 @Override 281 @Override
282 public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { 282 public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) {
283 String regionName = data.get(position).getRegionName(); 283 String regionName = data.get(position).getRegionName();
284 String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); 284 String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng");
285 SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); 285 SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName);
286 CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); 286 CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog");
287 tv_useinfo_adress.setText(""); 287 tv_useinfo_adress.setText("");
288 tv_useinfo_adress.setText(provice + regionName); 288 tv_useinfo_adress.setText(provice + regionName);
289 289
290 290
291 } 291 }
292 292
293 @Override 293 @Override
294 public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { 294 public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) {
295 String regionName = data.get(position).getRegionName(); 295 String regionName = data.get(position).getRegionName();
296 String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); 296 String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng");
297 String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); 297 String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi");
298 tv_useinfo_adress.setText(""); 298 tv_useinfo_adress.setText("");
299 tv_useinfo_adress.setText(provices + citys + regionName); 299 tv_useinfo_adress.setText(provices + citys + regionName);
300 300
301 } 301 }
302 302
303 @Override 303 @Override
304 public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { 304 public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) {
305 String regionName = data.get(position).getName(); 305 String regionName = data.get(position).getName();
306 tv_useinfo_gender.setText(regionName); 306 tv_useinfo_gender.setText(regionName);
307 } 307 }
308 308
309 @Override 309 @Override
310 public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { 310 public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) {
311 String regionName = data.get(position).getRegionName(); 311 String regionName = data.get(position).getRegionName();
312 SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); 312 SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName);
313 CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); 313 CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog");
314 314
315 } 315 }
316 316
317 @Override 317 @Override
318 public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { 318 public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) {
319 String regionName = data.get(position).getSchoolName(); 319 String regionName = data.get(position).getSchoolName();
320 tv_useinfo_school.setText(regionName); 320 tv_useinfo_school.setText(regionName);
321 321
322 322
323 } 323 }
324 } 324 }
325 325
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/RegisterFragment.java
1 package com.hjx.personalcenter.fragment; 1 package com.hjx.personalcenter.fragment;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.os.Handler; 5 import android.os.Handler;
6 import android.os.Message; 6 import android.os.Message;
7 import android.support.annotation.Nullable; 7 import android.support.annotation.Nullable;
8 import android.support.v4.app.Fragment; 8 import android.support.v4.app.Fragment;
9 import android.text.TextUtils; 9 import android.text.TextUtils;
10 import android.text.method.HideReturnsTransformationMethod; 10 import android.text.method.HideReturnsTransformationMethod;
11 import android.text.method.PasswordTransformationMethod; 11 import android.text.method.PasswordTransformationMethod;
12 import android.view.LayoutInflater; 12 import android.view.LayoutInflater;
13 import android.view.View; 13 import android.view.View;
14 import android.view.ViewGroup; 14 import android.view.ViewGroup;
15 import android.widget.Button; 15 import android.widget.Button;
16 import android.widget.EditText; 16 import android.widget.EditText;
17 import android.widget.ImageView; 17 import android.widget.ImageView;
18 18
19 import com.hjx.personalcenter.R; 19 import com.hjx.personalcenter.R;
20 import com.hjx.personalcenter.activity.RegisterInfoActivity; 20 import com.hjx.personalcenter.activity.RegisterInfoActivity;
21 import com.hjx.personalcenter.db.Content;
21 import com.hjx.personalcenter.http.HttpCode; 22 import com.hjx.personalcenter.http.HttpCode;
22 import com.hjx.personalcenter.http.HttpManager; 23 import com.hjx.personalcenter.http.HttpManager;
23 import com.hjx.personalcenter.util.AlertUtils; 24 import com.hjx.personalcenter.util.AlertUtils;
24 import com.hjx.personalcenter.util.PasswordCheckUtils; 25 import com.hjx.personalcenter.util.PasswordCheckUtils;
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 Administrator on 2016/11/7. 33 * Created by Administrator on 2016/11/7.
33 */ 34 */
34 35
35 public class RegisterFragment extends Fragment implements View.OnClickListener { 36 public class RegisterFragment extends Fragment implements View.OnClickListener {
36 private View mView; 37 private View mView;
37 38
38 private Button btn_register,get_authcode; 39 private Button btn_register,get_authcode;
39 private EditText phonenumber,password,anth_6num;//;//密码 40 private EditText phonenumber,password,anth_6num;//;//密码
40 private ImageView openeyes; 41 private ImageView openeyes;
41 private String sourceStr ="android"; 42 private String sourceStr ="android";
42 private String typeStr = "register"; 43 private String typeStr = "register";
43 private int i = 0; 44 private int i = 0;
44 private Thread thread; 45 private Thread thread;
45 private int type; 46 private int type;
46 public static Boolean showPassword = false; 47 public static Boolean showPassword = false;
47 public static String TABLAYOUT_FRAGMENT = "tab_fragment"; 48 public static String TABLAYOUT_FRAGMENT = "tab_fragment";
48 49
49 public static RegisterFragment newInstance(int type) { 50 public static RegisterFragment newInstance(int type) {
50 RegisterFragment fragment = new RegisterFragment(); 51 RegisterFragment fragment = new RegisterFragment();
51 Bundle bundle = new Bundle(); 52 Bundle bundle = new Bundle();
52 bundle.putSerializable(TABLAYOUT_FRAGMENT, type); 53 bundle.putSerializable(TABLAYOUT_FRAGMENT, type);
53 fragment.setArguments(bundle); 54 fragment.setArguments(bundle);
54 return fragment; 55 return fragment;
55 56
56 } 57 }
57 Handler handler = new Handler() { 58 Handler handler = new Handler() {
58 @Override 59 @Override
59 public void handleMessage(Message msg) { 60 public void handleMessage(Message msg) {
60 super.handleMessage(msg); 61 super.handleMessage(msg);
61 try { 62 try {
62 JSONObject jsonObject; 63 JSONObject jsonObject;
63 String status; 64 String status;
64 switch (msg.what) { 65 switch (msg.what) {
65 case HttpCode.REGISTERED_SUCESS: 66 case HttpCode.REGISTERED_SUCESS:
66 jsonObject = (JSONObject) msg.obj; 67 jsonObject = (JSONObject) msg.obj;
67 status = jsonObject.getString("status"); 68 status = jsonObject.getString("status");
68 //AlertUtils.showToast(RegisterActivity.this, jsonObject.optString("message")); 69 //AlertUtils.showToast(RegisterActivity.this, jsonObject.optString("message"));
69 String access_token = jsonObject.getString("access_token"); 70 String access_token = jsonObject.getString("access_token");
70 String userId = jsonObject.getString("userId"); 71 String userId = jsonObject.getString("userId");
71 if (status.equals("100")) { 72 if (status.equals("100")) {
72 String usernameStr = phonenumber.getText().toString().trim(); 73 String usernameStr = phonenumber.getText().toString().trim();
73 String passwordStr = password.getText().toString().trim(); 74 String passwordStr = password.getText().toString().trim();
74 HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,"true",userId); 75 //HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,"true",userId);
75 AlertUtils.showToast(getActivity(), "注册成功!"); 76 AlertUtils.showToast(getActivity(), "注册成功!");
77 Content.accountflag =1;
76 //检查信息是否填写完整 78 //检查信息是否填写完整
77 Intent intent = new Intent(); 79 Intent intent = new Intent();
78 intent.setClass(getActivity(),RegisterInfoActivity.class); 80 intent.setClass(getActivity(),RegisterInfoActivity.class);
79 startActivity(intent); 81 startActivity(intent);
80 getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); 82 getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout);
81 getActivity().finish(); 83 getActivity().finish();
82 } 84 }
83 break; 85 break;
84 case HttpCode.REGISTERED_FAIL: 86 case HttpCode.REGISTERED_FAIL:
85 AlertUtils.showToast(getActivity(), "注册失败"); 87 AlertUtils.showToast(getActivity(), "注册失败");
86 break; 88 break;
87 case HttpCode.AUTHCODE_SUCESS: 89 case HttpCode.AUTHCODE_SUCESS:
88 jsonObject = (JSONObject) msg.obj; 90 jsonObject = (JSONObject) msg.obj;
89 status = jsonObject.optString("status"); 91 status = jsonObject.optString("status");
90 if (status.equals("100")) { 92 if (status.equals("100")) {
91 AlertUtils.showToast(getActivity(), "验证码发送成功"); 93 AlertUtils.showToast(getActivity(), "验证码发送成功");
92 } 94 }
93 95
94 break; 96 break;
95 case HttpCode.AUTHCODE_FAIL: 97 case HttpCode.AUTHCODE_FAIL:
96 jsonObject = (JSONObject) msg.obj; 98 jsonObject = (JSONObject) msg.obj;
97 AlertUtils.showToast(getActivity(), "验证码发送失败"); 99 AlertUtils.showToast(getActivity(), "验证码发送失败");
98 break; 100 break;
99 case HttpCode.IS_REFISTER: 101 case HttpCode.IS_REFISTER:
100 jsonObject = (JSONObject) msg.obj; 102 jsonObject = (JSONObject) msg.obj;
101 status = jsonObject.getString("status"); 103 status = jsonObject.getString("status");
102 if (!status.equals("true")) { 104 if (!status.equals("true")) {
103 getauthcode(); 105 getauthcode();
104 106
105 }else { 107 }else {
106 AlertUtils.showToast(getActivity(), "该手机号已经注册过了"); 108 AlertUtils.showToast(getActivity(), "该手机号已经注册过了");
107 } 109 }
108 break; 110 break;
109 case 1: 111 case 1:
110 get_authcode.setEnabled(false); 112 get_authcode.setEnabled(false);
111 get_authcode.setClickable(false); 113 get_authcode.setClickable(false);
112 get_authcode.setText(Integer.toString(i--)+" s"); 114 get_authcode.setText(Integer.toString(i--)+" s");
113 if (i<=0){ 115 if (i<=0){
114 get_authcode.setEnabled(true); 116 get_authcode.setEnabled(true);
115 get_authcode.setClickable(true); 117 get_authcode.setClickable(true);
116 get_authcode.setText("获取验证码"); 118 get_authcode.setText("获取验证码");
117 } 119 }
118 break; 120 break;
119 } 121 }
120 } catch (JSONException e) { 122 } catch (JSONException e) {
121 e.printStackTrace(); 123 e.printStackTrace();
122 } 124 }
123 } 125 }
124 }; 126 };
125 @Override 127 @Override
126 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 128 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
127 if (mView == null) { 129 if (mView == null) {
128 mView = inflater.inflate(R.layout.fragment_loginandregister_register, container, false); 130 mView = inflater.inflate(R.layout.fragment_loginandregister_register, container, false);
129 initView(mView); 131 initView(mView);
130 initData(); 132 initData();
131 setLister(); 133 setLister();
132 134
133 135
134 } 136 }
135 return mView; 137 return mView;
136 } 138 }
137 139
138 private void initView(View mView) { 140 private void initView(View mView) {
139 get_authcode = (Button) mView.findViewById(R.id.btn_authcode); 141 get_authcode = (Button) mView.findViewById(R.id.btn_authcode);
140 anth_6num = (EditText) mView.findViewById(R.id.et_authcode); 142 anth_6num = (EditText) mView.findViewById(R.id.et_authcode);
141 phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); 143 phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber);
142 password = (EditText) mView.findViewById(R.id.et_password); 144 password = (EditText) mView.findViewById(R.id.et_password);
143 openeyes= (ImageView) mView.findViewById(R.id.iv_pwd_change); 145 openeyes= (ImageView) mView.findViewById(R.id.iv_pwd_change);
144 btn_register = (Button) mView.findViewById(R.id.btn_register); 146 btn_register = (Button) mView.findViewById(R.id.btn_register);
145 147
146 } 148 }
147 private void initData() { 149 private void initData() {
148 } 150 }
149 private void setLister() { 151 private void setLister() {
150 get_authcode.setOnClickListener(this); 152 get_authcode.setOnClickListener(this);
151 openeyes.setOnClickListener(this); 153 openeyes.setOnClickListener(this);
152 btn_register.setOnClickListener(this); 154 btn_register.setOnClickListener(this);
153 } 155 }
154 156
155 157
156 @Override 158 @Override
157 public void onClick(View v) { 159 public void onClick(View v) {
158 switch (v.getId()){ 160 switch (v.getId()){
159 case R.id.btn_register: 161 case R.id.btn_register:
160 //测试 162 //测试
161 // 163 //
162 164
163 String usernameStr = phonenumber.getText().toString().trim(); 165 String usernameStr = phonenumber.getText().toString().trim();
164 String authcodeStr = anth_6num.getText().toString().trim(); 166 String authcodeStr = anth_6num.getText().toString().trim();
165 String passwordStr = password.getText().toString().trim(); 167 String passwordStr = password.getText().toString().trim();
166 if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)||TextUtils.isEmpty(passwordStr)) { 168 if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)||TextUtils.isEmpty(passwordStr)) {
167 AlertUtils.showToast(getActivity(), "手机号,密码和验证码不能为空"); 169 AlertUtils.showToast(getActivity(), "手机号,密码和验证码不能为空");
168 return; 170 return;
169 } else if(passwordStr.length()<8){ 171 } else if(passwordStr.length()<8){
170 AlertUtils.showToast(getActivity(), "密码不能少于8位"); 172 AlertUtils.showToast(getActivity(), "密码不能少于8位");
171 }else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ 173 }else if (!PhoneNumCheckUtils.isPhone(usernameStr)){
172 AlertUtils.showToast(getActivity(), "手机号码输入错误"); 174 AlertUtils.showToast(getActivity(), "手机号码输入错误");
173 175
174 }else if(!passwordStr.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ 176 }else if(!passwordStr.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){
175 AlertUtils.showToast(getActivity(), "密码由英文和数字组成"); 177 AlertUtils.showToast(getActivity(), "密码由英文和数字组成");
176 }else { 178 }else {
177 register(); 179 register();
178 } 180 }
179 181
180 break; 182 break;
181 case R.id.iv_pwd_change: 183 case R.id.iv_pwd_change:
182 if(showPassword){//显示密码 184 if(showPassword){//显示密码
183 showPassword = !showPassword; 185 showPassword = !showPassword;
184 openeyes.setImageResource(R.mipmap.pwd_open); 186 openeyes.setImageResource(R.mipmap.pwd_open);
185 password.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); 187 password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
186 password.setSelection(password.getText().toString().length()); 188 password.setSelection(password.getText().toString().length());
187 }else{//隐藏密码 189 }else{//隐藏密码
188 showPassword = !showPassword; 190 showPassword = !showPassword;
189 openeyes.setImageResource(R.mipmap.pwd_hide); 191 openeyes.setImageResource(R.mipmap.pwd_hide);
190 password.setTransformationMethod(PasswordTransformationMethod.getInstance()); 192 password.setTransformationMethod(PasswordTransformationMethod.getInstance());
191 password.setSelection(password.getText().toString().length()); 193 password.setSelection(password.getText().toString().length());
192 } 194 }
193 break; 195 break;
194 case R.id.btn_authcode: 196 case R.id.btn_authcode:
195 usernameStr = phonenumber.getText().toString().trim(); 197 usernameStr = phonenumber.getText().toString().trim();
196 if (!PhoneNumCheckUtils.isPhone(usernameStr)){ 198 if (!PhoneNumCheckUtils.isPhone(usernameStr)){
197 AlertUtils.showToast(getActivity(), "请输入正确的手机号"); 199 AlertUtils.showToast(getActivity(), "请输入正确的手机号");
198 }else { 200 }else {
199 anth_6num.requestFocus(); 201 anth_6num.requestFocus();
200 ifregister(); 202 ifregister();
201 } 203 }
202 204
203 break; 205 break;
204 } 206 }
205 207
206 } 208 }
207 //获取验证码 209 //获取验证码
208 private void getauthcode() { 210 private void getauthcode() {
209 String usernameStr = phonenumber.getText().toString().trim(); 211 String usernameStr = phonenumber.getText().toString().trim();
210 HttpManager.getInstance().authCode(typeStr, usernameStr, handler, getActivity()); 212 HttpManager.getInstance().authCode(typeStr, usernameStr, handler, getActivity());
211 i = 60; 213 i = 60;
212 if(thread == null){ 214 if(thread == null){
213 thread = new Thread( new ThreadShow()); 215 thread = new Thread( new ThreadShow());
214 thread.start(); 216 thread.start();
215 } 217 }
216 } 218 }
217 219
218 private void ifregister() { 220 private void ifregister() {
219 String usernameStr = phonenumber.getText().toString().trim(); 221 String usernameStr = phonenumber.getText().toString().trim();
220 HttpManager.getInstance().isregistered(usernameStr, handler, getActivity()); 222 HttpManager.getInstance().isregistered(usernameStr, handler, getActivity());
221 } 223 }
222 224
223 private void register() { 225 private void register() {
224 String usernameStr = phonenumber.getText().toString().trim(); 226 String usernameStr = phonenumber.getText().toString().trim();
225 String authcodeStr = anth_6num.getText().toString().trim(); 227 String authcodeStr = anth_6num.getText().toString().trim();
226 String passwordStr = password.getText().toString().trim(); 228 String passwordStr = password.getText().toString().trim();
227 HttpManager.getInstance().register(getActivity(), usernameStr, passwordStr, authcodeStr, sourceStr,handler); 229 HttpManager.getInstance().register(getActivity(), usernameStr, passwordStr, authcodeStr, sourceStr,handler);
228 } 230 }
229 // 线程类 定时器 231 // 线程类 定时器
230 class ThreadShow implements Runnable { 232 class ThreadShow implements Runnable {
231 233
232 @Override 234 @Override
233 public void run() { 235 public void run() {
234 // TODO Auto-generated method stub 236 // TODO Auto-generated method stub
235 while (true) { 237 while (true) {
236 try { 238 try {
237 Thread.sleep(1000); 239 Thread.sleep(1000);
238 Message msg = new Message(); 240 Message msg = new Message();
239 msg.what = 1; 241 msg.what = 1;
240 handler.sendMessage(msg); 242 handler.sendMessage(msg);
241 System.out.println("send..."); 243 System.out.println("send...");
242 } catch (Exception e) { 244 } catch (Exception e) {
243 // TODO Auto-generated catch block 245 // TODO Auto-generated catch block
244 e.printStackTrace(); 246 e.printStackTrace();
245 System.out.println("thread error..."); 247 System.out.println("thread error...");
246 } 248 }
247 } 249 }
248 } 250 }
249 } 251 }
250 } 252 }
251 253
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{
285 Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show();
284 } 286 }
285 } catch (JSONException e) { 287 } catch (JSONException e) {
286 e.printStackTrace(); 288 e.printStackTrace();
287 } 289 }
288 } 290 }
289 291
290 @Override 292 @Override
291 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 293 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
292 Log.e("test", "onFailure" + new String(bytes)); 294 Log.e("test", "onFailure" + new String(bytes));
293 new CircleDialog.Builder((FragmentActivity) context) 295 new CircleDialog.Builder((FragmentActivity) context)
294 .setCanceledOnTouchOutside(false) 296 .setCanceledOnTouchOutside(false)
295 .setCancelable(false) 297 .setCancelable(false)
296 .setWidth(0.5f) 298 .setWidth(0.5f)
297 .configText(new ConfigText() { 299 .configText(new ConfigText() {
298 @Override 300 @Override
299 public void onConfig(TextParams params) { 301 public void onConfig(TextParams params) {
300 params.gravity = Gravity.CENTER; 302 params.gravity = Gravity.CENTER;
301 params.padding = new int[]{50, 50, 50, 50}; 303 params.padding = new int[]{50, 50, 50, 50};
302 } 304 }
303 }) 305 })
304 .setText("当前无网络,请检查网络设置") 306 .setText("当前无网络,请检查网络设置")
305 .setNegative("继续使用", null) 307 .setNegative("继续使用", null)
306 .setPositive("设置网络", new View.OnClickListener() { 308 .setPositive("设置网络", new View.OnClickListener() {
307 @Override 309 @Override
308 public void onClick(View v) { 310 public void onClick(View v) {
309 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 311 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
310 context.startActivity(intent); 312 context.startActivity(intent);
311 } 313 }
312 }) 314 })
313 .show(); 315 .show();
314 } 316 }
315 }); 317 });
316 318
317 } 319 }
318 320
319 //忘记密码 321 //忘记密码
320 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) {
321 RequestParams params = new RequestParams(); 323 RequestParams params = new RequestParams();
322 params.put(HttpKey.USERNAME, forot_pwd_phone1); 324 params.put(HttpKey.USERNAME, forot_pwd_phone1);
323 params.put(HttpKey.PASSWORD, forot_pwd_pwd3); 325 params.put(HttpKey.PASSWORD, forot_pwd_pwd3);
324 params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); 326 params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1);
325 HttpClient.getInstance().addHeader("Accept", "*/*"); 327 HttpClient.getInstance().addHeader("Accept", "*/*");
326 HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { 328 HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() {
327 @Override 329 @Override
328 public void onSuccess(int i, Header[] headers, byte[] bytes) { 330 public void onSuccess(int i, Header[] headers, byte[] bytes) {
329 try { 331 try {
330 JSONObject jsonObject = new JSONObject(new String(bytes)); 332 JSONObject jsonObject = new JSONObject(new String(bytes));
331 String status = jsonObject.optString("status"); 333 String status = jsonObject.optString("status");
332 if (status.equals("100")) { 334 if (status.equals("100")) {
333 Log.e("test", "onSuccess" + new String(bytes)); 335 Log.e("test", "onSuccess" + new String(bytes));
334 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); 336 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show();
335 ((Activity) context).finish(); 337 ((Activity) context).finish();
338 }else{
339 Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show();
336 } 340 }
337 } catch (JSONException e) { 341 } catch (JSONException e) {
338 e.printStackTrace(); 342 e.printStackTrace();
339 } 343 }
340 } 344 }
341 345
342 @Override 346 @Override
343 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 347 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
344 Log.e("test", "onFailure" + new String(bytes)); 348 Log.e("test", "onFailure" + new String(bytes));
345 new CircleDialog.Builder((FragmentActivity) context) 349 new CircleDialog.Builder((FragmentActivity) context)
346 .setCanceledOnTouchOutside(false) 350 .setCanceledOnTouchOutside(false)
347 .setCancelable(false) 351 .setCancelable(false)
348 .setWidth(0.5f) 352 .setWidth(0.5f)
349 .configText(new ConfigText() { 353 .configText(new ConfigText() {
350 @Override 354 @Override
351 public void onConfig(TextParams params) { 355 public void onConfig(TextParams params) {
352 params.gravity = Gravity.CENTER; 356 params.gravity = Gravity.CENTER;
353 params.padding = new int[]{50, 50, 50, 50}; 357 params.padding = new int[]{50, 50, 50, 50};
354 } 358 }
355 }) 359 })
356 .setText("当前无网络,请检查网络设置") 360 .setText("当前无网络,请检查网络设置")
357 .setNegative("继续使用", null) 361 .setNegative("继续使用", null)
358 .setPositive("设置网络", new View.OnClickListener() { 362 .setPositive("设置网络", new View.OnClickListener() {
359 @Override 363 @Override
360 public void onClick(View v) { 364 public void onClick(View v) {
361 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 365 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
362 context.startActivity(intent); 366 context.startActivity(intent);
363 } 367 }
364 }) 368 })
365 .show(); 369 .show();
366 } 370 }
367 }); 371 });
368 372
369 } 373 }
370 374
371 //保存用户登录信息 375 //保存用户登录信息
372 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) {
373 SaveParam.getInstance().saveLoginParam(context, "username", username); 377 SaveParam.getInstance().saveLoginParam(context, "username", username);
374 SaveParam.getInstance().saveLoginParam(context, "password", password); 378 SaveParam.getInstance().saveLoginParam(context, "password", password);
375 SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); 379 SaveParam.getInstance().saveLoginParam(context, "access_token", access_token);
376 SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); 380 SaveParam.getInstance().saveLoginParam(context, "login", loginStatus);
377 SaveParam.getInstance().saveLoginParam(context, "userId", userId); 381 SaveParam.getInstance().saveLoginParam(context, "userId", userId);
378 382
379 383
380 } 384 }
381 385
382 //保存用户登录信息
383 public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) {
384 SaveParam.getInstance().saveLoginParam(context, "lastname", lastname);
385 SaveParam.getInstance().saveLoginParam(context, "gender", gender);
386 SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait);
387 }
388
389 //提交保卡信息 386 //提交保卡信息
390 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,
391 String buyAddress, String buyTime, String alterSaleCall, 388 String buyAddress, String buyTime, String alterSaleCall,
392 String productModel, String deviceNumber, String macAddress, 389 String productModel, String deviceNumber, String macAddress,
393 String mobilePhone) { 390 String mobilePhone) {
394 mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", 391 mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...",
395 false, true, null); 392 false, true, null);
396 RequestParams params = new RequestParams(); 393 RequestParams params = new RequestParams();
397 394
398 params.put(HttpKey.USEID, userId); 395 params.put(HttpKey.USEID, userId);
399 params.put(HttpKey.CUSTOMENAME, customerName); 396 params.put(HttpKey.CUSTOMENAME, customerName);
400 params.put(HttpKey.CUSTOMADRESS, customerAddress); 397 params.put(HttpKey.CUSTOMADRESS, customerAddress);
401 params.put(HttpKey.BUYADREES, buyAddress); 398 params.put(HttpKey.BUYADREES, buyAddress);
402 params.put(HttpKey.BUYTIME, buyTime); 399 params.put(HttpKey.BUYTIME, buyTime);
403 params.put(HttpKey.ALTERSALECALL, alterSaleCall); 400 params.put(HttpKey.ALTERSALECALL, alterSaleCall);
404 params.put(HttpKey.PRODUCTMODEL, productModel); 401 params.put(HttpKey.PRODUCTMODEL, productModel);
405 params.put(HttpKey.DEVICENUMBER, deviceNumber); 402 params.put(HttpKey.DEVICENUMBER, deviceNumber);
406 params.put(HttpKey.MACADRESS, macAddress); 403 params.put(HttpKey.MACADRESS, macAddress);
407 params.put(HttpKey.MOBILPHONE, mobilePhone); 404 params.put(HttpKey.MOBILPHONE, mobilePhone);
408 405
409 HttpClient.getInstance().addHeader("Accept", "*/*"); 406 HttpClient.getInstance().addHeader("Accept", "*/*");
410 407
411 Log.e("test", "params" + params); 408 Log.e("test", "params" + params);
412 HttpClient.getInstance().setTimeout(5 * 1000); 409 HttpClient.getInstance().setTimeout(5 * 1000);
413 HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { 410 HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() {
414 @Override 411 @Override
415 public void onSuccess(int i, Header[] headers, byte[] bytes) { 412 public void onSuccess(int i, Header[] headers, byte[] bytes) {
416 JSONObject jsonObject = null; 413 JSONObject jsonObject = null;
417 closeProgress(); 414 closeProgress();
418 try { 415 try {
419 jsonObject = new JSONObject(new String(bytes)); 416 jsonObject = new JSONObject(new String(bytes));
420 String status = jsonObject.optString("status"); 417 String status = jsonObject.optString("status");
421 if (status.equals("1")) { 418 if (status.equals("1")) {
422 Log.e("test", "onSuccess" + jsonObject); 419 Log.e("test", "onSuccess" + jsonObject);
423 Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); 420 Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show();
424 Intent intent = new Intent(); 421 Intent intent = new Intent();
425 intent.setClass((Activity) context, TheStartPageActivity.class); 422 intent.setClass((Activity) context, TheStartPageActivity.class);
426 ((Activity) context).startActivity(intent); 423 ((Activity) context).startActivity(intent);
427 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); 424 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout);
428 ((Activity) context).finish(); 425 ((Activity) context).finish();
426 } else {
427 Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show();
429 } 428 }
430 } catch (JSONException e) { 429 } catch (JSONException e) {
431 e.printStackTrace(); 430 e.printStackTrace();
432 } 431 }
433 432
434 433
435 } 434 }
436 435
437 @Override 436 @Override
438 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 437 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
439 Log.e("test", "onFailure" + (throwable)); 438 Log.e("test", "onFailure" + (throwable));
440 closeProgress(); 439 closeProgress();
441 new CircleDialog.Builder((FragmentActivity) context) 440 new CircleDialog.Builder((FragmentActivity) context)
442 .setCanceledOnTouchOutside(false) 441 .setCanceledOnTouchOutside(false)
443 .setCancelable(false) 442 .setCancelable(false)
444 .setWidth(0.5f) 443 .setWidth(0.5f)
445 .configText(new ConfigText() { 444 .configText(new ConfigText() {
446 @Override 445 @Override
447 public void onConfig(TextParams params) { 446 public void onConfig(TextParams params) {
448 params.gravity = Gravity.CENTER; 447 params.gravity = Gravity.CENTER;
449 params.padding = new int[]{50, 50, 50, 50}; 448 params.padding = new int[]{50, 50, 50, 50};
450 } 449 }
451 }) 450 })
452 .setText("当前无网络,请检查网络设置") 451 .setText("当前无网络,请检查网络设置")
453 .setNegative("继续使用", null) 452 .setNegative("继续使用", null)
454 .setPositive("设置网络", new View.OnClickListener() { 453 .setPositive("设置网络", new View.OnClickListener() {
455 @Override 454 @Override
456 public void onClick(View v) { 455 public void onClick(View v) {
457 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 456 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
458 context.startActivity(intent); 457 context.startActivity(intent);
459 } 458 }
460 }) 459 })
461 .show(); 460 .show();
462 461
463 } 462 }
464 }); 463 });
465 464
466 } 465 }
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 CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 478 try {
479 CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); 479 JSONObject jsonObject = new JSONObject(new String(arg2));
480 Message msg = Message.obtain(); 480 int status = jsonObject.optInt("status");
481 msg.what = HttpCode.SUCHCARDINFO; 481 if (status == 1) {
482 msg.obj = schoolInfoBeanList; 482 CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据
483 handler.sendMessage(msg); 483 CardInfo.DataBean schoolInfoBeanList = cardInfo.getData();
484 Message msg = Message.obtain();
485 msg.what = HttpCode.SUCHCARDINFO;
486 msg.obj = schoolInfoBeanList;
487 handler.sendMessage(msg);
488
489
490 } else {
491 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
492
493 }
494 } catch (JSONException e) {
495 e.printStackTrace();
496 }
497
484 } 498 }
485 499
486 @Override 500 @Override
487 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 501 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
488 closeProgress(); 502 closeProgress();
489 new CircleDialog.Builder((FragmentActivity) mContext) 503 new CircleDialog.Builder((FragmentActivity) mContext)
490 .setCanceledOnTouchOutside(false) 504 .setCanceledOnTouchOutside(false)
491 .setCancelable(false) 505 .setCancelable(false)
492 .setWidth(0.5f) 506 .setWidth(0.5f)
493 .configText(new ConfigText() { 507 .configText(new ConfigText() {
494 @Override 508 @Override
495 public void onConfig(TextParams params) { 509 public void onConfig(TextParams params) {
496 params.gravity = Gravity.CENTER; 510 params.gravity = Gravity.CENTER;
497 params.padding = new int[]{50, 50, 50, 50}; 511 params.padding = new int[]{50, 50, 50, 50};
498 } 512 }
499 }) 513 })
500 .setText("当前无网络,请检查网络设置") 514 .setText("当前无网络,请检查网络设置")
501 .setNegative("继续使用", null) 515 .setNegative("继续使用", null)
502 .setPositive("设置网络", new View.OnClickListener() { 516 .setPositive("设置网络", new View.OnClickListener() {
503 @Override 517 @Override
504 public void onClick(View v) { 518 public void onClick(View v) {
505 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 519 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
506 mContext.startActivity(intent); 520 mContext.startActivity(intent);
507 } 521 }
508 }) 522 })
509 .show(); 523 .show();
510 } 524 }
511 }); 525 });
512 } 526 }
527
513 //修改保卡信息电话 528 //修改保卡信息电话
514 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) {
515 RequestParams params = new RequestParams(); 530 RequestParams params = new RequestParams();
516 params.put("userId", userId); 531 params.put("userId", userId);
517 params.put("customerPhone", customerPhone); 532 params.put("customerPhone", customerPhone);
518 params.put("authCode", authCode); 533 params.put("authCode", authCode);
519 HttpClient.getInstance().addHeader("Accept", "*/*"); 534 HttpClient.getInstance().addHeader("Accept", "*/*");
520 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { 535 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() {
521 @Override 536 @Override
522 public void onSuccess(int i, Header[] headers, byte[] bytes) { 537 public void onSuccess(int i, Header[] headers, byte[] bytes) {
523 try { 538 try {
524 JSONObject jsonObject = new JSONObject(new String(bytes)); 539 JSONObject jsonObject = new JSONObject(new String(bytes));
525 String status = jsonObject.optString("status"); 540 String status = jsonObject.optString("status");
526 if (status.equals("1")) { 541 if (status.equals("1")) {
527 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); 542 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show();
528 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone); 543 SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone);
529 ((Activity) mContext).finish(); 544 ((Activity) mContext).finish();
530 }else if (status.equals("1001")){ 545 } else if (status.equals("1001")) {
531 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); 546 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show();
547 } else {
548 AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试");
532 } 549 }
533 } catch (JSONException e) { 550 } catch (JSONException e) {
534 e.printStackTrace(); 551 e.printStackTrace();
535 } 552 }
536 } 553 }
537 554
538 @Override 555 @Override
539 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 556 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
540 Log.e("test", "onFailure" + new String(bytes)); 557 Log.e("test", "onFailure" + new String(bytes));
541 new CircleDialog.Builder((FragmentActivity) mContext) 558 new CircleDialog.Builder((FragmentActivity) mContext)
542 .setCanceledOnTouchOutside(false) 559 .setCanceledOnTouchOutside(false)
543 .setCancelable(false) 560 .setCancelable(false)
544 .setWidth(0.5f) 561 .setWidth(0.5f)
545 .configText(new ConfigText() { 562 .configText(new ConfigText() {
546 @Override 563 @Override
547 public void onConfig(TextParams params) { 564 public void onConfig(TextParams params) {
548 params.gravity = Gravity.CENTER; 565 params.gravity = Gravity.CENTER;
549 params.padding = new int[]{50, 50, 50, 50}; 566 params.padding = new int[]{50, 50, 50, 50};
550 } 567 }
551 }) 568 })
552 .setText("当前无网络,请检查网络设置") 569 .setText("当前无网络,请检查网络设置")
553 .setNegative("继续使用", null) 570 .setNegative("继续使用", null)
554 .setPositive("设置网络", new View.OnClickListener() { 571 .setPositive("设置网络", new View.OnClickListener() {
555 @Override 572 @Override
556 public void onClick(View v) { 573 public void onClick(View v) {
557 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 574 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
558 mContext.startActivity(intent); 575 mContext.startActivity(intent);
559 } 576 }
560 }) 577 })
561 .show(); 578 .show();
562 } 579 }
563 }); 580 });
564 } 581 }
582
565 //修改保卡信息地址 583 //修改保卡信息地址
566 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) {
567 RequestParams params = new RequestParams(); 585 RequestParams params = new RequestParams();
568 params.put("userId", userId); 586 params.put("userId", userId);
569 params.put("customerPhone", customerPhone); 587 params.put("customerPhone", customerPhone);
570 params.put("authCode", authCode); 588 params.put("authCode", authCode);
571 params.put("customerAddress", customerAddress); 589 params.put("customerAddress", customerAddress);
572 HttpClient.getInstance().addHeader("Accept", "*/*"); 590 HttpClient.getInstance().addHeader("Accept", "*/*");
573 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { 591 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() {
574 @Override 592 @Override
575 public void onSuccess(int i, Header[] headers, byte[] bytes) { 593 public void onSuccess(int i, Header[] headers, byte[] bytes) {
576 try { 594 try {
577 JSONObject jsonObject = new JSONObject(new String(bytes)); 595 JSONObject jsonObject = new JSONObject(new String(bytes));
578 String status = jsonObject.optString("status"); 596 String status = jsonObject.optString("status");
579 if (status.equals("1")) { 597 if (status.equals("1")) {
580 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); 598 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show();
581 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress); 599 SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress);
582 ((Activity) mContext).finish(); 600 ((Activity) mContext).finish();
601 } else {
602 AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试");
583 } 603 }
584 } catch (JSONException e) { 604 } catch (JSONException e) {
585 e.printStackTrace(); 605 e.printStackTrace();
586 } 606 }
587 } 607 }
588 608
589 @Override 609 @Override
590 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 610 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
591 Log.e("test", "onFailure" + new String(bytes)); 611 Log.e("test", "onFailure" + new String(bytes));
592 new CircleDialog.Builder((FragmentActivity) mContext) 612 new CircleDialog.Builder((FragmentActivity) mContext)
593 .setCanceledOnTouchOutside(false) 613 .setCanceledOnTouchOutside(false)
594 .setCancelable(false) 614 .setCancelable(false)
595 .setWidth(0.5f) 615 .setWidth(0.5f)
596 .configText(new ConfigText() { 616 .configText(new ConfigText() {
597 @Override 617 @Override
598 public void onConfig(TextParams params) { 618 public void onConfig(TextParams params) {
599 params.gravity = Gravity.CENTER; 619 params.gravity = Gravity.CENTER;
600 params.padding = new int[]{50, 50, 50, 50}; 620 params.padding = new int[]{50, 50, 50, 50};
601 } 621 }
602 }) 622 })
603 .setText("当前无网络,请检查网络设置") 623 .setText("当前无网络,请检查网络设置")
604 .setNegative("继续使用", null) 624 .setNegative("继续使用", null)
605 .setPositive("设置网络", new View.OnClickListener() { 625 .setPositive("设置网络", new View.OnClickListener() {
606 @Override 626 @Override
607 public void onClick(View v) { 627 public void onClick(View v) {
608 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 628 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
609 mContext.startActivity(intent); 629 mContext.startActivity(intent);
610 } 630 }
611 }) 631 })
612 .show(); 632 .show();
613 } 633 }
614 }); 634 });
615 } 635 }
636
616 //验证是否保卡信息 637 //验证是否保卡信息
617 public void cardinfocheck(final Context mContext, long userId, final Handler handler) { 638 public void cardinfocheck(final Context mContext, long userId, final Handler handler) {
618 mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", 639 mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...",
619 false, true, null); 640 false, true, null);
620 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");
621 HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() { 642 HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() {
622 @Override 643 @Override
623 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 644 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
624 Log.e("test", "---" + new String(arg2)); 645 Log.e("test", "---" + new String(arg2));
625 closeProgress(); 646 closeProgress();
626 Message msg = Message.obtain(); 647 try {
627 msg.what = HttpCode.CHECKCARD; 648 JSONObject jsonObject = new JSONObject(new String(arg2));
628 msg.obj = new String(arg2); 649 int status = jsonObject.optInt("status");
629 handler.sendMessage(msg); 650 if (status == 1) {
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
660 }
661 } catch (JSONException e) {
662 e.printStackTrace();
663 }
664
630 } 665 }
631 666
632 @Override 667 @Override
633 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 668 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
634 closeProgress(); 669 closeProgress();
635 new CircleDialog.Builder((FragmentActivity) mContext) 670 new CircleDialog.Builder((FragmentActivity) mContext)
636 .setCanceledOnTouchOutside(false) 671 .setCanceledOnTouchOutside(false)
637 .setCancelable(false) 672 .setCancelable(false)
638 .setWidth(0.5f) 673 .setWidth(0.5f)
639 .configText(new ConfigText() { 674 .configText(new ConfigText() {
640 @Override 675 @Override
641 public void onConfig(TextParams params) { 676 public void onConfig(TextParams params) {
642 params.gravity = Gravity.CENTER; 677 params.gravity = Gravity.CENTER;
643 params.padding = new int[]{50, 50, 50, 50}; 678 params.padding = new int[]{50, 50, 50, 50};
644 } 679 }
645 }) 680 })
646 .setText("当前无网络,请检查网络设置") 681 .setText("当前无网络,请检查网络设置")
647 .setNegative("继续使用", null) 682 .setNegative("继续使用", null)
648 .setPositive("设置网络", new View.OnClickListener() { 683 .setPositive("设置网络", new View.OnClickListener() {
649 @Override 684 @Override
650 public void onClick(View v) { 685 public void onClick(View v) {
651 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 686 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
652 mContext.startActivity(intent); 687 mContext.startActivity(intent);
653 } 688 }
654 }) 689 })
655 .show(); 690 .show();
656 //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); 691 //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show();
657 } 692 }
658 }); 693 });
659 } 694 }
660 695
661 ///获取年级 696 ///获取年级
662 public void getgrade(final Context mContext, final Handler handler) { 697 public void getgrade(final Context mContext, final Handler handler) {
663 HttpClient.getInstance().addHeader("Accept", "application/json"); 698 HttpClient.getInstance().addHeader("Accept", "application/json");
664 HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { 699 HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() {
665 @Override 700 @Override
666 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 701 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
667 Log.e("test", "年级" + new String(arg2)); 702 Log.e("test", "年级" + new String(arg2));
668 GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 703 GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据
669 List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); 704 List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>();
670 for (int i = 0 ;i<gradeInfo.getData().size()-2;i++) { 705 for (int i = 0; i < gradeInfo.getData().size() - 2; i++) {
671 String name = gradeInfo.getData().get(i).getName(); 706 String name = gradeInfo.getData().get(i).getName();
672 int id = gradeInfo.getData().get(i).getId(); 707 int id = gradeInfo.getData().get(i).getId();
673 List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); 708 List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren();
674 for (int j = 0; j < gradeinfoList.size(); j++) { 709 for (int j = 0; j < gradeinfoList.size(); j++) {
675 String secondname = gradeinfoList.get(j).getName(); 710 String secondname = gradeinfoList.get(j).getName();
676 int secondid = gradeinfoList.get(j).getId(); 711 int secondid = gradeinfoList.get(j).getId();
677 GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); 712 GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean();
678 dataBean.setName(secondname); 713 dataBean.setName(secondname);
679 dataBean.setId(secondid); 714 dataBean.setId(secondid);
680 gradeInfoLists.add(dataBean); 715 gradeInfoLists.add(dataBean);
681 } 716 }
682 717
683 } 718 }
684 719
685 Message message = Message.obtain(); 720 Message message = Message.obtain();
686 message.what = HttpCode.GRADER; 721 message.what = HttpCode.GRADER;
687 message.obj = gradeInfoLists; 722 message.obj = gradeInfoLists;
688 handler.sendMessage(message); 723 handler.sendMessage(message);
689 724
690 725
691 } 726 }
692 727
693 @Override 728 @Override
694 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 729 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
695 new CircleDialog.Builder((FragmentActivity) mContext) 730 new CircleDialog.Builder((FragmentActivity) mContext)
696 .setCanceledOnTouchOutside(false) 731 .setCanceledOnTouchOutside(false)
697 .setCancelable(false) 732 .setCancelable(false)
698 .setWidth(0.5f) 733 .setWidth(0.5f)
699 .configText(new ConfigText() { 734 .configText(new ConfigText() {
700 @Override 735 @Override
701 public void onConfig(TextParams params) { 736 public void onConfig(TextParams params) {
702 params.gravity = Gravity.CENTER; 737 params.gravity = Gravity.CENTER;
703 params.padding = new int[]{50, 50, 50, 50}; 738 params.padding = new int[]{50, 50, 50, 50};
704 } 739 }
705 }) 740 })
706 .setText("当前无网络,请检查网络设置") 741 .setText("当前无网络,请检查网络设置")
707 .setNegative("继续使用", null) 742 .setNegative("继续使用", null)
708 .setPositive("设置网络", new View.OnClickListener() { 743 .setPositive("设置网络", new View.OnClickListener() {
709 @Override 744 @Override
710 public void onClick(View v) { 745 public void onClick(View v) {
711 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 746 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
712 mContext.startActivity(intent); 747 mContext.startActivity(intent);
713 } 748 }
714 }) 749 })
715 .show(); 750 .show();
716 } 751 }
717 }); 752 });
718 } 753 }
719 754
720 /** 755 /**
721 * 获取学校 756 * 获取学校
757 *
722 * @param mContext 758 * @param mContext
723 * @param regionId 759 * @param regionId
724 * @param gradeId 760 * @param gradeId
725 * @param handler 761 * @param handler
726 */ 762 */
727 public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { 763 public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) {
728 HttpClient.getInstance().addHeader("Accept", "application/json"); 764 HttpClient.getInstance().addHeader("Accept", "application/json");
729 HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { 765 HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() {
730 @Override 766 @Override
731 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 767 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
732 Log.e("test", "学校" + new String(arg2)); 768 Log.e("test", "学校" + new String(arg2));
733 SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 769 try {
734 List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); 770 JSONObject jsonObject = new JSONObject(new String(arg2));
735 Message message = Message.obtain(); 771 int status = jsonObject.optInt("status");
736 message.what = HttpCode.SCHOOL; 772 if (status == 1) {
737 message.obj = schoolInfoBeanList; 773 SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据
738 handler.sendMessage(message); 774 List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData();
775 Message message = Message.obtain();
776 message.what = HttpCode.SCHOOL;
777 message.obj = schoolInfoBeanList;
778 handler.sendMessage(message);
779
780
781 } else {
782 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
783
784 }
785 } catch (JSONException e) {
786 e.printStackTrace();
787 }
739 788
740 } 789 }
741 790
742 @Override 791 @Override
743 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 792 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
744 new CircleDialog.Builder((FragmentActivity) mContext) 793 new CircleDialog.Builder((FragmentActivity) mContext)
745 .setCanceledOnTouchOutside(false) 794 .setCanceledOnTouchOutside(false)
746 .setCancelable(false) 795 .setCancelable(false)
747 .setWidth(0.5f) 796 .setWidth(0.5f)
748 .configText(new ConfigText() { 797 .configText(new ConfigText() {
749 @Override 798 @Override
750 public void onConfig(TextParams params) { 799 public void onConfig(TextParams params) {
751 params.gravity = Gravity.CENTER; 800 params.gravity = Gravity.CENTER;
752 params.padding = new int[]{50, 50, 50, 50}; 801 params.padding = new int[]{50, 50, 50, 50};
753 } 802 }
754 }) 803 })
755 .setText("当前无网络,请检查网络设置") 804 .setText("当前无网络,请检查网络设置")
756 .setNegative("继续使用", null) 805 .setNegative("继续使用", null)
757 .setPositive("设置网络", new View.OnClickListener() { 806 .setPositive("设置网络", new View.OnClickListener() {
758 @Override 807 @Override
759 public void onClick(View v) { 808 public void onClick(View v) {
760 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 809 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
761 mContext.startActivity(intent); 810 mContext.startActivity(intent);
762 } 811 }
763 }) 812 })
764 .show(); 813 .show();
765 } 814 }
766 }); 815 });
767 } 816 }
768 817
769 818
770
771 /** 819 /**
772 * 获取个人信息 820 * 获取个人信息
821 *
773 * @param mContext 822 * @param mContext
774 * @param userId 823 * @param userId
775 * @param handler 824 * @param handler
776 */ 825 */
777 public void getpresonalinfo(final Context mContext, long userId, final Handler handler) { 826 public void getpresonalinfo(final Context mContext, long userId, final Handler handler) {
778 mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", 827 mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...",
779 false, true, null); 828 false, true, null);
780 HttpClient.getInstance().addHeader("Accept", "application/json"); 829 HttpClient.getInstance().addHeader("Accept", "application/json");
781 HttpClient.getInstance().setConnectTimeout(5*1000); 830 HttpClient.getInstance().setConnectTimeout(5 * 1000);
782 HttpClient.getInstance().get(HttpUrl.getpresonalinfo+ "?userId=" + userId, new AsyncHttpResponseHandler() { 831 HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId, new AsyncHttpResponseHandler() {
783 @Override 832 @Override
784 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 833 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
785 closeProgress(); 834 closeProgress();
786 Log.e("test", "个人信息" + new String(arg2)); 835 Log.e("test", "个人信息" + new String(arg2));
787 PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 836 try {
788 PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); 837 JSONObject jsonObject = new JSONObject(new String(arg2));
789 Message message = Message.obtain(); 838 int status = jsonObject.optInt("status");
790 message.what = HttpCode.GETINFO; 839 if (status == 1) {
791 message.obj = pesonalInfoBeanList; 840 PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据
792 handler.sendMessage(message); 841 PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData();
842 Message message = Message.obtain();
843 message.what = HttpCode.GETINFO;
844 message.obj = pesonalInfoBeanList;
845 handler.sendMessage(message);
846
847
848 } else {
849 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
850
851 }
852 } catch (JSONException e) {
853 e.printStackTrace();
854 }
855
793 856
794 } 857 }
795 858
796 @Override 859 @Override
797 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 860 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
798 closeProgress(); 861 closeProgress();
799 new CircleDialog.Builder((FragmentActivity) mContext) 862 new CircleDialog.Builder((FragmentActivity) mContext)
800 .setCanceledOnTouchOutside(false) 863 .setCanceledOnTouchOutside(false)
801 .setCancelable(false) 864 .setCancelable(false)
802 .setWidth(0.5f) 865 .setWidth(0.5f)
803 .configText(new ConfigText() { 866 .configText(new ConfigText() {
804 @Override 867 @Override
805 public void onConfig(TextParams params) { 868 public void onConfig(TextParams params) {
806 params.gravity = Gravity.CENTER; 869 params.gravity = Gravity.CENTER;
807 params.padding = new int[]{50, 50, 50, 50}; 870 params.padding = new int[]{50, 50, 50, 50};
808 } 871 }
809 }) 872 })
810 .setText("当前无网络,请检查网络设置") 873 .setText("当前无网络,请检查网络设置")
811 .setNegative("继续使用", null) 874 .setNegative("继续使用", null)
812 .setPositive("设置网络", new View.OnClickListener() { 875 .setPositive("设置网络", new View.OnClickListener() {
813 @Override 876 @Override
814 public void onClick(View v) { 877 public void onClick(View v) {
815 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 878 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
816 mContext.startActivity(intent); 879 mContext.startActivity(intent);
817 } 880 }
818 }) 881 })
819 .show(); 882 .show();
820 } 883 }
821 }); 884 });
822 } 885 }
886
823 //修改个人信息 887 //修改个人信息
824 public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException { 888 public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException {
825 Gson gson = new Gson(); 889 Gson gson = new Gson();
826 String jsonObject = gson.toJson(object); 890 String jsonObject = gson.toJson(object);
827 Log.e("test", "onSuccess" + jsonObject); 891 Log.e("test", "onSuccess" + jsonObject);
828 mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", 892 mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...",
829 false, true, null); 893 false, true, null);
830 ByteArrayEntity entity = null; 894 ByteArrayEntity entity = null;
831 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); 895 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8"));
832 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); 896 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
833 897
834 HttpClient.getInstance().addHeader("Accept", "*/*"); 898 HttpClient.getInstance().addHeader("Accept", "*/*");
835 HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() { 899 HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() {
836 @Override 900 @Override
837 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 901 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
838 super.onSuccess(statusCode, headers, response); 902 super.onSuccess(statusCode, headers, response);
839 closeProgress(); 903 closeProgress();
840 String status = response.optString("status"); 904 String status = response.optString("status");
841 if (status.equals("1")) { 905 if (status.equals("1")) {
842 Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); 906 Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show();
843 ((Activity) mContext).finish(); 907 ((Activity) mContext).finish();
844 } 908 } else {
909 AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试");
910 }
845 Log.e("test", "onSuccess" + response); 911 Log.e("test", "onSuccess" + response);
846 912
847 } 913 }
848 914
849 @Override 915 @Override
850 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 916 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
851 super.onFailure(statusCode, headers, throwable, errorResponse); 917 super.onFailure(statusCode, headers, throwable, errorResponse);
852 closeProgress(); 918 closeProgress();
853 Log.e("test", "onFailure" + errorResponse); 919 Log.e("test", "onFailure" + errorResponse);
854 new CircleDialog.Builder((FragmentActivity) mContext) 920 new CircleDialog.Builder((FragmentActivity) mContext)
855 .setCanceledOnTouchOutside(false) 921 .setCanceledOnTouchOutside(false)
856 .setCancelable(false) 922 .setCancelable(false)
857 .setWidth(0.5f) 923 .setWidth(0.5f)
858 .configText(new ConfigText() { 924 .configText(new ConfigText() {
859 @Override 925 @Override
860 public void onConfig(TextParams params) { 926 public void onConfig(TextParams params) {
861 params.gravity = Gravity.CENTER; 927 params.gravity = Gravity.CENTER;
862 params.padding = new int[]{50, 50, 50, 50}; 928 params.padding = new int[]{50, 50, 50, 50};
863 } 929 }
864 }) 930 })
865 .setText("当前无网络,请检查网络设置") 931 .setText("当前无网络,请检查网络设置")
866 .setNegative("继续使用", null) 932 .setNegative("继续使用", null)
867 .setPositive("设置网络", new View.OnClickListener() { 933 .setPositive("设置网络", new View.OnClickListener() {
868 @Override 934 @Override
869 public void onClick(View v) { 935 public void onClick(View v) {
870 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 936 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
871 mContext.startActivity(intent); 937 mContext.startActivity(intent);
872 } 938 }
873 }) 939 })
874 .show(); 940 .show();
875 } 941 }
876 942
877 }); 943 });
878 } 944 }
945
879 //修改个性签名 946 //修改个性签名
880 public void changsignature(final Context mContext, long userId, final String signature) { 947 public void changsignature(final Context mContext, long userId, final String signature) {
881 RequestParams params = new RequestParams(); 948 RequestParams params = new RequestParams();
882 params.put("userId", userId); 949 params.put("userId", userId);
883 params.put("signature", signature); 950 params.put("signature", signature);
884 HttpClient.getInstance().addHeader("Accept", "*/*"); 951 HttpClient.getInstance().addHeader("Accept", "*/*");
885 HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { 952 HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() {
886 @Override 953 @Override
887 public void onSuccess(int i, Header[] headers, byte[] bytes) { 954 public void onSuccess(int i, Header[] headers, byte[] bytes) {
888 try { 955 try {
889 JSONObject jsonObject = new JSONObject(new String(bytes)); 956 JSONObject jsonObject = new JSONObject(new String(bytes));
890 String status = jsonObject.optString("status"); 957 String status = jsonObject.optString("status");
891 if (status.equals("1")) { 958 if (status.equals("1")) {
892 Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); 959 Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show();
960 } else {
961 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试");
893 } 962 }
894 } catch (JSONException e) { 963 } catch (JSONException e) {
895 e.printStackTrace(); 964 e.printStackTrace();
896 } 965 }
897 } 966 }
898 967
899 @Override 968 @Override
900 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 969 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
901 Log.e("test", "onFailure" + new String(bytes)); 970 Log.e("test", "onFailure" + new String(bytes));
902 new CircleDialog.Builder((FragmentActivity) mContext) 971 new CircleDialog.Builder((FragmentActivity) mContext)
903 .setCanceledOnTouchOutside(false) 972 .setCanceledOnTouchOutside(false)
904 .setCancelable(false) 973 .setCancelable(false)
905 .setWidth(0.5f) 974 .setWidth(0.5f)
906 .configText(new ConfigText() { 975 .configText(new ConfigText() {
907 @Override 976 @Override
908 public void onConfig(TextParams params) { 977 public void onConfig(TextParams params) {
909 params.gravity = Gravity.CENTER; 978 params.gravity = Gravity.CENTER;
910 params.padding = new int[]{50, 50, 50, 50}; 979 params.padding = new int[]{50, 50, 50, 50};
911 } 980 }
912 }) 981 })
913 .setText("当前无网络,请检查网络设置") 982 .setText("当前无网络,请检查网络设置")
914 .setNegative("继续使用", null) 983 .setNegative("继续使用", null)
915 .setPositive("设置网络", new View.OnClickListener() { 984 .setPositive("设置网络", new View.OnClickListener() {
916 @Override 985 @Override
917 public void onClick(View v) { 986 public void onClick(View v) {
918 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 987 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
919 mContext.startActivity(intent); 988 mContext.startActivity(intent);
920 } 989 }
921 }) 990 })
922 .show(); 991 .show();
923 } 992 }
924 }); 993 });
925 } 994 }
926 995
927 /** 996 /**
928 * 获取个性签名 997 * 获取个性签名
998 *
929 * @param mContext 999 * @param mContext
930 * @param userId 1000 * @param userId
931 * @param handler 1001 * @param handler
932 */ 1002 */
933 public void getsignatures(final Context mContext,long userId , final Handler handler) { 1003 public void getsignatures(final Context mContext, long userId, final Handler handler) {
934 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1004 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
935 HttpClient.getInstance().get(HttpUrl.getsignature+"?userId="+userId, new AsyncHttpResponseHandler() { 1005 HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId, new AsyncHttpResponseHandler() {
936 @Override 1006 @Override
937 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1007 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
938 Log.e("test", "个性签名" + new String(arg2)); 1008 Log.e("test", "个性签名" + new String(arg2));
939 SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 1009 try {
940 SignInfo.DataBean signInfoBeanList = signInfo.getData(); 1010 JSONObject jsonObject = new JSONObject(new String(arg2));
941 Message message = Message.obtain(); 1011 int status = jsonObject.optInt("status");
942 message.what = HttpCode.SIGN; 1012 if (status == 1) {
943 message.obj = signInfoBeanList; 1013 SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据
944 handler.sendMessage(message); 1014 SignInfo.DataBean signInfoBeanList = signInfo.getData();
1015 Message message = Message.obtain();
1016 message.what = HttpCode.SIGN;
1017 message.obj = signInfoBeanList;
1018 handler.sendMessage(message);
1019
1020
1021 } else {
1022 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
1023
1024 }
1025 } catch (JSONException e) {
1026 e.printStackTrace();
1027 }
1028
945 1029
946 } 1030 }
947 1031
948 @Override 1032 @Override
949 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1033 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
950 Log.e("test", "失败原因" + arg3); 1034 Log.e("test", "失败原因" + arg3);
951 new CircleDialog.Builder((FragmentActivity) mContext) 1035 new CircleDialog.Builder((FragmentActivity) mContext)
952 .setCanceledOnTouchOutside(false) 1036 .setCanceledOnTouchOutside(false)
953 .setCancelable(false) 1037 .setCancelable(false)
954 .setWidth(0.5f) 1038 .setWidth(0.5f)
955 .configText(new ConfigText() { 1039 .configText(new ConfigText() {
956 @Override 1040 @Override
957 public void onConfig(TextParams params) { 1041 public void onConfig(TextParams params) {
958 params.gravity = Gravity.CENTER; 1042 params.gravity = Gravity.CENTER;
959 params.padding = new int[]{50, 50, 50, 50}; 1043 params.padding = new int[]{50, 50, 50, 50};
960 } 1044 }
961 }) 1045 })
962 .setText("当前无网络,请检查网络设置") 1046 .setText("当前无网络,请检查网络设置")
963 .setNegative("继续使用", null) 1047 .setNegative("继续使用", null)
964 .setPositive("设置网络", new View.OnClickListener() { 1048 .setPositive("设置网络", new View.OnClickListener() {
965 @Override 1049 @Override
966 public void onClick(View v) { 1050 public void onClick(View v) {
967 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1051 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
968 mContext.startActivity(intent); 1052 mContext.startActivity(intent);
969 } 1053 }
970 }) 1054 })
971 .show(); 1055 .show();
972 } 1056 }
973 }); 1057 });
974 } 1058 }
975 1059
976 /** 1060 /**
977 * 用户反馈 1061 * 用户反馈
1062 *
978 * @param mContext 1063 * @param mContext
979 * @param object 1064 * @param object
980 * @throws UnsupportedEncodingException 1065 * @throws UnsupportedEncodingException
981 */ 1066 */
982 public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException { 1067 public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException {
983 Gson gson = new Gson(); 1068 Gson gson = new Gson();
984 String jsonObject = gson.toJson(object); 1069 String jsonObject = gson.toJson(object);
985 Log.e("test", "onSuccess" + jsonObject); 1070 Log.e("test", "onSuccess" + jsonObject);
986 mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", 1071 mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...",
987 false, true, null); 1072 false, true, null);
988 ByteArrayEntity entity = null; 1073 ByteArrayEntity entity = null;
989 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); 1074 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8"));
990 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); 1075 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
991 1076
992 HttpClient.getInstance().addHeader("Accept", "*/*"); 1077 HttpClient.getInstance().addHeader("Accept", "*/*");
993 HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() { 1078 HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() {
994 @Override 1079 @Override
995 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 1080 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
996 super.onSuccess(statusCode, headers, response); 1081 super.onSuccess(statusCode, headers, response);
997 closeProgress(); 1082 closeProgress();
998 String status = response.optString("status"); 1083 String status = response.optString("status");
999 if (status.equals("1")) { 1084 if (status.equals("1")) {
1000 Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show(); 1085 Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show();
1001 ((Activity) mContext).finish(); 1086 ((Activity) mContext).finish();
1087 } else {
1088 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试");
1002 } 1089 }
1003 Log.e("test", "onSuccess" + response); 1090 Log.e("test", "onSuccess" + response);
1004 1091
1005 } 1092 }
1006 1093
1007 @Override 1094 @Override
1008 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 1095 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
1009 super.onFailure(statusCode, headers, throwable, errorResponse); 1096 super.onFailure(statusCode, headers, throwable, errorResponse);
1010 closeProgress(); 1097 closeProgress();
1011 Log.e("test", "onFailure" + errorResponse); 1098 Log.e("test", "onFailure" + errorResponse);
1012 new CircleDialog.Builder((FragmentActivity) mContext) 1099 new CircleDialog.Builder((FragmentActivity) mContext)
1013 .setCanceledOnTouchOutside(false) 1100 .setCanceledOnTouchOutside(false)
1014 .setCancelable(false) 1101 .setCancelable(false)
1015 .setWidth(0.5f) 1102 .setWidth(0.5f)
1016 .configText(new ConfigText() { 1103 .configText(new ConfigText() {
1017 @Override 1104 @Override
1018 public void onConfig(TextParams params) { 1105 public void onConfig(TextParams params) {
1019 params.gravity = Gravity.CENTER; 1106 params.gravity = Gravity.CENTER;
1020 params.padding = new int[]{50, 50, 50, 50}; 1107 params.padding = new int[]{50, 50, 50, 50};
1021 } 1108 }
1022 }) 1109 })
1023 .setText("当前无网络,请检查网络设置") 1110 .setText("当前无网络,请检查网络设置")
1024 .setNegative("继续使用", null) 1111 .setNegative("继续使用", null)
1025 .setPositive("设置网络", new View.OnClickListener() { 1112 .setPositive("设置网络", new View.OnClickListener() {
1026 @Override 1113 @Override
1027 public void onClick(View v) { 1114 public void onClick(View v) {
1028 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1115 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1029 mContext.startActivity(intent); 1116 mContext.startActivity(intent);
1030 } 1117 }
1031 }) 1118 })
1032 .show(); 1119 .show();
1033 } 1120 }
1034 1121
1035 }); 1122 });
1036 } 1123 }
1037 1124
1038 /** 1125 /**
1039 * 查询子账户信息 1126 * 查询子账户信息
1127 *
1040 * @param mContext 1128 * @param mContext
1041 * @param userId 1129 * @param userId
1042 * @param handler 1130 * @param handler
1043 */ 1131 */
1044 public void getchildAccountinfo(final Context mContext, long userId , final Handler handler) { 1132 public void getchildAccountinfo(final Context mContext, long userId, final Handler handler) {
1045 mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", 1133 mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...",
1046 false, true, null); 1134 false, true, null);
1047 HttpClient.getInstance().setTimeout(5 * 1000); 1135 HttpClient.getInstance().setTimeout(5 * 1000);
1048 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1136 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1049 HttpClient.getInstance().get(HttpUrl.childUserURL+ "?userId=" + userId , new AsyncHttpResponseHandler() { 1137 HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId, new AsyncHttpResponseHandler() {
1050 @Override 1138 @Override
1051 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1139 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1052 closeProgress(); 1140 closeProgress();
1053 Log.e("test", "子账户信息" + new String(arg2)); 1141 Log.e("test", "子账户信息" + new String(arg2));
1054 try { 1142 try {
1055 JSONObject jsonObject = new JSONObject(new String(arg2)); 1143 JSONObject jsonObject = new JSONObject(new String(arg2));
1056 int status = jsonObject.optInt("status"); 1144 int status = jsonObject.optInt("status");
1057 if (status ==1000){ 1145 if (status == 0) {
1058 AlertUtils.showToast(mContext,"你好,你还未添加子账号,子账号为空!"); 1146 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!");
1059 }else { 1147 } else if (status == 1000) {
1148 AlertUtils.showToast(mContext, "你好,你还未添加子账号,子账号为空!");
1149 } else {
1060 ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 1150 ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据
1061 List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); 1151 List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData();
1062 Message msg = Message.obtain(); 1152 Message msg = Message.obtain();
1063 msg.what = HttpCode.CHILDS_SUCESS; 1153 msg.what = HttpCode.CHILDS_SUCESS;
1064 msg.obj = schoolInfoBeanList; 1154 msg.obj = schoolInfoBeanList;
1065 handler.sendMessage(msg); 1155 handler.sendMessage(msg);
1066 1156
1067 } 1157 }
1068 } catch (JSONException e) { 1158 } catch (JSONException e) {
1069 e.printStackTrace(); 1159 e.printStackTrace();
1070 } 1160 }
1071 1161
1072 } 1162 }
1073 1163
1074 @Override 1164 @Override
1075 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1165 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1076 closeProgress(); 1166 closeProgress();
1077 Log.e("test", "错误信息" + new String(arg2)); 1167 Log.e("test", "错误信息" + new String(arg2));
1078 new CircleDialog.Builder((FragmentActivity) mContext) 1168 new CircleDialog.Builder((FragmentActivity) mContext)
1079 .setCanceledOnTouchOutside(false) 1169 .setCanceledOnTouchOutside(false)
1080 .setCancelable(false) 1170 .setCancelable(false)
1081 .setWidth(0.5f) 1171 .setWidth(0.5f)
1082 .configText(new ConfigText() { 1172 .configText(new ConfigText() {
1083 @Override 1173 @Override
1084 public void onConfig(TextParams params) { 1174 public void onConfig(TextParams params) {
1085 params.gravity = Gravity.CENTER; 1175 params.gravity = Gravity.CENTER;
1086 params.padding = new int[]{50, 50, 50, 50}; 1176 params.padding = new int[]{50, 50, 50, 50};
1087 } 1177 }
1088 }) 1178 })
1089 .setText("当前无网络,请检查网络设置") 1179 .setText("当前无网络,请检查网络设置")
1090 .setNegative("继续使用", null) 1180 .setNegative("继续使用", null)
1091 .setPositive("设置网络", new View.OnClickListener() { 1181 .setPositive("设置网络", new View.OnClickListener() {
1092 @Override 1182 @Override
1093 public void onClick(View v) { 1183 public void onClick(View v) {
1094 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1184 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1095 mContext.startActivity(intent); 1185 mContext.startActivity(intent);
1096 } 1186 }
1097 }) 1187 })
1098 .show(); 1188 .show();
1099 } 1189 }
1100 }); 1190 });
1101 1191
1102 } 1192 }
1193
1103 /** 1194 /**
1104 * 删除子账户信息 1195 * 删除子账户信息
1196 *
1105 * @param mContext 1197 * @param mContext
1106 * @param subAccountId 1198 * @param subAccountId
1107 *
1108 */ 1199 */
1109 public void deletechildAccountinfo(final Context mContext, long subAccountId ) { 1200 public void deletechildAccountinfo(final Context mContext, long subAccountId) {
1110 mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", 1201 mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...",
1111 false, true, null); 1202 false, true, null);
1112 HttpClient.getInstance().setTimeout(5 * 1000); 1203 HttpClient.getInstance().setTimeout(5 * 1000);
1113 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1204 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1114 HttpClient.getInstance().get(HttpUrl.deletechildUserURL+ "?subAccountId=" + subAccountId , new AsyncHttpResponseHandler() { 1205 HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() {
1115 @Override 1206 @Override
1116 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1207 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1117 closeProgress(); 1208 closeProgress();
1118 Log.e("test", "子账户信息" + new String(arg2)); 1209 Log.e("test", "子账户信息" + new String(arg2));
1119 try { 1210 try {
1120 JSONObject jsonObject = new JSONObject(new String(arg2)); 1211 JSONObject jsonObject = new JSONObject(new String(arg2));
1121 int status = jsonObject.optInt("status"); 1212 int status = jsonObject.optInt("status");
1122 if (status ==1){ 1213 if (status == 1) {
1123 AlertUtils.showToast(mContext,"子账号删除成功!"); 1214 AlertUtils.showToast(mContext, "子账号删除成功!");
1124 }else { 1215 } else {
1125 AlertUtils.showToast(mContext,"你好,子账号删除失败!"); 1216 AlertUtils.showToast(mContext, "你好,子账号删除失败!");
1126 1217
1127 } 1218 }
1128 } catch (JSONException e) { 1219 } catch (JSONException e) {
1129 e.printStackTrace(); 1220 e.printStackTrace();
1130 } 1221 }
1131 1222
1132 } 1223 }
1133 1224
1134 @Override 1225 @Override
1135 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1226 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1136 closeProgress(); 1227 closeProgress();
1137 Log.e("test", "错误信息" + new String(arg2)); 1228 Log.e("test", "错误信息" + new String(arg2));
1138 new CircleDialog.Builder((FragmentActivity) mContext) 1229 new CircleDialog.Builder((FragmentActivity) mContext)
1139 .setCanceledOnTouchOutside(false) 1230 .setCanceledOnTouchOutside(false)
1140 .setCancelable(false) 1231 .setCancelable(false)
1141 .setWidth(0.5f) 1232 .setWidth(0.5f)
1142 .configText(new ConfigText() { 1233 .configText(new ConfigText() {
1143 @Override 1234 @Override
1144 public void onConfig(TextParams params) { 1235 public void onConfig(TextParams params) {
1145 params.gravity = Gravity.CENTER; 1236 params.gravity = Gravity.CENTER;
1146 params.padding = new int[]{50, 50, 50, 50}; 1237 params.padding = new int[]{50, 50, 50, 50};
1147 } 1238 }
1148 }) 1239 })
1149 .setText("当前无网络,请检查网络设置") 1240 .setText("当前无网络,请检查网络设置")
1150 .setNegative("继续使用", null) 1241 .setNegative("继续使用", null)
1151 .setPositive("设置网络", new View.OnClickListener() { 1242 .setPositive("设置网络", new View.OnClickListener() {
1152 @Override 1243 @Override
1153 public void onClick(View v) { 1244 public void onClick(View v) {
1154 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1245 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1155 mContext.startActivity(intent); 1246 mContext.startActivity(intent);
1156 } 1247 }
1157 }) 1248 })
1158 .show(); 1249 .show();
1159 } 1250 }
1160 }); 1251 });
1161 1252
1162 } 1253 }
1254
1163 /** 1255 /**
1164 * 添加子账户信息 1256 * 添加子账户信息
1165 *
1166 */ 1257 */
1167 public void addchildAccountinfo(final Context mContext, long parentId,String image, 1258 public void addchildAccountinfo(final Context mContext, long parentId, String image,
1168 String name,String grade,String school,String region) { 1259 String name, String grade, String school, String region) {
1169 mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", 1260 mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...",
1170 false, true, null); 1261 false, true, null);
1171 RequestParams params = new RequestParams(); 1262 RequestParams params = new RequestParams();
1172 1263
1173 params.put(HttpKey.PARENTID, parentId); 1264 params.put(HttpKey.PARENTID, parentId);
1174 params.put(HttpKey.IMAGE, image); 1265 params.put(HttpKey.IMAGE, image);
1175 params.put(HttpKey.NAME, name); 1266 params.put(HttpKey.NAME, name);
1176 params.put(HttpKey.GRADE, grade); 1267 params.put(HttpKey.GRADE, grade);
1177 params.put(HttpKey.SCHOOL, school); 1268 params.put(HttpKey.SCHOOL, school);
1178 params.put(HttpKey.REGION, region); 1269 params.put(HttpKey.REGION, region);
1179 1270
1180 1271
1181 HttpClient.getInstance().addHeader("Accept", "*/*"); 1272 HttpClient.getInstance().addHeader("Accept", "*/*");
1182 HttpClient.getInstance().setTimeout(5 * 1000); 1273 HttpClient.getInstance().setTimeout(5 * 1000);
1183 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1274 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1184 HttpClient.getInstance().post(HttpUrl.addchildUserURL ,params, new AsyncHttpResponseHandler() { 1275 HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() {
1185 @Override 1276 @Override
1186 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1277 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1187 closeProgress(); 1278 closeProgress();
1188 1279
1189 Log.e("test", "子账户信息" + new String(arg2)); 1280 Log.e("test", "子账户信息" + new String(arg2));
1190 try { 1281 try {
1191 JSONObject jsonObject = new JSONObject(new String(arg2)); 1282 JSONObject jsonObject = new JSONObject(new String(arg2));
1192 int status = jsonObject.optInt("status"); 1283 int status = jsonObject.optInt("status");
1193 if (status ==1){ 1284 if (status == 1) {
1194 AlertUtils.showToast(mContext,"子账号添加成功!"); 1285 AlertUtils.showToast(mContext, "子账号添加成功!");
1195 ((Activity) mContext).finish(); 1286 ((Activity) mContext).finish();
1196 }else { 1287 } else {
1197 AlertUtils.showToast(mContext,"你好,子账号添加失败!"); 1288 AlertUtils.showToast(mContext, "你好,子账号添加失败!");
1198 1289
1199 } 1290 }
1200 } catch (JSONException e) { 1291 } catch (JSONException e) {
1201 e.printStackTrace(); 1292 e.printStackTrace();
1202 } 1293 }
1203 1294
1204 } 1295 }
1205 1296
1206 @Override 1297 @Override
1207 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1298 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1208 closeProgress(); 1299 closeProgress();
1209 Log.e("test", "错误信息" + new String(arg2)); 1300 Log.e("test", "错误信息" + new String(arg2));
1210 new CircleDialog.Builder((FragmentActivity) mContext) 1301 new CircleDialog.Builder((FragmentActivity) mContext)
1211 .setCanceledOnTouchOutside(false) 1302 .setCanceledOnTouchOutside(false)
1212 .setCancelable(false) 1303 .setCancelable(false)
1213 .setWidth(0.5f) 1304 .setWidth(0.5f)
1214 .configText(new ConfigText() { 1305 .configText(new ConfigText() {
1215 @Override 1306 @Override
1216 public void onConfig(TextParams params) { 1307 public void onConfig(TextParams params) {
1217 params.gravity = Gravity.CENTER; 1308 params.gravity = Gravity.CENTER;
1218 params.padding = new int[]{50, 50, 50, 50}; 1309 params.padding = new int[]{50, 50, 50, 50};
1219 } 1310 }
1220 }) 1311 })
1221 .setText("当前无网络,请检查网络设置") 1312 .setText("当前无网络,请检查网络设置")
1222 .setNegative("继续使用", null) 1313 .setNegative("继续使用", null)
1223 .setPositive("设置网络", new View.OnClickListener() { 1314 .setPositive("设置网络", new View.OnClickListener() {
1224 @Override 1315 @Override
1225 public void onClick(View v) { 1316 public void onClick(View v) {
1226 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1317 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1227 mContext.startActivity(intent); 1318 mContext.startActivity(intent);
1228 } 1319 }
1229 }) 1320 })
1230 .show(); 1321 .show();
1231 } 1322 }
1232 }); 1323 });
1233 1324
1234 } 1325 }
1235 1326
1236 /** 1327 /**
1237 * 切换子账户信息 1328 * 切换子账户信息
1329 *
1238 * @param mContext 1330 * @param mContext
1239 * @param subAccountId 1331 * @param subAccountId
1240 *
1241 */ 1332 */
1242 public void changechildAccountinfo(final Context mContext, long subAccountId ,long userId) { 1333 public void changechildAccountinfo(final Context mContext, long subAccountId, long userId) {
1243 mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", 1334 mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...",
1244 false, true, null); 1335 false, true, null);
1245 HttpClient.getInstance().setTimeout(5 * 1000); 1336 HttpClient.getInstance().setTimeout(5 * 1000);
1246 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1337 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1247 HttpClient.getInstance().get(HttpUrl.changechildUserURL+ "?subAccountId=" + subAccountId+"&userId="+ userId, new AsyncHttpResponseHandler() { 1338 HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId, new AsyncHttpResponseHandler() {
1248 @Override 1339 @Override
1249 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1340 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1250 closeProgress(); 1341 closeProgress();
1251 Log.e("test", "子账户信息" + new String(arg2)); 1342 Log.e("test", "子账户信息" + new String(arg2));
1252 try { 1343 try {
1253 JSONObject jsonObject = new JSONObject(new String(arg2)); 1344 JSONObject jsonObject = new JSONObject(new String(arg2));
1254 int status = jsonObject.optInt("status"); 1345 int status = jsonObject.optInt("status");
1255 if (status ==1){ 1346 if (status == 1) {
1256 AlertUtils.showToast(mContext,"子账号切换成功!"); 1347 AlertUtils.showToast(mContext, "子账号切换成功!");
1257 1348
1258 }else { 1349 } else {
1259 AlertUtils.showToast(mContext,"你好,子账号切换失败!"); 1350 AlertUtils.showToast(mContext, "你好,子账号切换失败!");
1260 1351
1261 } 1352 }
1262 } catch (JSONException e) { 1353 } catch (JSONException e) {
1263 e.printStackTrace(); 1354 e.printStackTrace();
1264 } 1355 }
1265 1356
1266 } 1357 }
1267 1358
1268 @Override 1359 @Override
1269 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1360 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1270 closeProgress(); 1361 closeProgress();
1271 Log.e("test", "错误信息" + new String(arg2)); 1362 Log.e("test", "错误信息" + new String(arg2));
1272 new CircleDialog.Builder((FragmentActivity) mContext) 1363 new CircleDialog.Builder((FragmentActivity) mContext)
1273 .setCanceledOnTouchOutside(false) 1364 .setCanceledOnTouchOutside(false)
1274 .setCancelable(false) 1365 .setCancelable(false)
1275 .setWidth(0.5f) 1366 .setWidth(0.5f)
1276 .configText(new ConfigText() { 1367 .configText(new ConfigText() {
1277 @Override 1368 @Override
1278 public void onConfig(TextParams params) { 1369 public void onConfig(TextParams params) {
1279 params.gravity = Gravity.CENTER; 1370 params.gravity = Gravity.CENTER;
1280 params.padding = new int[]{50, 50, 50, 50}; 1371 params.padding = new int[]{50, 50, 50, 50};
1281 } 1372 }
1282 }) 1373 })
1283 .setText("当前无网络,请检查网络设置") 1374 .setText("当前无网络,请检查网络设置")
1284 .setNegative("继续使用", null) 1375 .setNegative("继续使用", null)
1285 .setPositive("设置网络", new View.OnClickListener() { 1376 .setPositive("设置网络", new View.OnClickListener() {
1286 @Override 1377 @Override
1287 public void onClick(View v) { 1378 public void onClick(View v) {
1288 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1379 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1289 mContext.startActivity(intent); 1380 mContext.startActivity(intent);
1290 } 1381 }
1291 }) 1382 })
1292 .show(); 1383 .show();
1293 } 1384 }
1294 }); 1385 });
1295 1386
1296 } 1387 }
1388
1297 /** 1389 /**
1298 * 系统升级 1390 * 系统升级
1299 * @param mContext
1300 * @param pid
1301 * appName
1302 * 1391 *
1392 * @param mContext
1393 * @param pid appName
1303 */ 1394 */
1304 public void updateAPP(final Context mContext, String pid , String appName, final Handler handler) { 1395 public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) {
1305 mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", 1396 mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...",
1306 false, true, null); 1397 false, true, null);
1307 HttpClient.getInstance().setTimeout(5 * 1000); 1398 HttpClient.getInstance().setTimeout(5 * 1000);
1308 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1399 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1309 HttpClient.getInstance().get(HttpUrl.updateappURL+ "?pid=" + pid+"&appName="+ appName, new AsyncHttpResponseHandler() { 1400 HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() {
1310 @Override 1401 @Override
1311 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1402 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1312 closeProgress(); 1403 closeProgress();
1313 Log.e("test", "版本升级信息" + new String(arg2)); 1404 Log.e("test", "版本升级信息" + new String(arg2));
1314 AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 1405 AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据
1315 Message msg = Message.obtain(); 1406 Message msg = Message.obtain();
1316 msg.what = HttpCode.APPUPDATE_SUCESS; 1407 msg.what = HttpCode.APPUPDATE_SUCESS;
1317 msg.obj = appVersion; 1408 msg.obj = appVersion;
1318 handler.sendMessage(msg); 1409 handler.sendMessage(msg);
1319 1410
1320 1411
1321 } 1412 }
1322 1413
1323 @Override 1414 @Override
1324 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1415 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1325 closeProgress(); 1416 closeProgress();
1326 Log.e("test", "错误信息" + new String(arg2)); 1417 Log.e("test", "错误信息" + new String(arg2));
1327 new CircleDialog.Builder((FragmentActivity) mContext) 1418 new CircleDialog.Builder((FragmentActivity) mContext)
1328 .setCanceledOnTouchOutside(false) 1419 .setCanceledOnTouchOutside(false)
1329 .setCancelable(false) 1420 .setCancelable(false)
1330 .setWidth(0.5f) 1421 .setWidth(0.5f)
1331 .configText(new ConfigText() { 1422 .configText(new ConfigText() {
1332 @Override 1423 @Override
1333 public void onConfig(TextParams params) { 1424 public void onConfig(TextParams params) {
1334 params.gravity = Gravity.CENTER; 1425 params.gravity = Gravity.CENTER;
1335 params.padding = new int[]{50, 50, 50, 50}; 1426 params.padding = new int[]{50, 50, 50, 50};
1336 } 1427 }
1337 }) 1428 })
1338 .setText("当前无网络,请检查网络设置") 1429 .setText("当前无网络,请检查网络设置")
1339 .setNegative("继续使用", null) 1430 .setNegative("继续使用", null)
1340 .setPositive("设置网络", new View.OnClickListener() { 1431 .setPositive("设置网络", new View.OnClickListener() {
1341 @Override 1432 @Override
1342 public void onClick(View v) { 1433 public void onClick(View v) {
1343 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1434 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1344 mContext.startActivity(intent); 1435 mContext.startActivity(intent);
1345 } 1436 }
1346 }) 1437 })
1347 .show(); 1438 .show();
1348 } 1439 }
1349 }); 1440 });
1350 1441
1351 } 1442 }
1352 1443
1353 1444
1354
1355
1356
1357 ///省级接口 1445 ///省级接口
1358 public void provices(final Context mContext, final Handler handler) { 1446 public void provices(final Context mContext, final Handler handler) {
1359 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1447 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1360 HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { 1448 HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() {
1361 @Override 1449 @Override
1362 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1450 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1363 Log.e("test", "省" + new String(arg2)); 1451 Log.e("test", "省" + new String(arg2));
1364 ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 1452 try {
1365 Log.e("test", "状态码" + provinceInfo.getStatus()); 1453 JSONObject jsonObject = new JSONObject(new String(arg2));
1366 List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); 1454 int status = jsonObject.optInt("status");
1367 Message message = Message.obtain(); 1455 if (status == 100) {
1368 message.what = HttpCode.PROVICES; 1456 ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据
1369 message.obj = provincesBeanList; 1457 Log.e("test", "状态码" + provinceInfo.getStatus());
1370 handler.sendMessage(message); 1458 List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces();
1459 Message message = Message.obtain();
1460 message.what = HttpCode.PROVICES;
1461 message.obj = provincesBeanList;
1462 handler.sendMessage(message);
1463
1464
1465 } else {
1466 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
1467
1468 }
1469 } catch (JSONException e) {
1470 e.printStackTrace();
1471 }
1472
1371 1473
1372 } 1474 }
1373 1475
1374 @Override 1476 @Override
1375 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1477 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1376 new CircleDialog.Builder((FragmentActivity) mContext) 1478 new CircleDialog.Builder((FragmentActivity) mContext)
1377 .setCanceledOnTouchOutside(false) 1479 .setCanceledOnTouchOutside(false)
1378 .setCancelable(false) 1480 .setCancelable(false)
1379 .setWidth(0.5f) 1481 .setWidth(0.5f)
1380 .configText(new ConfigText() { 1482 .configText(new ConfigText() {
1381 @Override 1483 @Override
1382 public void onConfig(TextParams params) { 1484 public void onConfig(TextParams params) {
1383 params.gravity = Gravity.CENTER; 1485 params.gravity = Gravity.CENTER;
1384 params.padding = new int[]{50, 50, 50, 50}; 1486 params.padding = new int[]{50, 50, 50, 50};
1385 } 1487 }
1386 }) 1488 })
1387 .setText("当前无网络,请检查网络设置") 1489 .setText("当前无网络,请检查网络设置")
1388 .setNegative("继续使用", null) 1490 .setNegative("继续使用", null)
1389 .setPositive("设置网络", new View.OnClickListener() { 1491 .setPositive("设置网络", new View.OnClickListener() {
1390 @Override 1492 @Override
1391 public void onClick(View v) { 1493 public void onClick(View v) {
1392 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1494 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1393 mContext.startActivity(intent); 1495 mContext.startActivity(intent);
1394 } 1496 }
1395 }) 1497 })
1396 .show(); 1498 .show();
1397 } 1499 }
1398 }); 1500 });
1399 } 1501 }
1400 1502
1401 //市级接口 1503 //市级接口
1402 public void cityinfo(final Context mContext, long regionId , final Handler handler) { 1504 public void cityinfo(final Context mContext, long regionId, final Handler handler) {
1403 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1505 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1404 HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { 1506 HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() {
1405 @Override 1507 @Override
1406 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1508 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1407 Log.e("test", "市" + new String(arg2)); 1509 Log.e("test", "市" + new String(arg2));
1408 Gson gson = new Gson(); 1510 try {
1409 CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); 1511 JSONObject jsonObject = new JSONObject(new String(arg2));
1410 List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); 1512 int status = jsonObject.optInt("status");
1411 Message message = Message.obtain(); 1513 if (status == 100) {
1412 message.what = HttpCode.CITYS; 1514 Gson gson = new Gson();
1413 message.obj = cityInfoBeanList; 1515 CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class);
1414 handler.sendMessage(message); 1516 List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities();
1517 Message message = Message.obtain();
1518 message.what = HttpCode.CITYS;
1519 message.obj = cityInfoBeanList;
1520 handler.sendMessage(message);
1521
1522 } else {
1523 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
1524
1525 }
1526 } catch (JSONException e) {
1527 e.printStackTrace();
1528 }
1415 1529
1416 1530
1417 } 1531 }
1418 1532
1419 @Override 1533 @Override
1420 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1534 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1421 new CircleDialog.Builder((FragmentActivity) mContext) 1535 new CircleDialog.Builder((FragmentActivity) mContext)
1422 .setCanceledOnTouchOutside(false) 1536 .setCanceledOnTouchOutside(false)
1423 .setCancelable(false) 1537 .setCancelable(false)
1424 .setWidth(0.5f) 1538 .setWidth(0.5f)
1425 .configText(new ConfigText() { 1539 .configText(new ConfigText() {
1426 @Override 1540 @Override
1427 public void onConfig(TextParams params) { 1541 public void onConfig(TextParams params) {
1428 params.gravity = Gravity.CENTER; 1542 params.gravity = Gravity.CENTER;
1429 params.padding = new int[]{50, 50, 50, 50}; 1543 params.padding = new int[]{50, 50, 50, 50};
1430 } 1544 }
1431 }) 1545 })
1432 .setText("当前无网络,请检查网络设置") 1546 .setText("当前无网络,请检查网络设置")
1433 .setNegative("继续使用", null) 1547 .setNegative("继续使用", null)
1434 .setPositive("设置网络", new View.OnClickListener() { 1548 .setPositive("设置网络", new View.OnClickListener() {
1435 @Override 1549 @Override
1436 public void onClick(View v) { 1550 public void onClick(View v) {
1437 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1551 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1438 mContext.startActivity(intent); 1552 mContext.startActivity(intent);
1439 } 1553 }
1440 }) 1554 })
1441 .show(); 1555 .show();
1442 } 1556 }
1443 }); 1557 });
1444 } 1558 }
1445 1559
1446 //区县级接口 1560 //区县级接口
1447 public void countyinfo(final Context mContext, int parentId, final Handler handler) { 1561 public void countyinfo(final Context mContext, int parentId, final Handler handler) {
1448 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1562 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1449 HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { 1563 HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() {
1450 @Override 1564 @Override
1451 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1565 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1452 Log.e("test", "区" + new String(arg2)); 1566 Log.e("test", "区" + new String(arg2));
1453 Gson gson = new Gson(); 1567 try {
1454 CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); 1568 JSONObject jsonObject = new JSONObject(new String(arg2));
1455 List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); 1569 int status = jsonObject.optInt("status");
1456 Message message = Message.obtain(); 1570 if (status == 100) {
1457 message.what = HttpCode.COUNTRY; 1571 Gson gson = new Gson();
1458 message.obj = countyInfoInfoBeanList; 1572 CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class);
1459 handler.sendMessage(message); 1573 List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties();
1574 Message message = Message.obtain();
1575 message.what = HttpCode.COUNTRY;
1576 message.obj = countyInfoInfoBeanList;
1577 handler.sendMessage(message);
1578 } else {
1579 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
1580
1581 }
1582 } catch (JSONException e) {
1583 e.printStackTrace();
1584 }
1460 1585
1461 1586
1462 } 1587 }
1463 1588
1464 @Override 1589 @Override
1465 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1590 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1466 new CircleDialog.Builder((FragmentActivity) mContext) 1591 new CircleDialog.Builder((FragmentActivity) mContext)
1467 .setCanceledOnTouchOutside(false) 1592 .setCanceledOnTouchOutside(false)
1468 .setCancelable(false) 1593 .setCancelable(false)
1469 .setWidth(0.5f) 1594 .setWidth(0.5f)
1470 .configText(new ConfigText() { 1595 .configText(new ConfigText() {
1471 @Override 1596 @Override
1472 public void onConfig(TextParams params) { 1597 public void onConfig(TextParams params) {
1473 params.gravity = Gravity.CENTER; 1598 params.gravity = Gravity.CENTER;
1474 params.padding = new int[]{50, 50, 50, 50}; 1599 params.padding = new int[]{50, 50, 50, 50};
1475 } 1600 }
1476 }) 1601 })
1477 .setText("当前无网络,请检查网络设置") 1602 .setText("当前无网络,请检查网络设置")
1478 .setNegative("继续使用", null) 1603 .setNegative("继续使用", null)
1479 .setPositive("设置网络", new View.OnClickListener() { 1604 .setPositive("设置网络", new View.OnClickListener() {
1480 @Override 1605 @Override
1481 public void onClick(View v) { 1606 public void onClick(View v) {
1482 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1607 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1483 mContext.startActivity(intent); 1608 mContext.startActivity(intent);
1484 } 1609 }
1485 }) 1610 })
1486 .show(); 1611 .show();
1487 } 1612 }
PersonalCenter/app/src/main/res/layout/activity_account_management.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/account_management" 28 android:text="@string/account_management"
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="wrap_content" 34 android:layout_width="wrap_content"
35 android:layout_height="wrap_content" 35 android:layout_height="wrap_content"
36 android:layout_margin="20dp" 36 android:layout_margin="20dp"
37 android:gravity="center_vertical" 37 android:gravity="center_vertical"
38 android:orientation="horizontal"> 38 android:orientation="horizontal">
39 39
40 <View 40 <View
41 android:layout_width="5dp" 41 android:layout_width="5dp"
42 android:layout_height="20dp" 42 android:layout_height="20dp"
43 android:background="@color/login_text_blue"> 43 android:background="@color/login_text_blue">
44 44
45 </View> 45 </View>
46 46
47 <TextView 47 <TextView
48 android:layout_width="wrap_content" 48 android:layout_width="wrap_content"
49 android:layout_height="wrap_content" 49 android:layout_height="wrap_content"
50 android:layout_marginLeft="5dp" 50 android:layout_marginLeft="5dp"
51 android:text="账户安全" 51 android:text="账户安全"
52 android:textSize="22sp" /> 52 android:textSize="22sp" />
53 53
54 </LinearLayout> 54 </LinearLayout>
55 55
56 <LinearLayout 56 <LinearLayout
57 android:layout_width="match_parent" 57 android:layout_width="match_parent"
58 android:layout_height="wrap_content" 58 android:layout_height="wrap_content"
59 android:layout_marginLeft="60dp" 59 android:layout_marginLeft="60dp"
60 android:orientation="vertical"> 60 android:orientation="vertical">
61 61
62 <LinearLayout 62 <LinearLayout
63 android:layout_width="match_parent" 63 android:layout_width="match_parent"
64 android:layout_height="wrap_content"> 64 android:layout_height="wrap_content">
65 65
66 66
67 <TextView 67 <TextView
68 android:layout_width="0dp" 68 android:layout_width="0dp"
69 android:layout_height="wrap_content" 69 android:layout_height="wrap_content"
70 android:layout_weight="1.5" 70 android:layout_weight="1.5"
71 android:text="当前绑定手机号" 71 android:text="当前绑定手机号"
72 android:textSize="22sp" /> 72 android:textSize="22sp" />
73 73
74 <TextView 74 <TextView
75 android:id="@+id/cunt_username" 75 android:id="@+id/cunt_username"
76 android:layout_width="0dp" 76 android:layout_width="0dp"
77 android:layout_height="wrap_content" 77 android:layout_height="wrap_content"
78 android:layout_marginLeft="50dp" 78 android:layout_marginLeft="50dp"
79 android:layout_weight="6" 79 android:layout_weight="6"
80 android:text="" 80 android:text=""
81 android:textSize="22sp" /> 81 android:textSize="22sp" />
82 82
83 <TextView 83 <TextView
84 android:id="@+id/changBangding" 84 android:id="@+id/changBangding"
85 android:layout_width="0dp" 85 android:layout_width="0dp"
86 android:layout_height="wrap_content" 86 android:layout_height="wrap_content"
87 android:layout_weight="1" 87 android:layout_weight="1"
88 android:text="更换绑定" 88 android:text="更换绑定"
89 android:textSize="22sp" /> 89 android:textSize="22sp" />
90 90
91 <ImageView 91 <ImageView
92 android:layout_width="wrap_content" 92 android:layout_width="wrap_content"
93 android:layout_height="wrap_content" 93 android:layout_height="wrap_content"
94 android:layout_weight="0.1" 94 android:layout_weight="0.1"
95 android:padding="10dp" 95 android:padding="10dp"
96 android:src="@mipmap/youjiantou" /> 96 android:src="@mipmap/youjiantou" />
97 </LinearLayout> 97 </LinearLayout>
98 98
99 <LinearLayout 99 <LinearLayout
100 android:layout_width="match_parent" 100 android:layout_width="match_parent"
101 android:layout_height="wrap_content" 101 android:layout_height="wrap_content"
102 android:layout_marginTop="30dp"> 102 android:layout_marginTop="30dp">
103 103
104 104
105 <TextView 105 <TextView
106 android:layout_width="0dp" 106 android:layout_width="0dp"
107 android:layout_height="wrap_content" 107 android:layout_height="wrap_content"
108 android:layout_weight="1.5" 108 android:layout_weight="1.5"
109 android:text="登录密码" 109 android:text="登录密码"
110 android:textSize="22sp" /> 110 android:textSize="22sp" />
111 111
112 <TextView 112 <TextView
113 android:layout_width="0dp" 113 android:layout_width="0dp"
114 android:layout_height="wrap_content" 114 android:layout_height="wrap_content"
115 android:layout_marginLeft="50dp" 115 android:layout_marginLeft="50dp"
116 android:layout_weight="6" 116 android:layout_weight="6"
117 android:text="已设置" 117 android:text="已设置"
118 android:textSize="22sp" /> 118 android:textSize="22sp" />
119 119
120 <TextView 120 <TextView
121 android:id="@+id/changpassword" 121 android:id="@+id/changpassword"
122 android:layout_width="0dp" 122 android:layout_width="0dp"
123 android:layout_height="wrap_content" 123 android:layout_height="wrap_content"
124 android:layout_weight="1" 124 android:layout_weight="1"
125 android:text="修改密码" 125 android:text="修改密码"
126 android:textSize="22sp" /> 126 android:textSize="22sp" />
127 127
128 <ImageView 128 <ImageView
129 android:layout_width="wrap_content" 129 android:layout_width="wrap_content"
130 android:layout_height="wrap_content" 130 android:layout_height="wrap_content"
131 android:layout_weight="0.1" 131 android:layout_weight="0.1"
132 android:padding="10dp" 132 android:padding="10dp"
133 android:src="@mipmap/youjiantou" /> 133 android:src="@mipmap/youjiantou" />
134 </LinearLayout> 134 </LinearLayout>
135 135
136 </LinearLayout> 136 </LinearLayout>
137 137
138 <View 138 <View
139 android:layout_width="match_parent" 139 android:layout_width="match_parent"
140 android:layout_height="0.7dp" 140 android:layout_height="0.7dp"
141 android:layout_margin="20dp" 141 android:layout_margin="20dp"
142 android:background="#FF909090" /> 142 android:background="#FF909090" />
143 143
144 <LinearLayout 144 <LinearLayout
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_margin="20dp" 147 android:layout_margin="20dp"
148 android:gravity="center_vertical" 148 android:gravity="center_vertical"
149 android:orientation="horizontal"> 149 android:orientation="horizontal">
150 150
151 <View 151 <View
152 android:layout_width="5dp" 152 android:layout_width="5dp"
153 android:layout_height="20dp" 153 android:layout_height="20dp"
154 android:background="@color/login_text_blue"> 154 android:background="@color/login_text_blue">
155 155
156 </View> 156 </View>
157 157
158 <TextView 158 <TextView
159 android:layout_width="wrap_content" 159 android:layout_width="wrap_content"
160 android:layout_height="wrap_content" 160 android:layout_height="wrap_content"
161 android:layout_marginLeft="5dp" 161 android:layout_marginLeft="5dp"
162 android:text="子账户管理" 162 android:text="子账户管理"
163 android:textSize="22sp" /> 163 android:textSize="22sp" />
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="match_parent" 169 android:layout_height="match_parent"
170 android:layout_marginLeft="30dp" 170 android:layout_marginLeft="30dp"
171 android:orientation="vertical"> 171 android:orientation="vertical">
172 172
173 <LinearLayout 173 <LinearLayout
174 android:layout_width="match_parent" 174 android:layout_width="match_parent"
175 android:layout_height="wrap_content"> 175 android:layout_height="wrap_content">
176 176
177 <LinearLayout 177 <LinearLayout
178 android:layout_width="0dp" 178 android:layout_width="0dp"
179 android:layout_height="wrap_content" 179 android:layout_height="wrap_content"
180 android:layout_weight="1"> 180 android:layout_weight="1">
181 181
182 <LinearLayout 182 <LinearLayout
183 android:layout_width="wrap_content" 183 android:layout_width="wrap_content"
184 android:layout_height="wrap_content" 184 android:layout_height="wrap_content"
185 android:background="@drawable/corcle_blue_bg" 185 android:background="@drawable/corcle_blue_bg"
186 android:orientation="vertical"> 186 android:orientation="vertical">
187 187
188 <LinearLayout 188 <LinearLayout
189 android:layout_width="match_parent" 189 android:layout_width="match_parent"
190 android:layout_height="wrap_content" 190 android:layout_height="wrap_content"
191 android:orientation="horizontal"> 191 android:orientation="horizontal">
192 192
193 <ImageView 193 <ImageView
194 android:id="@+id/tv_account_head" 194 android:id="@+id/tv_account_head"
195 android:layout_width="wrap_content" 195 android:layout_width="wrap_content"
196 android:layout_height="wrap_content" 196 android:layout_height="wrap_content"
197 android:layout_margin="10dp" 197 android:layout_margin="10dp"
198 android:src="@mipmap/header_default" /> 198 android:src="@mipmap/header_default" />
199 199
200 <LinearLayout 200 <LinearLayout
201 android:layout_width="0dp" 201 android:layout_width="0dp"
202 android:layout_height="wrap_content" 202 android:layout_height="wrap_content"
203 android:layout_marginLeft="10dp" 203 android:layout_marginLeft="10dp"
204 android:layout_marginTop="10dp" 204 android:layout_marginTop="10dp"
205 android:layout_weight="1" 205 android:layout_weight="1"
206 android:orientation="vertical"> 206 android:orientation="vertical">
207 207
208 <TextView 208 <TextView
209 android:id="@+id/tv_account_name" 209 android:id="@+id/tv_account_name"
210 android:layout_width="wrap_content" 210 android:layout_width="wrap_content"
211 android:layout_height="wrap_content" 211 android:layout_height="wrap_content"
212 android:text="" 212 android:text=""
213 android:textSize="18sp" /> 213 android:textSize="18sp" />
214 214
215 <TextView 215 <TextView
216 android:id="@+id/tv_account_grade" 216 android:id="@+id/tv_account_grade"
217 android:layout_width="wrap_content" 217 android:layout_width="wrap_content"
218 android:layout_height="wrap_content" 218 android:layout_height="wrap_content"
219 android:text="" 219 android:text=""
220 android:textSize="18sp" /> 220 android:textSize="18sp" />
221 221
222 <TextView 222 <TextView
223 android:id="@+id/tv_account_school" 223 android:id="@+id/tv_account_school"
224 android:layout_width="wrap_content" 224 android:layout_width="wrap_content"
225 android:layout_height="wrap_content" 225 android:layout_height="wrap_content"
226 android:text="" 226 android:text=""
227 android:textSize="18sp" /> 227 android:textSize="18sp" />
228 228
229 <TextView 229 <TextView
230 android:id="@+id/tv_account_adress" 230 android:id="@+id/tv_account_adress"
231 android:layout_width="wrap_content" 231 android:layout_width="wrap_content"
232 android:layout_height="wrap_content" 232 android:layout_height="wrap_content"
233 android:text="" 233 android:text=""
234 android:textSize="18sp" /> 234 android:textSize="18sp" />
235 235
236 236
237 </LinearLayout> 237 </LinearLayout>
238 238
239 <ImageView 239 <ImageView
240 android:layout_width="wrap_content" 240 android:layout_width="wrap_content"
241 android:layout_height="wrap_content" 241 android:layout_height="wrap_content"
242 android:layout_gravity="right" 242 android:layout_gravity="right"
243 android:layout_marginLeft="60dp" 243 android:layout_marginLeft="60dp"
244 android:src="@mipmap/shiyongzhong" /> 244 android:src="@mipmap/shiyongzhong" />
245 245
246 </LinearLayout> 246 </LinearLayout>
247 247
248 <View 248 <View
249 android:layout_width="match_parent" 249 android:layout_width="match_parent"
250 android:layout_height="0.7dp" 250 android:layout_height="0.7dp"
251 android:layout_margin="10dp" 251 android:layout_margin="10dp"
252 android:background="@color/cutoff_line"> 252 android:background="@color/cutoff_line">
253 253
254 </View> 254 </View>
255 255
256 <LinearLayout 256 <LinearLayout
257 android:layout_width="match_parent" 257 android:layout_width="match_parent"
258 android:layout_height="wrap_content" 258 android:layout_height="wrap_content"
259 android:layout_marginBottom="10dp" 259 android:layout_marginBottom="10dp"
260 android:orientation="horizontal"> 260 android:orientation="horizontal">
261 261
262 <TextView 262 <TextView
263 android:id="@+id/tv_account_delete"
264 android:layout_width="0dp" 263 android:layout_width="0dp"
265 android:layout_height="wrap_content" 264 android:layout_height="wrap_content"
266 android:layout_weight="1" 265 android:layout_weight="1"
267 android:gravity="center" 266 android:gravity="center"
268 android:text="删除用户"
269 android:textSize="18sp" /> 267 android:textSize="18sp" />
270 268
271 <TextView 269 <TextView
270 android:id="@+id/tv_account_delete"
272 android:layout_width="0dp" 271 android:layout_width="0dp"
273 android:layout_height="wrap_content" 272 android:layout_height="wrap_content"
274 android:layout_weight="1" 273 android:layout_weight="1"
275 android:gravity="center" 274 android:gravity="center"
276 android:text="使用中" 275 android:text="使用中"
277 android:textSize="18sp" /> 276 android:textSize="18sp" />
278 277
279 278
280 </LinearLayout> 279 </LinearLayout>
281 280
282 </LinearLayout> 281 </LinearLayout>
283 282
284 283
285 </LinearLayout> 284 </LinearLayout>
286 285
287 <LinearLayout 286 <LinearLayout
288 android:layout_width="0dp" 287 android:layout_width="0dp"
289 android:layout_height="wrap_content" 288 android:layout_height="wrap_content"
290 android:layout_weight="1"> 289 android:layout_weight="1">
291 290
292 </LinearLayout> 291 </LinearLayout>
293 292
294 <LinearLayout 293 <LinearLayout
295 android:layout_width="0dp" 294 android:layout_width="0dp"
296 android:layout_height="wrap_content" 295 android:layout_height="wrap_content"
297 android:layout_weight="1"> 296 android:layout_weight="1">
298 297
299 </LinearLayout> 298 </LinearLayout>
300 </LinearLayout> 299 </LinearLayout>
301 300
302 <RelativeLayout 301 <RelativeLayout
303 android:layout_width="match_parent" 302 android:layout_width="match_parent"
304 android:layout_height="wrap_content" 303 android:layout_height="wrap_content"
305 android:layout_marginTop="20dp" 304 android:layout_marginTop="20dp"
306 android:orientation="horizontal"> 305 android:orientation="horizontal">
307 <android.support.v7.widget.RecyclerView 306 <android.support.v7.widget.RecyclerView
308 android:id="@+id/id_recyclerview_horizontal" 307 android:id="@+id/id_recyclerview_horizontal"
309 android:layout_width="wrap_content" 308 android:layout_width="wrap_content"
310 android:layout_toLeftOf="@+id/add_account" 309 android:layout_toLeftOf="@+id/add_account"
311 android:layout_height="wrap_content" 310 android:layout_height="wrap_content"
312 android:layout_centerVertical="true" 311 android:layout_centerVertical="true"
313 android:scrollbars="none" 312 android:scrollbars="none"
314 > 313 >
315 </android.support.v7.widget.RecyclerView> 314 </android.support.v7.widget.RecyclerView>
316 <LinearLayout 315 <LinearLayout
317 android:id="@+id/add_account" 316 android:id="@+id/add_account"
318 android:layout_width="415dp" 317 android:layout_width="415dp"
319 android:layout_height="165dp" 318 android:layout_height="165dp"
320 android:layout_marginLeft="10dp" 319 android:layout_marginLeft="10dp"
321 android:layout_alignParentRight="true" 320 android:layout_alignParentRight="true"
322 android:background="@drawable/corcle_black_bg" 321 android:background="@drawable/corcle_black_bg"
323 android:gravity="center"> 322 android:gravity="center">
324 <ImageView 323 <ImageView
325 android:layout_width="wrap_content" 324 android:layout_width="wrap_content"
326 android:layout_height="wrap_content" 325 android:layout_height="wrap_content"
327 android:src="@mipmap/jia"/> 326 android:src="@mipmap/jia"/>
328 327
329 </LinearLayout> 328 </LinearLayout>
330 329
331 330
332 331
333 332
334 </RelativeLayout> 333 </RelativeLayout>
335 334
336 </LinearLayout> 335 </LinearLayout>
337 336
338 337
PersonalCenter/app/src/main/res/layout/activity_choisetextbook.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical" android:layout_width="match_parent" 3 android:orientation="vertical" android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/white"> 5 android:background="@color/white">
6 <RelativeLayout 6 <RelativeLayout
7 android:id="@+id/title" 7 android:id="@+id/title"
8 android:layout_width="match_parent" 8 android:layout_width="match_parent"
9 android:layout_height="wrap_content" 9 android:layout_height="wrap_content"
10 android:background="@color/login_text_blue" 10 android:background="@color/login_text_blue"
11 android:minHeight="50dp" > 11 android:minHeight="50dp" >
12 12
13 <ImageView 13 <ImageView
14 android:id="@+id/cancel" 14 android:id="@+id/cancel"
15 android:layout_width="wrap_content" 15 android:layout_width="wrap_content"
16 android:layout_height="wrap_content" 16 android:layout_height="wrap_content"
17 android:layout_centerVertical="true" 17 android:layout_centerVertical="true"
18 android:paddingLeft="20dp" 18 android:paddingLeft="20dp"
19 android:paddingRight="20dp" 19 android:paddingRight="20dp"
20 android:src="@mipmap/title_back" /> 20 android:src="@mipmap/title_back" />
21 21
22 <TextView 22 <TextView
23 android:id="@+id/menu_title" 23 android:id="@+id/menu_title"
24 android:layout_width="wrap_content" 24 android:layout_width="wrap_content"
25 android:layout_height="wrap_content" 25 android:layout_height="wrap_content"
26 android:layout_centerInParent="true" 26 android:layout_centerInParent="true"
27 android:text="@string/string_textbook_info" 27 android:text="@string/string_textbook_info"
28 android:textColor="@android:color/white" 28 android:textColor="@android:color/white"
29 android:textSize="22sp" /> 29 android:textSize="22sp" />
30 </RelativeLayout> 30 </RelativeLayout>
31 <GridView 31 <GridView
32 android:id="@+id/grideview" 32 android:id="@+id/grideview"
33 android:layout_marginTop="10dp" 33 android:layout_margin="30dp"
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:gravity="center_vertical"
36 android:layout_below="@+id/title" 37 android:layout_below="@+id/title"
38 android:verticalSpacing="20dp"
37 android:numColumns="5"> 39 android:numColumns="5">
38 40
39 </GridView> 41 </GridView>
40 <LinearLayout 42 <LinearLayout
41 android:layout_width="match_parent" 43 android:layout_width="match_parent"
42 android:layout_height="match_parent" 44 android:layout_height="match_parent"
43
44 android:background="#ffffffff" 45 android:background="#ffffffff"
45 android:layout_below="@+id/grideview" 46 android:layout_below="@+id/grideview"
46 android:orientation="vertical" 47 android:orientation="vertical"
47 android:paddingLeft="250dp" 48 android:paddingLeft="250dp"
48 android:paddingRight="250dp"> 49 android:paddingRight="250dp">
49 <Button 50 <Button
50 android:id="@+id/btn_ok" 51 android:id="@+id/btn_ok"
51 style="@style/button_login_register_style" 52 style="@style/button_login_register_style"
52 android:layout_marginTop="30dp" 53 android:layout_marginTop="30dp"
53 android:text="@string/string_regist_next" /> 54 android:text="@string/string_regist_next" />
54 </LinearLayout> 55 </LinearLayout>
55 56
56 57
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical" android:layout_width="match_parent" 3 android:orientation="vertical" android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/white"> 5 android:background="@color/white">
6 <GridView 6 <GridView
7 android:id="@+id/grideview" 7 android:id="@+id/grideview"
8 android:layout_marginTop="20dp" 8 android:layout_margin="30dp"
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:gravity="center_vertical"
11 android:layout_below="@+id/title" 12 android:layout_below="@+id/title"
13 android:verticalSpacing="20dp"
12 android:numColumns="5"> 14 android:numColumns="5">
13 15
14 </GridView> 16 </GridView>
15 17
16 </RelativeLayout> 18 </RelativeLayout>
PersonalCenter/app/src/main/res/layout/recycler_childaccunt_item_view.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 xmlns:fresco="http://schemas.android.com/apk/res-auto" 3 xmlns:fresco="http://schemas.android.com/apk/res-auto"
4 android:orientation="vertical" 4 android:orientation="vertical"
5 android:layout_width="415dp" 5 android:layout_width="415dp"
6 android:layout_height="match_parent"> 6 android:layout_height="match_parent">
7 <LinearLayout 7 <LinearLayout
8 android:layout_width="wrap_content" 8 android:layout_width="wrap_content"
9 android:layout_height="wrap_content" 9 android:layout_height="wrap_content"
10 android:background="@drawable/corcle_black_bg" 10 android:background="@drawable/corcle_black_bg"
11 android:orientation="vertical"> 11 android:orientation="vertical">
12 12
13 <LinearLayout 13 <LinearLayout
14 android:layout_width="wrap_content" 14 android:layout_width="wrap_content"
15 android:layout_height="wrap_content" 15 android:layout_height="wrap_content"
16 android:orientation="horizontal"> 16 android:orientation="horizontal">
17 <com.facebook.drawee.view.SimpleDraweeView 17 <com.facebook.drawee.view.SimpleDraweeView
18 android:id="@+id/iv_child_head" 18 android:id="@+id/iv_child_head"
19 android:layout_width="60dp" 19 android:layout_width="60dp"
20 android:layout_height="60dp" 20 android:layout_height="60dp"
21 android:layout_margin="10dp" 21 android:layout_margin="10dp"
22 fresco:placeholderImage="@mipmap/header_default" 22 fresco:placeholderImage="@mipmap/header_default"
23 fresco:roundAsCircle="true" 23 fresco:roundAsCircle="true"
24 fresco:placeholderImageScaleType="fitCenter" /> 24 fresco:placeholderImageScaleType="fitCenter" />
25 25
26 26
27 <LinearLayout 27 <LinearLayout
28 android:layout_width="0dp" 28 android:layout_width="0dp"
29 android:layout_height="wrap_content" 29 android:layout_height="wrap_content"
30 android:layout_marginLeft="10dp" 30 android:layout_marginLeft="10dp"
31 android:layout_marginTop="10dp" 31 android:layout_marginTop="10dp"
32 android:layout_weight="1" 32 android:layout_weight="1"
33 android:orientation="vertical"> 33 android:orientation="vertical">
34 34
35 <TextView 35 <TextView
36 android:id="@+id/iv_child_name" 36 android:id="@+id/iv_child_name"
37 android:layout_width="wrap_content" 37 android:layout_width="wrap_content"
38 android:layout_height="wrap_content" 38 android:layout_height="wrap_content"
39 android:text="删除用户" 39 android:text=""
40 android:textSize="18sp" /> 40 android:textSize="18sp" />
41 41
42 <TextView 42 <TextView
43 android:id="@+id/iv_child_grade" 43 android:id="@+id/iv_child_grade"
44 android:layout_width="wrap_content" 44 android:layout_width="wrap_content"
45 android:layout_height="wrap_content" 45 android:layout_height="wrap_content"
46 android:text="使用中" 46 android:text=""
47 android:textSize="18sp" /> 47 android:textSize="18sp" />
48 48
49 <TextView 49 <TextView
50 android:id="@+id/iv_child_school" 50 android:id="@+id/iv_child_school"
51 android:layout_width="wrap_content" 51 android:layout_width="wrap_content"
52 android:layout_height="wrap_content" 52 android:layout_height="wrap_content"
53 android:text="删除用户" 53 android:text=""
54 android:textSize="18sp" /> 54 android:textSize="18sp" />
55 55
56 <TextView 56 <TextView
57 android:id="@+id/iv_child_adress" 57 android:id="@+id/iv_child_adress"
58 android:layout_width="wrap_content" 58 android:layout_width="wrap_content"
59 android:layout_height="wrap_content" 59 android:layout_height="wrap_content"
60 android:text="使用中" 60 android:text=""
61 android:textSize="18sp" /> 61 android:textSize="18sp" />
62 62
63 63
64
64 </LinearLayout> 65 </LinearLayout>
65 66
66 67
67 </LinearLayout> 68 </LinearLayout>
68 69
69 <View 70 <View
70 android:layout_width="wrap_content" 71 android:layout_width="wrap_content"
71 android:layout_height="0.7dp" 72 android:layout_height="0.7dp"
72 android:layout_margin="10dp" 73 android:layout_margin="10dp"
73 android:background="@color/cutoff_line"> 74 android:background="@color/cutoff_line">
74 75
75 </View> 76 </View>
76 77
77 <LinearLayout 78 <LinearLayout
78 android:layout_width="match_parent" 79 android:layout_width="match_parent"
79 android:layout_height="wrap_content" 80 android:layout_height="wrap_content"
80 android:layout_marginBottom="10dp" 81 android:layout_marginBottom="10dp"
81 android:orientation="horizontal"> 82 android:orientation="horizontal">
82 83
83 <TextView 84 <TextView
84 android:id="@+id/delete_child_account" 85 android:id="@+id/delete_child_account"
85 android:layout_width="0dp" 86 android:layout_width="0dp"
86 android:layout_height="wrap_content" 87 android:layout_height="wrap_content"
87 android:layout_weight="1" 88 android:layout_weight="1"
88 android:gravity="center" 89 android:gravity="center"
89 android:text="删除用户" 90 android:text="删除用户"
90 android:textSize="18sp" /> 91 android:textSize="18sp" />
91 92
92 <TextView 93 <TextView
93 android:id="@+id/chang_account" 94 android:id="@+id/chang_account"
94 android:layout_width="0dp" 95 android:layout_width="0dp"
95 android:layout_height="wrap_content" 96 android:layout_height="wrap_content"
96 android:layout_weight="1" 97 android:layout_weight="1"
97 android:gravity="center" 98 android:gravity="center"
98 android:text="切换使用" 99 android:text="切换使用"
99 android:textSize="18sp" /> 100 android:textSize="18sp" />
100 101
101 102
102 </LinearLayout> 103 </LinearLayout>
103 104
104 </LinearLayout> 105 </LinearLayout>
105 106
106 </LinearLayout> 107 </LinearLayout>