Commit 29ad76f4f231b3e93f31c1e0e964ebb36d5618d7

Authored by xiongwei
1 parent 1ab8c79994
Exists in master

AIDL数据共享

Showing 19 changed files with 368 additions and 110 deletions   Show diff stats
PersonalCenter/.idea/misc.xml
... ... @@ -37,7 +37,7 @@
37 37 <ConfirmationsSetting value="0" id="Add" />
38 38 <ConfirmationsSetting value="0" id="Remove" />
39 39 </component>
40   - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
  40 + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
41 41 <output url="file://$PROJECT_DIR$/build/classes" />
42 42 </component>
43 43 <component name="ProjectType">
... ...
PersonalCenter/app/build.gradle
... ... @@ -41,7 +41,9 @@ dependencies {
41 41 compile 'com.google.code.gson:gson:2.7'
42 42 compile 'com.zaaach:toprightmenu:1.0'
43 43 compile 'com.facebook.fresco:fresco:1.1.0'
44   - compile'com.android.support:recyclerview-v7:25.+'
  44 + compile 'com.android.support:recyclerview-v7:25.+'
45 45 debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
46 46 releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
  47 + compile 'com.google.zxing:core:3.3.0'
  48 + compile 'com.google.zxing:android-core:3.3.0'
47 49 }
... ...
PersonalCenter/app/src/main/AndroidManifest.xml
... ... @@ -116,6 +116,23 @@
116 116 android:screenOrientation="landscape">
117 117  
118 118 </activity>
  119 + <activity
  120 + android:name=".activity.BangDingCode"
  121 + android:launchMode="singleTask"
  122 + android:screenOrientation="landscape">
  123 +
  124 + </activity>
  125 + <service
  126 + android:name="com.hjx.personalcenter.service.TestService"
  127 + android:process=":remote"
  128 + >
  129 + <intent-filter>
  130 + <action android:name="com.hjx.personalcenter.service.GetLoginInfoService">
  131 +
  132 + </action>
  133 + </intent-filter>
  134 + </service>
  135 +
119 136 </application>
120 137 <!--权限-->
121 138 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
... ...
PersonalCenter/app/src/main/aidl/com/hjx/personalcenter/service/IPresonalInterface.aidl
... ... @@ -0,0 +1,8 @@
  1 +// IPresonalInterface.aidl
  2 +package com.hjx.personalcenter.service;
  3 +
  4 +// Declare any non-default types here with import statements
  5 +
  6 +interface IPresonalInterface {
  7 + String sayHello();
  8 +}
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/BangDingCode.java
... ... @@ -0,0 +1,48 @@
  1 +package com.hjx.personalcenter.activity;
  2 +
  3 +import android.app.Activity;
  4 +import android.graphics.Bitmap;
  5 +import android.os.Bundle;
  6 +import android.util.DisplayMetrics;
  7 +import android.widget.ImageView;
  8 +import android.widget.LinearLayout;
  9 +
  10 +import com.hjx.personalcenter.R;
  11 +import com.hjx.personalcenter.util.FileUtil;
  12 +import com.hjx.personalcenter.util.QRCodeUtil;
  13 +
  14 +import java.io.File;
  15 +
  16 +/**
  17 + * Created by h on 2017/8/31.
  18 + */
  19 +
  20 +public class BangDingCode extends Activity{
  21 + private ImageView EQpicture;
  22 + File file;
  23 + @Override
  24 + protected void onCreate(Bundle savedInstanceState) {
  25 + super.onCreate(savedInstanceState);
  26 + setContentView(R.layout.activity_binding_code);
  27 + EQpicture = (ImageView) findViewById(R.id.EQpicture);
  28 + EQPicture();
  29 +
  30 +
  31 + }
  32 + public void EQPicture() {
  33 + DisplayMetrics dm = new DisplayMetrics();
  34 + getWindowManager().getDefaultDisplay().getMetrics(dm);
  35 + int screenHeight = dm.heightPixels;//屏幕高度
  36 + //设置二维码外布局占屏幕高宽
  37 + LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) EQpicture.getLayoutParams();
  38 + layoutParams.width = screenHeight * 17 / 30;
  39 + layoutParams.height = screenHeight * 19 / 30;
  40 + EQpicture.setLayoutParams(layoutParams);
  41 + //生成占屏幕一定比例 的二维码存储在本地并显示
  42 + file = new File(FileUtil.getCachePath(this), "user-code.jpg");
  43 + Bitmap bitmap = QRCodeUtil.createQRImage("www.baidu.com", screenHeight * 15 / 30, screenHeight * 15 / 30, null, file.getPath());
  44 + if (bitmap != null) {
  45 + EQpicture.setImageBitmap(bitmap);
  46 + }
  47 + }
  48 +}
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardInfoOKActivity.java
1 1 package com.hjx.personalcenter.activity;
2 2  
3 3 import android.app.Activity;
  4 +import android.content.Intent;
