Commit 6a86a5fc01e3ad31cb8353ca436323b42090f51e
1 parent
bfaa7264b3
Exists in
master
家长控制手机端功能
Showing
11 changed files
with
88 additions
and
10 deletions
Show diff stats
.DS_Store
No preview for this file type
PersonalCenter/.idea/misc.xml
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <project version="4"> |
| 3 | + <component name="EntryPointsManager"> | |
| 4 | + <entry_points version="2.0" /> | |
| 5 | + </component> | |
| 3 | 6 | <component name="NullableNotNullManager"> |
| 4 | 7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> |
| 5 | 8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> |
| ... | ... | @@ -24,7 +27,7 @@ |
| 24 | 27 | </value> |
| 25 | 28 | </option> |
| 26 | 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 | 31 | <output url="file://$PROJECT_DIR$/build/classes" /> |
| 29 | 32 | </component> |
| 30 | 33 | <component name="ProjectType"> | ... | ... |
PersonalCenter/app/PresonalCenter.apk
No preview for this file type
PersonalCenter/app/build.gradle
| ... | ... | @@ -7,8 +7,8 @@ android { |
| 7 | 7 | applicationId "com.hjx.personalcenter" |
| 8 | 8 | minSdkVersion 15 |
| 9 | 9 | targetSdkVersion 25 |
| 10 | - versionCode 5 | |
| 11 | - versionName "1.0.5" | |
| 10 | + versionCode 6 | |
| 11 | + versionName "1.1.0" | |
| 12 | 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" |
| 13 | 13 | } |
| 14 | 14 | buildTypes { |
| ... | ... | @@ -44,7 +44,7 @@ dependencies { |
| 44 | 44 | compile files('libs/android-async-http-1.4.8.jar') |
| 45 | 45 | compile 'com.google.code.gson:gson:2.7' |
| 46 | 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 | 48 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' |
| 49 | 49 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' |
| 50 | 50 | compile 'com.google.zxing:core:3.3.0' | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
| ... | ... | @@ -246,6 +246,16 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen |
| 246 | 246 | |
| 247 | 247 | } |
| 248 | 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 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpClient.java
| 1 | 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 | 9 | import com.loopj.android.http.AsyncHttpClient; |
| 5 | 10 | |
| 6 | 11 | public class HttpClient extends AsyncHttpClient { |
| ... | ... | @@ -9,6 +14,14 @@ public class HttpClient extends AsyncHttpClient { |
| 9 | 14 | public static HttpClient getInstance() { |
| 10 | 15 | if(client == null) { |
| 11 | 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 | 26 | return client; |
| 14 | 27 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
| ... | ... | @@ -4,6 +4,7 @@ import android.app.Activity; |
| 4 | 4 | import android.app.ProgressDialog; |
| 5 | 5 | import android.content.Context; |
| 6 | 6 | import android.content.Intent; |
| 7 | +import android.os.Build; | |
| 7 | 8 | import android.os.Handler; |
| 8 | 9 | import android.os.Message; |
| 9 | 10 | import android.support.v4.app.FragmentActivity; |
| ... | ... | @@ -36,6 +37,7 @@ import com.hjx.personalcenter.model.VersionInfo; |
| 36 | 37 | import com.hjx.personalcenter.model.VideoInfo; |
| 37 | 38 | import com.hjx.personalcenter.util.AlertUtils; |
| 38 | 39 | import com.hjx.personalcenter.util.DialogPermission; |
| 40 | +import com.hjx.personalcenter.util.GetDevicesUtil; | |
| 39 | 41 | import com.loopj.android.http.AsyncHttpResponseHandler; |
| 40 | 42 | import com.loopj.android.http.JsonHttpResponseHandler; |
| 41 | 43 | import com.loopj.android.http.RequestParams; |
| ... | ... | @@ -71,6 +73,7 @@ public class HttpManager { |
| 71 | 73 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
| 72 | 74 | true, true, null); |
| 73 | 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 | 77 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
| 75 | 78 | @Override |
| 76 | 79 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| ... | ... | @@ -647,20 +650,21 @@ public class HttpManager { |
| 647 | 650 | @Override |
| 648 | 651 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 649 | 652 | closeProgress(); |
| 650 | - // Log.e("test", "个人信息" + new String(arg2)); | |
| 653 | + Log.e("test", "个人信息" + new String(arg2)); | |
| 651 | 654 | try { |
| 652 | 655 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 653 | 656 | int status = jsonObject.optInt("status"); |
| 657 | + Message message = Message.obtain(); | |
| 654 | 658 | if (status == 1) { |
| 655 | 659 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
| 656 | 660 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
| 657 | - Message message = Message.obtain(); | |
| 658 | 661 | message.what = HttpCode.GETINFO; |
| 659 | 662 | message.obj = pesonalInfoBeanList; |
| 660 | 663 | handler.sendMessage(message); |
| 661 | - | |
| 662 | - | |
| 663 | - } else { | |
| 664 | + } else if (status == 1011){ | |
| 665 | + message.what = HttpCode.RELOGIN; | |
| 666 | + handler.sendMessage(message); | |
| 667 | + }else { | |
| 664 | 668 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 665 | 669 | |
| 666 | 670 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/CenterService.java
| ... | ... | @@ -118,7 +118,7 @@ public class CenterService extends BaseService { |
| 118 | 118 | userInfoModer.setBirthday(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTCONSTELLATION)); |
| 119 | 119 | userInfoModer.setGender(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSEX)); |
| 120 | 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 | 122 | userInfoModer.setPortrait(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.PORTAIT)); |
| 123 | 123 | userInfoModer.setGradeid(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.GRADENS)); |
| 124 | 124 | userInfoModer.setIsprototype(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.YANGJI)); | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/VersionCodeUtils.java
| ... | ... | @@ -0,0 +1,45 @@ |
| 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 | +} | ... | ... |
PersonalCenter/app/src/main/res/layout/activity_electronic_look_cardinfo.xml
| ... | ... | @@ -300,6 +300,7 @@ |
| 300 | 300 | android:layout_marginLeft="18dp" |
| 301 | 301 | android:background="@drawable/corcle_blue_bg" |
| 302 | 302 | android:text="修改" |
| 303 | + android:visibility="gone" | |
| 303 | 304 | android:paddingLeft="5dp" |
| 304 | 305 | android:paddingRight="5dp" |
| 305 | 306 | android:textColor="@color/login_text_blue" | ... | ... |