Commit 6a86a5fc01e3ad31cb8353ca436323b42090f51e

Authored by liujiaqi
1 parent bfaa7264b3
Exists in master

家长控制手机端功能

No preview for this file type
PersonalCenter/.idea/misc.xml
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4"> 2 <project version="4">
3 <component name="EntryPointsManager">
4 <entry_points version="2.0" />
5 </component>
3 <component name="NullableNotNullManager"> 6 <component name="NullableNotNullManager">
4 <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> 7 <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
5 <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> 8 <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
6 <option name="myNullables"> 9 <option name="myNullables">
7 <value> 10 <value>
8 <list size="4"> 11 <list size="4">
9 <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" />
10 <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> 13 <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
11 <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" />
12 <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" />
13 </list> 16 </list>
14 </value> 17 </value>
15 </option> 18 </option>
16 <option name="myNotNulls"> 19 <option name="myNotNulls">
17 <value> 20 <value>
18 <list size="4"> 21 <list size="4">
19 <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" />
20 <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> 23 <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
21 <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" />
22 <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" />
23 </list> 26 </list>
24 </value> 27 </value>
25 </option> 28 </option>
26 </component> 29 </component>
27 <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> 30 <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
28 <output url="file://$PROJECT_DIR$/build/classes" /> 31 <output url="file://$PROJECT_DIR$/build/classes" />
29 </component> 32 </component>
30 <component name="ProjectType"> 33 <component name="ProjectType">
31 <option name="id" value="Android" /> 34 <option name="id" value="Android" />
32 </component> 35 </component>
33 </project> 36 </project>
PersonalCenter/app/PresonalCenter.apk
No preview for this file type
PersonalCenter/app/build.gradle
1 apply plugin: 'com.android.application' 1 apply plugin: 'com.android.application'
2 2
3 android { 3 android {
4 compileSdkVersion 25 4 compileSdkVersion 25
5 buildToolsVersion "25.0.3" 5 buildToolsVersion "25.0.3"
6 defaultConfig { 6 defaultConfig {
7 applicationId "com.hjx.personalcenter" 7 applicationId "com.hjx.personalcenter"
8 minSdkVersion 15 8 minSdkVersion 15
9 targetSdkVersion 25 9 targetSdkVersion 25
10 versionCode 5 10 versionCode 6
11 versionName "1.0.5" 11 versionName "1.1.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 lintOptions{ 21 lintOptions{
22 checkReleaseBuilds false 22 checkReleaseBuilds false
23 abortOnError false 23 abortOnError false
24 } 24 }
25 sourceSets { 25 sourceSets {
26 main { 26 main {
27 jniLibs.srcDirs = ['libs'] 27 jniLibs.srcDirs = ['libs']
28 } 28 }
29 } 29 }
30 } 30 }
31 31
32 dependencies { 32 dependencies {
33 compile fileTree(include: ['*.jar'], dir: 'libs') 33 compile fileTree(include: ['*.jar'], dir: 'libs')
34 androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 34 androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
35 exclude group: 'com.android.support', module: 'support-annotations' 35 exclude group: 'com.android.support', module: 'support-annotations'
36 }) 36 })
37 compile 'com.tencent.bugly:crashreport:latest.release' 37 compile 'com.tencent.bugly:crashreport:latest.release'
38 compile 'org.apache.httpcomponents:httpcore:4.4.1' 38 compile 'org.apache.httpcomponents:httpcore:4.4.1'
39 compile 'org.apache.httpcomponents:httpclient:4.5' 39 compile 'org.apache.httpcomponents:httpclient:4.5'
40 compile 'com.android.support:appcompat-v7:25.3.1' 40 compile 'com.android.support:appcompat-v7:25.3.1'
41 testCompile 'junit:junit:4.12' 41 testCompile 'junit:junit:4.12'
42 compile project(':circledialog') 42 compile project(':circledialog')
43 compile project(':pickerview') 43 compile project(':pickerview')
44 compile files('libs/android-async-http-1.4.8.jar') 44 compile files('libs/android-async-http-1.4.8.jar')
45 compile 'com.google.code.gson:gson:2.7' 45 compile 'com.google.code.gson:gson:2.7'
46 compile 'com.zaaach:toprightmenu:1.0' 46 compile 'com.zaaach:toprightmenu:1.0'
47 compile 'com.android.support:recyclerview-v7:25.+' 47 compile 'com.android.support:recyclerview-v7:25.3.1'
48 debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' 48 debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
49 releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' 49 releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
50 compile 'com.google.zxing:core:3.3.0' 50 compile 'com.google.zxing:core:3.3.0'
51 compile 'com.google.zxing:android-core:3.3.0' 51 compile 'com.google.zxing:android-core:3.3.0'
52 compile project(path: ':mypresonallibrary') 52 compile project(path: ':mypresonallibrary')
53 compile files('libs/picasso-2.5.2.jar') 53 compile files('libs/picasso-2.5.2.jar')
54 } 54 }
55 55
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.content.Intent; 4 import android.content.Intent;
5 import android.content.pm.PackageManager; 5 import android.content.pm.PackageManager;
6 import android.net.Uri; 6 import android.net.Uri;
7 import android.os.Build; 7 import android.os.Build;
8 import android.os.Bundle; 8 import android.os.Bundle;
9 import android.os.Handler; 9 import android.os.Handler;
10 import android.os.Message; 10 import android.os.Message;
11 import android.provider.MediaStore; 11 import android.provider.MediaStore;
12 import android.support.annotation.NonNull; 12 import android.support.annotation.NonNull;
13 import android.support.v4.app.FragmentActivity; 13 import android.support.v4.app.FragmentActivity;
14 import android.support.v4.content.FileProvider; 14 import android.support.v4.content.FileProvider;
15 import android.support.v7.widget.LinearLayoutManager; 15 import android.support.v7.widget.LinearLayoutManager;
16 import android.support.v7.widget.RecyclerView; 16 import android.support.v7.widget.RecyclerView;
17 import android.util.Log; 17 import android.util.Log;
18 import android.view.KeyEvent; 18 import android.view.KeyEvent;
19 import android.view.View; 19 import android.view.View;
20 import android.widget.GridView; 20 import android.widget.GridView;
21 import android.widget.ImageView; 21 import android.widget.ImageView;
22 import android.widget.LinearLayout; 22 import android.widget.LinearLayout;
23 import android.widget.TextView; 23 import android.widget.TextView;
24 import android.widget.Toast; 24 import android.widget.Toast;
25 25
26 import com.google.gson.Gson; 26 import com.google.gson.Gson;
27 import com.hjx.personalcenter.R; 27 import com.hjx.personalcenter.R;
28 import com.hjx.personalcenter.adapter.MianGridAdapter; 28 import com.hjx.personalcenter.adapter.MianGridAdapter;
29 import com.hjx.personalcenter.adapter.VideoAdapter; 29 import com.hjx.personalcenter.adapter.VideoAdapter;
30 import com.hjx.personalcenter.customdialog.HeadDialog; 30 import com.hjx.personalcenter.customdialog.HeadDialog;
31 import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; 31 import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem;
32 import com.hjx.personalcenter.db.Content; 32 import com.hjx.personalcenter.db.Content;
33 import com.hjx.personalcenter.db.SaveParam; 33 import com.hjx.personalcenter.db.SaveParam;
34 import com.hjx.personalcenter.http.HttpCode; 34 import com.hjx.personalcenter.http.HttpCode;
35 import com.hjx.personalcenter.http.HttpManager; 35 import com.hjx.personalcenter.http.HttpManager;
36 import com.hjx.personalcenter.interfaces.DialogCallBack; 36 import com.hjx.personalcenter.interfaces.DialogCallBack;
37 import com.hjx.personalcenter.model.DefautPublishInfo; 37 import com.hjx.personalcenter.model.DefautPublishInfo;
38 import com.hjx.personalcenter.model.PesonalInfo; 38 import com.hjx.personalcenter.model.PesonalInfo;
39 import com.hjx.personalcenter.model.SignInfo; 39 import com.hjx.personalcenter.model.SignInfo;
40 import com.hjx.personalcenter.model.VideoInfo; 40 import com.hjx.personalcenter.model.VideoInfo;
41 import com.hjx.personalcenter.update.UpdateChecker; 41 import com.hjx.personalcenter.update.UpdateChecker;
42 import com.hjx.personalcenter.util.AlertUtils; 42 import com.hjx.personalcenter.util.AlertUtils;
43 import com.hjx.personalcenter.util.BrithdayStar; 43 import com.hjx.personalcenter.util.BrithdayStar;
44 import com.hjx.personalcenter.util.CropUtils; 44 import com.hjx.personalcenter.util.CropUtils;
45 import com.hjx.personalcenter.util.DialogPermission; 45 import com.hjx.personalcenter.util.DialogPermission;
46 import com.hjx.personalcenter.util.FileUtil; 46 import com.hjx.personalcenter.util.FileUtil;
47 import com.hjx.personalcenter.util.GetDevicesUtil; 47 import com.hjx.personalcenter.util.GetDevicesUtil;
48 import com.hjx.personalcenter.util.PermissionUtil; 48 import com.hjx.personalcenter.util.PermissionUtil;
49 import com.hjx.personalcenter.util.SharedPreferenceMark; 49 import com.hjx.personalcenter.util.SharedPreferenceMark;
50 import com.mylhyl.circledialog.CircleDialog; 50 import com.mylhyl.circledialog.CircleDialog;
51 import com.mylhyl.circledialog.callback.ConfigInput; 51 import com.mylhyl.circledialog.callback.ConfigInput;
52 import com.mylhyl.circledialog.params.InputParams; 52 import com.mylhyl.circledialog.params.InputParams;
53 import com.mylhyl.circledialog.view.listener.OnInputClickListener; 53 import com.mylhyl.circledialog.view.listener.OnInputClickListener;
54 import com.squareup.picasso.Picasso; 54 import com.squareup.picasso.Picasso;
55 import com.zaaach.toprightmenu.MenuItem; 55 import com.zaaach.toprightmenu.MenuItem;
56 import com.zaaach.toprightmenu.TopRightMenu; 56 import com.zaaach.toprightmenu.TopRightMenu;
57 57
58 import org.json.JSONException; 58 import org.json.JSONException;
59 import org.json.JSONObject; 59 import org.json.JSONObject;
60 60
61 import java.io.File; 61 import java.io.File;
62 import java.io.UnsupportedEncodingException; 62 import java.io.UnsupportedEncodingException;
63 import java.util.ArrayList; 63 import java.util.ArrayList;
64 import java.util.List; 64 import java.util.List;
65 65
66 public class MainActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.CallBackView { 66 public class MainActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.CallBackView {
67 private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex, tv_edit_presoninfo; 67 private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex, tv_edit_presoninfo;
68 private TextView tv_sign, 68 private TextView tv_sign,
69 tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, 69 tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday,
70 tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; 70 tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji;
71 private TextView linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass, iv_look_card; 71 private TextView linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass, iv_look_card;
72 private TopRightMenu mTopRightMenu; 72 private TopRightMenu mTopRightMenu;
73 private LinearLayout view_novedeo; 73 private LinearLayout view_novedeo;
74 private View sssssssss; 74 private View sssssssss;
75 //水平滑动 75 //水平滑动
76 private RecyclerView mRecyclerView; 76 private RecyclerView mRecyclerView;
77 private GridView mRecyclerViewpublish; 77 private GridView mRecyclerViewpublish;
78 private VideoAdapter RecyclerViewadapter; 78 private VideoAdapter RecyclerViewadapter;
79 private MianGridAdapter RecyclerViewadapterpublish; 79 private MianGridAdapter RecyclerViewadapterpublish;
80 private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); 80 private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>();
81 81
82 private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); 82 private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>();
83 private boolean showIcon = false; 83 private boolean showIcon = false;
84 private boolean dimBg = false; 84 private boolean dimBg = false;
85 private boolean needAnim = true; 85 private boolean needAnim = true;
86 private static final int REQUEST_CODE_TAKE_PHOTO = 1; 86 private static final int REQUEST_CODE_TAKE_PHOTO = 1;
87 private static final int REQUEST_CODE_ALBUM = 2; 87 private static final int REQUEST_CODE_ALBUM = 2;
88 private static final int REQUEST_CODE_CROUP_PHOTO = 3; 88 private static final int REQUEST_CODE_CROUP_PHOTO = 3;
89 private ImageView mSimpleDraweeView; 89 private ImageView mSimpleDraweeView;
90 private File file; 90 private File file;
91 private Uri uri; 91 private Uri uri;
92 String portrait; 92 String portrait;
93 Handler handler = new Handler() { 93 Handler handler = new Handler() {
94 @Override 94 @Override
95 public void handleMessage(Message msg) { 95 public void handleMessage(Message msg) {
96 super.handleMessage(msg); 96 super.handleMessage(msg);
97 switch (msg.what) { 97 switch (msg.what) {
98 case HttpCode.GETINFO: 98 case HttpCode.GETINFO:
99 PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; 99 PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj;
100 tv_username.setText(cardinfoBean.getNickName()); 100 tv_username.setText(cardinfoBean.getNickName());
101 tv_username1.setText(cardinfoBean.getNickName()); 101 tv_username1.setText(cardinfoBean.getNickName());
102 tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); 102 tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName());
103 tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); 103 tv_useinfo_birthday.setText(cardinfoBean.getBirthday());
104 tv_useinfo_qq.setText(cardinfoBean.getQq()); 104 tv_useinfo_qq.setText(cardinfoBean.getQq());
105 tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); 105 tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName());
106 tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); 106 tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName());
107 String sex = cardinfoBean.getGender(); 107 String sex = cardinfoBean.getGender();
108 if ("0".equals(sex)) { 108 if ("0".equals(sex)) {
109 tv_sex.setText("男"); 109 tv_sex.setText("男");
110 iv_sex.setImageResource(R.mipmap.men); 110 iv_sex.setImageResource(R.mipmap.men);
111 } else { 111 } else {
112 tv_sex.setText("女"); 112 tv_sex.setText("女");
113 iv_sex.setImageResource(R.mipmap.women); 113 iv_sex.setImageResource(R.mipmap.women);
114 } 114 }
115 portrait = cardinfoBean.getPortrait(); 115 portrait = cardinfoBean.getPortrait();
116 //mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); 116 //mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait());
117 if (portrait!=null&&!portrait.isEmpty()) { 117 if (portrait!=null&&!portrait.isEmpty()) {
118 Picasso.with(MainActivity.this).load(portrait).into(mSimpleDraweeView); 118 Picasso.with(MainActivity.this).load(portrait).into(mSimpleDraweeView);
119 } 119 }
120 //加载星座 120 //加载星座
121 BrithdayStar brithdayStar = new BrithdayStar(); 121 BrithdayStar brithdayStar = new BrithdayStar();
122 if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) { 122 if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) {
123 tv_mygad.setText(""); 123 tv_mygad.setText("");
124 } else { 124 } else {
125 String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); 125 String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday());
126 tv_mygad.setText(xiongzuo); 126 tv_mygad.setText(xiongzuo);
127 } 127 }
128 //保存个人信息 128 //保存个人信息
129 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName()); 129 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName());
130 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName()); 130 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName());
131 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName()); 131 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName());
132 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday()); 132 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday());
133 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString()); 133 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString());
134 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq()); 134 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq());
135 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName()); 135 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName());
136 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress()); 136 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress());
137 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId()); 137 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId());
138 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait()); 138 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait());
139 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId()); 139 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId());
140 String graderID = cardinfoBean.getGrade().getGradeId(); 140 String graderID = cardinfoBean.getGrade().getGradeId();
141 Log.e("test", "nianji" + graderID); 141 Log.e("test", "nianji" + graderID);
142 try { 142 try {
143 long auserID = Long.parseLong(graderID); 143 long auserID = Long.parseLong(graderID);
144 String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); 144 String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS);
145 // if ((auserID < 8) && (ss == null)) { 145 // if ((auserID < 8) && (ss == null)) {
146 // Intent intentbroad = new Intent(); 146 // Intent intentbroad = new Intent();
147 // intentbroad.putExtra("info", "小学"); 147 // intentbroad.putExtra("info", "小学");
148 // //4、定义广播发送的action 148 // //4、定义广播发送的action
149 // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); 149 // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE");
150 // //5、发送广播 150 // //5、发送广播
151 // sendBroadcast(intentbroad); 151 // sendBroadcast(intentbroad);
152 // Log.i("---", "发送完了"); 152 // Log.i("---", "发送完了");
153 // } 153 // }
154 } catch (NumberFormatException e) { 154 } catch (NumberFormatException e) {
155 e.printStackTrace(); 155 e.printStackTrace();
156 } 156 }
157 157
158 158
159 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); 159 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID);
160 String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); 160 String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId");
161 //账户类型 161 //账户类型
162 String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); 162 String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT);
163 String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); 163 String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID);
164 164
165 try { 165 try {
166 Object auserID; 166 Object auserID;
167 int type; 167 int type;
168 int graderIDs = Integer.parseInt(graderID); 168 int graderIDs = Integer.parseInt(graderID);
169 if ("2".equals(accounts)) { 169 if ("2".equals(accounts)) {
170 type = Integer.parseInt(accounts); 170 type = Integer.parseInt(accounts);
171 auserID = childID; 171 auserID = childID;
172 } else { 172 } else {
173 type = Integer.parseInt(accounts); 173 type = Integer.parseInt(accounts);
174 auserID = Long.parseLong(userID); 174 auserID = Long.parseLong(userID);
175 } 175 }
176 //获取版本信息 176 //获取版本信息
177 //Log.e("test","nianji"+graderID+auserID+"sssss"+type); 177 //Log.e("test","nianji"+graderID+auserID+"sssss"+type);
178 HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); 178 HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler);
179 179
180 } catch (NumberFormatException e) { 180 } catch (NumberFormatException e) {
181 e.printStackTrace(); 181 e.printStackTrace();
182 } 182 }
183 183
184 break; 184 break;
185 case HttpCode.SIGN: 185 case HttpCode.SIGN:
186 SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; 186 SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj;
187 if (dataBean.getSignature() == null) { 187 if (dataBean.getSignature() == null) {
188 tv_sign.setText("你还未设置个性签名"); 188 tv_sign.setText("你还未设置个性签名");
189 } else { 189 } else {
190 tv_sign.setText(dataBean.getSignature()); 190 tv_sign.setText(dataBean.getSignature());
191 } 191 }
192 192
193 break; 193 break;
194 case HttpCode.PUBLISH_SUCESS: 194 case HttpCode.PUBLISH_SUCESS:
195 defautPublishInfos.clear(); 195 defautPublishInfos.clear();
196 defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); 196 defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj);
197 RecyclerViewadapterpublish.notifyDataSetChanged(); 197 RecyclerViewadapterpublish.notifyDataSetChanged();
198 Gson gson = new Gson(); 198 Gson gson = new Gson();
199 Log.e("test", "(List<DefautPublishInfo.DataBean>) msg.obj" + gson.toJson(msg.obj)); 199 Log.e("test", "(List<DefautPublishInfo.DataBean>) msg.obj" + gson.toJson(msg.obj));
200 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj)); 200 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj));
201 break; 201 break;
202 case HttpCode.GETVIDIO_SUCESS: 202 case HttpCode.GETVIDIO_SUCESS:
203 videoinfo.clear(); 203 videoinfo.clear();
204 view_novedeo.setVisibility(View.GONE); 204 view_novedeo.setVisibility(View.GONE);
205 videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); 205 videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj);
206 RecyclerViewadapter.notifyDataSetChanged(); 206 RecyclerViewadapter.notifyDataSetChanged();
207 break; 207 break;
208 case HttpCode.SUCHCARDINFOONE: 208 case HttpCode.SUCHCARDINFOONE:
209 JSONObject jsonObject; 209 JSONObject jsonObject;
210 String status; 210 String status;
211 try { 211 try {
212 jsonObject = new JSONObject((String) msg.obj); 212 jsonObject = new JSONObject((String) msg.obj);
213 status = jsonObject.getString("status"); 213 status = jsonObject.getString("status");
214 if (status.equals("1")) { 214 if (status.equals("1")) {
215 //sssssssss.setVisibility(View.VISIBLE); 215 //sssssssss.setVisibility(View.VISIBLE);
216 tv_yangji.setVisibility(View.GONE); 216 tv_yangji.setVisibility(View.GONE);
217 iv_look_card.setVisibility(View.VISIBLE); 217 iv_look_card.setVisibility(View.VISIBLE);
218 //客机没有保卡 218 //客机没有保卡
219 } else if (status.equals("2001")) { 219 } else if (status.equals("2001")) {
220 //sssssssss.setVisibility(View.VISIBLE); 220 //sssssssss.setVisibility(View.VISIBLE);
221 tv_yangji.setVisibility(View.GONE); 221 tv_yangji.setVisibility(View.GONE);
222 iv_look_card.setVisibility(View.VISIBLE); 222 iv_look_card.setVisibility(View.VISIBLE);
223 AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录"); 223 AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录");
224 SaveParam.getInstance().clearData(MainActivity.this); 224 SaveParam.getInstance().clearData(MainActivity.this);
225 Intent settingintent = new Intent(); 225 Intent settingintent = new Intent();
226 settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); 226 settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class);
227 startActivity(settingintent); 227 startActivity(settingintent);
228 overridePendingTransition(R.anim.rightin, R.anim.rightout); 228 overridePendingTransition(R.anim.rightin, R.anim.rightout);
229 } else if (status.equals("2002")) {//样机 229 } else if (status.equals("2002")) {//样机
230 //sssssssss.setVisibility(View.INVISIBLE); 230 //sssssssss.setVisibility(View.INVISIBLE);
231 iv_look_card.setVisibility(View.INVISIBLE); 231 iv_look_card.setVisibility(View.INVISIBLE);
232 tv_yangji.setVisibility(View.VISIBLE); 232 tv_yangji.setVisibility(View.VISIBLE);
233 233
234 } else { 234 } else {
235 AlertUtils.showToast(MainActivity.this, "服务器连接失败"); 235 AlertUtils.showToast(MainActivity.this, "服务器连接失败");
236 } 236 }
237 } catch (JSONException e) { 237 } catch (JSONException e) {
238 e.printStackTrace(); 238 e.printStackTrace();
239 } 239 }
240 case HttpCode.TOUXIANG: 240 case HttpCode.TOUXIANG:
241 if (msg.obj.equals("1")){ 241 if (msg.obj.equals("1")){
242 String s = SaveParam.getInstance().getLoginParam(MainActivity.this,SaveParam.PORTAIT); 242 String s = SaveParam.getInstance().getLoginParam(MainActivity.this,SaveParam.PORTAIT);
243 if (portrait!=null&&!portrait.isEmpty()){ 243 if (portrait!=null&&!portrait.isEmpty()){
244 Picasso.with(MainActivity.this).load(s).into(mSimpleDraweeView); 244 Picasso.with(MainActivity.this).load(s).into(mSimpleDraweeView);
245 } 245 }
246 246
247 } 247 }
248 break; 248 break;
249 case HttpCode.RELOGIN:
250 //清除数据
251 SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.ACCOUNT, "1");
252 SaveParam.getInstance().clearData(MainActivity.this);
253 Intent settingintent = new Intent();
254 settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class);
255 startActivity(settingintent);
256 overridePendingTransition(R.anim.rightin, R.anim.rightout);
257 finish();
258 break;
249 259
250 260
251 } 261 }
252 } 262 }
253 }; 263 };
254 264
255 @Override 265 @Override
256 protected void onCreate(Bundle savedInstanceState) { 266 protected void onCreate(Bundle savedInstanceState) {
257 super.onCreate(savedInstanceState); 267 super.onCreate(savedInstanceState);
258 setContentView(R.layout.activity_main); 268 setContentView(R.layout.activity_main);
259 SysApplication.getInstance().addActivity(this); 269 SysApplication.getInstance().addActivity(this);
260 initView(); 270 initView();
261 initData(); 271 initData();
262 initLister(); 272 initLister();
263 updateVersion(); 273 updateVersion();
264 } 274 }
265 275
266 //////版本更新 276 //////版本更新
267 private void updateVersion() { 277 private void updateVersion() {
268 UpdateChecker updateChecker = new UpdateChecker(this); 278 UpdateChecker updateChecker = new UpdateChecker(this);
269 updateChecker.checkForUpdates(); 279 updateChecker.checkForUpdates();
270 280
271 281
272 } 282 }
273 283
274 private void initView() { 284 private void initView() {
275 iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); 285 iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan);
276 iv_look_card = (TextView) findViewById(R.id.iv_look_card); 286 iv_look_card = (TextView) findViewById(R.id.iv_look_card);
277 tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); 287 tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo);
278 iv_setting = (ImageView) findViewById(R.id.iv_setting); 288 iv_setting = (ImageView) findViewById(R.id.iv_setting);
279 iv_sign = (ImageView) findViewById(R.id.iv_sign); 289 iv_sign = (ImageView) findViewById(R.id.iv_sign);
280 tv_sign = (TextView) findViewById(R.id.tv_sign); 290 tv_sign = (TextView) findViewById(R.id.tv_sign);
281 //头像 291 //头像
282 mSimpleDraweeView = (ImageView) findViewById(R.id.iv_head); 292 mSimpleDraweeView = (ImageView) findViewById(R.id.iv_head);
283 //初始化个人信息 293 //初始化个人信息
284 iv_sex = (ImageView) findViewById(R.id.iv_sex); 294 iv_sex = (ImageView) findViewById(R.id.iv_sex);
285 tv_username = (TextView) findViewById(R.id.tv_username); 295 tv_username = (TextView) findViewById(R.id.tv_username);
286 tv_username1 = (TextView) findViewById(R.id.tv_username1); 296 tv_username1 = (TextView) findViewById(R.id.tv_username1);
287 tv_mygad = (TextView) findViewById(R.id.tv_mygad); 297 tv_mygad = (TextView) findViewById(R.id.tv_mygad);
288 tv_sex = (TextView) findViewById(R.id.tv_sex); 298 tv_sex = (TextView) findViewById(R.id.tv_sex);
289 tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); 299 tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress);
290 tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); 300 tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday);
291 tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); 301 tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq);
292 tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); 302 tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school);
293 tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); 303 tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender);
294 tv_yangji = (TextView) findViewById(R.id.tv_yangji); 304 tv_yangji = (TextView) findViewById(R.id.tv_yangji);
295 //跳转其他应用 305 //跳转其他应用
296 linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); 306 linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti);
297 linel_mynote = (TextView) findViewById(R.id.linel_mynote); 307 linel_mynote = (TextView) findViewById(R.id.linel_mynote);
298 linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); 308 linel_mycollege = (TextView) findViewById(R.id.linel_mycollege);
299 linel_myclass = (TextView) findViewById(R.id.linel_myclass); 309 linel_myclass = (TextView) findViewById(R.id.linel_myclass);
300 // 310 //
301 mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); 311 mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal);
302 mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); 312 mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish);
303 view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); 313 view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo);
304 314
305 //sssssssss = findViewById(R.id.sssssssss); 315 //sssssssss = findViewById(R.id.sssssssss);
306 316
307 } 317 }
308 318
309 319
310 private void initData() { 320 private void initData() {
311 file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); 321 file = new File(FileUtil.getCachePath(this), "user-avatar.jpg");
312 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { 322 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
313 uri = Uri.fromFile(file); 323 uri = Uri.fromFile(file);
314 } else { 324 } else {
315 //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) 325 //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问)
316 uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); 326 uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file);
317 } 327 }
318 //设置布局管理器 328 //设置布局管理器
319 LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); 329 LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
320 linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); 330 linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
321 331
322 // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); 332 // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this);
323 // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); 333 // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL);
324 334
325 mRecyclerView.setLayoutManager(linearLayoutManager); 335 mRecyclerView.setLayoutManager(linearLayoutManager);
326 mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); 336 mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10));
327 337
328 // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); 338 // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish);
329 // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); 339 // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10));
330 340
331 //设置视频适配器 341 //设置视频适配器
332 RecyclerViewadapter = new VideoAdapter(this, videoinfo); 342 RecyclerViewadapter = new VideoAdapter(this, videoinfo);
333 RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this); 343 RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this);
334 344
335 //版本信息适配器 345 //版本信息适配器
336 mRecyclerView.setAdapter(RecyclerViewadapter); 346 mRecyclerView.setAdapter(RecyclerViewadapter);
337 mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); 347 mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish);
338 348
339 //判断保卡信息是否为样机 349 //判断保卡信息是否为样机
340 String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); 350 String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI);
341 String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); 351 String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber();
342 Log.d("test", "yangji" + yangji); 352 Log.d("test", "yangji" + yangji);
343 if ("1".equals(yangji)) { 353 if ("1".equals(yangji)) {
344 //sssssssss.setVisibility(View.INVISIBLE); 354 //sssssssss.setVisibility(View.INVISIBLE);
345 iv_look_card.setVisibility(View.INVISIBLE); 355 iv_look_card.setVisibility(View.INVISIBLE);
346 tv_yangji.setVisibility(View.VISIBLE); 356 tv_yangji.setVisibility(View.VISIBLE);
347 } else { 357 } else {
348 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.YANGJI, "0"); 358 SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.YANGJI, "0");
349 HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); 359 HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler);
350 360
351 } 361 }
352 362
353 363
354 } 364 }
355 365
356 private void initLister() { 366 private void initLister() {
357 iv_imformatioan.setOnClickListener(this); 367 iv_imformatioan.setOnClickListener(this);
358 iv_look_card.setOnClickListener(this); 368 iv_look_card.setOnClickListener(this);
359 tv_edit_presoninfo.setOnClickListener(this); 369 tv_edit_presoninfo.setOnClickListener(this);
360 iv_setting.setOnClickListener(this); 370 iv_setting.setOnClickListener(this);
361 iv_sign.setOnClickListener(this); 371 iv_sign.setOnClickListener(this);
362 tv_sign.setOnClickListener(this); 372 tv_sign.setOnClickListener(this);
363 mSimpleDraweeView.setOnClickListener(this); 373 mSimpleDraweeView.setOnClickListener(this);
364 linel_mycuoti.setOnClickListener(this); 374 linel_mycuoti.setOnClickListener(this);
365 linel_mynote.setOnClickListener(this); 375 linel_mynote.setOnClickListener(this);
366 linel_mycollege.setOnClickListener(this); 376 linel_mycollege.setOnClickListener(this);
367 linel_myclass.setOnClickListener(this); 377 linel_myclass.setOnClickListener(this);
368 378
369 } 379 }
370 380
371 @Override 381 @Override
372 public void onClick(View v) { 382 public void onClick(View v) {
373 switch (v.getId()) { 383 switch (v.getId()) {
374 case R.id.iv_imformatioan: 384 case R.id.iv_imformatioan:
375 Intent intent = new Intent(); 385 Intent intent = new Intent();
376 intent.setClass(MainActivity.this, FeedBackActivity.class); 386 intent.setClass(MainActivity.this, FeedBackActivity.class);
377 startActivity(intent); 387 startActivity(intent);
378 overridePendingTransition(R.anim.rightin, R.anim.rightout); 388 overridePendingTransition(R.anim.rightin, R.anim.rightout);
379 break; 389 break;
380 case R.id.iv_look_card: 390 case R.id.iv_look_card:
381 Intent lookintent = new Intent(); 391 Intent lookintent = new Intent();
382 lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); 392 lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class);
383 startActivity(lookintent); 393 startActivity(lookintent);
384 overridePendingTransition(R.anim.rightin, R.anim.rightout); 394 overridePendingTransition(R.anim.rightin, R.anim.rightout);
385 break; 395 break;
386 case R.id.tv_edit_presoninfo: 396 case R.id.tv_edit_presoninfo:
387 Intent editintent = new Intent(); 397 Intent editintent = new Intent();
388 editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); 398 editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class);
389 startActivity(editintent); 399 startActivity(editintent);
390 overridePendingTransition(R.anim.rightin, R.anim.rightout); 400 overridePendingTransition(R.anim.rightin, R.anim.rightout);
391 break; 401 break;
392 case R.id.iv_head: 402 case R.id.iv_head:
393 HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); 403 HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog");
394 break; 404 break;
395 case R.id.iv_setting: 405 case R.id.iv_setting:
396 mTopRightMenu = new TopRightMenu(MainActivity.this); 406 mTopRightMenu = new TopRightMenu(MainActivity.this);
397 List<MenuItem> menuItems = new ArrayList<>(); 407 List<MenuItem> menuItems = new ArrayList<>();
398 menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户")); 408 menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户"));
399 menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理")); 409 menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理"));
400 mTopRightMenu 410 mTopRightMenu
401 .setHeight(150) //默认高度480 411 .setHeight(150) //默认高度480
402 .setWidth(180) //默认宽度wrap_content 412 .setWidth(180) //默认宽度wrap_content
403 .showIcon(showIcon) //显示菜单图标,默认为true 413 .showIcon(showIcon) //显示菜单图标,默认为true
404 .dimBackground(dimBg) //背景变暗,默认为true 414 .dimBackground(dimBg) //背景变暗,默认为true
405 .needAnimationStyle(needAnim) //显示动画,默认为true 415 .needAnimationStyle(needAnim) //显示动画,默认为true
406 .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE 416 .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE
407 .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { 417 .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() {
408 @Override 418 @Override
409 public void onMenuItemClick(int position) { 419 public void onMenuItemClick(int position) {
410 switch (position) { 420 switch (position) {
411 case 0: 421 case 0:
412 new CircleDialog.Builder(MainActivity.this) 422 new CircleDialog.Builder(MainActivity.this)
413 .setCanceledOnTouchOutside(false) 423 .setCanceledOnTouchOutside(false)
414 .setWidth(0.4f) 424 .setWidth(0.4f)
415 .setCancelable(false) 425 .setCancelable(false)
416 .setText("您确定要退出,更换其他账号登录吗?") 426 .setText("您确定要退出,更换其他账号登录吗?")
417 .setNegative("取消", null) 427 .setNegative("取消", null)
418 .setPositive("确定", new View.OnClickListener() { 428 .setPositive("确定", new View.OnClickListener() {
419 @Override 429 @Override
420 public void onClick(View v) { 430 public void onClick(View v) {
421 //String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); 431 //String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS);
422 //int graderIDs = Integer.parseInt(graderID); 432 //int graderIDs = Integer.parseInt(graderID);
423 // if (graderIDs < 8) { 433 // if (graderIDs < 8) {
424 // Intent intentbroad = new Intent(); 434 // Intent intentbroad = new Intent();
425 // intentbroad.putExtra("info", "小学"); 435 // intentbroad.putExtra("info", "小学");
426 // //4、定义广播发送的action 436 // //4、定义广播发送的action
427 // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); 437 // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE");
428 // //5、发送广播 438 // //5、发送广播
429 // sendBroadcast(intentbroad); 439 // sendBroadcast(intentbroad);
430 // Log.i("---", "发送完了"); 440 // Log.i("---", "发送完了");
431 // } 441 // }
432 //清除数据 442 //清除数据
433 SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.ACCOUNT, "1"); 443 SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.ACCOUNT, "1");
434 SaveParam.getInstance().clearData(MainActivity.this); 444 SaveParam.getInstance().clearData(MainActivity.this);
435 Intent settingintent = new Intent(); 445 Intent settingintent = new Intent();
436 settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); 446 settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class);
437 startActivity(settingintent); 447 startActivity(settingintent);
438 overridePendingTransition(R.anim.rightin, R.anim.rightout); 448 overridePendingTransition(R.anim.rightin, R.anim.rightout);
439 finish(); 449 finish();
440 } 450 }
441 }) 451 })
442 .show(); 452 .show();
443 break; 453 break;
444 case 1: 454 case 1:
445 Intent accontMintent = new Intent(); 455 Intent accontMintent = new Intent();
446 accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); 456 accontMintent.setClass(MainActivity.this, AccountManagementActivity.class);
447 startActivity(accontMintent); 457 startActivity(accontMintent);
448 overridePendingTransition(R.anim.rightin, R.anim.rightout); 458 overridePendingTransition(R.anim.rightin, R.anim.rightout);
449 break; 459 break;
450 } 460 }
451 } 461 }
452 }) 462 })
453 .addMenuList(menuItems) 463 .addMenuList(menuItems)
454 .showAsDropDown(iv_setting, -120, 0); 464 .showAsDropDown(iv_setting, -120, 0);
455 break; 465 break;
456 case R.id.iv_sign: 466 case R.id.iv_sign:
457 case R.id.tv_sign: 467 case R.id.tv_sign:
458 new CircleDialog.Builder(this) 468 new CircleDialog.Builder(this)
459 .setCanceledOnTouchOutside(false) 469 .setCanceledOnTouchOutside(false)
460 .setCancelable(true) 470 .setCancelable(true)
461 .setTitle("个性签名") 471 .setTitle("个性签名")
462 .setInputHint("请输入个性签名") 472 .setInputHint("请输入个性签名")
463 .setWidth(0.4f) 473 .setWidth(0.4f)
464 .setInputHeight(80) 474 .setInputHeight(80)
465 .configInput(new ConfigInput() { 475 .configInput(new ConfigInput() {
466 @Override 476 @Override
467 public void onConfig(InputParams params) { 477 public void onConfig(InputParams params) {
468 // params.inputBackgroundResourceId = R.drawable.bg_input; 478 // params.inputBackgroundResourceId = R.drawable.bg_input;
469 } 479 }
470 }) 480 })
471 .setNegative("取消", new View.OnClickListener() { 481 .setNegative("取消", new View.OnClickListener() {
472 @Override 482 @Override
473 public void onClick(View v) { 483 public void onClick(View v) {
474 RecyclerViewadapterpublish.notifyDataSetChanged(); 484 RecyclerViewadapterpublish.notifyDataSetChanged();
475 } 485 }
476 }) 486 })
477 .setPositiveInput("确定", new OnInputClickListener() { 487 .setPositiveInput("确定", new OnInputClickListener() {
478 @Override 488 @Override
479 public void onClick(String text, View v) { 489 public void onClick(String text, View v) {
480 if (text.equals("")) { 490 if (text.equals("")) {
481 AlertUtils.showToast(MainActivity.this, "请输入个性签名"); 491 AlertUtils.showToast(MainActivity.this, "请输入个性签名");
482 } else { 492 } else {
483 try { 493 try {
484 String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); 494 String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT);
485 String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); 495 String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId");
486 String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); 496 String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID);
487 Object id = null; 497 Object id = null;
488 long auserID = Long.parseLong(userID); 498 long auserID = Long.parseLong(userID);
489 int typeaccount1 = Integer.parseInt(typeaccount); 499 int typeaccount1 = Integer.parseInt(typeaccount);
490 if (typeaccount1 == 2) { 500 if (typeaccount1 == 2) {
491 id = childsID; 501 id = childsID;
492 } else { 502 } else {
493 id = auserID; 503 id = auserID;
494 } 504 }
495 HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text); 505 HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text);
496 RecyclerViewadapterpublish.notifyDataSetChanged(); 506 RecyclerViewadapterpublish.notifyDataSetChanged();
497 } catch (NumberFormatException e) { 507 } catch (NumberFormatException e) {
498 e.printStackTrace(); 508 e.printStackTrace();
499 } 509 }
500 510
501 tv_sign.setText(text); 511 tv_sign.setText(text);
502 } 512 }
503 513
504 } 514 }
505 }) 515 })
506 .show(); 516 .show();
507 break; 517 break;
508 case R.id.linel_mycuoti: 518 case R.id.linel_mycuoti:
509 AlertUtils.showToast(this, "未安装该应用 "); 519 AlertUtils.showToast(this, "未安装该应用 ");
510 break; 520 break;
511 case R.id.linel_mynote: 521 case R.id.linel_mynote:
512 AlertUtils.showToast(this, "未安装该应用 "); 522 AlertUtils.showToast(this, "未安装该应用 ");
513 break; 523 break;
514 case R.id.linel_mycollege: 524 case R.id.linel_mycollege:
515 AlertUtils.showToast(this, "未安装该应用 "); 525 AlertUtils.showToast(this, "未安装该应用 ");
516 break; 526 break;
517 case R.id.linel_myclass: 527 case R.id.linel_myclass:
518 AlertUtils.showToast(this, "未安装该应用 "); 528 AlertUtils.showToast(this, "未安装该应用 ");
519 break; 529 break;
520 } 530 }
521 531
522 } 532 }
523 533
524 @Override 534 @Override
525 protected void onPause() { 535 protected void onPause() {
526 super.onPause(); 536 super.onPause();
527 } 537 }
528 538
529 @Override 539 @Override
530 protected void onResume() { 540 protected void onResume() {
531 super.onResume(); 541 super.onResume();
532 Content.changegradeinfoflag = 0; 542 Content.changegradeinfoflag = 0;
533 Content.changeadressinfoflag = 0; 543 Content.changeadressinfoflag = 0;
534 String userID = SaveParam.getInstance().getLoginParam(this, "userId"); 544 String userID = SaveParam.getInstance().getLoginParam(this, "userId");
535 //获取个性签名 545 //获取个性签名
536 String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); 546 String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT);
537 String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); 547 String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID);
538 548
539 try { 549 try {
540 Object auserID = 1; 550 Object auserID = 1;
541 long id = Long.parseLong(userID); 551 long id = Long.parseLong(userID);
542 int typeaccount1 = Integer.parseInt(typeaccount); 552 int typeaccount1 = Integer.parseInt(typeaccount);
543 //获取个人信息 553 //获取个人信息
544 HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler); 554 HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler);
545 if (typeaccount1 == 2) { 555 if (typeaccount1 == 2) {
546 auserID = childsID; 556 auserID = childsID;
547 } else { 557 } else {
548 auserID = id; 558 auserID = id;
549 } 559 }
550 Log.e("test", "个性签名的ID" + auserID); 560 Log.e("test", "个性签名的ID" + auserID);
551 HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); 561 HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler);
552 //获取最近播放视频 562 //获取最近播放视频
553 HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); 563 HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler);
554 564
555 } catch (NumberFormatException e) { 565 } catch (NumberFormatException e) {
556 e.printStackTrace(); 566 e.printStackTrace();
557 } 567 }
558 568
559 } 569 }
560 570
561 //回调头像监听 571 //回调头像监听
562 @Override 572 @Override
563 public void heard(Context context, View v, int headpitiaon) { 573 public void heard(Context context, View v, int headpitiaon) {
564 String picUrl = ""; 574 String picUrl = "";
565 String userID; 575 String userID;
566 String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); 576 String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT);
567 if ("2".equals(typeaccount)) { 577 if ("2".equals(typeaccount)) {
568 userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); 578 userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID);
569 } else { 579 } else {
570 userID = SaveParam.getInstance().getLoginParam(this, "userId"); 580 userID = SaveParam.getInstance().getLoginParam(this, "userId");
571 } 581 }
572 switch (v.getId()) { 582 switch (v.getId()) {
573 //选择默认图片 583 //选择默认图片
574 case R.id.oktakephone: 584 case R.id.oktakephone:
575 if (headpitiaon == 1) { 585 if (headpitiaon == 1) {
576 mSimpleDraweeView.setImageDrawable(null); 586 mSimpleDraweeView.setImageDrawable(null);
577 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); 587 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1);
578 picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/75f05c02-3dbc-44e3-aec9-a73eca60ca8b.png"; 588 picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/75f05c02-3dbc-44e3-aec9-a73eca60ca8b.png";
579 try { 589 try {
580 HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); 590 HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl);
581 } catch (UnsupportedEncodingException e) { 591 } catch (UnsupportedEncodingException e) {
582 e.printStackTrace(); 592 e.printStackTrace();
583 } 593 }
584 } else if (headpitiaon == 2) { 594 } else if (headpitiaon == 2) {
585 mSimpleDraweeView.setImageDrawable(null); 595 mSimpleDraweeView.setImageDrawable(null);
586 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); 596 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2);
587 picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/d102b0d8-435f-45a5-908f-ea43e02176d4.png"; 597 picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/d102b0d8-435f-45a5-908f-ea43e02176d4.png";
588 try { 598 try {
589 HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); 599 HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl);
590 } catch (UnsupportedEncodingException e) { 600 } catch (UnsupportedEncodingException e) {
591 e.printStackTrace(); 601 e.printStackTrace();
592 } 602 }
593 } else if (headpitiaon == 3) { 603 } else if (headpitiaon == 3) {
594 mSimpleDraweeView.setImageDrawable(null); 604 mSimpleDraweeView.setImageDrawable(null);
595 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); 605 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3);
596 picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/a623a8ba-5e56-4827-95d1-ffeb0d6874d5.png"; 606 picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/a623a8ba-5e56-4827-95d1-ffeb0d6874d5.png";
597 try { 607 try {
598 HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); 608 HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl);
599 } catch (UnsupportedEncodingException e) { 609 } catch (UnsupportedEncodingException e) {
600 e.printStackTrace(); 610 e.printStackTrace();
601 } 611 }
602 } else if (headpitiaon == 4) { 612 } else if (headpitiaon == 4) {
603 mSimpleDraweeView.setImageDrawable(null); 613 mSimpleDraweeView.setImageDrawable(null);
604 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); 614 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4);
605 picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/3d822736-a18d-47ae-b0b1-67752e027375.png"; 615 picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/3d822736-a18d-47ae-b0b1-67752e027375.png";
606 try { 616 try {
607 HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); 617 HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl);
608 } catch (UnsupportedEncodingException e) { 618 } catch (UnsupportedEncodingException e) {
609 e.printStackTrace(); 619 e.printStackTrace();
610 } 620 }
611 } else { 621 } else {
612 mSimpleDraweeView.setImageDrawable(null); 622 mSimpleDraweeView.setImageDrawable(null);
613 mSimpleDraweeView.setImageResource(R.mipmap.header_default); 623 mSimpleDraweeView.setImageResource(R.mipmap.header_default);
614 ; 624 ;
615 } 625 }
616 626
617 break; 627 break;
618 case R.id.canceltakephone: 628 case R.id.canceltakephone:
619 629
620 break; 630 break;
621 //拍摄和相册 631 //拍摄和相册
622 case R.id.take_pic: 632 case R.id.take_pic:
623 if (PermissionUtil.hasCameraPermission(MainActivity.this)) { 633 if (PermissionUtil.hasCameraPermission(MainActivity.this)) {
624 uploadAvatarFromPhotoRequest(); 634 uploadAvatarFromPhotoRequest();
625 } 635 }
626 break; 636 break;
627 case R.id.xiangce: 637 case R.id.xiangce:
628 uploadAvatarFromAlbumRequest(); 638 uploadAvatarFromAlbumRequest();
629 break; 639 break;
630 640
631 } 641 }
632 642
633 } 643 }
634 644
635 //照相 645 //照相
636 private void uploadAvatarFromPhotoRequest() { 646 private void uploadAvatarFromPhotoRequest() {
637 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 647 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
638 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 648 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
639 intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); 649 intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0);
640 intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); 650 intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
641 startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); 651 startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO);
642 } 652 }
643 653
644 //选择图库 654 //选择图库
645 private void uploadAvatarFromAlbumRequest() { 655 private void uploadAvatarFromAlbumRequest() {
646 Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); 656 Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
647 photoPickerIntent.setType("image/*"); 657 photoPickerIntent.setType("image/*");
648 startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); 658 startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM);
649 } 659 }
650 660
651 //回掉 661 //回掉
652 @Override 662 @Override
653 protected void onActivityResult(int requestCode, int resultCode, Intent data) { 663 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
654 super.onActivityResult(requestCode, resultCode, data); 664 super.onActivityResult(requestCode, resultCode, data);
655 if (resultCode != -1) { 665 if (resultCode != -1) {
656 return; 666 return;
657 } 667 }
658 if (requestCode == REQUEST_CODE_ALBUM && data != null) { 668 if (requestCode == REQUEST_CODE_ALBUM && data != null) {
659 Uri newUri; 669 Uri newUri;
660 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { 670 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
661 newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); 671 newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData()));
662 } else { 672 } else {
663 newUri = data.getData(); 673 newUri = data.getData();
664 } 674 }
665 if (newUri != null) { 675 if (newUri != null) {
666 startPhotoZoom(newUri); 676 startPhotoZoom(newUri);
667 } else { 677 } else {
668 Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); 678 Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show();
669 } 679 }
670 } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { 680 } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) {
671 //startPhotoZoom(uri); 681 //startPhotoZoom(uri);
672 uploadAvatarFromPhoto(); 682 uploadAvatarFromPhoto();
673 } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { 683 } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) {
674 uploadAvatarFromPhoto(); 684 uploadAvatarFromPhoto();
675 } 685 }
676 } 686 }
677 687
678 private void uploadAvatarFromPhoto() { 688 private void uploadAvatarFromPhoto() {
679 compressAndUploadAvatar(file.getPath()); 689 compressAndUploadAvatar(file.getPath());
680 690
681 } 691 }
682 692
683 private void compressAndUploadAvatar(String fileSrc) { 693 private void compressAndUploadAvatar(String fileSrc) {
684 694
685 695
686 //上传到服务器 696 //上传到服务器
687 697
688 final File cover = FileUtil.getSmallBitmap(this, fileSrc); 698 final File cover = FileUtil.getSmallBitmap(this, fileSrc);
689 String mimeType = "image/*"; 699 String mimeType = "image/*";
690 //requestBody = RequestBody.create(MediaType.parse(mimeType), file); 700 //requestBody = RequestBody.create(MediaType.parse(mimeType), file);
691 //String fileName = cover.getName(); 701 //String fileName = cover.getName();
692 String userID; 702 String userID;
693 String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); 703 String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT);
694 if ("2".equals(typeaccount)) { 704 if ("2".equals(typeaccount)) {
695 userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); 705 userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID);
696 } else { 706 } else {
697 userID = SaveParam.getInstance().getLoginParam(this, "userId"); 707 userID = SaveParam.getInstance().getLoginParam(this, "userId");
698 } 708 }
699 709
700 //上传头像 710 //上传头像
701 711
702 try { 712 try {
703 HttpManager.getInstance().header(this, userID, typeaccount, fileSrc,handler); 713 HttpManager.getInstance().header(this, userID, typeaccount, fileSrc,handler);
704 } catch (UnsupportedEncodingException e) { 714 } catch (UnsupportedEncodingException e) {
705 e.printStackTrace(); 715 e.printStackTrace();
706 } 716 }
707 //mSimpleDraweeView.setImageURI(Uri.fromFile(new File(fileSrc))); 717 //mSimpleDraweeView.setImageURI(Uri.fromFile(new File(fileSrc)));
708 718
709 // GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); 719 // GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());
710 // GenericDraweeHierarchy hierarchy = builder 720 // GenericDraweeHierarchy hierarchy = builder
711 // .setDesiredAspectRatio(1f) 721 // .setDesiredAspectRatio(1f)
712 // .setFailureImage(R.mipmap.header_default) 722 // .setFailureImage(R.mipmap.header_default)
713 // //圆形头像 723 // //圆形头像
714 // .setRoundingParams(RoundingParams.asCircle()) 724 // .setRoundingParams(RoundingParams.asCircle())
715 // .build(); 725 // .build();
716 // //OOM 726 // //OOM
717 // ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) 727 // ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
718 // //根据View的尺寸放缩图片 728 // //根据View的尺寸放缩图片
719 // .setResizeOptions(new ResizeOptions(mSimpleDraweeView.getWidth(), mSimpleDraweeView.getHeight())) 729 // .setResizeOptions(new ResizeOptions(mSimpleDraweeView.getWidth(), mSimpleDraweeView.getHeight()))
720 // .build(); 730 // .build();
721 // 731 //
722 // 732 //
723 // //加载本地图片 733 // //加载本地图片
724 // Uri uri = Uri.fromFile(cover); 734 // Uri uri = Uri.fromFile(cover);
725 //Picasso.with(MainActivity.this).load(uri).placeholder(R.mipmap.header_default).error(R.mipmap.header_default).transform(new RoundTransform(1000)).into(mSimpleDraweeView); 735 //Picasso.with(MainActivity.this).load(uri).placeholder(R.mipmap.header_default).error(R.mipmap.header_default).transform(new RoundTransform(1000)).into(mSimpleDraweeView);
726 // DraweeController controller = Fresco.newDraweeControllerBuilder() 736 // DraweeController controller = Fresco.newDraweeControllerBuilder()
727 // .setOldController(mSimpleDraweeView.getController()) 737 // .setOldController(mSimpleDraweeView.getController())
728 // .setImageRequest(request) 738 // .setImageRequest(request)
729 // .setUri(uri) 739 // .setUri(uri)
730 // .build(); 740 // .build();
731 // mSimpleDraweeView.setHierarchy(hierarchy); 741 // mSimpleDraweeView.setHierarchy(hierarchy);
732 // mSimpleDraweeView.setController(controller); 742 // mSimpleDraweeView.setController(controller);
733 743
734 } 744 }
735 745
736 public void startPhotoZoom(Uri uri) { 746 public void startPhotoZoom(Uri uri) {
737 Intent intent = new Intent("com.android.camera.action.CROP"); 747 Intent intent = new Intent("com.android.camera.action.CROP");
738 intent.setDataAndType(uri, "image/*"); 748 intent.setDataAndType(uri, "image/*");
739 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 749 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
740 intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. 750 intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面.
741 intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. 751 intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例.
742 intent.putExtra("aspectY", 1);// x:y=1:1 752 intent.putExtra("aspectY", 1);// x:y=1:1
743 // intent.putExtra("outputX", 400);//图片输出大小 753 // intent.putExtra("outputX", 400);//图片输出大小
744 // intent.putExtra("outputY", 400); 754 // intent.putExtra("outputY", 400);
745 intent.putExtra("output", Uri.fromFile(file)); 755 intent.putExtra("output", Uri.fromFile(file));
746 intent.putExtra("outputFormat", "JPEG");// 返回格式 756 intent.putExtra("outputFormat", "JPEG");// 返回格式
747 startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); 757 startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO);
748 } 758 }
749 759
750 @Override 760 @Override
751 public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { 761 public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
752 switch (requestCode) { 762 switch (requestCode) {
753 763
754 case PermissionUtil.REQUEST_SHOWCAMERA: 764 case PermissionUtil.REQUEST_SHOWCAMERA:
755 if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { 765 if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
756 // Permission Granted 766 // Permission Granted
757 uploadAvatarFromPhotoRequest(); 767 uploadAvatarFromPhotoRequest();
758 768
759 } else { 769 } else {
760 if (!SharedPreferenceMark.getHasShowCamera()) { 770 if (!SharedPreferenceMark.getHasShowCamera()) {
761 SharedPreferenceMark.setHasShowCamera(true); 771 SharedPreferenceMark.setHasShowCamera(true);
762 new DialogPermission(this, "关闭摄像头权限影响扫描功能"); 772 new DialogPermission(this, "关闭摄像头权限影响扫描功能");
763 773
764 } else { 774 } else {
765 Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) 775 Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT)
766 .show(); 776 .show();
767 } 777 }
768 } 778 }
769 break; 779 break;
770 default: 780 default:
771 super.onRequestPermissionsResult(requestCode, permissions, grantResults); 781 super.onRequestPermissionsResult(requestCode, permissions, grantResults);
772 } 782 }
773 } 783 }
774 784
775 785
776 private long exitTime = 0; 786 private long exitTime = 0;
777 787
778 @Override 788 @Override
779 public boolean onKeyDown(int keyCode, KeyEvent event) { 789 public boolean onKeyDown(int keyCode, KeyEvent event) {
780 if (keyCode == KeyEvent.KEYCODE_BACK) { 790 if (keyCode == KeyEvent.KEYCODE_BACK) {
781 if ((System.currentTimeMillis() - exitTime) > 2000) { 791 if ((System.currentTimeMillis() - exitTime) > 2000) {
782 Toast.makeText(getApplicationContext(), "再按一次退出程序", 792 Toast.makeText(getApplicationContext(), "再按一次退出程序",
783 Toast.LENGTH_SHORT).show(); 793 Toast.LENGTH_SHORT).show();
784 exitTime = System.currentTimeMillis(); 794 exitTime = System.currentTimeMillis();
785 } else { 795 } else {
786 //SysApplication.getInstance().finishActivity(MainActivity.this); 796 //SysApplication.getInstance().finishActivity(MainActivity.this);
787 SysApplication.getInstance().exit(); 797 SysApplication.getInstance().exit();
788 } 798 }
789 return false; 799 return false;
790 } 800 }
791 return super.onKeyDown(keyCode, event); 801 return super.onKeyDown(keyCode, event);
792 } 802 }
793 } 803 }
794 804
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpClient.java
1 package com.hjx.personalcenter.http; 1 package com.hjx.personalcenter.http;
2 2
3 3
4 import android.os.Build;
5
6 import com.hjx.personalcenter.R;
7 import com.hjx.personalcenter.activity.MyApplication;
8 import com.hjx.personalcenter.util.VersionCodeUtils;
4 import com.loopj.android.http.AsyncHttpClient; 9 import com.loopj.android.http.AsyncHttpClient;
5 10
6 public class HttpClient extends AsyncHttpClient { 11 public class HttpClient extends AsyncHttpClient {
7 private static HttpClient client; 12 private static HttpClient client;
8 13
9 public static HttpClient getInstance() { 14 public static HttpClient getInstance() {
10 if(client == null) { 15 if(client == null) {
11 client = new HttpClient(); 16 client = new HttpClient();
17 client.addHeader("app-name", MyApplication.getInstance().getString(R.string.app_name));
18 client.addHeader("device-model", Build.MODEL);
19 client.addHeader("device-number", Build.SERIAL);
20 client.addHeader("os-type", "Android");
21 client.addHeader("os-version", Build.VERSION.RELEASE);
22 client.addHeader("pid", MyApplication.getInstance().getPackageName());
23 client.addHeader("version-code", VersionCodeUtils.getVersionCode()+"");
24 client.addHeader("version-name", VersionCodeUtils.getVerName());
12 } 25 }
13 return client; 26 return client;
14 } 27 }
15 private HttpClient() {} 28 private HttpClient() {}
16 29
17 30
18 } 31 }
19 32
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
1 package com.hjx.personalcenter.http; 1 package com.hjx.personalcenter.http;
2 2
3 /** 3 /**
4 * Created by wei on 2017/6/21. 4 * Created by wei on 2017/6/21.
5 */ 5 */
6 6
7 public class HttpCode { 7 public class HttpCode {
8 //查询保卡信息 8 //查询保卡信息
9 public static final int SUCHCARDINFO = 0; 9 public static final int SUCHCARDINFO = 0;
10 //是否填写保卡信息 10 //是否填写保卡信息
11 public static final int CHECKCARD = 1; 11 public static final int CHECKCARD = 1;
12 //注册 12 //注册
13 public static final int REGISTERED_SUCESS = 2; 13 public static final int REGISTERED_SUCESS = 2;
14 public static final int REGISTERED_FAIL = 3; 14 public static final int REGISTERED_FAIL = 3;
15 //注册验证码 15 //注册验证码
16 public static final int AUTHCODE_SUCESS = 4; 16 public static final int AUTHCODE_SUCESS = 4;
17 public static final int AUTHCODE_FAIL = 5; 17 public static final int AUTHCODE_FAIL = 5;
18 //忘记密码验证码 18 //忘记密码验证码
19 public static final int AUTHCODE_SUCESS1 = 6; 19 public static final int AUTHCODE_SUCESS1 = 6;
20 public static final int AUTHCODE_FAIL1 = 7; 20 public static final int AUTHCODE_FAIL1 = 7;
21 //是否已经注册 21 //是否已经注册
22 public static final int IS_REFISTER = 8; 22 public static final int IS_REFISTER = 8;
23 //忘记密码 23 //忘记密码
24 public static final int PASSWORD_SUCESS = 9; 24 public static final int PASSWORD_SUCESS = 9;
25 public static final int PASSWORD_FAIL = 10; 25 public static final int PASSWORD_FAIL = 10;
26 //s省 26 //s省
27 public static final int PROVICES = 11; 27 public static final int PROVICES = 11;
28 //市 28 //市
29 public static final int CITYS = 12; 29 public static final int CITYS = 12;
30 //区 30 //区
31 public static final int COUNTRY = 13; 31 public static final int COUNTRY = 13;
32 //学校 32 //学校
33 public static final int SCHOOL = 14; 33 public static final int SCHOOL = 14;
34 //年级 34 //年级
35 public static final int GRADER = 15; 35 public static final int GRADER = 15;
36 //获取个人信息 36 //获取个人信息
37 public static final int GETINFO = 16; 37 public static final int GETINFO = 16;
38 //获取个性签名 38 //获取个性签名
39 public static final int SIGN = 17; 39 public static final int SIGN = 17;
40 //登录 40 //登录
41 public static final int LOGIN_SUCESS = 18; 41 public static final int LOGIN_SUCESS = 18;
42 //获取子账户信息 42 //获取子账户信息
43 public static final int CHILDS_SUCESS = 19; 43 public static final int CHILDS_SUCESS = 19;
44 //版本升级 44 //版本升级
45 public static final int APPUPDATE_SUCESS = 20; 45 public static final int APPUPDATE_SUCESS = 20;
46 //获取出版社 46 //获取出版社
47 public static final int VERSION_SUCESS = 22; 47 public static final int VERSION_SUCESS = 22;
48 //注册信息是否完整 48 //注册信息是否完整
49 public static final int REGISTER_SUCESS = 23; 49 public static final int REGISTER_SUCESS = 23;
50 //获取默认版本信息 50 //获取默认版本信息
51 public static final int PUBLISH_SUCESS = 24; 51 public static final int PUBLISH_SUCESS = 24;
52 //注册信息提交 52 //注册信息提交
53 public static final int REGISTERINFO_SUCESS = 25; 53 public static final int REGISTERINFO_SUCESS = 25;
54 //获取视频信息 54 //获取视频信息
55 public static final int GETVIDIO_SUCESS = 26; 55 public static final int GETVIDIO_SUCESS = 26;
56 //查询保卡信息1 56 //查询保卡信息1
57 public static final int SUCHCARDINFOONE = 27; 57 public static final int SUCHCARDINFOONE = 27;
58 //个人信息 58 //个人信息
59 public static final int PESERNAOL = 28; 59 public static final int PESERNAOL = 28;
60 //touxan 60 //touxan
61 public static final int TOUXIANG = 29; 61 public static final int TOUXIANG = 29;
62 //学校 62 //学校
63 public static final int SCOOL = 29; 63 public static final int SCOOL = 29;
64 //每天POST设备号,需要重新登录
65 public static final int RELOGIN = 30;
64 66
65 67
66 } 68 }
67 69
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
1 package com.hjx.personalcenter.http; 1 package com.hjx.personalcenter.http;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.app.ProgressDialog; 4 import android.app.ProgressDialog;
5 import android.content.Context; 5 import android.content.Context;
6 import android.content.Intent; 6 import android.content.Intent;
7 import android.os.Build;
7 import android.os.Handler; 8 import android.os.Handler;
8 import android.os.Message; 9 import android.os.Message;
9 import android.support.v4.app.FragmentActivity; 10 import android.support.v4.app.FragmentActivity;
10 import android.util.Log; 11 import android.util.Log;
11 import android.view.KeyEvent; 12 import android.view.KeyEvent;
12 import android.widget.Toast; 13 import android.widget.Toast;
13 14
14 import com.google.gson.Gson; 15 import com.google.gson.Gson;
15 import com.google.gson.reflect.TypeToken; 16 import com.google.gson.reflect.TypeToken;
16 import com.hjx.personalcenter.R; 17 import com.hjx.personalcenter.R;
17 import com.hjx.personalcenter.activity.BangDingCode; 18 import com.hjx.personalcenter.activity.BangDingCode;
18 import com.hjx.personalcenter.activity.LoginAndRegisterActivity; 19 import com.hjx.personalcenter.activity.LoginAndRegisterActivity;
19 import com.hjx.personalcenter.activity.TheStartPageActivity; 20 import com.hjx.personalcenter.activity.TheStartPageActivity;
20 import com.hjx.personalcenter.customdialog.IllegalDialog; 21 import com.hjx.personalcenter.customdialog.IllegalDialog;
21 import com.hjx.personalcenter.db.Content; 22 import com.hjx.personalcenter.db.Content;
22 import com.hjx.personalcenter.db.SaveParam; 23 import com.hjx.personalcenter.db.SaveParam;
23 import com.hjx.personalcenter.gson.GsonTool; 24 import com.hjx.personalcenter.gson.GsonTool;
24 import com.hjx.personalcenter.model.AppVersion; 25 import com.hjx.personalcenter.model.AppVersion;
25 import com.hjx.personalcenter.model.CardInfo; 26 import com.hjx.personalcenter.model.CardInfo;
26 import com.hjx.personalcenter.model.ChildsInfo; 27 import com.hjx.personalcenter.model.ChildsInfo;
27 import com.hjx.personalcenter.model.CityInfo; 28 import com.hjx.personalcenter.model.CityInfo;
28 import com.hjx.personalcenter.model.CountyInfo; 29 import com.hjx.personalcenter.model.CountyInfo;
29 import com.hjx.personalcenter.model.DefautPublishInfo; 30 import com.hjx.personalcenter.model.DefautPublishInfo;
30 import com.hjx.personalcenter.model.GradeInfo; 31 import com.hjx.personalcenter.model.GradeInfo;
31 import com.hjx.personalcenter.model.PesonalInfo; 32 import com.hjx.personalcenter.model.PesonalInfo;
32 import com.hjx.personalcenter.model.ProvinceInfo; 33 import com.hjx.personalcenter.model.ProvinceInfo;
33 import com.hjx.personalcenter.model.SchoolInfo; 34 import com.hjx.personalcenter.model.SchoolInfo;
34 import com.hjx.personalcenter.model.SignInfo; 35 import com.hjx.personalcenter.model.SignInfo;
35 import com.hjx.personalcenter.model.VersionInfo; 36 import com.hjx.personalcenter.model.VersionInfo;
36 import com.hjx.personalcenter.model.VideoInfo; 37 import com.hjx.personalcenter.model.VideoInfo;
37 import com.hjx.personalcenter.util.AlertUtils; 38 import com.hjx.personalcenter.util.AlertUtils;
38 import com.hjx.personalcenter.util.DialogPermission; 39 import com.hjx.personalcenter.util.DialogPermission;
40 import com.hjx.personalcenter.util.GetDevicesUtil;
39 import com.loopj.android.http.AsyncHttpResponseHandler; 41 import com.loopj.android.http.AsyncHttpResponseHandler;
40 import com.loopj.android.http.JsonHttpResponseHandler; 42 import com.loopj.android.http.JsonHttpResponseHandler;
41 import com.loopj.android.http.RequestParams; 43 import com.loopj.android.http.RequestParams;
42 44
43 import org.apache.http.Header; 45 import org.apache.http.Header;
44 import org.apache.http.entity.ByteArrayEntity; 46 import org.apache.http.entity.ByteArrayEntity;
45 import org.apache.http.message.BasicHeader; 47 import org.apache.http.message.BasicHeader;
46 import org.apache.http.protocol.HTTP; 48 import org.apache.http.protocol.HTTP;
47 import org.json.JSONException; 49 import org.json.JSONException;
48 import org.json.JSONObject; 50 import org.json.JSONObject;
49 51
50 import java.io.File; 52 import java.io.File;
51 import java.io.FileNotFoundException; 53 import java.io.FileNotFoundException;
52 import java.io.UnsupportedEncodingException; 54 import java.io.UnsupportedEncodingException;
53 import java.util.ArrayList; 55 import java.util.ArrayList;
54 import java.util.List; 56 import java.util.List;
55 57
56 public class HttpManager { 58 public class HttpManager {
57 private static HttpManager instance; 59 private static HttpManager instance;
58 private ProgressDialog mProgress = null; 60 private ProgressDialog mProgress = null;
59 61
60 public static HttpManager getInstance() { 62 public static HttpManager getInstance() {
61 if (instance == null) { 63 if (instance == null) {
62 instance = new HttpManager(); 64 instance = new HttpManager();
63 } 65 }
64 return instance; 66 return instance;
65 } 67 }
66 68
67 69
68 //登录接口 70 //登录接口
69 71
70 public void login(final String username, final String password, final Context mContext, final Handler handler) { 72 public void login(final String username, final String password, final Context mContext, final Handler handler) {
71 mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", 73 mProgress = DialogPermission.showProgress(mContext, null, "正在登录...",
72 true, true, null); 74 true, true, null);
73 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 75 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
76 HttpClient.getInstance().addHeader("device-number", Build.SERIAL);
74 HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { 77 HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() {
75 @Override 78 @Override
76 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 79 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
77 closeProgress(); 80 closeProgress();
78 Message msg = Message.obtain(); 81 Message msg = Message.obtain();
79 msg.what = HttpCode.LOGIN_SUCESS; 82 msg.what = HttpCode.LOGIN_SUCESS;
80 msg.obj = new String(arg2); 83 msg.obj = new String(arg2);
81 handler.sendMessage(msg); 84 handler.sendMessage(msg);
82 85
83 86
84 } 87 }
85 88
86 @Override 89 @Override
87 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 90 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
88 closeProgress(); 91 closeProgress();
89 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 92 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
90 } 93 }
91 }); 94 });
92 } 95 }
93 96
94 //注册接口 97 //注册接口
95 public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { 98 public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) {
96 mProgress = DialogPermission.showProgress(context, null, "正在注册...", 99 mProgress = DialogPermission.showProgress(context, null, "正在注册...",
97 false, true, null); 100 false, true, null);
98 JSONObject jsonObject = new JSONObject(); 101 JSONObject jsonObject = new JSONObject();
99 ByteArrayEntity entity = null; 102 ByteArrayEntity entity = null;
100 try { 103 try {
101 jsonObject.put(HttpKey.USERNAME, username); 104 jsonObject.put(HttpKey.USERNAME, username);
102 jsonObject.put(HttpKey.PASSWORD, password); 105 jsonObject.put(HttpKey.PASSWORD, password);
103 jsonObject.put(HttpKey.SMSCODE, smscode); 106 jsonObject.put(HttpKey.SMSCODE, smscode);
104 jsonObject.put(HttpKey.SOURCE, source); 107 jsonObject.put(HttpKey.SOURCE, source);
105 Log.e("test", "jsonObject" + jsonObject); 108 Log.e("test", "jsonObject" + jsonObject);
106 entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); 109 entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8"));
107 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); 110 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
108 } catch (JSONException e) { 111 } catch (JSONException e) {
109 e.printStackTrace(); 112 e.printStackTrace();
110 } catch (UnsupportedEncodingException e) { 113 } catch (UnsupportedEncodingException e) {
111 e.printStackTrace(); 114 e.printStackTrace();
112 } 115 }
113 HttpClient.getInstance().addHeader("Accept", "*/*"); 116 HttpClient.getInstance().addHeader("Accept", "*/*");
114 HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { 117 HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() {
115 @Override 118 @Override
116 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 119 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
117 super.onSuccess(statusCode, headers, response); 120 super.onSuccess(statusCode, headers, response);
118 closeProgress(); 121 closeProgress();
119 Log.e("test", "onSuccess" + response); 122 Log.e("test", "onSuccess" + response);
120 Message msg = Message.obtain(); 123 Message msg = Message.obtain();
121 msg.what = HttpCode.REGISTERED_SUCESS; 124 msg.what = HttpCode.REGISTERED_SUCESS;
122 msg.obj = response; 125 msg.obj = response;
123 handler.sendMessage(msg); 126 handler.sendMessage(msg);
124 127
125 } 128 }
126 129
127 @Override 130 @Override
128 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 131 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
129 super.onFailure(statusCode, headers, throwable, errorResponse); 132 super.onFailure(statusCode, headers, throwable, errorResponse);
130 closeProgress(); 133 closeProgress();
131 Log.e("test", "onFailure" + errorResponse); 134 Log.e("test", "onFailure" + errorResponse);
132 AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); 135 AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!");
133 } 136 }
134 137
135 }); 138 });
136 } 139 }
137 140
138 //注册验证码 141 //注册验证码
139 public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { 142 public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) {
140 RequestParams params = new RequestParams(); 143 RequestParams params = new RequestParams();
141 params.put(HttpKey.TYPE, type); 144 params.put(HttpKey.TYPE, type);
142 params.put(HttpKey.MOBIL, mobile); 145 params.put(HttpKey.MOBIL, mobile);
143 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 146 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
144 HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { 147 HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() {
145 148
146 @Override 149 @Override
147 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 150 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
148 Log.e("test", "onSuccess-----" + response); 151 Log.e("test", "onSuccess-----" + response);
149 Message msg = Message.obtain(); 152 Message msg = Message.obtain();
150 msg.what = HttpCode.AUTHCODE_SUCESS; 153 msg.what = HttpCode.AUTHCODE_SUCESS;
151 msg.obj = response; 154 msg.obj = response;
152 handler.sendMessage(msg); 155 handler.sendMessage(msg);
153 } 156 }
154 157
155 @Override 158 @Override
156 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 159 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
157 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 160 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
158 } 161 }
159 }); 162 });
160 } 163 }
161 164
162 165
163 //手机号是否注册 166 //手机号是否注册
164 public void isregistered(final String mobile, final Handler handler, final Context mContext) { 167 public void isregistered(final String mobile, final Handler handler, final Context mContext) {
165 RequestParams params = new RequestParams(); 168 RequestParams params = new RequestParams();
166 params.put(HttpKey.USERNAME, mobile); 169 params.put(HttpKey.USERNAME, mobile);
167 HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { 170 HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() {
168 @Override 171 @Override
169 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 172 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
170 Log.e("test", "isregistered" + response.toString()); 173 Log.e("test", "isregistered" + response.toString());
171 Message msg = Message.obtain(); 174 Message msg = Message.obtain();
172 msg.what = HttpCode.IS_REFISTER; 175 msg.what = HttpCode.IS_REFISTER;
173 msg.obj = response; 176 msg.obj = response;
174 handler.sendMessage(msg); 177 handler.sendMessage(msg);
175 178
176 } 179 }
177 180
178 @Override 181 @Override
179 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 182 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
180 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 183 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
181 184
182 } 185 }
183 }); 186 });
184 } 187 }
185 188
186 //修改密码 189 //修改密码
187 public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { 190 public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) {
188 mProgress = DialogPermission.showProgress(context, null, "正在修改密码...", 191 mProgress = DialogPermission.showProgress(context, null, "正在修改密码...",
189 false, true, null); 192 false, true, null);
190 RequestParams params = new RequestParams(); 193 RequestParams params = new RequestParams();
191 params.put(HttpKey.USERNAME, username); 194 params.put(HttpKey.USERNAME, username);
192 params.put(HttpKey.OLDPASS, old_pwd1); 195 params.put(HttpKey.OLDPASS, old_pwd1);
193 params.put(HttpKey.NEWPASS, newpassword3); 196 params.put(HttpKey.NEWPASS, newpassword3);
194 HttpClient.getInstance().addHeader("Accept", "*/*"); 197 HttpClient.getInstance().addHeader("Accept", "*/*");
195 HttpClient.getInstance().setTimeout(10 * 1000); 198 HttpClient.getInstance().setTimeout(10 * 1000);
196 HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { 199 HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() {
197 @Override 200 @Override
198 public void onSuccess(int i, Header[] headers, byte[] bytes) { 201 public void onSuccess(int i, Header[] headers, byte[] bytes) {
199 closeProgress(); 202 closeProgress();
200 try { 203 try {
201 JSONObject jsonObject = new JSONObject(new String(bytes)); 204 JSONObject jsonObject = new JSONObject(new String(bytes));
202 String status = jsonObject.optString("status"); 205 String status = jsonObject.optString("status");
203 if (status.equals("100")) { 206 if (status.equals("100")) {
204 // Log.e("test", "onSuccess" + new String(bytes)); 207 // Log.e("test", "onSuccess" + new String(bytes));
205 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); 208 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show();
206 SaveParam.getInstance().clearData((Activity) context); 209 SaveParam.getInstance().clearData((Activity) context);
207 Intent intent = new Intent(); 210 Intent intent = new Intent();
208 intent.setClass(context, LoginAndRegisterActivity.class); 211 intent.setClass(context, LoginAndRegisterActivity.class);
209 ((Activity) context).startActivity(intent); 212 ((Activity) context).startActivity(intent);
210 ((Activity) context).finish(); 213 ((Activity) context).finish();
211 } else { 214 } else {
212 Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); 215 Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show();
213 } 216 }
214 } catch (JSONException e) { 217 } catch (JSONException e) {
215 e.printStackTrace(); 218 e.printStackTrace();
216 } 219 }
217 } 220 }
218 221
219 @Override 222 @Override
220 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 223 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
221 closeProgress(); 224 closeProgress();
222 // Log.e("test", "onFailure" + new String(bytes)); 225 // Log.e("test", "onFailure" + new String(bytes));
223 AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); 226 AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!");
224 } 227 }
225 }); 228 });
226 229
227 } 230 }
228 231
229 //忘记密码 232 //忘记密码
230 public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { 233 public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) {
231 RequestParams params = new RequestParams(); 234 RequestParams params = new RequestParams();
232 params.put(HttpKey.USERNAME, forot_pwd_phone1); 235 params.put(HttpKey.USERNAME, forot_pwd_phone1);
233 params.put(HttpKey.PASSWORD, forot_pwd_pwd3); 236 params.put(HttpKey.PASSWORD, forot_pwd_pwd3);
234 params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); 237 params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1);
235 HttpClient.getInstance().addHeader("Accept", "*/*"); 238 HttpClient.getInstance().addHeader("Accept", "*/*");
236 HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { 239 HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() {
237 @Override 240 @Override
238 public void onSuccess(int i, Header[] headers, byte[] bytes) { 241 public void onSuccess(int i, Header[] headers, byte[] bytes) {
239 try { 242 try {
240 JSONObject jsonObject = new JSONObject(new String(bytes)); 243 JSONObject jsonObject = new JSONObject(new String(bytes));
241 String status = jsonObject.optString("status"); 244 String status = jsonObject.optString("status");
242 if (status.equals("100")) { 245 if (status.equals("100")) {
243 // Log.e("test", "onSuccess" + new String(bytes)); 246 // Log.e("test", "onSuccess" + new String(bytes));
244 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); 247 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show();
245 ((Activity) context).finish(); 248 ((Activity) context).finish();
246 } else { 249 } else {
247 Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); 250 Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show();
248 } 251 }
249 } catch (JSONException e) { 252 } catch (JSONException e) {
250 e.printStackTrace(); 253 e.printStackTrace();
251 } 254 }
252 } 255 }
253 256
254 @Override 257 @Override
255 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 258 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
256 // Log.e("test", "onFailure" + new String(bytes)); 259 // Log.e("test", "onFailure" + new String(bytes));
257 AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); 260 AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!");
258 } 261 }
259 }); 262 });
260 263
261 } 264 }
262 265
263 //保存用户登录信息 266 //保存用户登录信息
264 public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { 267 public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) {
265 SaveParam.getInstance().saveLoginParam(context, "username", username); 268 SaveParam.getInstance().saveLoginParam(context, "username", username);
266 SaveParam.getInstance().saveLoginParam(context, "password", password); 269 SaveParam.getInstance().saveLoginParam(context, "password", password);
267 SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); 270 SaveParam.getInstance().saveLoginParam(context, "access_token", access_token);
268 SaveParam.getInstance().saveLoginParam(context, "userId", userId); 271 SaveParam.getInstance().saveLoginParam(context, "userId", userId);
269 272
270 273
271 } 274 }
272 275
273 //提交保卡信息 276 //提交保卡信息
274 public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, 277 public void subcardinfo(final Context context, long userId, String customerName, String customerAddress,
275 String buyAddress, String buyTime, String alterSaleCall, 278 String buyAddress, String buyTime, String alterSaleCall,
276 String productModel, String deviceNumber, String macAddress, 279 String productModel, String deviceNumber, String macAddress,
277 String mobilePhone) { 280 String mobilePhone) {
278 mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", 281 mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...",
279 false, true, null); 282 false, true, null);
280 RequestParams params = new RequestParams(); 283 RequestParams params = new RequestParams();
281 284
282 params.put(HttpKey.USEID, userId); 285 params.put(HttpKey.USEID, userId);
283 params.put(HttpKey.CUSTOMENAME, customerName); 286 params.put(HttpKey.CUSTOMENAME, customerName);
284 params.put(HttpKey.CUSTOMADRESS, customerAddress); 287 params.put(HttpKey.CUSTOMADRESS, customerAddress);
285 params.put(HttpKey.BUYADREES, buyAddress); 288 params.put(HttpKey.BUYADREES, buyAddress);
286 params.put(HttpKey.BUYTIME, buyTime); 289 params.put(HttpKey.BUYTIME, buyTime);
287 params.put(HttpKey.ALTERSALECALL, alterSaleCall); 290 params.put(HttpKey.ALTERSALECALL, alterSaleCall);
288 params.put(HttpKey.PRODUCTMODEL, productModel); 291 params.put(HttpKey.PRODUCTMODEL, productModel);
289 params.put(HttpKey.DEVICENUMBER, deviceNumber); 292 params.put(HttpKey.DEVICENUMBER, deviceNumber);
290 params.put(HttpKey.MACADRESS, macAddress); 293 params.put(HttpKey.MACADRESS, macAddress);
291 params.put(HttpKey.MOBILPHONE, mobilePhone); 294 params.put(HttpKey.MOBILPHONE, mobilePhone);
292 295
293 HttpClient.getInstance().addHeader("Accept", "*/*"); 296 HttpClient.getInstance().addHeader("Accept", "*/*");
294 297
295 Log.e("test", "params" + params); 298 Log.e("test", "params" + params);
296 HttpClient.getInstance().setTimeout(5 * 1000); 299 HttpClient.getInstance().setTimeout(5 * 1000);
297 HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { 300 HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() {
298 @Override 301 @Override
299 public void onSuccess(int i, Header[] headers, byte[] bytes) { 302 public void onSuccess(int i, Header[] headers, byte[] bytes) {
300 JSONObject jsonObject = null; 303 JSONObject jsonObject = null;
301 closeProgress(); 304 closeProgress();
302 try { 305 try {
303 jsonObject = new JSONObject(new String(bytes)); 306 jsonObject = new JSONObject(new String(bytes));
304 String status = jsonObject.optString("status"); 307 String status = jsonObject.optString("status");
305 if (status.equals("1")) { 308 if (status.equals("1")) {
306 Log.e("test", "onSuccess" + jsonObject); 309 Log.e("test", "onSuccess" + jsonObject);
307 Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); 310 Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show();
308 if (Content.cardintentflag == 1) { 311 if (Content.cardintentflag == 1) {
309 Intent intent = new Intent(); 312 Intent intent = new Intent();
310 intent.setClass((Activity) context, TheStartPageActivity.class); 313 intent.setClass((Activity) context, TheStartPageActivity.class);
311 ((Activity) context).startActivity(intent); 314 ((Activity) context).startActivity(intent);
312 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); 315 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout);
313 ((Activity) context).finish(); 316 ((Activity) context).finish();
314 } else if (Content.cardintentflag == 2) { 317 } else if (Content.cardintentflag == 2) {
315 Intent intent = new Intent(); 318 Intent intent = new Intent();
316 intent.setClass((Activity) context, BangDingCode.class); 319 intent.setClass((Activity) context, BangDingCode.class);
317 ((Activity) context).startActivity(intent); 320 ((Activity) context).startActivity(intent);
318 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); 321 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout);
319 ((Activity) context).finish(); 322 ((Activity) context).finish();
320 323
321 } 324 }
322 325
323 326
324 } else if (status.equals("2003")){ 327 } else if (status.equals("2003")){
325 IllegalDialog.getInstance().show(((FragmentActivity) context).getSupportFragmentManager(),"feifa"); 328 IllegalDialog.getInstance().show(((FragmentActivity) context).getSupportFragmentManager(),"feifa");
326 329
327 }else { 330 }else {
328 SaveParam.getInstance().saveCustomizeParam((FragmentActivity) context,SaveParam.CARDPHONE,""); 331 SaveParam.getInstance().saveCustomizeParam((FragmentActivity) context,SaveParam.CARDPHONE,"");
329 Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); 332 Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show();
330 } 333 }
331 } catch (JSONException e) { 334 } catch (JSONException e) {
332 e.printStackTrace(); 335 e.printStackTrace();
333 } 336 }
334 337
335 338
336 } 339 }
337 340
338 @Override 341 @Override
339 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 342 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
340 Log.e("test", "onFailure" + (throwable)); 343 Log.e("test", "onFailure" + (throwable));
341 closeProgress(); 344 closeProgress();
342 AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); 345 AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!");
343 346
344 } 347 }
345 }); 348 });
346 349
347 } 350 }
348 351
349 //获取保卡信息 352 //获取保卡信息
350 public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { 353 public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) {
351 mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", 354 mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...",
352 false, true, null); 355 false, true, null);
353 HttpClient.getInstance().setTimeout(5 * 1000); 356 HttpClient.getInstance().setTimeout(5 * 1000);
354 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 357 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
355 HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { 358 HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() {
356 @Override 359 @Override
357 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 360 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
358 closeProgress(); 361 closeProgress();
359 // Log.e("test", "保卡信息" + new String(arg2)); 362 // Log.e("test", "保卡信息" + new String(arg2));
360 try { 363 try {
361 JSONObject jsonObject = new JSONObject(new String(arg2)); 364 JSONObject jsonObject = new JSONObject(new String(arg2));
362 int status = jsonObject.optInt("status"); 365 int status = jsonObject.optInt("status");
363 if (status == 1) { 366 if (status == 1) {
364 CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 367 CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据
365 CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); 368 CardInfo.DataBean schoolInfoBeanList = cardInfo.getData();
366 Message msg = Message.obtain(); 369 Message msg = Message.obtain();
367 msg.what = HttpCode.SUCHCARDINFO; 370 msg.what = HttpCode.SUCHCARDINFO;
368 msg.obj = schoolInfoBeanList; 371 msg.obj = schoolInfoBeanList;
369 handler.sendMessage(msg); 372 handler.sendMessage(msg);
370 373
371 374
372 } else { 375 } else {
373 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); 376 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
374 377
375 } 378 }
376 } catch (JSONException e) { 379 } catch (JSONException e) {
377 e.printStackTrace(); 380 e.printStackTrace();
378 } 381 }
379 382
380 } 383 }
381 384
382 @Override 385 @Override
383 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 386 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
384 closeProgress(); 387 closeProgress();
385 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 388 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
386 } 389 }
387 }); 390 });
388 } 391 }
389 392
390 //获取是否为样机信息 393 //获取是否为样机信息
391 public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { 394 public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) {
392 HttpClient.getInstance().setTimeout(5 * 1000); 395 HttpClient.getInstance().setTimeout(5 * 1000);
393 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 396 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
394 HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { 397 HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() {
395 @Override 398 @Override
396 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 399 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
397 closeProgress(); 400 closeProgress();
398 // Log.e("test", "保卡信息" + new String(arg2)); 401 // Log.e("test", "保卡信息" + new String(arg2));
399 Message msg = Message.obtain(); 402 Message msg = Message.obtain();
400 msg.what = HttpCode.SUCHCARDINFOONE; 403 msg.what = HttpCode.SUCHCARDINFOONE;
401 msg.obj = new String(arg2); 404 msg.obj = new String(arg2);
402 handler.sendMessage(msg); 405 handler.sendMessage(msg);
403 406
404 } 407 }
405 408
406 @Override 409 @Override
407 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 410 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
408 closeProgress(); 411 closeProgress();
409 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 412 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
410 } 413 }
411 }); 414 });
412 } 415 }
413 416
414 //修改账户电话 417 //修改账户电话
415 public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { 418 public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) {
416 RequestParams params = new RequestParams(); 419 RequestParams params = new RequestParams();
417 params.put("userId", userId); 420 params.put("userId", userId);
418 params.put("username", username); 421 params.put("username", username);
419 params.put("authCode", authCode); 422 params.put("authCode", authCode);
420 HttpClient.getInstance().addHeader("Accept", "*/*"); 423 HttpClient.getInstance().addHeader("Accept", "*/*");
421 HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { 424 HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() {
422 @Override 425 @Override
423 public void onSuccess(int i, Header[] headers, byte[] bytes) { 426 public void onSuccess(int i, Header[] headers, byte[] bytes) {
424 try { 427 try {
425 // Log.e("test", "保卡信息" + new String(bytes)); 428 // Log.e("test", "保卡信息" + new String(bytes));
426 JSONObject jsonObject = new JSONObject(new String(bytes)); 429 JSONObject jsonObject = new JSONObject(new String(bytes));
427 String status = jsonObject.optString("status"); 430 String status = jsonObject.optString("status");
428 if (status.equals("1")) { 431 if (status.equals("1")) {
429 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); 432 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show();
430 SaveParam.getInstance().saveLoginParam(mContext, "username", username); 433 SaveParam.getInstance().saveLoginParam(mContext, "username", username);
431 ((Activity) mContext).finish(); 434 ((Activity) mContext).finish();
432 } else if (status.equals("1001")) { 435 } else if (status.equals("1001")) {
433 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); 436 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show();
434 } 437 }
435 else if (status.equals("1006")) { 438 else if (status.equals("1006")) {
436 AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); 439 AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!");
437 } else { 440 } else {
438 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 441 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
439 } 442 }
440 } catch (JSONException e) { 443 } catch (JSONException e) {
441 e.printStackTrace(); 444 e.printStackTrace();
442 } 445 }
443 } 446 }
444 447
445 @Override 448 @Override
446 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 449 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
447 //Log.e("test", "onFailure" + new String(bytes)); 450 //Log.e("test", "onFailure" + new String(bytes));
448 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 451 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
449 } 452 }
450 }); 453 });
451 } 454 }
452 455
453 //修改保卡信息电话 456 //修改保卡信息电话
454 public void changecardinfophone(final Context mContext, String userId, final String customerPhone, String authCode) { 457 public void changecardinfophone(final Context mContext, String userId, final String customerPhone, String authCode) {
455 RequestParams params = new RequestParams(); 458 RequestParams params = new RequestParams();
456 params.put("deviceNumber", userId); 459 params.put("deviceNumber", userId);
457 params.put("customerPhone", customerPhone); 460 params.put("customerPhone", customerPhone);
458 params.put("authCode", authCode); 461 params.put("authCode", authCode);
459 HttpClient.getInstance().addHeader("Accept", "*/*"); 462 HttpClient.getInstance().addHeader("Accept", "*/*");
460 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { 463 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() {
461 @Override 464 @Override
462 public void onSuccess(int i, Header[] headers, byte[] bytes) { 465 public void onSuccess(int i, Header[] headers, byte[] bytes) {
463 try { 466 try {
464 JSONObject jsonObject = new JSONObject(new String(bytes)); 467 JSONObject jsonObject = new JSONObject(new String(bytes));
465 String status = jsonObject.optString("status"); 468 String status = jsonObject.optString("status");
466 if (status.equals("1")) { 469 if (status.equals("1")) {
467 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); 470 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show();
468 SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); 471 SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone);
469 ((Activity) mContext).finish(); 472 ((Activity) mContext).finish();
470 } else if (status.equals("1001")) { 473 } else if (status.equals("1001")) {
471 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); 474 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show();
472 } else { 475 } else {
473 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 476 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
474 } 477 }
475 } catch (JSONException e) { 478 } catch (JSONException e) {
476 e.printStackTrace(); 479 e.printStackTrace();
477 } 480 }
478 } 481 }
479 482
480 @Override 483 @Override
481 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 484 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
482 // Log.e("test", "onFailure" + new String(bytes)); 485 // Log.e("test", "onFailure" + new String(bytes));
483 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 486 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
484 } 487 }
485 }); 488 });
486 } 489 }
487 490
488 //修改保卡信息地址 491 //修改保卡信息地址
489 public void changecardadressinfo(final Context mContext, String userId, final String customerPhone, String authCode, final String customerAddress) { 492 public void changecardadressinfo(final Context mContext, String userId, final String customerPhone, String authCode, final String customerAddress) {
490 RequestParams params = new RequestParams(); 493 RequestParams params = new RequestParams();
491 params.put("deviceNumber", userId); 494 params.put("deviceNumber", userId);
492 params.put("customerPhone", customerPhone); 495 params.put("customerPhone", customerPhone);
493 params.put("authCode", authCode); 496 params.put("authCode", authCode);
494 params.put("customerAddress", customerAddress); 497 params.put("customerAddress", customerAddress);
495 HttpClient.getInstance().addHeader("Accept", "*/*"); 498 HttpClient.getInstance().addHeader("Accept", "*/*");
496 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { 499 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() {
497 @Override 500 @Override
498 public void onSuccess(int i, Header[] headers, byte[] bytes) { 501 public void onSuccess(int i, Header[] headers, byte[] bytes) {
499 try { 502 try {
500 JSONObject jsonObject = new JSONObject(new String(bytes)); 503 JSONObject jsonObject = new JSONObject(new String(bytes));
501 String status = jsonObject.optString("status"); 504 String status = jsonObject.optString("status");
502 if (status.equals("1")) { 505 if (status.equals("1")) {
503 Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); 506 Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show();
504 SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); 507 SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress);
505 ((Activity) mContext).finish(); 508 ((Activity) mContext).finish();
506 } else if (status.equals("1001")) { 509 } else if (status.equals("1001")) {
507 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); 510 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show();
508 } else { 511 } else {
509 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 512 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
510 } 513 }
511 } catch (JSONException e) { 514 } catch (JSONException e) {
512 e.printStackTrace(); 515 e.printStackTrace();
513 } 516 }
514 } 517 }
515 518
516 @Override 519 @Override
517 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 520 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
518 // Log.e("test", "onFailure" + new String(bytes)); 521 // Log.e("test", "onFailure" + new String(bytes));
519 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 522 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
520 } 523 }
521 }); 524 });
522 } 525 }
523 526
524 //验证是否保卡信息 527 //验证是否保卡信息
525 public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { 528 public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) {
526 mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", 529 mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...",
527 false, true, null); 530 false, true, null);
528 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 531 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
529 HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { 532 HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() {
530 @Override 533 @Override
531 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 534 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
532 // Log.e("test", "验证保卡" + new String(arg2)); 535 // Log.e("test", "验证保卡" + new String(arg2));
533 closeProgress(); 536 closeProgress();
534 Message msg = Message.obtain(); 537 Message msg = Message.obtain();
535 msg.what = HttpCode.CHECKCARD; 538 msg.what = HttpCode.CHECKCARD;
536 msg.obj = new String(arg2); 539 msg.obj = new String(arg2);
537 handler.sendMessage(msg); 540 handler.sendMessage(msg);
538 541
539 542
540 } 543 }
541 544
542 @Override 545 @Override
543 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 546 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
544 closeProgress(); 547 closeProgress();
545 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 548 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
546 //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); 549 //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show();
547 } 550 }
548 }); 551 });
549 } 552 }
550 553
551 ///获取年级 554 ///获取年级
552 public void getgrade(final Context mContext, final Handler handler) { 555 public void getgrade(final Context mContext, final Handler handler) {
553 HttpClient.getInstance().addHeader("Accept", "application/json"); 556 HttpClient.getInstance().addHeader("Accept", "application/json");
554 HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { 557 HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() {
555 @Override 558 @Override
556 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 559 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
557 // Log.e("test", "年级" + new String(arg2)); 560 // Log.e("test", "年级" + new String(arg2));
558 GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 561 GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据
559 List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); 562 List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>();
560 for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { 563 for (int i = 0; i < gradeInfo.getData().size() - 2; i++) {
561 String name = gradeInfo.getData().get(i).getName(); 564 String name = gradeInfo.getData().get(i).getName();
562 int id = gradeInfo.getData().get(i).getId(); 565 int id = gradeInfo.getData().get(i).getId();
563 List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); 566 List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren();
564 for (int j = 0; j < gradeinfoList.size(); j++) { 567 for (int j = 0; j < gradeinfoList.size(); j++) {
565 String secondname = gradeinfoList.get(j).getName(); 568 String secondname = gradeinfoList.get(j).getName();
566 int secondid = gradeinfoList.get(j).getId(); 569 int secondid = gradeinfoList.get(j).getId();
567 GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); 570 GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean();
568 dataBean.setName(secondname); 571 dataBean.setName(secondname);
569 dataBean.setId(secondid); 572 dataBean.setId(secondid);
570 gradeInfoLists.add(dataBean); 573 gradeInfoLists.add(dataBean);
571 } 574 }
572 575
573 } 576 }
574 577
575 Message message = Message.obtain(); 578 Message message = Message.obtain();
576 message.what = HttpCode.GRADER; 579 message.what = HttpCode.GRADER;
577 message.obj = gradeInfoLists; 580 message.obj = gradeInfoLists;
578 handler.sendMessage(message); 581 handler.sendMessage(message);
579 582
580 583
581 } 584 }
582 585
583 @Override 586 @Override
584 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 587 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
585 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 588 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
586 } 589 }
587 }); 590 });
588 } 591 }
589 592
590 /** 593 /**
591 * 获取学校 594 * 获取学校
592 * 595 *
593 * @param mContext 596 * @param mContext
594 * @param regionId 597 * @param regionId
595 * @param gradeId 598 * @param gradeId
596 * @param handler 599 * @param handler
597 */ 600 */
598 public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { 601 public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) {
599 HttpClient.getInstance().addHeader("Accept", "application/json"); 602 HttpClient.getInstance().addHeader("Accept", "application/json");
600 HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { 603 HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() {
601 @Override 604 @Override
602 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 605 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
603 // Log.e("test", "学校" + new String(arg2)); 606 // Log.e("test", "学校" + new String(arg2));
604 try { 607 try {
605 JSONObject jsonObject = new JSONObject(new String(arg2)); 608 JSONObject jsonObject = new JSONObject(new String(arg2));
606 int status = jsonObject.optInt("status"); 609 int status = jsonObject.optInt("status");
607 if (status == 1) { 610 if (status == 1) {
608 SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 611 SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据
609 List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); 612 List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData();
610 Message message = Message.obtain(); 613 Message message = Message.obtain();
611 message.what = HttpCode.SCHOOL; 614 message.what = HttpCode.SCHOOL;
612 message.obj = schoolInfoBeanList; 615 message.obj = schoolInfoBeanList;
613 handler.sendMessage(message); 616 handler.sendMessage(message);
614 617
615 618
616 } else { 619 } else {
617 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); 620 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
618 621
619 } 622 }
620 } catch (JSONException e) { 623 } catch (JSONException e) {
621 e.printStackTrace(); 624 e.printStackTrace();
622 } 625 }
623 626
624 } 627 }
625 628
626 @Override 629 @Override
627 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 630 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
628 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 631 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
629 } 632 }
630 }); 633 });
631 } 634 }
632 635
633 636
634 /** 637 /**
635 * 获取个人信息 638 * 获取个人信息
636 * 639 *
637 * @param mContext 640 * @param mContext
638 * @param userId 641 * @param userId
639 * @param handler 642 * @param handler
640 */ 643 */
641 public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { 644 public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) {
642 // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", 645 // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...",
643 // false, true, null); 646 // false, true, null);
644 HttpClient.getInstance().addHeader("Accept", "application/json"); 647 HttpClient.getInstance().addHeader("Accept", "application/json");
645 HttpClient.getInstance().setConnectTimeout(5 * 1000); 648 HttpClient.getInstance().setConnectTimeout(5 * 1000);
646 HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { 649 HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() {
647 @Override 650 @Override
648 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 651 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
649 closeProgress(); 652 closeProgress();
650 // Log.e("test", "个人信息" + new String(arg2)); 653 Log.e("test", "个人信息" + new String(arg2));
651 try { 654 try {
652 JSONObject jsonObject = new JSONObject(new String(arg2)); 655 JSONObject jsonObject = new JSONObject(new String(arg2));
653 int status = jsonObject.optInt("status"); 656 int status = jsonObject.optInt("status");
657 Message message = Message.obtain();
654 if (status == 1) { 658 if (status == 1) {
655 PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 659 PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据
656 PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); 660 PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData();
657 Message message = Message.obtain();
658 message.what = HttpCode.GETINFO; 661 message.what = HttpCode.GETINFO;
659 message.obj = pesonalInfoBeanList; 662 message.obj = pesonalInfoBeanList;
660 handler.sendMessage(message); 663 handler.sendMessage(message);
661 664 } else if (status == 1011){
662 665 message.what = HttpCode.RELOGIN;
663 } else { 666 handler.sendMessage(message);
667 }else {
664 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); 668 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
665 669
666 } 670 }
667 } catch (JSONException e) { 671 } catch (JSONException e) {
668 e.printStackTrace(); 672 e.printStackTrace();
669 } 673 }
670 674
671 675
672 } 676 }
673 677
674 @Override 678 @Override
675 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 679 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
676 closeProgress(); 680 closeProgress();
677 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 681 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
678 } 682 }
679 }); 683 });
680 } 684 }
681 685
682 //修改个人信息 686 //修改个人信息
683 public void changepresonalinfo(final Context mContext, Long id, int type 687 public void changepresonalinfo(final Context mContext, Long id, int type
684 , String name, String birthday, final int gradeId, long regionId, 688 , String name, String birthday, final int gradeId, long regionId,
685 Object schoolId, String qq, String gender 689 Object schoolId, String qq, String gender
686 , String regionName, String address, String devicenumber, final Handler handler) throws UnsupportedEncodingException { 690 , String regionName, String address, String devicenumber, final Handler handler) throws UnsupportedEncodingException {
687 mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", 691 mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...",
688 false, true, null); 692 false, true, null);
689 RequestParams params = new RequestParams(); 693 RequestParams params = new RequestParams();
690 694
691 params.put(HttpKey.USEID, id); 695 params.put(HttpKey.USEID, id);
692 params.put(HttpKey.TYPE, type); 696 params.put(HttpKey.TYPE, type);
693 params.put(HttpKey.NAME, name); 697 params.put(HttpKey.NAME, name);
694 params.put(HttpKey.BIRDays, birthday); 698 params.put(HttpKey.BIRDays, birthday);
695 params.put(HttpKey.GRADE, gradeId); 699 params.put(HttpKey.GRADE, gradeId);
696 params.put(HttpKey.REGION, regionId); 700 params.put(HttpKey.REGION, regionId);
697 params.put(HttpKey.SCHOOL, schoolId); 701 params.put(HttpKey.SCHOOL, schoolId);
698 params.put(HttpKey.QQ, qq); 702 params.put(HttpKey.QQ, qq);
699 params.put(HttpKey.GENDER, gender); 703 params.put(HttpKey.GENDER, gender);
700 params.put(HttpKey.REGIONNAME, regionName); 704 params.put(HttpKey.REGIONNAME, regionName);
701 params.put(HttpKey.ADDDRESS, address); 705 params.put(HttpKey.ADDDRESS, address);
702 params.put(HttpKey.DEVINUMBER, devicenumber); 706 params.put(HttpKey.DEVINUMBER, devicenumber);
703 Log.e("test", "个人信息" + params); 707 Log.e("test", "个人信息" + params);
704 HttpClient.getInstance().addHeader("Accept", "*/*"); 708 HttpClient.getInstance().addHeader("Accept", "*/*");
705 HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { 709 HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() {
706 @Override 710 @Override
707 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 711 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
708 super.onSuccess(statusCode, headers, response); 712 super.onSuccess(statusCode, headers, response);
709 closeProgress(); 713 closeProgress();
710 String status = response.optString("status"); 714 String status = response.optString("status");
711 if (status.equals("1")) { 715 if (status.equals("1")) {
712 Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); 716 Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show();
713 SaveParam.getInstance().saveLoginParam(mContext,SaveParam.VIEGREADE,gradeId+""); 717 SaveParam.getInstance().saveLoginParam(mContext,SaveParam.VIEGREADE,gradeId+"");
714 Message message = Message.obtain(); 718 Message message = Message.obtain();
715 message.what = HttpCode.PESERNAOL; 719 message.what = HttpCode.PESERNAOL;
716 message.obj = 1; 720 message.obj = 1;
717 handler.sendMessage(message); 721 handler.sendMessage(message);
718 } else { 722 } else {
719 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 723 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
720 } 724 }
721 725
722 } 726 }
723 727
724 @Override 728 @Override
725 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 729 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
726 super.onFailure(statusCode, headers, throwable, errorResponse); 730 super.onFailure(statusCode, headers, throwable, errorResponse);
727 closeProgress(); 731 closeProgress();
728 Log.e("test", "onFailure" + errorResponse); 732 Log.e("test", "onFailure" + errorResponse);
729 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 733 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
730 } 734 }
731 735
732 }); 736 });
733 } 737 }
734 738
735 //提交注册信息 739 //提交注册信息
736 public void subregisterinfo(final Context mContext, Long userId 740 public void subregisterinfo(final Context mContext, Long userId
737 , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese, 741 , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese,
738 String math, String english, String physics, String chemistry, 742 String math, String english, String physics, String chemistry,
739 String history, String geography, String political, String biology, String science, final Handler handler) { 743 String history, String geography, String political, String biology, String science, final Handler handler) {
740 mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", 744 mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...",
741 false, true, null); 745 false, true, null);
742 RequestParams params = new RequestParams(); 746 RequestParams params = new RequestParams();
743 747
744 params.put(HttpKey.USEID, userId); 748 params.put(HttpKey.USEID, userId);
745 params.put(HttpKey.NAME, name); 749 params.put(HttpKey.NAME, name);
746 params.put(HttpKey.GRADE, gradeId); 750 params.put(HttpKey.GRADE, gradeId);
747 params.put(HttpKey.REGION, regionId); 751 params.put(HttpKey.REGION, regionId);
748 params.put(HttpKey.SCHOOL, schoolId); 752 params.put(HttpKey.SCHOOL, schoolId);
749 params.put(HttpKey.REGIONNAME, regionName); 753 params.put(HttpKey.REGIONNAME, regionName);
750 params.put(HttpKey.MATH, math); 754 params.put(HttpKey.MATH, math);
751 params.put(HttpKey.ENGLISH, english); 755 params.put(HttpKey.ENGLISH, english);
752 params.put(HttpKey.CHINESE, chinese); 756 params.put(HttpKey.CHINESE, chinese);
753 params.put(HttpKey.PHYSICES, physics); 757 params.put(HttpKey.PHYSICES, physics);
754 params.put(HttpKey.CHEMISTRY, chemistry); 758 params.put(HttpKey.CHEMISTRY, chemistry);
755 params.put(HttpKey.HISTIRY, history); 759 params.put(HttpKey.HISTIRY, history);
756 params.put(HttpKey.GEOGRAPHY, geography); 760 params.put(HttpKey.GEOGRAPHY, geography);
757 params.put(HttpKey.POLITICAL, political); 761 params.put(HttpKey.POLITICAL, political);
758 params.put(HttpKey.BIOLOGY, biology); 762 params.put(HttpKey.BIOLOGY, biology);
759 params.put(HttpKey.SCIENCE, science); 763 params.put(HttpKey.SCIENCE, science);
760 764
761 Log.e("test", "注册信息" + params); 765 Log.e("test", "注册信息" + params);
762 HttpClient.getInstance().addHeader("Accept", "*/*"); 766 HttpClient.getInstance().addHeader("Accept", "*/*");
763 HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { 767 HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() {
764 @Override 768 @Override
765 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 769 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
766 super.onSuccess(statusCode, headers, response); 770 super.onSuccess(statusCode, headers, response);
767 closeProgress(); 771 closeProgress();
768 Message message = Message.obtain(); 772 Message message = Message.obtain();
769 message.what = HttpCode.REGISTERINFO_SUCESS; 773 message.what = HttpCode.REGISTERINFO_SUCESS;
770 message.obj = new String(String.valueOf(response)); 774 message.obj = new String(String.valueOf(response));
771 handler.sendMessage(message); 775 handler.sendMessage(message);
772 776
773 } 777 }
774 778
775 @Override 779 @Override
776 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 780 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
777 super.onFailure(statusCode, headers, throwable, errorResponse); 781 super.onFailure(statusCode, headers, throwable, errorResponse);
778 closeProgress(); 782 closeProgress();
779 Log.e("test", "onFailure" + errorResponse); 783 Log.e("test", "onFailure" + errorResponse);
780 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 784 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
781 } 785 }
782 786
783 }); 787 });
784 } 788 }
785 789
786 //修改版本信息 790 //修改版本信息
787 public void changepublishinfo(final Context mContext, String userId, String chinese, 791 public void changepublishinfo(final Context mContext, String userId, String chinese,
788 String math, String english, String physics, String chemistry, 792 String math, String english, String physics, String chemistry,
789 String history, String geography, String political, String biology, String science) { 793 String history, String geography, String political, String biology, String science) {
790 mProgress = DialogPermission.showProgress(mContext, null, "正在保存版本信息...", 794 mProgress = DialogPermission.showProgress(mContext, null, "正在保存版本信息...",
791 false, true, null); 795 false, true, null);
792 RequestParams params = new RequestParams(); 796 RequestParams params = new RequestParams();
793 params.put(HttpKey.USEID, userId); 797 params.put(HttpKey.USEID, userId);
794 params.put(HttpKey.CHINESE, chinese); 798 params.put(HttpKey.CHINESE, chinese);
795 params.put(HttpKey.MATH, math); 799 params.put(HttpKey.MATH, math);
796 params.put(HttpKey.ENGLISH, english); 800 params.put(HttpKey.ENGLISH, english);
797 params.put(HttpKey.PHYSICES, physics); 801 params.put(HttpKey.PHYSICES, physics);
798 params.put(HttpKey.CHEMISTRY, chemistry); 802 params.put(HttpKey.CHEMISTRY, chemistry);
799 params.put(HttpKey.HISTIRY, history); 803 params.put(HttpKey.HISTIRY, history);
800 params.put(HttpKey.GEOGRAPHY, geography); 804 params.put(HttpKey.GEOGRAPHY, geography);
801 params.put(HttpKey.POLITICAL, political); 805 params.put(HttpKey.POLITICAL, political);
802 params.put(HttpKey.BIOLOGY, biology); 806 params.put(HttpKey.BIOLOGY, biology);
803 params.put(HttpKey.SCIENCE, science); 807 params.put(HttpKey.SCIENCE, science);
804 808
805 Log.e("test", "版本信息信息" + params); 809 Log.e("test", "版本信息信息" + params);
806 HttpClient.getInstance().addHeader("Accept", "*/*"); 810 HttpClient.getInstance().addHeader("Accept", "*/*");
807 HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { 811 HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() {
808 @Override 812 @Override
809 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 813 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
810 super.onSuccess(statusCode, headers, response); 814 super.onSuccess(statusCode, headers, response);
811 closeProgress(); 815 closeProgress();
812 String status = response.optString("status"); 816 String status = response.optString("status");
813 if (status.equals("1")) { 817 if (status.equals("1")) {
814 Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); 818 Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show();
815 ((Activity) mContext).finish(); 819 ((Activity) mContext).finish();
816 } else { 820 } else {
817 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); 821 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试");
818 } 822 }
819 823
820 } 824 }
821 825
822 @Override 826 @Override
823 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 827 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
824 super.onFailure(statusCode, headers, throwable, errorResponse); 828 super.onFailure(statusCode, headers, throwable, errorResponse);
825 closeProgress(); 829 closeProgress();
826 Log.e("test", "onFailure" + errorResponse); 830 Log.e("test", "onFailure" + errorResponse);
827 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 831 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
828 } 832 }
829 833
830 }); 834 });
831 } 835 }
832 836
833 //修改个性签名 837 //修改个性签名
834 public void changsignature(final Context mContext, Object userId, int type, final String signature) { 838 public void changsignature(final Context mContext, Object userId, int type, final String signature) {
835 RequestParams params = new RequestParams(); 839 RequestParams params = new RequestParams();
836 params.put("userId", userId); 840 params.put("userId", userId);
837 params.put("type", type); 841 params.put("type", type);
838 params.put("signature", signature); 842 params.put("signature", signature);
839 HttpClient.getInstance().addHeader("Accept", "*/*"); 843 HttpClient.getInstance().addHeader("Accept", "*/*");
840 HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { 844 HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() {
841 @Override 845 @Override
842 public void onSuccess(int i, Header[] headers, byte[] bytes) { 846 public void onSuccess(int i, Header[] headers, byte[] bytes) {
843 try { 847 try {
844 JSONObject jsonObject = new JSONObject(new String(bytes)); 848 JSONObject jsonObject = new JSONObject(new String(bytes));
845 String status = jsonObject.optString("status"); 849 String status = jsonObject.optString("status");
846 if (status.equals("1")) { 850 if (status.equals("1")) {
847 Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); 851 Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show();
848 } else { 852 } else {
849 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); 853 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试");
850 } 854 }
851 } catch (JSONException e) { 855 } catch (JSONException e) {
852 e.printStackTrace(); 856 e.printStackTrace();
853 } 857 }
854 } 858 }
855 859
856 @Override 860 @Override
857 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 861 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
858 //Log.e("test", "onFailure" + new String(bytes)); 862 //Log.e("test", "onFailure" + new String(bytes));
859 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 863 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
860 } 864 }
861 }); 865 });
862 } 866 }
863 867
864 /** 868 /**
865 * 获取个性签名 869 * 获取个性签名
866 * 870 *
867 * @param mContext 871 * @param mContext
868 * @param userId 872 * @param userId
869 * @param handler 873 * @param handler
870 */ 874 */
871 public void getsignatures(final Context mContext, Object userId, int type, final Handler handler) { 875 public void getsignatures(final Context mContext, Object userId, int type, final Handler handler) {
872 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 876 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
873 HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { 877 HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() {
874 @Override 878 @Override
875 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 879 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
876 // Log.e("test", "个性签名" + new String(arg2)); 880 // Log.e("test", "个性签名" + new String(arg2));
877 try { 881 try {
878 JSONObject jsonObject = new JSONObject(new String(arg2)); 882 JSONObject jsonObject = new JSONObject(new String(arg2));
879 int status = jsonObject.optInt("status"); 883 int status = jsonObject.optInt("status");
880 if (status == 1) { 884 if (status == 1) {
881 SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 885 SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据
882 SignInfo.DataBean signInfoBeanList = signInfo.getData(); 886 SignInfo.DataBean signInfoBeanList = signInfo.getData();
883 Message message = Message.obtain(); 887 Message message = Message.obtain();
884 message.what = HttpCode.SIGN; 888 message.what = HttpCode.SIGN;
885 message.obj = signInfoBeanList; 889 message.obj = signInfoBeanList;
886 handler.sendMessage(message); 890 handler.sendMessage(message);
887 891
888 892
889 } else if (status == 1000) { 893 } else if (status == 1000) {
890 //AlertUtils.showToast(mContext, "您还没有签名哦"); 894 //AlertUtils.showToast(mContext, "您还没有签名哦");
891 895
892 } else { 896 } else {
893 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); 897 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
894 } 898 }
895 } catch (JSONException e) { 899 } catch (JSONException e) {
896 e.printStackTrace(); 900 e.printStackTrace();
897 } 901 }
898 902
899 903
900 } 904 }
901 905
902 @Override 906 @Override
903 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 907 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
904 //Log.e("test", "失败原因" + arg3); 908 //Log.e("test", "失败原因" + arg3);
905 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 909 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
906 } 910 }
907 }); 911 });
908 } 912 }
909 913
910 /** 914 /**
911 * 用户反馈 915 * 用户反馈
912 * 916 *
913 * @param mContext 917 * @param mContext
914 * @param userId 918 * @param userId
915 * @param content 919 * @param content
916 * @param contact 920 * @param contact
917 * @param imgs 921 * @param imgs
918 * @param feedtype 922 * @param feedtype
919 * @throws UnsupportedEncodingException 923 * @throws UnsupportedEncodingException
920 */ 924 */
921 public void feedback(final Context mContext, String userId, String content, 925 public void feedback(final Context mContext, String userId, String content,
922 String contact, String imgs, String feedtype) throws UnsupportedEncodingException { 926 String contact, String imgs, String feedtype) throws UnsupportedEncodingException {
923 mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", 927 mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...",
924 false, true, null); 928 false, true, null);
925 File file = new File(imgs); 929 File file = new File(imgs);
926 RequestParams params = new RequestParams(); 930 RequestParams params = new RequestParams();
927 try { 931 try {
928 params.put("userId", userId); 932 params.put("userId", userId);
929 params.put("content", content); 933 params.put("content", content);
930 params.put("contact", contact); 934 params.put("contact", contact);
931 if (file.exists() && file.length() > 0) { 935 if (file.exists() && file.length() > 0) {
932 params.put("imgs", file); 936 params.put("imgs", file);
933 } 937 }
934 params.put("feedtype", feedtype); 938 params.put("feedtype", feedtype);
935 } catch (FileNotFoundException e) { 939 } catch (FileNotFoundException e) {
936 e.printStackTrace(); 940 e.printStackTrace();
937 } 941 }
938 Log.e("test", "onSuccess" + params); 942 Log.e("test", "onSuccess" + params);
939 HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { 943 HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() {
940 @Override 944 @Override
941 public void onSuccess(int i, Header[] headers, byte[] bytes) { 945 public void onSuccess(int i, Header[] headers, byte[] bytes) {
942 closeProgress(); 946 closeProgress();
943 // Log.e("test", "onSuccess" + new String(bytes)); 947 // Log.e("test", "onSuccess" + new String(bytes));
944 try { 948 try {
945 JSONObject jsonObject = new JSONObject(new String(bytes)); 949 JSONObject jsonObject = new JSONObject(new String(bytes));
946 String status = jsonObject.optString("status"); 950 String status = jsonObject.optString("status");
947 if (status.equals("1")) { 951 if (status.equals("1")) {
948 Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); 952 Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show();
949 ((Activity) mContext).finish(); 953 ((Activity) mContext).finish();
950 } else { 954 } else {
951 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); 955 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试");
952 } 956 }
953 } catch (JSONException e) { 957 } catch (JSONException e) {
954 e.printStackTrace(); 958 e.printStackTrace();
955 } 959 }
956 } 960 }
957 961
958 @Override 962 @Override
959 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 963 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
960 closeProgress(); 964 closeProgress();
961 //Log.e("test", "错误信息" + new String(bytes)); 965 //Log.e("test", "错误信息" + new String(bytes));
962 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 966 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
963 967
964 } 968 }
965 }); 969 });
966 970
967 } 971 }
968 972
969 /** 973 /**
970 * 查询子账户信息 974 * 查询子账户信息
971 * 975 *
972 * @param mContext 976 * @param mContext
973 * @param userId 977 * @param userId
974 * @param handler 978 * @param handler
975 */ 979 */
976 public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { 980 public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) {
977 mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", 981 mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...",
978 false, true, null); 982 false, true, null);
979 983
980 Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); 984 Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber);
981 HttpClient.getInstance().setTimeout(5 * 1000); 985 HttpClient.getInstance().setTimeout(5 * 1000);
982 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 986 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
983 HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { 987 HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() {
984 @Override 988 @Override
985 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 989 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
986 closeProgress(); 990 closeProgress();
987 Log.e("test", "子账户信息" + new String(arg2)); 991 Log.e("test", "子账户信息" + new String(arg2));
988 try { 992 try {
989 JSONObject jsonObject = new JSONObject(new String(arg2)); 993 JSONObject jsonObject = new JSONObject(new String(arg2));
990 int status = jsonObject.optInt("status"); 994 int status = jsonObject.optInt("status");
991 if (status == 1) { 995 if (status == 1) {
992 ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 996 ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据
993 Log.e("test", "子账户信息" + childsInfo); 997 Log.e("test", "子账户信息" + childsInfo);
994 List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); 998 List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData();
995 Log.e("test", "子账户信息" + schoolInfoBeanList); 999 Log.e("test", "子账户信息" + schoolInfoBeanList);
996 Message msg = Message.obtain(); 1000 Message msg = Message.obtain();
997 msg.what = HttpCode.CHILDS_SUCESS; 1001 msg.what = HttpCode.CHILDS_SUCESS;
998 msg.obj = schoolInfoBeanList; 1002 msg.obj = schoolInfoBeanList;
999 handler.sendMessage(msg); 1003 handler.sendMessage(msg);
1000 1004
1001 } else { 1005 } else {
1002 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); 1006 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!");
1003 1007
1004 } 1008 }
1005 } catch (JSONException e) { 1009 } catch (JSONException e) {
1006 e.printStackTrace(); 1010 e.printStackTrace();
1007 1011
1008 } 1012 }
1009 1013
1010 } 1014 }
1011 1015
1012 @Override 1016 @Override
1013 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1017 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1014 closeProgress(); 1018 closeProgress();
1015 // Log.e("test", "错误信息" + new String(arg2)); 1019 // Log.e("test", "错误信息" + new String(arg2));
1016 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1020 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1017 } 1021 }
1018 }); 1022 });
1019 1023
1020 } 1024 }
1021 1025
1022 /** 1026 /**
1023 * 删除子账户信息 1027 * 删除子账户信息
1024 * 1028 *
1025 * @param mContext 1029 * @param mContext
1026 * @param subAccountId 1030 * @param subAccountId
1027 */ 1031 */
1028 public void deletechildAccountinfo(final Context mContext, String subAccountId) { 1032 public void deletechildAccountinfo(final Context mContext, String subAccountId) {
1029 mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", 1033 mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...",
1030 false, true, null); 1034 false, true, null);
1031 HttpClient.getInstance().setTimeout(5 * 1000); 1035 HttpClient.getInstance().setTimeout(5 * 1000);
1032 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1036 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1033 HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { 1037 HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() {
1034 @Override 1038 @Override
1035 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1039 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1036 closeProgress(); 1040 closeProgress();
1037 // Log.e("test", "子账户信息" + new String(arg2)); 1041 // Log.e("test", "子账户信息" + new String(arg2));
1038 try { 1042 try {
1039 JSONObject jsonObject = new JSONObject(new String(arg2)); 1043 JSONObject jsonObject = new JSONObject(new String(arg2));
1040 int status = jsonObject.optInt("status"); 1044 int status = jsonObject.optInt("status");
1041 if (status == 1) { 1045 if (status == 1) {
1042 AlertUtils.showToast(mContext, "子账号删除成功!"); 1046 AlertUtils.showToast(mContext, "子账号删除成功!");
1043 ((Activity) mContext).finish(); 1047 ((Activity) mContext).finish();
1044 } else { 1048 } else {
1045 AlertUtils.showToast(mContext, "你好,子账号删除失败!"); 1049 AlertUtils.showToast(mContext, "你好,子账号删除失败!");
1046 1050
1047 } 1051 }
1048 } catch (JSONException e) { 1052 } catch (JSONException e) {
1049 e.printStackTrace(); 1053 e.printStackTrace();
1050 } 1054 }
1051 1055
1052 } 1056 }
1053 1057
1054 @Override 1058 @Override
1055 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1059 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1056 closeProgress(); 1060 closeProgress();
1057 // Log.e("test", "错误信息" + new String(arg2)); 1061 // Log.e("test", "错误信息" + new String(arg2));
1058 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1062 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1059 } 1063 }
1060 }); 1064 });
1061 1065
1062 } 1066 }
1063 1067
1064 /** 1068 /**
1065 * 添加子账户信息 1069 * 添加子账户信息
1066 */ 1070 */
1067 public void addchildAccountinfo(final Context mContext, long parentId, String image, 1071 public void addchildAccountinfo(final Context mContext, long parentId, String image,
1068 String name, final Long grade, Object school, Long region 1072 String name, final Long grade, Object school, Long region
1069 , String deviceNumber, String regionName) { 1073 , String deviceNumber, String regionName) {
1070 mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", 1074 mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...",
1071 false, true, null); 1075 false, true, null);
1072 RequestParams params = new RequestParams(); 1076 RequestParams params = new RequestParams();
1073 1077
1074 params.put(HttpKey.PARENTID, parentId); 1078 params.put(HttpKey.PARENTID, parentId);
1075 params.put(HttpKey.IMAGE, image); 1079 params.put(HttpKey.IMAGE, image);
1076 params.put(HttpKey.NAME, name); 1080 params.put(HttpKey.NAME, name);
1077 params.put(HttpKey.GRADE, grade); 1081 params.put(HttpKey.GRADE, grade);
1078 params.put(HttpKey.SCHOOL, school); 1082 params.put(HttpKey.SCHOOL, school);
1079 params.put(HttpKey.REGION, region); 1083 params.put(HttpKey.REGION, region);
1080 params.put(HttpKey.DEVINUMBER, deviceNumber); 1084 params.put(HttpKey.DEVINUMBER, deviceNumber);
1081 params.put(HttpKey.REGIONNAME, regionName); 1085 params.put(HttpKey.REGIONNAME, regionName);
1082 1086
1083 Log.e("test", "子账户信息" + params); 1087 Log.e("test", "子账户信息" + params);
1084 HttpClient.getInstance().addHeader("Accept", "*/*"); 1088 HttpClient.getInstance().addHeader("Accept", "*/*");
1085 HttpClient.getInstance().setTimeout(5 * 1000); 1089 HttpClient.getInstance().setTimeout(5 * 1000);
1086 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1090 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1087 HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { 1091 HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() {
1088 @Override 1092 @Override
1089 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1093 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1090 closeProgress(); 1094 closeProgress();
1091 1095
1092 Log.e("test", "子账户信息" + new String(arg2)); 1096 Log.e("test", "子账户信息" + new String(arg2));
1093 try { 1097 try {
1094 JSONObject jsonObject = new JSONObject(new String(arg2)); 1098 JSONObject jsonObject = new JSONObject(new String(arg2));
1095 int status = jsonObject.optInt("status"); 1099 int status = jsonObject.optInt("status");
1096 if (status == 1) { 1100 if (status == 1) {
1097 AlertUtils.showToast(mContext, "子账号添加成功!"); 1101 AlertUtils.showToast(mContext, "子账号添加成功!");
1098 ((Activity) mContext).finish(); 1102 ((Activity) mContext).finish();
1099 } else { 1103 } else {
1100 AlertUtils.showToast(mContext, "你好,子账号添加失败!"); 1104 AlertUtils.showToast(mContext, "你好,子账号添加失败!");
1101 1105
1102 } 1106 }
1103 } catch (JSONException e) { 1107 } catch (JSONException e) {
1104 e.printStackTrace(); 1108 e.printStackTrace();
1105 } 1109 }
1106 1110
1107 } 1111 }
1108 1112
1109 @Override 1113 @Override
1110 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1114 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1111 closeProgress(); 1115 closeProgress();
1112 // Log.e("test", "错误信息" + new String(arg2)); 1116 // Log.e("test", "错误信息" + new String(arg2));
1113 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1117 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1114 } 1118 }
1115 }); 1119 });
1116 1120
1117 } 1121 }
1118 1122
1119 /** 1123 /**
1120 * 切换子账户信息 1124 * 切换子账户信息
1121 * 1125 *
1122 * @param mContext 1126 * @param mContext
1123 * @param subAccountId 1127 * @param subAccountId
1124 */ 1128 */
1125 public void changechildAccountinfo(final Context mContext, String subAccountId, long userId 1129 public void changechildAccountinfo(final Context mContext, String subAccountId, long userId
1126 , String deviceNumber, int type) { 1130 , String deviceNumber, int type) {
1127 mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", 1131 mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...",
1128 false, true, null); 1132 false, true, null);
1129 HttpClient.getInstance().setTimeout(5 * 1000); 1133 HttpClient.getInstance().setTimeout(5 * 1000);
1130 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1134 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1131 HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId 1135 HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId
1132 + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { 1136 + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() {
1133 @Override 1137 @Override
1134 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1138 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1135 closeProgress(); 1139 closeProgress();
1136 // Log.e("test", "子账户信息" + new String(arg2)); 1140 // Log.e("test", "子账户信息" + new String(arg2));
1137 try { 1141 try {
1138 JSONObject jsonObject = new JSONObject(new String(arg2)); 1142 JSONObject jsonObject = new JSONObject(new String(arg2));
1139 int status = jsonObject.optInt("status"); 1143 int status = jsonObject.optInt("status");
1140 if (status == 1) { 1144 if (status == 1) {
1141 AlertUtils.showToast(mContext, "子账号切换成功!"); 1145 AlertUtils.showToast(mContext, "子账号切换成功!");
1142 ((Activity) mContext).finish(); 1146 ((Activity) mContext).finish();
1143 1147
1144 } else { 1148 } else {
1145 AlertUtils.showToast(mContext, "你好,子账号切换失败!"); 1149 AlertUtils.showToast(mContext, "你好,子账号切换失败!");
1146 1150
1147 } 1151 }
1148 } catch (JSONException e) { 1152 } catch (JSONException e) {
1149 e.printStackTrace(); 1153 e.printStackTrace();
1150 } 1154 }
1151 1155
1152 } 1156 }
1153 1157
1154 @Override 1158 @Override
1155 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1159 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1156 closeProgress(); 1160 closeProgress();
1157 //Log.e("test", "错误信息" + new String(arg2)); 1161 //Log.e("test", "错误信息" + new String(arg2));
1158 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1162 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1159 } 1163 }
1160 }); 1164 });
1161 1165
1162 } 1166 }
1163 1167
1164 /** 1168 /**
1165 * 切换主账户信息 1169 * 切换主账户信息
1166 * 1170 *
1167 * @param mContext 1171 * @param mContext
1168 * @param type 1172 * @param type
1169 */ 1173 */
1170 public void Accountinfo(final Context mContext, long userId 1174 public void Accountinfo(final Context mContext, long userId
1171 , String deviceNumber, int type) { 1175 , String deviceNumber, int type) {
1172 mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", 1176 mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...",
1173 false, true, null); 1177 false, true, null);
1174 HttpClient.getInstance().setTimeout(5 * 1000); 1178 HttpClient.getInstance().setTimeout(5 * 1000);
1175 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1179 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1176 HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber 1180 HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber
1177 + "&type=" + type, new AsyncHttpResponseHandler() { 1181 + "&type=" + type, new AsyncHttpResponseHandler() {
1178 @Override 1182 @Override
1179 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1183 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1180 closeProgress(); 1184 closeProgress();
1181 // Log.e("test", "子账户信息" + new String(arg2)); 1185 // Log.e("test", "子账户信息" + new String(arg2));
1182 try { 1186 try {
1183 JSONObject jsonObject = new JSONObject(new String(arg2)); 1187 JSONObject jsonObject = new JSONObject(new String(arg2));
1184 int status = jsonObject.optInt("status"); 1188 int status = jsonObject.optInt("status");
1185 if (status == 1) { 1189 if (status == 1) {
1186 AlertUtils.showToast(mContext, "主账号切换成功!"); 1190 AlertUtils.showToast(mContext, "主账号切换成功!");
1187 ((Activity) mContext).finish(); 1191 ((Activity) mContext).finish();
1188 1192
1189 } else { 1193 } else {
1190 AlertUtils.showToast(mContext, "你好,主账号切换失败!"); 1194 AlertUtils.showToast(mContext, "你好,主账号切换失败!");
1191 1195
1192 } 1196 }
1193 } catch (JSONException e) { 1197 } catch (JSONException e) {
1194 e.printStackTrace(); 1198 e.printStackTrace();
1195 } 1199 }
1196 1200
1197 } 1201 }
1198 1202
1199 @Override 1203 @Override
1200 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1204 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1201 closeProgress(); 1205 closeProgress();
1202 // Log.e("test", "错误信息" + new String(arg2)); 1206 // Log.e("test", "错误信息" + new String(arg2));
1203 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1207 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1204 } 1208 }
1205 }); 1209 });
1206 1210
1207 } 1211 }
1208 1212
1209 /** 1213 /**
1210 * 头像拍张 1214 * 头像拍张
1211 * 1215 *
1212 * @param mContext 1216 * @param mContext
1213 * @param userId 1217 * @param userId
1214 * @param img 1218 * @param img
1215 * @throws UnsupportedEncodingException 1219 * @throws UnsupportedEncodingException
1216 */ 1220 */
1217 public void header(final Context mContext, String userId, String type, String img, final Handler handler) throws UnsupportedEncodingException { 1221 public void header(final Context mContext, String userId, String type, String img, final Handler handler) throws UnsupportedEncodingException {
1218 1222
1219 File file = new File(img); 1223 File file = new File(img);
1220 if (file.exists() && file.length() > 0) { 1224 if (file.exists() && file.length() > 0) {
1221 RequestParams params = new RequestParams(); 1225 RequestParams params = new RequestParams();
1222 try { 1226 try {
1223 params.put("userId", userId); 1227 params.put("userId", userId);
1224 params.put("type", type); 1228 params.put("type", type);
1225 params.put("img", file); 1229 params.put("img", file);
1226 } catch (FileNotFoundException e) { 1230 } catch (FileNotFoundException e) {
1227 e.printStackTrace(); 1231 e.printStackTrace();
1228 } 1232 }
1229 Log.e("test", "params" + params); 1233 Log.e("test", "params" + params);
1230 HttpClient.getInstance().setTimeout(5 * 1000); 1234 HttpClient.getInstance().setTimeout(5 * 1000);
1231 HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { 1235 HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() {
1232 @Override 1236 @Override
1233 public void onSuccess(int i, Header[] headers, byte[] bytes) { 1237 public void onSuccess(int i, Header[] headers, byte[] bytes) {
1234 // Log.e("test", "onSuccess" + new String(bytes)); 1238 // Log.e("test", "onSuccess" + new String(bytes));
1235 try { 1239 try {
1236 JSONObject jsonObject = new JSONObject(new String(bytes)); 1240 JSONObject jsonObject = new JSONObject(new String(bytes));
1237 String status = jsonObject.optString("status"); 1241 String status = jsonObject.optString("status");
1238 JSONObject jsonObject1 = jsonObject.getJSONObject("data"); 1242 JSONObject jsonObject1 = jsonObject.getJSONObject("data");
1239 String imagUrl = jsonObject1.optString("imgUrl"); 1243 String imagUrl = jsonObject1.optString("imgUrl");
1240 SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); 1244 SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl);
1241 if (status.equals("1")) { 1245 if (status.equals("1")) {
1242 Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); 1246 Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show();
1243 SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); 1247 SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl);
1244 Message msg = Message.obtain(); 1248 Message msg = Message.obtain();
1245 msg.what = HttpCode.TOUXIANG; 1249 msg.what = HttpCode.TOUXIANG;
1246 msg.obj = status; 1250 msg.obj = status;
1247 handler.sendMessage(msg); 1251 handler.sendMessage(msg);
1248 } else { 1252 } else {
1249 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); 1253 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试");
1250 } 1254 }
1251 } catch (JSONException e) { 1255 } catch (JSONException e) {
1252 e.printStackTrace(); 1256 e.printStackTrace();
1253 } 1257 }
1254 } 1258 }
1255 1259
1256 @Override 1260 @Override
1257 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 1261 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
1258 closeProgress(); 1262 closeProgress();
1259 // Log.e("test", "错误信息" + new String(bytes)); 1263 // Log.e("test", "错误信息" + new String(bytes));
1260 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1264 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1261 1265
1262 } 1266 }
1263 }); 1267 });
1264 } else { 1268 } else {
1265 Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); 1269 Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show();
1266 } 1270 }
1267 } 1271 }
1268 1272
1269 /** 1273 /**
1270 * 头像默认 1274 * 头像默认
1271 * 1275 *
1272 * @param mContext 1276 * @param mContext
1273 * @param userId 1277 * @param userId
1274 * @param 1278 * @param
1275 * @throws UnsupportedEncodingException 1279 * @throws UnsupportedEncodingException
1276 */ 1280 */
1277 public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { 1281 public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException {
1278 RequestParams params = new RequestParams(); 1282 RequestParams params = new RequestParams();
1279 params.put("userId", userId); 1283 params.put("userId", userId);
1280 params.put("type", type); 1284 params.put("type", type);
1281 params.put("defaultImg", defaultImg); 1285 params.put("defaultImg", defaultImg);
1282 Log.e("test", "params" + params); 1286 Log.e("test", "params" + params);
1283 HttpClient.getInstance().setTimeout(5 * 1000); 1287 HttpClient.getInstance().setTimeout(5 * 1000);
1284 HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { 1288 HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() {
1285 @Override 1289 @Override
1286 public void onSuccess(int i, Header[] headers, byte[] bytes) { 1290 public void onSuccess(int i, Header[] headers, byte[] bytes) {
1287 //Log.e("test", "onSuccess" + new String(bytes)); 1291 //Log.e("test", "onSuccess" + new String(bytes));
1288 try { 1292 try {
1289 JSONObject jsonObject = new JSONObject(new String(bytes)); 1293 JSONObject jsonObject = new JSONObject(new String(bytes));
1290 String status = jsonObject.optString("status"); 1294 String status = jsonObject.optString("status");
1291 JSONObject jsonObject1 = jsonObject.getJSONObject("data"); 1295 JSONObject jsonObject1 = jsonObject.getJSONObject("data");
1292 String imagUrl = jsonObject1.optString("imgUrl"); 1296 String imagUrl = jsonObject1.optString("imgUrl");
1293 SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); 1297 SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl);
1294 if (status.equals("1")) { 1298 if (status.equals("1")) {
1295 Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); 1299 Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show();
1296 SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); 1300 SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl);
1297 } else { 1301 } else {
1298 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); 1302 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试");
1299 } 1303 }
1300 } catch (JSONException e) { 1304 } catch (JSONException e) {
1301 e.printStackTrace(); 1305 e.printStackTrace();
1302 } 1306 }
1303 } 1307 }
1304 1308
1305 @Override 1309 @Override
1306 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 1310 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
1307 closeProgress(); 1311 closeProgress();
1308 //.e("test", "错误信息" + new String(bytes)); 1312 //.e("test", "错误信息" + new String(bytes));
1309 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1313 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1310 1314
1311 } 1315 }
1312 }); 1316 });
1313 } 1317 }
1314 1318
1315 /** 1319 /**
1316 * 检查注册信息是否完整 1320 * 检查注册信息是否完整
1317 * 1321 *
1318 * @param mContext 1322 * @param mContext
1319 * @param userId 1323 * @param userId
1320 */ 1324 */
1321 public void registerinfocheck(final Context mContext, long userId, final Handler handler) { 1325 public void registerinfocheck(final Context mContext, long userId, final Handler handler) {
1322 mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", 1326 mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...",
1323 false, true, null); 1327 false, true, null);
1324 HttpClient.getInstance().setTimeout(5 * 1000); 1328 HttpClient.getInstance().setTimeout(5 * 1000);
1325 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1329 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1326 HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { 1330 HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() {
1327 @Override 1331 @Override
1328 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1332 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1329 closeProgress(); 1333 closeProgress();
1330 //Log.e("test", "注册信息" + new String(arg2)); 1334 //Log.e("test", "注册信息" + new String(arg2));
1331 Message msg = Message.obtain(); 1335 Message msg = Message.obtain();
1332 msg.what = HttpCode.REGISTER_SUCESS; 1336 msg.what = HttpCode.REGISTER_SUCESS;
1333 msg.obj = new String(arg2); 1337 msg.obj = new String(arg2);
1334 handler.sendMessage(msg); 1338 handler.sendMessage(msg);
1335 1339
1336 } 1340 }
1337 1341
1338 @Override 1342 @Override
1339 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1343 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1340 closeProgress(); 1344 closeProgress();
1341 // Log.e("test", "错误信息" + new String(arg2)); 1345 // Log.e("test", "错误信息" + new String(arg2));
1342 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1346 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1343 1347
1344 } 1348 }
1345 }); 1349 });
1346 1350
1347 } 1351 }
1348 1352
1349 /** 1353 /**
1350 * 获取最近学习视频 1354 * 获取最近学习视频
1351 * 1355 *
1352 * @param mContext 1356 * @param mContext
1353 * @param userId 1357 * @param userId
1354 */ 1358 */
1355 public void getstuyvidioinfo(final Context mContext, Object userId, final Handler handler) { 1359 public void getstuyvidioinfo(final Context mContext, Object userId, final Handler handler) {
1356 mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", 1360 mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...",
1357 false, true, null); 1361 false, true, null);
1358 HttpClient.getInstance().setTimeout(5 * 1000); 1362 HttpClient.getInstance().setTimeout(5 * 1000);
1359 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1363 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1360 HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { 1364 HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() {
1361 @Override 1365 @Override
1362 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1366 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1363 closeProgress(); 1367 closeProgress();
1364 //Log.e("test", "近学习视频" + new String(arg2)); 1368 //Log.e("test", "近学习视频" + new String(arg2));
1365 try { 1369 try {
1366 JSONObject jsonObject = new JSONObject(new String(arg2)); 1370 JSONObject jsonObject = new JSONObject(new String(arg2));
1367 int status = jsonObject.optInt("status"); 1371 int status = jsonObject.optInt("status");
1368 if (status == 1) { 1372 if (status == 1) {
1369 VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 1373 VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据
1370 List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); 1374 List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData();
1371 Message msg = Message.obtain(); 1375 Message msg = Message.obtain();
1372 msg.what = HttpCode.GETVIDIO_SUCESS; 1376 msg.what = HttpCode.GETVIDIO_SUCESS;
1373 msg.obj = schoolInfoBeanList; 1377 msg.obj = schoolInfoBeanList;
1374 handler.sendMessage(msg); 1378 handler.sendMessage(msg);
1375 1379
1376 } else if (status == 1000){ 1380 } else if (status == 1000){
1377 //AlertUtils.showToast(mContext, "暂无最近学习视频!"); 1381 //AlertUtils.showToast(mContext, "暂无最近学习视频!");
1378 1382
1379 }else { 1383 }else {
1380 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1384 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1381 } 1385 }
1382 } catch (JSONException e) { 1386 } catch (JSONException e) {
1383 e.printStackTrace(); 1387 e.printStackTrace();
1384 1388
1385 } 1389 }
1386 1390
1387 } 1391 }
1388 1392
1389 @Override 1393 @Override
1390 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1394 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1391 closeProgress(); 1395 closeProgress();
1392 // Log.e("test", "错误信息" + new String(arg2)); 1396 // Log.e("test", "错误信息" + new String(arg2));
1393 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1397 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1394 1398
1395 } 1399 }
1396 }); 1400 });
1397 1401
1398 } 1402 }
1399 1403
1400 1404
1401 /** 1405 /**
1402 * 系统升级 1406 * 系统升级
1403 * 1407 *
1404 * @param mContext 1408 * @param mContext
1405 * @param pid appName 1409 * @param pid appName
1406 */ 1410 */
1407 public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { 1411 public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) {
1408 // mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", 1412 // mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...",
1409 // false, true, null); 1413 // false, true, null);
1410 HttpClient.getInstance().setTimeout(5 * 1000); 1414 HttpClient.getInstance().setTimeout(5 * 1000);
1411 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1415 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1412 HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { 1416 HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() {
1413 @Override 1417 @Override
1414 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1418 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1415 //closeProgress(); 1419 //closeProgress();
1416 // Log.e("test", "版本升级信息" + new String(arg2)); 1420 // Log.e("test", "版本升级信息" + new String(arg2));
1417 Gson gson = new Gson(); 1421 Gson gson = new Gson();
1418 List<AppVersion> applist = gson.fromJson(new String(arg2), 1422 List<AppVersion> applist = gson.fromJson(new String(arg2),
1419 new TypeToken<List<AppVersion>>() {}.getType()); 1423 new TypeToken<List<AppVersion>>() {}.getType());
1420 Log.e("test", "版本升级信息" + applist); 1424 Log.e("test", "版本升级信息" + applist);
1421 Message msg = Message.obtain(); 1425 Message msg = Message.obtain();
1422 msg.what = HttpCode.APPUPDATE_SUCESS; 1426 msg.what = HttpCode.APPUPDATE_SUCESS;
1423 msg.obj = applist; 1427 msg.obj = applist;
1424 handler.sendMessage(msg); 1428 handler.sendMessage(msg);
1425 1429
1426 1430
1427 1431
1428 } 1432 }
1429 1433
1430 @Override 1434 @Override
1431 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1435 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1432 //closeProgress(); 1436 //closeProgress();
1433 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1437 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1434 } 1438 }
1435 }); 1439 });
1436 1440
1437 } 1441 }
1438 1442
1439 //版本信息 1443 //版本信息
1440 public void versioninfo(final Context mContext, String subjectName, final Handler handler) { 1444 public void versioninfo(final Context mContext, String subjectName, final Handler handler) {
1441 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1445 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1442 HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { 1446 HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() {
1443 @Override 1447 @Override
1444 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1448 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1445 //Log.e("test", "版本信息" + new String(arg2)); 1449 //Log.e("test", "版本信息" + new String(arg2));
1446 try { 1450 try {
1447 JSONObject jsonObject = new JSONObject(new String(arg2)); 1451 JSONObject jsonObject = new JSONObject(new String(arg2));
1448 int status = jsonObject.optInt("status"); 1452 int status = jsonObject.optInt("status");
1449 if (status == 1) { 1453 if (status == 1) {
1450 VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 1454 VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据
1451 List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); 1455 List<VersionInfo.DataBean> versionInfoList = versionInfo.getData();
1452 Message message = Message.obtain(); 1456 Message message = Message.obtain();
1453 message.what = HttpCode.VERSION_SUCESS; 1457 message.what = HttpCode.VERSION_SUCESS;
1454 message.obj = versionInfoList; 1458 message.obj = versionInfoList;
1455 handler.sendMessage(message); 1459 handler.sendMessage(message);
1456 1460
1457 } else if (status == 1000) { 1461 } else if (status == 1000) {
1458 AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); 1462 AlertUtils.showToast(mContext, "你好,该科目没有版本信息");
1459 1463
1460 } else { 1464 } else {
1461 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); 1465 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
1462 } 1466 }
1463 } catch (JSONException e) { 1467 } catch (JSONException e) {
1464 e.printStackTrace(); 1468 e.printStackTrace();
1465 } 1469 }
1466 1470
1467 1471
1468 } 1472 }
1469 1473
1470 @Override 1474 @Override
1471 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1475 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1472 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1476 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1473 } 1477 }
1474 }); 1478 });
1475 } 1479 }
1476 1480
1477 1481
1478 ///省级接口 1482 ///省级接口
1479 public void provices(final Context mContext, final Handler handler) { 1483 public void provices(final Context mContext, final Handler handler) {
1480 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1484 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1481 HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { 1485 HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() {
1482 @Override 1486 @Override
1483 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1487 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1484 // Log.e("test", "省" + new String(arg2)); 1488 // Log.e("test", "省" + new String(arg2));
1485 try { 1489 try {
1486 JSONObject jsonObject = new JSONObject(new String(arg2)); 1490 JSONObject jsonObject = new JSONObject(new String(arg2));
1487 int status = jsonObject.optInt("status"); 1491 int status = jsonObject.optInt("status");
1488 if (status == 100) { 1492 if (status == 100) {
1489 ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 1493 ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据
1490 Log.e("test", "状态码" + provinceInfo.getStatus()); 1494 Log.e("test", "状态码" + provinceInfo.getStatus());
1491 List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); 1495 List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces();
1492 Message message = Message.obtain(); 1496 Message message = Message.obtain();
1493 message.what = HttpCode.PROVICES; 1497 message.what = HttpCode.PROVICES;
1494 message.obj = provincesBeanList; 1498 message.obj = provincesBeanList;
1495 handler.sendMessage(message); 1499 handler.sendMessage(message);
1496 1500
1497 1501
1498 } else { 1502 } else {
1499 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); 1503 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
1500 1504
1501 } 1505 }
1502 } catch (JSONException e) { 1506 } catch (JSONException e) {
1503 e.printStackTrace(); 1507 e.printStackTrace();
1504 } 1508 }
1505 1509
1506 1510
1507 } 1511 }
1508 1512
1509 @Override 1513 @Override
1510 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1514 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1511 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1515 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1512 } 1516 }
1513 }); 1517 });
1514 } 1518 }
1515 1519
1516 //获取版本信息接口 1520 //获取版本信息接口
1517 public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { 1521 public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) {
1518 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1522 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1519 HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { 1523 HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() {
1520 @Override 1524 @Override
1521 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1525 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1522 // Log.e("test", "获取版本信息接口" + new String(arg2)); 1526 // Log.e("test", "获取版本信息接口" + new String(arg2));
1523 try { 1527 try {
1524 JSONObject jsonObject = new JSONObject(new String(arg2)); 1528 JSONObject jsonObject = new JSONObject(new String(arg2));
1525 int status = jsonObject.optInt("status"); 1529 int status = jsonObject.optInt("status");
1526 if (status == 1) { 1530 if (status == 1) {
1527 Gson gson = new Gson(); 1531 Gson gson = new Gson();
1528 DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); 1532 DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class);
1529 List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); 1533 List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData();
1530 Message message = Message.obtain(); 1534 Message message = Message.obtain();
1531 message.what = HttpCode.PUBLISH_SUCESS; 1535 message.what = HttpCode.PUBLISH_SUCESS;
1532 message.obj = defautPublishInfoBeanList; 1536 message.obj = defautPublishInfoBeanList;
1533 handler.sendMessage(message); 1537 handler.sendMessage(message);
1534 1538
1535 } else { 1539 } else {
1536 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); 1540 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
1537 1541
1538 } 1542 }
1539 } catch (JSONException e) { 1543 } catch (JSONException e) {
1540 e.printStackTrace(); 1544 e.printStackTrace();
1541 } 1545 }
1542 1546
1543 1547
1544 } 1548 }
1545 1549
1546 @Override 1550 @Override
1547 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1551 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1548 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1552 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1549 } 1553 }
1550 }); 1554 });
1551 } 1555 }
1552 1556
1553 1557
1554 //市级接口 1558 //市级接口
1555 public void cityinfo(final Context mContext, long regionId, final Handler handler) { 1559 public void cityinfo(final Context mContext, long regionId, final Handler handler) {
1556 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1560 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1557 HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { 1561 HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() {
1558 @Override 1562 @Override
1559 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1563 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1560 // Log.e("test", "市" + new String(arg2)); 1564 // Log.e("test", "市" + new String(arg2));
1561 try { 1565 try {
1562 JSONObject jsonObject = new JSONObject(new String(arg2)); 1566 JSONObject jsonObject = new JSONObject(new String(arg2));
1563 int status = jsonObject.optInt("status"); 1567 int status = jsonObject.optInt("status");
1564 if (status == 100) { 1568 if (status == 100) {
1565 Gson gson = new Gson(); 1569 Gson gson = new Gson();
1566 CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); 1570 CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class);
1567 List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); 1571 List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities();
1568 Message message = Message.obtain(); 1572 Message message = Message.obtain();
1569 message.what = HttpCode.CITYS; 1573 message.what = HttpCode.CITYS;
1570 message.obj = cityInfoBeanList; 1574 message.obj = cityInfoBeanList;
1571 handler.sendMessage(message); 1575 handler.sendMessage(message);
1572 1576
1573 } else { 1577 } else {
1574 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); 1578 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
1575 1579
1576 } 1580 }
1577 } catch (JSONException e) { 1581 } catch (JSONException e) {
1578 e.printStackTrace(); 1582 e.printStackTrace();
1579 } 1583 }
1580 1584
1581 1585
1582 } 1586 }
1583 1587
1584 @Override 1588 @Override
1585 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1589 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1586 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1590 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1587 } 1591 }
1588 }); 1592 });
1589 } 1593 }
1590 1594
1591 //区县级接口 1595 //区县级接口
1592 public void countyinfo(final Context mContext, int parentId, final Handler handler) { 1596 public void countyinfo(final Context mContext, int parentId, final Handler handler) {
1593 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1597 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1594 HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { 1598 HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() {
1595 @Override 1599 @Override
1596 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1600 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1597 // Log.e("test", "区" + new String(arg2)); 1601 // Log.e("test", "区" + new String(arg2));
1598 try { 1602 try {
1599 JSONObject jsonObject = new JSONObject(new String(arg2)); 1603 JSONObject jsonObject = new JSONObject(new String(arg2));
1600 int status = jsonObject.optInt("status"); 1604 int status = jsonObject.optInt("status");
1601 if (status == 100) { 1605 if (status == 100) {
1602 Gson gson = new Gson(); 1606 Gson gson = new Gson();
1603 CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); 1607 CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class);
1604 List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); 1608 List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties();
1605 Message message = Message.obtain(); 1609 Message message = Message.obtain();
1606 message.what = HttpCode.COUNTRY; 1610 message.what = HttpCode.COUNTRY;
1607 message.obj = countyInfoInfoBeanList; 1611 message.obj = countyInfoInfoBeanList;
1608 handler.sendMessage(message); 1612 handler.sendMessage(message);
1609 } else { 1613 } else {
1610 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); 1614 AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
1611 1615
1612 } 1616 }
1613 } catch (JSONException e) { 1617 } catch (JSONException e) {
1614 e.printStackTrace(); 1618 e.printStackTrace();
1615 } 1619 }
1616 1620
1617 1621
1618 } 1622 }
1619 1623
1620 @Override 1624 @Override
1621 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1625 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1622 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); 1626 AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!");
1623 } 1627 }
1624 }); 1628 });
1625 } 1629 }
1626 1630
1627 1631
1628 private void closeProgress() { 1632 private void closeProgress() {
1629 try { 1633 try {
1630 if (mProgress != null) { 1634 if (mProgress != null) {
1631 mProgress.dismiss(); 1635 mProgress.dismiss();
1632 mProgress = null; 1636 mProgress = null;
1633 } 1637 }
1634 } catch (Exception e) { 1638 } catch (Exception e) {
1635 e.printStackTrace(); 1639 e.printStackTrace();
1636 } 1640 }
1637 } 1641 }
1638 1642
1639 public boolean onKeyDown(int keyCode, KeyEvent event) { 1643 public boolean onKeyDown(int keyCode, KeyEvent event) {
1640 if (keyCode == KeyEvent.KEYCODE_BACK) { 1644 if (keyCode == KeyEvent.KEYCODE_BACK) {
1641 1645
1642 HttpManager.getInstance().closeProgress(); 1646 HttpManager.getInstance().closeProgress();
1643 } 1647 }
1644 1648
1645 return false; 1649 return false;
1646 1650
1647 } 1651 }
1648 1652
1649 } 1653 }
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/CenterService.java
1 package com.hjx.personalcenter.service; 1 package com.hjx.personalcenter.service;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.IBinder; 4 import android.os.IBinder;
5 import android.os.RemoteException; 5 import android.os.RemoteException;
6 6
7 import com.google.gson.Gson; 7 import com.google.gson.Gson;
8 import com.hjx.personalcenter.activity.LoginAndRegisterActivity; 8 import com.hjx.personalcenter.activity.LoginAndRegisterActivity;
9 import com.hjx.personalcenter.db.SaveParam; 9 import com.hjx.personalcenter.db.SaveParam;
10 import com.hjx.personalcenter.model.CardInfo; 10 import com.hjx.personalcenter.model.CardInfo;
11 import com.hjx.personalcenter.model.LoginInfo; 11 import com.hjx.personalcenter.model.LoginInfo;
12 import com.hjx.personalcenter.model.UserInfoModer; 12 import com.hjx.personalcenter.model.UserInfoModer;
13 import com.hjx.personalcenter.util.GetDevicesUtil; 13 import com.hjx.personalcenter.util.GetDevicesUtil;
14 14
15 /** 15 /**
16 * Created by h on 2017/9/1. 16 * Created by h on 2017/9/1.
17 */ 17 */
18 18
19 public class CenterService extends BaseService { 19 public class CenterService extends BaseService {
20 enum ACTIVITY_ACTION{ 20 enum ACTIVITY_ACTION{
21 userinfo_activity 21 userinfo_activity
22 } 22 }
23 public CenterService(){ 23 public CenterService(){
24 24
25 } 25 }
26 IPresonalInterface.Stub binder = new IPresonalInterface.Stub() { 26 IPresonalInterface.Stub binder = new IPresonalInterface.Stub() {
27 @Override 27 @Override
28 public String sayHello() throws RemoteException { 28 public String sayHello() throws RemoteException {
29 return "这是测试AIDL的方法"; 29 return "这是测试AIDL的方法";
30 } 30 }
31 31
32 @Override 32 @Override
33 public String viewPage(String action) throws RemoteException { 33 public String viewPage(String action) throws RemoteException {
34 String result = null; 34 String result = null;
35 if(action.equals(ACTIVITY_ACTION.userinfo_activity.toString())){ 35 if(action.equals(ACTIVITY_ACTION.userinfo_activity.toString())){
36 //登录界面 36 //登录界面
37 Intent intent = new Intent(); 37 Intent intent = new Intent();
38 intent.setClass(CenterService.this, LoginAndRegisterActivity.class); 38 intent.setClass(CenterService.this, LoginAndRegisterActivity.class);
39 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 39 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
40 startActivity(intent); 40 startActivity(intent);
41 result= "跳转成功"; 41 result= "跳转成功";
42 } 42 }
43 43
44 return result; 44 return result;
45 } 45 }
46 46
47 @Override 47 @Override
48 public String getSimpleUser() throws RemoteException { 48 public String getSimpleUser() throws RemoteException {
49 String logininfo = null; 49 String logininfo = null;
50 Gson gson = new Gson(); 50 Gson gson = new Gson();
51 LoginInfo loginInfo = new LoginInfo(); 51 LoginInfo loginInfo = new LoginInfo();
52 String islogin = SaveParam.getInstance().getLoginParam(getApplication(),"login"); 52 String islogin = SaveParam.getInstance().getLoginParam(getApplication(),"login");
53 //子账户id 53 //子账户id
54 String childsidid = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CHILDSID); 54 String childsidid = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CHILDSID);
55 //账户类型 55 //账户类型
56 String accounts = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ACCOUNT); 56 String accounts = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ACCOUNT);
57 if ("true".equals(islogin)){ 57 if ("true".equals(islogin)){
58 loginInfo.setUsername(SaveParam.getInstance().getLoginParam(getApplication(), "username")); 58 loginInfo.setUsername(SaveParam.getInstance().getLoginParam(getApplication(), "username"));
59 loginInfo.setPassword(SaveParam.getInstance().getLoginParam(getApplication(), "password")); 59 loginInfo.setPassword(SaveParam.getInstance().getLoginParam(getApplication(), "password"));
60 loginInfo.setAccess_token(SaveParam.getInstance().getLoginParam(getApplication(), "access_token")); 60 loginInfo.setAccess_token(SaveParam.getInstance().getLoginParam(getApplication(), "access_token"));
61 loginInfo.setLoginStatus(SaveParam.getInstance().getLoginParam(getApplication(), "login")); 61 loginInfo.setLoginStatus(SaveParam.getInstance().getLoginParam(getApplication(), "login"));
62 62
63 if ("2".equals(accounts)){ 63 if ("2".equals(accounts)){
64 loginInfo.setUserId(childsidid); 64 loginInfo.setUserId(childsidid);
65 }else { 65 }else {
66 loginInfo.setUserId(SaveParam.getInstance().getLoginParam(getApplication(), "userId")); 66 loginInfo.setUserId(SaveParam.getInstance().getLoginParam(getApplication(), "userId"));
67 } 67 }
68 68
69 logininfo =gson.toJson(loginInfo); 69 logininfo =gson.toJson(loginInfo);
70 70
71 //Log.e("test","登录信息"+logininfo); 71 //Log.e("test","登录信息"+logininfo);
72 72
73 } 73 }
74 74
75 return logininfo; 75 return logininfo;
76 } 76 }
77 //保卡信息 77 //保卡信息
78 @Override 78 @Override
79 public String getcardUser() throws RemoteException { 79 public String getcardUser() throws RemoteException {
80 String results = null; 80 String results = null;
81 // CardInfo cardInfo = new CardInfo(); 81 // CardInfo cardInfo = new CardInfo();
82 CardInfo.DataBean dataBean = new CardInfo.DataBean(); 82 CardInfo.DataBean dataBean = new CardInfo.DataBean();
83 Gson gson = new Gson(); 83 Gson gson = new Gson();
84 84
85 //获取设备信息 85 //获取设备信息
86 dataBean.setProductModel(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceModel()); 86 dataBean.setProductModel(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceModel());
87 dataBean.setDeviceNumber(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceNumber()); 87 dataBean.setDeviceNumber(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceNumber());
88 dataBean.setMacAddress(GetDevicesUtil.getDevicesInfo(getApplication()).getMac()); 88 dataBean.setMacAddress(GetDevicesUtil.getDevicesInfo(getApplication()).getMac());
89 //获取保卡信息 89 //获取保卡信息
90 dataBean.setCustomerName(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CUNSTEMNAME)); 90 dataBean.setCustomerName(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CUNSTEMNAME));
91 dataBean.setCustomerAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ADRESSCUNSTEM)); 91 dataBean.setCustomerAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ADRESSCUNSTEM));
92 dataBean.setBuyTime(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTIME)); 92 dataBean.setBuyTime(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTIME));
93 dataBean.setBuyAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPADRESS)); 93 dataBean.setBuyAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPADRESS));
94 dataBean.setAlterSaleCall(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTLEPHONE)); 94 dataBean.setAlterSaleCall(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTLEPHONE));
95 dataBean.setMobilePhone(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CARDPHONE)); 95 dataBean.setMobilePhone(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CARDPHONE));
96 // cardInfo.setData(dataBean); 96 // cardInfo.setData(dataBean);
97 97
98 //Log.e("test","保卡信息"+results); 98 //Log.e("test","保卡信息"+results);
99 String yangji = SaveParam.getInstance().getLoginParam(getApplication(), SaveParam.YANGJI); 99 String yangji = SaveParam.getInstance().getLoginParam(getApplication(), SaveParam.YANGJI);
100 if ("1".equals(yangji)) { 100 if ("1".equals(yangji)) {
101 results = null; 101 results = null;
102 } else { 102 } else {
103 results = gson.toJson(dataBean); 103 results = gson.toJson(dataBean);
104 } 104 }
105 105
106 return results; 106 return results;
107 107
108 } 108 }
109 109
110 @Override 110 @Override
111 public String getUserInfo() throws RemoteException { 111 public String getUserInfo() throws RemoteException {
112 String userinfo = null; 112 String userinfo = null;
113 Gson gson = new Gson(); 113 Gson gson = new Gson();
114 UserInfoModer userInfoModer = new UserInfoModer(); 114 UserInfoModer userInfoModer = new UserInfoModer();
115 userInfoModer.setNickName(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTUSERNAME)); 115 userInfoModer.setNickName(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTUSERNAME));
116 userInfoModer.setGrade(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTGRADES)); 116 userInfoModer.setGrade(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTGRADES));
117 userInfoModer.setSchool(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSCHOOL)); 117 userInfoModer.setSchool(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSCHOOL));
118 userInfoModer.setBirthday(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTCONSTELLATION)); 118 userInfoModer.setBirthday(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTCONSTELLATION));
119 userInfoModer.setGender(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSEX)); 119 userInfoModer.setGender(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSEX));
120 userInfoModer.setQq(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTQQ)); 120 userInfoModer.setQq(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTQQ));
121 userInfoModer.setAddress(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTXINGZUO)); 121 userInfoModer.setAddress(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTADRESS));
122 userInfoModer.setPortrait(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.PORTAIT)); 122 userInfoModer.setPortrait(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.PORTAIT));
123 userInfoModer.setGradeid(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.GRADENS)); 123 userInfoModer.setGradeid(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.GRADENS));
124 userInfoModer.setIsprototype(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.YANGJI)); 124 userInfoModer.setIsprototype(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.YANGJI));
125 userinfo = gson.toJson(userInfoModer); 125 userinfo = gson.toJson(userInfoModer);
126 return userinfo; 126 return userinfo;
127 } 127 }
128 128
129 @Override 129 @Override
130 public String logout() throws RemoteException { 130 public String logout() throws RemoteException {
131 String visoninfo = SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.VERSIONINTEFACE); 131 String visoninfo = SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.VERSIONINTEFACE);
132 return visoninfo; 132 return visoninfo;
133 } 133 }
134 134
135 @Override 135 @Override
136 public String validateToken() throws RemoteException { 136 public String validateToken() throws RemoteException {
137 return null; 137 return null;
138 } 138 }
139 139
140 @Override 140 @Override
141 public String getDeviceID() throws RemoteException { 141 public String getDeviceID() throws RemoteException {
142 return null; 142 return null;
143 } 143 }
144 144
145 @Override 145 @Override
146 public String getChildsInfo() throws RemoteException { 146 public String getChildsInfo() throws RemoteException {
147 return null; 147 return null;
148 } 148 }
149 }; 149 };
150 150
151 @Override 151 @Override
152 public IBinder onBind(Intent intent) { 152 public IBinder onBind(Intent intent) {
153 return binder; 153 return binder;
154 } 154 }
155 155
156 @Override 156 @Override
157 public void onDestroy() { 157 public void onDestroy() {
158 super.onDestroy(); 158 super.onDestroy();
159 } 159 }
160 } 160 }
161 161
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/VersionCodeUtils.java
File was created 1 package com.hjx.personalcenter.util;
2
3 import android.content.Context;
4 import android.content.pm.PackageManager;
5
6 import com.hjx.personalcenter.activity.MyApplication;
7
8 /**
9 * Created by liujiaqi on 2018/4/11.
10 */
11
12 public class VersionCodeUtils {
13 /**
14 * 获取当前本地apk的版本
15 *
16 * @return
17 */
18 public static int getVersionCode() {
19 int versionCode = 0;
20 try {
21 //获取软件版本号,对应AndroidManifest.xml下android:versionCode
22 versionCode = MyApplication.getInstance().getPackageManager().
23 getPackageInfo(MyApplication.getInstance().getPackageName(), 0).versionCode;
24 } catch (PackageManager.NameNotFoundException e) {
25 e.printStackTrace();
26 }
27 return versionCode;
28 }
29
30 /**
31 * 获取版本号名称
32 *
33 * @return
34 */
35 public static String getVerName() {
36 String verName = "";
37 try {
38 verName = MyApplication.getInstance().getPackageManager().
39 getPackageInfo(MyApplication.getInstance().getPackageName(), 0).versionName;
40 } catch (PackageManager.NameNotFoundException e) {
41 e.printStackTrace();
42 }
43 return verName;
44 }
45 }
46
PersonalCenter/app/src/main/res/layout/activity_electronic_look_cardinfo.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:orientation="vertical"> 5 android:orientation="vertical">
6 6
7 <RelativeLayout 7 <RelativeLayout
8 android:id="@+id/title" 8 android:id="@+id/title"
9 android:layout_width="match_parent" 9 android:layout_width="match_parent"
10 android:layout_height="wrap_content" 10 android:layout_height="wrap_content"
11 android:background="@color/login_text_blue" 11 android:background="@color/login_text_blue"
12 android:minHeight="50dp"> 12 android:minHeight="50dp">
13 13
14 <ImageView 14 <ImageView
15 android:id="@+id/cancel" 15 android:id="@+id/cancel"
16 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
17 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
18 android:layout_centerVertical="true" 18 android:layout_centerVertical="true"
19 android:paddingLeft="20dp" 19 android:paddingLeft="20dp"
20 android:paddingRight="20dp" 20 android:paddingRight="20dp"
21 android:src="@mipmap/title_back" /> 21 android:src="@mipmap/title_back" />
22 22
23 <TextView 23 <TextView
24 android:id="@+id/menu_title" 24 android:id="@+id/menu_title"
25 android:layout_width="wrap_content" 25 android:layout_width="wrap_content"
26 android:layout_height="wrap_content" 26 android:layout_height="wrap_content"
27 android:layout_centerInParent="true" 27 android:layout_centerInParent="true"
28 android:text="@string/string_electroniccard_info_look" 28 android:text="@string/string_electroniccard_info_look"
29 android:textColor="@android:color/white" 29 android:textColor="@android:color/white"
30 android:textSize="22sp" /> 30 android:textSize="22sp" />
31 </RelativeLayout> 31 </RelativeLayout>
32 32
33 <LinearLayout 33 <LinearLayout
34 android:layout_width="match_parent" 34 android:layout_width="match_parent"
35 android:layout_height="wrap_content" 35 android:layout_height="wrap_content"
36 android:layout_margin="20dp" 36 android:layout_margin="20dp"
37 android:background="@mipmap/cardbackgrangd" 37 android:background="@mipmap/cardbackgrangd"
38 android:gravity="center" 38 android:gravity="center"
39 android:orientation="vertical"> 39 android:orientation="vertical">
40 40
41 <LinearLayout 41 <LinearLayout
42 android:layout_width="match_parent" 42 android:layout_width="match_parent"
43 android:layout_height="wrap_content" 43 android:layout_height="wrap_content"
44 android:layout_marginTop="70dp" 44 android:layout_marginTop="70dp"
45 android:gravity="center_vertical" 45 android:gravity="center_vertical"
46 android:orientation="horizontal"> 46 android:orientation="horizontal">
47 47
48 <LinearLayout 48 <LinearLayout
49 android:layout_width="0dp" 49 android:layout_width="0dp"
50 android:layout_height="wrap_content" 50 android:layout_height="wrap_content"
51 android:layout_marginLeft="200dp" 51 android:layout_marginLeft="200dp"
52 android:layout_weight="1" 52 android:layout_weight="1"
53 android:gravity="center_vertical"> 53 android:gravity="center_vertical">
54 54
55 <ImageView 55 <ImageView
56 android:layout_width="wrap_content" 56 android:layout_width="wrap_content"
57 android:layout_height="wrap_content" 57 android:layout_height="wrap_content"
58 android:src="@mipmap/logo_info" /> 58 android:src="@mipmap/logo_info" />
59 59
60 <TextView 60 <TextView
61 android:layout_width="wrap_content" 61 android:layout_width="wrap_content"
62 android:layout_height="wrap_content" 62 android:layout_height="wrap_content"
63 android:layout_marginLeft="50dp" 63 android:layout_marginLeft="50dp"
64 android:background="@null" 64 android:background="@null"
65 android:text="电子保卡" 65 android:text="电子保卡"
66 android:textColor="@color/electronic_card" 66 android:textColor="@color/electronic_card"
67 android:textSize="22sp" /> 67 android:textSize="22sp" />
68 68
69 </LinearLayout> 69 </LinearLayout>
70 70
71 <LinearLayout 71 <LinearLayout
72 android:layout_width="0dp" 72 android:layout_width="0dp"
73 android:layout_height="80dp" 73 android:layout_height="80dp"
74 android:layout_weight="1" 74 android:layout_weight="1"
75 android:layout_marginLeft="80dp" 75 android:layout_marginLeft="80dp"
76 android:gravity="center_vertical"> 76 android:gravity="center_vertical">
77 77
78 <TextView 78 <TextView
79 android:layout_width="wrap_content" 79 android:layout_width="wrap_content"
80 android:layout_height="wrap_content" 80 android:layout_height="wrap_content"
81 android:text="客户姓名" 81 android:text="客户姓名"
82 android:textSize="22sp" /> 82 android:textSize="22sp" />
83 83
84 <TextView 84 <TextView
85 android:id="@+id/iv_card_username" 85 android:id="@+id/iv_card_username"
86 android:layout_width="wrap_content" 86 android:layout_width="wrap_content"
87 android:layout_height="wrap_content" 87 android:layout_height="wrap_content"
88 android:layout_marginLeft="60dp" 88 android:layout_marginLeft="60dp"
89 android:text="" 89 android:text=""
90 android:textSize="22sp" /> 90 android:textSize="22sp" />
91 91
92 </LinearLayout> 92 </LinearLayout>
93 93
94 </LinearLayout> 94 </LinearLayout>
95 95
96 <LinearLayout 96 <LinearLayout
97 android:layout_width="match_parent" 97 android:layout_width="match_parent"
98 android:layout_height="wrap_content" 98 android:layout_height="wrap_content"
99 android:gravity="center_vertical" 99 android:gravity="center_vertical"
100 android:orientation="horizontal"> 100 android:orientation="horizontal">
101 101
102 <LinearLayout 102 <LinearLayout
103 android:layout_width="0dp" 103 android:layout_width="0dp"
104 android:layout_height="60dp" 104 android:layout_height="60dp"
105 android:layout_weight="1" 105 android:layout_weight="1"
106 android:layout_marginLeft="200dp" 106 android:layout_marginLeft="200dp"
107 android:gravity="center_vertical"> 107 android:gravity="center_vertical">
108 108
109 <TextView 109 <TextView
110 android:layout_width="wrap_content" 110 android:layout_width="wrap_content"
111 android:layout_height="wrap_content" 111 android:layout_height="wrap_content"
112 android:text="产品型号" 112 android:text="产品型号"
113 android:textSize="22sp" /> 113 android:textSize="22sp" />
114 114
115 <TextView 115 <TextView
116 android:id="@+id/tv_card_deviceModel" 116 android:id="@+id/tv_card_deviceModel"
117 android:layout_width="wrap_content" 117 android:layout_width="wrap_content"
118 android:layout_height="wrap_content" 118 android:layout_height="wrap_content"
119 android:layout_marginLeft="50dp" 119 android:layout_marginLeft="50dp"
120 android:text="" 120 android:text=""
121 android:textSize="22sp" /> 121 android:textSize="22sp" />
122 122
123 123
124 </LinearLayout> 124 </LinearLayout>
125 125
126 <LinearLayout 126 <LinearLayout
127 android:layout_width="0dp" 127 android:layout_width="0dp"
128 android:layout_height="60dp" 128 android:layout_height="60dp"
129 android:layout_weight="1" 129 android:layout_weight="1"
130 android:layout_marginLeft="80dp" 130 android:layout_marginLeft="80dp"
131 android:gravity="center_vertical"> 131 android:gravity="center_vertical">
132 132
133 <TextView 133 <TextView
134 android:layout_width="wrap_content" 134 android:layout_width="wrap_content"
135 android:layout_height="wrap_content" 135 android:layout_height="wrap_content"
136 android:text="客户地址" 136 android:text="客户地址"
137 android:textSize="22sp" /> 137 android:textSize="22sp" />
138 138
139 <TextView 139 <TextView
140 android:id="@+id/tv_card_adress" 140 android:id="@+id/tv_card_adress"
141 android:layout_width="wrap_content" 141 android:layout_width="wrap_content"
142 android:layout_height="wrap_content" 142 android:layout_height="wrap_content"
143 android:layout_marginLeft="60dp" 143 android:layout_marginLeft="60dp"
144 android:text="" 144 android:text=""
145 android:textSize="22sp" /> 145 android:textSize="22sp" />
146 <TextView 146 <TextView
147 android:id="@+id/tv_card_adress_change" 147 android:id="@+id/tv_card_adress_change"
148 android:layout_width="wrap_content" 148 android:layout_width="wrap_content"
149 android:layout_height="wrap_content" 149 android:layout_height="wrap_content"
150 android:layout_marginLeft="18dp" 150 android:layout_marginLeft="18dp"
151 android:background="@drawable/corcle_blue_bg" 151 android:background="@drawable/corcle_blue_bg"
152 android:text="修改" 152 android:text="修改"
153 android:paddingLeft="5dp" 153 android:paddingLeft="5dp"
154 android:paddingRight="5dp" 154 android:paddingRight="5dp"
155 android:textColor="@color/login_text_blue" 155 android:textColor="@color/login_text_blue"
156 android:textSize="18sp" /> 156 android:textSize="18sp" />
157 157
158 158
159 </LinearLayout> 159 </LinearLayout>
160 160
161 </LinearLayout> 161 </LinearLayout>
162 162
163 <LinearLayout 163 <LinearLayout
164 android:layout_width="match_parent" 164 android:layout_width="match_parent"
165 android:layout_height="wrap_content" 165 android:layout_height="wrap_content"
166 android:gravity="center_vertical" 166 android:gravity="center_vertical"
167 android:orientation="horizontal"> 167 android:orientation="horizontal">
168 168
169 <LinearLayout 169 <LinearLayout
170 android:layout_width="0dp" 170 android:layout_width="0dp"
171 android:layout_height="60dp" 171 android:layout_height="60dp"
172 android:layout_weight="1" 172 android:layout_weight="1"
173 android:layout_marginLeft="200dp" 173 android:layout_marginLeft="200dp"
174 android:gravity="center_vertical"> 174 android:gravity="center_vertical">
175 175
176 <TextView 176 <TextView
177 android:layout_width="wrap_content" 177 android:layout_width="wrap_content"
178 android:layout_height="wrap_content" 178 android:layout_height="wrap_content"
179 android:text="MAC地址" 179 android:text="MAC地址"
180 android:textSize="22sp" /> 180 android:textSize="22sp" />
181 181
182 <TextView 182 <TextView
183 android:id="@+id/tv_card_mac" 183 android:id="@+id/tv_card_mac"
184 android:layout_width="wrap_content" 184 android:layout_width="wrap_content"
185 android:layout_height="wrap_content" 185 android:layout_height="wrap_content"
186 android:layout_marginLeft="50dp" 186 android:layout_marginLeft="50dp"
187 android:text="" 187 android:text=""
188 android:textSize="22sp" /> 188 android:textSize="22sp" />
189 189
190 </LinearLayout> 190 </LinearLayout>
191 191
192 <LinearLayout 192 <LinearLayout
193 android:layout_width="0dp" 193 android:layout_width="0dp"
194 android:layout_height="60dp" 194 android:layout_height="60dp"
195 android:layout_weight="1" 195 android:layout_weight="1"
196 android:layout_marginLeft="80dp" 196 android:layout_marginLeft="80dp"
197 android:gravity="center_vertical"> 197 android:gravity="center_vertical">
198 198
199 <TextView 199 <TextView
200 android:layout_width="wrap_content" 200 android:layout_width="wrap_content"
201 android:layout_height="wrap_content" 201 android:layout_height="wrap_content"
202 android:text="购买时间" 202 android:text="购买时间"
203 android:textSize="22sp" /> 203 android:textSize="22sp" />
204 204
205 <TextView 205 <TextView
206 android:id="@+id/tv_card_time" 206 android:id="@+id/tv_card_time"
207 android:layout_width="wrap_content" 207 android:layout_width="wrap_content"
208 android:layout_height="wrap_content" 208 android:layout_height="wrap_content"
209 android:layout_marginLeft="60dp" 209 android:layout_marginLeft="60dp"
210 android:text="" 210 android:text=""
211 android:textSize="22sp" /> 211 android:textSize="22sp" />
212 </LinearLayout> 212 </LinearLayout>
213 213
214 </LinearLayout> 214 </LinearLayout>
215 215
216 <LinearLayout 216 <LinearLayout
217 android:layout_width="match_parent" 217 android:layout_width="match_parent"
218 android:layout_height="wrap_content" 218 android:layout_height="wrap_content"
219 android:gravity="center_vertical" 219 android:gravity="center_vertical"
220 android:orientation="horizontal"> 220 android:orientation="horizontal">
221 221
222 <LinearLayout 222 <LinearLayout
223 android:layout_width="0dp" 223 android:layout_width="0dp"
224 android:layout_height="60dp" 224 android:layout_height="60dp"
225 android:layout_weight="1" 225 android:layout_weight="1"
226 android:layout_marginLeft="200dp" 226 android:layout_marginLeft="200dp"
227 android:gravity="center_vertical"> 227 android:gravity="center_vertical">
228 228
229 <TextView 229 <TextView
230 android:layout_width="wrap_content" 230 android:layout_width="wrap_content"
231 android:layout_height="wrap_content" 231 android:layout_height="wrap_content"
232 android:text="机身编码" 232 android:text="机身编码"
233 android:textSize="22sp" /> 233 android:textSize="22sp" />
234 234
235 <TextView 235 <TextView
236 android:id="@+id/tv_card_deviceNumber" 236 android:id="@+id/tv_card_deviceNumber"
237 android:layout_width="wrap_content" 237 android:layout_width="wrap_content"
238 android:layout_height="wrap_content" 238 android:layout_height="wrap_content"
239 android:layout_marginLeft="50dp" 239 android:layout_marginLeft="50dp"
240 android:hint="" 240 android:hint=""
241 android:textSize="22sp" /> 241 android:textSize="22sp" />
242 242
243 </LinearLayout> 243 </LinearLayout>
244 244
245 <LinearLayout 245 <LinearLayout
246 android:layout_width="0dp" 246 android:layout_width="0dp"
247 android:layout_height="60dp" 247 android:layout_height="60dp"
248 android:layout_weight="1" 248 android:layout_weight="1"
249 android:layout_marginLeft="80dp" 249 android:layout_marginLeft="80dp"
250 android:gravity="center_vertical"> 250 android:gravity="center_vertical">
251 251
252 <TextView 252 <TextView
253 android:layout_width="wrap_content" 253 android:layout_width="wrap_content"
254 android:layout_height="wrap_content" 254 android:layout_height="wrap_content"
255 android:text="购买地址" 255 android:text="购买地址"
256 android:textSize="22sp" /> 256 android:textSize="22sp" />
257 257
258 <TextView 258 <TextView
259 android:id="@+id/tv_card_shopAdress" 259 android:id="@+id/tv_card_shopAdress"
260 android:layout_width="wrap_content" 260 android:layout_width="wrap_content"
261 android:layout_height="wrap_content" 261 android:layout_height="wrap_content"
262 android:layout_marginLeft="60dp" 262 android:layout_marginLeft="60dp"
263 android:text="" 263 android:text=""
264 android:textSize="22sp" /> 264 android:textSize="22sp" />
265 </LinearLayout> 265 </LinearLayout>
266 266
267 </LinearLayout> 267 </LinearLayout>
268 268
269 <LinearLayout 269 <LinearLayout
270 android:layout_width="match_parent" 270 android:layout_width="match_parent"
271 android:layout_height="wrap_content" 271 android:layout_height="wrap_content"
272 android:gravity="center_vertical" 272 android:gravity="center_vertical"
273 android:layout_marginBottom="30dp" 273 android:layout_marginBottom="30dp"
274 android:orientation="horizontal"> 274 android:orientation="horizontal">
275 275
276 <LinearLayout 276 <LinearLayout
277 android:layout_width="0dp" 277 android:layout_width="0dp"
278 android:layout_height="60dp" 278 android:layout_height="60dp"
279 android:layout_weight="1" 279 android:layout_weight="1"
280 android:layout_marginLeft="200dp" 280 android:layout_marginLeft="200dp"
281 android:gravity="center_vertical"> 281 android:gravity="center_vertical">
282 282
283 <TextView 283 <TextView
284 android:layout_width="wrap_content" 284 android:layout_width="wrap_content"
285 android:layout_height="wrap_content" 285 android:layout_height="wrap_content"
286 android:text="手机号码" 286 android:text="手机号码"
287 android:textSize="22sp" /> 287 android:textSize="22sp" />
288 288
289 <TextView 289 <TextView
290 android:id="@+id/tv_card_phone" 290 android:id="@+id/tv_card_phone"
291 android:layout_width="wrap_content" 291 android:layout_width="wrap_content"
292 android:layout_height="wrap_content" 292 android:layout_height="wrap_content"
293 android:layout_marginLeft="50dp" 293 android:layout_marginLeft="50dp"
294 android:text="" 294 android:text=""
295 android:textSize="22sp" /> 295 android:textSize="22sp" />
296 <TextView 296 <TextView
297 android:id="@+id/tv_card_phone_change" 297 android:id="@+id/tv_card_phone_change"
298 android:layout_width="wrap_content" 298 android:layout_width="wrap_content"
299 android:layout_height="wrap_content" 299 android:layout_height="wrap_content"
300 android:layout_marginLeft="18dp" 300 android:layout_marginLeft="18dp"
301 android:background="@drawable/corcle_blue_bg" 301 android:background="@drawable/corcle_blue_bg"
302 android:text="修改" 302 android:text="修改"
303 android:visibility="gone"
303 android:paddingLeft="5dp" 304 android:paddingLeft="5dp"
304 android:paddingRight="5dp" 305 android:paddingRight="5dp"
305 android:textColor="@color/login_text_blue" 306 android:textColor="@color/login_text_blue"
306 android:textSize="18sp" /> 307 android:textSize="18sp" />
307 308
308 309
309 </LinearLayout> 310 </LinearLayout>
310 311
311 <LinearLayout 312 <LinearLayout
312 android:layout_width="0dp" 313 android:layout_width="0dp"
313 android:layout_height="60dp" 314 android:layout_height="60dp"
314 android:layout_weight="1" 315 android:layout_weight="1"
315 android:layout_marginLeft="80dp" 316 android:layout_marginLeft="80dp"
316 android:gravity="center_vertical"> 317 android:gravity="center_vertical">
317 318
318 <TextView 319 <TextView
319 android:layout_width="wrap_content" 320 android:layout_width="wrap_content"
320 android:layout_height="wrap_content" 321 android:layout_height="wrap_content"
321 android:text="本地售后电话" 322 android:text="本地售后电话"
322 android:textSize="22sp" /> 323 android:textSize="22sp" />
323 324
324 <TextView 325 <TextView
325 android:id="@+id/tv_card_tleNember" 326 android:id="@+id/tv_card_tleNember"
326 android:layout_width="wrap_content" 327 android:layout_width="wrap_content"
327 android:layout_height="wrap_content" 328 android:layout_height="wrap_content"
328 android:layout_marginLeft="60dp" 329 android:layout_marginLeft="60dp"
329 android:text="" 330 android:text=""
330 android:textSize="22sp" /> 331 android:textSize="22sp" />
331 332
332 </LinearLayout> 333 </LinearLayout>
333 334
334 </LinearLayout> 335 </LinearLayout>
335 </LinearLayout> 336 </LinearLayout>
336 337
337 <LinearLayout 338 <LinearLayout
338 android:layout_width="match_parent" 339 android:layout_width="match_parent"
339 android:layout_height="wrap_content" 340 android:layout_height="wrap_content"
340 android:layout_marginTop="5dp" 341 android:layout_marginTop="5dp"
341 android:gravity="center" 342 android:gravity="center"
342 android:orientation="vertical"> 343 android:orientation="vertical">
343 344
344 <TextView 345 <TextView
345 android:layout_width="wrap_content" 346 android:layout_width="wrap_content"
346 android:layout_height="wrap_content" 347 android:layout_height="wrap_content"
347 android:layout_marginTop="5dp" 348 android:layout_marginTop="5dp"
348 android:text="@string/electronic_card" 349 android:text="@string/electronic_card"
349 android:textColor="@color/electronic_text" 350 android:textColor="@color/electronic_text"
350 android:textSize="18sp" /> 351 android:textSize="18sp" />
351 352
352 353
353 354
354 </LinearLayout> 355 </LinearLayout>
355 <LinearLayout 356 <LinearLayout
356 android:layout_width="match_parent" 357 android:layout_width="match_parent"
357 android:layout_height="wrap_content" 358 android:layout_height="wrap_content"
358 android:layout_marginTop="30dp" 359 android:layout_marginTop="30dp"
359 android:gravity="center" 360 android:gravity="center"
360 android:orientation="horizontal"> 361 android:orientation="horizontal">
361 362
362 <ImageView 363 <ImageView
363 android:layout_width="wrap_content" 364 android:layout_width="wrap_content"
364 android:layout_height="wrap_content" 365 android:layout_height="wrap_content"
365 android:src="@mipmap/phone"/> 366 android:src="@mipmap/phone"/>
366 <TextView 367 <TextView
367 android:layout_width="wrap_content" 368 android:layout_width="wrap_content"
368 android:layout_height="wrap_content" 369 android:layout_height="wrap_content"
369 android:textSize="30sp" 370 android:textSize="30sp"
370 android:layout_marginLeft="5dp" 371 android:layout_marginLeft="5dp"
371 android:textColor="@color/login_text_blue" 372 android:textColor="@color/login_text_blue"
372 android:text="4006-123-678"/> 373 android:text="4006-123-678"/>
373 374
374 375
375 </LinearLayout> 376 </LinearLayout>
376 377
377 378
378 379
379 </LinearLayout> 380 </LinearLayout>