4 5 import android.os.Bundle;
5 6 import android.view.View;
6 7 import android.widget.Button;
... ... @@ -17,7 +18,7 @@ import com.hjx.personalcenter.util.GetDevicesUtil;
17 18 */
18 19  
19 20 public class ElectronicCardInfoOKActivity extends Activity implements View.OnClickListener {
20   - private Button btn_finish;
  21 + private Button btn_finish,btn_bangding;
21 22 private ImageView iv_last_step;
22 23 private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone;
23 24 @Override
... ... @@ -40,6 +41,7 @@ public class ElectronicCardInfoOKActivity extends Activity implements View.OnCli
40 41 shopadress = (TextView) findViewById(R.id.tv_card_shopAdress);
41 42 phone = (TextView) findViewById(R.id.tv_card_phone);
42 43 tlePhone = (TextView) findViewById(R.id.tv_card_tleNember);
  44 + btn_bangding = (Button) findViewById(R.id.btn_bangding);
43 45 }
44 46  
45 47 private void initData() {
... ... @@ -61,6 +63,7 @@ public class ElectronicCardInfoOKActivity extends Activity implements View.OnCli
61 63 private void initLister() {
62 64 iv_last_step.setOnClickListener(this);
63 65 btn_finish.setOnClickListener(this);
  66 + btn_bangding.setOnClickListener(this);
64 67 }
65 68  
66 69 @Override
... ... @@ -80,6 +83,13 @@ public class ElectronicCardInfoOKActivity extends Activity implements View.OnCli
80 83 deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(),
81 84 mac_adress.getText().toString().trim(),phone.getText().toString().trim());
82 85 break;
  86 + case R.id.btn_bangding:
  87 + Intent intent = new Intent();
  88 + intent.setClass(ElectronicCardInfoOKActivity.this, BangDingCode.class);
  89 + startActivity(intent);
  90 + overridePendingTransition(R.anim.rightin, R.anim.rightout);
  91 +
  92 + break;
83 93 case R.id.cancel:
84 94 finish();
85 95 break;
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ForgotPasswordActivity.java
... ... @@ -23,21 +23,22 @@ import com.hjx.personalcenter.util.PhoneNumCheckUtils;
23 23 import org.json.JSONException;
24 24 import org.json.JSONObject;
25 25  
26   -/**忘记密码
  26 +/**
  27 + * 忘记密码
27 28 * Created by h on 2017/6/17.
28 29 */
29 30  
30 31 public class ForgotPasswordActivity extends Activity implements View.OnClickListener {
31   - private ImageView back_forgit,iv_pwd_change;
32   - private EditText forot_pwd_phone,forot_pwd_anthcode,forot_pwd_pwd,forot_pwd_pwd2;
33   - private Button forot_pwd_sub,forot_pwd_getanthcode;
  32 + private ImageView back_forgit, iv_pwd_change;
  33 + private EditText forot_pwd_phone, forot_pwd_anthcode, forot_pwd_pwd, forot_pwd_pwd2;
  34 + private Button forot_pwd_sub, forot_pwd_getanthcode;
34 35 private String forot_pwd_phone1;
35 36 private String forot_pwd_anthcode1;
36 37 private String forot_pwd_pwd3;
37 38 private String forot_pwd_pwd4;
38 39 private String typeStr = "login";
39 40 private int i = 0;
40   - private Thread thread;
  41 + private Thread thread;
41 42 public static Boolean showPassword = false;
42 43  
43 44 Handler handler = new Handler() {
... ... @@ -53,7 +54,7 @@ public class ForgotPasswordActivity extends Activity implements View.OnClickList
53 54 status = jsonObject.getString("status");
54 55 // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message"));
55 56 if (status.equals("100")) {
56   - AlertUtils.showToast(ForgotPasswordActivity.this,"密码修改成功");
  57 + AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改成功");
57 58 }
58 59  
59 60 break;
... ... @@ -78,18 +79,16 @@ public class ForgotPasswordActivity extends Activity implements View.OnClickList
78 79 status = jsonObject.getString("status");
79 80 if (status.equals("true")) {
80 81 getauthcode();
81   -// i = 60;
82   -// new Thread(new ForgotPassword.ThreadShow()).start();
83 82  
84   - }else {
  83 + } else {
85 84 AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册");
86 85 }
87 86 break;
88 87 case 1:
89 88 forot_pwd_getanthcode.setEnabled(false);
90 89 forot_pwd_getanthcode.setClickable(false);
91   - forot_pwd_getanthcode.setText(Integer.toString(i--)+" s");
92   - if (i<=0){
  90 + forot_pwd_getanthcode.setText(Integer.toString(i--) + " s");
  91 + if (i <= 0) {
93 92 forot_pwd_getanthcode.setEnabled(true);
94 93 forot_pwd_getanthcode.setClickable(true);
95 94 forot_pwd_getanthcode.setText("获取验证码");
... ... @@ -102,6 +101,7 @@ public class ForgotPasswordActivity extends Activity implements View.OnClickList
102 101 }
103 102 }
104 103 };
  104 +
105 105 @Override
106 106 protected void onCreate(Bundle savedInstanceState) {
107 107 super.onCreate(savedInstanceState);
... ... @@ -109,14 +109,16 @@ public class ForgotPasswordActivity extends Activity implements View.OnClickList
109 109 initView();
110 110 setLister();
111 111 }
  112 +
112 113 //获取验证码
113 114 private void getauthcode() {
114 115 forot_pwd_anthcode.requestFocus();
115 116 HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this);
116 117 i = 60;
117   - if(thread == null){
118   - thread = new Thread( new ThreadShow());
  118 + if (thread == null) {
  119 + thread = new Thread(new ThreadShow());
119 120 thread.start();
  121 +
120 122 }
121 123  
122 124 }
... ... @@ -128,9 +130,10 @@ public class ForgotPasswordActivity extends Activity implements View.OnClickList
128 130 forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword);
129 131 forot_pwd_sub = (Button) findViewById(R.id.btn_ok);
130 132 forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode);
131   - iv_pwd_change=(ImageView) findViewById(R.id.iv_pwd_change);
132   - back_forgit= (ImageView) findViewById(R.id.cancel);
  133 + iv_pwd_change = (ImageView) findViewById(R.id.iv_pwd_change);
  134 + back_forgit = (ImageView) findViewById(R.id.cancel);
