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