Commit ee4c3fd1533df19022732bd8698d219cbd3ffdaa
1 parent
6e28f761de
Exists in
master
个人中心部分问题的修复首页UI调整
Showing
49 changed files
with
678 additions
and
218 deletions
Show diff stats
PersonalCenter/app/src/main/AndroidManifest.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | package="com.hjx.personalcenter"> | 3 | package="com.hjx.personalcenter"> |
| 4 | 4 | ||
| 5 | <application | 5 | <application |
| 6 | android:name=".activity.MyApplication" | 6 | android:name=".activity.MyApplication" |
| 7 | android:allowBackup="true" | 7 | android:allowBackup="true" |
| 8 | android:icon="@mipmap/ic_launcher" | 8 | android:icon="@mipmap/ic_launcher" |
| 9 | android:label="@string/app_name" | 9 | android:label="@string/app_name" |
| 10 | android:supportsRtl="true" | 10 | android:supportsRtl="true" |
| 11 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> | 11 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> |
| 12 | <activity | 12 | <activity |
| 13 | android:name=".activity.MainActivity" | 13 | android:name=".activity.MainActivity" |
| 14 | android:launchMode="singleTask" | 14 | android:launchMode="singleTask" |
| 15 | android:screenOrientation="landscape"> | 15 | android:screenOrientation="landscape"> |
| 16 | </activity> | 16 | </activity> |
| 17 | <activity | 17 | <activity |
| 18 | android:name=".activity.LoginAndRegisterActivity" | 18 | android:name=".activity.LoginAndRegisterActivity" |
| 19 | android:launchMode="singleTask" | 19 | android:launchMode="singleTask" |
| 20 | 20 | ||
| 21 | android:screenOrientation="landscape"> | 21 | android:screenOrientation="landscape"> |
| 22 | <intent-filter> | 22 | <intent-filter> |
| 23 | <action android:name="android.intent.action.MAIN" /> | 23 | <action android:name="android.intent.action.MAIN" /> |
| 24 | 24 | ||
| 25 | <category android:name="android.intent.category.LAUNCHER" /> | 25 | <category android:name="android.intent.category.LAUNCHER" /> |
| 26 | </intent-filter> | 26 | </intent-filter> |
| 27 | 27 | ||
| 28 | </activity> | 28 | </activity> |
| 29 | <activity | 29 | <activity |
| 30 | android:name=".activity.ForgotPasswordActivity" | 30 | android:name=".activity.ForgotPasswordActivity" |
| 31 | android:launchMode="singleTask" | 31 | android:launchMode="singleTask" |
| 32 | android:screenOrientation="landscape"> | 32 | android:screenOrientation="landscape"> |
| 33 | 33 | ||
| 34 | </activity> | 34 | </activity> |
| 35 | <activity | 35 | <activity |
| 36 | android:name=".activity.ChangePasswordActivity" | 36 | android:name=".activity.ChangePasswordActivity" |
| 37 | android:launchMode="singleTask" | 37 | android:launchMode="singleTask" |
| 38 | android:screenOrientation="landscape"> | 38 | android:screenOrientation="landscape"> |
| 39 | 39 | ||
| 40 | </activity> | 40 | </activity> |
| 41 | <activity | 41 | <activity |
| 42 | android:name=".activity.RegisterInfoActivity" | 42 | android:name=".activity.RegisterInfoActivity" |
| 43 | android:launchMode="singleTask" | 43 | android:launchMode="singleTask" |
| 44 | android:screenOrientation="landscape"> | 44 | android:screenOrientation="landscape"> |
| 45 | 45 | ||
| 46 | </activity> | 46 | </activity> |
| 47 | <activity | 47 | <activity |
| 48 | android:name=".activity.ElectronicCardValidationActivity" | 48 | android:name=".activity.ElectronicCardValidationActivity" |
| 49 | android:launchMode="singleTask" | 49 | android:launchMode="singleTask" |
| 50 | android:screenOrientation="landscape"> | 50 | android:screenOrientation="landscape"> |
| 51 | 51 | ||
| 52 | </activity> | 52 | </activity> |
| 53 | <activity | 53 | <activity |
| 54 | android:name=".activity.ChangeBangDingActivity" | 54 | android:name=".activity.ChangeBangDingActivity" |
| 55 | android:launchMode="singleTask" | 55 | android:launchMode="singleTask" |
| 56 | android:screenOrientation="landscape"> | 56 | android:screenOrientation="landscape"> |
| 57 | 57 | ||
| 58 | </activity> | 58 | </activity> |
| 59 | <activity | 59 | <activity |
| 60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" | 60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" |
| 61 | android:launchMode="singleTask" | 61 | android:launchMode="singleTask" |
| 62 | android:screenOrientation="landscape"> | 62 | android:screenOrientation="landscape"> |
| 63 | 63 | ||
| 64 | </activity> | 64 | </activity> |
| 65 | <activity | 65 | <activity |
| 66 | android:name=".activity.ChangeEletronicCardPhoneActivity" | 66 | android:name=".activity.ChangeEletronicCardPhoneActivity" |
| 67 | android:launchMode="singleTask" | 67 | android:launchMode="singleTask" |
| 68 | android:screenOrientation="landscape"> | 68 | android:screenOrientation="landscape"> |
| 69 | 69 | ||
| 70 | </activity> | 70 | </activity> |
| 71 | <activity | 71 | <activity |
| 72 | android:name=".activity.ChoiseTextBookActivity" | 72 | android:name=".activity.ChoiseTextBookActivity" |
| 73 | android:launchMode="singleTask" | 73 | android:launchMode="singleTask" |
| 74 | android:screenOrientation="landscape"> | 74 | android:screenOrientation="landscape"> |
| 75 | 75 | ||
| 76 | </activity> | 76 | </activity> |
| 77 | <activity | 77 | <activity |
| 78 | android:name=".activity.TheStartPageActivity" | 78 | android:name=".activity.TheStartPageActivity" |
| 79 | android:launchMode="singleTask" | 79 | android:launchMode="singleTask" |
| 80 | android:screenOrientation="landscape"> | 80 | android:screenOrientation="landscape"> |
| 81 | 81 | ||
| 82 | </activity> | 82 | </activity> |
| 83 | <activity | 83 | <activity |
| 84 | android:name=".activity.ElectronicCardEditInfoActivity" | 84 | android:name=".activity.ElectronicCardEditInfoActivity" |
| 85 | android:launchMode="singleTask" | 85 | android:launchMode="singleTask" |
| 86 | android:screenOrientation="landscape"> | 86 | android:screenOrientation="landscape"> |
| 87 | 87 | ||
| 88 | </activity> | 88 | </activity> |
| 89 | <activity | 89 | <activity |
| 90 | android:name=".activity.ElectronicCardInfoOKActivity" | 90 | android:name=".activity.ElectronicCardInfoOKActivity" |
| 91 | android:launchMode="singleTask" | 91 | android:launchMode="singleTask" |
| 92 | android:screenOrientation="landscape"> | 92 | android:screenOrientation="landscape"> |
| 93 | 93 | ||
| 94 | </activity> | 94 | </activity> |
| 95 | <activity | 95 | <activity |
| 96 | android:name=".activity.ElectronicCardLookInfoActivity" | 96 | android:name=".activity.ElectronicCardLookInfoActivity" |
| 97 | android:launchMode="singleTask" | 97 | android:launchMode="singleTask" |
| 98 | android:screenOrientation="landscape"> | 98 | android:screenOrientation="landscape"> |
| 99 | 99 | ||
| 100 | </activity> | 100 | </activity> |
| 101 | <activity | 101 | <activity |
| 102 | android:name=".activity.FeedBackActivity" | 102 | android:name=".activity.FeedBackActivity" |
| 103 | android:launchMode="singleTask" | 103 | android:launchMode="singleTask" |
| 104 | android:screenOrientation="landscape"> | 104 | android:screenOrientation="landscape"> |
| 105 | 105 | ||
| 106 | </activity> | 106 | </activity> |
| 107 | <activity | 107 | <activity |
| 108 | android:name=".activity.AccountManagementActivity" | 108 | android:name=".activity.AccountManagementActivity" |
| 109 | android:launchMode="singleTask" | 109 | android:launchMode="singleTask" |
| 110 | android:screenOrientation="landscape"> | 110 | android:screenOrientation="landscape"> |
| 111 | 111 | ||
| 112 | </activity> | 112 | </activity> |
| 113 | <activity | 113 | <activity |
| 114 | android:name=".activity.ChangePresonalInfoActivity" | 114 | android:name=".activity.ChangePresonalInfoActivity" |
| 115 | android:launchMode="singleTask" | 115 | android:launchMode="singleTask" |
| 116 | android:screenOrientation="landscape"> | 116 | android:screenOrientation="landscape"> |
| 117 | 117 | ||
| 118 | </activity> | 118 | </activity> |
| 119 | <activity | 119 | <activity |
| 120 | android:name=".activity.BangDingCode" | 120 | android:name=".activity.BangDingCode" |
| 121 | android:launchMode="singleTask" | 121 | android:launchMode="singleTask" |
| 122 | android:screenOrientation="landscape"> | 122 | android:screenOrientation="landscape"> |
| 123 | 123 | ||
| 124 | </activity> | 124 | </activity> |
| 125 | <service android:name="com.hjx.personalcenter.service.CenterService" | 125 | <service android:name="com.hjx.personalcenter.service.CenterService" |
| 126 | android:enabled="true" | 126 | android:enabled="true" |
| 127 | android:exported="true"> | 127 | android:exported="true"> |
| 128 | <intent-filter> | 128 | <intent-filter> |
| 129 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> | 129 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> |
| 130 | </intent-filter> | 130 | </intent-filter> |
| 131 | </service> | 131 | </service> |
| 132 | <service | 132 | <service |
| 133 | android:name="com.hjx.personalcenter.update.DownloadService" | 133 | android:name="com.hjx.personalcenter.update.DownloadService" |
| 134 | android:enabled="true"/> | 134 | android:enabled="true"/> |
| 135 | <receiver | ||
| 136 | android:name="com.hjx.personalcenter.service.StaticReceiver" | ||
| 137 | android:exported="true"> | ||
| 138 | <intent-filter > | ||
| 139 | <action android:name="com.ozing.launcher.SWITCH_GRADE"/> | ||
| 140 | </intent-filter> | ||
| 135 | 141 | ||
| 142 | </receiver> | ||
| 136 | </application> | 143 | </application> |
| 137 | <!--权限--> | 144 | <!--权限--> |
| 138 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 145 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| 139 | <uses-permission android:name="android.permission.CAMERA" /> | 146 | <uses-permission android:name="android.permission.CAMERA" /> |
| 140 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 147 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
| 141 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | 148 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
| 142 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 149 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
| 143 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 150 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| 144 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 151 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| 145 | <uses-permission android:name="android.permission.CALL_PHONE" /> | 152 | <uses-permission android:name="android.permission.CALL_PHONE" /> |
| 146 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 153 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
| 147 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | 154 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> |
| 148 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 155 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
| 149 | <uses-permission android:name="android.permission.INTERNET" /> | 156 | <uses-permission android:name="android.permission.INTERNET" /> |
| 150 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 157 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
| 151 | <uses-permission android:name="android.permission.READ_LOGS" /> | 158 | <uses-permission android:name="android.permission.READ_LOGS" /> |
| 152 | <uses-permission android:name="android.permission.RESTART_PACKAGES\"/> | 159 | <uses-permission android:name="android.permission.RESTART_PACKAGES\"/> |
| 153 | 160 | ||
| 154 | </manifest> | 161 | </manifest> |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeElectronicCardAdressInfoActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | import android.os.Handler; | 4 | import android.os.Handler; |
| 5 | import android.os.Message; | 5 | import android.os.Message; |
| 6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v7.app.AppCompatActivity; |
| 7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.widget.Button; | 9 | import android.widget.Button; |
| 10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
| 11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
| 12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
| 13 | 13 | ||
| 14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
| 15 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 15 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
| 16 | import com.hjx.personalcenter.customdialog.CountryDialog; | 16 | import com.hjx.personalcenter.customdialog.CountryDialog; |
| 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 18 | import com.hjx.personalcenter.db.SaveParam; | 18 | import com.hjx.personalcenter.db.SaveParam; |
| 19 | import com.hjx.personalcenter.http.HttpCode; | 19 | import com.hjx.personalcenter.http.HttpCode; |
| 20 | import com.hjx.personalcenter.http.HttpManager; | 20 | import com.hjx.personalcenter.http.HttpManager; |
| 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 22 | import com.hjx.personalcenter.model.CityInfo; | 22 | import com.hjx.personalcenter.model.CityInfo; |
| 23 | import com.hjx.personalcenter.model.CountyInfo; | 23 | import com.hjx.personalcenter.model.CountyInfo; |
| 24 | import com.hjx.personalcenter.model.ProvinceInfo; | 24 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 25 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
| 26 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
| 26 | import com.hjx.personalcenter.util.Judgment; | 27 | import com.hjx.personalcenter.util.Judgment; |
| 27 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 28 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
| 28 | 29 | ||
| 29 | import org.json.JSONObject; | 30 | import org.json.JSONObject; |
| 30 | 31 | ||
| 31 | import java.util.ArrayList; | 32 | import java.util.ArrayList; |
| 32 | import java.util.TimerTask; | 33 | import java.util.TimerTask; |
| 33 | 34 | ||
| 34 | /** | 35 | /** |
| 35 | * Created by h on 2017/8/9. | 36 | * Created by h on 2017/8/9. |
| 36 | */ | 37 | */ |
| 37 | 38 | ||
| 38 | public class ChangeElectronicCardAdressInfoActivity extends AppCompatActivity implements View.OnClickListener | 39 | public class ChangeElectronicCardAdressInfoActivity extends AppCompatActivity implements View.OnClickListener |
| 39 | ,DialogCallBack.ProvincesCallBack | 40 | ,DialogCallBack.ProvincesCallBack |
| 40 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ | 41 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ |
| 41 | private ImageView back_forgit; | 42 | private ImageView back_forgit; |
| 42 | private EditText forot_pwd_phone,forot_pwd_anthcode,newadress; | 43 | private EditText forot_pwd_phone,forot_pwd_anthcode,newadress; |
| 43 | private TextView adress; | 44 | private TextView adress; |
| 44 | private Button forot_pwd_sub,forot_pwd_getanthcode; | 45 | private Button forot_pwd_sub,forot_pwd_getanthcode; |
| 45 | private String typeStr = "register"; | 46 | private String typeStr = "register"; |
| 46 | private int delayTime=60; | 47 | private int delayTime=60; |
| 47 | private java.util.Timer Delaytimer; | 48 | private java.util.Timer Delaytimer; |
| 48 | Handler handler = new Handler() { | 49 | Handler handler = new Handler() { |
| 49 | @Override | 50 | @Override |
| 50 | public void handleMessage(Message msg) { | 51 | public void handleMessage(Message msg) { |
| 51 | super.handleMessage(msg); | 52 | super.handleMessage(msg); |
| 52 | JSONObject jsonObject; | 53 | JSONObject jsonObject; |
| 53 | String status; | 54 | String status; |
| 54 | switch (msg.what) { | 55 | switch (msg.what) { |
| 55 | case HttpCode.AUTHCODE_SUCESS1: | 56 | case HttpCode.AUTHCODE_SUCESS1: |
| 56 | jsonObject = (JSONObject) msg.obj; | 57 | jsonObject = (JSONObject) msg.obj; |
| 57 | status = jsonObject.optString("status"); | 58 | status = jsonObject.optString("status"); |
| 58 | if (status.equals("100")) { | 59 | if (status.equals("100")) { |
| 59 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "验证码发送成功"); | 60 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "验证码发送成功"); |
| 60 | } | 61 | } |
| 61 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 62 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
| 62 | break; | 63 | break; |
| 63 | case HttpCode.AUTHCODE_FAIL1: | 64 | case HttpCode.AUTHCODE_FAIL1: |
| 64 | jsonObject = (JSONObject) msg.obj; | 65 | jsonObject = (JSONObject) msg.obj; |
| 65 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); | 66 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); |
| 66 | break; | 67 | break; |
| 67 | case 21: | 68 | case 21: |
| 68 | if(delayTime<=0){ | 69 | if(delayTime<=0){ |
| 69 | if(Delaytimer!=null){ | 70 | if(Delaytimer!=null){ |
| 70 | Delaytimer.cancel(); | 71 | Delaytimer.cancel(); |
| 71 | } | 72 | } |
| 72 | forot_pwd_getanthcode.setEnabled(true); | 73 | forot_pwd_getanthcode.setEnabled(true); |
| 73 | forot_pwd_getanthcode.setClickable(true); | 74 | forot_pwd_getanthcode.setClickable(true); |
| 74 | forot_pwd_getanthcode.setText("获取验证码"); | 75 | forot_pwd_getanthcode.setText("获取验证码"); |
| 75 | delayTime=60; | 76 | delayTime=60; |
| 76 | }else{ | 77 | }else{ |
| 77 | forot_pwd_getanthcode.setEnabled(false); | 78 | forot_pwd_getanthcode.setEnabled(false); |
| 78 | forot_pwd_getanthcode.setClickable(false); | 79 | forot_pwd_getanthcode.setClickable(false); |
| 79 | forot_pwd_getanthcode.setText(delayTime + " s"); | 80 | forot_pwd_getanthcode.setText(delayTime + " s"); |
| 80 | } | 81 | } |
| 81 | break; | 82 | break; |
| 82 | } | 83 | } |
| 83 | } | 84 | } |
| 84 | }; | 85 | }; |
| 85 | @Override | 86 | @Override |
| 86 | protected void onCreate(Bundle savedInstanceState) { | 87 | protected void onCreate(Bundle savedInstanceState) { |
| 87 | super.onCreate(savedInstanceState); | 88 | super.onCreate(savedInstanceState); |
| 88 | setContentView(R.layout.activity_change_card_validation); | 89 | setContentView(R.layout.activity_change_card_validation); |
| 89 | SysApplication.getInstance().addActivity(this); | 90 | SysApplication.getInstance().addActivity(this); |
| 90 | initView(); | 91 | initView(); |
| 91 | setLister(); | 92 | setLister(); |
| 92 | } | 93 | } |
| 93 | //获取验证码 | 94 | //获取验证码 |
| 94 | private void getauthcode() { | 95 | private void getauthcode() { |
| 95 | forot_pwd_anthcode.requestFocus(); | 96 | forot_pwd_anthcode.requestFocus(); |
| 96 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 97 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
| 97 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); | 98 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); |
| 98 | valiDelay(); | 99 | valiDelay(); |
| 99 | 100 | ||
| 100 | } | 101 | } |
| 101 | private void initView() { | 102 | private void initView() { |
| 102 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); | 103 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); |
| 103 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); | 104 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); |
| 104 | adress = (TextView) findViewById(R.id.et_newpassword); | 105 | adress = (TextView) findViewById(R.id.et_newpassword); |
| 105 | newadress = (EditText) findViewById(R.id.et_again_newpassword); | 106 | newadress = (EditText) findViewById(R.id.et_again_newpassword); |
| 106 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); | 107 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); |
| 107 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); | 108 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); |
| 108 | back_forgit= (ImageView) findViewById(R.id.cancel); | 109 | back_forgit= (ImageView) findViewById(R.id.cancel); |
| 109 | } | 110 | } |
| 110 | private void setLister() { | 111 | private void setLister() { |
| 111 | back_forgit.setOnClickListener(this); | 112 | back_forgit.setOnClickListener(this); |
| 112 | forot_pwd_sub.setOnClickListener(this); | 113 | forot_pwd_sub.setOnClickListener(this); |
| 113 | forot_pwd_getanthcode.setOnClickListener(this); | 114 | forot_pwd_getanthcode.setOnClickListener(this); |
| 114 | adress.setOnClickListener(this); | 115 | adress.setOnClickListener(this); |
| 115 | 116 | ||
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | @Override | 119 | @Override |
| 119 | public void onClick(View view) { | 120 | public void onClick(View view) { |
| 120 | switch (view.getId()){ | 121 | switch (view.getId()){ |
| 121 | case R.id.btn_ok: | 122 | case R.id.btn_ok: |
| 122 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 123 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
| 123 | String forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); | 124 | String forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); |
| 124 | String forot_pwd_pwd3 = adress.getText().toString().trim(); | 125 | String forot_pwd_pwd3 = adress.getText().toString().trim(); |
| 125 | String forot_pwd_pwd4 = newadress.getText().toString().trim(); | 126 | String forot_pwd_pwd4 = newadress.getText().toString().trim(); |
| 126 | if (TextUtils.isEmpty(forot_pwd_phone1)|| | 127 | if (TextUtils.isEmpty(forot_pwd_phone1)|| |
| 127 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ | 128 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ |
| 128 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请将必填项填写完整"); | 129 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请将必填项填写完整"); |
| 129 | return; | 130 | return; |
| 130 | }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ | 131 | }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ |
| 131 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "手机号码输入有误"); | 132 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "手机号码输入有误"); |
| 132 | 133 | ||
| 133 | } else { | 134 | } else { |
| 134 | //修改地址接口 | 135 | //修改地址接口 |
| 135 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 136 | String userID = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
| 136 | long auserID = 0; | 137 | long auserID = 0; |
| 137 | try { | 138 | try { |
| 138 | auserID = Long.parseLong(userID); | 139 | auserID = Long.parseLong(userID); |
| 139 | HttpManager.getInstance().changecardadressinfo(this,auserID,forot_pwd_phone1,forot_pwd_anthcode1,forot_pwd_pwd3+forot_pwd_pwd4); | 140 | HttpManager.getInstance().changecardadressinfo(this,auserID,forot_pwd_phone1,forot_pwd_anthcode1,forot_pwd_pwd3+forot_pwd_pwd4); |
| 140 | } catch (NumberFormatException e) { | 141 | } catch (NumberFormatException e) { |
| 141 | e.printStackTrace(); | 142 | e.printStackTrace(); |
| 142 | } | 143 | } |
| 143 | 144 | ||
| 144 | } | 145 | } |
| 145 | break; | 146 | break; |
| 146 | case R.id.btn_authcode: | 147 | case R.id.btn_authcode: |
| 147 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 148 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
| 148 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ | 149 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ |
| 149 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请输入正确的手机号"); | 150 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请输入正确的手机号"); |
| 150 | }else { | 151 | }else { |
| 151 | forot_pwd_anthcode.requestFocus(); | 152 | forot_pwd_anthcode.requestFocus(); |
| 152 | getauthcode(); | 153 | getauthcode(); |
| 153 | 154 | ||
| 154 | } | 155 | } |
| 155 | 156 | ||
| 156 | break; | 157 | break; |
| 157 | case R.id.et_newpassword: | 158 | case R.id.et_newpassword: |
| 158 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) ChangeElectronicCardAdressInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 159 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) ChangeElectronicCardAdressInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
| 159 | break; | 160 | break; |
| 160 | 161 | ||
| 161 | case R.id.cancel: | 162 | case R.id.cancel: |
| 162 | finish(); | 163 | finish(); |
| 163 | break; | 164 | break; |
| 164 | } | 165 | } |
| 165 | } | 166 | } |
| 166 | 167 | ||
| 167 | @Override | 168 | @Override |
| 168 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 169 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
| 169 | String regionName = data.get(position).getRegionName(); | 170 | String regionName = data.get(position).getRegionName(); |
| 170 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 171 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
| 171 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 172 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
| 172 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 173 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
| 173 | adress.setText(""); | 174 | adress.setText(""); |
| 174 | adress.setText(provice+regionName); | 175 | adress.setText(provice+regionName); |
| 175 | 176 | ||
| 176 | 177 | ||
| 177 | } | 178 | } |
| 178 | 179 | ||
| 179 | @Override | 180 | @Override |
| 180 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 181 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
| 181 | String regionName = data.get(position).getRegionName(); | 182 | String regionName = data.get(position).getRegionName(); |
| 182 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 183 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
| 183 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 184 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
| 184 | adress.setText(""); | 185 | adress.setText(""); |
| 185 | adress.setText(provices+citys+regionName); | 186 | adress.setText(provices+citys+regionName); |
| 186 | } | 187 | } |
| 187 | 188 | ||
| 188 | @Override | 189 | @Override |
| 189 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 190 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
| 190 | String regionName = data.get(position).getRegionName(); | 191 | String regionName = data.get(position).getRegionName(); |
| 191 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 192 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
| 192 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 193 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
| 193 | adress.setText(""); | 194 | adress.setText(""); |
| 194 | adress.setText(regionName); | 195 | adress.setText(regionName); |
| 195 | } | 196 | } |
| 196 | 197 | ||
| 197 | // 线程类 定时器 | 198 | // 线程类 定时器 |
| 198 | public void valiDelay() { | 199 | public void valiDelay() { |
| 199 | 200 | ||
| 200 | Delaytimer = new java.util.Timer(true); | 201 | Delaytimer = new java.util.Timer(true); |
| 201 | 202 | ||
| 202 | 203 | ||
| 203 | TimerTask task = new TimerTask() { | 204 | TimerTask task = new TimerTask() { |
| 204 | public void run() { | 205 | public void run() { |
| 205 | //每次需要执行的代码放到这里面。 | 206 | //每次需要执行的代码放到这里面。 |
| 206 | delayTime--; | 207 | delayTime--; |
| 207 | handler.sendEmptyMessage(21); | 208 | handler.sendEmptyMessage(21); |
| 208 | 209 | ||
| 209 | 210 | ||
| 210 | 211 | ||
| 211 | } | 212 | } |
| 212 | }; | 213 | }; |
| 213 | Delaytimer.schedule(task, 1000,1000); | 214 | Delaytimer.schedule(task, 1000,1000); |
| 214 | } | 215 | } |
| 215 | 216 | ||
| 216 | } | 217 | } |
| 217 | 218 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardValidationActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | import android.os.Message; | 6 | import android.os.Message; |
| 7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
| 8 | import android.text.TextUtils; | 8 | import android.text.TextUtils; |
| 9 | import android.view.View; | 9 | import android.view.View; |
| 10 | import android.widget.Button; | 10 | import android.widget.Button; |
| 11 | import android.widget.EditText; | 11 | import android.widget.EditText; |
| 12 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
| 13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
| 14 | 14 | ||
| 15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
| 16 | import com.hjx.personalcenter.db.Content; | 16 | import com.hjx.personalcenter.db.Content; |
| 17 | import com.hjx.personalcenter.db.SaveParam; | 17 | import com.hjx.personalcenter.db.SaveParam; |
| 18 | import com.hjx.personalcenter.http.HttpCode; | 18 | import com.hjx.personalcenter.http.HttpCode; |
| 19 | import com.hjx.personalcenter.http.HttpManager; | 19 | import com.hjx.personalcenter.http.HttpManager; |
| 20 | import com.hjx.personalcenter.util.AlertUtils; | 20 | import com.hjx.personalcenter.util.AlertUtils; |
| 21 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
| 21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 22 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
| 22 | 23 | ||
| 23 | import org.json.JSONObject; | 24 | import org.json.JSONObject; |
| 24 | 25 | ||
| 25 | import java.util.TimerTask; | 26 | import java.util.TimerTask; |
| 26 | 27 | ||
| 27 | /** | 28 | /** |
| 28 | * Created by h on 2017/8/9. | 29 | * Created by h on 2017/8/9. |
| 29 | */ | 30 | */ |
| 30 | 31 | ||
| 31 | public class ElectronicCardValidationActivity extends AppCompatActivity implements View.OnClickListener { | 32 | public class ElectronicCardValidationActivity extends AppCompatActivity implements View.OnClickListener { |
| 32 | private Button btn_card_valiyanzhen,get_authcode; | 33 | private Button btn_card_valiyanzhen,get_authcode; |
| 33 | private EditText phonenumber,anth_6num;//;//密码 | 34 | private EditText phonenumber,anth_6num;//;//密码 |
| 34 | private TextView menu_title; | 35 | private TextView menu_title; |
| 35 | private ImageView cancel; | 36 | private ImageView cancel; |
| 36 | private int delayTime=60; | 37 | private int delayTime=60; |
| 37 | private java.util.Timer Delaytimer; | 38 | private java.util.Timer Delaytimer; |
| 38 | private String sourceStr ="android"; | 39 | private String sourceStr ="android"; |
| 39 | private String typeStr = "register"; | 40 | private String typeStr = "register"; |
| 40 | String authcode = ""; | 41 | String authcode = ""; |
| 41 | Handler handler = new Handler() { | 42 | Handler handler = new Handler() { |
| 42 | @Override | 43 | @Override |
| 43 | public void handleMessage(Message msg) { | 44 | public void handleMessage(Message msg) { |
| 44 | super.handleMessage(msg); | 45 | super.handleMessage(msg); |
| 45 | JSONObject jsonObject; | 46 | JSONObject jsonObject; |
| 46 | String status; | 47 | String status; |
| 47 | switch (msg.what) { | 48 | switch (msg.what) { |
| 48 | case HttpCode.AUTHCODE_SUCESS: | 49 | case HttpCode.AUTHCODE_SUCESS: |
| 49 | jsonObject = (JSONObject) msg.obj; | 50 | jsonObject = (JSONObject) msg.obj; |
| 50 | status = jsonObject.optString("status"); | 51 | status = jsonObject.optString("status"); |
| 51 | authcode = jsonObject.optString("jsessionid"); | 52 | authcode = jsonObject.optString("jsessionid"); |
| 52 | if (status.equals("100")) { | 53 | if (status.equals("100")) { |
| 53 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); | 54 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | break; | 57 | break; |
| 57 | case HttpCode.AUTHCODE_FAIL: | 58 | case HttpCode.AUTHCODE_FAIL: |
| 58 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); | 59 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); |
| 59 | break; | 60 | break; |
| 60 | case 21: | 61 | case 21: |
| 61 | if(delayTime<=0){ | 62 | if(delayTime<=0){ |
| 62 | if(Delaytimer!=null){ | 63 | if(Delaytimer!=null){ |
| 63 | Delaytimer.cancel(); | 64 | Delaytimer.cancel(); |
| 64 | } | 65 | } |
| 65 | get_authcode.setEnabled(true); | 66 | get_authcode.setEnabled(true); |
| 66 | get_authcode.setClickable(true); | 67 | get_authcode.setClickable(true); |
| 67 | get_authcode.setText("获取验证码"); | 68 | get_authcode.setText("获取验证码"); |
| 68 | delayTime=60; | 69 | delayTime=60; |
| 69 | }else{ | 70 | }else{ |
| 70 | get_authcode.setEnabled(false); | 71 | get_authcode.setEnabled(false); |
| 71 | get_authcode.setClickable(false); | 72 | get_authcode.setClickable(false); |
| 72 | get_authcode.setText(delayTime + " s"); | 73 | get_authcode.setText(delayTime + " s"); |
| 73 | } | 74 | } |
| 74 | break; | 75 | break; |
| 75 | } | 76 | } |
| 76 | } | 77 | } |
| 77 | }; | 78 | }; |
| 78 | @Override | 79 | @Override |
| 79 | protected void onCreate(Bundle savedInstanceState) { | 80 | protected void onCreate(Bundle savedInstanceState) { |
| 80 | super.onCreate(savedInstanceState); | 81 | super.onCreate(savedInstanceState); |
| 81 | setContentView(R.layout.activity_electroniccard_validation); | 82 | setContentView(R.layout.activity_electroniccard_validation); |
| 82 | SysApplication.getInstance().addActivity(this); | 83 | SysApplication.getInstance().addActivity(this); |
| 83 | initView(); | 84 | initView(); |
| 84 | initData(); | 85 | initData(); |
| 85 | initLister(); | 86 | initLister(); |
| 86 | } | 87 | } |
| 87 | 88 | ||
| 88 | private void initView() { | 89 | private void initView() { |
| 89 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); | 90 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); |
| 90 | get_authcode = (Button) findViewById(R.id.btn_authcode); | 91 | get_authcode = (Button) findViewById(R.id.btn_authcode); |
| 91 | anth_6num = (EditText) findViewById(R.id.et_authcode); | 92 | anth_6num = (EditText) findViewById(R.id.et_authcode); |
| 92 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); | 93 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); |
| 93 | menu_title = (TextView) findViewById(R.id.menu_title); | 94 | menu_title = (TextView) findViewById(R.id.menu_title); |
| 94 | cancel = (ImageView) findViewById(R.id.cancel); | 95 | cancel = (ImageView) findViewById(R.id.cancel); |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | private void initData() { | 98 | private void initData() { |
| 98 | if (Content.authcodeflag==1){ | 99 | if (Content.authcodeflag==1){ |
| 99 | menu_title.setText("更换绑定"); | 100 | menu_title.setText("更换绑定"); |
| 100 | btn_card_valiyanzhen.setText("确定"); | 101 | btn_card_valiyanzhen.setText("确定"); |
| 101 | 102 | ||
| 102 | }else if (Content.authcodeflag==2){ | 103 | }else if (Content.authcodeflag==2){ |
| 103 | menu_title.setText("修改保卡信息"); | 104 | menu_title.setText("修改保卡信息"); |
| 104 | btn_card_valiyanzhen.setText("确定"); | 105 | btn_card_valiyanzhen.setText("确定"); |
| 105 | 106 | ||
| 106 | }else { | 107 | }else { |
| 107 | menu_title.setText("填写保卡信息"); | 108 | menu_title.setText("填写保卡信息"); |
| 108 | btn_card_valiyanzhen.setText("下一步"); | 109 | btn_card_valiyanzhen.setText("下一步"); |
| 109 | } | 110 | } |
| 110 | 111 | ||
| 111 | 112 | ||
| 112 | 113 | ||
| 113 | } | 114 | } |
| 114 | 115 | ||
| 115 | private void initLister() { | 116 | private void initLister() { |
| 116 | get_authcode.setOnClickListener(this); | 117 | get_authcode.setOnClickListener(this); |
| 117 | btn_card_valiyanzhen.setOnClickListener(this); | 118 | btn_card_valiyanzhen.setOnClickListener(this); |
| 118 | cancel.setOnClickListener(this); | 119 | cancel.setOnClickListener(this); |
| 119 | 120 | ||
| 120 | } | 121 | } |
| 121 | 122 | ||
| 122 | @Override | 123 | @Override |
| 123 | public void onClick(View v) { | 124 | public void onClick(View v) { |
| 124 | switch (v.getId()){ | 125 | switch (v.getId()){ |
| 125 | case R.id.btn_card_valiyanzhen: | 126 | case R.id.btn_card_valiyanzhen: |
| 126 | 127 | ||
| 127 | String usernameStr = phonenumber.getText().toString().trim(); | 128 | String usernameStr = phonenumber.getText().toString().trim(); |
| 128 | String authcodeStr = anth_6num.getText().toString().trim(); | 129 | String authcodeStr = anth_6num.getText().toString().trim(); |
| 129 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { | 130 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { |
| 130 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); | 131 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); |
| 131 | return; | 132 | return; |
| 132 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 133 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ |
| 133 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); | 134 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); |
| 134 | 135 | ||
| 135 | }else if (!authcode.equals(authcodeStr)){ | 136 | }else if (!authcode.equals(authcodeStr)){ |
| 136 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); | 137 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); |
| 137 | }else { | 138 | }else { |
| 138 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 139 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
| 139 | Long auserID = null; | 140 | Long auserID = null; |
| 140 | try { | 141 | try { |
| 141 | auserID = Long.parseLong(userID); | 142 | auserID = Long.parseLong(userID); |
| 142 | } catch (NumberFormatException e) { | 143 | } catch (NumberFormatException e) { |
| 143 | e.printStackTrace(); | 144 | e.printStackTrace(); |
| 144 | } | 145 | } |
| 145 | if (Content.authcodeflag==1){ | 146 | if (Content.authcodeflag==1){ |
| 146 | //修改账户手机号 | 147 | //修改账户手机号 |
| 147 | HttpManager.getInstance().changeaccountphone(this, | 148 | HttpManager.getInstance().changeaccountphone(this, |
| 148 | auserID,usernameStr,authcodeStr); | 149 | auserID,usernameStr,authcodeStr); |
| 149 | 150 | ||
| 150 | }else if (Content.authcodeflag==2){ | 151 | }else if (Content.authcodeflag==2){ |
| 151 | //修改保卡手机号 | 152 | //修改保卡手机号 |
| 153 | String userID22 = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | ||
| 152 | HttpManager.getInstance().changecardinfophone(this, | 154 | HttpManager.getInstance().changecardinfophone(this, |
| 153 | auserID,usernameStr,authcodeStr); | 155 | userID22,usernameStr,authcodeStr); |
| 154 | }else { | 156 | }else { |
| 155 | String phone =phonenumber.getText().toString().trim(); | 157 | String phone =phonenumber.getText().toString().trim(); |
| 156 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone ); | 158 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone ); |
| 157 | Intent intent = new Intent(); | 159 | Intent intent = new Intent(); |
| 158 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | 160 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); |
| 159 | startActivity(intent); | 161 | startActivity(intent); |
| 160 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 162 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 161 | } | 163 | } |
| 162 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); | 164 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); |
| 163 | // Intent intent = new Intent(); | 165 | // Intent intent = new Intent(); |
| 164 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | 166 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); |
| 165 | // startActivity(intent); | 167 | // startActivity(intent); |
| 166 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); | 168 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 167 | } | 169 | } |
| 168 | break; | 170 | break; |
| 169 | case R.id.btn_authcode: | 171 | case R.id.btn_authcode: |
| 170 | String usernameStr1 = phonenumber.getText().toString().trim(); | 172 | String usernameStr1 = phonenumber.getText().toString().trim(); |
| 171 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ | 173 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ |
| 172 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); | 174 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); |
| 173 | }else { | 175 | }else { |
| 174 | anth_6num.requestFocus(); | 176 | anth_6num.requestFocus(); |
| 175 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); | 177 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); |
| 176 | valiDelay(); | 178 | valiDelay(); |
| 177 | 179 | ||
| 178 | } | 180 | } |
| 179 | 181 | ||
| 180 | break; | 182 | break; |
| 181 | case R.id.cancel: | 183 | case R.id.cancel: |
| 182 | finish(); | 184 | finish(); |
| 183 | break; | 185 | break; |
| 184 | } | 186 | } |
| 185 | } | 187 | } |
| 186 | // 线程类 定时器 | 188 | // 线程类 定时器 |
| 187 | public void valiDelay() { | 189 | public void valiDelay() { |
| 188 | 190 | ||
| 189 | Delaytimer = new java.util.Timer(true); | 191 | Delaytimer = new java.util.Timer(true); |
| 190 | 192 | ||
| 191 | 193 | ||
| 192 | TimerTask task = new TimerTask() { | 194 | TimerTask task = new TimerTask() { |
| 193 | public void run() { | 195 | public void run() { |
| 194 | //每次需要执行的代码放到这里面。 | 196 | //每次需要执行的代码放到这里面。 |
| 195 | delayTime--; | 197 | delayTime--; |
| 196 | handler.sendEmptyMessage(21); | 198 | handler.sendEmptyMessage(21); |
| 197 | } | 199 | } |
| 198 | }; | 200 | }; |
| 199 | Delaytimer.schedule(task, 1000,1000); | 201 | Delaytimer.schedule(task, 1000,1000); |
| 200 | } | 202 | } |
| 201 | } | 203 | } |
| 202 | 204 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
| 6 | import android.net.Uri; | 6 | import android.net.Uri; |
| 7 | import android.os.Build; | 7 | import android.os.Build; |
| 8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
| 9 | import android.os.Handler; | 9 | import android.os.Handler; |
| 10 | import android.os.Message; | 10 | import android.os.Message; |
| 11 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
| 12 | import android.support.annotation.NonNull; | 12 | import android.support.annotation.NonNull; |
| 13 | import android.support.v4.content.FileProvider; | 13 | import android.support.v4.content.FileProvider; |
| 14 | import android.support.v7.app.AppCompatActivity; | 14 | import android.support.v7.app.AppCompatActivity; |
| 15 | import android.support.v7.widget.LinearLayoutManager; | 15 | import android.support.v7.widget.LinearLayoutManager; |
| 16 | import android.support.v7.widget.RecyclerView; | 16 | import android.support.v7.widget.RecyclerView; |
| 17 | import android.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.ImageView; | 21 | import android.widget.ImageView; |
| 21 | import android.widget.LinearLayout; | 22 | import android.widget.LinearLayout; |
| 22 | import android.widget.TextView; | 23 | import android.widget.TextView; |
| 23 | import android.widget.Toast; | 24 | import android.widget.Toast; |
| 24 | 25 | ||
| 25 | import com.facebook.drawee.backends.pipeline.Fresco; | 26 | import com.facebook.drawee.backends.pipeline.Fresco; |
| 26 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 27 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
| 27 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 28 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
| 28 | import com.facebook.drawee.generic.RoundingParams; | 29 | import com.facebook.drawee.generic.RoundingParams; |
| 29 | import com.facebook.drawee.interfaces.DraweeController; | 30 | import com.facebook.drawee.interfaces.DraweeController; |
| 30 | import com.facebook.drawee.view.SimpleDraweeView; | 31 | import com.facebook.drawee.view.SimpleDraweeView; |
| 32 | import com.google.gson.Gson; | ||
| 31 | import com.hjx.personalcenter.R; | 33 | import com.hjx.personalcenter.R; |
| 32 | import com.hjx.personalcenter.adapter.GalleryAdapter; | 34 | import com.hjx.personalcenter.adapter.MianGridAdapter; |
| 33 | import com.hjx.personalcenter.adapter.VideoAdapter; | 35 | import com.hjx.personalcenter.adapter.VideoAdapter; |
| 34 | import com.hjx.personalcenter.customdialog.HeadDialog; | 36 | import com.hjx.personalcenter.customdialog.HeadDialog; |
| 35 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 37 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
| 36 | import com.hjx.personalcenter.db.SaveParam; | 38 | import com.hjx.personalcenter.db.SaveParam; |
| 37 | import com.hjx.personalcenter.http.HttpCode; | 39 | import com.hjx.personalcenter.http.HttpCode; |
| 38 | import com.hjx.personalcenter.http.HttpManager; | 40 | import com.hjx.personalcenter.http.HttpManager; |
| 39 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 41 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 40 | import com.hjx.personalcenter.model.DefautPublishInfo; | 42 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 41 | import com.hjx.personalcenter.model.PesonalInfo; | 43 | import com.hjx.personalcenter.model.PesonalInfo; |
| 42 | import com.hjx.personalcenter.model.SignInfo; | 44 | import com.hjx.personalcenter.model.SignInfo; |
| 43 | import com.hjx.personalcenter.model.VideoInfo; | 45 | import com.hjx.personalcenter.model.VideoInfo; |
| 44 | import com.hjx.personalcenter.update.UpdateChecker; | 46 | import com.hjx.personalcenter.update.UpdateChecker; |
| 45 | import com.hjx.personalcenter.util.AlertUtils; | 47 | import com.hjx.personalcenter.util.AlertUtils; |
| 46 | import com.hjx.personalcenter.util.BrithdayStar; | 48 | import com.hjx.personalcenter.util.BrithdayStar; |
| 47 | import com.hjx.personalcenter.util.CropUtils; | 49 | import com.hjx.personalcenter.util.CropUtils; |
| 48 | import com.hjx.personalcenter.util.DialogPermission; | 50 | import com.hjx.personalcenter.util.DialogPermission; |
| 49 | import com.hjx.personalcenter.util.FileUtil; | 51 | import com.hjx.personalcenter.util.FileUtil; |
| 50 | import com.hjx.personalcenter.util.GetDevicesUtil; | 52 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 51 | import com.hjx.personalcenter.util.PermissionUtil; | 53 | import com.hjx.personalcenter.util.PermissionUtil; |
| 52 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 54 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
| 53 | import com.mylhyl.circledialog.CircleDialog; | 55 | import com.mylhyl.circledialog.CircleDialog; |
| 54 | import com.mylhyl.circledialog.callback.ConfigInput; | 56 | import com.mylhyl.circledialog.callback.ConfigInput; |
| 55 | import com.mylhyl.circledialog.params.InputParams; | 57 | import com.mylhyl.circledialog.params.InputParams; |
| 56 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 58 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
| 57 | import com.zaaach.toprightmenu.MenuItem; | 59 | import com.zaaach.toprightmenu.MenuItem; |
| 58 | import com.zaaach.toprightmenu.TopRightMenu; | 60 | import com.zaaach.toprightmenu.TopRightMenu; |
| 59 | 61 | ||
| 60 | import org.json.JSONException; | 62 | import org.json.JSONException; |
| 61 | import org.json.JSONObject; | 63 | import org.json.JSONObject; |
| 62 | 64 | ||
| 63 | import java.io.File; | 65 | import java.io.File; |
| 64 | import java.io.UnsupportedEncodingException; | 66 | import java.io.UnsupportedEncodingException; |
| 65 | import java.util.ArrayList; | 67 | import java.util.ArrayList; |
| 66 | import java.util.List; | 68 | import java.util.List; |
| 67 | 69 | ||
| 68 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 70 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
| 69 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; | 71 | private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex,tv_edit_presoninfo; |
| 70 | private TextView tv_edit_presoninfo, tv_sign, | 72 | private TextView tv_sign, |
| 71 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 73 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
| 72 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; | 74 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; |
| 73 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; | 75 | private TextView linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass,iv_look_card; |
| 74 | private TopRightMenu mTopRightMenu; | 76 | private TopRightMenu mTopRightMenu; |
| 77 | private LinearLayout view_novedeo; | ||
| 75 | //水平滑动 | 78 | //水平滑动 |
| 76 | private RecyclerView mRecyclerView; | 79 | private RecyclerView mRecyclerView; |
| 77 | private RecyclerView mRecyclerViewpublish; | 80 | private GridView mRecyclerViewpublish; |
| 78 | private VideoAdapter RecyclerViewadapter; | 81 | private VideoAdapter RecyclerViewadapter; |
| 79 | private GalleryAdapter RecyclerViewadapterpublish; | 82 | private MianGridAdapter RecyclerViewadapterpublish; |
| 80 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 83 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
| 81 | 84 | ||
| 82 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); | 85 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); |
| 83 | private boolean showIcon = true; | 86 | private boolean showIcon = true; |
| 84 | private boolean dimBg = true; | 87 | private boolean dimBg = true; |
| 85 | private boolean needAnim = true; | 88 | private boolean needAnim = true; |
| 86 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 89 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
| 87 | private static final int REQUEST_CODE_ALBUM = 2; | 90 | private static final int REQUEST_CODE_ALBUM = 2; |
| 88 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 91 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
| 89 | SimpleDraweeView mSimpleDraweeView; | 92 | SimpleDraweeView mSimpleDraweeView; |
| 90 | private File file; | 93 | private File file; |
| 91 | private Uri uri; | 94 | private Uri uri; |
| 92 | Handler handler = new Handler() { | 95 | Handler handler = new Handler() { |
| 93 | @Override | 96 | @Override |
| 94 | public void handleMessage(Message msg) { | 97 | public void handleMessage(Message msg) { |
| 95 | super.handleMessage(msg); | 98 | super.handleMessage(msg); |
| 96 | switch (msg.what) { | 99 | switch (msg.what) { |
| 97 | case HttpCode.GETINFO: | 100 | case HttpCode.GETINFO: |
| 98 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; | 101 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; |
| 99 | tv_username.setText(cardinfoBean.getNickName()); | 102 | tv_username.setText(cardinfoBean.getNickName()); |
| 100 | tv_username1.setText(cardinfoBean.getNickName()); | 103 | tv_username1.setText(cardinfoBean.getNickName()); |
| 101 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 104 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
| 102 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 105 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
| 103 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 106 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
| 104 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 107 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
| 105 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 108 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
| 106 | String sex = cardinfoBean.getGender(); | 109 | String sex = cardinfoBean.getGender(); |
| 107 | if ("0".equals(sex)) { | 110 | if ("0".equals(sex)) { |
| 108 | tv_sex.setText("男"); | 111 | tv_sex.setText("男"); |
| 109 | iv_sex.setImageResource(R.mipmap.men); | 112 | iv_sex.setImageResource(R.mipmap.men); |
| 110 | } else { | 113 | } else { |
| 111 | tv_sex.setText("女"); | 114 | tv_sex.setText("女"); |
| 112 | iv_sex.setImageResource(R.mipmap.women); | 115 | iv_sex.setImageResource(R.mipmap.women); |
| 113 | } | 116 | } |
| 114 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | 117 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); |
| 115 | //加载星座 | 118 | //加载星座 |
| 116 | BrithdayStar brithdayStar = new BrithdayStar(); | 119 | BrithdayStar brithdayStar = new BrithdayStar(); |
| 117 | if (cardinfoBean.getBirthday() ==null||"".equals(cardinfoBean.getBirthday())) { | 120 | if (cardinfoBean.getBirthday() ==null||"".equals(cardinfoBean.getBirthday())) { |
| 118 | tv_mygad.setText(""); | 121 | tv_mygad.setText(""); |
| 119 | } else { | 122 | } else { |
| 120 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); | 123 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); |
| 121 | tv_mygad.setText(xiongzuo); | 124 | tv_mygad.setText(xiongzuo); |
| 122 | } | 125 | } |
| 123 | //保存个人信息 | 126 | //保存个人信息 |
| 124 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTUSERNAME,cardinfoBean.getNickName()); | 127 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTUSERNAME,cardinfoBean.getNickName()); |
| 125 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTGRADES,cardinfoBean.getGrade().getGradeName()); | 128 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTGRADES,cardinfoBean.getGrade().getGradeName()); |
| 126 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTSCHOOL,cardinfoBean.getSchool().getSchoolName()); | 129 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTSCHOOL,cardinfoBean.getSchool().getSchoolName()); |
| 127 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTCONSTELLATION,cardinfoBean.getBirthday()); | 130 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTCONSTELLATION,cardinfoBean.getBirthday()); |
| 128 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTSEX,tv_sex.getText().toString()); | 131 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTSEX,tv_sex.getText().toString()); |
| 129 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTQQ,cardinfoBean.getQq()); | 132 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTQQ,cardinfoBean.getQq()); |
| 130 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTADRESS,cardinfoBean.getRegion().getRegionName()); | 133 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTADRESS,cardinfoBean.getRegion().getRegionName()); |
| 131 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTXINGZUO,cardinfoBean.getAddress()); | 134 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTXINGZUO,cardinfoBean.getAddress()); |
| 135 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ADRESSID,cardinfoBean.getRegion().getRegionId()); | ||
| 136 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.PORTAIT,cardinfoBean.getPortrait()); | ||
| 132 | String graderID = cardinfoBean.getGrade().getGradeId(); | 137 | String graderID = cardinfoBean.getGrade().getGradeId(); |
| 133 | Log.e("test","nianji"+graderID); | 138 | Log.e("test","nianji"+graderID); |
| 139 | try { | ||
| 140 | long auserID = Long.parseLong(graderID); | ||
| 141 | String ss =SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | ||
| 142 | if ((auserID<8)&&(ss ==null)){ | ||
| 143 | Intent intentbroad = new Intent(); | ||
| 144 | intentbroad.putExtra("info","小学"); | ||
| 145 | //4、定义广播发送的action | ||
| 146 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | ||
| 147 | //5、发送广播 | ||
| 148 | sendBroadcast(intentbroad); | ||
| 149 | Log.i("---", "发送完了"); | ||
| 150 | } | ||
| 151 | } catch (NumberFormatException e) { | ||
| 152 | e.printStackTrace(); | ||
| 153 | } | ||
| 154 | |||
| 155 | |||
| 134 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); | 156 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); |
| 135 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 157 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
| 136 | //账户类型 | 158 | //账户类型 |
| 137 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 159 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
| 138 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 160 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
| 139 | 161 | ||
| 140 | try { | 162 | try { |
| 141 | Object auserID; | 163 | Object auserID; |
| 142 | int type; | 164 | int type; |
| 143 | int graderIDs = Integer.parseInt(graderID); | 165 | int graderIDs = Integer.parseInt(graderID); |
| 144 | if ("2".equals(accounts)) { | 166 | if ("2".equals(accounts)) { |
| 145 | type = Integer.parseInt(accounts); | 167 | type = Integer.parseInt(accounts); |
| 146 | auserID = childID; | 168 | auserID = childID; |
| 147 | } else { | 169 | } else { |
| 148 | type = Integer.parseInt(accounts); | 170 | type = Integer.parseInt(accounts); |
| 149 | auserID = Long.parseLong(userID); | 171 | auserID = Long.parseLong(userID); |
| 150 | } | 172 | } |
| 151 | //获取版本信息 | 173 | //获取版本信息 |
| 152 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); | 174 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); |
| 153 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); | 175 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); |
| 154 | 176 | ||
| 155 | } catch (NumberFormatException e) { | 177 | } catch (NumberFormatException e) { |
| 156 | e.printStackTrace(); | 178 | e.printStackTrace(); |
| 157 | } | 179 | } |
| 158 | 180 | ||
| 159 | break; | 181 | break; |
| 160 | case HttpCode.SIGN: | 182 | case HttpCode.SIGN: |
| 161 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; | 183 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; |
| 162 | if (dataBean.getSignature() == null) { | 184 | if (dataBean.getSignature() == null) { |
| 163 | tv_sign.setText("你还未设置个性签名"); | 185 | tv_sign.setText("你还未设置个性签名"); |
| 164 | } else { | 186 | } else { |
| 165 | tv_sign.setText(dataBean.getSignature()); | 187 | tv_sign.setText(dataBean.getSignature()); |
| 166 | } | 188 | } |
| 167 | 189 | ||
| 168 | break; | 190 | break; |
| 169 | case HttpCode.PUBLISH_SUCESS: | 191 | case HttpCode.PUBLISH_SUCESS: |
| 170 | defautPublishInfos.clear(); | 192 | defautPublishInfos.clear(); |
| 171 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 193 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
| 172 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 194 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
| 195 | Gson gson = new Gson(); | ||
| 196 | Log.e("test","(List<DefautPublishInfo.DataBean>) msg.obj"+ gson.toJson( msg.obj)); | ||
| 197 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.VERSIONINTEFACE, gson.toJson( msg.obj)); | ||
| 173 | break; | 198 | break; |
| 174 | case HttpCode.GETVIDIO_SUCESS: | 199 | case HttpCode.GETVIDIO_SUCESS: |
| 175 | videoinfo.clear(); | 200 | videoinfo.clear(); |
| 176 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); | 201 | if (((List<VideoInfo.DataBean>) msg.obj).size()==0) { |
| 202 | view_novedeo.setVisibility(View.VISIBLE); | ||
| 203 | } else { | ||
| 204 | view_novedeo.setVisibility(View.GONE); | ||
| 205 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); | ||
| 206 | } | ||
| 207 | |||
| 177 | RecyclerViewadapter.notifyDataSetChanged(); | 208 | RecyclerViewadapter.notifyDataSetChanged(); |
| 178 | break; | 209 | break; |
| 179 | case HttpCode.SUCHCARDINFOONE: | 210 | case HttpCode.SUCHCARDINFOONE: |
| 180 | JSONObject jsonObject; | 211 | JSONObject jsonObject; |
| 181 | String status; | 212 | String status; |
| 182 | try { | 213 | try { |
| 183 | jsonObject = new JSONObject((String) msg.obj); | 214 | jsonObject = new JSONObject((String) msg.obj); |
| 184 | status = jsonObject.getString("status"); | 215 | status = jsonObject.getString("status"); |
| 185 | if (status.equals("1")) { | 216 | if (status.equals("1")) { |
| 186 | tv_yangji.setVisibility(View.GONE); | 217 | tv_yangji.setVisibility(View.GONE); |
| 187 | iv_look_card.setVisibility(View.VISIBLE); | 218 | iv_look_card.setVisibility(View.VISIBLE); |
| 188 | } else if (status.equals("2001")) { | 219 | } else if (status.equals("2001")) { |
| 189 | tv_yangji.setVisibility(View.GONE); | 220 | tv_yangji.setVisibility(View.GONE); |
| 190 | iv_look_card.setVisibility(View.VISIBLE); | 221 | iv_look_card.setVisibility(View.VISIBLE); |
| 191 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息,请重新登录"); | 222 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息,请重新登录"); |
| 192 | SaveParam.getInstance().clearData(MainActivity.this); | 223 | SaveParam.getInstance().clearData(MainActivity.this); |
| 193 | Intent settingintent = new Intent(); | 224 | Intent settingintent = new Intent(); |
| 194 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 225 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 195 | startActivity(settingintent); | 226 | startActivity(settingintent); |
| 196 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 227 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 197 | finish(); | 228 | finish(); |
| 198 | } else if (status.equals("2002")) { | 229 | } else if (status.equals("2002")) { |
| 199 | iv_look_card.setVisibility(View.GONE); | 230 | iv_look_card.setVisibility(View.GONE); |
| 200 | tv_yangji.setVisibility(View.VISIBLE); | 231 | tv_yangji.setVisibility(View.VISIBLE); |
| 201 | 232 | ||
| 202 | } else { | 233 | } else { |
| 203 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); | 234 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); |
| 204 | } | 235 | } |
| 205 | } catch (JSONException e) { | 236 | } catch (JSONException e) { |
| 206 | e.printStackTrace(); | 237 | e.printStackTrace(); |
| 207 | } | 238 | } |
| 208 | 239 | ||
| 209 | 240 | ||
| 210 | } | 241 | } |
| 211 | } | 242 | } |
| 212 | }; | 243 | }; |
| 213 | 244 | ||
| 214 | @Override | 245 | @Override |
| 215 | protected void onCreate(Bundle savedInstanceState) { | 246 | protected void onCreate(Bundle savedInstanceState) { |
| 216 | super.onCreate(savedInstanceState); | 247 | super.onCreate(savedInstanceState); |
| 217 | Fresco.initialize(this); | 248 | Fresco.initialize(this); |
| 218 | setContentView(R.layout.activity_main); | 249 | setContentView(R.layout.activity_main); |
| 219 | SysApplication.getInstance().addActivity(this); | 250 | SysApplication.getInstance().addActivity(this); |
| 220 | initView(); | 251 | initView(); |
| 221 | initData(); | 252 | initData(); |
| 222 | initLister(); | 253 | initLister(); |
| 223 | updateVersion(); | 254 | updateVersion(); |
| 224 | } | 255 | } |
| 225 | 256 | ||
| 226 | //////版本更新 | 257 | //////版本更新 |
| 227 | private void updateVersion() { | 258 | private void updateVersion() { |
| 228 | UpdateChecker updateChecker = new UpdateChecker(this); | 259 | UpdateChecker updateChecker = new UpdateChecker(this); |
| 229 | updateChecker.checkForUpdates(); | 260 | updateChecker.checkForUpdates(); |
| 230 | 261 | ||
| 231 | 262 | ||
| 232 | } | 263 | } |
| 233 | 264 | ||
| 234 | private void initView() { | 265 | private void initView() { |
| 235 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 266 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
| 236 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); | 267 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); |
| 237 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); | 268 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); |
| 238 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 269 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
| 239 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 270 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
| 240 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 271 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
| 241 | //头像 | 272 | //头像 |
| 242 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 273 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
| 243 | //初始化个人信息 | 274 | //初始化个人信息 |
| 244 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 275 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
| 245 | tv_username = (TextView) findViewById(R.id.tv_username); | 276 | tv_username = (TextView) findViewById(R.id.tv_username); |
| 246 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 277 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
| 247 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 278 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
| 248 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 279 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
| 249 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 280 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
| 250 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 281 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
| 251 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 282 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
| 252 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 283 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
| 253 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 284 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
| 254 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); | 285 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); |
| 255 | //跳转其他应用 | 286 | //跳转其他应用 |
| 256 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); | 287 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); |
| 257 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); | 288 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); |
| 258 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); | 289 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); |
| 259 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); | 290 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); |
| 260 | // | 291 | // |
| 261 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 292 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
| 262 | mRecyclerViewpublish = (RecyclerView) findViewById(R.id.id_recyclerview_pubish); | 293 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); |
| 263 | 294 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); | |
| 264 | } | 295 | } |
| 265 | 296 | ||
| 266 | 297 | ||
| 267 | private void initData() { | 298 | private void initData() { |
| 268 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 299 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
| 269 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 300 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 270 | uri = Uri.fromFile(file); | 301 | uri = Uri.fromFile(file); |
| 271 | } else { | 302 | } else { |
| 272 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 303 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
| 273 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 304 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
| 274 | } | 305 | } |
| 275 | //设置布局管理器 | 306 | //设置布局管理器 |
| 276 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 307 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
| 277 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 308 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
| 278 | 309 | ||
| 279 | LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); | 310 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); |
| 280 | linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); | 311 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); |
| 281 | 312 | ||
| 282 | mRecyclerView.setLayoutManager(linearLayoutManager); | 313 | mRecyclerView.setLayoutManager(linearLayoutManager); |
| 283 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); | 314 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); |
| 284 | 315 | ||
| 285 | mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); | 316 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); |
| 286 | mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); | 317 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); |
| 287 | 318 | ||
| 288 | //设置视频适配器 | 319 | //设置视频适配器 |
| 289 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); | 320 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); |
| 290 | RecyclerViewadapterpublish = new GalleryAdapter(this, defautPublishInfos); | 321 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos,this); |
| 291 | 322 | ||
| 292 | //版本信息适配器 | 323 | //版本信息适配器 |
| 293 | mRecyclerView.setAdapter(RecyclerViewadapter); | 324 | mRecyclerView.setAdapter(RecyclerViewadapter); |
| 294 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | 325 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); |
| 295 | 326 | ||
| 296 | //判断保卡信息是否为样机 | 327 | //判断保卡信息是否为样机 |
| 297 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); | 328 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); |
| 298 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); | 329 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); |
| 299 | if ("1".equals(yangji)) { | 330 | if ("1".equals(yangji)) { |
| 300 | iv_look_card.setVisibility(View.GONE); | 331 | iv_look_card.setVisibility(View.GONE); |
| 301 | tv_yangji.setVisibility(View.VISIBLE); | 332 | tv_yangji.setVisibility(View.VISIBLE); |
| 302 | } else { | 333 | } else { |
| 303 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); | 334 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); |
| 304 | 335 | ||
| 305 | } | 336 | } |
| 306 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 337 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 307 | //获取个性签名 | 338 | //获取个性签名 |
| 308 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 339 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 340 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | ||
| 341 | |||
| 309 | try { | 342 | try { |
| 310 | long auserID = Long.parseLong(userID); | 343 | long auserID = 1; |
| 344 | long id = Long.parseLong(userID); | ||
| 345 | long childssID = Long.parseLong(childsID); | ||
| 346 | |||
| 311 | int typeaccount1 = Integer.parseInt(typeaccount); | 347 | int typeaccount1 = Integer.parseInt(typeaccount); |
| 312 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); | 348 | if (typeaccount1==2){ |
| 349 | auserID =childssID; | ||
| 350 | }else { | ||
| 351 | auserID =id; | ||
| 352 | } | ||
| 353 | |||
| 354 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); | ||
| 313 | 355 | ||
| 314 | } catch (NumberFormatException e) { | 356 | } catch (NumberFormatException e) { |
| 315 | e.printStackTrace(); | 357 | e.printStackTrace(); |
| 316 | } | 358 | } |
| 317 | 359 | ||
| 318 | 360 | ||
| 319 | } | 361 | } |
| 320 | 362 | ||
| 321 | private void initLister() { | 363 | private void initLister() { |
| 322 | iv_imformatioan.setOnClickListener(this); | 364 | iv_imformatioan.setOnClickListener(this); |
| 323 | iv_look_card.setOnClickListener(this); | 365 | iv_look_card.setOnClickListener(this); |
| 324 | tv_edit_presoninfo.setOnClickListener(this); | 366 | tv_edit_presoninfo.setOnClickListener(this); |
| 325 | iv_setting.setOnClickListener(this); | 367 | iv_setting.setOnClickListener(this); |
| 326 | iv_sign.setOnClickListener(this); | 368 | iv_sign.setOnClickListener(this); |
| 327 | mSimpleDraweeView.setOnClickListener(this); | 369 | mSimpleDraweeView.setOnClickListener(this); |
| 328 | linel_mycuoti.setOnClickListener(this); | 370 | linel_mycuoti.setOnClickListener(this); |
| 329 | linel_mynote.setOnClickListener(this); | 371 | linel_mynote.setOnClickListener(this); |
| 330 | linel_mycollege.setOnClickListener(this); | 372 | linel_mycollege.setOnClickListener(this); |
| 331 | linel_myclass.setOnClickListener(this); | 373 | linel_myclass.setOnClickListener(this); |
| 332 | 374 | ||
| 333 | } | 375 | } |
| 334 | 376 | ||
| 335 | @Override | 377 | @Override |
| 336 | public void onClick(View v) { | 378 | public void onClick(View v) { |
| 337 | switch (v.getId()) { | 379 | switch (v.getId()) { |
| 338 | case R.id.iv_imformatioan: | 380 | case R.id.iv_imformatioan: |
| 339 | Intent intent = new Intent(); | 381 | Intent intent = new Intent(); |
| 340 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 382 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
| 341 | startActivity(intent); | 383 | startActivity(intent); |
| 342 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 384 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 343 | break; | 385 | break; |
| 344 | case R.id.iv_look_card: | 386 | case R.id.iv_look_card: |
| 345 | Intent lookintent = new Intent(); | 387 | Intent lookintent = new Intent(); |
| 346 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 388 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
| 347 | startActivity(lookintent); | 389 | startActivity(lookintent); |
| 348 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 390 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 349 | break; | 391 | break; |
| 350 | case R.id.tv_edit_presoninfo: | 392 | case R.id.tv_edit_presoninfo: |
| 351 | Intent editintent = new Intent(); | 393 | Intent editintent = new Intent(); |
| 352 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 394 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
| 353 | startActivity(editintent); | 395 | startActivity(editintent); |
| 354 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 396 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 355 | break; | 397 | break; |
| 356 | case R.id.iv_head: | 398 | case R.id.iv_head: |
| 357 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 399 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
| 358 | break; | 400 | break; |
| 359 | case R.id.iv_setting: | 401 | case R.id.iv_setting: |
| 360 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 402 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
| 361 | List<MenuItem> menuItems = new ArrayList<>(); | 403 | List<MenuItem> menuItems = new ArrayList<>(); |
| 362 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 404 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); |
| 363 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 405 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); |
| 364 | mTopRightMenu | 406 | mTopRightMenu |
| 365 | .setHeight(150) //默认高度480 | 407 | .setHeight(150) //默认高度480 |
| 366 | .setWidth(320) //默认宽度wrap_content | 408 | .setWidth(320) //默认宽度wrap_content |
| 367 | .showIcon(showIcon) //显示菜单图标,默认为true | 409 | .showIcon(showIcon) //显示菜单图标,默认为true |
| 368 | .dimBackground(dimBg) //背景变暗,默认为true | 410 | .dimBackground(dimBg) //背景变暗,默认为true |
| 369 | .needAnimationStyle(needAnim) //显示动画,默认为true | 411 | .needAnimationStyle(needAnim) //显示动画,默认为true |
| 370 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 412 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
| 371 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 413 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
| 372 | @Override | 414 | @Override |
| 373 | public void onMenuItemClick(int position) { | 415 | public void onMenuItemClick(int position) { |
| 374 | switch (position) { | 416 | switch (position) { |
| 375 | case 0: | 417 | case 0: |
| 376 | new CircleDialog.Builder(MainActivity.this) | 418 | new CircleDialog.Builder(MainActivity.this) |
| 377 | .setCanceledOnTouchOutside(false) | 419 | .setCanceledOnTouchOutside(false) |
| 378 | .setWidth(0.4f) | 420 | .setWidth(0.4f) |
| 379 | .setCancelable(false) | 421 | .setCancelable(false) |
| 380 | .setText("您确定要退出,更换其他账号登录吗?") | 422 | .setText("您确定要退出,更换其他账号登录吗?") |
| 381 | .setNegative("取消", null) | 423 | .setNegative("取消", null) |
| 382 | .setPositive("确定", new View.OnClickListener() { | 424 | .setPositive("确定", new View.OnClickListener() { |
| 383 | @Override | 425 | @Override |
| 384 | public void onClick(View v) { | 426 | public void onClick(View v) { |
| 427 | String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | ||
| 428 | int graderIDs = Integer.parseInt(graderID); | ||
| 429 | if (graderIDs<8){ | ||
| 430 | Intent intentbroad = new Intent(); | ||
| 431 | intentbroad.putExtra("info","小学"); | ||
| 432 | //4、定义广播发送的action | ||
| 433 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | ||
| 434 | //5、发送广播 | ||
| 435 | sendBroadcast(intentbroad); | ||
| 436 | Log.i("---", "发送完了"); | ||
| 437 | } | ||
| 385 | //清除数据 | 438 | //清除数据 |
| 386 | SaveParam.getInstance().clearData(MainActivity.this); | 439 | SaveParam.getInstance().clearData(MainActivity.this); |
| 387 | Intent settingintent = new Intent(); | 440 | Intent settingintent = new Intent(); |
| 388 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 441 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 389 | startActivity(settingintent); | 442 | startActivity(settingintent); |
| 390 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 443 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 391 | finish(); | 444 | finish(); |
| 392 | } | 445 | } |
| 393 | }) | 446 | }) |
| 394 | .show(); | 447 | .show(); |
| 395 | break; | 448 | break; |
| 396 | case 1: | 449 | case 1: |
| 397 | Intent accontMintent = new Intent(); | 450 | Intent accontMintent = new Intent(); |
| 398 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 451 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
| 399 | startActivity(accontMintent); | 452 | startActivity(accontMintent); |
| 400 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 453 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 401 | break; | 454 | break; |
| 402 | } | 455 | } |
| 403 | } | 456 | } |
| 404 | }) | 457 | }) |
| 405 | .addMenuList(menuItems) | 458 | .addMenuList(menuItems) |
| 406 | .showAsDropDown(iv_setting, -250, 0); | 459 | .showAsDropDown(iv_setting, -250, 0); |
| 407 | break; | 460 | break; |
| 408 | case R.id.iv_sign: | 461 | case R.id.iv_sign: |
| 409 | new CircleDialog.Builder(this) | 462 | new CircleDialog.Builder(this) |
| 410 | .setCanceledOnTouchOutside(false) | 463 | .setCanceledOnTouchOutside(false) |
| 411 | .setCancelable(true) | 464 | .setCancelable(true) |
| 412 | .setTitle("个性签名") | 465 | .setTitle("个性签名") |
| 413 | .setInputHint("请输入个性签名") | 466 | .setInputHint("请输入个性签名") |
| 414 | .setWidth(0.5f) | 467 | .setWidth(0.5f) |
| 415 | .configInput(new ConfigInput() { | 468 | .configInput(new ConfigInput() { |
| 416 | @Override | 469 | @Override |
| 417 | public void onConfig(InputParams params) { | 470 | public void onConfig(InputParams params) { |
| 418 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 471 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
| 419 | } | 472 | } |
| 420 | }) | 473 | }) |
| 421 | .setNegative("取消", null) | 474 | .setNegative("取消", new View.OnClickListener() { |
| 475 | @Override | ||
| 476 | public void onClick(View v) { | ||
| 477 | RecyclerViewadapterpublish.notifyDataSetChanged(); | ||
| 478 | } | ||
| 479 | }) | ||
| 422 | .setPositiveInput("确定", new OnInputClickListener() { | 480 | .setPositiveInput("确定", new OnInputClickListener() { |
| 423 | @Override | 481 | @Override |
| 424 | public void onClick(String text, View v) { | 482 | public void onClick(String text, View v) { |
| 425 | if (text.equals("")) { | 483 | if (text.equals("")) { |
| 426 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 484 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
| 427 | } else { | 485 | } else { |
| 428 | try { | 486 | try { |
| 429 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 487 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
| 430 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 488 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
| 431 | long auserID = Long.parseLong(userID); | 489 | long auserID = Long.parseLong(userID); |
| 432 | int typeaccount1 = Integer.parseInt(typeaccount); | 490 | int typeaccount1 = Integer.parseInt(typeaccount); |
| 433 | HttpManager.getInstance().changsignature(MainActivity.this, auserID, typeaccount1, text); | 491 | HttpManager.getInstance().changsignature(MainActivity.this, auserID, typeaccount1, text); |
| 434 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 492 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
| 435 | } catch (NumberFormatException e) { | 493 | } catch (NumberFormatException e) { |
| 436 | e.printStackTrace(); | 494 | e.printStackTrace(); |
| 437 | } | 495 | } |
| 438 | 496 | ||
| 439 | tv_sign.setText(text); | 497 | tv_sign.setText(text); |
| 440 | } | 498 | } |
| 441 | 499 | ||
| 442 | } | 500 | } |
| 443 | }) | 501 | }) |
| 444 | .show(); | 502 | .show(); |
| 445 | break; | 503 | break; |
| 446 | case R.id.linel_mycuoti: | 504 | case R.id.linel_mycuoti: |
| 447 | AlertUtils.showToast(this, "我的错题 "); | 505 | // Intent intentbroad = new Intent(); |
| 506 | // //intentbroad.putExtra("info","小学"); | ||
| 507 | // //4、定义广播发送的action | ||
| 508 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | ||
| 509 | // //5、发送广播 | ||
| 510 | // sendBroadcast(intentbroad); | ||
| 511 | // Log.i("---", "发送完了"); | ||
| 448 | break; | 512 | break; |
| 449 | case R.id.linel_mynote: | 513 | case R.id.linel_mynote: |
| 450 | AlertUtils.showToast(this, "我的笔记 "); | 514 | // Intent intentbroad1 = new Intent(); |
| 515 | // //intentbroad1.putExtra("info","中学"); | ||
| 516 | // //4、定义广播发送的action | ||
| 517 | // intentbroad1.setAction("com.ozing.launcher.SWITCH_GRADE"); | ||
| 518 | // //5、发送广播 | ||
| 519 | // sendBroadcast(intentbroad1); | ||
| 520 | // Log.i("---", "发送完了"); | ||
| 451 | break; | 521 | break; |
| 452 | case R.id.linel_mycollege: | 522 | case R.id.linel_mycollege: |
| 453 | AlertUtils.showToast(this, "我的收藏 "); | 523 | AlertUtils.showToast(this, "我的收藏 "); |
| 454 | break; | 524 | break; |
| 455 | case R.id.linel_myclass: | 525 | case R.id.linel_myclass: |
| 456 | AlertUtils.showToast(this, "我的班级 "); | 526 | AlertUtils.showToast(this, "我的班级 "); |
| 457 | break; | 527 | break; |
| 458 | } | 528 | } |
| 459 | 529 | ||
| 460 | } | 530 | } |
| 461 | 531 | ||
| 462 | @Override | 532 | @Override |
| 463 | protected void onPause() { | 533 | protected void onPause() { |
| 464 | super.onPause(); | 534 | super.onPause(); |
| 465 | } | 535 | } |
| 466 | 536 | ||
| 467 | @Override | 537 | @Override |
| 468 | protected void onResume() { | 538 | protected void onResume() { |
| 469 | super.onResume(); | 539 | super.onResume(); |
| 470 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 540 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 471 | //账户类型 | 541 | //账户类型 |
| 472 | String accounts = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 542 | String accounts = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 473 | try { | 543 | try { |
| 474 | int graderID; | 544 | int graderID; |
| 475 | long auserID = Long.parseLong(userID); | 545 | long auserID = Long.parseLong(userID); |
| 476 | int typeaccount1 = Integer.parseInt(accounts); | 546 | int typeaccount1 = Integer.parseInt(accounts); |
| 477 | //获取最近播放视频 | 547 | //获取最近播放视频 |
| 478 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); | 548 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); |
| 479 | //获取个人信息 | 549 | //获取个人信息 |
| 480 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, auserID, typeaccount1, handler); | 550 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, auserID, typeaccount1, handler); |
| 481 | 551 | ||
| 482 | 552 | ||
| 483 | } catch (NumberFormatException e) { | 553 | } catch (NumberFormatException e) { |
| 484 | e.printStackTrace(); | 554 | e.printStackTrace(); |
| 485 | } | 555 | } |
| 486 | 556 | ||
| 487 | } | 557 | } |
| 488 | 558 | ||
| 489 | //回调头像监听 | 559 | //回调头像监听 |
| 490 | @Override | 560 | @Override |
| 491 | public void heard(Context context, View v, int headpitiaon) { | 561 | public void heard(Context context, View v, int headpitiaon) { |
| 492 | String picUrl = ""; | 562 | String picUrl = ""; |
| 493 | String userID; | 563 | String userID; |
| 494 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 564 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 495 | if ("2".equals(typeaccount)) { | 565 | if ("2".equals(typeaccount)) { |
| 496 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 566 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
| 497 | } else { | 567 | } else { |
| 498 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 568 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 499 | } | 569 | } |
| 500 | switch (v.getId()) { | 570 | switch (v.getId()) { |
| 501 | //选择默认图片 | 571 | //选择默认图片 |
| 502 | case R.id.oktakephone: | 572 | case R.id.oktakephone: |
| 503 | if (headpitiaon == 1) { | 573 | if (headpitiaon == 1) { |
| 504 | mSimpleDraweeView.setImageDrawable(null); | 574 | mSimpleDraweeView.setImageDrawable(null); |
| 505 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 575 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
| 506 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; | 576 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; |
| 507 | try { | 577 | try { |
| 508 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 578 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 509 | } catch (UnsupportedEncodingException e) { | 579 | } catch (UnsupportedEncodingException e) { |
| 510 | e.printStackTrace(); | 580 | e.printStackTrace(); |
| 511 | } | 581 | } |
| 512 | } else if (headpitiaon == 2) { | 582 | } else if (headpitiaon == 2) { |
| 513 | mSimpleDraweeView.setImageDrawable(null); | 583 | mSimpleDraweeView.setImageDrawable(null); |
| 514 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 584 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
| 515 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; | 585 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; |
| 516 | try { | 586 | try { |
| 517 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 587 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 518 | } catch (UnsupportedEncodingException e) { | 588 | } catch (UnsupportedEncodingException e) { |
| 519 | e.printStackTrace(); | 589 | e.printStackTrace(); |
| 520 | } | 590 | } |
| 521 | } else if (headpitiaon == 3) { | 591 | } else if (headpitiaon == 3) { |
| 522 | mSimpleDraweeView.setImageDrawable(null); | 592 | mSimpleDraweeView.setImageDrawable(null); |
| 523 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 593 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
| 524 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; | 594 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; |
| 525 | try { | 595 | try { |
| 526 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 596 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 527 | } catch (UnsupportedEncodingException e) { | 597 | } catch (UnsupportedEncodingException e) { |
| 528 | e.printStackTrace(); | 598 | e.printStackTrace(); |
| 529 | } | 599 | } |
| 530 | } else if (headpitiaon == 4) { | 600 | } else if (headpitiaon == 4) { |
| 531 | mSimpleDraweeView.setImageDrawable(null); | 601 | mSimpleDraweeView.setImageDrawable(null); |
| 532 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 602 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
| 533 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; | 603 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; |
| 534 | try { | 604 | try { |
| 535 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 605 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 536 | } catch (UnsupportedEncodingException e) { | 606 | } catch (UnsupportedEncodingException e) { |
| 537 | e.printStackTrace(); | 607 | e.printStackTrace(); |
| 538 | } | 608 | } |
| 539 | } else { | 609 | } else { |
| 540 | mSimpleDraweeView.setImageDrawable(null); | 610 | mSimpleDraweeView.setImageDrawable(null); |
| 541 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); | 611 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); |
| 542 | ; | 612 | ; |
| 543 | } | 613 | } |
| 544 | 614 | ||
| 545 | break; | 615 | break; |
| 546 | case R.id.canceltakephone: | 616 | case R.id.canceltakephone: |
| 547 | 617 | ||
| 548 | break; | 618 | break; |
| 549 | //拍摄和相册 | 619 | //拍摄和相册 |
| 550 | case R.id.take_pic: | 620 | case R.id.take_pic: |
| 551 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 621 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
| 552 | uploadAvatarFromPhotoRequest(); | 622 | uploadAvatarFromPhotoRequest(); |
| 553 | } | 623 | } |
| 554 | break; | 624 | break; |
| 555 | case R.id.xiangce: | 625 | case R.id.xiangce: |
| 556 | uploadAvatarFromAlbumRequest(); | 626 | uploadAvatarFromAlbumRequest(); |
| 557 | break; | 627 | break; |
| 558 | 628 | ||
| 559 | } | 629 | } |
| 560 | 630 | ||
| 561 | } | 631 | } |
| 562 | //照相 | 632 | //照相 |
| 563 | private void uploadAvatarFromPhotoRequest() { | 633 | private void uploadAvatarFromPhotoRequest() { |
| 564 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 634 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
| 565 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 635 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 566 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 636 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
| 567 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 637 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
| 568 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 638 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
| 569 | } | 639 | } |
| 570 | 640 | ||
| 571 | //选择图库 | 641 | //选择图库 |
| 572 | private void uploadAvatarFromAlbumRequest() { | 642 | private void uploadAvatarFromAlbumRequest() { |
| 573 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 643 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
| 574 | photoPickerIntent.setType("image/*"); | 644 | photoPickerIntent.setType("image/*"); |
| 575 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 645 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
| 576 | } | 646 | } |
| 577 | 647 | ||
| 578 | //回掉 | 648 | //回掉 |
| 579 | @Override | 649 | @Override |
| 580 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 650 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 581 | super.onActivityResult(requestCode, resultCode, data); | 651 | super.onActivityResult(requestCode, resultCode, data); |
| 582 | if (resultCode != -1) { | 652 | if (resultCode != -1) { |
| 583 | return; | 653 | return; |
| 584 | } | 654 | } |
| 585 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 655 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
| 586 | Uri newUri; | 656 | Uri newUri; |
| 587 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 657 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 588 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 658 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
| 589 | } else { | 659 | } else { |
| 590 | newUri = data.getData(); | 660 | newUri = data.getData(); |
| 591 | } | 661 | } |
| 592 | if (newUri != null) { | 662 | if (newUri != null) { |
| 593 | startPhotoZoom(newUri); | 663 | startPhotoZoom(newUri); |
| 594 | } else { | 664 | } else { |
| 595 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 665 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
| 596 | } | 666 | } |
| 597 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 667 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
| 598 | //startPhotoZoom(uri); | 668 | //startPhotoZoom(uri); |
| 599 | uploadAvatarFromPhoto(); | 669 | uploadAvatarFromPhoto(); |
| 600 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 670 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
| 601 | uploadAvatarFromPhoto(); | 671 | uploadAvatarFromPhoto(); |
| 602 | } | 672 | } |
| 603 | } | 673 | } |
| 604 | 674 | ||
| 605 | private void uploadAvatarFromPhoto() { | 675 | private void uploadAvatarFromPhoto() { |
| 606 | compressAndUploadAvatar(file.getPath()); | 676 | compressAndUploadAvatar(file.getPath()); |
| 607 | 677 | ||
| 608 | } | 678 | } |
| 609 | 679 | ||
| 610 | private void compressAndUploadAvatar(String fileSrc) { | 680 | private void compressAndUploadAvatar(String fileSrc) { |
| 611 | 681 | ||
| 612 | 682 | ||
| 613 | //上传到服务器 | 683 | //上传到服务器 |
| 614 | 684 | ||
| 615 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 685 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
| 616 | String mimeType = "image/*"; | 686 | String mimeType = "image/*"; |
| 617 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 687 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
| 618 | //String fileName = cover.getName(); | 688 | //String fileName = cover.getName(); |
| 619 | String userID; | 689 | String userID; |
| 620 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 690 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 621 | if ("2".equals(typeaccount)) { | 691 | if ("2".equals(typeaccount)) { |
| 622 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 692 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
| 623 | } else { | 693 | } else { |
| 624 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 694 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 625 | } | 695 | } |
| 626 | 696 | ||
| 627 | //上传头像 | 697 | //上传头像 |
| 628 | 698 | ||
| 629 | try { | 699 | try { |
| 630 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc); | 700 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc); |
| 631 | } catch (UnsupportedEncodingException e) { | 701 | } catch (UnsupportedEncodingException e) { |
| 632 | e.printStackTrace(); | 702 | e.printStackTrace(); |
| 633 | } | 703 | } |
| 634 | 704 | ||
| 635 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 705 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
| 636 | GenericDraweeHierarchy hierarchy = builder | 706 | GenericDraweeHierarchy hierarchy = builder |
| 637 | .setDesiredAspectRatio(1f) | 707 | .setDesiredAspectRatio(1f) |
| 638 | .setFailureImage(R.mipmap.header_default) | 708 | .setFailureImage(R.mipmap.header_default) |
| 639 | //圆形头像 | 709 | //圆形头像 |
| 640 | .setRoundingParams(RoundingParams.asCircle()) | 710 | .setRoundingParams(RoundingParams.asCircle()) |
| 641 | .build(); | 711 | .build(); |
| 642 | 712 | ||
| 643 | //加载本地图片 | 713 | //加载本地图片 |
| 644 | Uri uri = Uri.fromFile(cover); | 714 | Uri uri = Uri.fromFile(cover); |
| 645 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 715 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
| 646 | .setOldController(mSimpleDraweeView.getController()) | 716 | .setOldController(mSimpleDraweeView.getController()) |
| 647 | .setUri(uri) | 717 | .setUri(uri) |
| 648 | .build(); | 718 | .build(); |
| 649 | mSimpleDraweeView.setHierarchy(hierarchy); | 719 | mSimpleDraweeView.setHierarchy(hierarchy); |
| 650 | mSimpleDraweeView.setController(controller); | 720 | mSimpleDraweeView.setController(controller); |
| 651 | 721 | ||
| 652 | } | 722 | } |
| 653 | 723 | ||
| 654 | public void startPhotoZoom(Uri uri) { | 724 | public void startPhotoZoom(Uri uri) { |
| 655 | Intent intent = new Intent("com.android.camera.action.CROP"); | 725 | Intent intent = new Intent("com.android.camera.action.CROP"); |
| 656 | intent.setDataAndType(uri, "image/*"); | 726 | intent.setDataAndType(uri, "image/*"); |
| 657 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 727 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 658 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 728 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
| 659 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 729 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
| 660 | intent.putExtra("aspectY", 1);// x:y=1:1 | 730 | intent.putExtra("aspectY", 1);// x:y=1:1 |
| 661 | // intent.putExtra("outputX", 400);//图片输出大小 | 731 | // intent.putExtra("outputX", 400);//图片输出大小 |
| 662 | // intent.putExtra("outputY", 400); | 732 | // intent.putExtra("outputY", 400); |
| 663 | intent.putExtra("output", Uri.fromFile(file)); | 733 | intent.putExtra("output", Uri.fromFile(file)); |
| 664 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 734 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
| 665 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 735 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
| 666 | } | 736 | } |
| 667 | 737 | ||
| 668 | @Override | 738 | @Override |
| 669 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 739 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
| 670 | switch (requestCode) { | 740 | switch (requestCode) { |
| 671 | 741 | ||
| 672 | case PermissionUtil.REQUEST_SHOWCAMERA: | 742 | case PermissionUtil.REQUEST_SHOWCAMERA: |
| 673 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 743 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
| 674 | // Permission Granted | 744 | // Permission Granted |
| 675 | uploadAvatarFromPhotoRequest(); | 745 | uploadAvatarFromPhotoRequest(); |
| 676 | 746 | ||
| 677 | } else { | 747 | } else { |
| 678 | if (!SharedPreferenceMark.getHasShowCamera()) { | 748 | if (!SharedPreferenceMark.getHasShowCamera()) { |
| 679 | SharedPreferenceMark.setHasShowCamera(true); | 749 | SharedPreferenceMark.setHasShowCamera(true); |
| 680 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 750 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
| 681 | 751 | ||
| 682 | } else { | 752 | } else { |
| 683 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 753 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
| 684 | .show(); | 754 | .show(); |
| 685 | } | 755 | } |
| 686 | } | 756 | } |
| 687 | break; | 757 | break; |
| 688 | default: | 758 | default: |
| 689 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 759 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 690 | } | 760 | } |
| 691 | } | 761 | } |
| 692 | 762 | ||
| 693 | 763 | ||
| 694 | 764 | ||
| 695 | private long exitTime = 0; | 765 | private long exitTime = 0; |
| 696 | 766 | ||
| 697 | @Override | 767 | @Override |
| 698 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 768 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| 699 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 769 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 700 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 770 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
| 701 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 771 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
| 702 | Toast.LENGTH_SHORT).show(); | 772 | Toast.LENGTH_SHORT).show(); |
| 703 | exitTime = System.currentTimeMillis(); | 773 | exitTime = System.currentTimeMillis(); |
| 704 | } else { | 774 | } else { |
| 705 | SysApplication.getInstance().finishActivity(MainActivity.this); | 775 | SysApplication.getInstance().finishActivity(MainActivity.this); |
| 706 | } | 776 | } |
| 707 | return false; | 777 | return false; |
| 708 | } | 778 | } |
| 709 | return super.onKeyDown(keyCode, event); | 779 | return super.onKeyDown(keyCode, event); |
| 710 | } | 780 | } |
| 711 | } | 781 | } |
| 712 | 782 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MyApplication.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.app.Application; | 3 | import android.app.Application; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.graphics.drawable.Drawable; | 5 | import android.graphics.drawable.Drawable; |
| 6 | import android.os.Looper; | 6 | import android.os.Looper; |
| 7 | import android.view.Gravity; | 7 | import android.view.Gravity; |
| 8 | import android.widget.TextView; | 8 | import android.widget.TextView; |
| 9 | import android.widget.Toast; | 9 | import android.widget.Toast; |
| 10 | 10 | ||
| 11 | import com.facebook.drawee.backends.pipeline.Fresco; | 11 | import com.facebook.drawee.backends.pipeline.Fresco; |
| 12 | import com.hjx.personalcenter.R; | 12 | import com.hjx.personalcenter.R; |
| 13 | import com.hjx.personalcenter.crash.CrashHandler; | 13 | import com.hjx.personalcenter.crash.CrashHandler; |
| 14 | import com.hjx.personalcenter.util.ImageCache; | 14 | import com.hjx.personalcenter.util.ImageCache; |
| 15 | import com.squareup.leakcanary.LeakCanary; | 15 | import com.squareup.leakcanary.LeakCanary; |
| 16 | import com.tencent.bugly.crashreport.CrashReport; | 16 | import com.tencent.bugly.crashreport.CrashReport; |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | * Created by ${yf} on 2017/2/16. | 19 | * Created by ${yf} on 2017/2/16. |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | public class MyApplication extends Application { | 22 | public class MyApplication extends Application { |
| 23 | 23 | ||
| 24 | private ImageCache mImageCache; | 24 | private ImageCache mImageCache; |
| 25 | private static Context context; | 25 | private static Context context; |
| 26 | private static MyApplication instance; | 26 | private static MyApplication instance; |
| 27 | @Override | 27 | @Override |
| 28 | public void onCreate() { | 28 | public void onCreate() { |
| 29 | context = getApplicationContext(); | 29 | context = getApplicationContext(); |
| 30 | //c初始化内存检测 | 30 | //c初始化内存检测 |
| 31 | LeakCanary.install(this); | 31 | LeakCanary.install(this); |
| 32 | //初始化Fresco | 32 | //初始化Fresco |
| 33 | Fresco.initialize(this); | 33 | Fresco.initialize(this); |
| 34 | mImageCache = new ImageCache(); | 34 | mImageCache = new ImageCache(); |
| 35 | instance = this; | 35 | instance = this; |
| 36 | CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false); | 36 | CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false); |
| 37 | CrashHandler crashHandler = CrashHandler.getInstance(); | 37 | CrashHandler crashHandler = CrashHandler.getInstance(); |
| 38 | //生成错误日志,测试的时候得放开 | 38 | //生成错误日志,上线的时候得放开 |
| 39 | crashHandler.init(getApplicationContext()); | 39 | //crashHandler.init(getApplicationContext()); |
| 40 | crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { | 40 | crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { |
| 41 | 41 | ||
| 42 | @Override | 42 | @Override |
| 43 | public boolean handleCrash(final Context context, final Throwable ex) { | 43 | public boolean handleCrash(final Context context, final Throwable ex) { |
| 44 | new Thread(new Runnable() { | 44 | new Thread(new Runnable() { |
| 45 | 45 | ||
| 46 | @Override | 46 | @Override |
| 47 | public void run() { | 47 | public void run() { |
| 48 | Looper.prepare(); | 48 | Looper.prepare(); |
| 49 | System.out.println("bcz = " + ex.toString()); | 49 | System.out.println("bcz = " + ex.toString()); |
| 50 | Toast toast = new Toast(context); | 50 | Toast toast = new Toast(context); |
| 51 | TextView tv = new TextView(context); | 51 | TextView tv = new TextView(context); |
| 52 | tv.setText(" 很抱歉,"+context.getString(R.string.app_name)+"崩溃了,我们会尽快修复."); | 52 | tv.setText(" 很抱歉,"+context.getString(R.string.app_name)+"崩溃了,我们会尽快修复."); |
| 53 | tv.setPadding(10, 10, 10, 10); | 53 | tv.setPadding(10, 10, 10, 10); |
| 54 | tv.setTextSize(20); | 54 | tv.setTextSize(20); |
| 55 | tv.setBackgroundResource(R.drawable.black_btn_default); | 55 | tv.setBackgroundResource(R.drawable.black_btn_default); |
| 56 | tv.setTextColor(context.getResources().getColor(android.R.color.white)); | 56 | tv.setTextColor(context.getResources().getColor(android.R.color.white)); |
| 57 | Drawable drawable= context.getResources().getDrawable(R.drawable.sorry); | 57 | Drawable drawable= context.getResources().getDrawable(R.drawable.sorry); |
| 58 | drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); | 58 | drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); |
| 59 | tv.setCompoundDrawables(drawable,null,null,null); | 59 | tv.setCompoundDrawables(drawable,null,null,null); |
| 60 | toast.setView(tv); | 60 | toast.setView(tv); |
| 61 | toast.setGravity(Gravity.CENTER, 0, 0); | 61 | toast.setGravity(Gravity.CENTER, 0, 0); |
| 62 | toast.setDuration(Toast.LENGTH_LONG); | 62 | toast.setDuration(Toast.LENGTH_LONG); |
| 63 | toast.show(); | 63 | toast.show(); |
| 64 | Looper.loop(); | 64 | Looper.loop(); |
| 65 | } | 65 | } |
| 66 | }).start(); | 66 | }).start(); |
| 67 | try { | 67 | try { |
| 68 | Thread.sleep(1000); | 68 | Thread.sleep(1000); |
| 69 | } catch (InterruptedException e) { | 69 | } catch (InterruptedException e) { |
| 70 | // TODO Auto-generated catch block | 70 | // TODO Auto-generated catch block |
| 71 | e.printStackTrace(); | 71 | e.printStackTrace(); |
| 72 | } | 72 | } |
| 73 | return false; | 73 | return false; |
| 74 | } | 74 | } |
| 75 | }); | 75 | }); |
| 76 | super.onCreate(); | 76 | super.onCreate(); |
| 77 | } | 77 | } |
| 78 | public ImageCache getImageCache() { | 78 | public ImageCache getImageCache() { |
| 79 | return mImageCache; | 79 | return mImageCache; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | public static Context getContext() { | 82 | public static Context getContext() { |
| 83 | return context; | 83 | return context; |
| 84 | } | 84 | } |
| 85 | public static MyApplication getInstance() { | 85 | public static MyApplication getInstance() { |
| 86 | return instance; | 86 | return instance; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | } | 89 | } |
| 90 | 90 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/MianGridAdapter.java
| File was created | 1 | package com.hjx.personalcenter.adapter; | |
| 2 | |||
| 3 | import android.content.Context; | ||
| 4 | import android.view.View; | ||
| 5 | import android.view.ViewGroup; | ||
| 6 | import android.widget.BaseAdapter; | ||
| 7 | import android.widget.TextView; | ||
| 8 | |||
| 9 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 10 | import com.hjx.personalcenter.R; | ||
| 11 | import com.hjx.personalcenter.model.DefautPublishInfo; | ||
| 12 | |||
| 13 | import java.util.ArrayList; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * Created by h on 2017/9/12. | ||
| 17 | */ | ||
| 18 | |||
| 19 | public class MianGridAdapter extends BaseAdapter { | ||
| 20 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; | ||
| 21 | private Context context; | ||
| 22 | |||
| 23 | public MianGridAdapter(ArrayList<DefautPublishInfo.DataBean> defautPublishInfo, Context context) { | ||
| 24 | this.defautPublishInfo = defautPublishInfo; | ||
| 25 | this.context = context; | ||
| 26 | } | ||
| 27 | |||
| 28 | @Override | ||
| 29 | public int getCount() { | ||
| 30 | return defautPublishInfo.size(); | ||
| 31 | } | ||
| 32 | |||
| 33 | @Override | ||
| 34 | public Object getItem(int position) { | ||
| 35 | return position; | ||
| 36 | } | ||
| 37 | |||
| 38 | @Override | ||
| 39 | public long getItemId(int position) { | ||
| 40 | return position; | ||
| 41 | } | ||
| 42 | |||
| 43 | @Override | ||
| 44 | public View getView(int position, View convertView, ViewGroup parent) { | ||
| 45 | ViewHolder viewHolder = new ViewHolder(); | ||
| 46 | if (convertView == null) { | ||
| 47 | convertView = View.inflate(context, R.layout.fragment_changge_version_info_itmes4, null); | ||
| 48 | viewHolder.simpleDraweeView = (SimpleDraweeView) convertView.findViewById(R.id.image_publish); | ||
| 49 | //viewHolder.subject = (TextView) convertView.findViewById(R.id.subject); | ||
| 50 | viewHolder.publish = (TextView) convertView.findViewById(R.id.tv_publish); | ||
| 51 | convertView.setTag(viewHolder); | ||
| 52 | } else { | ||
| 53 | viewHolder = (ViewHolder) convertView.getTag(); | ||
| 54 | } | ||
| 55 | viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(position).getCover()); | ||
| 56 | //viewHolder.subject.setText(defautPublishInfo.get(position).getSubject()); | ||
| 57 | viewHolder.publish.setText(defautPublishInfo.get(position).getPress()); | ||
| 58 | return convertView; | ||
| 59 | } | ||
| 60 | |||
| 61 | static class ViewHolder { | ||
| 62 | SimpleDraweeView simpleDraweeView; | ||
| 63 | // TextView subject; | ||
| 64 | TextView publish; | ||
| 65 | } | ||
| 66 | } | ||
| 67 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/SchoolListDialog.java
| 1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
| 2 | 2 | ||
| 3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
| 6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 7 | import android.os.Handler; | 7 | import android.os.Handler; |
| 8 | import android.os.Message; | 8 | import android.os.Message; |
| 9 | import android.text.Editable; | 9 | import android.text.Editable; |
| 10 | import android.text.TextWatcher; | 10 | import android.text.TextWatcher; |
| 11 | import android.util.Log; | 11 | import android.util.Log; |
| 12 | import android.view.Gravity; | 12 | import android.view.Gravity; |
| 13 | import android.view.LayoutInflater; | 13 | import android.view.LayoutInflater; |
| 14 | import android.view.View; | 14 | import android.view.View; |
| 15 | import android.view.ViewGroup; | 15 | import android.view.ViewGroup; |
| 16 | import android.widget.AdapterView; | 16 | import android.widget.AdapterView; |
| 17 | import android.widget.EditText; | 17 | import android.widget.EditText; |
| 18 | import android.widget.ImageView; | 18 | import android.widget.ImageView; |
| 19 | import android.widget.ListView; | 19 | import android.widget.ListView; |
| 20 | 20 | ||
| 21 | import com.hjx.personalcenter.R; | 21 | import com.hjx.personalcenter.R; |
| 22 | import com.hjx.personalcenter.adapter.SchoolAdapter; | 22 | import com.hjx.personalcenter.adapter.SchoolAdapter; |
| 23 | import com.hjx.personalcenter.db.Content; | 23 | import com.hjx.personalcenter.db.Content; |
| 24 | import com.hjx.personalcenter.db.SaveParam; | 24 | import com.hjx.personalcenter.db.SaveParam; |
| 25 | import com.hjx.personalcenter.http.HttpCode; | 25 | import com.hjx.personalcenter.http.HttpCode; |
| 26 | import com.hjx.personalcenter.http.HttpManager; | 26 | import com.hjx.personalcenter.http.HttpManager; |
| 27 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 27 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 28 | import com.hjx.personalcenter.model.SchoolInfo; | 28 | import com.hjx.personalcenter.model.SchoolInfo; |
| 29 | import com.mylhyl.circledialog.BaseCircleDialog; | 29 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 30 | import com.mylhyl.circledialog.res.values.CircleDimen; | 30 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 31 | 31 | ||
| 32 | import java.util.ArrayList; | 32 | import java.util.ArrayList; |
| 33 | import java.util.List; | 33 | import java.util.List; |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * Created by h on 2017/8/21. | 36 | * Created by h on 2017/8/21. |
| 37 | */ | 37 | */ |
| 38 | @SuppressLint("ValidFragment") | 38 | @SuppressLint("ValidFragment") |
| 39 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 39 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
| 40 | private ListView school_list; | 40 | private ListView school_list; |
| 41 | private EditText school_sech; | 41 | private EditText school_sech; |
| 42 | private SchoolAdapter listadapter; | 42 | private SchoolAdapter listadapter; |
| 43 | private ImageView cance; | 43 | private ImageView cance; |
| 44 | private View mView; | 44 | private View mView; |
| 45 | boolean isFilter; | 45 | boolean isFilter; |
| 46 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); | 46 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); |
| 47 | private DialogCallBack.SchoolCallBack mCallBack; | 47 | private DialogCallBack.SchoolCallBack mCallBack; |
| 48 | 48 | ||
| 49 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { | 49 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { |
| 50 | // this.mCallBack = callBack; | 50 | // this.mCallBack = callBack; |
| 51 | // } | 51 | // } |
| 52 | public SchoolListDialog(DialogCallBack.SchoolCallBack callBack) { | 52 | public SchoolListDialog(DialogCallBack.SchoolCallBack callBack) { |
| 53 | this.mCallBack = callBack; | 53 | this.mCallBack = callBack; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | public static SchoolListDialog getInstance(DialogCallBack.SchoolCallBack mCallBack) { | 56 | public static SchoolListDialog getInstance(DialogCallBack.SchoolCallBack mCallBack) { |
| 57 | SchoolListDialog dialogFragment = new SchoolListDialog(mCallBack); | 57 | SchoolListDialog dialogFragment = new SchoolListDialog(mCallBack); |
| 58 | dialogFragment.setCanceledBack(true); | 58 | dialogFragment.setCanceledBack(true); |
| 59 | dialogFragment.setCanceledOnTouchOutside(true); | 59 | dialogFragment.setCanceledOnTouchOutside(true); |
| 60 | dialogFragment.setRadius(CircleDimen.RADIUS); | 60 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 61 | dialogFragment.setWidth(0.5f); | 61 | dialogFragment.setWidth(0.5f); |
| 62 | dialogFragment.setGravity(Gravity.CENTER); | 62 | dialogFragment.setGravity(Gravity.CENTER); |
| 63 | dialogFragment.setBackgroundColor(Color.WHITE); | 63 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 64 | return dialogFragment; | 64 | return dialogFragment; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | Handler handler = new Handler(){ | 67 | Handler handler = new Handler(){ |
| 68 | @Override | 68 | @Override |
| 69 | public void handleMessage(Message msg) { | 69 | public void handleMessage(Message msg) { |
| 70 | super.handleMessage(msg); | 70 | super.handleMessage(msg); |
| 71 | switch (msg.what){ | 71 | switch (msg.what){ |
| 72 | case HttpCode.SCHOOL: | 72 | case HttpCode.SCHOOL: |
| 73 | data.clear(); | 73 | data.clear(); |
| 74 | data.addAll( (List<SchoolInfo.DataBean>)msg.obj); | 74 | data.addAll( (List<SchoolInfo.DataBean>)msg.obj); |
| 75 | listadapter.notifyDataSetChanged(); | 75 | listadapter.notifyDataSetChanged(); |
| 76 | break; | 76 | break; |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | @Override | 82 | @Override |
| 83 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 83 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 84 | 84 | ||
| 85 | if (mView == null) { | 85 | if (mView == null) { |
| 86 | mView = inflater.inflate(R.layout.custom_adilog_school_list, container, false); | 86 | mView = inflater.inflate(R.layout.custom_adilog_school_list, container, false); |
| 87 | //mCallBack.provinceOnItemClick(context, inflater, container); | 87 | //mCallBack.provinceOnItemClick(context, inflater, container); |
| 88 | } | 88 | } |
| 89 | return mView; | 89 | return mView; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | @Override | 92 | @Override |
| 93 | public void onActivityCreated(Bundle savedInstanceState) { | 93 | public void onActivityCreated(Bundle savedInstanceState) { |
| 94 | super.onActivityCreated(savedInstanceState); | 94 | super.onActivityCreated(savedInstanceState); |
| 95 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); | 95 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); |
| 96 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); | 96 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); |
| 97 | cance = (ImageView) getView().findViewById(R.id.cancel); | 97 | cance = (ImageView) getView().findViewById(R.id.cancel); |
| 98 | String citys = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); | 98 | String citys = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); |
| 99 | String country = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.COUNTRY); | 99 | String country = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.ADRESSID); |
| 100 | if (country==null){ | 100 | if (country==null){ |
| 101 | country =citys; | 101 | country =citys; |
| 102 | } | 102 | } |
| 103 | String grade; | 103 | String grade; |
| 104 | if ( Content.changeinfoflag == true){ | 104 | if ( Content.changeinfoflag == true){ |
| 105 | grade=SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CHILDSGRADENS); | 105 | grade=SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CHILDSGRADENS); |
| 106 | }else { | 106 | }else { |
| 107 | grade=SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 107 | grade=SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
| 108 | } | 108 | } |
| 109 | listadapter = new SchoolAdapter(data, getActivity()); | 109 | listadapter = new SchoolAdapter(data, getActivity()); |
| 110 | school_list.setAdapter(listadapter); | 110 | school_list.setAdapter(listadapter); |
| 111 | school_list.setOnItemClickListener(this); | 111 | school_list.setOnItemClickListener(this); |
| 112 | cance.setOnClickListener(new View.OnClickListener() { | 112 | cance.setOnClickListener(new View.OnClickListener() { |
| 113 | @Override | 113 | @Override |
| 114 | public void onClick(View v) { | 114 | public void onClick(View v) { |
| 115 | dismiss(); | 115 | dismiss(); |
| 116 | } | 116 | } |
| 117 | }); | 117 | }); |
| 118 | try { | 118 | try { |
| 119 | int a = Integer.parseInt(country); | 119 | int a = Integer.parseInt(country); |
| 120 | int b = Integer.parseInt(grade); | 120 | int b = Integer.parseInt(grade); |
| 121 | Log.e("test","地区ID"+country+"年级ID"+grade); | 121 | Log.e("test","地区ID"+country+"年级ID"+grade); |
| 122 | HttpManager.getInstance().getschool(getActivity(),a,b,handler); | 122 | HttpManager.getInstance().getschool(getActivity(),a,b,handler); |
| 123 | } catch (NumberFormatException e) { | 123 | } catch (NumberFormatException e) { |
| 124 | e.printStackTrace(); | 124 | e.printStackTrace(); |
| 125 | } | 125 | } |
| 126 | intiEditView(); | 126 | intiEditView(); |
| 127 | 127 | ||
| 128 | 128 | ||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | private void intiEditView() { | 131 | private void intiEditView() { |
| 132 | school_sech.addTextChangedListener(new TextWatcher() { | 132 | school_sech.addTextChangedListener(new TextWatcher() { |
| 133 | @Override | 133 | @Override |
| 134 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | 134 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
| 135 | 135 | ||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | @Override | 138 | @Override |
| 139 | public void onTextChanged(CharSequence s, int start, int before, int count) { | 139 | public void onTextChanged(CharSequence s, int start, int before, int count) { |
| 140 | // mAdapter.getFilter().filter(s); | 140 | // mAdapter.getFilter().filter(s); |
| 141 | 141 | ||
| 142 | listadapter.getFilter().filter(s); | 142 | listadapter.getFilter().filter(s); |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | @Override | 145 | @Override |
| 146 | public void afterTextChanged(Editable s) { | 146 | public void afterTextChanged(Editable s) { |
| 147 | 147 | ||
| 148 | } | 148 | } |
| 149 | }); | 149 | }); |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | @Override | 152 | @Override |
| 153 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 153 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
| 154 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SCHOOOlID, ""+data.get(position).getSchoolId()); | 154 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SCHOOOlID, ""+data.get(position).getSchoolId()); |
| 155 | mCallBack.provinceO4nItemClick(data,position,4); | 155 | mCallBack.provinceO4nItemClick(data,position,4); |
| 156 | dismiss(); | 156 | dismiss(); |
| 157 | 157 | ||
| 158 | } | 158 | } |
| 159 | } | 159 | } |
| 160 | 160 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
| 1 | package com.hjx.personalcenter.db; | 1 | package com.hjx.personalcenter.db; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.content.SharedPreferences; | 5 | import android.content.SharedPreferences; |
| 6 | 6 | ||
| 7 | public class SaveParam { | 7 | public class SaveParam { |
| 8 | 8 | ||
| 9 | private static SaveParam instance; | 9 | private static SaveParam instance; |
| 10 | public static SaveParam getInstance(){ | 10 | public static SaveParam getInstance(){ |
| 11 | if (instance==null){ | 11 | if (instance==null){ |
| 12 | instance = new SaveParam(); | 12 | instance = new SaveParam(); |
| 13 | } | 13 | } |
| 14 | return instance; | 14 | return instance; |
| 15 | } | 15 | } |
| 16 | public static String GRADERFLAG = "graderflag";//子账号id | 16 | public static String GRADERFLAG = "graderflag";//子账号id |
| 17 | public static String CHILDSID = "childID";//子账号id | 17 | public static String CHILDSID = "childID";//子账号id |
| 18 | public static String CHILDSGRADENS = "childs";//子账号年级id | 18 | public static String CHILDSGRADENS = "childs";//子账号年级id |
| 19 | public static String GRADENS = "gradens";//年级id | 19 | public static String GRADENS = "gradens";//年级id |
| 20 | public static String SCHOOOlID = "schoolid";//学校id | 20 | public static String SCHOOOlID = "schoolid";//学校id |
| 21 | //个人信息 | 21 | //个人信息 |
| 22 | public static String USERNAME = "usernames";//昵称 | 22 | public static String USERNAME = "usernames";//昵称 |
| 23 | public static String ADRESS = "adress";//地址 | 23 | public static String ADRESS = "adress";//地址 |
| 24 | public static String GRADES = "gadens";//年级 | 24 | public static String GRADES = "gadens";//年级 |
| 25 | public static String SCHOOL = "school";//学校 | 25 | public static String SCHOOL = "school";//学校 |
| 26 | public static String CONSTELLATION = "constellations";//星座 | 26 | public static String CONSTELLATION = "constellations";//星座 |
| 27 | public static String HEADURL = "headurl";//头像 | 27 | public static String HEADURL = "headurl";//头像 |
| 28 | 28 | ||
| 29 | //用户个人信息 | 29 | //用户个人信息 |
| 30 | public static String ACCOUNTUSERNAME = "accountusernames";//昵称 | 30 | public static String ACCOUNTUSERNAME = "accountusernames";//昵称 |
| 31 | public static String ACCOUNTADRESS = "accountadress";//地址 | 31 | public static String ACCOUNTADRESS = "accountadress";//地址 |
| 32 | public static String ACCOUNTGRADES = "accountgadens";//年级 | 32 | public static String ACCOUNTGRADES = "accountgadens";//年级 |
| 33 | public static String ACCOUNTSCHOOL = "accountschool";//学校 | 33 | public static String ACCOUNTSCHOOL = "accountschool";//学校 |
| 34 | public static String ACCOUNTCONSTELLATION = "accountbthday";//生日 | 34 | public static String ACCOUNTCONSTELLATION = "accountbthday";//生日 |
| 35 | public static String ACCOUNTSEX = "accountsex";//性别 | 35 | public static String ACCOUNTSEX = "accountsex";//性别 |
| 36 | public static String ACCOUNTQQ= "accountqq";//qq | 36 | public static String ACCOUNTQQ= "accountqq";//qq |
| 37 | public static String ACCOUNTXINGZUO = "accountxingzuo";//详细地址 | 37 | public static String ACCOUNTXINGZUO = "accountxingzuo";//详细地址 |
| 38 | public static String PORTAIT = "portrait";//头像 | ||
| 39 | public static String ADRESSID = "adressid";//地址id | ||
| 38 | 40 | ||
| 39 | //电子保卡信息 | 41 | //电子保卡信息 |
| 40 | public static String CARDPHONE = "cardphone";//保卡手机号 | 42 | public static String CARDPHONE = "cardphone";//保卡手机号 |
| 41 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 | 43 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 |
| 42 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 | 44 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 |
| 43 | public static String SHOPTIME = "shoptime";//购买时间 | 45 | public static String SHOPTIME = "shoptime";//购买时间 |
| 44 | public static String SHOPADRESS = "shopadress";//购买地址 | 46 | public static String SHOPADRESS = "shopadress";//购买地址 |
| 45 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 | 47 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 |
| 46 | 48 | ||
| 47 | //省市区参数、 | 49 | //省市区参数、 |
| 48 | public static String PROVINCES = "provinces";//省 | 50 | public static String PROVINCES = "provinces";//省 |
| 49 | public static String CITYS = "citys";//市 | 51 | public static String CITYS = "citys";//市 |
| 50 | public static String COUNTRY = "country";//区 | 52 | public static String COUNTRY = "country";//区 |
| 51 | 53 | ||
| 52 | //账户管理 | 54 | //账户管理 |
| 53 | public static String ACCOUNT = "account";//账户类型 | 55 | public static String ACCOUNT = "account";//账户类型 |
| 54 | //科目信息 | 56 | //科目信息 |
| 55 | public static String SUBJECT = "subject"; | 57 | public static String SUBJECT = "subject"; |
| 56 | //样机 | 58 | //样机 |
| 57 | public static String YANGJI = "yangji"; | 59 | public static String YANGJI = "yangji"; |
| 58 | //图片URL | 60 | //图片URL |
| 59 | public static String IMGURL = "imgurl"; | 61 | public static String IMGURL = "imgurl"; |
| 60 | //版本名称 | 62 | //版本名称 |
| 61 | public static String VERSION = "version"; | 63 | public static String VERSION = "version"; |
| 64 | //版本信息接口返回值 | ||
| 65 | public static String VERSIONINTEFACE = "versioninterface"; | ||
| 62 | 66 | ||
| 63 | 67 | ||
| 64 | public void saveLoginParam(Context context,String spname, String spstr) { | 68 | public void saveLoginParam(Context context,String spname, String spstr) { |
| 65 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 69 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 66 | Activity.MODE_PRIVATE); | 70 | Activity.MODE_PRIVATE); |
| 67 | 71 | ||
| 68 | sp.edit().putString(spname, spstr).commit(); | 72 | sp.edit().putString(spname, spstr).commit(); |
| 69 | } | 73 | } |
| 70 | 74 | ||
| 71 | 75 | ||
| 72 | public String getLoginParam(Context context,String spname) { | 76 | public String getLoginParam(Context context,String spname) { |
| 73 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 77 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 74 | Activity.MODE_PRIVATE); | 78 | Activity.MODE_PRIVATE); |
| 75 | String param = sp.getString(spname, null); | 79 | String param = sp.getString(spname, null); |
| 76 | return param; | 80 | return param; |
| 77 | } | 81 | } |
| 78 | public void clearData(Context context) { | 82 | public void clearData(Context context) { |
| 79 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 83 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 80 | Activity.MODE_PRIVATE); | 84 | Activity.MODE_PRIVATE); |
| 81 | sp.edit().clear().commit(); | 85 | sp.edit().clear().commit(); |
| 82 | } | 86 | } |
| 83 | 87 | ||
| 84 | public void saveCustomizeParam(Context context,String spname, String spstr) { | 88 | public void saveCustomizeParam(Context context,String spname, String spstr) { |
| 85 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 89 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 86 | Activity.MODE_PRIVATE); | 90 | Activity.MODE_PRIVATE); |
| 87 | 91 | ||
| 88 | sp.edit().putString(spname, spstr).commit(); | 92 | sp.edit().putString(spname, spstr).commit(); |
| 89 | 93 | ||
| 90 | } | 94 | } |
| 91 | 95 | ||
| 92 | public String getCustomizeParam(Context context,String spname) { | 96 | public String getCustomizeParam(Context context,String spname) { |
| 93 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 97 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 94 | Activity.MODE_PRIVATE); | 98 | Activity.MODE_PRIVATE); |
| 95 | String param = sp.getString(spname, null); | 99 | String param = sp.getString(spname, null); |
| 96 | return param; | 100 | return param; |
| 97 | } | 101 | } |
| 98 | 102 | ||
| 99 | public void clearCustomizeParam(Context context ){ | 103 | public void clearCustomizeParam(Context context ){ |
| 100 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 104 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 101 | Activity.MODE_PRIVATE); | 105 | Activity.MODE_PRIVATE); |
| 102 | sp.edit().clear().commit(); | 106 | sp.edit().clear().commit(); |
| 103 | } | 107 | } |
| 104 | public void saveCityParam(Context context,String spname, String spstr) { | 108 | public void saveCityParam(Context context,String spname, String spstr) { |
| 105 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 109 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
| 106 | Activity.MODE_PRIVATE); | 110 | Activity.MODE_PRIVATE); |
| 107 | 111 | ||
| 108 | sp.edit().putString(spname, spstr).commit(); | 112 | sp.edit().putString(spname, spstr).commit(); |
| 109 | 113 | ||
| 110 | } | 114 | } |
| 111 | 115 | ||
| 112 | public String getsaveCityParam(Context context,String spname) { | 116 | public String getsaveCityParam(Context context,String spname) { |
| 113 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 117 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
| 114 | Activity.MODE_PRIVATE); | 118 | Activity.MODE_PRIVATE); |
| 115 | String param = sp.getString(spname, null); | 119 | String param = sp.getString(spname, null); |
| 116 | return param; | 120 | return param; |
| 117 | } | 121 | } |
| 118 | 122 | ||
| 119 | public void clearsaveCityParam(Context context ){ | 123 | public void clearsaveCityParam(Context context ){ |
| 120 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 124 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
| 121 | Activity.MODE_PRIVATE); | 125 | Activity.MODE_PRIVATE); |
| 122 | sp.edit().clear().commit(); | 126 | sp.edit().clear().commit(); |
| 123 | } | 127 | } |
| 124 | } | 128 | } |
| 125 | 129 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
| 1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | ||
| 3 | import android.graphics.Color; | 4 | import android.graphics.Color; |
| 4 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 5 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 6 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
| 7 | import android.support.v4.view.ViewPager; | 8 | import android.support.v4.view.ViewPager; |
| 8 | import android.util.Log; | 9 | import android.util.Log; |
| 9 | import android.view.Gravity; | 10 | import android.view.Gravity; |
| 10 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
| 11 | import android.view.View; | 12 | import android.view.View; |
| 12 | import android.view.ViewGroup; | 13 | import android.view.ViewGroup; |
| 13 | import android.widget.AdapterView; | 14 | import android.widget.AdapterView; |
| 14 | import android.widget.EditText; | 15 | import android.widget.EditText; |
| 15 | import android.widget.ImageView; | 16 | import android.widget.ImageView; |
| 16 | import android.widget.LinearLayout; | 17 | import android.widget.LinearLayout; |
| 17 | import android.widget.TextView; | 18 | import android.widget.TextView; |
| 18 | 19 | ||
| 19 | import com.bigkoo.pickerview.TimePickerView; | 20 | import com.bigkoo.pickerview.TimePickerView; |
| 20 | import com.hjx.personalcenter.R; | 21 | import com.hjx.personalcenter.R; |
| 21 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; | 22 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; |
| 22 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 23 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
| 23 | import com.hjx.personalcenter.customdialog.CountryDialog; | 24 | import com.hjx.personalcenter.customdialog.CountryDialog; |
| 24 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 25 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
| 25 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 26 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 26 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 27 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
| 27 | import com.hjx.personalcenter.db.Content; | 28 | import com.hjx.personalcenter.db.Content; |
| 28 | import com.hjx.personalcenter.db.SaveParam; | 29 | import com.hjx.personalcenter.db.SaveParam; |
| 29 | import com.hjx.personalcenter.http.HttpManager; | 30 | import com.hjx.personalcenter.http.HttpManager; |
| 30 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 31 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 31 | import com.hjx.personalcenter.model.CityInfo; | 32 | import com.hjx.personalcenter.model.CityInfo; |
| 32 | import com.hjx.personalcenter.model.CountyInfo; | 33 | import com.hjx.personalcenter.model.CountyInfo; |
| 33 | import com.hjx.personalcenter.model.GradeInfo; | 34 | import com.hjx.personalcenter.model.GradeInfo; |
| 34 | import com.hjx.personalcenter.model.ProvinceInfo; | 35 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 35 | import com.hjx.personalcenter.model.SchoolInfo; | 36 | import com.hjx.personalcenter.model.SchoolInfo; |
| 36 | import com.hjx.personalcenter.util.AlertUtils; | 37 | import com.hjx.personalcenter.util.AlertUtils; |
| 37 | import com.hjx.personalcenter.util.GetDevicesUtil; | 38 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 38 | import com.mylhyl.circledialog.CircleDialog; | 39 | import com.mylhyl.circledialog.CircleDialog; |
| 39 | import com.mylhyl.circledialog.callback.ConfigDialog; | 40 | import com.mylhyl.circledialog.callback.ConfigDialog; |
| 40 | import com.mylhyl.circledialog.params.DialogParams; | 41 | import com.mylhyl.circledialog.params.DialogParams; |
| 41 | 42 | ||
| 42 | import org.apache.http.util.TextUtils; | 43 | import org.apache.http.util.TextUtils; |
| 43 | 44 | ||
| 44 | import java.text.SimpleDateFormat; | 45 | import java.text.SimpleDateFormat; |
| 45 | import java.util.ArrayList; | 46 | import java.util.ArrayList; |
| 46 | import java.util.Date; | 47 | import java.util.Date; |
| 47 | 48 | ||
| 48 | /** | 49 | /** |
| 49 | * Created by h on 2017/8/12. | 50 | * Created by h on 2017/8/12. |
| 50 | */ | 51 | */ |
| 51 | 52 | ||
| 52 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 53 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
| 53 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 54 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
| 54 | private View mView; | 55 | private View mView; |
| 55 | private int type; | 56 | private int type; |
| 56 | private TimePickerView pvTime; | 57 | private TimePickerView pvTime; |
| 57 | private LinearLayout tv_version; | 58 | private LinearLayout tv_version; |
| 58 | 59 | ||
| 59 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; | 60 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
| 60 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender, sub; | 61 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender, sub; |
| 61 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; | 62 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; |
| 62 | private ImageView my_adress, my_sex, my_bthday, my_grade, my_school, ccancel; | 63 | private ImageView my_adress, my_sex, my_bthday, my_grade, my_school, ccancel; |
| 63 | 64 | ||
| 64 | 65 | ||
| 65 | public static PresonInfoFragment newInstance(int type) { | 66 | public static PresonInfoFragment newInstance(int type) { |
| 66 | PresonInfoFragment fragment = new PresonInfoFragment(); | 67 | PresonInfoFragment fragment = new PresonInfoFragment(); |
| 67 | Bundle bundle = new Bundle(); | 68 | Bundle bundle = new Bundle(); |
| 68 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 69 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
| 69 | fragment.setArguments(bundle); | 70 | fragment.setArguments(bundle); |
| 70 | return fragment; | 71 | return fragment; |
| 71 | 72 | ||
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | @Override | 75 | @Override |
| 75 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 76 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 76 | if (mView == null) { | 77 | if (mView == null) { |
| 77 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 78 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
| 78 | Content.changeinfoflag = false; | 79 | Content.changeinfoflag = false; |
| 79 | initView(mView); | 80 | initView(mView); |
| 80 | initData(); | 81 | initData(); |
| 81 | setLister(); | 82 | setLister(); |
| 82 | initTimePicker(); | 83 | initTimePicker(); |
| 83 | 84 | ||
| 84 | 85 | ||
| 85 | } | 86 | } |
| 86 | return mView; | 87 | return mView; |
| 87 | } | 88 | } |
| 88 | 89 | ||
| 89 | //初始化 | 90 | //初始化 |
| 90 | private void initView(View mView) { | 91 | private void initView(View mView) { |
| 91 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 92 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
| 92 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 93 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
| 93 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 94 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
| 94 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 95 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
| 95 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 96 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
| 96 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 97 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
| 97 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 98 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
| 98 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 99 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
| 99 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); | 100 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); |
| 100 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); | 101 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); |
| 101 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); | 102 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); |
| 102 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); | 103 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); |
| 103 | my_school = (ImageView) mView.findViewById(R.id.my_school); | 104 | my_school = (ImageView) mView.findViewById(R.id.my_school); |
| 104 | sub = (TextView) mView.findViewById(R.id.presonal_sub); | 105 | sub = (TextView) mView.findViewById(R.id.presonal_sub); |
| 105 | ccancel = (ImageView) mView.findViewById(R.id.cancel); | 106 | ccancel = (ImageView) mView.findViewById(R.id.cancel); |
| 106 | tv_version = (LinearLayout) mView.findViewById(R.id.tv_version); | 107 | tv_version = (LinearLayout) mView.findViewById(R.id.tv_version); |
| 107 | 108 | ||
| 108 | 109 | ||
| 109 | } | 110 | } |
| 110 | 111 | ||
| 111 | private void initData() { | 112 | private void initData() { |
| 112 | //初始化个人信息 | 113 | //初始化个人信息 |
| 113 | String name = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTUSERNAME); | 114 | String name = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTUSERNAME); |
| 114 | String adress1 = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTADRESS); | 115 | String adress1 = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTADRESS); |
| 115 | String adress2 = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTXINGZUO); | 116 | String adress2 = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTXINGZUO); |
| 116 | String sex = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTSEX); | 117 | String sex = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTSEX); |
| 117 | String bithday = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTCONSTELLATION); | 118 | String bithday = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTCONSTELLATION); |
| 118 | String qq = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTQQ); | 119 | String qq = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTQQ); |
| 119 | String grader = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTGRADES); | 120 | String grader = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTGRADES); |
| 120 | String school = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTSCHOOL); | 121 | String school = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTSCHOOL); |
| 121 | tv_username1.setText(name); | 122 | tv_username1.setText(name); |
| 122 | tv_useinfo_qq.setText(qq); | 123 | tv_useinfo_qq.setText(qq); |
| 123 | tv_sex.setText(sex); | 124 | tv_sex.setText(sex); |
| 124 | tv_useinfo_birthday.setText(bithday); | 125 | tv_useinfo_birthday.setText(bithday); |
| 125 | tv_useinfo_gender.setText(grader); | 126 | tv_useinfo_gender.setText(grader); |
| 126 | tv_useinfo_school.setText(school); | 127 | tv_useinfo_school.setText(school); |
| 127 | tv_useinfo_adress1.setText(adress2); | 128 | tv_useinfo_adress1.setText(adress2); |
| 128 | tv_useinfo_adress.setText(adress1); | 129 | tv_useinfo_adress.setText(adress1); |
| 129 | 130 | ||
| 130 | 131 | ||
| 131 | 132 | ||
| 132 | 133 | ||
| 133 | } | 134 | } |
| 134 | 135 | ||
| 135 | private void setLister() { | 136 | private void setLister() { |
| 136 | tv_sex.setOnClickListener(this); | 137 | tv_sex.setOnClickListener(this); |
| 137 | tv_useinfo_adress.setOnClickListener(this); | 138 | tv_useinfo_adress.setOnClickListener(this); |
| 138 | tv_useinfo_birthday.setOnClickListener(this); | 139 | tv_useinfo_birthday.setOnClickListener(this); |
| 139 | tv_useinfo_school.setOnClickListener(this); | 140 | tv_useinfo_school.setOnClickListener(this); |
| 140 | tv_useinfo_gender.setOnClickListener(this); | 141 | tv_useinfo_gender.setOnClickListener(this); |
| 141 | my_adress.setOnClickListener(this); | 142 | my_adress.setOnClickListener(this); |
| 142 | my_sex.setOnClickListener(this); | 143 | my_sex.setOnClickListener(this); |
| 143 | my_bthday.setOnClickListener(this); | 144 | my_bthday.setOnClickListener(this); |
| 144 | my_grade.setOnClickListener(this); | 145 | my_grade.setOnClickListener(this); |
| 145 | my_school.setOnClickListener(this); | 146 | my_school.setOnClickListener(this); |
| 146 | sub.setOnClickListener(this); | 147 | sub.setOnClickListener(this); |
| 147 | tv_version.setOnClickListener(this); | 148 | tv_version.setOnClickListener(this); |
| 148 | ccancel.setOnClickListener(this); | 149 | ccancel.setOnClickListener(this); |
| 149 | } | 150 | } |
| 150 | 151 | ||
| 151 | @Override | 152 | @Override |
| 152 | public void onClick(View v) { | 153 | public void onClick(View v) { |
| 153 | String presonal1 = tv_username1.getText().toString().trim(); | 154 | String presonal1 = tv_username1.getText().toString().trim(); |
| 154 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | 155 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); |
| 155 | String presonal3 = tv_sex.getText().toString().trim(); | 156 | String presonal3 = tv_sex.getText().toString().trim(); |
| 156 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | 157 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); |
| 157 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | 158 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); |
| 158 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | 159 | String presonal6 = tv_useinfo_school.getText().toString().trim(); |
| 159 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | 160 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); |
| 160 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | 161 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); |
| 161 | switch (v.getId()) { | 162 | switch (v.getId()) { |
| 162 | case R.id.tv_sex: | 163 | case R.id.tv_sex: |
| 163 | case R.id.my_sex: | 164 | case R.id.my_sex: |
| 164 | final String[] items = {"男", "女"}; | 165 | final String[] items = {"男", "女"}; |
| 165 | new CircleDialog.Builder(getActivity()) | 166 | new CircleDialog.Builder(getActivity()) |
| 166 | .configDialog(new ConfigDialog() { | 167 | .configDialog(new ConfigDialog() { |
| 167 | @Override | 168 | @Override |
| 168 | public void onConfig(DialogParams params) { | 169 | public void onConfig(DialogParams params) { |
| 169 | //增加弹出动画 | 170 | //增加弹出动画 |
| 170 | params.gravity = Gravity.CENTER; | 171 | params.gravity = Gravity.CENTER; |
| 171 | } | 172 | } |
| 172 | }) | 173 | }) |
| 173 | .setTitle("请选择性别") | 174 | .setTitle("请选择性别") |
| 174 | .setWidth(0.5f) | 175 | .setWidth(0.5f) |
| 175 | .setItems(items, new AdapterView.OnItemClickListener() { | 176 | .setItems(items, new AdapterView.OnItemClickListener() { |
| 176 | @Override | 177 | @Override |
| 177 | public void onItemClick(AdapterView<?> parent, View view, int | 178 | public void onItemClick(AdapterView<?> parent, View view, int |
| 178 | position, long id) { | 179 | position, long id) { |
| 179 | switch (position) { | 180 | switch (position) { |
| 180 | case 0: | 181 | case 0: |
| 181 | tv_sex.setText("男"); | 182 | tv_sex.setText("男"); |
| 182 | break; | 183 | break; |
| 183 | case 1: | 184 | case 1: |
| 184 | tv_sex.setText("女"); | 185 | tv_sex.setText("女"); |
| 185 | break; | 186 | break; |
| 186 | } | 187 | } |
| 187 | 188 | ||
| 188 | } | 189 | } |
| 189 | }) | 190 | }) |
| 190 | .show(); | 191 | .show(); |
| 191 | break; | 192 | break; |
| 192 | case R.id.tv_useinfo_adress: | 193 | case R.id.tv_useinfo_adress: |
| 193 | case R.id.my_adress: | 194 | case R.id.my_adress: |
| 194 | tv_useinfo_school.setText(""); | 195 | tv_useinfo_school.setText(""); |
| 195 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); | 196 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
| 196 | break; | 197 | break; |
| 197 | case R.id.tv_useinfo_birthday: | 198 | case R.id.tv_useinfo_birthday: |
| 198 | case R.id.my_bthday: | 199 | case R.id.my_bthday: |
| 199 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 200 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
| 200 | break; | 201 | break; |
| 201 | case R.id.tv_useinfo_school: | 202 | case R.id.tv_useinfo_school: |
| 202 | case R.id.my_school: | 203 | case R.id.my_school: |
| 203 | if (TextUtils.isEmpty(presonal4) || | 204 | if (TextUtils.isEmpty(presonal4) || |
| 204 | TextUtils.isEmpty(presonal7)) { | 205 | TextUtils.isEmpty(presonal7)) { |
| 205 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | 206 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); |
| 206 | return; | 207 | return; |
| 207 | } else { | 208 | } else { |
| 208 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | 209 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); |
| 209 | } | 210 | } |
| 210 | 211 | ||
| 211 | 212 | ||
| 212 | break; | 213 | break; |
| 213 | case R.id.tv_useinfo_gender: | 214 | case R.id.tv_useinfo_gender: |
| 214 | case R.id.my_grade: | 215 | case R.id.my_grade: |
| 215 | tv_useinfo_school.setText(""); | 216 | tv_useinfo_school.setText(""); |
| 216 | Content.changeinfoflag = true; | 217 | Content.changeinfoflag = true; |
| 217 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); | 218 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
| 218 | break; | 219 | break; |
| 219 | case R.id.cancel: | 220 | case R.id.cancel: |
| 220 | getActivity().finish(); | 221 | getActivity().finish(); |
| 221 | break; | 222 | break; |
| 222 | case R.id.tv_version: | 223 | case R.id.tv_version: |
| 223 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); | 224 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); |
| 224 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { | 225 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { |
| 225 | @Override | 226 | @Override |
| 226 | public void gotoFragment(ViewPager viewPager) { | 227 | public void gotoFragment(ViewPager viewPager) { |
| 227 | //fragment传递数据 | 228 | //fragment传递数据 |
| 228 | viewPager.setCurrentItem(1); | 229 | viewPager.setCurrentItem(1); |
| 229 | } | 230 | } |
| 230 | }); | 231 | }); |
| 231 | mainActivity.forSkip(); | 232 | mainActivity.forSkip(); |
| 232 | break; | 233 | break; |
| 233 | case R.id.presonal_sub: | 234 | case R.id.presonal_sub: |
| 234 | Log.e("test", "你提交个人信息"); | 235 | Log.e("test", "你提交个人信息"); |
| 235 | if (TextUtils.isEmpty(presonal1) || | 236 | if (TextUtils.isEmpty(presonal1) || |
| 236 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || | 237 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || |
| 237 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || | 238 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || |
| 238 | TextUtils.isEmpty(presonal8)) { | 239 | TextUtils.isEmpty(presonal8)) { |
| 239 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); | 240 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
| 240 | return; | 241 | return; |
| 241 | } else { | 242 | } else { |
| 242 | int a = 0, b = 0; | 243 | int a = 0, b = 0; |
| 243 | int d = 1; | 244 | int d = 1,gradeold =0; |
| 244 | Object schoolids; | 245 | Object schoolids; |
| 245 | Long f = null; | 246 | Long f = null; |
| 246 | String regionId = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.COUNTRY); | 247 | String regionId2 = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.COUNTRY); |
| 247 | String regionId1 = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); | 248 | String regionId1 = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); |
| 248 | if (regionId == null) { | 249 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.ADRESSID); |
| 249 | regionId = regionId1; | 250 | if (regionId == null ) { |
| 251 | if (regionId1!=null){ | ||
| 252 | regionId = regionId1; | ||
| 253 | }else { | ||
| 254 | regionId = regionId2; | ||
| 255 | } | ||
| 256 | |||
| 250 | } | 257 | } |
| 251 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CHILDSGRADENS); | 258 | String gradeolds = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
| 259 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | ||
| 252 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | 260 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); |
| 253 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 261 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
| 254 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 262 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
| 263 | String childsID = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSID); | ||
| 264 | |||
| 255 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | 265 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); |
| 256 | String changeinfo = null; | 266 | String changeinfo = null; |
| 257 | if ("男".equals(presonal3)) { | 267 | if ("男".equals(presonal3)) { |
| 258 | changeinfo = "male"; | 268 | changeinfo = "male"; |
| 259 | } else { | 269 | } else { |
| 260 | changeinfo = "female"; | 270 | changeinfo = "female"; |
| 261 | } | 271 | } |
| 262 | try { | 272 | try { |
| 263 | a = Integer.parseInt(regionId); | 273 | a = Integer.parseInt(regionId); |
| 264 | b = Integer.parseInt(grade); | 274 | b = Integer.parseInt(grade); |
| 275 | gradeold = Integer.parseInt(gradeolds); | ||
| 276 | if ((gradeold<8&&b>=8)||((gradeold>8&&b<=8))){ | ||
| 277 | Intent intentbroad = new Intent(); | ||
| 278 | intentbroad.putExtra("info","小学"); | ||
| 279 | //4、定义广播发送的action | ||
| 280 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | ||
| 281 | //5、发送广播 | ||
| 282 | getActivity().sendBroadcast(intentbroad); | ||
| 283 | Log.i("---", "发送完了"); | ||
| 284 | } | ||
| 265 | if (TextUtils.isEmpty(presonal6)) { | 285 | if (TextUtils.isEmpty(presonal6)) { |
| 266 | schoolids = null; | 286 | schoolids = null; |
| 267 | } else { | 287 | } else { |
| 268 | schoolids = Long.parseLong(schoolid); | 288 | schoolids = Long.parseLong(schoolid); |
| 269 | } | 289 | } |
| 270 | d = Integer.parseInt(type); | 290 | d = Integer.parseInt(type); |
| 271 | f = Long.parseLong(userID); | 291 | if (d==2){ |
| 292 | f = Long.parseLong(childsID); | ||
| 293 | |||
| 294 | }else{ | ||
| 295 | f = Long.parseLong(userID); | ||
| 296 | } | ||
| 297 | |||
| 298 | |||
| 272 | //提交个人信息 | 299 | //提交个人信息 |
| 273 | HttpManager.getInstance().changepresonalinfo(getActivity(), | 300 | HttpManager.getInstance().changepresonalinfo(getActivity(), |
| 274 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 ,presonal2,devicenumber); | 301 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 ,presonal2,devicenumber); |
| 275 | 302 | ||
| 276 | } catch (Exception e) { | 303 | } catch (Exception e) { |
| 277 | e.printStackTrace(); | 304 | e.printStackTrace(); |
| 278 | } | 305 | } |
| 279 | 306 | ||
| 280 | break; | 307 | break; |
| 281 | 308 | ||
| 282 | } | 309 | } |
| 283 | } | 310 | } |
| 284 | } | 311 | } |
| 285 | 312 | ||
| 286 | //自定义时间选择器 | 313 | //自定义时间选择器 |
| 287 | private void initTimePicker() { | 314 | private void initTimePicker() { |
| 288 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 315 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
| 289 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 316 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
| 290 | // Calendar selectedDate = Calendar.getInstance(); | 317 | // Calendar selectedDate = Calendar.getInstance(); |
| 291 | // Calendar startDate = Calendar.getInstance(); | 318 | // Calendar startDate = Calendar.getInstance(); |
| 292 | // startDate.set(1900, 1, 1); | 319 | // startDate.set(1900, 1, 1); |
| 293 | // Calendar endDate = Calendar.getInstance(); | 320 | // Calendar endDate = Calendar.getInstance(); |
| 294 | // endDate.set(2100, 1, 1); | 321 | // endDate.set(2100, 1, 1); |
| 295 | //时间选择器 | 322 | //时间选择器 |
| 296 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 323 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
| 297 | @Override | 324 | @Override |
| 298 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 325 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
| 299 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 326 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
| 300 | /*btn_Time.setText(getTime(date));*/ | 327 | /*btn_Time.setText(getTime(date));*/ |
| 301 | TextView btn = (TextView) v; | 328 | TextView btn = (TextView) v; |
| 302 | btn.setText(getTime(date)); | 329 | btn.setText(getTime(date)); |
| 303 | } | 330 | } |
| 304 | }) | 331 | }) |
| 305 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 332 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
| 306 | .setType(new boolean[]{true, true, true, false, false, false}) | 333 | .setType(new boolean[]{true, true, true, false, false, false}) |
| 307 | .setLabel("", "", "", "", "", "") | 334 | .setLabel("", "", "", "", "", "") |
| 308 | .isCenterLabel(false) | 335 | .isCenterLabel(false) |
| 309 | .setDividerColor(Color.DKGRAY) | 336 | .setDividerColor(Color.DKGRAY) |
| 310 | .setContentSize(21) | 337 | .setContentSize(21) |
| 311 | // .setDate(selectedDate) | 338 | // .setDate(selectedDate) |
| 312 | // .setRangDate(startDate, endDate) | 339 | // .setRangDate(startDate, endDate) |
| 313 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 340 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
| 314 | .setDecorView(null) | 341 | .setDecorView(null) |
| 315 | .setTitleText("出生日期") | 342 | .setTitleText("出生日期") |
| 316 | .setTitleSize(22) | 343 | .setTitleSize(22) |
| 317 | .setCancelColor(Color.GRAY) | 344 | .setCancelColor(Color.GRAY) |
| 318 | .setSubCalSize(22) | 345 | .setSubCalSize(22) |
| 319 | .setDividerColor(Color.GRAY) | 346 | .setDividerColor(Color.GRAY) |
| 320 | .setSubmitColor(Color.GRAY) | 347 | .setSubmitColor(Color.GRAY) |
| 321 | .build(); | 348 | .build(); |
| 322 | } | 349 | } |
| 323 | 350 | ||
| 324 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 351 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
| 325 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 352 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| 326 | return format.format(date); | 353 | return format.format(date); |
| 327 | } | 354 | } |
| 328 | 355 | ||
| 329 | @Override | 356 | @Override |
| 330 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 357 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
| 331 | String regionName = data.get(position).getRegionName(); | 358 | String regionName = data.get(position).getRegionName(); |
| 332 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 359 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
| 333 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | 360 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); |
| 334 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | 361 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); |
| 335 | tv_useinfo_adress.setText(""); | 362 | tv_useinfo_adress.setText(""); |
| 336 | tv_useinfo_adress.setText(provice + regionName); | 363 | tv_useinfo_adress.setText(provice + regionName); |
| 337 | 364 | ||
| 338 | 365 | ||
| 339 | } | 366 | } |
| 340 | 367 | ||
| 341 | @Override | 368 | @Override |
| 342 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 369 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
| 343 | String regionName = data.get(position).getRegionName(); | 370 | String regionName = data.get(position).getRegionName(); |
| 344 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 371 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
| 345 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); | 372 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); |
| 346 | tv_useinfo_adress.setText(""); | 373 | tv_useinfo_adress.setText(""); |
| 347 | tv_useinfo_adress.setText(provices + citys + regionName); | 374 | tv_useinfo_adress.setText(provices + citys + regionName); |
| 348 | 375 | ||
| 349 | } | 376 | } |
| 350 | 377 | ||
| 351 | @Override | 378 | @Override |
| 352 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 379 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
| 353 | String regionName = data.get(position).getName(); | 380 | String regionName = data.get(position).getName(); |
| 354 | tv_useinfo_gender.setText(regionName); | 381 | tv_useinfo_gender.setText(regionName); |
| 355 | } | 382 | } |
| 356 | 383 | ||
| 357 | @Override | 384 | @Override |
| 358 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 385 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
| 359 | String regionName = data.get(position).getRegionName(); | 386 | String regionName = data.get(position).getRegionName(); |
| 360 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); | 387 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); |
| 361 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); | 388 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); |
| 362 | tv_useinfo_adress.setText(""); | 389 | tv_useinfo_adress.setText(""); |
| 363 | tv_useinfo_adress.setText(regionName); | 390 | tv_useinfo_adress.setText(regionName); |
| 364 | } | 391 | } |
| 365 | 392 | ||
| 366 | @Override | 393 | @Override |
| 367 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 394 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
| 368 | String regionName = data.get(position).getSchoolName(); | 395 | String regionName = data.get(position).getSchoolName(); |
| 369 | tv_useinfo_school.setText(regionName); | 396 | tv_useinfo_school.setText(regionName); |
| 370 | 397 | ||
| 371 | 398 | ||
| 372 | } | 399 | } |
| 373 | } | 400 | } |
| 374 | 401 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
| 1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.app.ProgressDialog; | 4 | import android.app.ProgressDialog; |
| 5 | import android.content.Context; | 5 | import android.content.Context; |
| 6 | import android.content.Intent; | 6 | import android.content.Intent; |
| 7 | import android.os.Handler; | 7 | import android.os.Handler; |
| 8 | import android.os.Message; | 8 | import android.os.Message; |
| 9 | import android.util.Log; | 9 | import android.util.Log; |
| 10 | import android.view.KeyEvent; | 10 | import android.view.KeyEvent; |
| 11 | import android.widget.Toast; | 11 | import android.widget.Toast; |
| 12 | 12 | ||
| 13 | import com.google.gson.Gson; | 13 | import com.google.gson.Gson; |
| 14 | import com.google.gson.reflect.TypeToken; | 14 | import com.google.gson.reflect.TypeToken; |
| 15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
| 16 | import com.hjx.personalcenter.activity.BangDingCode; | 16 | import com.hjx.personalcenter.activity.BangDingCode; |
| 17 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 17 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
| 18 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 18 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
| 19 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
| 20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
| 21 | import com.hjx.personalcenter.gson.GsonTool; | 21 | import com.hjx.personalcenter.gson.GsonTool; |
| 22 | import com.hjx.personalcenter.model.AppVersion; | 22 | import com.hjx.personalcenter.model.AppVersion; |
| 23 | import com.hjx.personalcenter.model.CardInfo; | 23 | import com.hjx.personalcenter.model.CardInfo; |
| 24 | import com.hjx.personalcenter.model.ChildsInfo; | 24 | import com.hjx.personalcenter.model.ChildsInfo; |
| 25 | import com.hjx.personalcenter.model.CityInfo; | 25 | import com.hjx.personalcenter.model.CityInfo; |
| 26 | import com.hjx.personalcenter.model.CountyInfo; | 26 | import com.hjx.personalcenter.model.CountyInfo; |
| 27 | import com.hjx.personalcenter.model.DefautPublishInfo; | 27 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 28 | import com.hjx.personalcenter.model.GradeInfo; | 28 | import com.hjx.personalcenter.model.GradeInfo; |
| 29 | import com.hjx.personalcenter.model.PesonalInfo; | 29 | import com.hjx.personalcenter.model.PesonalInfo; |
| 30 | import com.hjx.personalcenter.model.ProvinceInfo; | 30 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 31 | import com.hjx.personalcenter.model.SchoolInfo; | 31 | import com.hjx.personalcenter.model.SchoolInfo; |
| 32 | import com.hjx.personalcenter.model.SignInfo; | 32 | import com.hjx.personalcenter.model.SignInfo; |
| 33 | import com.hjx.personalcenter.model.VersionInfo; | 33 | import com.hjx.personalcenter.model.VersionInfo; |
| 34 | import com.hjx.personalcenter.model.VideoInfo; | 34 | import com.hjx.personalcenter.model.VideoInfo; |
| 35 | import com.hjx.personalcenter.util.AlertUtils; | 35 | import com.hjx.personalcenter.util.AlertUtils; |
| 36 | import com.hjx.personalcenter.util.DialogPermission; | 36 | import com.hjx.personalcenter.util.DialogPermission; |
| 37 | import com.loopj.android.http.AsyncHttpResponseHandler; | 37 | import com.loopj.android.http.AsyncHttpResponseHandler; |
| 38 | import com.loopj.android.http.JsonHttpResponseHandler; | 38 | import com.loopj.android.http.JsonHttpResponseHandler; |
| 39 | import com.loopj.android.http.RequestParams; | 39 | import com.loopj.android.http.RequestParams; |
| 40 | 40 | ||
| 41 | import org.apache.http.Header; | 41 | import org.apache.http.Header; |
| 42 | import org.apache.http.entity.ByteArrayEntity; | 42 | import org.apache.http.entity.ByteArrayEntity; |
| 43 | import org.apache.http.message.BasicHeader; | 43 | import org.apache.http.message.BasicHeader; |
| 44 | import org.apache.http.protocol.HTTP; | 44 | import org.apache.http.protocol.HTTP; |
| 45 | import org.json.JSONException; | 45 | import org.json.JSONException; |
| 46 | import org.json.JSONObject; | 46 | import org.json.JSONObject; |
| 47 | 47 | ||
| 48 | import java.io.File; | 48 | import java.io.File; |
| 49 | import java.io.FileNotFoundException; | 49 | import java.io.FileNotFoundException; |
| 50 | import java.io.UnsupportedEncodingException; | 50 | import java.io.UnsupportedEncodingException; |
| 51 | import java.util.ArrayList; | 51 | import java.util.ArrayList; |
| 52 | import java.util.List; | 52 | import java.util.List; |
| 53 | 53 | ||
| 54 | public class HttpManager { | 54 | public class HttpManager { |
| 55 | private static HttpManager instance; | 55 | private static HttpManager instance; |
| 56 | private ProgressDialog mProgress = null; | 56 | private ProgressDialog mProgress = null; |
| 57 | 57 | ||
| 58 | public static HttpManager getInstance() { | 58 | public static HttpManager getInstance() { |
| 59 | if (instance == null) { | 59 | if (instance == null) { |
| 60 | instance = new HttpManager(); | 60 | instance = new HttpManager(); |
| 61 | } | 61 | } |
| 62 | return instance; | 62 | return instance; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | //登录接口 | 66 | //登录接口 |
| 67 | 67 | ||
| 68 | public void login(final String username, final String password, final Context mContext, final Handler handler) { | 68 | public void login(final String username, final String password, final Context mContext, final Handler handler) { |
| 69 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 69 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
| 70 | true, true, null); | 70 | true, true, null); |
| 71 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 71 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 72 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 72 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
| 73 | @Override | 73 | @Override |
| 74 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 74 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 75 | closeProgress(); | 75 | closeProgress(); |
| 76 | Message msg = Message.obtain(); | 76 | Message msg = Message.obtain(); |
| 77 | msg.what = HttpCode.LOGIN_SUCESS; | 77 | msg.what = HttpCode.LOGIN_SUCESS; |
| 78 | msg.obj = new String(arg2); | 78 | msg.obj = new String(arg2); |
| 79 | handler.sendMessage(msg); | 79 | handler.sendMessage(msg); |
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | @Override | 84 | @Override |
| 85 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 85 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 86 | closeProgress(); | 86 | closeProgress(); |
| 87 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 87 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 88 | } | 88 | } |
| 89 | }); | 89 | }); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | //注册接口 | 92 | //注册接口 |
| 93 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 93 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
| 94 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 94 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
| 95 | false, true, null); | 95 | false, true, null); |
| 96 | JSONObject jsonObject = new JSONObject(); | 96 | JSONObject jsonObject = new JSONObject(); |
| 97 | ByteArrayEntity entity = null; | 97 | ByteArrayEntity entity = null; |
| 98 | try { | 98 | try { |
| 99 | jsonObject.put(HttpKey.USERNAME, username); | 99 | jsonObject.put(HttpKey.USERNAME, username); |
| 100 | jsonObject.put(HttpKey.PASSWORD, password); | 100 | jsonObject.put(HttpKey.PASSWORD, password); |
| 101 | jsonObject.put(HttpKey.SMSCODE, smscode); | 101 | jsonObject.put(HttpKey.SMSCODE, smscode); |
| 102 | jsonObject.put(HttpKey.SOURCE, source); | 102 | jsonObject.put(HttpKey.SOURCE, source); |
| 103 | Log.e("test", "jsonObject" + jsonObject); | 103 | Log.e("test", "jsonObject" + jsonObject); |
| 104 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 104 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
| 105 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 105 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
| 106 | } catch (JSONException e) { | 106 | } catch (JSONException e) { |
| 107 | e.printStackTrace(); | 107 | e.printStackTrace(); |
| 108 | } catch (UnsupportedEncodingException e) { | 108 | } catch (UnsupportedEncodingException e) { |
| 109 | e.printStackTrace(); | 109 | e.printStackTrace(); |
| 110 | } | 110 | } |
| 111 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 111 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 112 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 112 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
| 113 | @Override | 113 | @Override |
| 114 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 114 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 115 | super.onSuccess(statusCode, headers, response); | 115 | super.onSuccess(statusCode, headers, response); |
| 116 | closeProgress(); | 116 | closeProgress(); |
| 117 | Log.e("test", "onSuccess" + response); | 117 | Log.e("test", "onSuccess" + response); |
| 118 | Message msg = Message.obtain(); | 118 | Message msg = Message.obtain(); |
| 119 | msg.what = HttpCode.REGISTERED_SUCESS; | 119 | msg.what = HttpCode.REGISTERED_SUCESS; |
| 120 | msg.obj = response; | 120 | msg.obj = response; |
| 121 | handler.sendMessage(msg); | 121 | handler.sendMessage(msg); |
| 122 | 122 | ||
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | @Override | 125 | @Override |
| 126 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 126 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 127 | super.onFailure(statusCode, headers, throwable, errorResponse); | 127 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 128 | closeProgress(); | 128 | closeProgress(); |
| 129 | Log.e("test", "onFailure" + errorResponse); | 129 | Log.e("test", "onFailure" + errorResponse); |
| 130 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 130 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | }); | 133 | }); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | //注册验证码 | 136 | //注册验证码 |
| 137 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 137 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
| 138 | RequestParams params = new RequestParams(); | 138 | RequestParams params = new RequestParams(); |
| 139 | params.put(HttpKey.TYPE, type); | 139 | params.put(HttpKey.TYPE, type); |
| 140 | params.put(HttpKey.MOBIL, mobile); | 140 | params.put(HttpKey.MOBIL, mobile); |
| 141 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 141 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 142 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 142 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
| 143 | 143 | ||
| 144 | @Override | 144 | @Override |
| 145 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 145 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 146 | Log.e("test", "onSuccess-----" + response); | 146 | Log.e("test", "onSuccess-----" + response); |
| 147 | Message msg = Message.obtain(); | 147 | Message msg = Message.obtain(); |
| 148 | msg.what = HttpCode.AUTHCODE_SUCESS; | 148 | msg.what = HttpCode.AUTHCODE_SUCESS; |
| 149 | msg.obj = response; | 149 | msg.obj = response; |
| 150 | handler.sendMessage(msg); | 150 | handler.sendMessage(msg); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | @Override | 153 | @Override |
| 154 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 154 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 155 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 155 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 156 | } | 156 | } |
| 157 | }); | 157 | }); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | 160 | ||
| 161 | //手机号是否注册 | 161 | //手机号是否注册 |
| 162 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 162 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
| 163 | RequestParams params = new RequestParams(); | 163 | RequestParams params = new RequestParams(); |
| 164 | params.put(HttpKey.USERNAME, mobile); | 164 | params.put(HttpKey.USERNAME, mobile); |
| 165 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 165 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
| 166 | @Override | 166 | @Override |
| 167 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 167 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 168 | Log.e("test", "isregistered" + response.toString()); | 168 | Log.e("test", "isregistered" + response.toString()); |
| 169 | Message msg = Message.obtain(); | 169 | Message msg = Message.obtain(); |
| 170 | msg.what = HttpCode.IS_REFISTER; | 170 | msg.what = HttpCode.IS_REFISTER; |
| 171 | msg.obj = response; | 171 | msg.obj = response; |
| 172 | handler.sendMessage(msg); | 172 | handler.sendMessage(msg); |
| 173 | 173 | ||
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | @Override | 176 | @Override |
| 177 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 177 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 178 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 178 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 179 | 179 | ||
| 180 | } | 180 | } |
| 181 | }); | 181 | }); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | //修改密码 | 184 | //修改密码 |
| 185 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 185 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
| 186 | mProgress = DialogPermission.showProgress(context, null, "正在修改密码...", | 186 | mProgress = DialogPermission.showProgress(context, null, "正在修改密码...", |
| 187 | false, true, null); | 187 | false, true, null); |
| 188 | RequestParams params = new RequestParams(); | 188 | RequestParams params = new RequestParams(); |
| 189 | params.put(HttpKey.USERNAME, username); | 189 | params.put(HttpKey.USERNAME, username); |
| 190 | params.put(HttpKey.OLDPASS, old_pwd1); | 190 | params.put(HttpKey.OLDPASS, old_pwd1); |
| 191 | params.put(HttpKey.NEWPASS, newpassword3); | 191 | params.put(HttpKey.NEWPASS, newpassword3); |
| 192 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 192 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 193 | HttpClient.getInstance().setTimeout(10 * 1000); | 193 | HttpClient.getInstance().setTimeout(10 * 1000); |
| 194 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 194 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
| 195 | @Override | 195 | @Override |
| 196 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 196 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 197 | closeProgress(); | 197 | closeProgress(); |
| 198 | try { | 198 | try { |
| 199 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 199 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 200 | String status = jsonObject.optString("status"); | 200 | String status = jsonObject.optString("status"); |
| 201 | if (status.equals("100")) { | 201 | if (status.equals("100")) { |
| 202 | Log.e("test", "onSuccess" + new String(bytes)); | 202 | Log.e("test", "onSuccess" + new String(bytes)); |
| 203 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 203 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 204 | SaveParam.getInstance().clearData((Activity) context); | 204 | SaveParam.getInstance().clearData((Activity) context); |
| 205 | Intent intent = new Intent(); | 205 | Intent intent = new Intent(); |
| 206 | intent.setClass(context, LoginAndRegisterActivity.class); | 206 | intent.setClass(context, LoginAndRegisterActivity.class); |
| 207 | ((Activity) context).startActivity(intent); | 207 | ((Activity) context).startActivity(intent); |
| 208 | ((Activity) context).finish(); | 208 | ((Activity) context).finish(); |
| 209 | } else { | 209 | } else { |
| 210 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 210 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
| 211 | } | 211 | } |
| 212 | } catch (JSONException e) { | 212 | } catch (JSONException e) { |
| 213 | e.printStackTrace(); | 213 | e.printStackTrace(); |
| 214 | } | 214 | } |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | @Override | 217 | @Override |
| 218 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 218 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 219 | closeProgress(); | 219 | closeProgress(); |
| 220 | Log.e("test", "onFailure" + new String(bytes)); | 220 | Log.e("test", "onFailure" + new String(bytes)); |
| 221 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 221 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 222 | } | 222 | } |
| 223 | }); | 223 | }); |
| 224 | 224 | ||
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | //忘记密码 | 227 | //忘记密码 |
| 228 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 228 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
| 229 | RequestParams params = new RequestParams(); | 229 | RequestParams params = new RequestParams(); |
| 230 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 230 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
| 231 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 231 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
| 232 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 232 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
| 233 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 233 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 234 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 234 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
| 235 | @Override | 235 | @Override |
| 236 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 236 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 237 | try { | 237 | try { |
| 238 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 238 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 239 | String status = jsonObject.optString("status"); | 239 | String status = jsonObject.optString("status"); |
| 240 | if (status.equals("100")) { | 240 | if (status.equals("100")) { |
| 241 | Log.e("test", "onSuccess" + new String(bytes)); | 241 | Log.e("test", "onSuccess" + new String(bytes)); |
| 242 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 242 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 243 | ((Activity) context).finish(); | 243 | ((Activity) context).finish(); |
| 244 | } else { | 244 | } else { |
| 245 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 245 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
| 246 | } | 246 | } |
| 247 | } catch (JSONException e) { | 247 | } catch (JSONException e) { |
| 248 | e.printStackTrace(); | 248 | e.printStackTrace(); |
| 249 | } | 249 | } |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | @Override | 252 | @Override |
| 253 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 253 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 254 | Log.e("test", "onFailure" + new String(bytes)); | 254 | Log.e("test", "onFailure" + new String(bytes)); |
| 255 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 255 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 256 | } | 256 | } |
| 257 | }); | 257 | }); |
| 258 | 258 | ||
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | //保存用户登录信息 | 261 | //保存用户登录信息 |
| 262 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { | 262 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { |
| 263 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 263 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
| 264 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 264 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
| 265 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 265 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
| 266 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 266 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
| 267 | 267 | ||
| 268 | 268 | ||
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | //提交保卡信息 | 271 | //提交保卡信息 |
| 272 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 272 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
| 273 | String buyAddress, String buyTime, String alterSaleCall, | 273 | String buyAddress, String buyTime, String alterSaleCall, |
| 274 | String productModel, String deviceNumber, String macAddress, | 274 | String productModel, String deviceNumber, String macAddress, |
| 275 | String mobilePhone) { | 275 | String mobilePhone) { |
| 276 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 276 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
| 277 | false, true, null); | 277 | false, true, null); |
| 278 | RequestParams params = new RequestParams(); | 278 | RequestParams params = new RequestParams(); |
| 279 | 279 | ||
| 280 | params.put(HttpKey.USEID, userId); | 280 | params.put(HttpKey.USEID, userId); |
| 281 | params.put(HttpKey.CUSTOMENAME, customerName); | 281 | params.put(HttpKey.CUSTOMENAME, customerName); |
| 282 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 282 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
| 283 | params.put(HttpKey.BUYADREES, buyAddress); | 283 | params.put(HttpKey.BUYADREES, buyAddress); |
| 284 | params.put(HttpKey.BUYTIME, buyTime); | 284 | params.put(HttpKey.BUYTIME, buyTime); |
| 285 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 285 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
| 286 | params.put(HttpKey.PRODUCTMODEL, productModel); | 286 | params.put(HttpKey.PRODUCTMODEL, productModel); |
| 287 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 287 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
| 288 | params.put(HttpKey.MACADRESS, macAddress); | 288 | params.put(HttpKey.MACADRESS, macAddress); |
| 289 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 289 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
| 290 | 290 | ||
| 291 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 291 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 292 | 292 | ||
| 293 | Log.e("test", "params" + params); | 293 | Log.e("test", "params" + params); |
| 294 | HttpClient.getInstance().setTimeout(5 * 1000); | 294 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 295 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 295 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
| 296 | @Override | 296 | @Override |
| 297 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 297 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 298 | JSONObject jsonObject = null; | 298 | JSONObject jsonObject = null; |
| 299 | closeProgress(); | 299 | closeProgress(); |
| 300 | try { | 300 | try { |
| 301 | jsonObject = new JSONObject(new String(bytes)); | 301 | jsonObject = new JSONObject(new String(bytes)); |
| 302 | String status = jsonObject.optString("status"); | 302 | String status = jsonObject.optString("status"); |
| 303 | if (status.equals("1")) { | 303 | if (status.equals("1")) { |
| 304 | Log.e("test", "onSuccess" + jsonObject); | 304 | Log.e("test", "onSuccess" + jsonObject); |
| 305 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 305 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
| 306 | if (Content.cardintentflag == 1) { | 306 | if (Content.cardintentflag == 1) { |
| 307 | Intent intent = new Intent(); | 307 | Intent intent = new Intent(); |
| 308 | intent.setClass((Activity) context, TheStartPageActivity.class); | 308 | intent.setClass((Activity) context, TheStartPageActivity.class); |
| 309 | ((Activity) context).startActivity(intent); | 309 | ((Activity) context).startActivity(intent); |
| 310 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 310 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 311 | ((Activity) context).finish(); | 311 | ((Activity) context).finish(); |
| 312 | } else if (Content.cardintentflag == 2) { | 312 | } else if (Content.cardintentflag == 2) { |
| 313 | Intent intent = new Intent(); | 313 | Intent intent = new Intent(); |
| 314 | intent.setClass((Activity) context, BangDingCode.class); | 314 | intent.setClass((Activity) context, BangDingCode.class); |
| 315 | ((Activity) context).startActivity(intent); | 315 | ((Activity) context).startActivity(intent); |
| 316 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 316 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 317 | ((Activity) context).finish(); | 317 | ((Activity) context).finish(); |
| 318 | 318 | ||
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | 321 | ||
| 322 | } else { | 322 | } else { |
| 323 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 323 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
| 324 | } | 324 | } |
| 325 | } catch (JSONException e) { | 325 | } catch (JSONException e) { |
| 326 | e.printStackTrace(); | 326 | e.printStackTrace(); |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | 329 | ||
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | @Override | 332 | @Override |
| 333 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 333 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 334 | Log.e("test", "onFailure" + (throwable)); | 334 | Log.e("test", "onFailure" + (throwable)); |
| 335 | closeProgress(); | 335 | closeProgress(); |
| 336 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 336 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 337 | 337 | ||
| 338 | } | 338 | } |
| 339 | }); | 339 | }); |
| 340 | 340 | ||
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | //获取保卡信息 | 343 | //获取保卡信息 |
| 344 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { | 344 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { |
| 345 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 345 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
| 346 | false, true, null); | 346 | false, true, null); |
| 347 | HttpClient.getInstance().setTimeout(5 * 1000); | 347 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 348 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 348 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 349 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 349 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 350 | @Override | 350 | @Override |
| 351 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 351 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 352 | closeProgress(); | 352 | closeProgress(); |
| 353 | Log.e("test", "保卡信息" + new String(arg2)); | 353 | Log.e("test", "保卡信息" + new String(arg2)); |
| 354 | try { | 354 | try { |
| 355 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 355 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 356 | int status = jsonObject.optInt("status"); | 356 | int status = jsonObject.optInt("status"); |
| 357 | if (status == 1) { | 357 | if (status == 1) { |
| 358 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 358 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
| 359 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 359 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
| 360 | Message msg = Message.obtain(); | 360 | Message msg = Message.obtain(); |
| 361 | msg.what = HttpCode.SUCHCARDINFO; | 361 | msg.what = HttpCode.SUCHCARDINFO; |
| 362 | msg.obj = schoolInfoBeanList; | 362 | msg.obj = schoolInfoBeanList; |
| 363 | handler.sendMessage(msg); | 363 | handler.sendMessage(msg); |
| 364 | 364 | ||
| 365 | 365 | ||
| 366 | } else { | 366 | } else { |
| 367 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 367 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 368 | 368 | ||
| 369 | } | 369 | } |
| 370 | } catch (JSONException e) { | 370 | } catch (JSONException e) { |
| 371 | e.printStackTrace(); | 371 | e.printStackTrace(); |
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | @Override | 376 | @Override |
| 377 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 377 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 378 | closeProgress(); | 378 | closeProgress(); |
| 379 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 379 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 380 | } | 380 | } |
| 381 | }); | 381 | }); |
| 382 | } | 382 | } |
| 383 | 383 | ||
| 384 | //获取是否为样机信息 | 384 | //获取是否为样机信息 |
| 385 | public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { | 385 | public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { |
| 386 | HttpClient.getInstance().setTimeout(5 * 1000); | 386 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 387 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 387 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 388 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 388 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 389 | @Override | 389 | @Override |
| 390 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 390 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 391 | closeProgress(); | 391 | closeProgress(); |
| 392 | Log.e("test", "保卡信息" + new String(arg2)); | 392 | Log.e("test", "保卡信息" + new String(arg2)); |
| 393 | Message msg = Message.obtain(); | 393 | Message msg = Message.obtain(); |
| 394 | msg.what = HttpCode.SUCHCARDINFOONE; | 394 | msg.what = HttpCode.SUCHCARDINFOONE; |
| 395 | msg.obj = new String(arg2); | 395 | msg.obj = new String(arg2); |
| 396 | handler.sendMessage(msg); | 396 | handler.sendMessage(msg); |
| 397 | 397 | ||
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | @Override | 400 | @Override |
| 401 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 401 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 402 | closeProgress(); | 402 | closeProgress(); |
| 403 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 403 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 404 | } | 404 | } |
| 405 | }); | 405 | }); |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | //修改账户电话 | 408 | //修改账户电话 |
| 409 | public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { | 409 | public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { |
| 410 | RequestParams params = new RequestParams(); | 410 | RequestParams params = new RequestParams(); |
| 411 | params.put("userId", userId); | 411 | params.put("userId", userId); |
| 412 | params.put("username", username); | 412 | params.put("username", username); |
| 413 | params.put("authCode", authCode); | 413 | params.put("authCode", authCode); |
| 414 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 414 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 415 | HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { | 415 | HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { |
| 416 | @Override | 416 | @Override |
| 417 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 417 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 418 | try { | 418 | try { |
| 419 | Log.e("test", "保卡信息" + new String(bytes)); | 419 | Log.e("test", "保卡信息" + new String(bytes)); |
| 420 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 420 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 421 | String status = jsonObject.optString("status"); | 421 | String status = jsonObject.optString("status"); |
| 422 | if (status.equals("1")) { | 422 | if (status.equals("1")) { |
| 423 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 423 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 424 | SaveParam.getInstance().saveLoginParam(mContext, "username", username); | 424 | SaveParam.getInstance().saveLoginParam(mContext, "username", username); |
| 425 | ((Activity) mContext).finish(); | 425 | ((Activity) mContext).finish(); |
| 426 | } else if (status.equals("1001")) { | 426 | } else if (status.equals("1001")) { |
| 427 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 427 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 428 | } | 428 | } |
| 429 | else if (status.equals("1006")) { | 429 | else if (status.equals("1006")) { |
| 430 | AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); | 430 | AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); |
| 431 | } else { | 431 | } else { |
| 432 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 432 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 433 | } | 433 | } |
| 434 | } catch (JSONException e) { | 434 | } catch (JSONException e) { |
| 435 | e.printStackTrace(); | 435 | e.printStackTrace(); |
| 436 | } | 436 | } |
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | @Override | 439 | @Override |
| 440 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 440 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 441 | Log.e("test", "onFailure" + new String(bytes)); | 441 | Log.e("test", "onFailure" + new String(bytes)); |
| 442 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 442 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 443 | } | 443 | } |
| 444 | }); | 444 | }); |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | //修改保卡信息电话 | 447 | //修改保卡信息电话 |
| 448 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { | 448 | public void changecardinfophone(final Context mContext, String userId, final String customerPhone, String authCode) { |
| 449 | RequestParams params = new RequestParams(); | 449 | RequestParams params = new RequestParams(); |
| 450 | params.put("userId", userId); | 450 | params.put("userId", userId); |
| 451 | params.put("customerPhone", customerPhone); | 451 | params.put("customerPhone", customerPhone); |
| 452 | params.put("authCode", authCode); | 452 | params.put("authCode", authCode); |
| 453 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 453 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 454 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 454 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 455 | @Override | 455 | @Override |
| 456 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 456 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 457 | try { | 457 | try { |
| 458 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 458 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 459 | String status = jsonObject.optString("status"); | 459 | String status = jsonObject.optString("status"); |
| 460 | if (status.equals("1")) { | 460 | if (status.equals("1")) { |
| 461 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 461 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 462 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 462 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
| 463 | ((Activity) mContext).finish(); | 463 | ((Activity) mContext).finish(); |
| 464 | } else if (status.equals("1001")) { | 464 | } else if (status.equals("1001")) { |
| 465 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 465 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 466 | } else { | 466 | } else { |
| 467 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 467 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 468 | } | 468 | } |
| 469 | } catch (JSONException e) { | 469 | } catch (JSONException e) { |
| 470 | e.printStackTrace(); | 470 | e.printStackTrace(); |
| 471 | } | 471 | } |
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | @Override | 474 | @Override |
| 475 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 475 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 476 | Log.e("test", "onFailure" + new String(bytes)); | 476 | Log.e("test", "onFailure" + new String(bytes)); |
| 477 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 477 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 478 | } | 478 | } |
| 479 | }); | 479 | }); |
| 480 | } | 480 | } |
| 481 | 481 | ||
| 482 | //修改保卡信息地址 | 482 | //修改保卡信息地址 |
| 483 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { | 483 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { |
| 484 | RequestParams params = new RequestParams(); | 484 | RequestParams params = new RequestParams(); |
| 485 | params.put("userId", userId); | 485 | params.put("userId", userId); |
| 486 | params.put("customerPhone", customerPhone); | 486 | params.put("customerPhone", customerPhone); |
| 487 | params.put("authCode", authCode); | 487 | params.put("authCode", authCode); |
| 488 | params.put("customerAddress", customerAddress); | 488 | params.put("customerAddress", customerAddress); |
| 489 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 489 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 490 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 490 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 491 | @Override | 491 | @Override |
| 492 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 492 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 493 | try { | 493 | try { |
| 494 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 494 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 495 | String status = jsonObject.optString("status"); | 495 | String status = jsonObject.optString("status"); |
| 496 | if (status.equals("1")) { | 496 | if (status.equals("1")) { |
| 497 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); | 497 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); |
| 498 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 498 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
| 499 | ((Activity) mContext).finish(); | 499 | ((Activity) mContext).finish(); |
| 500 | } else { | 500 | } else { |
| 501 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 501 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 502 | } | 502 | } |
| 503 | } catch (JSONException e) { | 503 | } catch (JSONException e) { |
| 504 | e.printStackTrace(); | 504 | e.printStackTrace(); |
| 505 | } | 505 | } |
| 506 | } | 506 | } |
| 507 | 507 | ||
| 508 | @Override | 508 | @Override |
| 509 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 509 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 510 | Log.e("test", "onFailure" + new String(bytes)); | 510 | Log.e("test", "onFailure" + new String(bytes)); |
| 511 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 511 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 512 | } | 512 | } |
| 513 | }); | 513 | }); |
| 514 | } | 514 | } |
| 515 | 515 | ||
| 516 | //验证是否保卡信息 | 516 | //验证是否保卡信息 |
| 517 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { | 517 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { |
| 518 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 518 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
| 519 | false, true, null); | 519 | false, true, null); |
| 520 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 520 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 521 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 521 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 522 | @Override | 522 | @Override |
| 523 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 523 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 524 | Log.e("test", "验证保卡" + new String(arg2)); | 524 | Log.e("test", "验证保卡" + new String(arg2)); |
| 525 | closeProgress(); | 525 | closeProgress(); |
| 526 | Message msg = Message.obtain(); | 526 | Message msg = Message.obtain(); |
| 527 | msg.what = HttpCode.CHECKCARD; | 527 | msg.what = HttpCode.CHECKCARD; |
| 528 | msg.obj = new String(arg2); | 528 | msg.obj = new String(arg2); |
| 529 | handler.sendMessage(msg); | 529 | handler.sendMessage(msg); |
| 530 | 530 | ||
| 531 | 531 | ||
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | @Override | 534 | @Override |
| 535 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 535 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 536 | closeProgress(); | 536 | closeProgress(); |
| 537 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 537 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 538 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 538 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
| 539 | } | 539 | } |
| 540 | }); | 540 | }); |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | ///获取年级 | 543 | ///获取年级 |
| 544 | public void getgrade(final Context mContext, final Handler handler) { | 544 | public void getgrade(final Context mContext, final Handler handler) { |
| 545 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 545 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 546 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 546 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
| 547 | @Override | 547 | @Override |
| 548 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 548 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 549 | Log.e("test", "年级" + new String(arg2)); | 549 | Log.e("test", "年级" + new String(arg2)); |
| 550 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 550 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
| 551 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 551 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
| 552 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 552 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
| 553 | String name = gradeInfo.getData().get(i).getName(); | 553 | String name = gradeInfo.getData().get(i).getName(); |
| 554 | int id = gradeInfo.getData().get(i).getId(); | 554 | int id = gradeInfo.getData().get(i).getId(); |
| 555 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 555 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
| 556 | for (int j = 0; j < gradeinfoList.size(); j++) { | 556 | for (int j = 0; j < gradeinfoList.size(); j++) { |
| 557 | String secondname = gradeinfoList.get(j).getName(); | 557 | String secondname = gradeinfoList.get(j).getName(); |
| 558 | int secondid = gradeinfoList.get(j).getId(); | 558 | int secondid = gradeinfoList.get(j).getId(); |
| 559 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 559 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
| 560 | dataBean.setName(secondname); | 560 | dataBean.setName(secondname); |
| 561 | dataBean.setId(secondid); | 561 | dataBean.setId(secondid); |
| 562 | gradeInfoLists.add(dataBean); | 562 | gradeInfoLists.add(dataBean); |
| 563 | } | 563 | } |
| 564 | 564 | ||
| 565 | } | 565 | } |
| 566 | 566 | ||
| 567 | Message message = Message.obtain(); | 567 | Message message = Message.obtain(); |
| 568 | message.what = HttpCode.GRADER; | 568 | message.what = HttpCode.GRADER; |
| 569 | message.obj = gradeInfoLists; | 569 | message.obj = gradeInfoLists; |
| 570 | handler.sendMessage(message); | 570 | handler.sendMessage(message); |
| 571 | 571 | ||
| 572 | 572 | ||
| 573 | } | 573 | } |
| 574 | 574 | ||
| 575 | @Override | 575 | @Override |
| 576 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 576 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 577 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 577 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 578 | } | 578 | } |
| 579 | }); | 579 | }); |
| 580 | } | 580 | } |
| 581 | 581 | ||
| 582 | /** | 582 | /** |
| 583 | * 获取学校 | 583 | * 获取学校 |
| 584 | * | 584 | * |
| 585 | * @param mContext | 585 | * @param mContext |
| 586 | * @param regionId | 586 | * @param regionId |
| 587 | * @param gradeId | 587 | * @param gradeId |
| 588 | * @param handler | 588 | * @param handler |
| 589 | */ | 589 | */ |
| 590 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 590 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
| 591 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 591 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 592 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 592 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
| 593 | @Override | 593 | @Override |
| 594 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 594 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 595 | Log.e("test", "学校" + new String(arg2)); | 595 | Log.e("test", "学校" + new String(arg2)); |
| 596 | try { | 596 | try { |
| 597 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 597 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 598 | int status = jsonObject.optInt("status"); | 598 | int status = jsonObject.optInt("status"); |
| 599 | if (status == 1) { | 599 | if (status == 1) { |
| 600 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 600 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
| 601 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 601 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
| 602 | Message message = Message.obtain(); | 602 | Message message = Message.obtain(); |
| 603 | message.what = HttpCode.SCHOOL; | 603 | message.what = HttpCode.SCHOOL; |
| 604 | message.obj = schoolInfoBeanList; | 604 | message.obj = schoolInfoBeanList; |
| 605 | handler.sendMessage(message); | 605 | handler.sendMessage(message); |
| 606 | 606 | ||
| 607 | 607 | ||
| 608 | } else { | 608 | } else { |
| 609 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 609 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 610 | 610 | ||
| 611 | } | 611 | } |
| 612 | } catch (JSONException e) { | 612 | } catch (JSONException e) { |
| 613 | e.printStackTrace(); | 613 | e.printStackTrace(); |
| 614 | } | 614 | } |
| 615 | 615 | ||
| 616 | } | 616 | } |
| 617 | 617 | ||
| 618 | @Override | 618 | @Override |
| 619 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 619 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 620 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 620 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 621 | } | 621 | } |
| 622 | }); | 622 | }); |
| 623 | } | 623 | } |
| 624 | 624 | ||
| 625 | 625 | ||
| 626 | /** | 626 | /** |
| 627 | * 获取个人信息 | 627 | * 获取个人信息 |
| 628 | * | 628 | * |
| 629 | * @param mContext | 629 | * @param mContext |
| 630 | * @param userId | 630 | * @param userId |
| 631 | * @param handler | 631 | * @param handler |
| 632 | */ | 632 | */ |
| 633 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { | 633 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
| 634 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 634 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
| 635 | // false, true, null); | 635 | // false, true, null); |
| 636 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 636 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 637 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 637 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
| 638 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 638 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 639 | @Override | 639 | @Override |
| 640 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 640 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 641 | closeProgress(); | 641 | closeProgress(); |
| 642 | Log.e("test", "个人信息" + new String(arg2)); | 642 | Log.e("test", "个人信息" + new String(arg2)); |
| 643 | try { | 643 | try { |
| 644 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 644 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 645 | int status = jsonObject.optInt("status"); | 645 | int status = jsonObject.optInt("status"); |
| 646 | if (status == 1) { | 646 | if (status == 1) { |
| 647 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 647 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
| 648 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 648 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
| 649 | Message message = Message.obtain(); | 649 | Message message = Message.obtain(); |
| 650 | message.what = HttpCode.GETINFO; | 650 | message.what = HttpCode.GETINFO; |
| 651 | message.obj = pesonalInfoBeanList; | 651 | message.obj = pesonalInfoBeanList; |
| 652 | handler.sendMessage(message); | 652 | handler.sendMessage(message); |
| 653 | 653 | ||
| 654 | 654 | ||
| 655 | } else { | 655 | } else { |
| 656 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 656 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 657 | 657 | ||
| 658 | } | 658 | } |
| 659 | } catch (JSONException e) { | 659 | } catch (JSONException e) { |
| 660 | e.printStackTrace(); | 660 | e.printStackTrace(); |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | 663 | ||
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | @Override | 666 | @Override |
| 667 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 667 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 668 | closeProgress(); | 668 | closeProgress(); |
| 669 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 669 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 670 | } | 670 | } |
| 671 | }); | 671 | }); |
| 672 | } | 672 | } |
| 673 | 673 | ||
| 674 | //修改个人信息 | 674 | //修改个人信息 |
| 675 | public void changepresonalinfo(final Context mContext, Long id, int type | 675 | public void changepresonalinfo(final Context mContext, Long id, int type |
| 676 | , String name, String birthday, int gradeId, long regionId, | 676 | , String name, String birthday, int gradeId, long regionId, |
| 677 | Object schoolId, String qq, String gender | 677 | Object schoolId, String qq, String gender |
| 678 | , String regionName,String address, String devicenumber) throws UnsupportedEncodingException { | 678 | , String regionName,String address, String devicenumber) throws UnsupportedEncodingException { |
| 679 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 679 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
| 680 | false, true, null); | 680 | false, true, null); |
| 681 | RequestParams params = new RequestParams(); | 681 | RequestParams params = new RequestParams(); |
| 682 | 682 | ||
| 683 | params.put(HttpKey.USEID, id); | 683 | params.put(HttpKey.USEID, id); |
| 684 | params.put(HttpKey.TYPE, type); | 684 | params.put(HttpKey.TYPE, type); |
| 685 | params.put(HttpKey.NAME, name); | 685 | params.put(HttpKey.NAME, name); |
| 686 | params.put(HttpKey.BIRDays, birthday); | 686 | params.put(HttpKey.BIRDays, birthday); |
| 687 | params.put(HttpKey.GRADE, gradeId); | 687 | params.put(HttpKey.GRADE, gradeId); |
| 688 | params.put(HttpKey.REGION, regionId); | 688 | params.put(HttpKey.REGION, regionId); |
| 689 | params.put(HttpKey.SCHOOL, schoolId); | 689 | params.put(HttpKey.SCHOOL, schoolId); |
| 690 | params.put(HttpKey.QQ, qq); | 690 | params.put(HttpKey.QQ, qq); |
| 691 | params.put(HttpKey.GENDER, gender); | 691 | params.put(HttpKey.GENDER, gender); |
| 692 | params.put(HttpKey.REGIONNAME, regionName); | 692 | params.put(HttpKey.REGIONNAME, regionName); |
| 693 | params.put(HttpKey.ADDDRESS, address); | 693 | params.put(HttpKey.ADDDRESS, address); |
| 694 | params.put(HttpKey.DEVINUMBER, devicenumber); | 694 | params.put(HttpKey.DEVINUMBER, devicenumber); |
| 695 | Log.e("test", "个人信息" + params); | 695 | Log.e("test", "个人信息" + params); |
| 696 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 696 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 697 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { | 697 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { |
| 698 | @Override | 698 | @Override |
| 699 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 699 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 700 | super.onSuccess(statusCode, headers, response); | 700 | super.onSuccess(statusCode, headers, response); |
| 701 | closeProgress(); | 701 | closeProgress(); |
| 702 | String status = response.optString("status"); | 702 | String status = response.optString("status"); |
| 703 | if (status.equals("1")) { | 703 | if (status.equals("1")) { |
| 704 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 704 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
| 705 | ((Activity) mContext).finish(); | 705 | ((Activity) mContext).finish(); |
| 706 | } else { | 706 | } else { |
| 707 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 707 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 708 | } | 708 | } |
| 709 | 709 | ||
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | @Override | 712 | @Override |
| 713 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 713 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 714 | super.onFailure(statusCode, headers, throwable, errorResponse); | 714 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 715 | closeProgress(); | 715 | closeProgress(); |
| 716 | Log.e("test", "onFailure" + errorResponse); | 716 | Log.e("test", "onFailure" + errorResponse); |
| 717 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 717 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | }); | 720 | }); |
| 721 | } | 721 | } |
| 722 | 722 | ||
| 723 | //提交注册信息 | 723 | //提交注册信息 |
| 724 | public void subregisterinfo(final Context mContext, Long userId | 724 | public void subregisterinfo(final Context mContext, Long userId |
| 725 | , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese, | 725 | , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese, |
| 726 | String math, String english, String physics, String chemistry, | 726 | String math, String english, String physics, String chemistry, |
| 727 | String history, String geography, String political, String biology, String science, final Handler handler) { | 727 | String history, String geography, String political, String biology, String science, final Handler handler) { |
| 728 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 728 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
| 729 | false, true, null); | 729 | false, true, null); |
| 730 | RequestParams params = new RequestParams(); | 730 | RequestParams params = new RequestParams(); |
| 731 | 731 | ||
| 732 | params.put(HttpKey.USEID, userId); | 732 | params.put(HttpKey.USEID, userId); |
| 733 | params.put(HttpKey.NAME, name); | 733 | params.put(HttpKey.NAME, name); |
| 734 | params.put(HttpKey.GRADE, gradeId); | 734 | params.put(HttpKey.GRADE, gradeId); |
| 735 | params.put(HttpKey.REGION, regionId); | 735 | params.put(HttpKey.REGION, regionId); |
| 736 | params.put(HttpKey.SCHOOL, schoolId); | 736 | params.put(HttpKey.SCHOOL, schoolId); |
| 737 | params.put(HttpKey.REGIONNAME, regionName); | 737 | params.put(HttpKey.REGIONNAME, regionName); |
| 738 | params.put(HttpKey.MATH, math); | 738 | params.put(HttpKey.MATH, math); |
| 739 | params.put(HttpKey.ENGLISH, english); | 739 | params.put(HttpKey.ENGLISH, english); |
| 740 | params.put(HttpKey.CHINESE, chinese); | 740 | params.put(HttpKey.CHINESE, chinese); |
| 741 | params.put(HttpKey.PHYSICES, physics); | 741 | params.put(HttpKey.PHYSICES, physics); |
| 742 | params.put(HttpKey.CHEMISTRY, chemistry); | 742 | params.put(HttpKey.CHEMISTRY, chemistry); |
| 743 | params.put(HttpKey.HISTIRY, history); | 743 | params.put(HttpKey.HISTIRY, history); |
| 744 | params.put(HttpKey.GEOGRAPHY, geography); | 744 | params.put(HttpKey.GEOGRAPHY, geography); |
| 745 | params.put(HttpKey.POLITICAL, political); | 745 | params.put(HttpKey.POLITICAL, political); |
| 746 | params.put(HttpKey.BIOLOGY, biology); | 746 | params.put(HttpKey.BIOLOGY, biology); |
| 747 | params.put(HttpKey.SCIENCE, science); | 747 | params.put(HttpKey.SCIENCE, science); |
| 748 | 748 | ||
| 749 | Log.e("test", "注册信息" + params); | 749 | Log.e("test", "注册信息" + params); |
| 750 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 750 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 751 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { | 751 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { |
| 752 | @Override | 752 | @Override |
| 753 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 753 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 754 | super.onSuccess(statusCode, headers, response); | 754 | super.onSuccess(statusCode, headers, response); |
| 755 | closeProgress(); | 755 | closeProgress(); |
| 756 | Message message = Message.obtain(); | 756 | Message message = Message.obtain(); |
| 757 | message.what = HttpCode.REGISTERINFO_SUCESS; | 757 | message.what = HttpCode.REGISTERINFO_SUCESS; |
| 758 | message.obj = new String(String.valueOf(response)); | 758 | message.obj = new String(String.valueOf(response)); |
| 759 | handler.sendMessage(message); | 759 | handler.sendMessage(message); |
| 760 | 760 | ||
| 761 | } | 761 | } |
| 762 | 762 | ||
| 763 | @Override | 763 | @Override |
| 764 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 764 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 765 | super.onFailure(statusCode, headers, throwable, errorResponse); | 765 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 766 | closeProgress(); | 766 | closeProgress(); |
| 767 | Log.e("test", "onFailure" + errorResponse); | 767 | Log.e("test", "onFailure" + errorResponse); |
| 768 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 768 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 769 | } | 769 | } |
| 770 | 770 | ||
| 771 | }); | 771 | }); |
| 772 | } | 772 | } |
| 773 | 773 | ||
| 774 | //修改版本信息 | 774 | //修改版本信息 |
| 775 | public void changepublishinfo(final Context mContext, String userId, String chinese, | 775 | public void changepublishinfo(final Context mContext, String userId, String chinese, |
| 776 | String math, String english, String physics, String chemistry, | 776 | String math, String english, String physics, String chemistry, |
| 777 | String history, String geography, String political, String biology, String science) { | 777 | String history, String geography, String political, String biology, String science) { |
| 778 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 778 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存版本信息...", |
| 779 | false, true, null); | 779 | false, true, null); |
| 780 | RequestParams params = new RequestParams(); | 780 | RequestParams params = new RequestParams(); |
| 781 | params.put(HttpKey.USEID, userId); | 781 | params.put(HttpKey.USEID, userId); |
| 782 | params.put(HttpKey.CHINESE, chinese); | 782 | params.put(HttpKey.CHINESE, chinese); |
| 783 | params.put(HttpKey.MATH, math); | 783 | params.put(HttpKey.MATH, math); |
| 784 | params.put(HttpKey.ENGLISH, english); | 784 | params.put(HttpKey.ENGLISH, english); |
| 785 | params.put(HttpKey.PHYSICES, physics); | 785 | params.put(HttpKey.PHYSICES, physics); |
| 786 | params.put(HttpKey.CHEMISTRY, chemistry); | 786 | params.put(HttpKey.CHEMISTRY, chemistry); |
| 787 | params.put(HttpKey.HISTIRY, history); | 787 | params.put(HttpKey.HISTIRY, history); |
| 788 | params.put(HttpKey.GEOGRAPHY, geography); | 788 | params.put(HttpKey.GEOGRAPHY, geography); |
| 789 | params.put(HttpKey.POLITICAL, political); | 789 | params.put(HttpKey.POLITICAL, political); |
| 790 | params.put(HttpKey.BIOLOGY, biology); | 790 | params.put(HttpKey.BIOLOGY, biology); |
| 791 | params.put(HttpKey.SCIENCE, science); | 791 | params.put(HttpKey.SCIENCE, science); |
| 792 | 792 | ||
| 793 | Log.e("test", "版本信息信息" + params); | 793 | Log.e("test", "版本信息信息" + params); |
| 794 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 794 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 795 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { | 795 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { |
| 796 | @Override | 796 | @Override |
| 797 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 797 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 798 | super.onSuccess(statusCode, headers, response); | 798 | super.onSuccess(statusCode, headers, response); |
| 799 | closeProgress(); | 799 | closeProgress(); |
| 800 | String status = response.optString("status"); | 800 | String status = response.optString("status"); |
| 801 | if (status.equals("1")) { | 801 | if (status.equals("1")) { |
| 802 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); | 802 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); |
| 803 | ((Activity) mContext).finish(); | 803 | ((Activity) mContext).finish(); |
| 804 | } else { | 804 | } else { |
| 805 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 805 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 806 | } | 806 | } |
| 807 | 807 | ||
| 808 | } | 808 | } |
| 809 | 809 | ||
| 810 | @Override | 810 | @Override |
| 811 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 811 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 812 | super.onFailure(statusCode, headers, throwable, errorResponse); | 812 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 813 | closeProgress(); | 813 | closeProgress(); |
| 814 | Log.e("test", "onFailure" + errorResponse); | 814 | Log.e("test", "onFailure" + errorResponse); |
| 815 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 815 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 816 | } | 816 | } |
| 817 | 817 | ||
| 818 | }); | 818 | }); |
| 819 | } | 819 | } |
| 820 | 820 | ||
| 821 | //修改个性签名 | 821 | //修改个性签名 |
| 822 | public void changsignature(final Context mContext, long userId, int type, final String signature) { | 822 | public void changsignature(final Context mContext, long userId, int type, final String signature) { |
| 823 | RequestParams params = new RequestParams(); | 823 | RequestParams params = new RequestParams(); |
| 824 | params.put("userId", userId); | 824 | params.put("userId", userId); |
| 825 | params.put("type", type); | 825 | params.put("type", type); |
| 826 | params.put("signature", signature); | 826 | params.put("signature", signature); |
| 827 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 827 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 828 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 828 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
| 829 | @Override | 829 | @Override |
| 830 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 830 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 831 | try { | 831 | try { |
| 832 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 832 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 833 | String status = jsonObject.optString("status"); | 833 | String status = jsonObject.optString("status"); |
| 834 | if (status.equals("1")) { | 834 | if (status.equals("1")) { |
| 835 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 835 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
| 836 | } else { | 836 | } else { |
| 837 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 837 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 838 | } | 838 | } |
| 839 | } catch (JSONException e) { | 839 | } catch (JSONException e) { |
| 840 | e.printStackTrace(); | 840 | e.printStackTrace(); |
| 841 | } | 841 | } |
| 842 | } | 842 | } |
| 843 | 843 | ||
| 844 | @Override | 844 | @Override |
| 845 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 845 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 846 | //Log.e("test", "onFailure" + new String(bytes)); | 846 | //Log.e("test", "onFailure" + new String(bytes)); |
| 847 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 847 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 848 | } | 848 | } |
| 849 | }); | 849 | }); |
| 850 | } | 850 | } |
| 851 | 851 | ||
| 852 | /** | 852 | /** |
| 853 | * 获取个性签名 | 853 | * 获取个性签名 |
| 854 | * | 854 | * |
| 855 | * @param mContext | 855 | * @param mContext |
| 856 | * @param userId | 856 | * @param userId |
| 857 | * @param handler | 857 | * @param handler |
| 858 | */ | 858 | */ |
| 859 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { | 859 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { |
| 860 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 860 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 861 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 861 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 862 | @Override | 862 | @Override |
| 863 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 863 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 864 | Log.e("test", "个性签名" + new String(arg2)); | 864 | Log.e("test", "个性签名" + new String(arg2)); |
| 865 | try { | 865 | try { |
| 866 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 866 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 867 | int status = jsonObject.optInt("status"); | 867 | int status = jsonObject.optInt("status"); |
| 868 | if (status == 1) { | 868 | if (status == 1) { |
| 869 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 869 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
| 870 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 870 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
| 871 | Message message = Message.obtain(); | 871 | Message message = Message.obtain(); |
| 872 | message.what = HttpCode.SIGN; | 872 | message.what = HttpCode.SIGN; |
| 873 | message.obj = signInfoBeanList; | 873 | message.obj = signInfoBeanList; |
| 874 | handler.sendMessage(message); | 874 | handler.sendMessage(message); |
| 875 | 875 | ||
| 876 | 876 | ||
| 877 | } else if (status == 1000) { | 877 | } else if (status == 1000) { |
| 878 | //AlertUtils.showToast(mContext, "您还没有签名哦"); | 878 | //AlertUtils.showToast(mContext, "您还没有签名哦"); |
| 879 | 879 | ||
| 880 | } else { | 880 | } else { |
| 881 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 881 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 882 | } | 882 | } |
| 883 | } catch (JSONException e) { | 883 | } catch (JSONException e) { |
| 884 | e.printStackTrace(); | 884 | e.printStackTrace(); |
| 885 | } | 885 | } |
| 886 | 886 | ||
| 887 | 887 | ||
| 888 | } | 888 | } |
| 889 | 889 | ||
| 890 | @Override | 890 | @Override |
| 891 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 891 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 892 | //Log.e("test", "失败原因" + arg3); | 892 | //Log.e("test", "失败原因" + arg3); |
| 893 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 893 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 894 | } | 894 | } |
| 895 | }); | 895 | }); |
| 896 | } | 896 | } |
| 897 | 897 | ||
| 898 | /** | 898 | /** |
| 899 | * 用户反馈 | 899 | * 用户反馈 |
| 900 | * | 900 | * |
| 901 | * @param mContext | 901 | * @param mContext |
| 902 | * @param userId | 902 | * @param userId |
| 903 | * @param content | 903 | * @param content |
| 904 | * @param contact | 904 | * @param contact |
| 905 | * @param imgs | 905 | * @param imgs |
| 906 | * @param feedtype | 906 | * @param feedtype |
| 907 | * @throws UnsupportedEncodingException | 907 | * @throws UnsupportedEncodingException |
| 908 | */ | 908 | */ |
| 909 | public void feedback(final Context mContext, String userId, String content, | 909 | public void feedback(final Context mContext, String userId, String content, |
| 910 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { | 910 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { |
| 911 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 911 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
| 912 | false, true, null); | 912 | false, true, null); |
| 913 | File file = new File(imgs); | 913 | File file = new File(imgs); |
| 914 | RequestParams params = new RequestParams(); | 914 | RequestParams params = new RequestParams(); |
| 915 | try { | 915 | try { |
| 916 | params.put("userId", userId); | 916 | params.put("userId", userId); |
| 917 | params.put("content", content); | 917 | params.put("content", content); |
| 918 | params.put("contact", contact); | 918 | params.put("contact", contact); |
| 919 | if (file.exists() && file.length() > 0) { | 919 | if (file.exists() && file.length() > 0) { |
| 920 | params.put("imgs", file); | 920 | params.put("imgs", file); |
| 921 | } | 921 | } |
| 922 | params.put("feedtype", feedtype); | 922 | params.put("feedtype", feedtype); |
| 923 | } catch (FileNotFoundException e) { | 923 | } catch (FileNotFoundException e) { |
| 924 | e.printStackTrace(); | 924 | e.printStackTrace(); |
| 925 | } | 925 | } |
| 926 | Log.e("test", "onSuccess" + params); | 926 | Log.e("test", "onSuccess" + params); |
| 927 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { | 927 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { |
| 928 | @Override | 928 | @Override |
| 929 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 929 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 930 | closeProgress(); | 930 | closeProgress(); |
| 931 | Log.e("test", "onSuccess" + new String(bytes)); | 931 | Log.e("test", "onSuccess" + new String(bytes)); |
| 932 | try { | 932 | try { |
| 933 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 933 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 934 | String status = jsonObject.optString("status"); | 934 | String status = jsonObject.optString("status"); |
| 935 | if (status.equals("1")) { | 935 | if (status.equals("1")) { |
| 936 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); | 936 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); |
| 937 | ((Activity) mContext).finish(); | 937 | ((Activity) mContext).finish(); |
| 938 | } else { | 938 | } else { |
| 939 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 939 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 940 | } | 940 | } |
| 941 | } catch (JSONException e) { | 941 | } catch (JSONException e) { |
| 942 | e.printStackTrace(); | 942 | e.printStackTrace(); |
| 943 | } | 943 | } |
| 944 | } | 944 | } |
| 945 | 945 | ||
| 946 | @Override | 946 | @Override |
| 947 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 947 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 948 | closeProgress(); | 948 | closeProgress(); |
| 949 | //Log.e("test", "错误信息" + new String(bytes)); | 949 | //Log.e("test", "错误信息" + new String(bytes)); |
| 950 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 950 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 951 | 951 | ||
| 952 | } | 952 | } |
| 953 | }); | 953 | }); |
| 954 | 954 | ||
| 955 | } | 955 | } |
| 956 | 956 | ||
| 957 | /** | 957 | /** |
| 958 | * 查询子账户信息 | 958 | * 查询子账户信息 |
| 959 | * | 959 | * |
| 960 | * @param mContext | 960 | * @param mContext |
| 961 | * @param userId | 961 | * @param userId |
| 962 | * @param handler | 962 | * @param handler |
| 963 | */ | 963 | */ |
| 964 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { | 964 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { |
| 965 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", | 965 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", |
| 966 | false, true, null); | 966 | false, true, null); |
| 967 | 967 | ||
| 968 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); | 968 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); |
| 969 | HttpClient.getInstance().setTimeout(5 * 1000); | 969 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 970 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 970 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 971 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 971 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 972 | @Override | 972 | @Override |
| 973 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 973 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 974 | closeProgress(); | 974 | closeProgress(); |
| 975 | Log.e("test", "子账户信息" + new String(arg2)); | 975 | Log.e("test", "子账户信息" + new String(arg2)); |
| 976 | try { | 976 | try { |
| 977 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 977 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 978 | int status = jsonObject.optInt("status"); | 978 | int status = jsonObject.optInt("status"); |
| 979 | if (status == 1) { | 979 | if (status == 1) { |
| 980 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 980 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
| 981 | Log.e("test", "子账户信息" + childsInfo); | 981 | Log.e("test", "子账户信息" + childsInfo); |
| 982 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 982 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
| 983 | Log.e("test", "子账户信息" + schoolInfoBeanList); | 983 | Log.e("test", "子账户信息" + schoolInfoBeanList); |
| 984 | Message msg = Message.obtain(); | 984 | Message msg = Message.obtain(); |
| 985 | msg.what = HttpCode.CHILDS_SUCESS; | 985 | msg.what = HttpCode.CHILDS_SUCESS; |
| 986 | msg.obj = schoolInfoBeanList; | 986 | msg.obj = schoolInfoBeanList; |
| 987 | handler.sendMessage(msg); | 987 | handler.sendMessage(msg); |
| 988 | 988 | ||
| 989 | } else { | 989 | } else { |
| 990 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 990 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
| 991 | 991 | ||
| 992 | } | 992 | } |
| 993 | } catch (JSONException e) { | 993 | } catch (JSONException e) { |
| 994 | e.printStackTrace(); | 994 | e.printStackTrace(); |
| 995 | 995 | ||
| 996 | } | 996 | } |
| 997 | 997 | ||
| 998 | } | 998 | } |
| 999 | 999 | ||
| 1000 | @Override | 1000 | @Override |
| 1001 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1001 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1002 | closeProgress(); | 1002 | closeProgress(); |
| 1003 | // Log.e("test", "错误信息" + new String(arg2)); | 1003 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1004 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1004 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1005 | } | 1005 | } |
| 1006 | }); | 1006 | }); |
| 1007 | 1007 | ||
| 1008 | } | 1008 | } |
| 1009 | 1009 | ||
| 1010 | /** | 1010 | /** |
| 1011 | * 删除子账户信息 | 1011 | * 删除子账户信息 |
| 1012 | * | 1012 | * |
| 1013 | * @param mContext | 1013 | * @param mContext |
| 1014 | * @param subAccountId | 1014 | * @param subAccountId |
| 1015 | */ | 1015 | */ |
| 1016 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { | 1016 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { |
| 1017 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 1017 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
| 1018 | false, true, null); | 1018 | false, true, null); |
| 1019 | HttpClient.getInstance().setTimeout(5 * 1000); | 1019 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1020 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1020 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1021 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 1021 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
| 1022 | @Override | 1022 | @Override |
| 1023 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1023 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1024 | closeProgress(); | 1024 | closeProgress(); |
| 1025 | Log.e("test", "子账户信息" + new String(arg2)); | 1025 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1026 | try { | 1026 | try { |
| 1027 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1027 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1028 | int status = jsonObject.optInt("status"); | 1028 | int status = jsonObject.optInt("status"); |
| 1029 | if (status == 1) { | 1029 | if (status == 1) { |
| 1030 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 1030 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
| 1031 | ((Activity) mContext).finish(); | 1031 | ((Activity) mContext).finish(); |
| 1032 | } else { | 1032 | } else { |
| 1033 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 1033 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
| 1034 | 1034 | ||
| 1035 | } | 1035 | } |
| 1036 | } catch (JSONException e) { | 1036 | } catch (JSONException e) { |
| 1037 | e.printStackTrace(); | 1037 | e.printStackTrace(); |
| 1038 | } | 1038 | } |
| 1039 | 1039 | ||
| 1040 | } | 1040 | } |
| 1041 | 1041 | ||
| 1042 | @Override | 1042 | @Override |
| 1043 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1043 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1044 | closeProgress(); | 1044 | closeProgress(); |
| 1045 | Log.e("test", "错误信息" + new String(arg2)); | 1045 | Log.e("test", "错误信息" + new String(arg2)); |
| 1046 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1046 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1047 | } | 1047 | } |
| 1048 | }); | 1048 | }); |
| 1049 | 1049 | ||
| 1050 | } | 1050 | } |
| 1051 | 1051 | ||
| 1052 | /** | 1052 | /** |
| 1053 | * 添加子账户信息 | 1053 | * 添加子账户信息 |
| 1054 | */ | 1054 | */ |
| 1055 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 1055 | public void addchildAccountinfo(final Context mContext, long parentId, String image, |
| 1056 | String name, final Long grade, Object school, Long region | 1056 | String name, final Long grade, Object school, Long region |
| 1057 | , String deviceNumber, String regionName) { | 1057 | , String deviceNumber, String regionName) { |
| 1058 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 1058 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
| 1059 | false, true, null); | 1059 | false, true, null); |
| 1060 | RequestParams params = new RequestParams(); | 1060 | RequestParams params = new RequestParams(); |
| 1061 | 1061 | ||
| 1062 | params.put(HttpKey.PARENTID, parentId); | 1062 | params.put(HttpKey.PARENTID, parentId); |
| 1063 | params.put(HttpKey.IMAGE, image); | 1063 | params.put(HttpKey.IMAGE, image); |
| 1064 | params.put(HttpKey.NAME, name); | 1064 | params.put(HttpKey.NAME, name); |
| 1065 | params.put(HttpKey.GRADE, grade); | 1065 | params.put(HttpKey.GRADE, grade); |
| 1066 | params.put(HttpKey.SCHOOL, school); | 1066 | params.put(HttpKey.SCHOOL, school); |
| 1067 | params.put(HttpKey.REGION, region); | 1067 | params.put(HttpKey.REGION, region); |
| 1068 | params.put(HttpKey.DEVINUMBER, deviceNumber); | 1068 | params.put(HttpKey.DEVINUMBER, deviceNumber); |
| 1069 | params.put(HttpKey.REGIONNAME, regionName); | 1069 | params.put(HttpKey.REGIONNAME, regionName); |
| 1070 | 1070 | ||
| 1071 | Log.e("test", "子账户信息" + params); | 1071 | Log.e("test", "子账户信息" + params); |
| 1072 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1072 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 1073 | HttpClient.getInstance().setTimeout(5 * 1000); | 1073 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1074 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1074 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1075 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 1075 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
| 1076 | @Override | 1076 | @Override |
| 1077 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1077 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1078 | closeProgress(); | 1078 | closeProgress(); |
| 1079 | 1079 | ||
| 1080 | Log.e("test", "子账户信息" + new String(arg2)); | 1080 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1081 | try { | 1081 | try { |
| 1082 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1082 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1083 | int status = jsonObject.optInt("status"); | 1083 | int status = jsonObject.optInt("status"); |
| 1084 | if (status == 1) { | 1084 | if (status == 1) { |
| 1085 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1085 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
| 1086 | ((Activity) mContext).finish(); | 1086 | ((Activity) mContext).finish(); |
| 1087 | } else { | 1087 | } else { |
| 1088 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1088 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
| 1089 | 1089 | ||
| 1090 | } | 1090 | } |
| 1091 | } catch (JSONException e) { | 1091 | } catch (JSONException e) { |
| 1092 | e.printStackTrace(); | 1092 | e.printStackTrace(); |
| 1093 | } | 1093 | } |
| 1094 | 1094 | ||
| 1095 | } | 1095 | } |
| 1096 | 1096 | ||
| 1097 | @Override | 1097 | @Override |
| 1098 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1098 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1099 | closeProgress(); | 1099 | closeProgress(); |
| 1100 | Log.e("test", "错误信息" + new String(arg2)); | 1100 | Log.e("test", "错误信息" + new String(arg2)); |
| 1101 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1101 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1102 | } | 1102 | } |
| 1103 | }); | 1103 | }); |
| 1104 | 1104 | ||
| 1105 | } | 1105 | } |
| 1106 | 1106 | ||
| 1107 | /** | 1107 | /** |
| 1108 | * 切换子账户信息 | 1108 | * 切换子账户信息 |
| 1109 | * | 1109 | * |
| 1110 | * @param mContext | 1110 | * @param mContext |
| 1111 | * @param subAccountId | 1111 | * @param subAccountId |
| 1112 | */ | 1112 | */ |
| 1113 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId | 1113 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId |
| 1114 | , String deviceNumber, int type) { | 1114 | , String deviceNumber, int type) { |
| 1115 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1115 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
| 1116 | false, true, null); | 1116 | false, true, null); |
| 1117 | HttpClient.getInstance().setTimeout(5 * 1000); | 1117 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1118 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1118 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1119 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId | 1119 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId |
| 1120 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { | 1120 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1121 | @Override | 1121 | @Override |
| 1122 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1122 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1123 | closeProgress(); | 1123 | closeProgress(); |
| 1124 | Log.e("test", "子账户信息" + new String(arg2)); | 1124 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1125 | try { | 1125 | try { |
| 1126 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1126 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1127 | int status = jsonObject.optInt("status"); | 1127 | int status = jsonObject.optInt("status"); |
| 1128 | if (status == 1) { | 1128 | if (status == 1) { |
| 1129 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1129 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
| 1130 | ((Activity) mContext).finish(); | 1130 | ((Activity) mContext).finish(); |
| 1131 | 1131 | ||
| 1132 | } else { | 1132 | } else { |
| 1133 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1133 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
| 1134 | 1134 | ||
| 1135 | } | 1135 | } |
| 1136 | } catch (JSONException e) { | 1136 | } catch (JSONException e) { |
| 1137 | e.printStackTrace(); | 1137 | e.printStackTrace(); |
| 1138 | } | 1138 | } |
| 1139 | 1139 | ||
| 1140 | } | 1140 | } |
| 1141 | 1141 | ||
| 1142 | @Override | 1142 | @Override |
| 1143 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1143 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1144 | closeProgress(); | 1144 | closeProgress(); |
| 1145 | //Log.e("test", "错误信息" + new String(arg2)); | 1145 | //Log.e("test", "错误信息" + new String(arg2)); |
| 1146 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1146 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1147 | } | 1147 | } |
| 1148 | }); | 1148 | }); |
| 1149 | 1149 | ||
| 1150 | } | 1150 | } |
| 1151 | 1151 | ||
| 1152 | /** | 1152 | /** |
| 1153 | * 切换主账户信息 | 1153 | * 切换主账户信息 |
| 1154 | * | 1154 | * |
| 1155 | * @param mContext | 1155 | * @param mContext |
| 1156 | * @param type | 1156 | * @param type |
| 1157 | */ | 1157 | */ |
| 1158 | public void Accountinfo(final Context mContext, long userId | 1158 | public void Accountinfo(final Context mContext, long userId |
| 1159 | , String deviceNumber, int type) { | 1159 | , String deviceNumber, int type) { |
| 1160 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", | 1160 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", |
| 1161 | false, true, null); | 1161 | false, true, null); |
| 1162 | HttpClient.getInstance().setTimeout(5 * 1000); | 1162 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1163 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1163 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1164 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber | 1164 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber |
| 1165 | + "&type=" + type, new AsyncHttpResponseHandler() { | 1165 | + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1166 | @Override | 1166 | @Override |
| 1167 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1167 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1168 | closeProgress(); | 1168 | closeProgress(); |
| 1169 | Log.e("test", "子账户信息" + new String(arg2)); | 1169 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1170 | try { | 1170 | try { |
| 1171 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1171 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1172 | int status = jsonObject.optInt("status"); | 1172 | int status = jsonObject.optInt("status"); |
| 1173 | if (status == 1) { | 1173 | if (status == 1) { |
| 1174 | AlertUtils.showToast(mContext, "主账号切换成功!"); | 1174 | AlertUtils.showToast(mContext, "主账号切换成功!"); |
| 1175 | ((Activity) mContext).finish(); | 1175 | ((Activity) mContext).finish(); |
| 1176 | 1176 | ||
| 1177 | } else { | 1177 | } else { |
| 1178 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); | 1178 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); |
| 1179 | 1179 | ||
| 1180 | } | 1180 | } |
| 1181 | } catch (JSONException e) { | 1181 | } catch (JSONException e) { |
| 1182 | e.printStackTrace(); | 1182 | e.printStackTrace(); |
| 1183 | } | 1183 | } |
| 1184 | 1184 | ||
| 1185 | } | 1185 | } |
| 1186 | 1186 | ||
| 1187 | @Override | 1187 | @Override |
| 1188 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1188 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1189 | closeProgress(); | 1189 | closeProgress(); |
| 1190 | Log.e("test", "错误信息" + new String(arg2)); | 1190 | Log.e("test", "错误信息" + new String(arg2)); |
| 1191 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1191 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1192 | } | 1192 | } |
| 1193 | }); | 1193 | }); |
| 1194 | 1194 | ||
| 1195 | } | 1195 | } |
| 1196 | 1196 | ||
| 1197 | /** | 1197 | /** |
| 1198 | * 头像拍张 | 1198 | * 头像拍张 |
| 1199 | * | 1199 | * |
| 1200 | * @param mContext | 1200 | * @param mContext |
| 1201 | * @param userId | 1201 | * @param userId |
| 1202 | * @param img | 1202 | * @param img |
| 1203 | * @throws UnsupportedEncodingException | 1203 | * @throws UnsupportedEncodingException |
| 1204 | */ | 1204 | */ |
| 1205 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { | 1205 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { |
| 1206 | File file = new File(img); | 1206 | File file = new File(img); |
| 1207 | if (file.exists() && file.length() > 0) { | 1207 | if (file.exists() && file.length() > 0) { |
| 1208 | RequestParams params = new RequestParams(); | 1208 | RequestParams params = new RequestParams(); |
| 1209 | try { | 1209 | try { |
| 1210 | params.put("userId", userId); | 1210 | params.put("userId", userId); |
| 1211 | params.put("type", type); | 1211 | params.put("type", type); |
| 1212 | params.put("img", file); | 1212 | params.put("img", file); |
| 1213 | } catch (FileNotFoundException e) { | 1213 | } catch (FileNotFoundException e) { |
| 1214 | e.printStackTrace(); | 1214 | e.printStackTrace(); |
| 1215 | } | 1215 | } |
| 1216 | Log.e("test", "params" + params); | 1216 | Log.e("test", "params" + params); |
| 1217 | HttpClient.getInstance().setTimeout(5 * 1000); | 1217 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1218 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { | 1218 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { |
| 1219 | @Override | 1219 | @Override |
| 1220 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1220 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 1221 | Log.e("test", "onSuccess" + new String(bytes)); | 1221 | Log.e("test", "onSuccess" + new String(bytes)); |
| 1222 | try { | 1222 | try { |
| 1223 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1223 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 1224 | String status = jsonObject.optString("status"); | 1224 | String status = jsonObject.optString("status"); |
| 1225 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); | 1225 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); |
| 1226 | String imagUrl = jsonObject1.optString("imgUrl"); | 1226 | String imagUrl = jsonObject1.optString("imgUrl"); |
| 1227 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); | 1227 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); |
| 1228 | if (status.equals("1")) { | 1228 | if (status.equals("1")) { |
| 1229 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1229 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
| 1230 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); | ||
| 1230 | } else { | 1231 | } else { |
| 1231 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1232 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 1232 | } | 1233 | } |
| 1233 | } catch (JSONException e) { | 1234 | } catch (JSONException e) { |
| 1234 | e.printStackTrace(); | 1235 | e.printStackTrace(); |
| 1235 | } | 1236 | } |
| 1236 | } | 1237 | } |
| 1237 | 1238 | ||
| 1238 | @Override | 1239 | @Override |
| 1239 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1240 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 1240 | closeProgress(); | 1241 | closeProgress(); |
| 1241 | Log.e("test", "错误信息" + new String(bytes)); | 1242 | Log.e("test", "错误信息" + new String(bytes)); |
| 1242 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1243 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1243 | 1244 | ||
| 1244 | } | 1245 | } |
| 1245 | }); | 1246 | }); |
| 1246 | } else { | 1247 | } else { |
| 1247 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 1248 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); |
| 1248 | } | 1249 | } |
| 1249 | } | 1250 | } |
| 1250 | 1251 | ||
| 1251 | /** | 1252 | /** |
| 1252 | * 头像默认 | 1253 | * 头像默认 |
| 1253 | * | 1254 | * |
| 1254 | * @param mContext | 1255 | * @param mContext |
| 1255 | * @param userId | 1256 | * @param userId |
| 1256 | * @param | 1257 | * @param |
| 1257 | * @throws UnsupportedEncodingException | 1258 | * @throws UnsupportedEncodingException |
| 1258 | */ | 1259 | */ |
| 1259 | public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { | 1260 | public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { |
| 1260 | RequestParams params = new RequestParams(); | 1261 | RequestParams params = new RequestParams(); |
| 1261 | params.put("userId", userId); | 1262 | params.put("userId", userId); |
| 1262 | params.put("type", type); | 1263 | params.put("type", type); |
| 1263 | params.put("defaultImg", defaultImg); | 1264 | params.put("defaultImg", defaultImg); |
| 1264 | Log.e("test", "params" + params); | 1265 | Log.e("test", "params" + params); |
| 1265 | HttpClient.getInstance().setTimeout(5 * 1000); | 1266 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1266 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { | 1267 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { |
| 1267 | @Override | 1268 | @Override |
| 1268 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1269 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 1269 | Log.e("test", "onSuccess" + new String(bytes)); | 1270 | Log.e("test", "onSuccess" + new String(bytes)); |
| 1270 | try { | 1271 | try { |
| 1271 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1272 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 1272 | String status = jsonObject.optString("status"); | 1273 | String status = jsonObject.optString("status"); |
| 1273 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); | 1274 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); |
| 1274 | String imagUrl = jsonObject1.optString("imgUrl"); | 1275 | String imagUrl = jsonObject1.optString("imgUrl"); |
| 1275 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); | 1276 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); |
| 1276 | if (status.equals("1")) { | 1277 | if (status.equals("1")) { |
| 1277 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1278 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
| 1279 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); | ||
| 1278 | } else { | 1280 | } else { |
| 1279 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1281 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 1280 | } | 1282 | } |
| 1281 | } catch (JSONException e) { | 1283 | } catch (JSONException e) { |
| 1282 | e.printStackTrace(); | 1284 | e.printStackTrace(); |
| 1283 | } | 1285 | } |
| 1284 | } | 1286 | } |
| 1285 | 1287 | ||
| 1286 | @Override | 1288 | @Override |
| 1287 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1289 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 1288 | closeProgress(); | 1290 | closeProgress(); |
| 1289 | Log.e("test", "错误信息" + new String(bytes)); | 1291 | Log.e("test", "错误信息" + new String(bytes)); |
| 1290 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1292 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1291 | 1293 | ||
| 1292 | } | 1294 | } |
| 1293 | }); | 1295 | }); |
| 1294 | } | 1296 | } |
| 1295 | 1297 | ||
| 1296 | /** | 1298 | /** |
| 1297 | * 检查注册信息是否完整 | 1299 | * 检查注册信息是否完整 |
| 1298 | * | 1300 | * |
| 1299 | * @param mContext | 1301 | * @param mContext |
| 1300 | * @param userId | 1302 | * @param userId |
| 1301 | */ | 1303 | */ |
| 1302 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { | 1304 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { |
| 1303 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", | 1305 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", |
| 1304 | false, true, null); | 1306 | false, true, null); |
| 1305 | HttpClient.getInstance().setTimeout(5 * 1000); | 1307 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1306 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1308 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1307 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1309 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 1308 | @Override | 1310 | @Override |
| 1309 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1311 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1310 | closeProgress(); | 1312 | closeProgress(); |
| 1311 | Log.e("test", "注册信息" + new String(arg2)); | 1313 | Log.e("test", "注册信息" + new String(arg2)); |
| 1312 | Message msg = Message.obtain(); | 1314 | Message msg = Message.obtain(); |
| 1313 | msg.what = HttpCode.REGISTER_SUCESS; | 1315 | msg.what = HttpCode.REGISTER_SUCESS; |
| 1314 | msg.obj = new String(arg2); | 1316 | msg.obj = new String(arg2); |
| 1315 | handler.sendMessage(msg); | 1317 | handler.sendMessage(msg); |
| 1316 | 1318 | ||
| 1317 | } | 1319 | } |
| 1318 | 1320 | ||
| 1319 | @Override | 1321 | @Override |
| 1320 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1322 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1321 | closeProgress(); | 1323 | closeProgress(); |
| 1322 | // Log.e("test", "错误信息" + new String(arg2)); | 1324 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1323 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1325 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1324 | 1326 | ||
| 1325 | } | 1327 | } |
| 1326 | }); | 1328 | }); |
| 1327 | 1329 | ||
| 1328 | } | 1330 | } |
| 1329 | 1331 | ||
| 1330 | /** | 1332 | /** |
| 1331 | * 获取最近学习视频 | 1333 | * 获取最近学习视频 |
| 1332 | * | 1334 | * |
| 1333 | * @param mContext | 1335 | * @param mContext |
| 1334 | * @param userId | 1336 | * @param userId |
| 1335 | */ | 1337 | */ |
| 1336 | public void getstuyvidioinfo(final Context mContext, long userId, final Handler handler) { | 1338 | public void getstuyvidioinfo(final Context mContext, long userId, final Handler handler) { |
| 1337 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", | 1339 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", |
| 1338 | false, true, null); | 1340 | false, true, null); |
| 1339 | HttpClient.getInstance().setTimeout(5 * 1000); | 1341 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1340 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1342 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1341 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1343 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 1342 | @Override | 1344 | @Override |
| 1343 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1345 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1344 | closeProgress(); | 1346 | closeProgress(); |
| 1345 | Log.e("test", "近学习视频" + new String(arg2)); | 1347 | Log.e("test", "近学习视频" + new String(arg2)); |
| 1346 | try { | 1348 | try { |
| 1347 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1349 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1348 | int status = jsonObject.optInt("status"); | 1350 | int status = jsonObject.optInt("status"); |
| 1349 | if (status == 1) { | 1351 | if (status == 1) { |
| 1350 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 | 1352 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 |
| 1351 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); | 1353 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); |
| 1352 | Message msg = Message.obtain(); | 1354 | Message msg = Message.obtain(); |
| 1353 | msg.what = HttpCode.GETVIDIO_SUCESS; | 1355 | msg.what = HttpCode.GETVIDIO_SUCESS; |
| 1354 | msg.obj = schoolInfoBeanList; | 1356 | msg.obj = schoolInfoBeanList; |
| 1355 | handler.sendMessage(msg); | 1357 | handler.sendMessage(msg); |
| 1356 | 1358 | ||
| 1357 | } else { | 1359 | } else { |
| 1358 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 1360 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
| 1359 | 1361 | ||
| 1360 | } | 1362 | } |
| 1361 | } catch (JSONException e) { | 1363 | } catch (JSONException e) { |
| 1362 | e.printStackTrace(); | 1364 | e.printStackTrace(); |
| 1363 | 1365 | ||
| 1364 | } | 1366 | } |
| 1365 | 1367 | ||
| 1366 | } | 1368 | } |
| 1367 | 1369 | ||
| 1368 | @Override | 1370 | @Override |
| 1369 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1371 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1370 | closeProgress(); | 1372 | closeProgress(); |
| 1371 | // Log.e("test", "错误信息" + new String(arg2)); | 1373 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1372 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1374 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1373 | 1375 | ||
| 1374 | } | 1376 | } |
| 1375 | }); | 1377 | }); |
| 1376 | 1378 | ||
| 1377 | } | 1379 | } |
| 1378 | 1380 | ||
| 1379 | 1381 | ||
| 1380 | /** | 1382 | /** |
| 1381 | * 系统升级 | 1383 | * 系统升级 |
| 1382 | * | 1384 | * |
| 1383 | * @param mContext | 1385 | * @param mContext |
| 1384 | * @param pid appName | 1386 | * @param pid appName |
| 1385 | */ | 1387 | */ |
| 1386 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1388 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
| 1387 | // mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", | 1389 | // mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", |
| 1388 | // false, true, null); | 1390 | // false, true, null); |
| 1389 | HttpClient.getInstance().setTimeout(5 * 1000); | 1391 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1390 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1392 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1391 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1393 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
| 1392 | @Override | 1394 | @Override |
| 1393 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1395 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1394 | //closeProgress(); | 1396 | //closeProgress(); |
| 1395 | Log.e("test", "版本升级信息" + new String(arg2)); | 1397 | Log.e("test", "版本升级信息" + new String(arg2)); |
| 1396 | Gson gson = new Gson(); | 1398 | Gson gson = new Gson(); |
| 1397 | List<AppVersion> applist = gson.fromJson(new String(arg2), | 1399 | List<AppVersion> applist = gson.fromJson(new String(arg2), |
| 1398 | new TypeToken<List<AppVersion>>() {}.getType()); | 1400 | new TypeToken<List<AppVersion>>() {}.getType()); |
| 1399 | Log.e("test", "版本升级信息" + applist); | 1401 | Log.e("test", "版本升级信息" + applist); |
| 1400 | Message msg = Message.obtain(); | 1402 | Message msg = Message.obtain(); |
| 1401 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1403 | msg.what = HttpCode.APPUPDATE_SUCESS; |
| 1402 | msg.obj = applist; | 1404 | msg.obj = applist; |
| 1403 | handler.sendMessage(msg); | 1405 | handler.sendMessage(msg); |
| 1404 | 1406 | ||
| 1405 | 1407 | ||
| 1406 | 1408 | ||
| 1407 | } | 1409 | } |
| 1408 | 1410 | ||
| 1409 | @Override | 1411 | @Override |
| 1410 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1412 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1411 | //closeProgress(); | 1413 | //closeProgress(); |
| 1412 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1414 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1413 | } | 1415 | } |
| 1414 | }); | 1416 | }); |
| 1415 | 1417 | ||
| 1416 | } | 1418 | } |
| 1417 | 1419 | ||
| 1418 | //版本信息 | 1420 | //版本信息 |
| 1419 | public void versioninfo(final Context mContext, String subjectName, final Handler handler) { | 1421 | public void versioninfo(final Context mContext, String subjectName, final Handler handler) { |
| 1420 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1422 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1421 | HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { | 1423 | HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { |
| 1422 | @Override | 1424 | @Override |
| 1423 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1425 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1424 | Log.e("test", "版本信息" + new String(arg2)); | 1426 | Log.e("test", "版本信息" + new String(arg2)); |
| 1425 | try { | 1427 | try { |
| 1426 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1428 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1427 | int status = jsonObject.optInt("status"); | 1429 | int status = jsonObject.optInt("status"); |
| 1428 | if (status == 1) { | 1430 | if (status == 1) { |
| 1429 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 | 1431 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 |
| 1430 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); | 1432 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); |
| 1431 | Message message = Message.obtain(); | 1433 | Message message = Message.obtain(); |
| 1432 | message.what = HttpCode.VERSION_SUCESS; | 1434 | message.what = HttpCode.VERSION_SUCESS; |
| 1433 | message.obj = versionInfoList; | 1435 | message.obj = versionInfoList; |
| 1434 | handler.sendMessage(message); | 1436 | handler.sendMessage(message); |
| 1435 | 1437 | ||
| 1436 | } else if (status == 1000) { | 1438 | } else if (status == 1000) { |
| 1437 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); | 1439 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); |
| 1438 | 1440 | ||
| 1439 | } else { | 1441 | } else { |
| 1440 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1442 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1441 | } | 1443 | } |
| 1442 | } catch (JSONException e) { | 1444 | } catch (JSONException e) { |
| 1443 | e.printStackTrace(); | 1445 | e.printStackTrace(); |
| 1444 | } | 1446 | } |
| 1445 | 1447 | ||
| 1446 | 1448 | ||
| 1447 | } | 1449 | } |
| 1448 | 1450 | ||
| 1449 | @Override | 1451 | @Override |
| 1450 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1452 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1451 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1453 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1452 | } | 1454 | } |
| 1453 | }); | 1455 | }); |
| 1454 | } | 1456 | } |
| 1455 | 1457 | ||
| 1456 | 1458 | ||
| 1457 | ///省级接口 | 1459 | ///省级接口 |
| 1458 | public void provices(final Context mContext, final Handler handler) { | 1460 | public void provices(final Context mContext, final Handler handler) { |
| 1459 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1461 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1460 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1462 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
| 1461 | @Override | 1463 | @Override |
| 1462 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1464 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1463 | Log.e("test", "省" + new String(arg2)); | 1465 | Log.e("test", "省" + new String(arg2)); |
| 1464 | try { | 1466 | try { |
| 1465 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1467 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1466 | int status = jsonObject.optInt("status"); | 1468 | int status = jsonObject.optInt("status"); |
| 1467 | if (status == 100) { | 1469 | if (status == 100) { |
| 1468 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1470 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
| 1469 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1471 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
| 1470 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1472 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
| 1471 | Message message = Message.obtain(); | 1473 | Message message = Message.obtain(); |
| 1472 | message.what = HttpCode.PROVICES; | 1474 | message.what = HttpCode.PROVICES; |
| 1473 | message.obj = provincesBeanList; | 1475 | message.obj = provincesBeanList; |
| 1474 | handler.sendMessage(message); | 1476 | handler.sendMessage(message); |
| 1475 | 1477 | ||
| 1476 | 1478 | ||
| 1477 | } else { | 1479 | } else { |
| 1478 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1480 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1479 | 1481 | ||
| 1480 | } | 1482 | } |
| 1481 | } catch (JSONException e) { | 1483 | } catch (JSONException e) { |
| 1482 | e.printStackTrace(); | 1484 | e.printStackTrace(); |
| 1483 | } | 1485 | } |
| 1484 | 1486 | ||
| 1485 | 1487 | ||
| 1486 | } | 1488 | } |
| 1487 | 1489 | ||
| 1488 | @Override | 1490 | @Override |
| 1489 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1491 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1490 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1492 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1491 | } | 1493 | } |
| 1492 | }); | 1494 | }); |
| 1493 | } | 1495 | } |
| 1494 | 1496 | ||
| 1495 | //获取版本信息接口 | 1497 | //获取版本信息接口 |
| 1496 | public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { | 1498 | public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { |
| 1497 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1499 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1498 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { | 1500 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1499 | @Override | 1501 | @Override |
| 1500 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1502 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1501 | Log.e("test", "获取版本信息接口" + new String(arg2)); | 1503 | Log.e("test", "获取版本信息接口" + new String(arg2)); |
| 1502 | try { | 1504 | try { |
| 1503 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1505 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1504 | int status = jsonObject.optInt("status"); | 1506 | int status = jsonObject.optInt("status"); |
| 1505 | if (status == 1) { | 1507 | if (status == 1) { |
| 1506 | Gson gson = new Gson(); | 1508 | Gson gson = new Gson(); |
| 1507 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); | 1509 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); |
| 1508 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); | 1510 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); |
| 1509 | Message message = Message.obtain(); | 1511 | Message message = Message.obtain(); |
| 1510 | message.what = HttpCode.PUBLISH_SUCESS; | 1512 | message.what = HttpCode.PUBLISH_SUCESS; |
| 1511 | message.obj = defautPublishInfoBeanList; | 1513 | message.obj = defautPublishInfoBeanList; |
| 1512 | handler.sendMessage(message); | 1514 | handler.sendMessage(message); |
| 1513 | 1515 | ||
| 1514 | } else { | 1516 | } else { |
| 1515 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1517 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1516 | 1518 | ||
| 1517 | } | 1519 | } |
| 1518 | } catch (JSONException e) { | 1520 | } catch (JSONException e) { |
| 1519 | e.printStackTrace(); | 1521 | e.printStackTrace(); |
| 1520 | } | 1522 | } |
| 1521 | 1523 | ||
| 1522 | 1524 | ||
| 1523 | } | 1525 | } |
| 1524 | 1526 | ||
| 1525 | @Override | 1527 | @Override |
| 1526 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1528 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1527 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1529 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1528 | } | 1530 | } |
| 1529 | }); | 1531 | }); |
| 1530 | } | 1532 | } |
| 1531 | 1533 | ||
| 1532 | 1534 | ||
| 1533 | //市级接口 | 1535 | //市级接口 |
| 1534 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1536 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
| 1535 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1537 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1536 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1538 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
| 1537 | @Override | 1539 | @Override |
| 1538 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1540 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1539 | Log.e("test", "市" + new String(arg2)); | 1541 | Log.e("test", "市" + new String(arg2)); |
| 1540 | try { | 1542 | try { |
| 1541 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1543 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1542 | int status = jsonObject.optInt("status"); | 1544 | int status = jsonObject.optInt("status"); |
| 1543 | if (status == 100) { | 1545 | if (status == 100) { |
| 1544 | Gson gson = new Gson(); | 1546 | Gson gson = new Gson(); |
| 1545 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1547 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
| 1546 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1548 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
| 1547 | Message message = Message.obtain(); | 1549 | Message message = Message.obtain(); |
| 1548 | message.what = HttpCode.CITYS; | 1550 | message.what = HttpCode.CITYS; |
| 1549 | message.obj = cityInfoBeanList; | 1551 | message.obj = cityInfoBeanList; |
| 1550 | handler.sendMessage(message); | 1552 | handler.sendMessage(message); |
| 1551 | 1553 | ||
| 1552 | } else { | 1554 | } else { |
| 1553 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1555 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1554 | 1556 | ||
| 1555 | } | 1557 | } |
| 1556 | } catch (JSONException e) { | 1558 | } catch (JSONException e) { |
| 1557 | e.printStackTrace(); | 1559 | e.printStackTrace(); |
| 1558 | } | 1560 | } |
| 1559 | 1561 | ||
| 1560 | 1562 | ||
| 1561 | } | 1563 | } |
| 1562 | 1564 | ||
| 1563 | @Override | 1565 | @Override |
| 1564 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1566 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1565 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1567 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1566 | } | 1568 | } |
| 1567 | }); | 1569 | }); |
| 1568 | } | 1570 | } |
| 1569 | 1571 | ||
| 1570 | //区县级接口 | 1572 | //区县级接口 |
| 1571 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1573 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
| 1572 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1574 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1573 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1575 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
| 1574 | @Override | 1576 | @Override |
| 1575 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1577 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1576 | Log.e("test", "区" + new String(arg2)); | 1578 | Log.e("test", "区" + new String(arg2)); |
| 1577 | try { | 1579 | try { |
| 1578 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1580 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1579 | int status = jsonObject.optInt("status"); | 1581 | int status = jsonObject.optInt("status"); |
| 1580 | if (status == 100) { | 1582 | if (status == 100) { |
| 1581 | Gson gson = new Gson(); | 1583 | Gson gson = new Gson(); |
| 1582 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1584 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
| 1583 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1585 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
| 1584 | Message message = Message.obtain(); | 1586 | Message message = Message.obtain(); |
| 1585 | message.what = HttpCode.COUNTRY; | 1587 | message.what = HttpCode.COUNTRY; |
| 1586 | message.obj = countyInfoInfoBeanList; | 1588 | message.obj = countyInfoInfoBeanList; |
| 1587 | handler.sendMessage(message); | 1589 | handler.sendMessage(message); |
| 1588 | } else { | 1590 | } else { |
| 1589 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1591 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1590 | 1592 | ||
| 1591 | } | 1593 | } |
| 1592 | } catch (JSONException e) { | 1594 | } catch (JSONException e) { |
| 1593 | e.printStackTrace(); | 1595 | e.printStackTrace(); |
| 1594 | } | 1596 | } |
| 1595 | 1597 | ||
| 1596 | 1598 | ||
| 1597 | } | 1599 | } |
| 1598 | 1600 | ||
| 1599 | @Override | 1601 | @Override |
| 1600 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1602 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1601 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1603 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1602 | } | 1604 | } |
| 1603 | }); | 1605 | }); |
| 1604 | } | 1606 | } |
| 1605 | 1607 | ||
| 1606 | 1608 | ||
| 1607 | private void closeProgress() { | 1609 | private void closeProgress() { |
| 1608 | try { | 1610 | try { |
| 1609 | if (mProgress != null) { | 1611 | if (mProgress != null) { |
| 1610 | mProgress.dismiss(); | 1612 | mProgress.dismiss(); |
| 1611 | mProgress = null; | 1613 | mProgress = null; |
| 1612 | } | 1614 | } |
| 1613 | } catch (Exception e) { | 1615 | } catch (Exception e) { |
| 1614 | e.printStackTrace(); | 1616 | e.printStackTrace(); |
| 1615 | } | 1617 | } |
| 1616 | } | 1618 | } |
| 1617 | 1619 | ||
| 1618 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 1620 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| 1619 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 1621 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 1620 | 1622 | ||
| 1621 | HttpManager.getInstance().closeProgress(); | 1623 | HttpManager.getInstance().closeProgress(); |
| 1622 | } | 1624 | } |
| 1623 | 1625 | ||
| 1624 | return false; | 1626 | return false; |
| 1625 | 1627 | ||
| 1626 | } | 1628 | } |
| 1627 | 1629 | ||
| 1628 | } | 1630 | } |
| 1629 | 1631 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/UserInfoModer.java
| File was created | 1 | package com.hjx.personalcenter.model; | |
| 2 | |||
| 3 | import java.io.Serializable; | ||
| 4 | |||
| 5 | /** | ||
| 6 | * Created by h on 2017/11/23. | ||
| 7 | */ | ||
| 8 | |||
| 9 | public class UserInfoModer implements Serializable { | ||
| 10 | private String nickName; | ||
| 11 | private String gender; | ||
| 12 | private String address; | ||
| 13 | private String portrait; | ||
| 14 | private String school; | ||
| 15 | private String grade; | ||
| 16 | private String gradeid; | ||
| 17 | |||
| 18 | public String getGradeid() { | ||
| 19 | return gradeid; | ||
| 20 | } | ||
| 21 | |||
| 22 | public void setGradeid(String gradeid) { | ||
| 23 | this.gradeid = gradeid; | ||
| 24 | } | ||
| 25 | |||
| 26 | private String birthday; | ||
| 27 | private String qq; | ||
| 28 | |||
| 29 | public String getNickName() { | ||
| 30 | return nickName; | ||
| 31 | } | ||
| 32 | |||
| 33 | public void setNickName(String nickName) { | ||
| 34 | this.nickName = nickName; | ||
| 35 | } | ||
| 36 | |||
| 37 | public String getGender() { | ||
| 38 | return gender; | ||
| 39 | } | ||
| 40 | |||
| 41 | public void setGender(String gender) { | ||
| 42 | this.gender = gender; | ||
| 43 | } | ||
| 44 | |||
| 45 | public String getAddress() { | ||
| 46 | return address; | ||
| 47 | } | ||
| 48 | |||
| 49 | public void setAddress(String address) { | ||
| 50 | this.address = address; | ||
| 51 | } | ||
| 52 | |||
| 53 | public String getPortrait() { | ||
| 54 | return portrait; | ||
| 55 | } | ||
| 56 | |||
| 57 | public void setPortrait(String portrait) { | ||
| 58 | this.portrait = portrait; | ||
| 59 | } | ||
| 60 | |||
| 61 | public String getSchool() { | ||
| 62 | return school; | ||
| 63 | } | ||
| 64 | |||
| 65 | public void setSchool(String school) { | ||
| 66 | this.school = school; | ||
| 67 | } | ||
| 68 | |||
| 69 | public String getGrade() { | ||
| 70 | return grade; | ||
| 71 | } | ||
| 72 | |||
| 73 | public void setGrade(String grade) { | ||
| 74 | this.grade = grade; | ||
| 75 | } | ||
| 76 | |||
| 77 | public String getBirthday() { | ||
| 78 | return birthday; | ||
| 79 | } | ||
| 80 | |||
| 81 | public void setBirthday(String birthday) { | ||
| 82 | this.birthday = birthday; | ||
| 83 | } | ||
| 84 | |||
| 85 | public String getQq() { | ||
| 86 | return qq; | ||
| 87 | } | ||
| 88 | |||
| 89 | public void setQq(String qq) { | ||
| 90 | this.qq = qq; | ||
| 91 | } | ||
| 92 | } | ||
| 93 |
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 | import android.util.Log; | ||
| 7 | 6 | ||
| 8 | import com.google.gson.Gson; | 7 | import com.google.gson.Gson; |
| 9 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 8 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
| 10 | import com.hjx.personalcenter.db.SaveParam; | 9 | import com.hjx.personalcenter.db.SaveParam; |
| 11 | import com.hjx.personalcenter.model.CardInfo; | 10 | import com.hjx.personalcenter.model.CardInfo; |
| 12 | import com.hjx.personalcenter.model.LoginInfo; | 11 | import com.hjx.personalcenter.model.LoginInfo; |
| 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 | results =gson.toJson(dataBean); | 97 | results =gson.toJson(dataBean); |
| 98 | Log.e("test","保卡信息"+results); | 98 | //Log.e("test","保卡信息"+results); |
| 99 | return results; | 99 | return results; |
| 100 | 100 | ||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | @Override | 103 | @Override |
| 104 | public String getUserInfo() throws RemoteException { | 104 | public String getUserInfo() throws RemoteException { |
| 105 | return null; | 105 | String userinfo = null; |
| 106 | Gson gson = new Gson(); | ||
| 107 | UserInfoModer userInfoModer = new UserInfoModer(); | ||
| 108 | userInfoModer.setNickName(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTUSERNAME)); | ||
| 109 | userInfoModer.setGrade(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTGRADES)); | ||
| 110 | userInfoModer.setSchool(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSCHOOL)); | ||
| 111 | userInfoModer.setBirthday(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTCONSTELLATION)); | ||
| 112 | userInfoModer.setGender(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSEX)); | ||
| 113 | userInfoModer.setQq(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTQQ)); | ||
| 114 | userInfoModer.setAddress(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTXINGZUO)); | ||
| 115 | userInfoModer.setPortrait(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.PORTAIT)); | ||
| 116 | userInfoModer.setGradeid(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.GRADENS)); | ||
| 117 | userinfo = gson.toJson(userInfoModer); | ||
| 118 | return userinfo; | ||
| 106 | } | 119 | } |
| 107 | 120 | ||
| 108 | @Override | 121 | @Override |
| 109 | public String logout() throws RemoteException { | 122 | public String logout() throws RemoteException { |
| 110 | return null; | 123 | String visoninfo = SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.VERSIONINTEFACE); |
| 124 | return visoninfo; | ||
| 111 | } | 125 | } |
| 112 | 126 | ||
| 113 | @Override | 127 | @Override |
| 114 | public String validateToken() throws RemoteException { | 128 | public String validateToken() throws RemoteException { |
| 115 | return null; | 129 | return null; |
| 116 | } | 130 | } |
| 117 | 131 | ||
| 118 | @Override | 132 | @Override |
| 119 | public String getDeviceID() throws RemoteException { | 133 | public String getDeviceID() throws RemoteException { |
| 120 | return null; | 134 | return null; |
| 121 | } | 135 | } |
| 122 | 136 | ||
| 123 | @Override | 137 | @Override |
| 124 | public String getChildsInfo() throws RemoteException { | 138 | public String getChildsInfo() throws RemoteException { |
| 125 | return null; | 139 | return null; |
| 126 | } | 140 | } |
| 127 | }; | 141 | }; |
| 128 | 142 | ||
| 129 | @Override | 143 | @Override |
| 130 | public IBinder onBind(Intent intent) { | 144 | public IBinder onBind(Intent intent) { |
| 131 | return binder; | 145 | return binder; |
| 132 | } | 146 | } |
| 147 | |||
| 148 | @Override | ||
| 149 | public void onDestroy() { | ||
| 150 | super.onDestroy(); | ||
| 151 | } | ||
| 133 | } | 152 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/StaticReceiver.java
| File was created | 1 | package com.hjx.personalcenter.service; | |
| 2 | |||
| 3 | import android.content.BroadcastReceiver; | ||
| 4 | import android.content.Context; | ||
| 5 | import android.content.Intent; | ||
| 6 | import android.util.Log; | ||
| 7 | |||
| 8 | /** | ||
| 9 | * Created by h on 2017/11/20. | ||
| 10 | */ | ||
| 11 | |||
| 12 | public class StaticReceiver extends BroadcastReceiver { | ||
| 13 | @Override | ||
| 14 | public void onReceive(Context context, Intent intent) { | ||
| 15 | String info = intent.getStringExtra("info"); | ||
| 16 | Log.i("---","onReceive"); | ||
| 17 | // 处理消息 | ||
| 18 | // Toast.makeText(context, info, Toast.LENGTH_LONG).show(); | ||
| 19 | } | ||
| 20 | } | ||
| 21 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/GetDevicesUtil.java
| 1 | package com.hjx.personalcenter.util; | 1 | package com.hjx.personalcenter.util; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.net.wifi.WifiInfo; | 4 | import android.net.wifi.WifiInfo; |
| 5 | import android.net.wifi.WifiManager; | 5 | import android.net.wifi.WifiManager; |
| 6 | import android.provider.Settings; | 6 | import android.os.Build; |
| 7 | import android.telephony.TelephonyManager; | ||
| 8 | import android.util.Log; | 7 | import android.util.Log; |
| 9 | 8 | ||
| 10 | import com.hjx.personalcenter.model.DeviceInfo; | 9 | import com.hjx.personalcenter.model.DeviceInfo; |
| 11 | 10 | ||
| 12 | 11 | ||
| 13 | public class GetDevicesUtil { | 12 | public class GetDevicesUtil { |
| 14 | private final static String LOG_TAG = "GetDevicesUtil"; | 13 | private final static String LOG_TAG = "GetDevicesUtil"; |
| 15 | 14 | ||
| 16 | public static DeviceInfo getDevicesInfo(Context context){ | 15 | public static DeviceInfo getDevicesInfo(Context context){ |
| 17 | DeviceInfo mDeviceInfo = new DeviceInfo(); | 16 | DeviceInfo mDeviceInfo = new DeviceInfo(); |
| 18 | initDevicesInfo(mDeviceInfo,context); | 17 | initDevicesInfo(mDeviceInfo,context); |
| 19 | 18 | ||
| 20 | return mDeviceInfo; | 19 | return mDeviceInfo; |
| 21 | } | 20 | } |
| 22 | 21 | ||
| 23 | public static void initDevicesInfo(DeviceInfo mDeviceInfo,Context context){ | 22 | public static void initDevicesInfo(DeviceInfo mDeviceInfo,Context context){ |
| 23 | //if (PermissionUtil.hasReadExternalStoragePermission((Activity) context)) | ||
| 24 | mDeviceInfo.setDeviceModel(android.os.Build.MODEL); | 24 | mDeviceInfo.setDeviceModel(android.os.Build.MODEL); |
| 25 | Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceModel()); | 25 | Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceModel()); |
| 26 | mDeviceInfo.setMac(getMacAddress(context)); | 26 | mDeviceInfo.setMac(getMacAddress(context)); |
| 27 | Log.e(LOG_TAG,"" + mDeviceInfo.getMac()); | 27 | Log.e(LOG_TAG,"" + mDeviceInfo.getMac()); |
| 28 | 28 | ||
| 29 | mDeviceInfo.setDeviceNumber(getCPUSerial(context)); | 29 | mDeviceInfo.setDeviceNumber(getCPUSerial(context)); |
| 30 | Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceNumber()); | 30 | Log.e(LOG_TAG,"" + mDeviceInfo.getDeviceNumber()); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | private static String getCPUSerial(Context context) { | 33 | private static String getCPUSerial(Context context) { |
| 34 | String cpuAddress = null; | 34 | //String androidID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); |
| 35 | TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); | 35 | String cpuAddress = Build.SERIAL; |
| 36 | if (mTelephony.getDeviceId() != null) { | 36 | // String cpuAddress = null; |
| 37 | cpuAddress = mTelephony.getDeviceId(); | 37 | // TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); |
| 38 | } else { | 38 | // //if (PermissionUtil.hasReadExternalStoragePermission((Activity) context)) |
| 39 | //android.provider.Settings; | 39 | // if (mTelephony.getDeviceId() != null) { |
| 40 | cpuAddress = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID); | 40 | // cpuAddress = mTelephony.getDeviceId(); |
| 41 | } | 41 | // } else { |
| 42 | // //android.provider.Settings; | ||
| 43 | // cpuAddress = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID); | ||
| 44 | // } | ||
| 42 | return cpuAddress; | 45 | return cpuAddress; |
| 43 | } | 46 | } |
| 44 | 47 | ||
| 45 | private static String getMacAddress(Context mContext){ | 48 | private static String getMacAddress(Context mContext){ |
| 46 | 49 | ||
| 47 | String ret = null; | 50 | String ret = null; |
| 48 | try { | 51 | try { |
| 49 | WifiManager manager = (WifiManager)mContext.getSystemService(Context.WIFI_SERVICE); | 52 | WifiManager manager = (WifiManager)mContext.getSystemService(Context.WIFI_SERVICE); |
| 50 | WifiInfo info = manager.getConnectionInfo(); | 53 | WifiInfo info = manager.getConnectionInfo(); |
| 51 | ret = info.getMacAddress(); | 54 | ret = info.getMacAddress(); |
| 52 | } catch (Exception e) { | 55 | } catch (Exception e) { |
| 53 | Log.e(LOG_TAG, "get wifi address wrong", e); | 56 | Log.e(LOG_TAG, "get wifi address wrong", e); |
| 54 | } | 57 | } |
| 55 | Log.i(LOG_TAG, "wifi address is" + ret); | 58 | Log.i(LOG_TAG, "wifi address is" + ret); |
| 56 | return ret; | 59 | return ret; |
| 57 | } | 60 | } |
| 58 | } | 61 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/ISGradeChange.java
| File was created | 1 | package com.hjx.personalcenter.util; | |
| 2 | |||
| 3 | /** | ||
| 4 | * Created by h on 2017/11/20. | ||
| 5 | */ | ||
| 6 | |||
| 7 | public class ISGradeChange { | ||
| 8 | |||
| 9 | public boolean isgradechange(int grade) { | ||
| 10 | if (grade>7){ | ||
| 11 | return true; | ||
| 12 | } | ||
| 13 | return false; | ||
| 14 | } | ||
| 15 | } | ||
| 16 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/PermissionUtil.java
| 1 | package com.hjx.personalcenter.util; | 1 | package com.hjx.personalcenter.util; |
| 2 | 2 | ||
| 3 | import android.Manifest; | 3 | import android.Manifest; |
| 4 | import android.app.Activity; | 4 | import android.app.Activity; |
| 5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
| 6 | import android.os.Build; | 6 | import android.os.Build; |
| 7 | import android.support.v4.app.ActivityCompat; | 7 | import android.support.v4.app.ActivityCompat; |
| 8 | import android.support.v4.content.ContextCompat; | 8 | import android.support.v4.content.ContextCompat; |
| 9 | import android.support.v4.util.SimpleArrayMap; | 9 | import android.support.v4.util.SimpleArrayMap; |
| 10 | import android.util.Log; | 10 | import android.util.Log; |
| 11 | 11 | ||
| 12 | /** | 12 | /** |
| 13 | * Created by yf on 2016/7/22 0022. | 13 | * Created by yf on 2016/7/22 0022. |
| 14 | */ | 14 | */ |
| 15 | public class PermissionUtil { | 15 | public class PermissionUtil { |
| 16 | public static final int REQUEST_SHOWCAMERA = 0; | 16 | public static final int REQUEST_SHOWCAMERA = 0; |
| 17 | public static final int REQUEST_READ_EXTERNAL_STORAGE = 1; | 17 | public static final int READ_PHONE_STATE = 1; |
| 18 | public static final int REQUEST_RECORD_AUDIO = 2; | 18 | public static final int REQUEST_RECORD_AUDIO = 2; |
| 19 | public static final int REQUEST_CONTACTS = 3; | 19 | public static final int REQUEST_CONTACTS = 3; |
| 20 | public static final int REQUEST_LOCATION = 4; | 20 | public static final int REQUEST_LOCATION = 4; |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | private static final SimpleArrayMap<String, Integer> MIN_SDK_PERMISSIONS; | 23 | private static final SimpleArrayMap<String, Integer> MIN_SDK_PERMISSIONS; |
| 24 | static { | 24 | static { |
| 25 | MIN_SDK_PERMISSIONS = new SimpleArrayMap<>(8); | 25 | MIN_SDK_PERMISSIONS = new SimpleArrayMap<>(8); |
| 26 | MIN_SDK_PERMISSIONS.put("com.android.voicemail.permission.ADD_VOICEMAIL", 14); | 26 | MIN_SDK_PERMISSIONS.put("com.android.voicemail.permission.ADD_VOICEMAIL", 14); |
| 27 | MIN_SDK_PERMISSIONS.put("android.permission.BODY_SENSORS", 20); | 27 | MIN_SDK_PERMISSIONS.put("android.permission.BODY_SENSORS", 20); |
| 28 | MIN_SDK_PERMISSIONS.put("android.permission.READ_CALL_LOG", 16); | 28 | MIN_SDK_PERMISSIONS.put("android.permission.READ_CALL_LOG", 16); |
| 29 | MIN_SDK_PERMISSIONS.put("android.permission.READ_EXTERNAL_STORAGE", 16); | 29 | MIN_SDK_PERMISSIONS.put("android.permission.READ_EXTERNAL_STORAGE", 16); |
| 30 | MIN_SDK_PERMISSIONS.put("android.permission.USE_SIP", 9); | 30 | MIN_SDK_PERMISSIONS.put("android.permission.USE_SIP", 9); |
| 31 | MIN_SDK_PERMISSIONS.put("android.permission.WRITE_CALL_LOG", 16); | 31 | MIN_SDK_PERMISSIONS.put("android.permission.WRITE_CALL_LOG", 16); |
| 32 | MIN_SDK_PERMISSIONS.put("android.permission.SYSTEM_ALERT_WINDOW", 23); | 32 | MIN_SDK_PERMISSIONS.put("android.permission.SYSTEM_ALERT_WINDOW", 23); |
| 33 | MIN_SDK_PERMISSIONS.put("android.permission.WRITE_SETTINGS", 23); | 33 | MIN_SDK_PERMISSIONS.put("android.permission.WRITE_SETTINGS", 23); |
| 34 | MIN_SDK_PERMISSIONS.put("android.permission.READ_PHONE_STATE", 23); | ||
| 34 | } | 35 | } |
| 35 | private static boolean permissionExists(String permission) { | 36 | private static boolean permissionExists(String permission) { |
| 36 | Integer minVersion = MIN_SDK_PERMISSIONS.get(permission); | 37 | Integer minVersion = MIN_SDK_PERMISSIONS.get(permission); |
| 37 | return minVersion == null || Build.VERSION.SDK_INT >= minVersion; | 38 | return minVersion == null || Build.VERSION.SDK_INT >= minVersion; |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 41 | |||
| 40 | public static boolean hasCameraPermission(Activity activity){ | 42 | public static boolean hasCameraPermission(Activity activity){ |
| 41 | int hasPermission = ContextCompat.checkSelfPermission(activity, | 43 | int hasPermission = ContextCompat.checkSelfPermission(activity, |
| 42 | Manifest.permission.CAMERA); | 44 | Manifest.permission.CAMERA); |
| 43 | if(!permissionExists(Manifest.permission.CAMERA)){ | 45 | if(!permissionExists(Manifest.permission.CAMERA)){ |
| 44 | Log.e("permission","your system does not suppport"+ Manifest.permission.CAMERA+" permission"); | 46 | Log.e("permission","your system does not suppport"+ Manifest.permission.CAMERA+" permission"); |
| 45 | return false; | 47 | return false; |
| 46 | } | 48 | } |
| 47 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { | 49 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { |
| 48 | ActivityCompat.requestPermissions(activity, | 50 | ActivityCompat.requestPermissions(activity, |
| 49 | new String[]{Manifest.permission.CAMERA}, | 51 | new String[]{Manifest.permission.CAMERA}, |
| 50 | PermissionUtil.REQUEST_SHOWCAMERA); | 52 | PermissionUtil.REQUEST_SHOWCAMERA); |
| 51 | return false; | 53 | return false; |
| 52 | } | 54 | } |
| 53 | return true; | 55 | return true; |
| 54 | } | 56 | } |
| 55 | 57 | ||
| 56 | public static boolean hasReadExternalStoragePermission(Activity activity){ | 58 | public static boolean hasReadExternalStoragePermission(Activity activity){ |
| 57 | int hasPermission = ContextCompat.checkSelfPermission(activity, | 59 | int hasPermission = ContextCompat.checkSelfPermission(activity, |
| 58 | Manifest.permission.READ_EXTERNAL_STORAGE); | 60 | Manifest.permission.READ_PHONE_STATE); |
| 59 | if(!permissionExists(Manifest.permission.READ_EXTERNAL_STORAGE)){ | 61 | if(!permissionExists(Manifest.permission.READ_PHONE_STATE)){ |
| 60 | Log.e("permission","your system does not suppport "+ Manifest.permission.READ_EXTERNAL_STORAGE+" permission"); | 62 | Log.e("permission","your system does not suppport "+ Manifest.permission.READ_PHONE_STATE+" permission"); |
| 61 | return false; | 63 | return false; |
| 62 | } | 64 | } |
| 63 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { | 65 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { |
| 64 | ActivityCompat.requestPermissions(activity, | 66 | ActivityCompat.requestPermissions(activity, |
| 65 | new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, | 67 | new String[]{Manifest.permission.READ_PHONE_STATE}, |
| 66 | PermissionUtil.REQUEST_READ_EXTERNAL_STORAGE); | 68 | PermissionUtil.READ_PHONE_STATE); |
| 67 | return false; | 69 | return false; |
| 68 | } | 70 | } |
| 69 | return true; | 71 | return true; |
| 70 | } | 72 | } |
| 71 | public static boolean hasRecordAudioPermission(Activity activity){ | 73 | public static boolean hasRecordAudioPermission(Activity activity){ |
| 72 | int hasPermission = ContextCompat.checkSelfPermission(activity, | 74 | int hasPermission = ContextCompat.checkSelfPermission(activity, |
| 73 | Manifest.permission.RECORD_AUDIO); | 75 | Manifest.permission.RECORD_AUDIO); |
| 74 | if(!permissionExists(Manifest.permission.RECORD_AUDIO)){ | 76 | if(!permissionExists(Manifest.permission.RECORD_AUDIO)){ |
| 75 | Log.e("permission","your system does not suppport"+ Manifest.permission.RECORD_AUDIO+" permission"); | 77 | Log.e("permission","your system does not suppport"+ Manifest.permission.RECORD_AUDIO+" permission"); |
| 76 | return false; | 78 | return false; |
| 77 | } | 79 | } |
| 78 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { | 80 | if (hasPermission != PackageManager.PERMISSION_GRANTED) { |
| 79 | ActivityCompat.requestPermissions(activity, | 81 | ActivityCompat.requestPermissions(activity, |
| 80 | new String[]{Manifest.permission.RECORD_AUDIO}, | 82 | new String[]{Manifest.permission.RECORD_AUDIO}, |
| 81 | PermissionUtil.REQUEST_RECORD_AUDIO); | 83 | PermissionUtil.REQUEST_RECORD_AUDIO); |
| 82 | return false; | 84 | return false; |
| 83 | } | 85 | } |
| 84 | return true; | 86 | return true; |
| 85 | } | 87 | } |
| 86 | 88 | ||
| 87 | public static boolean hasContactsPermission(Activity activity){ | 89 | public static boolean hasContactsPermission(Activity activity){ |
| 88 | int hasWPermission = ContextCompat.checkSelfPermission(activity, | 90 | int hasWPermission = ContextCompat.checkSelfPermission(activity, |
| 89 | Manifest.permission.WRITE_CONTACTS); | 91 | Manifest.permission.WRITE_CONTACTS); |
| 90 | int hasRPermission = ContextCompat.checkSelfPermission(activity, | 92 | int hasRPermission = ContextCompat.checkSelfPermission(activity, |
| 91 | Manifest.permission.READ_CONTACTS); | 93 | Manifest.permission.READ_CONTACTS); |
| 92 | 94 | ||
| 93 | if(hasRPermission== PackageManager.PERMISSION_GRANTED && hasWPermission== PackageManager.PERMISSION_GRANTED){ | 95 | if(hasRPermission== PackageManager.PERMISSION_GRANTED && hasWPermission== PackageManager.PERMISSION_GRANTED){ |
| 94 | return true; | 96 | return true; |
| 95 | } | 97 | } |
| 96 | ActivityCompat.requestPermissions(activity, | 98 | ActivityCompat.requestPermissions(activity, |
| 97 | new String[]{Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS}, | 99 | new String[]{Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS}, |
| 98 | PermissionUtil.REQUEST_CONTACTS); | 100 | PermissionUtil.REQUEST_CONTACTS); |
| 99 | return false; | 101 | return false; |
| 100 | } | 102 | } |
| 101 | public static boolean hasLocationPermission(Activity activity){ | 103 | public static boolean hasLocationPermission(Activity activity){ |
| 102 | int hasFPermission = ContextCompat.checkSelfPermission(activity, | 104 | int hasFPermission = ContextCompat.checkSelfPermission(activity, |
| 103 | Manifest.permission.ACCESS_FINE_LOCATION); | 105 | Manifest.permission.ACCESS_FINE_LOCATION); |
| 104 | int hasCPermission = ContextCompat.checkSelfPermission(activity, | 106 | int hasCPermission = ContextCompat.checkSelfPermission(activity, |
| 105 | Manifest.permission.ACCESS_COARSE_LOCATION); | 107 | Manifest.permission.ACCESS_COARSE_LOCATION); |
| 106 | 108 | ||
| 107 | if(hasFPermission== PackageManager.PERMISSION_GRANTED&&hasCPermission== PackageManager.PERMISSION_GRANTED){ | 109 | if(hasFPermission== PackageManager.PERMISSION_GRANTED&&hasCPermission== PackageManager.PERMISSION_GRANTED){ |
| 108 | return true; | 110 | return true; |
| 109 | } | 111 | } |
| 110 | ActivityCompat.requestPermissions(activity, | 112 | ActivityCompat.requestPermissions(activity, |
| 111 | new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, | 113 | new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, |
| 112 | PermissionUtil.REQUEST_LOCATION); | 114 | PermissionUtil.REQUEST_LOCATION); |
| 113 | return false; | 115 | return false; |
| 114 | } | 116 | } |
| 115 | 117 | ||
| 116 | } | 118 | } |
| 117 | 119 |
PersonalCenter/app/src/main/res/drawable/corcle_blue_bg.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:shape="rectangle"> | 3 | android:shape="rectangle"> |
| 4 | <solid | 4 | <solid |
| 5 | android:color="@color/white"/> | 5 | android:color="@color/white"/> |
| 6 | <corners | 6 | <corners |
| 7 | android:bottomLeftRadius="20dp" | 7 | android:bottomLeftRadius="10dp" |
| 8 | android:topLeftRadius="20dp" | 8 | android:topLeftRadius="10dp" |
| 9 | android:bottomRightRadius="20dp" | 9 | android:bottomRightRadius="10dp" |
| 10 | android:topRightRadius="20dp"/> | 10 | android:topRightRadius="10dp"/> |
| 11 | <stroke android:width="1dp" | 11 | <stroke android:width="1dp" |
| 12 | android:color="@color/login_text_blue"/> | 12 | android:color="@color/login_text_blue"/> |
| 13 | </shape> | 13 | </shape> |
PersonalCenter/app/src/main/res/drawable/radio_button.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <selector xmlns:android="http://schemas.android.com/apk/res/android"> | 2 | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | 3 | ||
| 4 | <item android:drawable="@drawable/xuanzhong" | 4 | <item android:drawable="@drawable/xuanzhong" |
| 5 | android:state_checked="true" | 5 | android:state_checked="true" |
| 6 | android:state_enabled="true" | 6 | android:state_enabled="true" |
| 7 | /> | ||
| 8 | 7 | ||
| 9 | 8 | ||
| 9 | /> | ||
| 10 |
PersonalCenter/app/src/main/res/layout/activity_account_management.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
| 6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 7 | 7 | ||
| 8 | <RelativeLayout | 8 | <RelativeLayout |
| 9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
| 10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
| 12 | android:background="@color/login_text_blue" | 12 | android:background="@color/login_text_blue" |
| 13 | android:minHeight="50dp"> | 13 | android:minHeight="50dp"> |
| 14 | 14 | ||
| 15 | <ImageView | 15 | <ImageView |
| 16 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
| 17 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
| 18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
| 19 | android:layout_centerVertical="true" | 19 | android:layout_centerVertical="true" |
| 20 | android:paddingLeft="20dp" | 20 | android:paddingLeft="20dp" |
| 21 | android:paddingRight="20dp" | 21 | android:paddingRight="20dp" |
| 22 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
| 23 | 23 | ||
| 24 | <TextView | 24 | <TextView |
| 25 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
| 26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
| 27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
| 28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
| 29 | android:text="@string/account_management" | 29 | android:text="@string/account_management" |
| 30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
| 31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
| 32 | </RelativeLayout> | 32 | </RelativeLayout> |
| 33 | 33 | ||
| 34 | <LinearLayout | 34 | <LinearLayout |
| 35 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
| 36 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
| 37 | android:layout_margin="20dp" | 37 | android:layout_margin="20dp" |
| 38 | android:gravity="center_vertical" | 38 | android:gravity="center_vertical" |
| 39 | android:orientation="horizontal"> | 39 | android:orientation="horizontal"> |
| 40 | 40 | ||
| 41 | <View | 41 | <View |
| 42 | android:layout_width="5dp" | 42 | android:layout_width="5dp" |
| 43 | android:layout_height="20dp" | 43 | android:layout_height="20dp" |
| 44 | android:background="@color/login_text_blue"> | 44 | android:background="@color/login_text_blue"> |
| 45 | 45 | ||
| 46 | </View> | 46 | </View> |
| 47 | 47 | ||
| 48 | <TextView | 48 | <TextView |
| 49 | android:layout_width="wrap_content" | 49 | android:layout_width="wrap_content" |
| 50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
| 51 | android:layout_marginLeft="5dp" | 51 | android:layout_marginLeft="5dp" |
| 52 | android:text="账户安全" | 52 | android:text="账户安全" |
| 53 | android:textSize="22sp" /> | 53 | android:textSize="22sp" /> |
| 54 | 54 | ||
| 55 | </LinearLayout> | 55 | </LinearLayout> |
| 56 | 56 | ||
| 57 | <LinearLayout | 57 | <LinearLayout |
| 58 | android:layout_width="match_parent" | 58 | android:layout_width="match_parent" |
| 59 | android:layout_height="wrap_content" | 59 | android:layout_height="wrap_content" |
| 60 | android:layout_marginLeft="60dp" | 60 | android:layout_marginLeft="60dp" |
| 61 | android:orientation="vertical"> | 61 | android:orientation="vertical"> |
| 62 | 62 | ||
| 63 | <LinearLayout | 63 | <LinearLayout |
| 64 | android:layout_width="match_parent" | 64 | android:layout_width="match_parent" |
| 65 | android:layout_height="wrap_content"> | 65 | android:layout_height="wrap_content"> |
| 66 | 66 | ||
| 67 | 67 | ||
| 68 | <TextView | 68 | <TextView |
| 69 | android:layout_width="0dp" | 69 | android:layout_width="0dp" |
| 70 | android:layout_height="wrap_content" | 70 | android:layout_height="wrap_content" |
| 71 | android:layout_weight="1.5" | 71 | android:layout_weight="1.5" |
| 72 | android:text="当前绑定手机号" | 72 | android:text="当前绑定手机号" |
| 73 | android:textSize="22sp" /> | 73 | android:textSize="22sp" /> |
| 74 | 74 | ||
| 75 | <TextView | 75 | <TextView |
| 76 | android:id="@+id/cunt_username" | 76 | android:id="@+id/cunt_username" |
| 77 | android:layout_width="0dp" | 77 | android:layout_width="0dp" |
| 78 | android:layout_height="wrap_content" | 78 | android:layout_height="wrap_content" |
| 79 | android:layout_marginLeft="50dp" | 79 | android:layout_marginLeft="50dp" |
| 80 | android:layout_weight="6" | 80 | android:layout_weight="6" |
| 81 | android:text="" | 81 | android:text="" |
| 82 | android:textSize="22sp" /> | 82 | android:textSize="22sp" /> |
| 83 | 83 | ||
| 84 | <TextView | 84 | <TextView |
| 85 | android:id="@+id/changBangding" | 85 | android:id="@+id/changBangding" |
| 86 | android:layout_width="0dp" | 86 | android:layout_width="0dp" |
| 87 | android:layout_height="wrap_content" | 87 | android:layout_height="wrap_content" |
| 88 | android:layout_weight="1" | 88 | android:layout_weight="1" |
| 89 | android:text="更换绑定" | 89 | android:text="更换绑定" |
| 90 | android:gravity="center" | ||
| 91 | android:textColor="@color/white" | ||
| 92 | android:background="@drawable/blue_btn_bg_pressed" | ||
| 90 | android:textSize="22sp" /> | 93 | android:textSize="22sp" /> |
| 91 | 94 | ||
| 92 | <ImageView | 95 | <ImageView |
| 93 | android:layout_width="wrap_content" | 96 | android:layout_width="wrap_content" |
| 94 | android:layout_height="wrap_content" | 97 | android:layout_height="wrap_content" |
| 95 | android:layout_weight="0.1" | 98 | android:layout_weight="0.1" |
| 96 | android:padding="10dp" | 99 | android:padding="10dp" |
| 97 | android:src="@mipmap/youjiantou" /> | 100 | android:src="@mipmap/youjiantou" /> |
| 98 | </LinearLayout> | 101 | </LinearLayout> |
| 99 | 102 | ||
| 100 | <LinearLayout | 103 | <LinearLayout |
| 101 | android:layout_width="match_parent" | 104 | android:layout_width="match_parent" |
| 102 | android:layout_height="wrap_content" | 105 | android:layout_height="wrap_content" |
| 103 | android:layout_marginTop="30dp"> | 106 | android:layout_marginTop="30dp"> |
| 104 | 107 | ||
| 105 | 108 | ||
| 106 | <TextView | 109 | <TextView |
| 107 | android:layout_width="0dp" | 110 | android:layout_width="0dp" |
| 108 | android:layout_height="wrap_content" | 111 | android:layout_height="wrap_content" |
| 109 | android:layout_weight="1.5" | 112 | android:layout_weight="1.5" |
| 110 | android:text="登录密码" | 113 | android:text="登录密码" |
| 111 | android:textSize="22sp" /> | 114 | android:textSize="22sp" /> |
| 112 | 115 | ||
| 113 | <TextView | 116 | <TextView |
| 114 | android:layout_width="0dp" | 117 | android:layout_width="0dp" |
| 115 | android:layout_height="wrap_content" | 118 | android:layout_height="wrap_content" |
| 116 | android:layout_marginLeft="50dp" | 119 | android:layout_marginLeft="50dp" |
| 117 | android:layout_weight="6" | 120 | android:layout_weight="6" |
| 118 | android:text="已设置" | 121 | android:text="已设置" |
| 119 | android:textSize="22sp" /> | 122 | android:textSize="22sp" /> |
| 120 | 123 | ||
| 121 | <TextView | 124 | <TextView |
| 122 | android:id="@+id/changpassword" | 125 | android:id="@+id/changpassword" |
| 123 | android:layout_width="0dp" | 126 | android:layout_width="0dp" |
| 124 | android:layout_height="wrap_content" | 127 | android:layout_height="wrap_content" |
| 125 | android:layout_weight="1" | 128 | android:layout_weight="1" |
| 126 | android:text="修改密码" | 129 | android:text="修改密码" |
| 130 | android:gravity="center" | ||
| 131 | android:textColor="@color/white" | ||
| 132 | android:background="@drawable/blue_btn_bg_pressed" | ||
| 127 | android:textSize="22sp" /> | 133 | android:textSize="22sp" /> |
| 128 | 134 | ||
| 129 | <ImageView | 135 | <ImageView |
| 130 | android:layout_width="wrap_content" | 136 | android:layout_width="wrap_content" |
| 131 | android:layout_height="wrap_content" | 137 | android:layout_height="wrap_content" |
| 132 | android:layout_weight="0.1" | 138 | android:layout_weight="0.1" |
| 133 | android:padding="10dp" | 139 | android:padding="10dp" |
| 134 | android:src="@mipmap/youjiantou" /> | 140 | android:src="@mipmap/youjiantou" /> |
| 135 | </LinearLayout> | 141 | </LinearLayout> |
| 136 | 142 | ||
| 137 | </LinearLayout> | 143 | </LinearLayout> |
| 138 | 144 | ||
| 139 | <View | 145 | <View |
| 140 | android:layout_width="match_parent" | 146 | android:layout_width="match_parent" |
| 141 | android:layout_height="0.7dp" | 147 | android:layout_height="0.7dp" |
| 142 | android:layout_margin="20dp" | 148 | android:layout_margin="20dp" |
| 143 | android:background="#FF909090" /> | 149 | android:background="#FF909090" /> |
| 144 | 150 | ||
| 145 | <LinearLayout | 151 | <LinearLayout |
| 146 | android:layout_width="wrap_content" | 152 | android:layout_width="wrap_content" |
| 147 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
| 148 | android:layout_margin="20dp" | 154 | android:layout_margin="20dp" |
| 149 | android:gravity="center_vertical" | 155 | android:gravity="center_vertical" |
| 150 | android:orientation="horizontal"> | 156 | android:orientation="horizontal"> |
| 151 | 157 | ||
| 152 | <View | 158 | <View |
| 153 | android:layout_width="5dp" | 159 | android:layout_width="5dp" |
| 154 | android:layout_height="20dp" | 160 | android:layout_height="20dp" |
| 155 | android:background="@color/login_text_blue"> | 161 | android:background="@color/login_text_blue"> |
| 156 | 162 | ||
| 157 | </View> | 163 | </View> |
| 158 | 164 | ||
| 159 | <TextView | 165 | <TextView |
| 160 | android:layout_width="wrap_content" | 166 | android:layout_width="wrap_content" |
| 161 | android:layout_height="wrap_content" | 167 | android:layout_height="wrap_content" |
| 162 | android:layout_marginLeft="5dp" | 168 | android:layout_marginLeft="5dp" |
| 163 | android:text="子账户管理" | 169 | android:text="子账户管理" |
| 164 | android:textSize="22sp" /> | 170 | android:textSize="22sp" /> |
| 165 | 171 | ||
| 166 | </LinearLayout> | 172 | </LinearLayout> |
| 167 | 173 | ||
| 168 | <LinearLayout | 174 | <LinearLayout |
| 169 | android:layout_width="match_parent" | 175 | android:layout_width="match_parent" |
| 170 | android:layout_height="match_parent" | 176 | android:layout_height="match_parent" |
| 171 | android:layout_marginLeft="30dp" | 177 | android:layout_marginLeft="30dp" |
| 172 | android:orientation="vertical"> | 178 | android:orientation="vertical"> |
| 173 | 179 | ||
| 174 | <LinearLayout | 180 | <LinearLayout |
| 175 | android:layout_width="match_parent" | 181 | android:layout_width="match_parent" |
| 176 | android:layout_height="wrap_content"> | 182 | android:layout_height="wrap_content"> |
| 177 | 183 | ||
| 178 | <LinearLayout | 184 | <LinearLayout |
| 179 | android:layout_width="0dp" | 185 | android:layout_width="0dp" |
| 180 | android:layout_height="wrap_content" | 186 | android:layout_height="wrap_content" |
| 181 | android:layout_weight="1"> | 187 | android:layout_weight="1"> |
| 182 | 188 | ||
| 183 | <LinearLayout | 189 | <LinearLayout |
| 184 | android:id="@+id/ll_zhu_backgrangd" | 190 | android:id="@+id/ll_zhu_backgrangd" |
| 185 | android:layout_width="400dp" | 191 | android:layout_width="400dp" |
| 186 | android:layout_height="wrap_content" | 192 | android:layout_height="wrap_content" |
| 187 | android:layout_marginLeft="5dp" | 193 | android:layout_marginLeft="5dp" |
| 188 | android:background="@drawable/corcle_blue_bg" | 194 | android:background="@drawable/corcle_blue_bg" |
| 189 | android:orientation="vertical"> | 195 | android:orientation="vertical"> |
| 190 | 196 | ||
| 191 | <LinearLayout | 197 | <LinearLayout |
| 192 | android:layout_width="match_parent" | 198 | android:layout_width="match_parent" |
| 193 | android:layout_height="wrap_content" | 199 | android:layout_height="wrap_content" |
| 200 | android:background="@mipmap/bg_zhuzhanghu" | ||
| 194 | android:orientation="horizontal"> | 201 | android:orientation="horizontal"> |
| 195 | 202 | ||
| 196 | <com.facebook.drawee.view.SimpleDraweeView | 203 | <com.facebook.drawee.view.SimpleDraweeView |
| 197 | android:id="@+id/tv_account_head" | 204 | android:id="@+id/tv_account_head" |
| 198 | android:layout_width="60dp" | 205 | android:layout_width="60dp" |
| 199 | android:layout_height="60dp" | 206 | android:layout_height="60dp" |
| 200 | android:layout_margin="10dp" | 207 | android:layout_margin="10dp" |
| 201 | fresco:placeholderImage="@mipmap/header_default" | 208 | fresco:placeholderImage="@mipmap/header_default" |
| 202 | fresco:placeholderImageScaleType="fitCenter" | 209 | fresco:placeholderImageScaleType="fitCenter" |
| 203 | fresco:roundAsCircle="true" /> | 210 | fresco:roundAsCircle="true" /> |
| 204 | 211 | ||
| 205 | <LinearLayout | 212 | <LinearLayout |
| 206 | android:layout_width="0dp" | 213 | android:layout_width="0dp" |
| 207 | android:layout_height="wrap_content" | 214 | android:layout_height="wrap_content" |
| 208 | android:layout_marginLeft="10dp" | 215 | android:layout_marginLeft="10dp" |
| 209 | android:layout_marginTop="10dp" | 216 | android:layout_marginTop="10dp" |
| 210 | android:layout_weight="1" | 217 | android:layout_weight="1" |
| 211 | android:orientation="vertical"> | 218 | android:orientation="vertical"> |
| 212 | 219 | ||
| 213 | <TextView | 220 | <TextView |
| 214 | android:id="@+id/tv_account_name" | 221 | android:id="@+id/tv_account_name" |
| 215 | android:layout_width="wrap_content" | 222 | android:layout_width="wrap_content" |
| 216 | android:layout_height="wrap_content" | 223 | android:layout_height="wrap_content" |
| 217 | android:text="" | 224 | android:text="" |
| 218 | android:textSize="18sp" /> | 225 | android:textSize="18sp" /> |
| 219 | 226 | ||
| 220 | <TextView | 227 | <TextView |
| 221 | android:id="@+id/tv_account_grade" | 228 | android:id="@+id/tv_account_grade" |
| 222 | android:layout_width="wrap_content" | 229 | android:layout_width="wrap_content" |
| 223 | android:layout_height="wrap_content" | 230 | android:layout_height="wrap_content" |
| 224 | android:text="" | 231 | android:text="" |
| 225 | android:textSize="18sp" /> | 232 | android:textSize="18sp" /> |
| 226 | 233 | ||
| 227 | <TextView | 234 | <TextView |
| 228 | android:id="@+id/tv_account_school" | 235 | android:id="@+id/tv_account_school" |
| 229 | android:layout_width="wrap_content" | 236 | android:layout_width="wrap_content" |
| 230 | android:layout_height="wrap_content" | 237 | android:layout_height="wrap_content" |
| 231 | android:text="" | 238 | android:text="" |
| 232 | android:textSize="18sp" /> | 239 | android:textSize="18sp" /> |
| 233 | 240 | ||
| 234 | <TextView | 241 | <TextView |
| 235 | android:id="@+id/tv_account_adress" | 242 | android:id="@+id/tv_account_adress" |
| 236 | android:layout_width="wrap_content" | 243 | android:layout_width="wrap_content" |
| 237 | android:layout_height="wrap_content" | 244 | android:layout_height="wrap_content" |
| 238 | android:text="" | 245 | android:text="" |
| 239 | android:textSize="18sp" /> | 246 | android:textSize="18sp" /> |
| 240 | 247 | ||
| 241 | 248 | ||
| 242 | </LinearLayout> | 249 | </LinearLayout> |
| 243 | 250 | ||
| 244 | <ImageView | 251 | <ImageView |
| 245 | android:id="@+id/iv_shiyongzhong" | 252 | android:id="@+id/iv_shiyongzhong" |
| 246 | android:layout_width="wrap_content" | 253 | android:layout_width="wrap_content" |
| 247 | android:layout_height="wrap_content" | 254 | android:layout_height="wrap_content" |
| 248 | android:layout_gravity="right" | 255 | android:layout_gravity="right" |
| 249 | android:layout_marginLeft="60dp" | 256 | android:layout_marginLeft="60dp" |
| 250 | android:src="@mipmap/shiyongzhong" | 257 | android:src="@mipmap/shiyongzhong" |
| 251 | android:visibility="gone" /> | 258 | android:visibility="gone" /> |
| 252 | 259 | ||
| 253 | </LinearLayout> | 260 | </LinearLayout> |
| 254 | 261 | ||
| 255 | <View | 262 | <View |
| 256 | android:layout_width="match_parent" | 263 | android:layout_width="match_parent" |
| 257 | android:layout_height="0.7dp" | 264 | android:layout_height="0.7dp" |
| 258 | android:layout_margin="10dp" | 265 | android:layout_marginBottom="10dp" |
| 259 | android:background="@color/cutoff_line"> | 266 | android:background="@color/cutoff_line"> |
| 260 | 267 | ||
| 261 | </View> | 268 | </View> |
| 262 | 269 | ||
| 263 | <LinearLayout | 270 | <LinearLayout |
| 264 | android:layout_width="match_parent" | 271 | android:layout_width="match_parent" |
| 265 | android:layout_height="wrap_content" | 272 | android:layout_height="wrap_content" |
| 266 | android:layout_marginBottom="10dp" | 273 | android:layout_marginBottom="10dp" |
| 267 | android:orientation="horizontal"> | 274 | android:orientation="horizontal"> |
| 268 | 275 | ||
| 269 | <TextView | 276 | <TextView |
| 270 | android:id="@+id/change_zhu_account" | 277 | android:id="@+id/change_zhu_account" |
| 271 | android:layout_width="0dp" | 278 | android:layout_width="0dp" |
| 272 | android:layout_height="wrap_content" | 279 | android:layout_height="wrap_content" |
| 273 | android:layout_weight="1" | 280 | android:layout_weight="1" |
| 274 | android:gravity="center" | 281 | android:gravity="center" |
| 275 | android:text="切换主账户" | 282 | android:text="切换主账户" |
| 276 | android:textSize="18sp" /> | 283 | android:textSize="18sp" /> |
| 277 | 284 | ||
| 278 | 285 | ||
| 279 | </LinearLayout> | 286 | </LinearLayout> |
| 280 | 287 | ||
| 281 | </LinearLayout> | 288 | </LinearLayout> |
| 282 | 289 | ||
| 283 | 290 | ||
| 284 | </LinearLayout> | 291 | </LinearLayout> |
| 285 | 292 | ||
| 286 | <LinearLayout | 293 | <LinearLayout |
| 287 | android:layout_width="0dp" | 294 | android:layout_width="0dp" |
| 288 | android:layout_height="wrap_content" | 295 | android:layout_height="wrap_content" |
| 289 | android:layout_weight="1"> | 296 | android:layout_weight="1"> |
| 290 | 297 | ||
| 291 | </LinearLayout> | 298 | </LinearLayout> |
| 292 | 299 | ||
| 293 | <LinearLayout | 300 | <LinearLayout |
| 294 | android:layout_width="0dp" | 301 | android:layout_width="0dp" |
| 295 | android:layout_height="wrap_content" | 302 | android:layout_height="wrap_content" |
| 296 | android:layout_weight="1"> | 303 | android:layout_weight="1"> |
| 297 | 304 | ||
| 298 | </LinearLayout> | 305 | </LinearLayout> |
| 299 | </LinearLayout> | 306 | </LinearLayout> |
| 300 | 307 | ||
| 301 | <RelativeLayout | 308 | <RelativeLayout |
| 302 | android:layout_width="match_parent" | 309 | android:layout_width="match_parent" |
| 303 | android:layout_height="wrap_content" | 310 | android:layout_height="wrap_content" |
| 304 | android:layout_marginTop="20dp" | 311 | android:layout_marginTop="20dp" |
| 305 | android:orientation="horizontal"> | 312 | android:orientation="horizontal"> |
| 306 | 313 | ||
| 307 | <android.support.v7.widget.RecyclerView | 314 | <android.support.v7.widget.RecyclerView |
| 308 | android:id="@+id/id_recyclerview_horizontal" | 315 | android:id="@+id/id_recyclerview_horizontal" |
| 309 | android:layout_width="wrap_content" | 316 | android:layout_width="wrap_content" |
| 310 | android:layout_height="wrap_content" | 317 | android:layout_height="wrap_content" |
| 311 | android:layout_centerVertical="true" | 318 | android:layout_centerVertical="true" |
| 312 | android:scrollbars="none"> | 319 | android:scrollbars="none"> |
| 313 | 320 | ||
| 314 | </android.support.v7.widget.RecyclerView> | 321 | </android.support.v7.widget.RecyclerView> |
| 315 | 322 | ||
| 316 | 323 | ||
| 317 | 324 | ||
| 318 | </RelativeLayout> | 325 | </RelativeLayout> |
| 319 | 326 | ||
| 320 | </LinearLayout> | 327 | </LinearLayout> |
| 321 | 328 | ||
| 322 | 329 | ||
| 323 | </LinearLayout> | 330 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/activity_main.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 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 6 | android:background="@color/white" | ||
| 6 | android:orientation="vertical"> | 7 | android:orientation="vertical"> |
| 7 | 8 | ||
| 8 | <RelativeLayout | 9 | <RelativeLayout |
| 9 | android:id="@+id/title" | 10 | android:id="@+id/title" |
| 10 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 11 | android:layout_height="50dp" | 12 | android:layout_height="50dp" |
| 12 | android:background="@color/login_text_blue"> | 13 | android:background="@color/login_text_blue"> |
| 13 | 14 | ||
| 14 | <ImageView | 15 | <ImageView |
| 15 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
| 16 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
| 17 | android:layout_height="match_parent" | 18 | android:layout_height="match_parent" |
| 18 | android:paddingLeft="20dp" | 19 | android:paddingLeft="20dp" |
| 19 | android:paddingRight="20dp" | 20 | android:paddingRight="20dp" |
| 20 | android:visibility="gone" | 21 | android:visibility="gone" |
| 21 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
| 22 | 23 | ||
| 23 | <TextView | 24 | <TextView |
| 24 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
| 25 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
| 26 | android:layout_height="match_parent" | 27 | android:layout_height="match_parent" |
| 27 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
| 28 | android:gravity="center_vertical" | 29 | android:gravity="center_vertical" |
| 29 | android:text="@string/titel_preson" | 30 | android:text="@string/titel_preson" |
| 30 | android:textColor="@android:color/white" | 31 | android:textColor="@android:color/white" |
| 31 | android:textSize="22sp" /> | 32 | android:textSize="22sp" /> |
| 32 | 33 | ||
| 33 | <ImageView | 34 | <ImageView |
| 34 | android:id="@+id/iv_setting" | 35 | android:id="@+id/iv_setting" |
| 35 | android:layout_width="wrap_content" | 36 | android:layout_width="wrap_content" |
| 36 | android:layout_height="match_parent" | 37 | android:layout_height="match_parent" |
| 37 | android:layout_marginRight="10dp" | 38 | android:layout_marginRight="10dp" |
| 38 | android:layout_toLeftOf="@+id/iv_skin" | 39 | android:layout_toLeftOf="@+id/iv_skin" |
| 39 | android:gravity="center_vertical" | 40 | android:gravity="center_vertical" |
| 40 | android:padding="10dp" | 41 | android:padding="10dp" |
| 41 | android:src="@mipmap/shezhi" | 42 | android:src="@mipmap/shezhi1" |
| 42 | android:textColor="@android:color/white" | 43 | android:textColor="@android:color/white" |
| 43 | android:textSize="22sp" /> | 44 | android:textSize="22sp" /> |
| 44 | 45 | ||
| 45 | <ImageView | 46 | <ImageView |
| 46 | android:id="@+id/iv_skin" | 47 | android:id="@+id/iv_skin" |
| 47 | android:layout_width="wrap_content" | 48 | android:layout_width="wrap_content" |
| 48 | android:layout_height="match_parent" | 49 | android:layout_height="match_parent" |
| 49 | android:layout_marginRight="10dp" | 50 | android:layout_marginRight="10dp" |
| 50 | android:layout_toLeftOf="@+id/iv_imformatioan" | 51 | android:layout_toLeftOf="@+id/iv_imformatioan" |
| 51 | android:gravity="center_vertical" | 52 | android:gravity="center_vertical" |
| 52 | android:padding="10dp" | 53 | android:padding="10dp" |
| 53 | android:src="@mipmap/pifu" | 54 | android:src="@mipmap/pifu" |
| 54 | android:textColor="@android:color/white" | 55 | android:textColor="@android:color/white" |
| 56 | android:visibility="gone" | ||
| 55 | android:textSize="22sp" /> | 57 | android:textSize="22sp" /> |
| 56 | 58 | ||
| 57 | <ImageView | 59 | <ImageView |
| 58 | android:id="@+id/iv_imformatioan" | 60 | android:id="@+id/iv_imformatioan" |
| 59 | android:layout_width="wrap_content" | 61 | android:layout_width="wrap_content" |
| 60 | android:layout_height="match_parent" | 62 | android:layout_height="match_parent" |
| 61 | android:layout_alignParentRight="true" | 63 | android:layout_alignParentRight="true" |
| 62 | android:layout_marginRight="10dp" | 64 | android:layout_marginRight="10dp" |
| 63 | android:gravity="center_vertical" | 65 | android:gravity="center_vertical" |
| 64 | android:padding="10dp" | 66 | android:padding="10dp" |
| 65 | android:src="@mipmap/fankui" | 67 | android:src="@mipmap/fankui1" |
| 66 | android:textColor="@android:color/white" | 68 | android:textColor="@android:color/white" |
| 67 | android:textSize="22sp" /> | 69 | android:textSize="22sp" /> |
| 68 | 70 | ||
| 69 | 71 | ||
| 70 | </RelativeLayout> | 72 | </RelativeLayout> |
| 71 | 73 | ||
| 72 | <LinearLayout | 74 | <LinearLayout |
| 73 | android:layout_width="match_parent" | 75 | android:layout_width="match_parent" |
| 74 | android:layout_height="match_parent"> | 76 | android:layout_height="match_parent"> |
| 75 | 77 | ||
| 76 | <LinearLayout | 78 | <LinearLayout |
| 77 | android:layout_width="0dp" | 79 | android:layout_width="0dp" |
| 78 | android:layout_height="match_parent" | 80 | android:layout_height="match_parent" |
| 79 | android:layout_weight="1" | 81 | android:layout_weight="1.5" |
| 80 | android:orientation="vertical"> | 82 | android:orientation="vertical"> |
| 83 | <RelativeLayout | ||
| 84 | android:layout_width="wrap_content" | ||
| 85 | android:layout_height="250sp" | ||
| 86 | android:background="@mipmap/head_bg"> | ||
| 81 | 87 | ||
| 82 | <LinearLayout | 88 | <LinearLayout |
| 89 | android:id="@+id/ssss" | ||
| 83 | android:layout_width="match_parent" | 90 | android:layout_width="match_parent" |
| 84 | android:layout_height="wrap_content" | 91 | android:layout_height="wrap_content" |
| 85 | android:layout_marginTop="20dp" | 92 | android:layout_marginTop="28dp" |
| 93 | android:gravity="center" | ||
| 86 | android:orientation="horizontal"> | 94 | android:orientation="horizontal"> |
| 87 | <ImageView | ||
| 88 | android:id="@+id/iv_look_card" | ||
| 89 | android:layout_width="wrap_content" | ||
| 90 | android:layout_height="wrap_content" | ||
| 91 | android:padding="10dp" | ||
| 92 | android:layout_marginLeft="20dp" | ||
| 93 | android:src="@mipmap/card_icoc" /> | ||
| 94 | <com.facebook.drawee.view.SimpleDraweeView | 95 | <com.facebook.drawee.view.SimpleDraweeView |
| 95 | android:id="@+id/iv_head" | 96 | android:id="@+id/iv_head" |
| 96 | android:layout_width="60dp" | 97 | android:layout_width="65dp" |
| 97 | android:layout_height="60dp" | 98 | android:layout_height="65dp" |
| 98 | android:layout_marginLeft="60dp" | ||
| 99 | android:layout_gravity="center" | ||
| 100 | fresco:placeholderImage="@mipmap/header_default" | 99 | fresco:placeholderImage="@mipmap/header_default" |
| 101 | fresco:roundAsCircle="true" | 100 | fresco:roundAsCircle="true" |
| 102 | fresco:placeholderImageScaleType="fitCenter" /> | 101 | fresco:placeholderImageScaleType="fitCenter" /> |
| 103 | 102 | ||
| 104 | <TextView | 103 | <TextView |
| 105 | android:layout_width="wrap_content" | 104 | android:layout_width="wrap_content" |
| 106 | android:layout_height="wrap_content" | 105 | android:layout_height="wrap_content" |
| 107 | android:layout_marginLeft="18dp" | 106 | android:layout_marginLeft="18dp" |
| 108 | android:layout_marginTop="20dp" | 107 | android:layout_marginTop="20dp" |
| 109 | android:background="@drawable/corcle_blue_bg" | 108 | android:background="@drawable/corcle_blue_bg" |
| 110 | android:paddingLeft="5dp" | 109 | android:paddingLeft="5dp" |
| 111 | android:paddingRight="5dp" | 110 | android:paddingRight="5dp" |
| 112 | android:gravity="center_vertical" | 111 | android:gravity="center_vertical" |
| 113 | android:text="签到" | 112 | android:text="签到" |
| 114 | android:textColor="@color/login_text_blue" | 113 | android:textColor="@color/login_text_blue" |
| 114 | android:visibility="gone" | ||
| 115 | android:textSize="18sp" /> | 115 | android:textSize="18sp" /> |
| 116 | 116 | ||
| 117 | </LinearLayout> | 117 | </LinearLayout> |
| 118 | 118 | ||
| 119 | <LinearLayout | 119 | <LinearLayout |
| 120 | android:id="@+id/sssssss" | ||
| 120 | android:layout_width="match_parent" | 121 | android:layout_width="match_parent" |
| 121 | android:layout_height="wrap_content" | 122 | android:layout_height="wrap_content" |
| 122 | android:layout_marginLeft="20dp" | 123 | android:layout_marginLeft="20dp" |
| 124 | android:layout_below="@id/ssss" | ||
| 123 | android:layout_marginTop="20dp" | 125 | android:layout_marginTop="20dp" |
| 126 | android:gravity="center" | ||
| 124 | android:orientation="horizontal"> | 127 | android:orientation="horizontal"> |
| 125 | 128 | ||
| 126 | <TextView | 129 | <TextView |
| 127 | android:id="@+id/tv_username" | 130 | android:id="@+id/tv_username" |
| 128 | android:layout_width="wrap_content" | 131 | android:layout_width="wrap_content" |
| 129 | android:layout_height="wrap_content" | 132 | android:layout_height="wrap_content" |
| 130 | android:text="" | 133 | android:text="" |
| 131 | android:textSize="20dp" /> | 134 | android:textSize="20sp" /> |
| 132 | <TextView | 135 | <TextView |
| 133 | android:id="@+id/tv_yangji" | 136 | android:id="@+id/tv_yangji" |
| 134 | android:layout_marginLeft="5dp" | 137 | android:layout_marginLeft="5dp" |
| 135 | android:layout_width="wrap_content" | 138 | android:layout_width="wrap_content" |
| 136 | android:layout_height="wrap_content" | 139 | android:layout_height="wrap_content" |
| 137 | android:text="(样机)" | 140 | android:text="(样机)" |
| 138 | android:textSize="20dp" | 141 | android:textSize="20dp" |
| 139 | android:visibility="gone"/> | 142 | android:visibility="gone"/> |
| 140 | 143 | ||
| 141 | <ImageView | 144 | <ImageView |
| 142 | android:id="@+id/iv_sex" | 145 | android:id="@+id/iv_sex" |
| 143 | android:layout_width="wrap_content" | 146 | android:layout_width="wrap_content" |
| 144 | android:layout_height="wrap_content" | 147 | android:layout_height="wrap_content" |
| 145 | android:layout_gravity="center_vertical" | 148 | android:layout_gravity="center_vertical" |
| 146 | android:layout_marginLeft="50dp" | 149 | android:layout_marginLeft="5dp" |
| 147 | android:src="@mipmap/men" /> | 150 | android:src="@mipmap/men" /> |
| 148 | 151 | ||
| 149 | </LinearLayout> | 152 | </LinearLayout> |
| 150 | 153 | ||
| 151 | <LinearLayout | 154 | <LinearLayout |
| 155 | android:layout_below="@id/sssssss" | ||
| 152 | android:layout_width="match_parent" | 156 | android:layout_width="match_parent" |
| 153 | android:layout_height="wrap_content" | 157 | android:layout_height="wrap_content" |
| 154 | android:layout_marginLeft="20dp" | 158 | android:layout_marginLeft="20dp" |
| 155 | android:layout_marginTop="20dp" | 159 | android:layout_marginTop="10dp" |
| 156 | android:gravity="center" | 160 | android:gravity="center" |
| 157 | android:orientation="horizontal"> | 161 | android:orientation="horizontal"> |
| 158 | 162 | ||
| 159 | <TextView | 163 | <TextView |
| 160 | android:id="@+id/tv_sign" | 164 | android:id="@+id/tv_sign" |
| 161 | android:layout_width="0dp" | ||
| 162 | android:layout_height="wrap_content" | 165 | android:layout_height="wrap_content" |
| 163 | android:layout_weight="5" | 166 | android:layout_width="wrap_content" |
| 164 | android:hint="请输入个性签名" | 167 | android:hint="请输入个性签名" |
| 165 | android:maxLines="3" | 168 | android:maxLines="3" |
| 169 | android:maxLength="40" | ||
| 166 | android:ellipsize="end" | 170 | android:ellipsize="end" |
| 167 | android:textSize="18sp" /> | 171 | android:textSize="16sp" /> |
| 168 | 172 | ||
| 169 | <ImageView | 173 | <ImageView |
| 170 | android:id="@+id/iv_sign" | 174 | android:id="@+id/iv_sign" |
| 171 | android:layout_width="0dp" | 175 | android:layout_width="wrap_content" |
| 172 | android:layout_height="wrap_content" | 176 | android:layout_height="wrap_content" |
| 173 | android:layout_weight="1" | ||
| 174 | android:padding="10dp" | 177 | android:padding="10dp" |
| 175 | android:src="@mipmap/pencil" /> | 178 | android:src="@mipmap/qianming" /> |
| 176 | 179 | ||
| 177 | 180 | ||
| 178 | </LinearLayout> | 181 | </LinearLayout> |
| 179 | 182 | </RelativeLayout> | |
| 180 | <View | 183 | <View |
| 181 | android:layout_width="match_parent" | 184 | android:layout_width="match_parent" |
| 182 | android:layout_height="0.7dp" | 185 | android:layout_height="0.7dp" |
| 183 | android:layout_marginTop="20dp" | ||
| 184 | android:background="@color/cutoff_line"> | 186 | android:background="@color/cutoff_line"> |
| 185 | 187 | ||
| 186 | </View> | 188 | </View> |
| 187 | 189 | ||
| 188 | <LinearLayout | 190 | <LinearLayout |
| 189 | android:id="@+id/linel_mycuoti" | ||
| 190 | android:layout_width="match_parent" | 191 | android:layout_width="match_parent" |
| 191 | android:layout_height="wrap_content" | 192 | android:layout_height="wrap_content" |
| 192 | android:layout_marginTop="30dp" | ||
| 193 | android:orientation="vertical"> | 193 | android:orientation="vertical"> |
| 194 | 194 | ||
| 195 | <LinearLayout | 195 | <LinearLayout |
| 196 | android:layout_width="match_parent" | 196 | android:layout_width="match_parent" |
| 197 | android:layout_height="wrap_content" | 197 | android:layout_height="wrap_content" |
| 198 | android:gravity="center_vertical" | 198 | android:gravity="center_vertical" |
| 199 | android:orientation="horizontal"> | 199 | android:orientation="horizontal"> |
| 200 | 200 | ||
| 201 | <ImageView | 201 | <ImageView |
| 202 | android:layout_width="0dp" | 202 | android:layout_width="0dp" |
| 203 | android:layout_height="wrap_content" | 203 | android:layout_height="wrap_content" |
| 204 | android:layout_weight="1" | 204 | android:layout_weight="1" |
| 205 | android:src="@mipmap/wodecuoti" /> | 205 | android:paddingTop="20dp" |
| 206 | android:paddingBottom="20dp" | ||
| 207 | android:src="@mipmap/wodecuoti1" /> | ||
| 206 | 208 | ||
| 207 | <TextView | 209 | <TextView |
| 210 | android:id="@+id/linel_mycuoti" | ||
| 208 | android:layout_width="0dp" | 211 | android:layout_width="0dp" |
| 209 | android:layout_height="wrap_content" | 212 | android:layout_height="wrap_content" |
| 210 | android:layout_weight="5" | 213 | android:layout_weight="1" |
| 214 | android:paddingTop="20dp" | ||
| 215 | android:paddingBottom="20dp" | ||
| 211 | android:text="我的错题" | 216 | android:text="我的错题" |
| 212 | android:textSize="20sp" /> | 217 | android:textSize="20sp" /> |
| 218 | <View | ||
| 219 | android:layout_width="1dp" | ||
| 220 | android:layout_height="match_parent" | ||
| 221 | android:background="@color/cutoff_line"> | ||
| 213 | 222 | ||
| 214 | <ImageView | 223 | </View> |
| 215 | android:layout_width="0dp" | ||
| 216 | android:layout_height="wrap_content" | ||
| 217 | android:layout_weight="1" | ||
| 218 | android:src="@mipmap/youjiantou" /> | ||
| 219 | |||
| 220 | </LinearLayout> | ||
| 221 | |||
| 222 | <LinearLayout | ||
| 223 | android:id="@+id/linel_mynote" | ||
| 224 | android:layout_width="match_parent" | ||
| 225 | android:layout_height="wrap_content" | ||
| 226 | android:layout_marginTop="35dp" | ||
| 227 | android:gravity="center_vertical" | ||
| 228 | android:orientation="horizontal"> | ||
| 229 | 224 | ||
| 230 | <ImageView | 225 | <ImageView |
| 231 | android:layout_width="0dp" | 226 | android:layout_width="0dp" |
| 232 | android:layout_height="wrap_content" | 227 | android:layout_height="wrap_content" |
| 233 | android:layout_weight="1" | 228 | android:layout_weight="1" |
| 234 | android:src="@mipmap/wodebiji" /> | 229 | android:paddingTop="20dp" |
| 235 | 230 | android:paddingBottom="20dp" | |
| 231 | android:src="@mipmap/wodebiji1" /> | ||
| 236 | <TextView | 232 | <TextView |
| 233 | android:id="@+id/linel_mynote" | ||
| 237 | android:layout_width="0dp" | 234 | android:layout_width="0dp" |
| 238 | android:layout_height="wrap_content" | 235 | android:layout_height="wrap_content" |
| 239 | android:layout_weight="5" | 236 | android:layout_weight="1" |
| 237 | android:paddingTop="20dp" | ||
| 238 | android:paddingBottom="20dp" | ||
| 240 | android:text="我的笔记" | 239 | android:text="我的笔记" |
| 241 | android:textSize="20sp" /> | 240 | android:textSize="20sp" /> |
| 242 | 241 | ||
| 243 | <ImageView | ||
| 244 | android:layout_width="0dp" | ||
| 245 | android:layout_height="wrap_content" | ||
| 246 | android:layout_weight="1" | ||
| 247 | android:src="@mipmap/youjiantou" /> | ||
| 248 | |||
| 249 | </LinearLayout> | 242 | </LinearLayout> |
| 243 | <View | ||
| 244 | android:layout_width="match_parent" | ||
| 245 | android:layout_height="1dp" | ||
| 246 | android:background="@color/cutoff_line"> | ||
| 250 | 247 | ||
| 248 | </View> | ||
| 251 | <LinearLayout | 249 | <LinearLayout |
| 252 | android:id="@+id/linel_mycollege" | ||
| 253 | android:layout_width="match_parent" | 250 | android:layout_width="match_parent" |
| 254 | android:layout_height="wrap_content" | 251 | android:layout_height="wrap_content" |
| 255 | android:layout_marginTop="35dp" | ||
| 256 | android:gravity="center_vertical" | 252 | android:gravity="center_vertical" |
| 257 | android:orientation="horizontal"> | 253 | android:orientation="horizontal"> |
| 258 | 254 | ||
| 259 | <ImageView | 255 | <ImageView |
| 260 | android:layout_width="0dp" | 256 | android:layout_width="0dp" |
| 261 | android:layout_height="wrap_content" | 257 | android:layout_height="wrap_content" |
| 262 | android:layout_weight="1" | 258 | android:layout_weight="1" |
| 259 | android:paddingTop="20dp" | ||
| 260 | android:paddingBottom="20dp" | ||
| 263 | android:src="@mipmap/wodeshoucang" /> | 261 | android:src="@mipmap/wodeshoucang" /> |
| 264 | 262 | ||
| 265 | <TextView | 263 | <TextView |
| 264 | android:id="@+id/linel_mycollege" | ||
| 266 | android:layout_width="0dp" | 265 | android:layout_width="0dp" |
| 267 | android:layout_height="wrap_content" | 266 | android:layout_height="wrap_content" |
| 268 | android:layout_weight="5" | 267 | android:layout_weight="1" |
| 268 | android:paddingTop="20dp" | ||
| 269 | android:paddingBottom="20dp" | ||
| 269 | android:text="我的收藏" | 270 | android:text="我的收藏" |
| 270 | android:textSize="20sp" /> | 271 | android:textSize="20sp" /> |
| 272 | <View | ||
| 273 | android:layout_width="1dp" | ||
| 274 | android:layout_height="match_parent" | ||
| 275 | android:background="@color/cutoff_line"> | ||
| 271 | 276 | ||
| 272 | <ImageView | 277 | </View> |
| 273 | android:layout_width="0dp" | ||
| 274 | android:layout_height="wrap_content" | ||
| 275 | android:layout_weight="1" | ||
| 276 | android:src="@mipmap/youjiantou" /> | ||
| 277 | |||
| 278 | </LinearLayout> | ||
| 279 | |||
| 280 | <LinearLayout | ||
| 281 | android:id="@+id/linel_myclass" | ||
| 282 | android:layout_width="match_parent" | ||
| 283 | android:layout_height="wrap_content" | ||
| 284 | android:layout_marginTop="35dp" | ||
| 285 | android:gravity="center_vertical" | ||
| 286 | android:orientation="horizontal"> | ||
| 287 | 278 | ||
| 288 | <ImageView | 279 | <ImageView |
| 289 | android:layout_width="0dp" | 280 | android:layout_width="0dp" |
| 290 | android:layout_height="wrap_content" | 281 | android:layout_height="wrap_content" |
| 291 | android:layout_weight="1" | 282 | android:layout_weight="1" |
| 292 | android:src="@mipmap/wodebanji" /> | 283 | android:paddingTop="20dp" |
| 293 | 284 | android:paddingBottom="20dp" | |
| 285 | android:src="@mipmap/wodebanji1" /> | ||
| 294 | <TextView | 286 | <TextView |
| 287 | android:id="@+id/linel_myclass" | ||
| 295 | android:layout_width="0dp" | 288 | android:layout_width="0dp" |
| 296 | android:layout_height="wrap_content" | 289 | android:layout_height="wrap_content" |
| 297 | android:layout_weight="5" | 290 | android:layout_weight="1" |
| 298 | android:text="我的班级" | 291 | android:text="我的班级" |
| 292 | android:paddingTop="20dp" | ||
| 293 | android:paddingBottom="20dp" | ||
| 299 | android:textSize="20sp" /> | 294 | android:textSize="20sp" /> |
| 300 | 295 | ||
| 301 | <ImageView | ||
| 302 | android:layout_width="0dp" | ||
| 303 | android:layout_height="wrap_content" | ||
| 304 | android:layout_weight="1" | ||
| 305 | android:src="@mipmap/youjiantou" /> | ||
| 306 | |||
| 307 | </LinearLayout> | 296 | </LinearLayout> |
| 308 | 297 | ||
| 298 | <View | ||
| 299 | android:layout_width="match_parent" | ||
| 300 | android:layout_height="0.7dp" | ||
| 301 | android:background="@color/cutoff_line"> | ||
| 302 | |||
| 303 | </View> | ||
| 309 | 304 | ||
| 310 | </LinearLayout> | 305 | </LinearLayout> |
| 306 | <TextView | ||
| 307 | android:id="@+id/iv_look_card" | ||
| 308 | android:layout_width="wrap_content" | ||
| 309 | android:layout_height="wrap_content" | ||
| 310 | android:padding="10dp" | ||
| 311 | android:layout_gravity="center" | ||
| 312 | android:layout_marginTop="120dp" | ||
| 313 | android:text="查看电子保卡" /> | ||
| 311 | 314 | ||
| 312 | <LinearLayout | 315 | <LinearLayout |
| 313 | android:layout_width="match_parent" | 316 | android:layout_width="match_parent" |
| 314 | android:layout_height="match_parent" | 317 | android:layout_height="match_parent" |
| 315 | android:layout_marginTop="120dp" | ||
| 316 | android:background="@mipmap/xiaoguanggao"> | 318 | android:background="@mipmap/xiaoguanggao"> |
| 317 | 319 | ||
| 318 | </LinearLayout> | 320 | </LinearLayout> |
| 319 | 321 | ||
| 320 | 322 | ||
| 321 | </LinearLayout> | 323 | </LinearLayout> |
| 322 | 324 | ||
| 323 | 325 | ||
| 324 | <View | 326 | <View |
| 325 | android:layout_width="0.7dp" | 327 | android:layout_width="0.7dp" |
| 326 | android:layout_height="match_parent" | 328 | android:layout_height="match_parent" |
| 327 | android:background="@color/cutoff_line"> | 329 | android:background="@color/cutoff_line"> |
| 328 | 330 | ||
| 329 | </View> | 331 | </View> |
| 330 | 332 | ||
| 331 | <LinearLayout | 333 | <LinearLayout |
| 332 | android:layout_width="0dp" | 334 | android:layout_width="0dp" |
| 333 | android:layout_height="match_parent" | 335 | android:layout_height="match_parent" |
| 334 | android:layout_weight="2.5" | 336 | android:layout_weight="2.5" |
| 335 | android:orientation="vertical"> | 337 | android:orientation="vertical"> |
| 336 | 338 | ||
| 337 | <LinearLayout | 339 | <LinearLayout |
| 338 | android:layout_width="match_parent" | 340 | android:layout_width="match_parent" |
| 339 | android:layout_height="wrap_content" | 341 | android:layout_height="wrap_content" |
| 340 | android:layout_margin="20dp" | ||
| 341 | android:gravity="center_vertical" | ||
| 342 | android:orientation="horizontal"> | ||
| 343 | |||
| 344 | <View | ||
| 345 | android:layout_width="5dp" | ||
| 346 | android:layout_height="20dp" | ||
| 347 | android:background="@color/login_text_blue"> | ||
| 348 | |||
| 349 | </View> | ||
| 350 | |||
| 351 | <TextView | ||
| 352 | android:layout_width="wrap_content" | ||
| 353 | android:layout_height="wrap_content" | ||
| 354 | android:layout_marginLeft="5dp" | ||
| 355 | android:text="最近学习" | ||
| 356 | android:textSize="22sp" /> | ||
| 357 | |||
| 358 | </LinearLayout> | ||
| 359 | |||
| 360 | <LinearLayout | ||
| 361 | android:layout_width="wrap_content" | ||
| 362 | android:layout_height="wrap_content"> | ||
| 363 | |||
| 364 | <android.support.v7.widget.RecyclerView | ||
| 365 | android:id="@+id/id_recyclerview_horizontal" | ||
| 366 | android:layout_width="wrap_content" | ||
| 367 | android:layout_height="wrap_content" | ||
| 368 | android:layout_centerVertical="true" | ||
| 369 | android:scrollbars="none" /> | ||
| 370 | </LinearLayout> | ||
| 371 | |||
| 372 | <View | ||
| 373 | android:layout_width="match_parent" | ||
| 374 | android:layout_height="0.7dp" | ||
| 375 | android:layout_marginTop="10dp" | ||
| 376 | android:background="@color/cutoff_line"> | ||
| 377 | |||
| 378 | </View> | ||
| 379 | |||
| 380 | <LinearLayout | ||
| 381 | android:layout_width="match_parent" | ||
| 382 | android:layout_height="wrap_content" | ||
| 383 | android:layout_margin="10dp" | 342 | android:layout_margin="10dp" |
| 384 | android:gravity="center_vertical" | 343 | android:gravity="center_vertical" |
| 385 | android:orientation="horizontal"> | 344 | android:orientation="horizontal"> |
| 386 | 345 | ||
| 387 | <View | 346 | <View |
| 388 | android:layout_width="5dp" | 347 | android:layout_width="5dp" |
| 389 | android:layout_height="20dp" | 348 | android:layout_height="20dp" |
| 390 | android:background="@color/login_text_blue"> | 349 | android:background="@color/login_text_blue"> |
| 391 | 350 | ||
| 392 | </View> | 351 | </View> |
| 393 | 352 | ||
| 394 | <TextView | 353 | <TextView |
| 395 | android:layout_width="0dp" | 354 | android:layout_width="0dp" |
| 396 | android:layout_height="wrap_content" | 355 | android:layout_height="wrap_content" |
| 397 | android:layout_marginLeft="5dp" | 356 | android:layout_marginLeft="5dp" |
| 398 | android:layout_weight="5" | 357 | android:layout_weight="5" |
| 399 | android:text="个人信息" | 358 | android:text="个人信息" |
| 400 | android:textSize="22sp" /> | 359 | android:textSize="22sp" /> |
| 401 | 360 | ||
| 402 | <TextView | 361 | <TextView |
| 403 | android:id="@+id/tv_edit_presoninfo" | ||
| 404 | android:padding="5dp" | ||
| 405 | android:layout_width="0dp" | 362 | android:layout_width="0dp" |
| 406 | android:layout_height="wrap_content" | 363 | android:layout_height="wrap_content" |
| 407 | android:layout_marginLeft="10dp" | 364 | android:layout_marginLeft="10dp" |
| 408 | android:layout_weight="0.4" | 365 | android:layout_weight="0.1" |
| 409 | android:text="编辑" | 366 | android:text="" |
| 410 | android:textSize="18sp" /> | 367 | android:textSize="18sp" /> |
| 411 | 368 | ||
| 412 | <ImageView | 369 | <ImageView |
| 370 | android:id="@+id/tv_edit_presoninfo" | ||
| 371 | android:padding="10dp" | ||
| 413 | android:layout_width="0dp" | 372 | android:layout_width="0dp" |
| 414 | android:layout_height="wrap_content" | 373 | android:layout_height="wrap_content" |
| 415 | android:layout_weight="0.1" | 374 | android:layout_weight="0.4" |
| 416 | android:src="@mipmap/youjiantou" /> | 375 | android:src="@mipmap/gerenxinxibianji" /> |
| 417 | 376 | ||
| 418 | 377 | ||
| 419 | </LinearLayout> | 378 | </LinearLayout> |
| 420 | 379 | ||
| 421 | <LinearLayout | 380 | <LinearLayout |
| 422 | android:layout_width="match_parent" | 381 | android:layout_width="match_parent" |
| 423 | android:layout_height="wrap_content" | 382 | android:layout_height="wrap_content" |
| 424 | android:layout_marginLeft="50dp" | 383 | android:layout_marginLeft="50dp" |
| 425 | android:orientation="vertical"> | 384 | android:orientation="vertical"> |
| 426 | 385 | ||
| 427 | <LinearLayout | 386 | <LinearLayout |
| 428 | android:layout_width="match_parent" | 387 | android:layout_width="match_parent" |
| 429 | android:layout_height="wrap_content" | 388 | android:layout_height="wrap_content" |
| 430 | android:gravity="center_vertical" | 389 | android:gravity="center_vertical" |
| 431 | android:orientation="horizontal"> | 390 | android:orientation="horizontal"> |
| 432 | 391 | ||
| 433 | <TextView | 392 | <TextView |
| 434 | android:layout_width="0dp" | 393 | android:layout_width="0dp" |
| 435 | android:layout_height="wrap_content" | 394 | android:layout_height="wrap_content" |
| 395 | android:textColor="@color/login_edittext_hint" | ||
| 436 | android:layout_weight="1" | 396 | android:layout_weight="1" |
| 437 | android:text="昵称" | 397 | android:text="昵称" |
| 438 | android:textSize="20sp" /> | 398 | android:textSize="20sp" /> |
| 439 | 399 | ||
| 440 | <TextView | 400 | <TextView |
| 441 | android:id="@+id/tv_username1" | 401 | android:id="@+id/tv_username1" |
| 442 | android:layout_width="0dp" | 402 | android:layout_width="0dp" |
| 443 | android:layout_height="wrap_content" | 403 | android:layout_height="wrap_content" |
| 444 | android:layout_weight="2" | 404 | android:layout_weight="2" |
| 445 | android:hint="未填写" | 405 | android:hint="未填写" |
| 446 | android:textSize="20sp" /> | 406 | android:textSize="20sp" /> |
| 447 | 407 | ||
| 448 | <TextView | 408 | <TextView |
| 449 | android:layout_width="1dp" | 409 | android:layout_width="1dp" |
| 450 | android:layout_height="wrap_content" | 410 | android:layout_height="wrap_content" |
| 451 | android:layout_weight="1" | 411 | android:layout_weight="1" |
| 412 | android:textColor="@color/login_edittext_hint" | ||
| 452 | android:text="星座" | 413 | android:text="星座" |
| 453 | android:textSize="20sp" /> | 414 | android:textSize="20sp" /> |
| 454 | 415 | ||
| 455 | <TextView | 416 | <TextView |
| 456 | android:id="@+id/tv_mygad" | 417 | android:id="@+id/tv_mygad" |
| 457 | android:layout_width="0dp" | 418 | android:layout_width="0dp" |
| 458 | android:layout_height="wrap_content" | 419 | android:layout_height="wrap_content" |
| 459 | android:layout_weight="2" | 420 | android:layout_weight="2" |
| 460 | android:hint="未填写" | 421 | android:hint="未填写" |
| 461 | android:textSize="20sp" /> | 422 | android:textSize="20sp" /> |
| 462 | </LinearLayout> | 423 | </LinearLayout> |
| 463 | 424 | ||
| 464 | <LinearLayout | 425 | <LinearLayout |
| 465 | android:layout_width="match_parent" | 426 | android:layout_width="match_parent" |
| 466 | android:layout_height="wrap_content" | 427 | android:layout_height="wrap_content" |
| 467 | android:layout_marginTop="15dp" | 428 | android:layout_marginTop="15dp" |
| 468 | android:gravity="center_vertical" | 429 | android:gravity="center_vertical" |
| 469 | android:orientation="horizontal"> | 430 | android:orientation="horizontal"> |
| 470 | 431 | ||
| 471 | <TextView | 432 | <TextView |
| 472 | android:layout_width="0dp" | 433 | android:layout_width="0dp" |
| 473 | android:layout_height="wrap_content" | 434 | android:layout_height="wrap_content" |
| 435 | android:textColor="@color/login_edittext_hint" | ||
| 474 | android:layout_weight="1" | 436 | android:layout_weight="1" |
| 475 | android:text="性别" | 437 | android:text="性别" |
| 476 | android:textSize="20sp" /> | 438 | android:textSize="20sp" /> |
| 477 | 439 | ||
| 478 | <TextView | 440 | <TextView |
| 479 | android:id="@+id/tv_sex" | 441 | android:id="@+id/tv_sex" |
| 480 | android:layout_width="0dp" | 442 | android:layout_width="0dp" |
| 481 | android:layout_height="wrap_content" | 443 | android:layout_height="wrap_content" |
| 482 | android:layout_weight="2" | 444 | android:layout_weight="2" |
| 483 | android:hint="未填写" | 445 | android:hint="未填写" |
| 484 | android:textSize="20sp" /> | 446 | android:textSize="20sp" /> |
| 485 | 447 | ||
| 486 | <TextView | 448 | <TextView |
| 487 | android:layout_width="1dp" | 449 | android:layout_width="1dp" |
| 488 | android:layout_height="wrap_content" | 450 | android:layout_height="wrap_content" |
| 451 | android:textColor="@color/login_edittext_hint" | ||
| 489 | android:layout_weight="1" | 452 | android:layout_weight="1" |
| 490 | android:text="地区" | 453 | android:text="地区" |
| 491 | android:textSize="20sp" /> | 454 | android:textSize="20sp" /> |
| 492 | 455 | ||
| 493 | <TextView | 456 | <TextView |
| 494 | android:id="@+id/tv_useinfo_adress" | 457 | android:id="@+id/tv_useinfo_adress" |
| 495 | android:layout_width="0dp" | 458 | android:layout_width="0dp" |
| 496 | android:layout_height="wrap_content" | 459 | android:layout_height="wrap_content" |
| 497 | android:layout_weight="2" | 460 | android:layout_weight="2" |
| 498 | android:hint="未填写" | 461 | android:hint="未填写" |
| 499 | android:maxLines="2" | 462 | android:maxLines="2" |
| 500 | android:ellipsize="end" | 463 | android:ellipsize="end" |
| 501 | android:textSize="20sp" /> | 464 | android:textSize="20sp" /> |
| 502 | </LinearLayout> | 465 | </LinearLayout> |
| 503 | 466 | ||
| 504 | <LinearLayout | 467 | <LinearLayout |
| 505 | android:layout_width="match_parent" | 468 | android:layout_width="match_parent" |
| 506 | android:layout_height="wrap_content" | 469 | android:layout_height="wrap_content" |
| 507 | android:layout_marginTop="15dp" | 470 | android:layout_marginTop="15dp" |
| 508 | android:gravity="center_vertical" | 471 | android:gravity="center_vertical" |
| 509 | android:orientation="horizontal"> | 472 | android:orientation="horizontal"> |
| 510 | 473 | ||
| 511 | <TextView | 474 | <TextView |
| 512 | android:layout_width="0dp" | 475 | android:layout_width="0dp" |
| 513 | android:layout_height="wrap_content" | 476 | android:layout_height="wrap_content" |
| 514 | android:layout_weight="1" | 477 | android:layout_weight="1" |
| 515 | android:text="生日" | 478 | android:text="生日" |
| 479 | android:textColor="@color/login_edittext_hint" | ||
| 480 | |||
| 516 | android:textSize="20sp" /> | 481 | android:textSize="20sp" /> |
| 517 | 482 | ||
| 518 | <TextView | 483 | <TextView |
| 519 | android:id="@+id/tv_useinfo_birthday" | 484 | android:id="@+id/tv_useinfo_birthday" |
| 520 | android:layout_width="0dp" | 485 | android:layout_width="0dp" |
| 521 | android:layout_height="wrap_content" | 486 | android:layout_height="wrap_content" |
| 522 | android:layout_weight="2" | 487 | android:layout_weight="2" |
| 523 | android:hint="未填写" | 488 | android:hint="未填写" |
| 524 | android:textSize="20sp" /> | 489 | android:textSize="20sp" /> |
| 525 | 490 | ||
| 526 | <TextView | 491 | <TextView |
| 527 | android:layout_width="1dp" | 492 | android:layout_width="1dp" |
| 528 | android:layout_height="wrap_content" | 493 | android:layout_height="wrap_content" |
| 529 | android:layout_weight="1" | 494 | android:layout_weight="1" |
| 495 | android:textColor="@color/login_edittext_hint" | ||
| 496 | |||
| 530 | android:text="学校" | 497 | android:text="学校" |
| 531 | android:textSize="20sp" /> | 498 | android:textSize="20sp" /> |
| 532 | 499 | ||
| 533 | <TextView | 500 | <TextView |
| 534 | android:id="@+id/tv_useinfo_school" | 501 | android:id="@+id/tv_useinfo_school" |
| 535 | android:layout_width="0dp" | 502 | android:layout_width="0dp" |
| 536 | android:layout_height="wrap_content" | 503 | android:layout_height="wrap_content" |
| 537 | android:layout_weight="2" | 504 | android:layout_weight="2" |
| 538 | android:hint="未填写" | 505 | android:hint="未填写" |
| 539 | android:textSize="20sp" /> | 506 | android:textSize="20sp" /> |
| 540 | </LinearLayout> | 507 | </LinearLayout> |
| 541 | 508 | ||
| 542 | <LinearLayout | 509 | <LinearLayout |
| 543 | android:layout_width="match_parent" | 510 | android:layout_width="match_parent" |
| 544 | android:layout_height="wrap_content" | 511 | android:layout_height="wrap_content" |
| 545 | android:layout_marginTop="15dp" | 512 | android:layout_marginTop="15dp" |
| 546 | android:gravity="center_vertical" | 513 | android:gravity="center_vertical" |
| 547 | android:orientation="horizontal"> | 514 | android:orientation="horizontal"> |
| 548 | 515 | ||
| 549 | <TextView | 516 | <TextView |
| 550 | android:layout_width="0dp" | 517 | android:layout_width="0dp" |
| 551 | android:layout_height="wrap_content" | 518 | android:layout_height="wrap_content" |
| 552 | android:layout_weight="1" | 519 | android:layout_weight="1" |
| 520 | android:textColor="@color/login_edittext_hint" | ||
| 553 | android:text=" Q Q" | 521 | android:text=" Q Q" |
| 554 | android:textSize="20sp" /> | 522 | android:textSize="20sp" /> |
| 555 | 523 | ||
| 556 | <TextView | 524 | <TextView |
| 557 | android:id="@+id/tv_useinfo_qq" | 525 | android:id="@+id/tv_useinfo_qq" |
| 558 | android:layout_width="0dp" | 526 | android:layout_width="0dp" |
| 559 | android:layout_height="wrap_content" | 527 | android:layout_height="wrap_content" |
| 560 | android:layout_weight="2" | 528 | android:layout_weight="2" |
| 561 | android:hint="未填写" | 529 | android:hint="未填写" |
| 562 | android:textSize="20sp" /> | 530 | android:textSize="20sp" /> |
| 563 | 531 | ||
| 564 | <TextView | 532 | <TextView |
| 565 | android:layout_width="1dp" | 533 | android:layout_width="1dp" |
| 566 | android:layout_height="wrap_content" | 534 | android:layout_height="wrap_content" |
| 567 | android:layout_weight="1" | 535 | android:layout_weight="1" |
| 568 | android:text="年级" | 536 | android:text="年级" |
| 537 | android:textColor="@color/login_edittext_hint" | ||
| 538 | |||
| 569 | android:textSize="20sp" /> | 539 | android:textSize="20sp" /> |
| 570 | 540 | ||
| 571 | <TextView | 541 | <TextView |
| 572 | android:id="@+id/tv_useinfo_gender" | 542 | android:id="@+id/tv_useinfo_gender" |
| 573 | android:layout_width="0dp" | 543 | android:layout_width="0dp" |
| 574 | android:layout_height="wrap_content" | 544 | android:layout_height="wrap_content" |
| 575 | android:layout_weight="2" | 545 | android:layout_weight="2" |
| 576 | android:hint="未填写" | 546 | android:hint="未填写" |
| 577 | android:textSize="20sp" /> | 547 | android:textSize="20sp" /> |
| 578 | </LinearLayout> | 548 | </LinearLayout> |
| 579 | 549 | ||
| 580 | 550 | ||
| 581 | </LinearLayout> | 551 | </LinearLayout> |
| 582 | <View | 552 | <View |
| 583 | android:layout_width="match_parent" | 553 | android:layout_width="match_parent" |
| 584 | android:layout_height="0.7dp" | 554 | android:layout_height="0.7dp" |
| 585 | android:layout_marginTop="20dp" | 555 | android:layout_marginTop="40dp" |
| 586 | android:background="@color/cutoff_line"> | 556 | android:background="@color/cutoff_line"> |
| 587 | 557 | ||
| 588 | </View> | 558 | </View> |
| 589 | <LinearLayout | 559 | <LinearLayout |
| 590 | android:layout_width="match_parent" | 560 | android:layout_width="match_parent" |
| 591 | android:layout_height="wrap_content" | 561 | android:layout_height="wrap_content" |
| 592 | android:layout_margin="10dp" | 562 | android:layout_margin="10dp" |
| 593 | android:gravity="center_vertical" | 563 | android:gravity="center_vertical" |
| 594 | android:orientation="horizontal"> | 564 | android:orientation="horizontal"> |
| 595 | 565 | ||
| 596 | <View | 566 | <View |
| 597 | android:layout_width="5dp" | 567 | android:layout_width="5dp" |
| 598 | android:layout_height="20dp" | 568 | android:layout_height="20dp" |
| 569 | android:layout_marginTop="10dp" | ||
| 599 | android:background="@color/login_text_blue"> | 570 | android:background="@color/login_text_blue"> |
| 600 | 571 | ||
| 601 | </View> | 572 | </View> |
| 602 | 573 | ||
| 603 | <TextView | 574 | <TextView |
| 604 | android:layout_width="wrap_content" | 575 | android:layout_width="wrap_content" |
| 605 | android:layout_height="wrap_content" | 576 | android:layout_height="wrap_content" |
PersonalCenter/app/src/main/res/layout/fragment_changge_presonal_info.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:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
| 6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 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="50dp" | 10 | android:layout_height="50dp" |
| 11 | android:background="@color/login_text_blue"> | 11 | android:background="@color/login_text_blue"> |
| 12 | 12 | ||
| 13 | <ImageView | 13 | <ImageView |
| 14 | android:id="@+id/cancel" | 14 | android:id="@+id/cancel" |
| 15 | android:layout_width="wrap_content" | 15 | android:layout_width="wrap_content" |
| 16 | android:layout_height="match_parent" | 16 | android:layout_height="match_parent" |
| 17 | android:paddingLeft="20dp" | 17 | android:paddingLeft="20dp" |
| 18 | android:paddingRight="20dp" | 18 | android:paddingRight="20dp" |
| 19 | android:src="@mipmap/title_back" /> | 19 | android:src="@mipmap/title_back" /> |
| 20 | 20 | ||
| 21 | <TextView | 21 | <TextView |
| 22 | android:id="@+id/menu_title" | 22 | android:id="@+id/menu_title" |
| 23 | android:layout_width="wrap_content" | 23 | android:layout_width="wrap_content" |
| 24 | android:layout_height="match_parent" | 24 | android:layout_height="match_parent" |
| 25 | android:layout_centerInParent="true" | 25 | android:layout_centerInParent="true" |
| 26 | android:gravity="center_vertical" | 26 | android:gravity="center_vertical" |
| 27 | android:text="@string/changge_preson" | 27 | android:text="@string/changge_preson" |
| 28 | android:textColor="@android:color/white" | 28 | android:textColor="@android:color/white" |
| 29 | android:textSize="22sp" /> | 29 | android:textSize="22sp" /> |
| 30 | <TextView | 30 | <TextView |
| 31 | android:id="@+id/presonal_sub" | 31 | android:id="@+id/presonal_sub" |
| 32 | android:layout_width="wrap_content" | 32 | android:layout_width="wrap_content" |
| 33 | android:layout_height="match_parent" | 33 | android:layout_height="match_parent" |
| 34 | android:paddingLeft="20dp" | 34 | android:paddingLeft="20dp" |
| 35 | android:paddingRight="20dp" | 35 | android:paddingRight="20dp" |
| 36 | android:gravity="center_vertical" | 36 | android:gravity="center_vertical" |
| 37 | android:layout_alignParentRight="true" | 37 | android:layout_alignParentRight="true" |
| 38 | android:text="保存" | 38 | android:text="保存" |
| 39 | android:textColor="@android:color/white" | 39 | android:textColor="@android:color/white" |
| 40 | android:textSize="22sp" /> | 40 | android:textSize="22sp" /> |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | </RelativeLayout> | 43 | </RelativeLayout> |
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | <LinearLayout | 46 | <LinearLayout |
| 47 | android:layout_width="match_parent" | 47 | android:layout_width="match_parent" |
| 48 | android:layout_height="wrap_content" | 48 | android:layout_height="wrap_content" |
| 49 | android:layout_marginTop="50dp" | 49 | android:layout_marginTop="50dp" |
| 50 | android:orientation="horizontal"> | 50 | android:orientation="horizontal"> |
| 51 | <LinearLayout | 51 | <LinearLayout |
| 52 | android:layout_width="0dp" | 52 | android:layout_width="0dp" |
| 53 | android:layout_weight="1" | 53 | android:layout_weight="1" |
| 54 | android:gravity="right" | 54 | android:gravity="right" |
| 55 | android:layout_marginRight="50dp" | 55 | android:layout_marginRight="50dp" |
| 56 | android:orientation="vertical" | 56 | android:orientation="vertical" |
| 57 | android:layout_height="match_parent"> | 57 | android:layout_height="match_parent"> |
| 58 | <TextView | 58 | <TextView |
| 59 | android:id="@+id/tv_presonal" | 59 | android:id="@+id/tv_presonal" |
| 60 | android:layout_width="wrap_content" | 60 | android:layout_width="wrap_content" |
| 61 | android:layout_height="wrap_content" | 61 | android:layout_height="wrap_content" |
| 62 | android:textSize="22sp" | 62 | android:textSize="22sp" |
| 63 | android:textColor="@color/login_edittext_pressed" | 63 | android:textColor="@color/login_edittext_pressed" |
| 64 | android:text="个人信息"/> | 64 | android:text="个人信息"/> |
| 65 | <View | 65 | <View |
| 66 | android:layout_width="90dp" | 66 | android:layout_width="90dp" |
| 67 | android:layout_height="3dp" | 67 | android:layout_height="3dp" |
| 68 | android:layout_marginTop="5dp" | 68 | android:layout_marginTop="5dp" |
| 69 | android:background="@color/login_edittext_pressed" | 69 | android:background="@color/login_edittext_pressed" |
| 70 | /> | 70 | /> |
| 71 | 71 | ||
| 72 | 72 | ||
| 73 | </LinearLayout> | 73 | </LinearLayout> |
| 74 | <LinearLayout | 74 | <LinearLayout |
| 75 | android:id="@+id/tv_version" | 75 | android:id="@+id/tv_version" |
| 76 | android:layout_width="0dp" | 76 | android:layout_width="0dp" |
| 77 | android:layout_weight="1" | 77 | android:layout_weight="1" |
| 78 | android:gravity="left" | 78 | android:gravity="left" |
| 79 | android:layout_marginLeft="50dp" | 79 | android:layout_marginLeft="50dp" |
| 80 | android:layout_height="match_parent"> | 80 | android:layout_height="match_parent"> |
| 81 | <TextView | 81 | <TextView |
| 82 | android:textSize="22sp" | 82 | android:textSize="22sp" |
| 83 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
| 84 | android:layout_height="wrap_content" | 84 | android:layout_height="wrap_content" |
| 85 | android:text="版本信息"/> | 85 | android:text="版本信息"/> |
| 86 | 86 | ||
| 87 | </LinearLayout> | 87 | </LinearLayout> |
| 88 | 88 | ||
| 89 | </LinearLayout> | 89 | </LinearLayout> |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | <LinearLayout | 92 | <LinearLayout |
| 93 | android:layout_width="wrap_content" | 93 | android:layout_width="wrap_content" |
| 94 | android:layout_height="wrap_content" | 94 | android:layout_height="wrap_content" |
| 95 | android:layout_marginTop="80dp" | 95 | android:layout_marginTop="80dp" |
| 96 | android:orientation="horizontal"> | 96 | android:orientation="horizontal"> |
| 97 | 97 | ||
| 98 | <View | 98 | <View |
| 99 | android:layout_width="450dp" | 99 | android:layout_width="450dp" |
| 100 | android:layout_height="0.7dp" | 100 | android:layout_height="0.7dp" |
| 101 | android:layout_marginLeft="150dp" | 101 | android:layout_marginLeft="150dp" |
| 102 | android:background="@color/cutoff_line"> | 102 | android:background="@color/cutoff_line"> |
| 103 | 103 | ||
| 104 | </View> | 104 | </View> |
| 105 | 105 | ||
| 106 | <View | 106 | <View |
| 107 | android:layout_width="450dp" | 107 | android:layout_width="450dp" |
| 108 | android:layout_height="0.7dp" | 108 | android:layout_height="0.7dp" |
| 109 | android:layout_marginLeft="80dp" | 109 | android:layout_marginLeft="80dp" |
| 110 | android:background="@color/cutoff_line"> | 110 | android:background="@color/cutoff_line"> |
| 111 | 111 | ||
| 112 | </View> | 112 | </View> |
| 113 | 113 | ||
| 114 | 114 | ||
| 115 | </LinearLayout> | 115 | </LinearLayout> |
| 116 | 116 | ||
| 117 | <LinearLayout | 117 | <LinearLayout |
| 118 | android:layout_width="match_parent" | 118 | android:layout_width="match_parent" |
| 119 | android:layout_height="wrap_content" | 119 | android:layout_height="wrap_content" |
| 120 | android:layout_marginLeft="200dp" | 120 | android:layout_marginLeft="200dp" |
| 121 | android:gravity="center_vertical" | 121 | android:gravity="center_vertical" |
| 122 | android:orientation="horizontal"> | 122 | android:orientation="horizontal"> |
| 123 | 123 | ||
| 124 | <LinearLayout | 124 | <LinearLayout |
| 125 | android:layout_width="0dp" | 125 | android:layout_width="0dp" |
| 126 | android:layout_height="80dp" | 126 | android:layout_height="80dp" |
| 127 | android:layout_weight="1" | 127 | android:layout_weight="1" |
| 128 | android:gravity="center_vertical"> | 128 | android:gravity="center_vertical"> |
| 129 | 129 | ||
| 130 | <TextView | 130 | <TextView |
| 131 | android:layout_width="wrap_content" | 131 | android:layout_width="wrap_content" |
| 132 | android:layout_height="wrap_content" | 132 | android:layout_height="wrap_content" |
| 133 | android:text="昵称" | 133 | android:text="昵称" |
| 134 | android:textSize="22sp" /> | 134 | android:textSize="22sp" /> |
| 135 | 135 | ||
| 136 | <EditText | 136 | <EditText |
| 137 | android:id="@+id/tv_username1" | 137 | android:id="@+id/tv_username1" |
| 138 | android:layout_width="wrap_content" | 138 | android:layout_width="wrap_content" |
| 139 | android:layout_height="wrap_content" | 139 | android:layout_height="wrap_content" |
| 140 | android:layout_marginLeft="50dp" | 140 | android:layout_marginLeft="50dp" |
| 141 | android:textColor="@color/electronic_text" | 141 | android:textColor="@color/login_text_black" |
| 142 | android:background="@null" | 142 | android:background="@null" |
| 143 | android:hint="请输入12个以内的中文或英文字符" | 143 | android:hint="请输入12个以内的中文或英文字符" |
| 144 | android:textSize="22sp" /> | 144 | android:textSize="22sp" /> |
| 145 | 145 | ||
| 146 | </LinearLayout> | 146 | </LinearLayout> |
| 147 | 147 | ||
| 148 | <LinearLayout | 148 | <LinearLayout |
| 149 | android:layout_width="0dp" | 149 | android:layout_width="0dp" |
| 150 | android:layout_height="80dp" | 150 | android:layout_height="80dp" |
| 151 | android:layout_weight="1" | 151 | android:layout_weight="1" |
| 152 | android:gravity="center_vertical"> | 152 | android:gravity="center_vertical"> |
| 153 | 153 | ||
| 154 | <TextView | 154 | <TextView |
| 155 | android:layout_width="wrap_content" | 155 | android:layout_width="wrap_content" |
| 156 | android:layout_height="wrap_content" | 156 | android:layout_height="wrap_content" |
| 157 | android:text="地区" | 157 | android:text="地区" |
| 158 | android:textSize="22sp" /> | 158 | android:textSize="22sp" /> |
| 159 | 159 | ||
| 160 | <TextView | 160 | <TextView |
| 161 | android:id="@+id/tv_useinfo_adress" | 161 | android:id="@+id/tv_useinfo_adress" |
| 162 | android:layout_width="wrap_content" | 162 | android:layout_width="wrap_content" |
| 163 | android:layout_height="wrap_content" | 163 | android:layout_height="wrap_content" |
| 164 | android:layout_marginLeft="50dp" | 164 | android:layout_marginLeft="50dp" |
| 165 | android:hint="请选择" | 165 | android:hint="请选择" |
| 166 | android:textSize="22sp" /> | 166 | android:textSize="22sp" /> |
| 167 | 167 | ||
| 168 | <ImageView | 168 | <ImageView |
| 169 | android:id="@+id/my_adress" | 169 | android:id="@+id/my_adress" |
| 170 | android:padding="20dp" | 170 | android:padding="20dp" |
| 171 | android:layout_width="wrap_content" | 171 | android:layout_width="wrap_content" |
| 172 | android:layout_height="wrap_content" | 172 | android:layout_height="wrap_content" |
| 173 | android:layout_marginLeft="150dp" | 173 | android:layout_marginLeft="150dp" |
| 174 | android:src="@mipmap/xiajiantou"> | 174 | android:src="@mipmap/xiajiantou"> |
| 175 | 175 | ||
| 176 | </ImageView> | 176 | </ImageView> |
| 177 | </LinearLayout> | 177 | </LinearLayout> |
| 178 | 178 | ||
| 179 | </LinearLayout> | 179 | </LinearLayout> |
| 180 | 180 | ||
| 181 | <LinearLayout | 181 | <LinearLayout |
| 182 | android:layout_width="wrap_content" | 182 | android:layout_width="wrap_content" |
| 183 | android:layout_height="wrap_content" | 183 | android:layout_height="wrap_content" |
| 184 | android:orientation="horizontal"> | 184 | android:orientation="horizontal"> |
| 185 | 185 | ||
| 186 | <View | 186 | <View |
| 187 | android:layout_width="450dp" | 187 | android:layout_width="450dp" |
| 188 | android:layout_height="0.7dp" | 188 | android:layout_height="0.7dp" |
| 189 | android:layout_marginLeft="150dp" | 189 | android:layout_marginLeft="150dp" |
| 190 | android:background="@color/cutoff_line"> | 190 | android:background="@color/cutoff_line"> |
| 191 | 191 | ||
| 192 | </View> | 192 | </View> |
| 193 | 193 | ||
| 194 | <View | 194 | <View |
| 195 | android:layout_width="450dp" | 195 | android:layout_width="450dp" |
| 196 | android:layout_height="0.7dp" | 196 | android:layout_height="0.7dp" |
| 197 | android:layout_marginLeft="80dp" | 197 | android:layout_marginLeft="80dp" |
| 198 | android:background="@color/cutoff_line"> | 198 | android:background="@color/cutoff_line"> |
| 199 | 199 | ||
| 200 | </View> | 200 | </View> |
| 201 | 201 | ||
| 202 | 202 | ||
| 203 | </LinearLayout> | 203 | </LinearLayout> |
| 204 | 204 | ||
| 205 | <LinearLayout | 205 | <LinearLayout |
| 206 | android:layout_width="match_parent" | 206 | android:layout_width="match_parent" |
| 207 | android:layout_height="wrap_content" | 207 | android:layout_height="wrap_content" |
| 208 | android:layout_marginLeft="200dp" | 208 | android:layout_marginLeft="200dp" |
| 209 | android:gravity="center_vertical" | 209 | android:gravity="center_vertical" |
| 210 | android:orientation="horizontal"> | 210 | android:orientation="horizontal"> |
| 211 | 211 | ||
| 212 | <LinearLayout | 212 | <LinearLayout |
| 213 | android:layout_width="0dp" | 213 | android:layout_width="0dp" |
| 214 | android:layout_height="80dp" | 214 | android:layout_height="80dp" |
| 215 | android:layout_weight="1" | 215 | android:layout_weight="1" |
| 216 | android:gravity="center_vertical"> | 216 | android:gravity="center_vertical"> |
| 217 | 217 | ||
| 218 | <TextView | 218 | <TextView |
| 219 | android:layout_width="wrap_content" | 219 | android:layout_width="wrap_content" |
| 220 | android:layout_height="wrap_content" | 220 | android:layout_height="wrap_content" |
| 221 | android:text="性别" | 221 | android:text="性别" |
| 222 | android:textSize="22sp" /> | 222 | android:textSize="22sp" /> |
| 223 | 223 | ||
| 224 | <TextView | 224 | <TextView |
| 225 | android:id="@+id/tv_sex" | 225 | android:id="@+id/tv_sex" |
| 226 | android:layout_width="wrap_content" | 226 | android:layout_width="wrap_content" |
| 227 | android:layout_height="wrap_content" | 227 | android:layout_height="wrap_content" |
| 228 | android:layout_marginLeft="50dp" | 228 | android:layout_marginLeft="50dp" |
| 229 | android:hint="请选择" | 229 | android:hint="请选择" |
| 230 | android:textSize="22sp" /> | 230 | android:textSize="22sp" /> |
| 231 | 231 | ||
| 232 | <ImageView | 232 | <ImageView |
| 233 | android:id="@+id/my_sex" | 233 | android:id="@+id/my_sex" |
| 234 | android:padding="20dp" | 234 | android:padding="20dp" |
| 235 | android:layout_width="wrap_content" | 235 | android:layout_width="wrap_content" |
| 236 | android:layout_height="wrap_content" | 236 | android:layout_height="wrap_content" |
| 237 | android:layout_marginLeft="150dp" | 237 | android:layout_marginLeft="150dp" |
| 238 | android:src="@mipmap/xiajiantou"> | 238 | android:src="@mipmap/xiajiantou"> |
| 239 | 239 | ||
| 240 | </ImageView> | 240 | </ImageView> |
| 241 | 241 | ||
| 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="80dp" | 247 | android:layout_height="80dp" |
| 248 | android:layout_weight="1" | 248 | android:layout_weight="1" |
| 249 | android:gravity="center_vertical"> | 249 | android:gravity="center_vertical"> |
| 250 | 250 | ||
| 251 | <TextView | 251 | <TextView |
| 252 | android:layout_width="wrap_content" | 252 | android:layout_width="wrap_content" |
| 253 | android:layout_height="wrap_content" | 253 | android:layout_height="wrap_content" |
| 254 | android:text=" " | 254 | android:text=" " |
| 255 | android:textColor="@color/white" | 255 | android:textColor="@color/white" |
| 256 | android:textSize="22sp" /> | 256 | android:textSize="22sp" /> |
| 257 | 257 | ||
| 258 | <EditText | 258 | <EditText |
| 259 | android:id="@+id/tv_useinfo_adress1" | 259 | android:id="@+id/tv_useinfo_adress1" |
| 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="50dp" | 262 | android:layout_marginLeft="50dp" |
| 263 | android:textColor="@color/electronic_text" | 263 | android:textColor="@color/login_text_black" |
| 264 | android:background="@null" | 264 | android:background="@null" |
| 265 | android:hint="请输入详细地址" | 265 | android:hint="请输入详细地址" |
| 266 | android:textSize="22sp" /> | 266 | android:textSize="22sp" /> |
| 267 | 267 | ||
| 268 | </LinearLayout> | 268 | </LinearLayout> |
| 269 | 269 | ||
| 270 | </LinearLayout> | 270 | </LinearLayout> |
| 271 | 271 | ||
| 272 | <LinearLayout | 272 | <LinearLayout |
| 273 | android:layout_width="wrap_content" | 273 | android:layout_width="wrap_content" |
| 274 | android:layout_height="wrap_content" | 274 | android:layout_height="wrap_content" |
| 275 | 275 | ||
| 276 | android:orientation="horizontal"> | 276 | android:orientation="horizontal"> |
| 277 | 277 | ||
| 278 | <View | 278 | <View |
| 279 | android:layout_width="450dp" | 279 | android:layout_width="450dp" |
| 280 | android:layout_height="0.7dp" | 280 | android:layout_height="0.7dp" |
| 281 | android:layout_marginLeft="150dp" | 281 | android:layout_marginLeft="150dp" |
| 282 | android:background="@color/cutoff_line"> | 282 | android:background="@color/cutoff_line"> |
| 283 | 283 | ||
| 284 | </View> | 284 | </View> |
| 285 | 285 | ||
| 286 | <View | 286 | <View |
| 287 | android:layout_width="450dp" | 287 | android:layout_width="450dp" |
| 288 | android:layout_height="0.7dp" | 288 | android:layout_height="0.7dp" |
| 289 | android:layout_marginLeft="80dp" | 289 | android:layout_marginLeft="80dp" |
| 290 | android:background="@color/cutoff_line"> | 290 | android:background="@color/cutoff_line"> |
| 291 | 291 | ||
| 292 | </View> | 292 | </View> |
| 293 | 293 | ||
| 294 | 294 | ||
| 295 | </LinearLayout> | 295 | </LinearLayout> |
| 296 | 296 | ||
| 297 | <LinearLayout | 297 | <LinearLayout |
| 298 | android:layout_width="match_parent" | 298 | android:layout_width="match_parent" |
| 299 | android:layout_height="wrap_content" | 299 | android:layout_height="wrap_content" |
| 300 | android:layout_marginLeft="200dp" | 300 | android:layout_marginLeft="200dp" |
| 301 | android:gravity="center_vertical" | 301 | android:gravity="center_vertical" |
| 302 | android:orientation="horizontal"> | 302 | android:orientation="horizontal"> |
| 303 | 303 | ||
| 304 | 304 | ||
| 305 | <LinearLayout | 305 | <LinearLayout |
| 306 | android:layout_width="0dp" | 306 | android:layout_width="0dp" |
| 307 | android:layout_height="80dp" | 307 | android:layout_height="80dp" |
| 308 | android:layout_weight="1" | 308 | android:layout_weight="1" |
| 309 | android:gravity="center_vertical"> | 309 | android:gravity="center_vertical"> |
| 310 | 310 | ||
| 311 | <TextView | 311 | <TextView |
| 312 | android:layout_width="wrap_content" | 312 | android:layout_width="wrap_content" |
| 313 | android:layout_height="wrap_content" | 313 | android:layout_height="wrap_content" |
| 314 | android:text="生日" | 314 | android:text="生日" |
| 315 | android:textSize="22sp" /> | 315 | android:textSize="22sp" /> |
| 316 | 316 | ||
| 317 | <TextView | 317 | <TextView |
| 318 | android:id="@+id/tv_useinfo_birthday" | 318 | android:id="@+id/tv_useinfo_birthday" |
| 319 | android:layout_width="wrap_content" | 319 | android:layout_width="wrap_content" |
| 320 | android:layout_height="wrap_content" | 320 | android:layout_height="wrap_content" |
| 321 | android:layout_marginLeft="50dp" | 321 | android:layout_marginLeft="50dp" |
| 322 | android:hint="请选择" | 322 | android:hint="请选择" |
| 323 | android:textSize="22sp" /> | 323 | android:textSize="22sp" /> |
| 324 | 324 | ||
| 325 | <ImageView | 325 | <ImageView |
| 326 | android:id="@+id/my_bthday" | 326 | android:id="@+id/my_bthday" |
| 327 | android:padding="20dp" | 327 | android:padding="20dp" |
| 328 | android:layout_width="wrap_content" | 328 | android:layout_width="wrap_content" |
| 329 | android:layout_height="wrap_content" | 329 | android:layout_height="wrap_content" |
| 330 | android:layout_marginLeft="150dp" | 330 | android:layout_marginLeft="150dp" |
| 331 | android:src="@mipmap/xiajiantou"/> | 331 | android:src="@mipmap/xiajiantou"/> |
| 332 | </LinearLayout> | 332 | </LinearLayout> |
| 333 | <LinearLayout | 333 | <LinearLayout |
| 334 | android:layout_width="0dp" | 334 | android:layout_width="0dp" |
| 335 | android:layout_height="80dp" | 335 | android:layout_height="80dp" |
| 336 | android:layout_weight="1" | 336 | android:layout_weight="1" |
| 337 | android:gravity="center_vertical"> | 337 | android:gravity="center_vertical"> |
| 338 | 338 | ||
| 339 | <TextView | 339 | <TextView |
| 340 | android:layout_width="wrap_content" | 340 | android:layout_width="wrap_content" |
| 341 | android:layout_height="wrap_content" | 341 | android:layout_height="wrap_content" |
| 342 | android:text="年级" | 342 | android:text="年级" |
| 343 | android:textSize="22sp" /> | 343 | android:textSize="22sp" /> |
| 344 | 344 | ||
| 345 | <TextView | 345 | <TextView |
| 346 | android:id="@+id/tv_useinfo_gender" | 346 | android:id="@+id/tv_useinfo_gender" |
| 347 | android:layout_width="wrap_content" | 347 | android:layout_width="wrap_content" |
| 348 | android:layout_height="wrap_content" | 348 | android:layout_height="wrap_content" |
| 349 | android:layout_marginLeft="50dp" | 349 | android:layout_marginLeft="50dp" |
| 350 | android:hint="请选择" | 350 | android:hint="请选择" |
| 351 | android:textSize="22sp" /> | 351 | android:textSize="22sp" /> |
| 352 | 352 | ||
| 353 | <ImageView | 353 | <ImageView |
| 354 | android:id="@+id/my_grade" | 354 | android:id="@+id/my_grade" |
| 355 | android:padding="20dp" | 355 | android:padding="20dp" |
| 356 | android:layout_width="wrap_content" | 356 | android:layout_width="wrap_content" |
| 357 | android:layout_height="wrap_content" | 357 | android:layout_height="wrap_content" |
| 358 | android:layout_marginLeft="150dp" | 358 | android:layout_marginLeft="150dp" |
| 359 | android:src="@mipmap/xiajiantou"/> | 359 | android:src="@mipmap/xiajiantou"/> |
| 360 | </LinearLayout> | 360 | </LinearLayout> |
| 361 | 361 | ||
| 362 | </LinearLayout> | 362 | </LinearLayout> |
| 363 | 363 | ||
| 364 | <LinearLayout | 364 | <LinearLayout |
| 365 | android:layout_width="wrap_content" | 365 | android:layout_width="wrap_content" |
| 366 | android:layout_height="wrap_content" | 366 | android:layout_height="wrap_content" |
| 367 | 367 | ||
| 368 | android:orientation="horizontal"> | 368 | android:orientation="horizontal"> |
| 369 | 369 | ||
| 370 | <View | 370 | <View |
| 371 | android:layout_width="450dp" | 371 | android:layout_width="450dp" |
| 372 | android:layout_height="0.7dp" | 372 | android:layout_height="0.7dp" |
| 373 | android:layout_marginLeft="150dp" | 373 | android:layout_marginLeft="150dp" |
| 374 | android:background="@color/cutoff_line"> | 374 | android:background="@color/cutoff_line"> |
| 375 | 375 | ||
| 376 | </View> | 376 | </View> |
| 377 | 377 | ||
| 378 | <View | 378 | <View |
| 379 | android:layout_width="450dp" | 379 | android:layout_width="450dp" |
| 380 | android:layout_height="0.7dp" | 380 | android:layout_height="0.7dp" |
| 381 | android:layout_marginLeft="80dp" | 381 | android:layout_marginLeft="80dp" |
| 382 | android:background="@color/cutoff_line"> | 382 | android:background="@color/cutoff_line"> |
| 383 | 383 | ||
| 384 | </View> | 384 | </View> |
| 385 | 385 | ||
| 386 | 386 | ||
| 387 | </LinearLayout> | 387 | </LinearLayout> |
| 388 | 388 | ||
| 389 | <LinearLayout | 389 | <LinearLayout |
| 390 | android:layout_width="match_parent" | 390 | android:layout_width="match_parent" |
| 391 | android:layout_height="wrap_content" | 391 | android:layout_height="wrap_content" |
| 392 | android:layout_marginLeft="200dp" | 392 | android:layout_marginLeft="200dp" |
| 393 | android:gravity="center_vertical" | 393 | android:gravity="center_vertical" |
| 394 | android:orientation="horizontal"> | 394 | android:orientation="horizontal"> |
| 395 | 395 | ||
| 396 | <LinearLayout | 396 | <LinearLayout |
| 397 | android:id="@+id/lineL_buy_time" | 397 | android:id="@+id/lineL_buy_time" |
| 398 | android:layout_width="0dp" | 398 | android:layout_width="0dp" |
| 399 | android:layout_height="80dp" | 399 | android:layout_height="80dp" |
| 400 | android:layout_weight="1" | 400 | android:layout_weight="1" |
| 401 | android:gravity="center_vertical"> | 401 | android:gravity="center_vertical"> |
| 402 | 402 | ||
| 403 | <TextView | 403 | <TextView |
| 404 | android:layout_width="wrap_content" | 404 | android:layout_width="wrap_content" |
| 405 | android:layout_height="wrap_content" | 405 | android:layout_height="wrap_content" |
| 406 | android:text="Q Q" | 406 | android:text="Q Q" |
| 407 | android:textSize="22sp" /> | 407 | android:textSize="22sp" /> |
| 408 | 408 | ||
| 409 | <EditText | 409 | <EditText |
| 410 | android:id="@+id/tv_useinfo_qq" | 410 | android:id="@+id/tv_useinfo_qq" |
| 411 | android:layout_width="wrap_content" | 411 | android:layout_width="wrap_content" |
| 412 | android:layout_height="wrap_content" | 412 | android:layout_height="wrap_content" |
| 413 | android:layout_marginLeft="50dp" | 413 | android:layout_marginLeft="50dp" |
| 414 | android:background="@null" | 414 | android:background="@null" |
| 415 | android:textColor="@color/electronic_text" | 415 | android:textColor="@color/login_text_black" |
| 416 | android:hint="请输入" | 416 | android:hint="请输入" |
| 417 | android:textSize="22sp" /> | 417 | android:textSize="22sp" /> |
| 418 | 418 | ||
| 419 | </LinearLayout> | 419 | </LinearLayout> |
| 420 | 420 | ||
| 421 | <LinearLayout | 421 | <LinearLayout |
| 422 | android:layout_width="0dp" | 422 | android:layout_width="0dp" |
| 423 | android:layout_height="80dp" | 423 | android:layout_height="80dp" |
| 424 | android:layout_weight="1" | 424 | android:layout_weight="1" |
| 425 | 425 | ||
| 426 | android:gravity="center_vertical"> | 426 | android:gravity="center_vertical"> |
| 427 | 427 | ||
| 428 | <TextView | 428 | <TextView |
| 429 | android:layout_width="wrap_content" | 429 | android:layout_width="wrap_content" |
| 430 | android:layout_height="wrap_content" | 430 | android:layout_height="wrap_content" |
| 431 | android:text="学校" | 431 | android:text="学校" |
| 432 | android:textSize="22sp" /> | 432 | android:textSize="22sp" /> |
| 433 | 433 | ||
| 434 | <TextView | 434 | <TextView |
| 435 | android:id="@+id/tv_useinfo_school" | 435 | android:id="@+id/tv_useinfo_school" |
| 436 | android:layout_width="wrap_content" | 436 | android:layout_width="wrap_content" |
| 437 | android:layout_height="wrap_content" | 437 | android:layout_height="wrap_content" |
| 438 | android:layout_marginLeft="50dp" | 438 | android:layout_marginLeft="50dp" |
| 439 | android:hint="请选择" | 439 | android:hint="请选择" |
| 440 | android:textSize="22sp" /> | 440 | android:textSize="22sp" /> |
| 441 | 441 | ||
| 442 | <ImageView | 442 | <ImageView |
| 443 | android:id="@+id/my_school" | 443 | android:id="@+id/my_school" |
| 444 | android:padding="20dp" | 444 | android:padding="20dp" |
| 445 | android:layout_width="wrap_content" | 445 | android:layout_width="wrap_content" |
| 446 | android:layout_height="wrap_content" | 446 | android:layout_height="wrap_content" |
| 447 | android:layout_marginLeft="150dp" | 447 | android:layout_marginLeft="150dp" |
| 448 | android:src="@mipmap/xiajiantou"> | 448 | android:src="@mipmap/xiajiantou"> |
| 449 | 449 | ||
| 450 | </ImageView> | 450 | </ImageView> |
| 451 | </LinearLayout> | 451 | </LinearLayout> |
| 452 | 452 | ||
| 453 | </LinearLayout> | 453 | </LinearLayout> |
| 454 | 454 | ||
| 455 | <LinearLayout | 455 | <LinearLayout |
| 456 | android:layout_width="wrap_content" | 456 | android:layout_width="wrap_content" |
| 457 | android:layout_height="wrap_content" | 457 | android:layout_height="wrap_content" |
| 458 | android:orientation="horizontal"> | 458 | android:orientation="horizontal"> |
| 459 | 459 | ||
| 460 | <View | 460 | <View |
| 461 | android:layout_width="450dp" | 461 | android:layout_width="450dp" |
| 462 | android:layout_height="0.7dp" | 462 | android:layout_height="0.7dp" |
| 463 | android:layout_marginLeft="150dp" | 463 | android:layout_marginLeft="150dp" |
| 464 | android:background="@color/cutoff_line"> | 464 | android:background="@color/cutoff_line"> |
| 465 | 465 | ||
| 466 | </View> | 466 | </View> |
| 467 | 467 | ||
| 468 | <View | 468 | <View |
| 469 | android:layout_width="450dp" | 469 | android:layout_width="450dp" |
| 470 | android:layout_height="0.7dp" | 470 | android:layout_height="0.7dp" |
| 471 | android:layout_marginLeft="80dp" | 471 | android:layout_marginLeft="80dp" |
| 472 | android:background="@color/cutoff_line"> | 472 | android:background="@color/cutoff_line"> |
| 473 | 473 | ||
| 474 | </View> | 474 | </View> |
| 475 | 475 | ||
| 476 | 476 | ||
| 477 | </LinearLayout> | 477 | </LinearLayout> |
| 478 | 478 | ||
| 479 | </LinearLayout> | 479 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes2.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
| 5 | android:layout_width="wrap_content" | 5 | android:layout_width="wrap_content" |
| 6 | android:layout_height="wrap_content" | 6 | android:layout_height="wrap_content" |
| 7 | android:layout_marginLeft="10dp" | 7 | android:layout_marginLeft="10dp" |
| 8 | android:gravity="center"> | 8 | android:gravity="center"> |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | <com.facebook.drawee.view.SimpleDraweeView | 11 | <com.facebook.drawee.view.SimpleDraweeView |
| 12 | android:id="@+id/image_publish" | 12 | android:id="@+id/image_publish" |
| 13 | android:layout_width="80dp" | 13 | android:layout_width="80dp" |
| 14 | android:layout_height="100dp" | 14 | android:layout_height="100dp" |
| 15 | android:layout_gravity="center" | 15 | android:layout_gravity="center" |
| 16 | android:background="@drawable/corcle_black_bg" | 16 | fresco:placeholderImage="@mipmap/bgsubject" |
| 17 | fresco:placeholderImage="@mipmap/header_default" | ||
| 18 | fresco:roundAsCircle="true" | ||
| 19 | fresco:placeholderImageScaleType="fitCenter" /> | 17 | fresco:placeholderImageScaleType="fitCenter" /> |
| 20 | 18 | ||
| 21 | <TextView | 19 | <TextView |
| 22 | android:id="@+id/subject" | 20 | android:id="@+id/subject" |
| 23 | android:layout_marginTop="5dp" | 21 | android:layout_marginTop="5dp" |
| 24 | android:textSize="18sp" | 22 | android:textSize="18sp" |
| 25 | android:width="80dp" | 23 | android:width="80dp" |
| 26 | android:singleLine="true" | 24 | android:singleLine="true" |
| 27 | android:ellipsize="end" | 25 | android:ellipsize="end" |
| 28 | android:gravity="center" | 26 | android:gravity="center" |
| 29 | android:layout_width="wrap_content" | 27 | android:layout_width="wrap_content" |
| 30 | android:layout_height="wrap_content" | 28 | android:layout_height="wrap_content" |
| 31 | android:textColor="@color/login_text_black" | 29 | android:textColor="@color/login_text_black" |
| 32 | android:text="" | 30 | android:text="" |
| 33 | /> | 31 | /> |
| 34 | <TextView | 32 | <TextView |
| 35 | android:id="@+id/tv_publish" | 33 | android:id="@+id/tv_publish" |
| 36 | android:layout_marginTop="10dp" | 34 | android:layout_marginTop="10dp" |
| 37 | android:textSize="16sp" | 35 | android:textSize="16sp" |
| 38 | android:width="80dp" | 36 | android:width="80dp" |
| 39 | android:singleLine="true" | 37 | android:singleLine="true" |
| 40 | android:ellipsize="end" | 38 | android:ellipsize="end" |
| 41 | android:layout_width="80dp" | 39 | android:layout_width="80dp" |
| 42 | android:gravity="center" | 40 | android:gravity="center" |
| 43 | android:layout_height="wrap_content" | 41 | android:layout_height="wrap_content" |
| 44 | android:textColor="@color/login_text_black" | 42 | android:textColor="@color/login_text_black" |
| 45 | android:text="" | 43 | android:text="" |
| 46 | /> | 44 | /> |
| 47 | 45 | ||
| 48 | </LinearLayout> | 46 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes3.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| 7 | android:gravity="center"> | 7 | android:gravity="center"> |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | <com.facebook.drawee.view.SimpleDraweeView | 10 | <com.facebook.drawee.view.SimpleDraweeView |
| 11 | android:id="@+id/image_publish" | 11 | android:id="@+id/image_publish" |
| 12 | android:layout_width="100dp" | 12 | android:layout_width="100dp" |
| 13 | android:layout_height="150dp" | 13 | android:layout_height="150dp" |
| 14 | android:layout_gravity="center" | 14 | android:layout_gravity="center" |
| 15 | android:background="@drawable/corcle_black_bg" | 15 | fresco:placeholderImage="@mipmap/bgsubject" |
| 16 | fresco:placeholderImage="@mipmap/header_default" | ||
| 17 | fresco:roundAsCircle="true" | ||
| 18 | fresco:placeholderImageScaleType="fitCenter" /> | 16 | fresco:placeholderImageScaleType="fitCenter" /> |
| 19 | 17 | ||
| 20 | <TextView | 18 | <TextView |
| 21 | android:id="@+id/subject" | 19 | android:id="@+id/subject" |
| 22 | android:layout_marginTop="5dp" | 20 | android:layout_marginTop="5dp" |
| 23 | android:textSize="22sp" | 21 | android:textSize="22sp" |
| 24 | android:gravity="center" | 22 | android:gravity="center" |
| 25 | android:layout_width="match_parent" | 23 | android:layout_width="match_parent" |
| 26 | android:layout_height="wrap_content" | 24 | android:layout_height="wrap_content" |
| 27 | android:textColor="@color/login_text_black" | 25 | android:textColor="@color/login_text_black" |
| 28 | android:text="" | 26 | android:text="" |
| 29 | /> | 27 | /> |
| 30 | <TextView | 28 | <TextView |
| 31 | android:id="@+id/tv_publish" | 29 | android:id="@+id/tv_publish" |
| 32 | android:layout_marginTop="10dp" | 30 | android:layout_marginTop="10dp" |
| 33 | android:textSize="18sp" | 31 | android:textSize="18sp" |
| 34 | android:layout_width="wrap_content" | 32 | android:layout_width="wrap_content" |
| 35 | android:gravity="center" | 33 | android:gravity="center" |
| 36 | android:layout_height="wrap_content" | 34 | android:layout_height="wrap_content" |
| 37 | android:textColor="@color/login_text_black" | 35 | android:textColor="@color/login_text_black" |
| 38 | android:text="" | 36 | android:text="" |
| 39 | /> | 37 | /> |
| 40 | 38 | ||
| 41 | </LinearLayout> | 39 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes4.xml
| File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | ||
| 4 | android:layout_width="match_parent" | ||
| 5 | android:layout_height="match_parent" | ||
| 6 | android:gravity="center" | ||
| 7 | android:orientation="vertical"> | ||
| 8 | |||
| 9 | |||
| 10 | <com.facebook.drawee.view.SimpleDraweeView | ||
| 11 | android:id="@+id/image_publish" | ||
| 12 | android:layout_width="100dp" | ||
| 13 | android:layout_height="140dp" | ||
| 14 | android:layout_gravity="center" | ||
| 15 | fresco:placeholderImage="@mipmap/bgsubject" | ||
| 16 | fresco:placeholderImageScaleType="fitCenter" /> | ||
| 17 | |||
| 18 | |||
| 19 | <TextView | ||
| 20 | android:id="@+id/tv_publish" | ||
| 21 | android:layout_width="80dp" | ||
| 22 | android:layout_height="wrap_content" | ||
| 23 | android:layout_marginTop="5dp" | ||
| 24 | android:width="80dp" | ||
| 25 | android:ellipsize="end" | ||
| 26 | android:gravity="center" | ||
| 27 | android:singleLine="true" | ||
| 28 | android:text="" | ||
| 29 | android:textColor="@color/login_text_black" | ||
| 30 | android:textSize="16sp" /> | ||
| 31 | |||
| 32 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/recycler_childaccunt_item_view.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
| 5 | android:layout_width="400dp" | 5 | android:layout_width="400dp" |
| 6 | android:layout_height="match_parent"> | 6 | android:layout_height="match_parent"> |
| 7 | <LinearLayout | 7 | <LinearLayout |
| 8 | android:id="@+id/ll_backgrangd" | 8 | android:id="@+id/ll_backgrangd" |
| 9 | android:layout_width="wrap_content" | 9 | android:layout_width="wrap_content" |
| 10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
| 11 | android:background="@drawable/corcle_black_bg" | 11 | android:background="@drawable/corcle_black_bg" |
| 12 | android:orientation="vertical"> | 12 | android:orientation="vertical"> |
| 13 | 13 | ||
| 14 | <LinearLayout | 14 | <LinearLayout |
| 15 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
| 16 | android:layout_height="wrap_content" | 16 | android:layout_height="wrap_content" |
| 17 | android:background="@mipmap/zizhanghu" | ||
| 17 | android:orientation="horizontal"> | 18 | android:orientation="horizontal"> |
| 18 | <com.facebook.drawee.view.SimpleDraweeView | 19 | <com.facebook.drawee.view.SimpleDraweeView |
| 19 | android:id="@+id/iv_child_head" | 20 | android:id="@+id/iv_child_head" |
| 20 | android:layout_width="60dp" | 21 | android:layout_width="60dp" |
| 21 | android:layout_height="60dp" | 22 | android:layout_height="60dp" |
| 22 | android:layout_margin="10dp" | 23 | android:layout_margin="10dp" |
| 23 | fresco:placeholderImage="@mipmap/header_default" | 24 | fresco:placeholderImage="@mipmap/header_default" |
| 24 | fresco:roundAsCircle="true" | 25 | fresco:roundAsCircle="true" |
| 25 | fresco:placeholderImageScaleType="fitCenter" /> | 26 | fresco:placeholderImageScaleType="fitCenter" /> |
| 26 | 27 | ||
| 27 | 28 | ||
| 28 | <LinearLayout | 29 | <LinearLayout |
| 29 | android:layout_width="0dp" | 30 | android:layout_width="0dp" |
| 30 | android:layout_height="wrap_content" | 31 | android:layout_height="wrap_content" |
| 31 | android:layout_marginLeft="10dp" | 32 | android:layout_marginLeft="10dp" |
| 32 | android:layout_marginTop="10dp" | 33 | android:layout_marginTop="10dp" |
| 33 | android:layout_weight="1" | 34 | android:layout_weight="1" |
| 34 | android:orientation="vertical"> | 35 | android:orientation="vertical"> |
| 35 | 36 | ||
| 36 | <TextView | 37 | <TextView |
| 37 | android:id="@+id/iv_child_name" | 38 | android:id="@+id/iv_child_name" |
| 38 | android:layout_width="wrap_content" | 39 | android:layout_width="wrap_content" |
| 39 | android:layout_height="wrap_content" | 40 | android:layout_height="wrap_content" |
| 40 | android:text="" | 41 | android:text="" |
| 41 | android:textSize="18sp" /> | 42 | android:textSize="18sp" /> |
| 42 | 43 | ||
| 43 | <TextView | 44 | <TextView |
| 44 | android:id="@+id/iv_child_grade" | 45 | android:id="@+id/iv_child_grade" |
| 45 | android:layout_width="wrap_content" | 46 | android:layout_width="wrap_content" |
| 46 | android:layout_height="wrap_content" | 47 | android:layout_height="wrap_content" |
| 47 | android:text="" | 48 | android:text="" |
| 48 | android:textSize="18sp" /> | 49 | android:textSize="18sp" /> |
| 49 | 50 | ||
| 50 | <TextView | 51 | <TextView |
| 51 | android:id="@+id/iv_child_school" | 52 | android:id="@+id/iv_child_school" |
| 52 | android:layout_width="wrap_content" | 53 | android:layout_width="wrap_content" |
| 53 | android:layout_height="wrap_content" | 54 | android:layout_height="wrap_content" |
| 54 | android:text="" | 55 | android:text="" |
| 55 | android:textSize="18sp" /> | 56 | android:textSize="18sp" /> |
| 56 | 57 | ||
| 57 | <TextView | 58 | <TextView |
| 58 | android:id="@+id/iv_child_adress" | 59 | android:id="@+id/iv_child_adress" |
| 59 | android:layout_width="wrap_content" | 60 | android:layout_width="wrap_content" |
| 60 | android:layout_height="wrap_content" | 61 | android:layout_height="wrap_content" |
| 61 | android:text="" | 62 | android:text="" |
| 62 | android:textSize="18sp" /> | 63 | android:textSize="18sp" /> |
| 63 | 64 | ||
| 64 | </LinearLayout> | 65 | </LinearLayout> |
| 65 | <ImageView | 66 | <ImageView |
| 66 | android:id="@+id/iv_using_pic" | 67 | android:id="@+id/iv_using_pic" |
| 67 | android:layout_width="wrap_content" | 68 | android:layout_width="wrap_content" |
| 68 | android:layout_height="wrap_content" | 69 | android:layout_height="wrap_content" |
| 69 | android:layout_gravity="right" | 70 | android:layout_gravity="right" |
| 70 | android:layout_marginLeft="60dp" | 71 | android:layout_marginLeft="60dp" |
| 71 | android:visibility="gone" | 72 | android:visibility="gone" |
| 72 | android:src="@mipmap/shiyongzhong" /> | 73 | android:src="@mipmap/shiyongzhong" /> |
| 73 | 74 | ||
| 74 | 75 | ||
| 75 | 76 | ||
| 76 | </LinearLayout> | 77 | </LinearLayout> |
| 77 | 78 | ||
| 78 | <View | 79 | <View |
| 79 | android:layout_width="wrap_content" | 80 | android:layout_width="wrap_content" |
| 80 | android:layout_height="0.7dp" | 81 | android:layout_height="0.7dp" |
| 81 | android:layout_margin="10dp" | 82 | android:layout_marginBottom="10dp" |
| 82 | android:background="@color/cutoff_line"> | 83 | android:background="@color/cutoff_line"> |
| 83 | 84 | ||
| 84 | </View> | 85 | </View> |
| 85 | 86 | ||
| 86 | <LinearLayout | 87 | <LinearLayout |
| 87 | android:layout_width="match_parent" | 88 | android:layout_width="match_parent" |
| 88 | android:layout_height="wrap_content" | 89 | android:layout_height="wrap_content" |
| 89 | android:layout_marginBottom="10dp" | 90 | android:layout_marginBottom="10dp" |
| 90 | android:orientation="horizontal"> | 91 | android:orientation="horizontal"> |
| 91 | 92 | ||
| 92 | <TextView | 93 | <TextView |
| 93 | android:id="@+id/delete_child_account" | 94 | android:id="@+id/delete_child_account" |
| 94 | android:layout_width="0dp" | 95 | android:layout_width="0dp" |
| 95 | android:layout_height="wrap_content" | 96 | android:layout_height="wrap_content" |
| 96 | android:layout_weight="1" | 97 | android:layout_weight="1" |
| 97 | android:gravity="center" | 98 | android:gravity="center" |
| 98 | android:text="删除用户" | 99 | android:text="删除用户" |
| 99 | android:textSize="18sp" /> | 100 | android:textSize="18sp" /> |
| 100 | 101 | ||
| 101 | <TextView | 102 | <TextView |
| 102 | android:id="@+id/chang_account" | 103 | android:id="@+id/chang_account" |
| 103 | android:layout_width="0dp" | 104 | android:layout_width="0dp" |
| 104 | android:layout_height="wrap_content" | 105 | android:layout_height="wrap_content" |
| 105 | android:layout_weight="1" | 106 | android:layout_weight="1" |
| 106 | android:gravity="center" | 107 | android:gravity="center" |
| 107 | android:text="切换使用" | 108 | android:text="切换使用" |
| 108 | android:textSize="18sp" /> | 109 | android:textSize="18sp" /> |
| 109 | 110 | ||
| 110 | 111 | ||
| 111 | </LinearLayout> | 112 | </LinearLayout> |
| 112 | 113 | ||
| 113 | </LinearLayout> | 114 | </LinearLayout> |
| 114 | 115 | ||
| 115 | </LinearLayout> | 116 | </LinearLayout> |
PersonalCenter/app/src/main/res/mipmap-xhdpi/bg_zhuzhang.png
19.2 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/bg_zhuzhanghu.png
18 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/bgsubject.png
2.27 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/chuzhongdili7lower.jpg
598 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/chuzhongshuxue6upper.jpg
411 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/chuzhongwuli8lower.jpg
497 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/chuzhongyingyu4ce.jpg
322 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/chuzhongyuwen9total.jpg
341 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/chuzhongzhengzhi6upper.jpg
703 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/fankui1.png
1.92 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/gerenxinxibianji.png
1.54 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/head_bg.png
93.7 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/nostudy.png
20.2 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/qianming.png
1.31 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/shezhi1.png
2.04 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/shiyongzhong.png
PersonalCenter/app/src/main/res/mipmap-xhdpi/wodebanji1.png
7.7 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/wodebiji1.png
7.93 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/wodecuoti1.png
5.68 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/wodeshoucang.png
PersonalCenter/app/src/main/res/mipmap-xhdpi/zizhanghu.png
14.2 KB
PersonalCenter/app/src/main/res/values/colors.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <resources> | 2 | <resources> |
| 3 | <color name="colorPrimary">#3F51B5</color> | 3 | <color name="colorPrimary">#3F51B5</color> |
| 4 | <color name="colorPrimaryDark">#303F9F</color> | 4 | <color name="colorPrimaryDark">#303F9F</color> |
| 5 | <color name="colorAccent">#FF4081</color> | 5 | <color name="colorAccent">#FF4081</color> |
| 6 | <color name="white">#ffffffff</color> | 6 | <color name="white">#ffffffff</color> |
| 7 | <color name="login_edittext_hint">#afafaf</color> | 7 | <color name="login_edittext_hint">#afafaf</color> |
| 8 | <color name="login_text_blue">#1cb8ff</color> | 8 | <color name="login_text_blue">#1cb8ff</color> |
| 9 | <color name="login_text_black">#313131</color> | 9 | <color name="login_text_black">#313131</color> |
| 10 | <color name="login_edittext_normal">#d4d4d4</color> | 10 | <color name="login_edittext_normal">#d4d4d4</color> |
| 11 | <color name="error_hint">#ED1c24</color> | 11 | <color name="error_hint">#ED1c24</color> |
| 12 | <color name="login_edittext_pressed">#1cb8ff</color> | 12 | <color name="login_edittext_pressed">#1cb8ff</color> |
| 13 | <color name="cutoff_line">#CCCCCC</color> | 13 | <color name="cutoff_line">#CCCCCC</color> |
| 14 | <color name="electronic_card">#ff480f</color> | 14 | <color name="electronic_card">#ff480f</color> |
| 15 | <color name="electronic_text">#afafaf</color> | 15 | <color name="electronic_text">#afafaf</color> |
| 16 | <color name="backgerangde_laout">#eeeeee</color> | 16 | <color name="backgerangde_laout">#eeeeee</color> |
| 17 | <color name="bgstudy_laout">#F0F0F0</color> | ||
| 17 | 18 | ||
| 18 | </resources> | 19 | </resources> |
| 19 | 20 |
PersonalCenter/mypresonallibrary/src/main/java/com/hjx/mypresonallibrary/PresonalHelper.java
| 1 | package com.hjx.mypresonallibrary; | 1 | package com.hjx.mypresonallibrary; |
| 2 | 2 | ||
| 3 | import android.app.Service; | 3 | import android.app.Service; |
| 4 | import android.content.ComponentName; | 4 | import android.content.ComponentName; |
| 5 | import android.content.Context; | 5 | import android.content.Context; |
| 6 | import android.content.DialogInterface; | 6 | import android.content.DialogInterface; |
| 7 | import android.content.Intent; | 7 | import android.content.Intent; |
| 8 | import android.content.ServiceConnection; | 8 | import android.content.ServiceConnection; |
| 9 | import android.os.IBinder; | 9 | import android.os.IBinder; |
| 10 | import android.os.RemoteException; | 10 | import android.os.RemoteException; |
| 11 | 11 | ||
| 12 | import com.hjx.personalcenter.service.IPresonalInterface; | 12 | import com.hjx.personalcenter.service.IPresonalInterface; |
| 13 | 13 | ||
| 14 | import java.util.concurrent.locks.ReentrantLock; | 14 | import java.util.concurrent.locks.ReentrantLock; |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | * Created by h on 2017/9/13. | 17 | * Created by h on 2017/9/13. |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | public class PresonalHelper implements DialogInterface.OnDismissListener{ | 20 | public class PresonalHelper implements DialogInterface.OnDismissListener{ |
| 21 | private IPresonalInterface center; | 21 | private IPresonalInterface center; |
| 22 | private int STATUS_IDLE = 0; | 22 | private int STATUS_IDLE = 0; |
| 23 | private int STATUS_PENDDING = 1; | 23 | private int STATUS_PENDDING = 1; |
| 24 | private int STATUS_FINISH = 2; | 24 | private int STATUS_FINISH = 2; |
| 25 | private int status = STATUS_IDLE; | 25 | private int status = STATUS_IDLE; |
| 26 | private byte[] mx = new byte[0]; | 26 | private byte[] mx = new byte[0]; |
| 27 | private ReentrantLock lock = new ReentrantLock(); | 27 | private ReentrantLock lock = new ReentrantLock(); |
| 28 | private boolean isRun = false; | 28 | private boolean isRun = false; |
| 29 | private boolean isShow = false; | 29 | private boolean isShow = false; |
| 30 | 30 | ||
| 31 | public PresonalHelper() { | 31 | public PresonalHelper() { |
| 32 | isRun = true; | 32 | isRun = true; |
| 33 | } | 33 | } |
| 34 | private ServiceConnection serviceConnection = new ServiceConnection() { | 34 | private ServiceConnection serviceConnection = new ServiceConnection() { |
| 35 | 35 | ||
| 36 | @Override | 36 | @Override |
| 37 | public void onServiceDisconnected(ComponentName name) { | 37 | public void onServiceDisconnected(ComponentName name) { |
| 38 | center = null; | 38 | center = null; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | @Override | 41 | @Override |
| 42 | public void onServiceConnected(ComponentName name, IBinder service) { | 42 | public void onServiceConnected(ComponentName name, IBinder service) { |
| 43 | center = IPresonalInterface.Stub.asInterface(service); | 43 | center = IPresonalInterface.Stub.asInterface(service); |
| 44 | synchronized (mx) { | 44 | synchronized (mx) { |
| 45 | status = STATUS_FINISH; | 45 | status = STATUS_FINISH; |
| 46 | mx.notifyAll(); | 46 | mx.notifyAll(); |
| 47 | } | 47 | } |
| 48 | } | 48 | } |
| 49 | }; | 49 | }; |
| 50 | private void bind(Context context){ | 50 | private void bind(Context context){ |
| 51 | status = STATUS_PENDDING; | 51 | status = STATUS_PENDDING; |
| 52 | Intent intent = new Intent(ActionConfig.SERVICE_ACTION); | 52 | Intent intent = new Intent(ActionConfig.SERVICE_ACTION); |
| 53 | intent.setPackage(ActionConfig.PACKAGENAEM); | 53 | intent.setPackage(ActionConfig.PACKAGENAEM); |
| 54 | context.getApplicationContext().bindService(intent, serviceConnection, Service.BIND_AUTO_CREATE); | 54 | context.getApplicationContext().bindService(intent, serviceConnection, Service.BIND_AUTO_CREATE); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | 57 | ||
| 58 | @Override | 58 | @Override |
| 59 | public void onDismiss(DialogInterface dialog) { | 59 | public void onDismiss(DialogInterface dialog) { |
| 60 | isShow = false; | 60 | isShow = false; |
| 61 | 61 | ||
| 62 | } | 62 | } |
| 63 | private void checkBind(Context context){ | 63 | private void checkBind(Context context){ |
| 64 | if(!isRun)return; | 64 | if(!isRun)return; |
| 65 | if(status == STATUS_IDLE || (center == null && status!= STATUS_PENDDING)){ | 65 | if(status == STATUS_IDLE || (center == null && status!= STATUS_PENDDING)){ |
| 66 | bind(context); | 66 | bind(context); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | if(status == STATUS_PENDDING || status == STATUS_IDLE){ | 69 | if(status == STATUS_PENDDING || status == STATUS_IDLE){ |
| 70 | try { | 70 | try { |
| 71 | synchronized (mx) { | 71 | synchronized (mx) { |
| 72 | if (center == null) | 72 | if (center == null) |
| 73 | mx.wait(); | 73 | mx.wait(); |
| 74 | } | 74 | } |
| 75 | } catch (InterruptedException e) { | 75 | } catch (InterruptedException e) { |
| 76 | e.printStackTrace(); | 76 | e.printStackTrace(); |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | private String buildNotInstallResult(){ | 80 | private String buildNotInstallResult(){ |
| 81 | return "{\"resultCode\":301,\"message\":\"center not install.\"}"; | 81 | return "{\"resultCode\":301,\"message\":\"center not install.\"}"; |
| 82 | } | 82 | } |
| 83 | private String buildNotRun(){ | 83 | private String buildNotRun(){ |
| 84 | return "{\"resultCode\":302,\"message\":\"center is destoryed\"}"; | 84 | return "{\"resultCode\":302,\"message\":\"center is destoryed\"}"; |
| 85 | } | 85 | } |
| 86 | private String buildRemoteError(){ | 86 | private String buildRemoteError(){ |
| 87 | return "{\"resultCode\":303,\"message\":\"remote service call failed\"}"; | 87 | return "{\"resultCode\":303,\"message\":\"remote service call failed\"}"; |
| 88 | } | 88 | } |
| 89 | public void getSimpleUser(final Context context, final PresonalCallBack callBack){ | 89 | public void getSimpleUser(final Context context, final PresonalCallBack callBack){ |
| 90 | if(callBack == null){ | 90 | if(callBack == null){ |
| 91 | throw new IllegalArgumentException("call back can not null"); | 91 | throw new IllegalArgumentException("call back can not null"); |
| 92 | } | 92 | } |
| 93 | new Thread(new Runnable() { | 93 | new Thread(new Runnable() { |
| 94 | 94 | ||
| 95 | @Override | 95 | @Override |
| 96 | public void run() { | 96 | public void run() { |
| 97 | String result = null; | 97 | String result = null; |
| 98 | try { | 98 | try { |
| 99 | checkBind(context); | 99 | checkBind(context); |
| 100 | if(!isRun){ | 100 | if(!isRun){ |
| 101 | result = buildNotRun(); | 101 | result = buildNotRun(); |
| 102 | }else{ | 102 | }else{ |
| 103 | result = center.getSimpleUser(); | 103 | result = center.getSimpleUser(); |
| 104 | } | 104 | } |
| 105 | } catch (RemoteException e) { | 105 | } catch (RemoteException e) { |
| 106 | e.printStackTrace(); | 106 | e.printStackTrace(); |
| 107 | result = buildRemoteError(); | 107 | result = buildRemoteError(); |
| 108 | } | 108 | } |
| 109 | callBack.result(result); | 109 | callBack.result(result); |
| 110 | } | 110 | } |
| 111 | }).start(); | 111 | }).start(); |
| 112 | } | 112 | } |
| 113 | public void getcardUser(final Context context, final PresonalCallBack callBack){ | 113 | public void getcardUser(final Context context, final PresonalCallBack callBack){ |
| 114 | if(callBack == null){ | 114 | if(callBack == null){ |
| 115 | throw new IllegalArgumentException("call back can not null"); | 115 | throw new IllegalArgumentException("call back can not null"); |
| 116 | } | 116 | } |
| 117 | new Thread(new Runnable() { | 117 | new Thread(new Runnable() { |
| 118 | 118 | ||
| 119 | @Override | 119 | @Override |
| 120 | public void run() { | 120 | public void run() { |
| 121 | String result = null; | 121 | String result = null; |
| 122 | try { | 122 | try { |
| 123 | checkBind(context); | 123 | checkBind(context); |
| 124 | if(!isRun){ | 124 | if(!isRun){ |
| 125 | result = buildNotRun(); | 125 | result = buildNotRun(); |
| 126 | }else{ | 126 | }else{ |
| 127 | result = center.getcardUser(); | 127 | result = center.getcardUser(); |
| 128 | } | 128 | } |
| 129 | } catch (RemoteException e) { | 129 | } catch (RemoteException e) { |
| 130 | e.printStackTrace(); | 130 | e.printStackTrace(); |
| 131 | result = buildRemoteError(); | 131 | result = buildRemoteError(); |
| 132 | } | 132 | } |
| 133 | callBack.result(result); | 133 | callBack.result(result); |
| 134 | } | 134 | } |
| 135 | }).start(); | 135 | }).start(); |
| 136 | } | 136 | } |
| 137 | public void getUserInfo(final Context context, final PresonalCallBack callBack){ | ||
| 138 | if(callBack == null){ | ||
| 139 | throw new IllegalArgumentException("call back can not null"); | ||
| 140 | } | ||
| 141 | new Thread(new Runnable() { | ||
| 142 | |||
| 143 | @Override | ||
| 144 | public void run() { | ||
| 145 | String result = null; | ||
| 146 | try { | ||
| 147 | checkBind(context); | ||
| 148 | if(!isRun){ | ||
| 149 | result = buildNotRun(); | ||
| 150 | }else{ | ||
| 151 | result = center.getUserInfo(); | ||
| 152 | } | ||
| 153 | } catch (RemoteException e) { | ||
| 154 | e.printStackTrace(); | ||
| 155 | result = buildRemoteError(); | ||
| 156 | } | ||
| 157 | callBack.result(result); | ||
| 158 | } | ||
| 159 | }).start(); | ||
| 160 | } | ||
| 161 | public void getVersionInfo(final Context context, final PresonalCallBack callBack){ | ||
| 162 | if(callBack == null){ | ||
| 163 | throw new IllegalArgumentException("call back can not null"); | ||
| 164 | } | ||
| 165 | new Thread(new Runnable() { | ||
| 166 | |||
| 167 | @Override | ||
| 168 | public void run() { | ||
| 169 | String result = null; | ||
| 170 | try { | ||
| 171 | checkBind(context); | ||
| 172 | if(!isRun){ | ||
| 173 | result = buildNotRun(); | ||
| 174 | }else{ | ||
| 175 | result = center.logout(); | ||
| 176 | } | ||
| 177 | } catch (RemoteException e) { | ||
| 178 | e.printStackTrace(); | ||
| 179 | result = buildRemoteError(); | ||
| 180 | } | ||
| 181 | callBack.result(result); | ||
| 182 | } | ||
| 183 | }).start(); | ||
| 184 | } | ||
| 137 | } | 185 | } |
| 138 | 186 |
PersonalCenter/pickerview/src/main/res/drawable/corcle_black_bg.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:shape="rectangle"> | 3 | android:shape="rectangle"> |
| 4 | <solid | 4 | <solid |
| 5 | android:color="@color/white"/> | 5 | android:color="@color/white"/> |
| 6 | <corners | 6 | <corners |
| 7 | android:bottomLeftRadius="20dp" | 7 | android:bottomLeftRadius="10dp" |
| 8 | android:topLeftRadius="20dp" | 8 | android:topLeftRadius="10dp" |
| 9 | android:bottomRightRadius="20dp" | 9 | android:bottomRightRadius="10dp" |
| 10 | android:topRightRadius="20dp"/> | 10 | android:topRightRadius="10dp"/> |
| 11 | <stroke android:width="1dp" | 11 | <stroke android:width="1dp" |
| 12 | android:color="@color/login_edittext_hint"/> | 12 | android:color="@color/login_edittext_hint"/> |
| 13 | </shape> | 13 | </shape> |