133 135 }
  136 +
134 137 private void setLister() {
135 138 iv_pwd_change.setOnClickListener(this);
136 139 back_forgit.setOnClickListener(this);
... ... @@ -142,38 +145,36 @@ public class ForgotPasswordActivity extends Activity implements View.OnClickList
142 145  
143 146 @Override
144 147 public void onClick(View view) {
145   - switch (view.getId()){
  148 + switch (view.getId()) {
146 149 case R.id.btn_ok:
147 150 forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim();
148 151 forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim();
149 152 forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim();
150 153 forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim();
151   - if (TextUtils.isEmpty(forot_pwd_phone1)||
152   - TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){
  154 + if (TextUtils.isEmpty(forot_pwd_phone1) ||
  155 + TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)) {
153 156 AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整");
154 157 return;
155   - }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){
  158 + } else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)) {
156 159 AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误");
157 160  
158   - }
159   - else if(forot_pwd_pwd3.length()<8||forot_pwd_pwd4.length()<8){
  161 + } else if (forot_pwd_pwd3.length() < 8 || forot_pwd_pwd4.length() < 8) {
160 162 AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位");
161   - }else if(!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)||!forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){
  163 + } else if (!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER) || !forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)) {
162 164 AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成");
163   - }
164   - else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)){
  165 + } else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)) {
165 166 AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致");
166 167 return;
167   - }else {
  168 + } else {
168 169 //忘记密码接口
169   - HttpManager.getInstance().forgetpassword(this,forot_pwd_phone1,forot_pwd_pwd3,forot_pwd_anthcode1,handler);
  170 + HttpManager.getInstance().forgetpassword(this, forot_pwd_phone1, forot_pwd_pwd3, forot_pwd_anthcode1, handler);
170 171 }
171 172 break;
172 173 case R.id.btn_authcode:
173 174 forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim();
174   - if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){
  175 + if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)) {
175 176 AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号");
176   - }else {
  177 + } else {
177 178 forot_pwd_anthcode.requestFocus();
178 179 ifregister();
179 180  
... ... @@ -181,12 +182,12 @@ public class ForgotPasswordActivity extends Activity implements View.OnClickList
181 182  
182 183 break;
183 184 case R.id.iv_pwd_change:
184   - if(showPassword){//显示密码
  185 + if (showPassword) {//显示密码
185 186 showPassword = !showPassword;
186 187 iv_pwd_change.setImageResource(R.mipmap.pwd_open);
187 188 forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
188 189 forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length());
189   - }else{//隐藏密码
  190 + } else {//隐藏密码
190 191 showPassword = !showPassword;
191 192 iv_pwd_change.setImageResource(R.mipmap.pwd_hide);
192 193 forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
... ... @@ -199,11 +200,13 @@ public class ForgotPasswordActivity extends Activity implements View.OnClickList
199 200 break;
200 201 }
201 202 }
  203 +
202 204 //是否注册
203 205 private void ifregister() {
204 206 forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim();
205 207 HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this);
206 208 }
  209 +
207 210 // 线程类 定时器
208 211 class ThreadShow implements Runnable {
209 212  
... ... @@ -213,10 +216,11 @@ public class ForgotPasswordActivity extends Activity implements View.OnClickList
213 216 while (true) {
214 217 try {
215 218 Thread.sleep(1000);
  219 + // thread.interrupt();
216 220 Message msg = new Message();
217 221 msg.what = 1;
218 222 handler.sendMessage(msg);
219   - System.out.println("send...");
  223 + System.out.println("内存泄露...");
220 224 } catch (Exception e) {
221 225 // TODO Auto-generated catch block
222 226 e.printStackTrace();
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
... ... @@ -185,9 +185,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
185 185  
186 186 //获取个性签名
187 187 String userID = SaveParam.getInstance().getLoginParam(this,"userId");
  188 + String typeaccount = SaveParam.getInstance().getLoginParam(this,SaveParam.ACCOUNT);
188 189 try {
189 190 long auserID = Long.parseLong(userID);
190   - HttpManager.getInstance().getsignatures(MainActivity.this,auserID,handler);
  191 + int typeaccount1=Integer.parseInt(typeaccount);
  192 + HttpManager.getInstance().getsignatures(MainActivity.this,auserID,typeaccount1,handler);
191 193  
192 194 } catch (NumberFormatException e) {
193 195 e.printStackTrace();
... ... @@ -267,6 +269,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
267 269 settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class);
268 270 startActivity(settingintent);
269 271 overridePendingTransition(R.anim.rightin, R.anim.rightout);
  272 + finish();
270 273 break;
271 274 case 1:
272 275 Intent accontMintent = new Intent();
... ... @@ -301,9 +304,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
301 304 AlertUtils.showToast(MainActivity.this, "请输入个性签名");
302 305 } else {
303 306 try {
  307 + String typeaccount = SaveParam.getInstance().getLoginParam(MainActivity.this,SaveParam.ACCOUNT);
304 308 String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId");
305 309 long auserID = Long.parseLong(userID);
306   - HttpManager.getInstance().changsignature(MainActivity.this,auserID,text);
  310 + int typeaccount1=Integer.parseInt(typeaccount);
  311 + HttpManager.getInstance().changsignature(MainActivity.this,auserID,typeaccount1,text);
307 312 } catch (NumberFormatException e) {
308 313 e.printStackTrace();
309 314 }
... ... @@ -335,10 +340,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
335 340 protected void onResume() {
336 341 super.onResume();
337 342 String userID = SaveParam.getInstance().getLoginParam(this,"userId");
  343 + String typeaccount = SaveParam.getInstance().getLoginParam(this,SaveParam.ACCOUNT);
338 344 try {
339 345 long auserID = Long.parseLong(userID);
  346 + int typeaccount1=Integer.parseInt(typeaccount);
340 347 //获取个人信息
341   - HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,handler);
  348 + HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,typeaccount1,handler);
342 349  
343 350 } catch (NumberFormatException e) {
344 351 e.printStackTrace();
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
... ... @@ -26,6 +26,7 @@ import com.hjx.personalcenter.model.GradeInfo;
26 26 import com.hjx.personalcenter.model.ProvinceInfo;
27 27 import com.hjx.personalcenter.model.SchoolInfo;
28 28 import com.hjx.personalcenter.util.AlertUtils;
  29 +import com.hjx.personalcenter.util.GetDevicesUtil;
29 30  
30 31 import java.util.ArrayList;
31 32  
... ... @@ -103,16 +104,31 @@ public class RegisterInfoActivity extends AppCompatActivity implements View.OnCl
103 104 AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整");
104 105 return;
105 106 }else{
  107 + String register5 = et_username.getText().toString().trim();
  108 + String register6 = et_region.getText().toString().trim();
  109 + String register7 = et_grade.getText().toString().trim();
  110 + String register8 = et_school.getText().toString().trim();
106 111 if (Content.accountflag ==2){
107 112 String userID = SaveParam.getInstance().getLoginParam(this,"userId");
108   - String register5 = et_username.getText().toString().trim();
109   - String register6 = et_region.getText().toString().trim();
110   - String register7 = et_grade.getText().toString().trim();
111   - String register8 = et_school.getText().toString().trim();
  113 + String grade = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADENS);
  114 + String School = SaveParam.getInstance().getLoginParam(this,SaveParam.SCHOOOlID);
  115 + if (TextUtils.isEmpty(register8)){
  116 + School = "0";
  117 + }
  118 + String regionId = SaveParam.getInstance().getLoginParam(this, SaveParam.COUNTRY);
  119 + String regionId1 = SaveParam.getInstance().getLoginParam(this, SaveParam.CITYS);
  120 + String devicenumber =GetDevicesUtil.getDevicesInfo(this).getDeviceNumber();
  121 + if (regionId == null) {
  122 + regionId = regionId1;
  123 + }
  124 +
112 125 try {
113 126 long auserID = Long.parseLong(userID);
  127 + long grades = Long.parseLong(grade);
  128 + long Schools = Long.parseLong(School);
  129 + long regionIds = Long.parseLong(regionId);
114 130 HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this,auserID,"http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png",
115   - register5,register7,register8,register6);
  131 + register5,grades,Schools,regionIds,devicenumber,register6);
116 132  
117 133 } catch (NumberFormatException e) {
118 134 e.printStackTrace();
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/LoginFragment.java
... ... @@ -19,6 +19,7 @@ import com.hjx.personalcenter.R;
19 19 import com.hjx.personalcenter.activity.ForgotPasswordActivity;
20 20 import com.hjx.personalcenter.activity.MainActivity;
21 21 import com.hjx.personalcenter.customdialog.ElectronicCardDialog;
  22 +import com.hjx.personalcenter.db.SaveParam;
22 23 import com.hjx.personalcenter.http.HttpCode;
23 24 import com.hjx.personalcenter.http.HttpManager;
24 25 import com.hjx.personalcenter.util.AlertUtils;
... ... @@ -65,12 +66,14 @@ public class LoginFragment extends Fragment implements View.OnClickListener {
65 66 String userId = jsonObject.getString("userId");
66 67 final String name = phonenumber.getText().toString().trim();
67 68 final String pwd = login_pwwd.getText().toString().trim();
68   -// //登录成功,保存登录数据并且获取个人信息
69   - HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, "true", userId);
  69 +//
70 70 try {
71 71 long auserID = Long.parseLong(userId);
72 72 //是否填写保卡
73 73 HttpManager.getInstance().cardinfocheck(getActivity(),auserID,handler);
  74 + //登录成功,保存登录数据并且获取个人信息
  75 + HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, "true", userId);
  76 + SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.ACCOUNT,"1");
74 77 } catch (NumberFormatException e) {
75 78 e.printStackTrace();
76 79 }
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
... ... @@ -187,6 +187,9 @@ public class PresonInfoFragment extends Fragment implements View.OnClickListener
187 187 }
188 188 String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS);
189 189 String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID);
  190 + if (TextUtils.isEmpty(presonal6)){
  191 + schoolid = "0";
  192 + }
190 193 ChangeInfo.SchoolBean changeinfo2 = new ChangeInfo.SchoolBean();
191 194 try {
192 195 a = Integer.parseInt(regionId);
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpKey.java
... ... @@ -33,9 +33,11 @@ public class HttpKey {
33 33 public static String PARENTID = "parentId";
34 34 public static String IMAGE = "image";
35 35 public static String NAME = "name";
36   - public static String GRADE = "grade";
37   - public static String SCHOOL = "school";
38   - public static String REGION = "region";
  36 + public static String GRADE = "gradeId";
  37 + public static String SCHOOL = "schoolId";
  38 + public static String REGION = "regionId";
  39 + public static String DEVINUMBER = "deviceNumber";
  40 + public static String REGIONNAME = "regionName";
39 41  
40 42  
41 43  
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
... ... @@ -281,7 +281,7 @@ public class HttpManager {
281 281 intent.setClass(context, LoginAndRegisterActivity.class);
282 282 ((Activity) context).startActivity(intent);
283 283 ((Activity) context).finish();
284   - }else{
  284 + } else {
285 285 Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show();
286 286 }
287 287 } catch (JSONException e) {
... ... @@ -335,7 +335,7 @@ public class HttpManager {
335 335 Log.e("test", "onSuccess" + new String(bytes));
336 336 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show();
337 337 ((Activity) context).finish();
338   - }else{
  338 + } else {
339 339 Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show();
340 340 }
341 341 } catch (JSONException e) {
... ... @@ -644,23 +644,11 @@ public class HttpManager {
644 644 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
645 645 Log.e("test", "---" + new String(arg2));
646 646 closeProgress();
647   - try {
648   - JSONObject jsonObject = new JSONObject(new String(arg2));
649   - int status = jsonObject.optInt("status");
650   - if (status == 1) {
651   - Message msg = Message.obtain();
652   - msg.what = HttpCode.CHECKCARD;
653   - msg.obj = new String(arg2);
654   - handler.sendMessage(msg);
655   -
656   -
657   - } else {
658   - AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
  647 + Message msg = Message.obtain();
  648 + msg.what = HttpCode.CHECKCARD;
  649 + msg.obj = new String(arg2);
  650 + handler.sendMessage(msg);
659 651  
660   - }
661   - } catch (JSONException e) {
662   - e.printStackTrace();
663   - }
664 652  
665 653 }
666 654  
... ... @@ -823,12 +811,12 @@ public class HttpManager {
823 811 * @param userId
824 812 * @param handler
825 813 */
826   - public void getpresonalinfo(final Context mContext, long userId, final Handler handler) {
  814 + public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) {
827 815 mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...",
828 816 false, true, null);
829 817 HttpClient.getInstance().addHeader("Accept", "application/json");
830 818 HttpClient.getInstance().setConnectTimeout(5 * 1000);
831   - HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId, new AsyncHttpResponseHandler() {
  819 + HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() {
832 820 @Override
833 821 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
834 822 closeProgress();
... ... @@ -944,9 +932,10 @@ public class HttpManager {
944 932 }
945 933  
946 934 //修改个性签名
947   - public void changsignature(final Context mContext, long userId, final String signature) {
  935 + public void changsignature(final Context mContext, long userId, int type, final String signature) {
948 936 RequestParams params = new RequestParams();
949 937 params.put("userId", userId);
  938 + params.put("type", type);
950 939 params.put("signature", signature);
951 940 HttpClient.getInstance().addHeader("Accept", "*/*");
952 941 HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() {
... ... @@ -1000,9 +989,9 @@ public class HttpManager {
1000 989 * @param userId
1001 990 * @param handler
1002 991 */
1003   - public void getsignatures(final Context mContext, long userId, final Handler handler) {
  992 + public void getsignatures(final Context mContext, long userId, int type, final Handler handler) {
1004 993 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1005   - HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId, new AsyncHttpResponseHandler() {
  994 + HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() {
1006 995 @Override
1007 996 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1008 997 Log.e("test", "个性签名" + new String(arg2));
... ... @@ -1032,27 +1021,7 @@ public class HttpManager {
1032 1021 @Override
1033 1022 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1034 1023 Log.e("test", "失败原因" + arg3);
1035   - new CircleDialog.Builder((FragmentActivity) mContext)
1036   - .setCanceledOnTouchOutside(false)
1037   - .setCancelable(false)
1038   - .setWidth(0.5f)
1039   - .configText(new ConfigText() {
1040   - @Override
1041   - public void onConfig(TextParams params) {
1042   - params.gravity = Gravity.CENTER;
1043   - params.padding = new int[]{50, 50, 50, 50};
1044   - }
1045   - })
1046   - .setText("当前无网络,请检查网络设置")
1047   - .setNegative("继续使用", null)
1048   - .setPositive("设置网络", new View.OnClickListener() {
1049   - @Override
1050   - public void onClick(View v) {
1051   - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1052   - mContext.startActivity(intent);
1053   - }
1054   - })
1055   - .show();
  1024 + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!");
1056 1025 }
1057 1026 });
1058 1027 }
... ... @@ -1256,7 +1225,8 @@ public class HttpManager {
1256 1225 * 添加子账户信息
1257 1226 */
1258 1227 public void addchildAccountinfo(final Context mContext, long parentId, String image,
1259   - String name, String grade, String school, String region) {
  1228 + String name, Long grade, Long school, Long region
  1229 + , String deviceNumber, String regionName) {
1260 1230 mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...",
1261 1231 false, true, null);
1262 1232 RequestParams params = new RequestParams();
... ... @@ -1267,8 +1237,10 @@ public class HttpManager {
1267 1237 params.put(HttpKey.GRADE, grade);
1268 1238 params.put(HttpKey.SCHOOL, school);
1269 1239 params.put(HttpKey.REGION, region);
  1240 + params.put(HttpKey.DEVINUMBER, deviceNumber);
  1241 + params.put(HttpKey.REGIONNAME, regionName);
1270 1242  
1271   -
  1243 + Log.e("test", "子账户信息" + params);
1272 1244 HttpClient.getInstance().addHeader("Accept", "*/*");
1273 1245 HttpClient.getInstance().setTimeout(5 * 1000);
1274 1246 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/TestService.java
... ... @@ -0,0 +1,27 @@
  1 +package com.hjx.personalcenter.service;
  2 +
  3 +import android.app.Service;
  4 +import android.content.Intent;
  5 +import android.os.IBinder;
  6 +import android.os.RemoteException;
  7 +
  8 +/**
  9 + * Created by h on 2017/9/1.
  10 + */
  11 +
  12 +public class TestService extends Service {
  13 + public TestService(){
  14 +
  15 + }
  16 + IPresonalInterface.Stub binder = new IPresonalInterface.Stub() {
  17 + @Override
  18 + public String sayHello() throws RemoteException {
  19 + return "这是测试AIDL的方法";
  20 + }
  21 + };
  22 +
  23 + @Override
  24 + public IBinder onBind(Intent intent) {
  25 + return binder;
  26 + }
  27 +}
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/GetDevicesUtil.java
... ... @@ -11,20 +11,6 @@ import com.hjx.personalcenter.model.DeviceInfo;
11 11 public class GetDevicesUtil {
12 12 private final static String LOG_TAG = "GetDevicesUtil";
13 13  
14   - public static String getDevicesJson(Context context){
15   - DeviceInfo mDeviceInfo = new DeviceInfo();
16   - initDevicesInfo(mDeviceInfo,context);
17   -
18   - StringBuilder sb = new StringBuilder();
19   - sb.append("\"devices\":[{");
20   - sb.append("\"deviceNumber\":").append("\"").append( mDeviceInfo.getDeviceNumber()).append("\",");
21   - sb.append("\"deviceModel\":").append("\"").append(mDeviceInfo.getDeviceModel()).append("\",");
22   - sb.append("\"mac\":").append("\"").append(mDeviceInfo.getMac()).append("\",");
23   - sb.append("}]");
24   - Log.i(LOG_TAG, sb.toString());
25   - return sb.toString();
26   - }
27   -
28 14 public static DeviceInfo getDevicesInfo(Context context){
29 15 DeviceInfo mDeviceInfo = new DeviceInfo();
30 16 initDevicesInfo(mDeviceInfo,context);
... ... @@ -39,7 +25,7 @@ public class GetDevicesUtil {
39 25 Log.e(LOG_TAG,"" + mDeviceInfo.getMac());
40 26  
41 27 mDeviceInfo.setDeviceNumber(getCPUSerial(context));
42   - Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceModel());
  28 + Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceNumber());
43 29 }
44 30  
45 31 private static String getCPUSerial(Context context) {
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/MachineUtil.java
... ... @@ -2,6 +2,7 @@ package com.hjx.personalcenter.util;
2 2  
3 3 import android.content.Context;
4 4 import android.os.Build;
  5 +import android.provider.Settings;
5 6 import android.telephony.TelephonyManager;
6 7 import android.text.TextUtils;
7 8  
... ... @@ -67,7 +68,14 @@ public class MachineUtil {
67 68 }
68 69  
69 70 try{
70   - cpuAddress = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
  71 + TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
  72 + if (mTelephony.getDeviceId() != null) {
  73 + cpuAddress = mTelephony.getDeviceId();
  74 + } else {
  75 + //android.provider.Settings;
  76 + cpuAddress = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
  77 + }
  78 + //cpuAddress = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
71 79 }catch(Exception e){
72 80 com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 4 get device id error");
73 81 }
... ...
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/QRCodeUtil.java
... ... @@ -0,0 +1,133 @@
  1 +package com.hjx.personalcenter.util;
  2 +
  3 +/**
  4 + * Created by liujiaqi on 2016/12/6.
  5 + */
  6 +
  7 +import android.graphics.Bitmap;
  8 +import android.graphics.BitmapFactory;
  9 +import android.graphics.Canvas;
  10 +
  11 +import com.google.zxing.BarcodeFormat;
  12 +import com.google.zxing.EncodeHintType;
  13 +import com.google.zxing.WriterException;
  14 +import com.google.zxing.common.BitMatrix;
  15 +import com.google.zxing.qrcode.QRCodeWriter;
  16 +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
  17 +
  18 +import java.io.FileInputStream;
  19 +import java.io.FileOutputStream;
  20 +import java.io.IOException;
  21 +import java.util.HashMap;
  22 +import java.util.Map;
  23 +
  24 +/**
  25 + * 二维码生成工具类
  26 + */
  27 +public class QRCodeUtil {
  28 + /**
  29 + * 生成二维码Bitmap
  30 + *
  31 + * @param content 内容
  32 + * @param widthPix 图片宽度
  33 + * @param heightPix 图片高度
  34 + * @param logoBm 二维码中心的Logo图标(可以为null)
  35 + * @param filePath 用于存储二维码图片的文件路径
  36 + */
  37 + public static Bitmap createQRImage(String content, int widthPix, int heightPix, Bitmap logoBm, String filePath) {
  38 + Bitmap bitmap=null;
  39 + try {
  40 + if (content == null || "".equals(content)) {
  41 + return null;
  42 + }
  43 +
  44 + //配置参数
  45 + Map<EncodeHintType, Object> hints = new HashMap<>();
  46 + hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
  47 + //容错级别
  48 + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
  49 + //设置空白边距的宽度
  50 +// hints.put(EncodeHintType.MARGIN, 2); //default is 4
  51 +
  52 + // 图像数据转换,使用了矩阵转换
  53 + BitMatrix bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, widthPix, heightPix, hints);
  54 + int[] pixels = new int[widthPix * heightPix];
  55 + // 下面这里按照二维码的算法,逐个生成二维码的图片,
  56 + // 两个for循环是图片横列扫描的结果
  57 + for (int y = 0; y < heightPix; y++) {
  58 + for (int x = 0; x < widthPix; x++) {
  59 + if (bitMatrix.get(x, y)) {
  60 + pixels[y * widthPix + x] = 0xff000000;
  61 + } else {
  62 + pixels[y * widthPix + x] = 0xffffffff;
  63 + }
  64 + }
  65 + }
  66 +
  67 + // 生成二维码图片的格式,使用ARGB_8888
  68 + bitmap = Bitmap.createBitmap(widthPix, heightPix, Bitmap.Config.ARGB_8888);
  69 + bitmap.setPixels(pixels, 0, widthPix, 0, 0, widthPix, heightPix);
  70 +
  71 + if (logoBm != null) {
  72 + bitmap = addLogo(bitmap, logoBm);
  73 + }
  74 +
  75 + //必须使用compress方法将bitmap保存到文件中再进行读取。直接返回的bitmap是没有任何压缩的,内存消耗巨大!
  76 + if (bitmap != null) {
  77 + bitmap.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(filePath));
  78 + bitmap= BitmapFactory.decodeStream(new FileInputStream(filePath));
  79 + }
  80 +
  81 + } catch (WriterException | IOException e) {
  82 + e.printStackTrace();
  83 + }
  84 +
  85 + return bitmap;
  86 + }
  87 +
  88 + /**
  89 + * 在二维码中间添加Logo图案
  90 + */
  91 + private static Bitmap addLogo(Bitmap src, Bitmap logo) {
  92 + if (src == null) {
  93 + return null;
  94 + }
  95 +
  96 + if (logo == null) {
  97 + return src;
  98 + }
  99 +
  100 + //获取图片的宽高
  101 + int srcWidth = src.getWidth();
  102 + int srcHeight = src.getHeight();
  103 + int logoWidth = logo.getWidth();
  104 + int logoHeight = logo.getHeight();
  105 +
  106 + if (srcWidth == 0 || srcHeight == 0) {
  107 + return null;
  108 + }
  109 +
  110 + if (logoWidth == 0 || logoHeight == 0) {
  111 + return src;
  112 + }
  113 +
  114 + //logo大小为二维码整体大小的1/5
  115 + float scaleFactor = srcWidth * 1.0f / 5 / logoWidth;
  116 + Bitmap bitmap = Bitmap.createBitmap(srcWidth, srcHeight, Bitmap.Config.ARGB_8888);
  117 + try {
  118 + Canvas canvas = new Canvas(bitmap);
  119 + canvas.drawBitmap(src, 0, 0, null);
  120 + canvas.scale(scaleFactor, scaleFactor, srcWidth / 2, srcHeight / 2);
  121 + canvas.drawBitmap(logo, (srcWidth - logoWidth) / 2, (srcHeight - logoHeight) / 2, null);
  122 +
  123 + canvas.save(Canvas.ALL_SAVE_FLAG);
  124 + canvas.restore();
  125 + } catch (Exception e) {
  126 + bitmap = null;
  127 + e.getStackTrace();
  128 + }
  129 +
  130 + return bitmap;
  131 + }
  132 +
  133 +}
0 134 \ No newline at end of file
... ...
PersonalCenter/app/src/main/res/layout/activity_binding_code.xml
... ... @@ -0,0 +1,12 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:orientation="vertical"
  4 + android:layout_width="match_parent"
  5 + android:gravity="center"
  6 + android:layout_height="match_parent">
  7 + <ImageView
  8 + android:id="@+id/EQpicture"
  9 + android:layout_width="wrap_content"
  10 + android:layout_height="wrap_content" />
  11 +
  12 +</LinearLayout>
0 13 \ No newline at end of file
... ...
PersonalCenter/app/src/main/res/layout/activity_electronic_look_cardinfo.xml
... ... @@ -384,7 +384,7 @@
384 384 android:textSize="30sp"
385 385 android:layout_marginLeft="5dp"
386 386 android:textColor="@color/login_text_blue"
387   - android:text="400-400-000"/>
  387 + android:text="4006-123-678"/>
388 388  
389 389  
390 390 </LinearLayout>
... ...