Commit 66c44ff2208bff830c1105f20b3ce11083c06033
1 parent
5f17f7d7de
Exists in
master
头像问题
Showing
35 changed files
with
417 additions
and
180 deletions
Show diff stats
PersonalCenter/app/build.gradle
| 1 | apply plugin: 'com.android.application' | 1 | apply plugin: 'com.android.application' |
| 2 | 2 | ||
| 3 | android { | 3 | android { |
| 4 | compileSdkVersion 25 | 4 | compileSdkVersion 25 |
| 5 | buildToolsVersion "25.0.3" | 5 | buildToolsVersion "25.0.3" |
| 6 | defaultConfig { | 6 | defaultConfig { |
| 7 | applicationId "com.hjx.personalcenter" | 7 | applicationId "com.hjx.personalcenter" |
| 8 | minSdkVersion 15 | 8 | minSdkVersion 15 |
| 9 | targetSdkVersion 25 | 9 | targetSdkVersion 25 |
| 10 | versionCode 1 | 10 | versionCode 3 |
| 11 | versionName "1.0.1" | 11 | versionName "1.0.3" |
| 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" |
| 13 | } | 13 | } |
| 14 | buildTypes { | 14 | buildTypes { |
| 15 | release { | 15 | release { |
| 16 | minifyEnabled false | 16 | minifyEnabled false |
| 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| 20 | useLibrary 'org.apache.http.legacy' | 20 | useLibrary 'org.apache.http.legacy' |
| 21 | lintOptions{ | 21 | lintOptions{ |
| 22 | checkReleaseBuilds false | 22 | checkReleaseBuilds false |
| 23 | abortOnError false | 23 | abortOnError false |
| 24 | } | 24 | } |
| 25 | sourceSets { | 25 | sourceSets { |
| 26 | main { | 26 | main { |
| 27 | jniLibs.srcDirs = ['libs'] | 27 | jniLibs.srcDirs = ['libs'] |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | dependencies { | 32 | dependencies { |
| 33 | compile fileTree(include: ['*.jar'], dir: 'libs') | 33 | compile fileTree(include: ['*.jar'], dir: 'libs') |
| 34 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | 34 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { |
| 35 | exclude group: 'com.android.support', module: 'support-annotations' | 35 | exclude group: 'com.android.support', module: 'support-annotations' |
| 36 | }) | 36 | }) |
| 37 | compile 'com.tencent.bugly:crashreport:latest.release' | 37 | compile 'com.tencent.bugly:crashreport:latest.release' |
| 38 | compile 'org.apache.httpcomponents:httpcore:4.4.1' | 38 | compile 'org.apache.httpcomponents:httpcore:4.4.1' |
| 39 | compile 'org.apache.httpcomponents:httpclient:4.5' | 39 | compile 'org.apache.httpcomponents:httpclient:4.5' |
| 40 | compile 'com.android.support:appcompat-v7:25.3.1' | 40 | compile 'com.android.support:appcompat-v7:25.3.1' |
| 41 | testCompile 'junit:junit:4.12' | 41 | testCompile 'junit:junit:4.12' |
| 42 | compile project(':circledialog') | 42 | compile project(':circledialog') |
| 43 | compile project(':pickerview') | 43 | compile project(':pickerview') |
| 44 | compile files('libs/android-async-http-1.4.8.jar') | 44 | compile files('libs/android-async-http-1.4.8.jar') |
| 45 | compile 'com.google.code.gson:gson:2.7' | 45 | compile 'com.google.code.gson:gson:2.7' |
| 46 | compile 'com.zaaach:toprightmenu:1.0' | 46 | compile 'com.zaaach:toprightmenu:1.0' |
| 47 | compile 'com.facebook.fresco:fresco:1.1.0' | ||
| 48 | compile 'com.android.support:recyclerview-v7:25.+' | 47 | compile 'com.android.support:recyclerview-v7:25.+' |
| 49 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' | 48 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' |
| 50 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' | 49 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' |
| 51 | compile 'com.google.zxing:core:3.3.0' | 50 | compile 'com.google.zxing:core:3.3.0' |
| 52 | compile 'com.google.zxing:android-core:3.3.0' | 51 | compile 'com.google.zxing:android-core:3.3.0' |
| 53 | compile project(path: ':mypresonallibrary') | 52 | compile project(path: ':mypresonallibrary') |
| 53 | compile files('libs/picasso-2.5.2.jar') | ||
| 54 | } | 54 | } |
PersonalCenter/app/libs/picasso-2.5.2.jar
No preview for this file type
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 | android:configChanges="keyboardHidden|orientation"> |
| 5 | 5 | ||
| 6 | <application | 6 | <application |
| 7 | android:name=".activity.MyApplication" | 7 | android:name=".activity.MyApplication" |
| 8 | android:allowBackup="true" | 8 | android:allowBackup="true" |
| 9 | android:icon="@mipmap/grzx_icon" | 9 | android:icon="@mipmap/grzx_icon" |
| 10 | android:label="@string/app_name" | 10 | android:label="@string/app_name" |
| 11 | android:supportsRtl="true" | 11 | android:supportsRtl="true" |
| 12 | android:theme="@style/AppTheme"> | 12 | android:theme="@style/AppTheme"> |
| 13 | <activity | 13 | <activity |
| 14 | android:name=".activity.MainActivity" | 14 | android:name=".activity.MainActivity" |
| 15 | android:launchMode="singleTask" | 15 | android:launchMode="standard" |
| 16 | android:screenOrientation="sensorLandscape"> | 16 | android:screenOrientation="sensorLandscape"> |
| 17 | </activity> | 17 | </activity> |
| 18 | <activity | 18 | <activity |
| 19 | android:name=".activity.LoginAndRegisterActivity" | 19 | android:name=".activity.LoginAndRegisterActivity" |
| 20 | android:launchMode="standard" | 20 | android:launchMode="standard" |
| 21 | android:screenOrientation="sensorLandscape"> | 21 | android:screenOrientation="sensorLandscape"> |
| 22 | <intent-filter> | 22 | <intent-filter> |
| 23 | <action android:name="android.intent.action.MAIN" /> | 23 | <action android:name="android.intent.action.MAIN" /> |
| 24 | 24 | ||
| 25 | <category android:name="android.intent.category.LAUNCHER" /> | 25 | <category android:name="android.intent.category.LAUNCHER" /> |
| 26 | </intent-filter> | 26 | </intent-filter> |
| 27 | 27 | ||
| 28 | </activity> | 28 | </activity> |
| 29 | <activity | 29 | <activity |
| 30 | android:name=".activity.ForgotPasswordActivity" | 30 | android:name=".activity.ForgotPasswordActivity" |
| 31 | android:launchMode="singleTask" | 31 | android:launchMode="singleTask" |
| 32 | android:screenOrientation="sensorLandscape"> | 32 | android:screenOrientation="sensorLandscape"> |
| 33 | 33 | ||
| 34 | </activity> | 34 | </activity> |
| 35 | <activity | 35 | <activity |
| 36 | android:name=".activity.ChangePasswordActivity" | 36 | android:name=".activity.ChangePasswordActivity" |
| 37 | android:launchMode="singleTask" | 37 | android:launchMode="singleTask" |
| 38 | android:screenOrientation="sensorLandscape"> | 38 | android:screenOrientation="sensorLandscape"> |
| 39 | 39 | ||
| 40 | </activity> | 40 | </activity> |
| 41 | <activity | 41 | <activity |
| 42 | android:name=".activity.RegisterInfoActivity" | 42 | android:name=".activity.RegisterInfoActivity" |
| 43 | android:launchMode="singleTask" | 43 | android:launchMode="singleTask" |
| 44 | android:screenOrientation="sensorLandscape"> | 44 | android:screenOrientation="sensorLandscape"> |
| 45 | 45 | ||
| 46 | </activity> | 46 | </activity> |
| 47 | <activity | 47 | <activity |
| 48 | android:name=".activity.ElectronicCardValidationActivity" | 48 | android:name=".activity.ElectronicCardValidationActivity" |
| 49 | android:launchMode="singleTask" | 49 | android:launchMode="singleTask" |
| 50 | android:screenOrientation="sensorLandscape"> | 50 | android:screenOrientation="sensorLandscape"> |
| 51 | 51 | ||
| 52 | </activity> | 52 | </activity> |
| 53 | <activity | 53 | <activity |
| 54 | android:name=".activity.ChangeBangDingActivity" | 54 | android:name=".activity.ChangeBangDingActivity" |
| 55 | android:launchMode="singleTask" | 55 | android:launchMode="singleTask" |
| 56 | android:screenOrientation="sensorLandscape"> | 56 | android:screenOrientation="sensorLandscape"> |
| 57 | 57 | ||
| 58 | </activity> | 58 | </activity> |
| 59 | <activity | 59 | <activity |
| 60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" | 60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" |
| 61 | android:launchMode="singleTask" | 61 | android:launchMode="singleTask" |
| 62 | android:screenOrientation="sensorLandscape"> | 62 | android:screenOrientation="sensorLandscape"> |
| 63 | 63 | ||
| 64 | </activity> | 64 | </activity> |
| 65 | <activity | 65 | <activity |
| 66 | android:name=".activity.ChangeEletronicCardPhoneActivity" | 66 | android:name=".activity.ChangeEletronicCardPhoneActivity" |
| 67 | android:launchMode="singleTask" | 67 | android:launchMode="singleTask" |
| 68 | android:screenOrientation="sensorLandscape"> | 68 | android:screenOrientation="sensorLandscape"> |
| 69 | 69 | ||
| 70 | </activity> | 70 | </activity> |
| 71 | <activity | 71 | <activity |
| 72 | android:name=".activity.ChoiseTextBookActivity" | 72 | android:name=".activity.ChoiseTextBookActivity" |
| 73 | android:launchMode="singleTask" | 73 | android:launchMode="singleTask" |
| 74 | android:screenOrientation="sensorLandscape"> | 74 | android:screenOrientation="sensorLandscape"> |
| 75 | 75 | ||
| 76 | </activity> | 76 | </activity> |
| 77 | <activity | 77 | <activity |
| 78 | android:name=".activity.TheStartPageActivity" | 78 | android:name=".activity.TheStartPageActivity" |
| 79 | android:launchMode="singleTask" | 79 | android:launchMode="singleTask" |
| 80 | android:screenOrientation="sensorLandscape"> | 80 | android:screenOrientation="sensorLandscape"> |
| 81 | 81 | ||
| 82 | </activity> | 82 | </activity> |
| 83 | <activity | 83 | <activity |
| 84 | android:name=".activity.ElectronicCardEditInfoActivity" | 84 | android:name=".activity.ElectronicCardEditInfoActivity" |
| 85 | android:launchMode="singleTask" | 85 | android:launchMode="singleTask" |
| 86 | android:screenOrientation="sensorLandscape" | 86 | android:screenOrientation="sensorLandscape" |
| 87 | android:windowSoftInputMode="adjustPan"> | 87 | android:windowSoftInputMode="adjustPan"> |
| 88 | 88 | ||
| 89 | </activity> | 89 | </activity> |
| 90 | <activity | 90 | <activity |
| 91 | android:name=".activity.ElectronicCardInfoOKActivity" | 91 | android:name=".activity.ElectronicCardInfoOKActivity" |
| 92 | android:launchMode="singleTask" | 92 | android:launchMode="singleTask" |
| 93 | android:screenOrientation="sensorLandscape"> | 93 | android:screenOrientation="sensorLandscape"> |
| 94 | 94 | ||
| 95 | </activity> | 95 | </activity> |
| 96 | <activity | 96 | <activity |
| 97 | android:name=".activity.ElectronicCardLookInfoActivity" | 97 | android:name=".activity.ElectronicCardLookInfoActivity" |
| 98 | android:launchMode="singleTask" | 98 | android:launchMode="singleTask" |
| 99 | android:screenOrientation="sensorLandscape" | 99 | android:screenOrientation="sensorLandscape" |
| 100 | > | 100 | > |
| 101 | 101 | ||
| 102 | </activity> | 102 | </activity> |
| 103 | <activity | 103 | <activity |
| 104 | android:name=".activity.FeedBackActivity" | 104 | android:name=".activity.FeedBackActivity" |
| 105 | android:launchMode="singleTask" | 105 | android:launchMode="singleTask" |
| 106 | android:screenOrientation="sensorLandscape"> | 106 | android:screenOrientation="sensorLandscape"> |
| 107 | 107 | ||
| 108 | </activity> | 108 | </activity> |
| 109 | <activity | 109 | <activity |
| 110 | android:name=".activity.AccountManagementActivity" | 110 | android:name=".activity.AccountManagementActivity" |
| 111 | android:launchMode="singleTask" | 111 | android:launchMode="singleTask" |
| 112 | android:screenOrientation="sensorLandscape"> | 112 | android:screenOrientation="sensorLandscape"> |
| 113 | 113 | ||
| 114 | </activity> | 114 | </activity> |
| 115 | <activity | 115 | <activity |
| 116 | android:name=".activity.ChangePresonalInfoActivity" | 116 | android:name=".activity.ChangePresonalInfoActivity" |
| 117 | android:launchMode="singleTask" | 117 | android:launchMode="singleTask" |
| 118 | android:screenOrientation="sensorLandscape" | 118 | android:screenOrientation="sensorLandscape" |
| 119 | android:windowSoftInputMode="adjustPan"> | 119 | android:windowSoftInputMode="adjustPan"> |
| 120 | 120 | ||
| 121 | </activity> | 121 | </activity> |
| 122 | <activity | 122 | <activity |
| 123 | android:name=".activity.BangDingCode" | 123 | android:name=".activity.BangDingCode" |
| 124 | android:launchMode="singleTask" | 124 | android:launchMode="singleTask" |
| 125 | android:screenOrientation="sensorLandscape"> | 125 | android:screenOrientation="sensorLandscape"> |
| 126 | 126 | ||
| 127 | </activity> | 127 | </activity> |
| 128 | <service android:name="com.hjx.personalcenter.service.CenterService" | 128 | <service android:name="com.hjx.personalcenter.service.CenterService" |
| 129 | android:enabled="true" | 129 | android:enabled="true" |
| 130 | android:exported="true"> | 130 | android:exported="true"> |
| 131 | <intent-filter> | 131 | <intent-filter> |
| 132 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> | 132 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> |
| 133 | </intent-filter> | 133 | </intent-filter> |
| 134 | </service> | 134 | </service> |
| 135 | <service | 135 | <service |
| 136 | android:name="com.hjx.personalcenter.update.DownloadService" | 136 | android:name="com.hjx.personalcenter.update.DownloadService" |
| 137 | android:enabled="true"/> | 137 | android:enabled="true"/> |
| 138 | <!--<receiver | 138 | <!--<receiver |
| 139 | android:name="com.hjx.personalcenter.service.StaticReceiver" | 139 | android:name="com.hjx.personalcenter.service.StaticReceiver" |
| 140 | android:exported="true"> | 140 | android:exported="true"> |
| 141 | <intent-filter > | 141 | <intent-filter > |
| 142 | <action android:name="com.ozing.launcher.SWITCH_GRADE"/> | 142 | <action android:name="com.ozing.launcher.SWITCH_GRADE"/> |
| 143 | </intent-filter> | 143 | </intent-filter> |
| 144 | 144 | ||
| 145 | </receiver>--> | 145 | </receiver>--> |
| 146 | </application> | 146 | </application> |
| 147 | <!--权限--> | 147 | <!--权限--> |
| 148 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 148 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| 149 | <uses-permission android:name="android.permission.CAMERA" /> | 149 | <uses-permission android:name="android.permission.CAMERA" /> |
| 150 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 150 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
| 151 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | 151 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
| 152 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 152 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
| 153 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 153 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| 154 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 154 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| 155 | <uses-permission android:name="android.permission.CALL_PHONE" /> | 155 | <uses-permission android:name="android.permission.CALL_PHONE" /> |
| 156 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 156 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
| 157 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | 157 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> |
| 158 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 158 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
| 159 | <uses-permission android:name="android.permission.INTERNET" /> | 159 | <uses-permission android:name="android.permission.INTERNET" /> |
| 160 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 160 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
| 161 | <uses-permission android:name="android.permission.READ_LOGS" /> | 161 | <uses-permission android:name="android.permission.READ_LOGS" /> |
| 162 | <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" /> | 163 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> |
| 164 | 164 | ||
| 165 | </manifest> | 165 | </manifest> |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/View/Imageviews.java
| File was created | 1 | package com.hjx.personalcenter.View; | |
| 2 | |||
| 3 | import android.annotation.SuppressLint; | ||
| 4 | import android.content.Context; | ||
| 5 | import android.graphics.Bitmap; | ||
| 6 | import android.graphics.Bitmap.Config; | ||
| 7 | import android.graphics.Canvas; | ||
| 8 | import android.graphics.Paint; | ||
| 9 | import android.graphics.PorterDuff.Mode; | ||
| 10 | import android.graphics.PorterDuffXfermode; | ||
| 11 | import android.graphics.Rect; | ||
| 12 | import android.graphics.drawable.BitmapDrawable; | ||
| 13 | import android.graphics.drawable.Drawable; | ||
| 14 | import android.util.AttributeSet; | ||
| 15 | import android.widget.ImageView; | ||
| 16 | |||
| 17 | /** | ||
| 18 | * 自定义的圆形ImageView,可以直接当组件在布局中使用。 | ||
| 19 | * | ||
| 20 | * @author caizhiming | ||
| 21 | */ | ||
| 22 | @SuppressLint("AppCompatCustomView") | ||
| 23 | public class Imageviews extends ImageView { | ||
| 24 | |||
| 25 | private Paint paint; | ||
| 26 | |||
| 27 | public Imageviews(Context context) { | ||
| 28 | this(context, null); | ||
| 29 | } | ||
| 30 | |||
| 31 | public Imageviews(Context context, AttributeSet attrs) { | ||
| 32 | this(context, attrs, 0); | ||
| 33 | } | ||
| 34 | |||
| 35 | public Imageviews(Context context, AttributeSet attrs, int defStyle) { | ||
| 36 | super(context, attrs, defStyle); | ||
| 37 | paint = new Paint(); | ||
| 38 | |||
| 39 | } | ||
| 40 | |||
| 41 | /** | ||
| 42 | * 绘制圆形图片 | ||
| 43 | * | ||
| 44 | * @author caizhiming | ||
| 45 | */ | ||
| 46 | @Override | ||
| 47 | protected void onDraw(Canvas canvas) { | ||
| 48 | |||
| 49 | Drawable drawable = getDrawable(); | ||
| 50 | if (null != drawable) { | ||
| 51 | Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap(); | ||
| 52 | Bitmap b = getCircleBitmap(bitmap, 14); | ||
| 53 | final Rect rectSrc = new Rect(0, 0, b.getWidth(), b.getHeight()); | ||
| 54 | final Rect rectDest = new Rect(0, 0, getWidth(), getHeight()); | ||
| 55 | paint.reset(); | ||
| 56 | canvas.drawBitmap(b, rectSrc, rectDest, paint); | ||
| 57 | |||
| 58 | } else { | ||
| 59 | super.onDraw(canvas); | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | /** | ||
| 64 | * 获取圆形图片方法 | ||
| 65 | * | ||
| 66 | * @param bitmap | ||
| 67 | * @param pixels | ||
| 68 | * @return Bitmap | ||
| 69 | * @author caizhiming | ||
| 70 | */ | ||
| 71 | private Bitmap getCircleBitmap(Bitmap bitmap, int pixels) { | ||
| 72 | Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), | ||
| 73 | bitmap.getHeight(), Config.ARGB_8888); | ||
| 74 | Canvas canvas = new Canvas(output); | ||
| 75 | |||
| 76 | final int color = 0xff424242; | ||
| 77 | |||
| 78 | final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); | ||
| 79 | paint.setAntiAlias(true); | ||
| 80 | canvas.drawARGB(0, 0, 0, 0); | ||
| 81 | paint.setColor(color); | ||
| 82 | int x = bitmap.getWidth(); | ||
| 83 | |||
| 84 | canvas.drawCircle(x / 2, x / 2, x / 2, paint); | ||
| 85 | paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); | ||
| 86 | canvas.drawBitmap(bitmap, rect, rect, paint); | ||
| 87 | return output; | ||
| 88 | |||
| 89 | |||
| 90 | } | ||
| 91 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/View/RoundImageView60dip.java
| File was created | 1 | package com.hjx.personalcenter.View; | |
| 2 | |||
| 3 | |||
| 4 | import android.content.Context; | ||
| 5 | import android.graphics.Canvas; | ||
| 6 | import android.graphics.Color; | ||
| 7 | import android.graphics.Paint; | ||
| 8 | import android.graphics.PorterDuff; | ||
| 9 | import android.graphics.PorterDuffXfermode; | ||
| 10 | import android.graphics.RectF; | ||
| 11 | import android.support.v7.widget.AppCompatImageView; | ||
| 12 | import android.util.AttributeSet; | ||
| 13 | |||
| 14 | import com.hjx.personalcenter.activity.MyApplication; | ||
| 15 | |||
| 16 | |||
| 17 | /** | ||
| 18 | * | ||
| 19 | * @author skg | ||
| 20 | */ | ||
| 21 | public class RoundImageView60dip extends AppCompatImageView { | ||
| 22 | |||
| 23 | public RoundImageView60dip(Context context, AttributeSet attrs) { | ||
| 24 | super(context, attrs); | ||
| 25 | init(); | ||
| 26 | } | ||
| 27 | |||
| 28 | public RoundImageView60dip(Context context, AttributeSet attrs, int defStyle) { | ||
| 29 | super(context, attrs, defStyle); | ||
| 30 | init(); | ||
| 31 | } | ||
| 32 | |||
| 33 | public RoundImageView60dip(Context context) { | ||
| 34 | super(context); | ||
| 35 | init(); | ||
| 36 | } | ||
| 37 | |||
| 38 | private final RectF roundRect = new RectF(); | ||
| 39 | private float rect_adius = dip2px(60); | ||
| 40 | private final Paint maskPaint = new Paint(); | ||
| 41 | private final Paint zonePaint = new Paint(); | ||
| 42 | |||
| 43 | private void init() { | ||
| 44 | maskPaint.setAntiAlias(true); | ||
| 45 | maskPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); | ||
| 46 | // | ||
| 47 | zonePaint.setAntiAlias(true); | ||
| 48 | zonePaint.setColor(Color.WHITE); | ||
| 49 | // | ||
| 50 | /*float density = getResources().getDisplayMetrics().density; | ||
| 51 | rect_adius = rect_adius * density;*/ | ||
| 52 | } | ||
| 53 | |||
| 54 | public void setRectAdius(float adius) { | ||
| 55 | rect_adius = adius; | ||
| 56 | invalidate(); | ||
| 57 | } | ||
| 58 | |||
| 59 | @Override | ||
| 60 | protected void onLayout(boolean changed, int left, int top, int right, | ||
| 61 | int bottom) { | ||
| 62 | super.onLayout(changed, left, top, right, bottom); | ||
| 63 | int w = getWidth(); | ||
| 64 | int h = getHeight(); | ||
| 65 | roundRect.set(0, 0, w, h); | ||
| 66 | } | ||
| 67 | |||
| 68 | @Override | ||
| 69 | public void draw(Canvas canvas) { | ||
| 70 | canvas.saveLayer(roundRect, zonePaint, Canvas.ALL_SAVE_FLAG); | ||
| 71 | canvas.drawRoundRect(roundRect, rect_adius, rect_adius, zonePaint); | ||
| 72 | // | ||
| 73 | canvas.saveLayer(roundRect, maskPaint, Canvas.ALL_SAVE_FLAG); | ||
| 74 | super.draw(canvas); | ||
| 75 | canvas.restore(); | ||
| 76 | } | ||
| 77 | |||
| 78 | /** | ||
| 79 | * �����ֻ��ķֱ��ʴ� dp �ĵ�λ ת��Ϊ px(����) | ||
| 80 | */ | ||
| 81 | public static int dip2px(float dpValue) { | ||
| 82 | final float scale = MyApplication.getInstance().getResources() | ||
| 83 | .getDisplayMetrics().density; | ||
| 84 | return (int) (dpValue * scale + 0.5f); | ||
| 85 | } | ||
| 86 | |||
| 87 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/AccountManagementActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | import android.os.Message; | 6 | import android.os.Message; |
| 7 | import android.support.v4.app.FragmentActivity; | 7 | import android.support.v4.app.FragmentActivity; |
| 8 | import android.support.v7.widget.LinearLayoutManager; | 8 | import android.support.v7.widget.LinearLayoutManager; |
| 9 | import android.support.v7.widget.RecyclerView; | 9 | import android.support.v7.widget.RecyclerView; |
| 10 | import android.util.Log; | 10 | import android.util.Log; |
| 11 | import android.view.View; | 11 | import android.view.View; |
| 12 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
| 13 | import android.widget.LinearLayout; | 13 | import android.widget.LinearLayout; |
| 14 | import android.widget.TextView; | 14 | import android.widget.TextView; |
| 15 | 15 | ||
| 16 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 17 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
| 18 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; | 17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; |
| 19 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
| 20 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
| 21 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
| 22 | import com.hjx.personalcenter.http.HttpCode; | 21 | import com.hjx.personalcenter.http.HttpCode; |
| 23 | import com.hjx.personalcenter.http.HttpManager; | 22 | import com.hjx.personalcenter.http.HttpManager; |
| 24 | import com.hjx.personalcenter.model.ChildsInfo; | 23 | import com.hjx.personalcenter.model.ChildsInfo; |
| 25 | import com.hjx.personalcenter.util.AlertUtils; | 24 | import com.hjx.personalcenter.util.AlertUtils; |
| 26 | import com.hjx.personalcenter.util.GetDevicesUtil; | 25 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 26 | import com.squareup.picasso.Picasso; | ||
| 27 | 27 | ||
| 28 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
| 29 | import java.util.List; | 29 | import java.util.List; |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * 账户管理 熊巍 | 32 | * 账户管理 熊巍 |
| 33 | * Created by h on 2017/8/12. | 33 | * Created by h on 2017/8/12. |
| 34 | */ | 34 | */ |
| 35 | 35 | ||
| 36 | public class AccountManagementActivity extends FragmentActivity implements View.OnClickListener { | 36 | public class AccountManagementActivity extends FragmentActivity implements View.OnClickListener { |
| 37 | private TextView changbangding, changpassword, usernames, | 37 | private TextView changbangding, changpassword, usernames, |
| 38 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; | 38 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; |
| 39 | private ImageView iv_useing, cancel; | 39 | private ImageView iv_useing, cancel; |
| 40 | private SimpleDraweeView mSimpleDraweeView; | 40 | private ImageView mSimpleDraweeView; |
| 41 | private RecyclerView listview; | 41 | private RecyclerView listview; |
| 42 | private LinearLayout add_accunt, ll_zhu_backgrangd; | 42 | private LinearLayout add_accunt, ll_zhu_backgrangd; |
| 43 | private AccountChildsAdapter childsAdapter; | 43 | private AccountChildsAdapter childsAdapter; |
| 44 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); | 44 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); |
| 45 | private String subAccountId = null; | 45 | private String subAccountId = null; |
| 46 | Handler handler = new Handler() { | 46 | Handler handler = new Handler() { |
| 47 | @Override | 47 | @Override |
| 48 | public void handleMessage(Message msg) { | 48 | public void handleMessage(Message msg) { |
| 49 | super.handleMessage(msg); | 49 | super.handleMessage(msg); |
| 50 | switch (msg.what) { | 50 | switch (msg.what) { |
| 51 | case HttpCode.CHILDS_SUCESS: | 51 | case HttpCode.CHILDS_SUCESS: |
| 52 | ChildsInfo childsInfo = new ChildsInfo(); | 52 | ChildsInfo childsInfo = new ChildsInfo(); |
| 53 | if (childsInfo.getStatus()==1000) { | 53 | if (childsInfo.getStatus()==1000) { |
| 54 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.USERNAME); | 54 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.USERNAME); |
| 55 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.ADRESS); | 55 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.ADRESS); |
| 56 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); | 56 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); |
| 57 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); | 57 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); |
| 58 | tv_username.setText(names); | 58 | tv_username.setText(names); |
| 59 | tv_grade.setText(grades); | 59 | tv_grade.setText(grades); |
| 60 | tv_school.setText(schools); | 60 | tv_school.setText(schools); |
| 61 | tv_adress.setText(adress); | 61 | tv_adress.setText(adress); |
| 62 | tv_changzhu.setText("使用中"); | 62 | tv_changzhu.setText("使用中"); |
| 63 | tv_changzhu.setEnabled(false); | 63 | tv_changzhu.setEnabled(false); |
| 64 | iv_useing.setVisibility(View.VISIBLE); | 64 | iv_useing.setVisibility(View.VISIBLE); |
| 65 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 65 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
| 66 | //mSimpleDraweeView.setImageURI(phote); | 66 | //mSimpleDraweeView.setImageURI(phote); |
| 67 | 67 | ||
| 68 | } else { | 68 | } else { |
| 69 | String name = null; | 69 | String name = null; |
| 70 | String grade = null; | 70 | String grade = null; |
| 71 | String school = null; | 71 | String school = null; |
| 72 | String addr = null; | 72 | String addr = null; |
| 73 | String phote = null; | 73 | String phote = null; |
| 74 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); | 74 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); |
| 75 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; | 75 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; |
| 76 | for (int i = 0; i < list.size(); i++) { | 76 | for (int i = 0; i < list.size(); i++) { |
| 77 | int type = list.get(i).getType(); | 77 | int type = list.get(i).getType(); |
| 78 | if (type == 1) { | 78 | if (type == 1) { |
| 79 | name = list.get(i).getName(); | 79 | name = list.get(i).getName(); |
| 80 | grade = list.get(i).getGrade(); | 80 | grade = list.get(i).getGrade(); |
| 81 | school = list.get(i).getSchool(); | 81 | school = list.get(i).getSchool(); |
| 82 | addr = list.get(i).getRegion(); | 82 | addr = list.get(i).getRegion(); |
| 83 | phote = list.get(i).getImage(); | 83 | phote = list.get(i).getImage(); |
| 84 | subAccountId = list.get(i).getGradeId(); | 84 | subAccountId = list.get(i).getGradeId(); |
| 85 | } else if (type == 2) { | 85 | } else if (type == 2) { |
| 86 | childList.add(list.get(i)); | 86 | childList.add(list.get(i)); |
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | tv_username.setText(name); | 89 | tv_username.setText(name); |
| 90 | tv_grade.setText(grade); | 90 | tv_grade.setText(grade); |
| 91 | tv_school.setText(school); | 91 | tv_school.setText(school); |
| 92 | tv_adress.setText(addr); | 92 | tv_adress.setText(addr); |
| 93 | mSimpleDraweeView.setImageURI(phote); | 93 | if (phote!=null&&!phote.isEmpty()) { |
| 94 | Picasso.with(AccountManagementActivity.this).load(phote).into(mSimpleDraweeView); | ||
| 95 | } | ||
| 94 | data.clear(); | 96 | data.clear(); |
| 95 | data.addAll(childList); | 97 | data.addAll(childList); |
| 96 | childsAdapter.notifyDataSetChanged(); | 98 | childsAdapter.notifyDataSetChanged(); |
| 97 | } | 99 | } |
| 98 | break; | 100 | break; |
| 99 | } | 101 | } |
| 100 | } | 102 | } |
| 101 | }; | 103 | }; |
| 102 | 104 | ||
| 103 | @Override | 105 | @Override |
| 104 | protected void onCreate(Bundle savedInstanceState) { | 106 | protected void onCreate(Bundle savedInstanceState) { |
| 105 | super.onCreate(savedInstanceState); | 107 | super.onCreate(savedInstanceState); |
| 106 | setContentView(R.layout.activity_account_management); | 108 | setContentView(R.layout.activity_account_management); |
| 107 | initView(); | 109 | initView(); |
| 108 | initData(); | 110 | initData(); |
| 109 | initLister(); | 111 | initLister(); |
| 110 | } | 112 | } |
| 111 | 113 | ||
| 112 | private void initView() { | 114 | private void initView() { |
| 113 | changbangding = (TextView) findViewById(R.id.changBangding); | 115 | changbangding = (TextView) findViewById(R.id.changBangding); |
| 114 | changpassword = (TextView) findViewById(R.id.changpassword); | 116 | changpassword = (TextView) findViewById(R.id.changpassword); |
| 115 | usernames = (TextView) findViewById(R.id.cunt_username); | 117 | usernames = (TextView) findViewById(R.id.cunt_username); |
| 116 | tv_username = (TextView) findViewById(R.id.tv_account_name); | 118 | tv_username = (TextView) findViewById(R.id.tv_account_name); |
| 117 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); | 119 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); |
| 118 | tv_school = (TextView) findViewById(R.id.tv_account_school); | 120 | tv_school = (TextView) findViewById(R.id.tv_account_school); |
| 119 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); | 121 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); |
| 120 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.tv_account_head); | 122 | mSimpleDraweeView = (ImageView) findViewById(R.id.tv_account_head); |
| 121 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); | 123 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); |
| 122 | cancel = (ImageView) findViewById(R.id.cancel); | 124 | cancel = (ImageView) findViewById(R.id.cancel); |
| 123 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); | 125 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); |
| 124 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); | 126 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); |
| 125 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 127 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
| 126 | } | 128 | } |
| 127 | 129 | ||
| 128 | private void initData() { | 130 | private void initData() { |
| 129 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); | 131 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
| 130 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 132 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 131 | usernames.setText(cunt_username); | 133 | usernames.setText(cunt_username); |
| 132 | 134 | ||
| 133 | if (account.equals("1")) { | 135 | if (account.equals("1")) { |
| 134 | tv_changzhu.setText("使用中"); | 136 | tv_changzhu.setText("使用中"); |
| 135 | tv_changzhu.setEnabled(false); | 137 | tv_changzhu.setEnabled(false); |
| 136 | iv_useing.setVisibility(View.VISIBLE); | 138 | iv_useing.setVisibility(View.VISIBLE); |
| 137 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 139 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
| 138 | } else { | 140 | } else { |
| 139 | tv_changzhu.setText("切换主账户"); | 141 | tv_changzhu.setText("切换主账户"); |
| 140 | tv_changzhu.setEnabled(true); | 142 | tv_changzhu.setEnabled(true); |
| 141 | iv_useing.setVisibility(View.GONE); | 143 | iv_useing.setVisibility(View.GONE); |
| 142 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 144 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
| 143 | } | 145 | } |
| 144 | 146 | ||
| 145 | 147 | ||
| 146 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 148 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
| 147 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 149 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
| 148 | listview.setLayoutManager(linearLayoutManager); | 150 | listview.setLayoutManager(linearLayoutManager); |
| 149 | childsAdapter = new AccountChildsAdapter(data, this); | 151 | childsAdapter = new AccountChildsAdapter(data, this); |
| 150 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); | 152 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); |
| 151 | listview.setAdapter(childsAdapter); | 153 | listview.setAdapter(childsAdapter); |
| 152 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { | 154 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { |
| 153 | @Override | 155 | @Override |
| 154 | public void onItemClick(View view, int position) { | 156 | public void onItemClick(View view, int position) { |
| 155 | 157 | ||
| 156 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); | 158 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); |
| 157 | } | 159 | } |
| 158 | }); | 160 | }); |
| 159 | 161 | ||
| 160 | } | 162 | } |
| 161 | 163 | ||
| 162 | 164 | ||
| 163 | private void initLister() { | 165 | private void initLister() { |
| 164 | changbangding.setOnClickListener(this); | 166 | changbangding.setOnClickListener(this); |
| 165 | changpassword.setOnClickListener(this); | 167 | changpassword.setOnClickListener(this); |
| 166 | cancel.setOnClickListener(this); | 168 | cancel.setOnClickListener(this); |
| 167 | tv_changzhu.setOnClickListener(this); | 169 | tv_changzhu.setOnClickListener(this); |
| 168 | 170 | ||
| 169 | 171 | ||
| 170 | } | 172 | } |
| 171 | 173 | ||
| 172 | @Override | 174 | @Override |
| 173 | public void onClick(View v) { | 175 | public void onClick(View v) { |
| 174 | switch (v.getId()) { | 176 | switch (v.getId()) { |
| 175 | case R.id.changBangding: | 177 | case R.id.changBangding: |
| 176 | Content.authcodeflag = 1; | 178 | Content.authcodeflag = 1; |
| 177 | Intent changebangding = new Intent(); | 179 | Intent changebangding = new Intent(); |
| 178 | changebangding.setClass(AccountManagementActivity.this, ElectronicCardValidationActivity.class); | 180 | changebangding.setClass(AccountManagementActivity.this, ElectronicCardValidationActivity.class); |
| 179 | startActivity(changebangding); | 181 | startActivity(changebangding); |
| 180 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 182 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 181 | break; | 183 | break; |
| 182 | case R.id.changpassword: | 184 | case R.id.changpassword: |
| 183 | Intent changpwd = new Intent(); | 185 | Intent changpwd = new Intent(); |
| 184 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); | 186 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); |
| 185 | startActivity(changpwd); | 187 | startActivity(changpwd); |
| 186 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 188 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 187 | break; | 189 | break; |
| 188 | case R.id.change_zhu_account: | 190 | case R.id.change_zhu_account: |
| 189 | Content.changgeaccountflag = 1; | 191 | Content.changgeaccountflag = 1; |
| 190 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 192 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 191 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); | 193 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); |
| 192 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 194 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
| 193 | //String ss = SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADENS); | 195 | //String ss = SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADENS); |
| 194 | String zizhuanhui = SaveParam.getInstance().getCustomizeParam(AccountManagementActivity.this, SaveParam.CHILDSGRADENSss); | 196 | String zizhuanhui = SaveParam.getInstance().getCustomizeParam(AccountManagementActivity.this, SaveParam.CHILDSGRADENSss); |
| 195 | try { | 197 | try { |
| 196 | long auserID = Long.parseLong(userID); | 198 | long auserID = Long.parseLong(userID); |
| 197 | int zhugrade = Integer.parseInt(subAccountId); | 199 | int zhugrade = Integer.parseInt(subAccountId); |
| 198 | int zigrade = Integer.parseInt(zizhuanhui); | 200 | int zigrade = Integer.parseInt(zizhuanhui); |
| 199 | Log.i("---", "发送完了"+zhugrade+"ddd"+zhugrade); | 201 | Log.i("---", "发送完了"+zhugrade+"ddd"+zhugrade); |
| 200 | // if ((zhugrade < 8)&&(zigrade>=8)||(zhugrade >= 8)&&(zigrade<8)) { | 202 | // if ((zhugrade < 8)&&(zigrade>=8)||(zhugrade >= 8)&&(zigrade<8)) { |
| 201 | // Intent intentbroad = new Intent(); | 203 | // Intent intentbroad = new Intent(); |
| 202 | // intentbroad.putExtra("info", "小学"); | 204 | // intentbroad.putExtra("info", "小学"); |
| 203 | // //4、定义广播发送的action | 205 | // //4、定义广播发送的action |
| 204 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 206 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
| 205 | // //5、发送广播 | 207 | // //5、发送广播 |
| 206 | // sendBroadcast(intentbroad); | 208 | // sendBroadcast(intentbroad); |
| 207 | // Log.i("---", "发送完了"); | 209 | // Log.i("---", "发送完了"); |
| 208 | // } | 210 | // } |
| 209 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, | 211 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, |
| 210 | devicenumber, 1); | 212 | devicenumber, 1); |
| 211 | 213 | ||
| 212 | } catch (NumberFormatException e) { | 214 | } catch (NumberFormatException e) { |
| 213 | e.printStackTrace(); | 215 | e.printStackTrace(); |
| 214 | } | 216 | } |
| 215 | 217 | ||
| 216 | 218 | ||
| 217 | break; | 219 | break; |
| 218 | case R.id.cancel: | 220 | case R.id.cancel: |
| 219 | finish(); | 221 | finish(); |
| 220 | break; | 222 | break; |
| 221 | 223 | ||
| 222 | } | 224 | } |
| 223 | 225 | ||
| 224 | } | 226 | } |
| 225 | 227 | ||
| 226 | @Override | 228 | @Override |
| 227 | protected void onResume() { | 229 | protected void onResume() { |
| 228 | super.onResume(); | 230 | super.onResume(); |
| 229 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 231 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 230 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 232 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
| 231 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); | 233 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
| 232 | usernames.setText(cunt_username); | 234 | usernames.setText(cunt_username); |
| 233 | try { | 235 | try { |
| 234 | long auserID = Long.parseLong(userID); | 236 | long auserID = Long.parseLong(userID); |
| 235 | HttpManager.getInstance().getchildAccountinfo(this, auserID, devicenumber, handler); | 237 | HttpManager.getInstance().getchildAccountinfo(this, auserID, devicenumber, handler); |
| 236 | 238 | ||
| 237 | } catch (NumberFormatException e) { | 239 | } catch (NumberFormatException e) { |
| 238 | e.printStackTrace(); | 240 | e.printStackTrace(); |
| 239 | } | 241 | } |
| 240 | } | 242 | } |
| 241 | } | 243 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | import android.os.Message; | 6 | import android.os.Message; |
| 7 | import android.support.v4.app.FragmentActivity; | 7 | import android.support.v4.app.FragmentActivity; |
| 8 | import android.util.Log; | 8 | import android.util.Log; |
| 9 | import android.view.View; | 9 | import android.view.View; |
| 10 | import android.widget.AdapterView; | 10 | import android.widget.AdapterView; |
| 11 | import android.widget.Button; | 11 | import android.widget.Button; |
| 12 | import android.widget.GridView; | 12 | import android.widget.GridView; |
| 13 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
| 14 | import android.widget.TextView; | 14 | import android.widget.TextView; |
| 15 | import android.widget.Toast; | 15 | import android.widget.Toast; |
| 16 | 16 | ||
| 17 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 18 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
| 19 | import com.hjx.personalcenter.adapter.GridAdapter; | 18 | import com.hjx.personalcenter.adapter.GridAdapter; |
| 20 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 19 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
| 21 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 20 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
| 22 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
| 23 | import com.hjx.personalcenter.http.HttpCode; | 22 | import com.hjx.personalcenter.http.HttpCode; |
| 24 | import com.hjx.personalcenter.http.HttpManager; | 23 | import com.hjx.personalcenter.http.HttpManager; |
| 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 24 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 26 | import com.hjx.personalcenter.model.DefautPublishInfo; | 25 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 27 | import com.hjx.personalcenter.model.VersionInfo; | 26 | import com.hjx.personalcenter.model.VersionInfo; |
| 28 | import com.hjx.personalcenter.util.AlertUtils; | 27 | import com.hjx.personalcenter.util.AlertUtils; |
| 29 | import com.hjx.personalcenter.util.GetDevicesUtil; | 28 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 29 | import com.squareup.picasso.Picasso; | ||
| 30 | 30 | ||
| 31 | import org.json.JSONException; | 31 | import org.json.JSONException; |
| 32 | import org.json.JSONObject; | 32 | import org.json.JSONObject; |
| 33 | 33 | ||
| 34 | import java.util.ArrayList; | 34 | import java.util.ArrayList; |
| 35 | import java.util.List; | 35 | import java.util.List; |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | * 选择教材 | 38 | * 选择教材 |
| 39 | * Created by h on 2017/8/10. | 39 | * Created by h on 2017/8/10. |
| 40 | */ | 40 | */ |
| 41 | 41 | ||
| 42 | public class ChoiseTextBookActivity extends FragmentActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { | 42 | public class ChoiseTextBookActivity extends FragmentActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { |
| 43 | private GridView gridView; | 43 | private GridView gridView; |
| 44 | private Button btn_ok; | 44 | private Button btn_ok; |
| 45 | private ImageView cancel; | 45 | private ImageView cancel; |
| 46 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 46 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
| 47 | private GridAdapter sim_adapter; | 47 | private GridAdapter sim_adapter; |
| 48 | private SimpleDraweeView simpleDraweeView; | 48 | private ImageView simpleDraweeView; |
| 49 | private TextView publish; | 49 | private TextView publish; |
| 50 | private String chinese, math, english, physics, chemistry, history, geography, political, biology, science; | 50 | private String chinese, math, english, physics, chemistry, history, geography, political, biology, science; |
| 51 | 51 | ||
| 52 | 52 | ||
| 53 | Handler handler = new Handler() { | 53 | Handler handler = new Handler() { |
| 54 | @Override | 54 | @Override |
| 55 | public void handleMessage(Message msg) { | 55 | public void handleMessage(Message msg) { |
| 56 | super.handleMessage(msg); | 56 | super.handleMessage(msg); |
| 57 | JSONObject jsonObject; | 57 | JSONObject jsonObject; |
| 58 | String status; | 58 | String status; |
| 59 | switch (msg.what) { | 59 | switch (msg.what) { |
| 60 | case HttpCode.CHECKCARD: | 60 | case HttpCode.CHECKCARD: |
| 61 | try { | 61 | try { |
| 62 | jsonObject = new JSONObject((String) msg.obj); | 62 | jsonObject = new JSONObject((String) msg.obj); |
| 63 | status = jsonObject.optString("status"); | 63 | status = jsonObject.optString("status"); |
| 64 | if (status.equals("1")) { | 64 | if (status.equals("1")) { |
| 65 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); | 65 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); |
| 66 | Intent intent = new Intent(); | 66 | Intent intent = new Intent(); |
| 67 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 67 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
| 68 | ChoiseTextBookActivity.this.startActivity(intent); | 68 | ChoiseTextBookActivity.this.startActivity(intent); |
| 69 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 69 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 70 | } else if (status.equals("2001")) { | 70 | } else if (status.equals("2001")) { |
| 71 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); | 71 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); |
| 72 | } else if (status.equals("2002")) { | 72 | } else if (status.equals("2002")) { |
| 73 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您的机器为样机,可直接使用!"); | 73 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您的机器为样机,可直接使用!"); |
| 74 | Intent intent = new Intent(); | 74 | Intent intent = new Intent(); |
| 75 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 75 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
| 76 | ChoiseTextBookActivity.this.startActivity(intent); | 76 | ChoiseTextBookActivity.this.startActivity(intent); |
| 77 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 77 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | } catch (JSONException e) { | 80 | } catch (JSONException e) { |
| 81 | e.printStackTrace(); | 81 | e.printStackTrace(); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | break; | 84 | break; |
| 85 | case HttpCode.PUBLISH_SUCESS: | 85 | case HttpCode.PUBLISH_SUCESS: |
| 86 | defautPublishInfos.clear(); | 86 | defautPublishInfos.clear(); |
| 87 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 87 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
| 88 | sim_adapter.notifyDataSetChanged(); | 88 | sim_adapter.notifyDataSetChanged(); |
| 89 | for (int i = 0; i < defautPublishInfos.size(); i++) { | 89 | for (int i = 0; i < defautPublishInfos.size(); i++) { |
| 90 | String subject = defautPublishInfos.get(i).getSubject(); | 90 | String subject = defautPublishInfos.get(i).getSubject(); |
| 91 | if (subject.equals("语文")) { | 91 | if (subject.equals("语文")) { |
| 92 | chinese = defautPublishInfos.get(i).getPress(); | 92 | chinese = defautPublishInfos.get(i).getPress(); |
| 93 | } else if (subject.equals("数学")) { | 93 | } else if (subject.equals("数学")) { |
| 94 | math = defautPublishInfos.get(i).getPress(); | 94 | math = defautPublishInfos.get(i).getPress(); |
| 95 | } else if (subject.equals("英语")) { | 95 | } else if (subject.equals("英语")) { |
| 96 | english = defautPublishInfos.get(i).getPress(); | 96 | english = defautPublishInfos.get(i).getPress(); |
| 97 | } else if (subject.equals("物理")) { | 97 | } else if (subject.equals("物理")) { |
| 98 | physics = defautPublishInfos.get(i).getPress(); | 98 | physics = defautPublishInfos.get(i).getPress(); |
| 99 | } else if (subject.equals("化学")) { | 99 | } else if (subject.equals("化学")) { |
| 100 | chemistry = defautPublishInfos.get(i).getPress(); | 100 | chemistry = defautPublishInfos.get(i).getPress(); |
| 101 | } else if (subject.equals("历史")) { | 101 | } else if (subject.equals("历史")) { |
| 102 | history = defautPublishInfos.get(i).getPress(); | 102 | history = defautPublishInfos.get(i).getPress(); |
| 103 | } else if (subject.equals("地理")) { | 103 | } else if (subject.equals("地理")) { |
| 104 | geography = defautPublishInfos.get(i).getPress(); | 104 | geography = defautPublishInfos.get(i).getPress(); |
| 105 | } else if (subject.equals("政治")) { | 105 | } else if (subject.equals("政治")) { |
| 106 | political = defautPublishInfos.get(i).getPress(); | 106 | political = defautPublishInfos.get(i).getPress(); |
| 107 | } else if (subject.equals("生物")) { | 107 | } else if (subject.equals("生物")) { |
| 108 | biology = defautPublishInfos.get(i).getPress(); | 108 | biology = defautPublishInfos.get(i).getPress(); |
| 109 | } else if (subject.equals("科学")) { | 109 | } else if (subject.equals("科学")) { |
| 110 | science = defautPublishInfos.get(i).getPress(); | 110 | science = defautPublishInfos.get(i).getPress(); |
| 111 | } | 111 | } |
| 112 | } | 112 | } |
| 113 | break; | 113 | break; |
| 114 | case HttpCode.REGISTERINFO_SUCESS: | 114 | case HttpCode.REGISTERINFO_SUCESS: |
| 115 | try { | 115 | try { |
| 116 | jsonObject = new JSONObject((String) msg.obj); | 116 | jsonObject = new JSONObject((String) msg.obj); |
| 117 | String statusregister = jsonObject.optString("status"); | 117 | String statusregister = jsonObject.optString("status"); |
| 118 | if (statusregister.equals("1")) { | 118 | if (statusregister.equals("1")) { |
| 119 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); | 119 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); |
| 120 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ChoiseTextBookActivity.this).getDeviceNumber(); | 120 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ChoiseTextBookActivity.this).getDeviceNumber(); |
| 121 | if (deviceNumber == null) { | 121 | if (deviceNumber == null) { |
| 122 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 122 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
| 123 | 123 | ||
| 124 | } else { | 124 | } else { |
| 125 | //验证保卡信息 | 125 | //验证保卡信息 |
| 126 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, deviceNumber, handler); | 126 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, deviceNumber, handler); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | } else { | 129 | } else { |
| 130 | // AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); | 130 | // AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); |
| 131 | } | 131 | } |
| 132 | } catch (JSONException e) { | 132 | } catch (JSONException e) { |
| 133 | e.printStackTrace(); | 133 | e.printStackTrace(); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | 136 | ||
| 137 | break; | 137 | break; |
| 138 | 138 | ||
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | } | 141 | } |
| 142 | }; | 142 | }; |
| 143 | 143 | ||
| 144 | @Override | 144 | @Override |
| 145 | protected void onCreate(Bundle savedInstanceState) { | 145 | protected void onCreate(Bundle savedInstanceState) { |
| 146 | super.onCreate(savedInstanceState); | 146 | super.onCreate(savedInstanceState); |
| 147 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 147 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 148 | String graderid = SaveParam.getInstance().getLoginParam(this, SaveParam.CHILDSGRADENS); | 148 | String graderid = SaveParam.getInstance().getLoginParam(this, SaveParam.CHILDSGRADENS); |
| 149 | String accounts = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this,SaveParam.ACCOUNT); | 149 | String accounts = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this,SaveParam.ACCOUNT); |
| 150 | try { | 150 | try { |
| 151 | long auserID = Long.parseLong(userID); | 151 | long auserID = Long.parseLong(userID); |
| 152 | int graderID = Integer.parseInt(graderid); | 152 | int graderID = Integer.parseInt(graderid); |
| 153 | int accountss = Integer.parseInt(accounts); | 153 | int accountss = Integer.parseInt(accounts); |
| 154 | //获取版本信息 | 154 | //获取版本信息 |
| 155 | HttpManager.getInstance().getpublishinfo(this, auserID, graderID,accountss, handler); | 155 | HttpManager.getInstance().getpublishinfo(this, auserID, graderID,accountss, handler); |
| 156 | 156 | ||
| 157 | } catch (NumberFormatException e) { | 157 | } catch (NumberFormatException e) { |
| 158 | e.printStackTrace(); | 158 | e.printStackTrace(); |
| 159 | } | 159 | } |
| 160 | setContentView(R.layout.activity_choisetextbook); | 160 | setContentView(R.layout.activity_choisetextbook); |
| 161 | SysApplication.getInstance().addActivity(this); | 161 | SysApplication.getInstance().addActivity(this); |
| 162 | initView(); | 162 | initView(); |
| 163 | initData(); | 163 | initData(); |
| 164 | initLister(); | 164 | initLister(); |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | private void initView() { | 167 | private void initView() { |
| 168 | gridView = (GridView) findViewById(R.id.grideview); | 168 | gridView = (GridView) findViewById(R.id.grideview); |
| 169 | cancel = (ImageView) findViewById(R.id.cancel); | 169 | cancel = (ImageView) findViewById(R.id.cancel); |
| 170 | btn_ok = (Button) findViewById(R.id.btn_ok); | 170 | btn_ok = (Button) findViewById(R.id.btn_ok); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | private void initData() { | 173 | private void initData() { |
| 174 | sim_adapter = new GridAdapter(defautPublishInfos, this); | 174 | sim_adapter = new GridAdapter(defautPublishInfos, this); |
| 175 | //配置适配器 | 175 | //配置适配器 |
| 176 | gridView.setAdapter(sim_adapter); | 176 | gridView.setAdapter(sim_adapter); |
| 177 | 177 | ||
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | private void initLister() { | 180 | private void initLister() { |
| 181 | btn_ok.setOnClickListener(this); | 181 | btn_ok.setOnClickListener(this); |
| 182 | cancel.setOnClickListener(this); | 182 | cancel.setOnClickListener(this); |
| 183 | gridView.setOnItemClickListener(this); | 183 | gridView.setOnItemClickListener(this); |
| 184 | 184 | ||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | @Override | 187 | @Override |
| 188 | public void onClick(View v) { | 188 | public void onClick(View v) { |
| 189 | switch (v.getId()) { | 189 | switch (v.getId()) { |
| 190 | case R.id.btn_ok: | 190 | case R.id.btn_ok: |
| 191 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 191 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 192 | String regionId = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); | 192 | String regionId = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); |
| 193 | String regionId1 = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.CITYS); | 193 | String regionId1 = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.CITYS); |
| 194 | if (regionId == null) { | 194 | if (regionId == null) { |
| 195 | regionId = regionId1; | 195 | regionId = regionId1; |
| 196 | } | 196 | } |
| 197 | String grade = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CHILDSGRADENS); | 197 | String grade = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CHILDSGRADENS); |
| 198 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); | 198 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); |
| 199 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.USERNAME); | 199 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.USERNAME); |
| 200 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADRESS); | 200 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADRESS); |
| 201 | 201 | ||
| 202 | try { | 202 | try { |
| 203 | if (userID == null) { | 203 | if (userID == null) { |
| 204 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 204 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
| 205 | 205 | ||
| 206 | } else { | 206 | } else { |
| 207 | Object schoolID; | 207 | Object schoolID; |
| 208 | long auserID = Long.parseLong(userID); | 208 | long auserID = Long.parseLong(userID); |
| 209 | int gradeID = Integer.parseInt(grade); | 209 | int gradeID = Integer.parseInt(grade); |
| 210 | long regionID = Long.parseLong(regionId); | 210 | long regionID = Long.parseLong(regionId); |
| 211 | if (schoolid == null) { | 211 | if (schoolid == null) { |
| 212 | schoolID = null; | 212 | schoolID = null; |
| 213 | } else { | 213 | } else { |
| 214 | schoolID = Long.parseLong(schoolid); | 214 | schoolID = Long.parseLong(schoolid); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | //提交注册信息 | 217 | //提交注册信息 |
| 218 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, | 218 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, |
| 219 | name, gradeID, regionID, regeionname, schoolID, math, english, chinese, physics, chemistry, history, geography, political, biology, science, handler); | 219 | name, gradeID, regionID, regeionname, schoolID, math, english, chinese, physics, chemistry, history, geography, political, biology, science, handler); |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | } catch (NumberFormatException e) { | 222 | } catch (NumberFormatException e) { |
| 223 | e.printStackTrace(); | 223 | e.printStackTrace(); |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | break; | 226 | break; |
| 227 | case R.id.cancel: | 227 | case R.id.cancel: |
| 228 | finish(); | 228 | finish(); |
| 229 | break; | 229 | break; |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | @Override | 234 | @Override |
| 235 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 235 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
| 236 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); | 236 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); |
| 237 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); | 237 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); |
| 238 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | 238 | simpleDraweeView = (ImageView) view.findViewById(R.id.image_publish); |
| 239 | publish = (TextView) view.findViewById(R.id.tv_publish); | 239 | publish = (TextView) view.findViewById(R.id.tv_publish); |
| 240 | 240 | ||
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | @Override | 243 | @Override |
| 244 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | 244 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { |
| 245 | String imageurl = data.get(position).getPressCover(); | 245 | String imageurl = data.get(position).getPressCover(); |
| 246 | String publishs = data.get(position).getPressName(); | 246 | String publishs = data.get(position).getPressName(); |
| 247 | simpleDraweeView.setImageURI(imageurl); | 247 | if (imageurl!=null&&!imageurl.isEmpty()) { |
| 248 | Picasso.with(ChoiseTextBookActivity.this).load(imageurl).into(simpleDraweeView); | ||
| 249 | } | ||
| 248 | publish.setText(publishs); | 250 | publish.setText(publishs); |
| 249 | String subject = SaveParam.getInstance().getLoginParam(this, SaveParam.SUBJECT); | 251 | String subject = SaveParam.getInstance().getLoginParam(this, SaveParam.SUBJECT); |
| 250 | Log.e("test", "选择的科目" + subject); | 252 | Log.e("test", "选择的科目" + subject); |
| 251 | if ("语文".equals(subject)) { | 253 | if ("语文".equals(subject)) { |
| 252 | chinese = publishs; | 254 | chinese = publishs; |
| 253 | } else if ("数学".equals(subject)) { | 255 | } else if ("数学".equals(subject)) { |
| 254 | math = publishs; | 256 | math = publishs; |
| 255 | } else if ("英语".equals(subject)) { | 257 | } else if ("英语".equals(subject)) { |
| 256 | english = publishs; | 258 | english = publishs; |
| 257 | } else if ("物理".equals(subject)) { | 259 | } else if ("物理".equals(subject)) { |
| 258 | physics = publishs; | 260 | physics = publishs; |
| 259 | } else if ("化学".equals(subject)) { | 261 | } else if ("化学".equals(subject)) { |
| 260 | chemistry = publishs; | 262 | chemistry = publishs; |
| 261 | } else if ("历史".equals(subject)) { | 263 | } else if ("历史".equals(subject)) { |
| 262 | history = publishs; | 264 | history = publishs; |
| 263 | } else if ("地理".equals(subject)) { | 265 | } else if ("地理".equals(subject)) { |
| 264 | geography = publishs; | 266 | geography = publishs; |
| 265 | } else if ("政治".equals(subject)) { | 267 | } else if ("政治".equals(subject)) { |
| 266 | political = publishs; | 268 | political = publishs; |
| 267 | } else if ("生物".equals(subject)) { | 269 | } else if ("生物".equals(subject)) { |
| 268 | biology = publishs; | 270 | biology = publishs; |
| 269 | } else if ("科学".equals(subject)) { | 271 | } else if ("科学".equals(subject)) { |
| 270 | science = publishs; | 272 | science = publishs; |
| 271 | } | 273 | } |
| 272 | 274 | ||
| 273 | } | 275 | } |
| 274 | } | 276 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardInfoOKActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | import android.support.v4.app.FragmentActivity; | 4 | import android.support.v4.app.FragmentActivity; |
| 5 | import android.view.KeyEvent; | ||
| 5 | import android.view.View; | 6 | import android.view.View; |
| 6 | import android.widget.Button; | 7 | import android.widget.Button; |
| 7 | import android.widget.ImageView; | 8 | import android.widget.ImageView; |
| 8 | import android.widget.TextView; | 9 | import android.widget.TextView; |
| 9 | 10 | ||
| 10 | import com.hjx.personalcenter.R; | 11 | import com.hjx.personalcenter.R; |
| 11 | import com.hjx.personalcenter.db.Content; | 12 | import com.hjx.personalcenter.db.Content; |
| 12 | import com.hjx.personalcenter.db.SaveParam; | 13 | import com.hjx.personalcenter.db.SaveParam; |
| 13 | import com.hjx.personalcenter.http.HttpManager; | 14 | import com.hjx.personalcenter.http.HttpManager; |
| 14 | import com.hjx.personalcenter.util.GetDevicesUtil; | 15 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 15 | 16 | ||
| 16 | /**确认保卡信息 | 17 | /**确认保卡信息 |
| 17 | * Created by h on 2017/8/11. | 18 | * Created by h on 2017/8/11. |
| 18 | */ | 19 | */ |
| 19 | 20 | ||
| 20 | public class ElectronicCardInfoOKActivity extends FragmentActivity implements View.OnClickListener { | 21 | public class ElectronicCardInfoOKActivity extends FragmentActivity implements View.OnClickListener { |
| 21 | private Button btn_finish,btn_bangding; | 22 | private Button btn_finish,btn_bangding; |
| 22 | private ImageView iv_last_step; | 23 | private ImageView iv_last_step; |
| 23 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; | 24 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; |
| 24 | @Override | 25 | @Override |
| 25 | protected void onCreate(Bundle savedInstanceState) { | 26 | protected void onCreate(Bundle savedInstanceState) { |
| 26 | super.onCreate(savedInstanceState); | 27 | super.onCreate(savedInstanceState); |
| 27 | setContentView(R.layout.activity_ok_cardinfo); | 28 | setContentView(R.layout.activity_ok_cardinfo); |
| 28 | SysApplication.getInstance().addActivity(this); | 29 | SysApplication.getInstance().addActivity(this); |
| 29 | initView(); | 30 | initView(); |
| 30 | initData(); | 31 | initData(); |
| 31 | initLister(); | 32 | initLister(); |
| 32 | } | 33 | } |
| 33 | private void initView() { | 34 | private void initView() { |
| 34 | btn_finish = (Button) findViewById(R.id.btn_finish); | 35 | btn_finish = (Button) findViewById(R.id.btn_finish); |
| 35 | iv_last_step = (ImageView) findViewById(R.id.cancel); | 36 | iv_last_step = (ImageView) findViewById(R.id.cancel); |
| 36 | usename = (TextView) findViewById(R.id.iv_card_username); | 37 | usename = (TextView) findViewById(R.id.iv_card_username); |
| 37 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 38 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
| 38 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 39 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
| 39 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 40 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
| 40 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 41 | shoptime = (TextView) findViewById(R.id.tv_card_time); |
| 41 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 42 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
| 42 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 43 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
| 43 | phone = (TextView) findViewById(R.id.tv_card_phone); | 44 | phone = (TextView) findViewById(R.id.tv_card_phone); |
| 44 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 45 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
| 45 | btn_bangding = (Button) findViewById(R.id.btn_bangding); | 46 | btn_bangding = (Button) findViewById(R.id.btn_bangding); |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | private void initData() { | 49 | private void initData() { |
| 49 | //获取设备信息 | 50 | //获取设备信息 |
| 50 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 51 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
| 51 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 52 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
| 52 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 53 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
| 53 | //获取保卡信息 | 54 | //获取保卡信息 |
| 54 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | 55 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); |
| 55 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | 56 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); |
| 56 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | 57 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); |
| 57 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | 58 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); |
| 58 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | 59 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); |
| 59 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | 60 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); |
| 60 | 61 | ||
| 61 | 62 | ||
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | private void initLister() { | 65 | private void initLister() { |
| 65 | iv_last_step.setOnClickListener(this); | 66 | iv_last_step.setOnClickListener(this); |
| 66 | btn_finish.setOnClickListener(this); | 67 | btn_finish.setOnClickListener(this); |
| 67 | btn_bangding.setOnClickListener(this); | 68 | btn_bangding.setOnClickListener(this); |
| 68 | } | 69 | } |
| 69 | 70 | ||
| 70 | @Override | 71 | @Override |
| 71 | public void onClick(View v) { | 72 | public void onClick(View v) { |
| 72 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 73 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
| 73 | long auserID = 0; | 74 | long auserID = 0; |
| 74 | switch (v.getId()){ | 75 | switch (v.getId()){ |
| 75 | case R.id.btn_finish: | 76 | case R.id.btn_finish: |
| 76 | Content.cardintentflag =1; | 77 | Content.cardintentflag =1; |
| 77 | try { | 78 | try { |
| 78 | auserID = Long.parseLong(userID); | 79 | auserID = Long.parseLong(userID); |
| 79 | } catch (NumberFormatException e) { | 80 | } catch (NumberFormatException e) { |
| 80 | e.printStackTrace(); | 81 | e.printStackTrace(); |
| 81 | } | 82 | } |
| 82 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), | 83 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), |
| 83 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), | 84 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), |
| 84 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), | 85 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), |
| 85 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), | 86 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), |
| 86 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | 87 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); |
| 87 | break; | 88 | break; |
| 88 | case R.id.btn_bangding: | 89 | case R.id.btn_bangding: |
| 89 | Content.cardintentflag =2; | 90 | Content.cardintentflag =2; |
| 90 | try { | 91 | try { |
| 91 | auserID = Long.parseLong(userID); | 92 | auserID = Long.parseLong(userID); |
| 92 | } catch (NumberFormatException e) { | 93 | } catch (NumberFormatException e) { |
| 93 | e.printStackTrace(); | 94 | e.printStackTrace(); |
| 94 | } | 95 | } |
| 95 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), | 96 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), |
| 96 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), | 97 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), |
| 97 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), | 98 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), |
| 98 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), | 99 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), |
| 99 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | 100 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); |
| 100 | 101 | ||
| 101 | break; | 102 | break; |
| 102 | case R.id.cancel: | 103 | case R.id.cancel: |
| 103 | finish(); | 104 | finish(); |
| 104 | break; | 105 | break; |
| 105 | } | 106 | } |
| 106 | } | 107 | } |
| 108 | @Override | ||
| 109 | public boolean onKeyDown(int keyCode, KeyEvent event) { | ||
| 110 | if (keyCode == KeyEvent.KEYCODE_BACK) { | ||
| 111 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardInfoOKActivity.this,SaveParam.CARDPHONE,""); | ||
| 112 | return false;//return true;拦截事件传递,从而屏蔽back键。 | ||
| 113 | } | ||
| 114 | if (KeyEvent.KEYCODE_HOME == keyCode) { | ||
| 115 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardInfoOKActivity.this,SaveParam.CARDPHONE,""); | ||
| 116 | return false;//同理 | ||
| 117 | } | ||
| 118 | return super.onKeyDown(keyCode, event); | ||
| 119 | } | ||
| 107 | 120 | ||
| 108 | |||
| 109 | } | 121 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/FeedBackActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.content.pm.PackageManager; | 4 | import android.content.pm.PackageManager; |
| 5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
| 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.provider.MediaStore; | 9 | import android.provider.MediaStore; |
| 10 | import android.support.annotation.NonNull; | 10 | import android.support.annotation.NonNull; |
| 11 | import android.support.v4.app.FragmentActivity; | 11 | import android.support.v4.app.FragmentActivity; |
| 12 | import android.support.v4.content.FileProvider; | 12 | import android.support.v4.content.FileProvider; |
| 13 | import android.text.TextUtils; | 13 | import android.text.TextUtils; |
| 14 | import android.view.Gravity; | 14 | import android.view.Gravity; |
| 15 | import android.view.View; | 15 | import android.view.View; |
| 16 | import android.widget.AdapterView; | 16 | import android.widget.AdapterView; |
| 17 | import android.widget.EditText; | 17 | import android.widget.EditText; |
| 18 | import android.widget.ImageView; | 18 | import android.widget.ImageView; |
| 19 | import android.widget.TextView; | 19 | import android.widget.TextView; |
| 20 | import android.widget.Toast; | 20 | import android.widget.Toast; |
| 21 | 21 | ||
| 22 | import com.facebook.drawee.backends.pipeline.Fresco; | ||
| 23 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | ||
| 24 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | ||
| 25 | import com.facebook.drawee.generic.RoundingParams; | ||
| 26 | import com.facebook.drawee.interfaces.DraweeController; | ||
| 27 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 28 | import com.hjx.personalcenter.R; | 22 | import com.hjx.personalcenter.R; |
| 29 | import com.hjx.personalcenter.db.SaveParam; | 23 | import com.hjx.personalcenter.db.SaveParam; |
| 30 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
| 31 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
| 32 | import com.hjx.personalcenter.util.CropUtils; | 26 | import com.hjx.personalcenter.util.CropUtils; |
| 33 | import com.hjx.personalcenter.util.DialogPermission; | 27 | import com.hjx.personalcenter.util.DialogPermission; |
| 34 | import com.hjx.personalcenter.util.FileUtil; | 28 | import com.hjx.personalcenter.util.FileUtil; |
| 35 | import com.hjx.personalcenter.util.PermissionUtil; | 29 | import com.hjx.personalcenter.util.PermissionUtil; |
| 36 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 30 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
| 37 | import com.mylhyl.circledialog.CircleDialog; | 31 | import com.mylhyl.circledialog.CircleDialog; |
| 38 | import com.mylhyl.circledialog.callback.ConfigButton; | 32 | import com.mylhyl.circledialog.callback.ConfigButton; |
| 39 | import com.mylhyl.circledialog.callback.ConfigDialog; | 33 | import com.mylhyl.circledialog.callback.ConfigDialog; |
| 40 | import com.mylhyl.circledialog.params.ButtonParams; | 34 | import com.mylhyl.circledialog.params.ButtonParams; |
| 41 | import com.mylhyl.circledialog.params.DialogParams; | 35 | import com.mylhyl.circledialog.params.DialogParams; |
| 42 | 36 | ||
| 43 | import java.io.File; | 37 | import java.io.File; |
| 44 | 38 | ||
| 45 | /** | 39 | /** |
| 46 | * Created by h on 2017/8/11. | 40 | * Created by h on 2017/8/11. |
| 47 | */ | 41 | */ |
| 48 | 42 | ||
| 49 | public class FeedBackActivity extends FragmentActivity implements View.OnClickListener { | 43 | public class FeedBackActivity extends FragmentActivity implements View.OnClickListener { |
| 50 | private ImageView iv_cance, iv_show, iv_take; | 44 | private ImageView iv_cance, iv_show, iv_take; |
| 51 | private EditText content, phone; | 45 | private EditText content, phone; |
| 52 | private TextView tv_sub; | 46 | private TextView tv_sub; |
| 53 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 47 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
| 54 | private static final int REQUEST_CODE_ALBUM = 2; | 48 | private static final int REQUEST_CODE_ALBUM = 2; |
| 55 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 49 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
| 56 | private SimpleDraweeView mSimpleDraweeView; | 50 | private ImageView mSimpleDraweeView; |
| 57 | String type = "个人中心"; | 51 | String type = "个人中心"; |
| 58 | private File file; | 52 | private File file; |
| 59 | private Uri uri; | 53 | private Uri uri; |
| 60 | 54 | ||
| 61 | @Override | 55 | @Override |
| 62 | protected void onCreate(Bundle savedInstanceState) { | 56 | protected void onCreate(Bundle savedInstanceState) { |
| 63 | super.onCreate(savedInstanceState); | 57 | super.onCreate(savedInstanceState); |
| 64 | Fresco.initialize(this); | ||
| 65 | setContentView(R.layout.activity_feedback); | 58 | setContentView(R.layout.activity_feedback); |
| 66 | initView(); | 59 | initView(); |
| 67 | initData(); | 60 | initData(); |
| 68 | initLister(); | 61 | initLister(); |
| 69 | } | 62 | } |
| 70 | 63 | ||
| 71 | private void initView() { | 64 | private void initView() { |
| 72 | iv_cance = (ImageView) findViewById(R.id.cancel); | 65 | iv_cance = (ImageView) findViewById(R.id.cancel); |
| 73 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.show_iv); | 66 | mSimpleDraweeView = (ImageView) findViewById(R.id.show_iv); |
| 74 | iv_take = (ImageView) findViewById(R.id.iv_take); | 67 | iv_take = (ImageView) findViewById(R.id.iv_take); |
| 75 | content = (EditText) findViewById(R.id.feedback_content); | 68 | content = (EditText) findViewById(R.id.feedback_content); |
| 76 | phone = (EditText) findViewById(R.id.feedback_phone); | 69 | phone = (EditText) findViewById(R.id.feedback_phone); |
| 77 | tv_sub = (TextView) findViewById(R.id.feedback_sub); | 70 | tv_sub = (TextView) findViewById(R.id.feedback_sub); |
| 78 | 71 | ||
| 79 | } | 72 | } |
| 80 | 73 | ||
| 81 | private void initData() { | 74 | private void initData() { |
| 82 | file = new File(FileUtil.getCachePath(this), "user-feedback.jpg"); | 75 | file = new File(FileUtil.getCachePath(this), "user-feedback.jpg"); |
| 83 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 76 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 84 | uri = Uri.fromFile(file); | 77 | uri = Uri.fromFile(file); |
| 85 | } else { | 78 | } else { |
| 86 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 79 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
| 87 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 80 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
| 88 | } | 81 | } |
| 89 | 82 | ||
| 90 | } | 83 | } |
| 91 | 84 | ||
| 92 | private void initLister() { | 85 | private void initLister() { |
| 93 | iv_cance.setOnClickListener(this); | 86 | iv_cance.setOnClickListener(this); |
| 94 | iv_take.setOnClickListener(this); | 87 | iv_take.setOnClickListener(this); |
| 95 | tv_sub.setOnClickListener(this); | 88 | tv_sub.setOnClickListener(this); |
| 96 | mSimpleDraweeView.setOnClickListener(this); | 89 | mSimpleDraweeView.setOnClickListener(this); |
| 97 | 90 | ||
| 98 | } | 91 | } |
| 99 | 92 | ||
| 100 | @Override | 93 | @Override |
| 101 | public void onClick(View v) { | 94 | public void onClick(View v) { |
| 102 | String contents = content.getText().toString().trim(); | 95 | String contents = content.getText().toString().trim(); |
| 103 | String contants = phone.getText().toString().trim(); | 96 | String contants = phone.getText().toString().trim(); |
| 104 | switch (v.getId()) { | 97 | switch (v.getId()) { |
| 105 | case R.id.cancel: | 98 | case R.id.cancel: |
| 106 | finish(); | 99 | finish(); |
| 107 | break; | 100 | break; |
| 108 | case R.id.iv_take: | 101 | case R.id.iv_take: |
| 109 | choiceAvatar(); | 102 | choiceAvatar(); |
| 110 | break; | 103 | break; |
| 111 | case R.id.feedback_sub: | 104 | case R.id.feedback_sub: |
| 112 | //提交用户反馈 | 105 | //提交用户反馈 |
| 113 | if (TextUtils.isEmpty(contents)) { | 106 | if (TextUtils.isEmpty(contents)) { |
| 114 | AlertUtils.showToast(FeedBackActivity.this, "写下两点宝贵的意见或建议吧"); | 107 | AlertUtils.showToast(FeedBackActivity.this, "写下两点宝贵的意见或建议吧"); |
| 115 | return; | 108 | return; |
| 116 | } | 109 | } |
| 117 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 110 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 118 | try { | 111 | try { |
| 119 | HttpManager.getInstance().feedback(FeedBackActivity.this, userID, | 112 | HttpManager.getInstance().feedback(FeedBackActivity.this, userID, |
| 120 | contents,contants,file.getPath(),type); | 113 | contents, contants, file.getPath(), type); |
| 121 | } catch (Exception e) { | 114 | } catch (Exception e) { |
| 122 | e.printStackTrace(); | 115 | e.printStackTrace(); |
| 123 | } | 116 | } |
| 124 | break; | 117 | break; |
| 125 | case R.id.show_iv: | 118 | case R.id.show_iv: |
| 126 | 119 | ||
| 127 | 120 | ||
| 128 | break; | 121 | break; |
| 129 | } | 122 | } |
| 130 | } | 123 | } |
| 131 | 124 | ||
| 132 | //拍摄头像 | 125 | //拍摄头像 |
| 133 | private void choiceAvatar() { | 126 | private void choiceAvatar() { |
| 134 | final String[] items = {"拍照", "从相册选择"}; | 127 | final String[] items = {"拍照", "从相册选择"}; |
| 135 | new CircleDialog.Builder(this) | 128 | new CircleDialog.Builder(this) |
| 136 | .configDialog(new ConfigDialog() { | 129 | .configDialog(new ConfigDialog() { |
| 137 | @Override | 130 | @Override |
| 138 | public void onConfig(DialogParams params) { | 131 | public void onConfig(DialogParams params) { |
| 139 | //增加弹出动画 | 132 | //增加弹出动画 |
| 140 | params.gravity = Gravity.CENTER; | 133 | params.gravity = Gravity.CENTER; |
| 141 | } | 134 | } |
| 142 | }) | 135 | }) |
| 143 | .setTitle("请选择图片来源") | 136 | .setTitle("请选择图片来源") |
| 144 | .setWidth(0.5f) | 137 | .setWidth(0.5f) |
| 145 | .setItems(items, new AdapterView.OnItemClickListener() { | 138 | .setItems(items, new AdapterView.OnItemClickListener() { |
| 146 | @Override | 139 | @Override |
| 147 | public void onItemClick(AdapterView<?> parent, View view, int | 140 | public void onItemClick(AdapterView<?> parent, View view, int |
| 148 | position, long id) { | 141 | position, long id) { |
| 149 | switch (position) { | 142 | switch (position) { |
| 150 | case 0: | 143 | case 0: |
| 151 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { | 144 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { |
| 152 | uploadAvatarFromPhotoRequest(); | 145 | uploadAvatarFromPhotoRequest(); |
| 153 | } | 146 | } |
| 154 | break; | 147 | break; |
| 155 | case 1: | 148 | case 1: |
| 156 | uploadAvatarFromAlbumRequest(); | 149 | uploadAvatarFromAlbumRequest(); |
| 157 | break; | 150 | break; |
| 158 | } | 151 | } |
| 159 | 152 | ||
| 160 | } | 153 | } |
| 161 | }) | 154 | }) |
| 162 | .setNegative("取消", null) | 155 | .setNegative("取消", null) |
| 163 | .configNegative(new ConfigButton() { | 156 | .configNegative(new ConfigButton() { |
| 164 | @Override | 157 | @Override |
| 165 | public void onConfig(ButtonParams params) { | 158 | public void onConfig(ButtonParams params) { |
| 166 | //取消按钮字体颜色 | 159 | //取消按钮字体颜色 |
| 167 | params.textColor = Color.RED; | 160 | params.textColor = Color.RED; |
| 168 | } | 161 | } |
| 169 | }) | 162 | }) |
| 170 | .show(); | 163 | .show(); |
| 171 | 164 | ||
| 172 | 165 | ||
| 173 | } | 166 | } |
| 174 | 167 | ||
| 175 | //照相 | 168 | //照相 |
| 176 | private void uploadAvatarFromPhotoRequest() { | 169 | private void uploadAvatarFromPhotoRequest() { |
| 177 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 170 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
| 178 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 171 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 179 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 172 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
| 180 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 173 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
| 181 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 174 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
| 182 | } | 175 | } |
| 183 | 176 | ||
| 184 | //选择图库 | 177 | //选择图库 |
| 185 | private void uploadAvatarFromAlbumRequest() { | 178 | private void uploadAvatarFromAlbumRequest() { |
| 186 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 179 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
| 187 | photoPickerIntent.setType("image/*"); | 180 | photoPickerIntent.setType("image/*"); |
| 188 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 181 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
| 189 | } | 182 | } |
| 190 | 183 | ||
| 191 | //回掉 | 184 | //回掉 |
| 192 | @Override | 185 | @Override |
| 193 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 186 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 194 | super.onActivityResult(requestCode, resultCode, data); | 187 | super.onActivityResult(requestCode, resultCode, data); |
| 195 | if (resultCode != -1) { | 188 | if (resultCode != -1) { |
| 196 | return; | 189 | return; |
| 197 | } | 190 | } |
| 198 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 191 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
| 199 | Uri newUri; | 192 | Uri newUri; |
| 200 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 193 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 201 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 194 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
| 202 | } else { | 195 | } else { |
| 203 | newUri = data.getData(); | 196 | newUri = data.getData(); |
| 204 | } | 197 | } |
| 205 | if (newUri != null) { | 198 | if (newUri != null) { |
| 206 | //uploadAvatarFromPhoto(); | 199 | //uploadAvatarFromPhoto(); |
| 207 | //裁剪图片 | 200 | //裁剪图片 |
| 208 | startPhotoZoom(newUri); | 201 | startPhotoZoom(newUri); |
| 209 | } else { | 202 | } else { |
| 210 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 203 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
| 211 | } | 204 | } |
| 212 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 205 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
| 213 | uploadAvatarFromPhoto(); | 206 | uploadAvatarFromPhoto(); |
| 214 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 207 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
| 215 | uploadAvatarFromPhoto(); | 208 | uploadAvatarFromPhoto(); |
| 216 | } | 209 | } |
| 217 | } | 210 | } |
| 218 | 211 | ||
| 219 | private void uploadAvatarFromPhoto() { | 212 | private void uploadAvatarFromPhoto() { |
| 220 | compressAndUploadAvatar(file.getPath()); | 213 | compressAndUploadAvatar(file.getPath()); |
| 221 | 214 | ||
| 222 | } | 215 | } |
| 223 | 216 | ||
| 224 | private void compressAndUploadAvatar(String fileSrc) { | 217 | private void compressAndUploadAvatar(String fileSrc) { |
| 225 | 218 | ||
| 226 | 219 | ||
| 227 | //上传到服务器 | 220 | //上传到服务器 |
| 228 | 221 | ||
| 229 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 222 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
| 230 | String mimeType = "image/*"; | 223 | String mimeType = "image/*"; |
| 231 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 224 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
| 232 | //String fileName = cover.getName(); | 225 | //String fileName = cover.getName(); |
| 233 | //HttpManager.getInstance().header(this, fileSrc); | 226 | //HttpManager.getInstance().header(this, fileSrc); |
| 234 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 227 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
| 235 | //Fresco设置圆形头像 | 228 | //Fresco设置圆形头像 |
| 236 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 229 | // GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
| 237 | GenericDraweeHierarchy hierarchy = builder | 230 | // GenericDraweeHierarchy hierarchy = builder |
| 238 | .setDesiredAspectRatio(1f) | 231 | // .setDesiredAspectRatio(1f) |
| 239 | .setFailureImage(R.mipmap.blank) | 232 | // .setFailureImage(R.mipmap.blank) |
| 240 | //圆形头像 | 233 | // //圆形头像 |
| 241 | .setRoundingParams(RoundingParams.fromCornersRadius(0.7f)) | 234 | // .setRoundingParams(RoundingParams.fromCornersRadius(0.7f)) |
| 242 | .build(); | 235 | // .build(); |
| 236 | // //OOM | ||
| 237 | // ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) | ||
| 238 | // //根据View的尺寸放缩图片 | ||
| 239 | // .setResizeOptions(new ResizeOptions(mSimpleDraweeView.getWidth(), mSimpleDraweeView.getHeight())) | ||
| 240 | // .build(); | ||
| 241 | |||
| 243 | 242 | ||
| 244 | //加载本地图片 | 243 | //加载本地图片 |
| 245 | Uri uri = Uri.fromFile(cover); | 244 | mSimpleDraweeView.setImageURI(Uri.fromFile(new File(fileSrc))); |
| 246 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 245 | |
| 247 | .setOldController(mSimpleDraweeView.getController()) | 246 | //Picasso.with(FeedBackActivity.this).load(fileSrc).into(mSimpleDraweeView); |
| 248 | .setUri(uri) | 247 | // Uri uri = Uri.fromFile(cover); |
| 249 | .build(); | 248 | // DraweeController controller = Fresco.newDraweeControllerBuilder() |
| 250 | mSimpleDraweeView.setHierarchy(hierarchy); | 249 | // .setOldController(mSimpleDraweeView.getController()) |
| 251 | mSimpleDraweeView.setController(controller); | 250 | // .setImageRequest(request) |
| 251 | // .setUri(uri) | ||
| 252 | // .build(); | ||
| 253 | // mSimpleDraweeView.setHierarchy(hierarchy); | ||
| 254 | // mSimpleDraweeView.setController(controller); | ||
| 252 | 255 | ||
| 253 | } | 256 | } |
| 254 | 257 | ||
| 255 | public void startPhotoZoom(Uri uri) { | 258 | public void startPhotoZoom(Uri uri) { |
| 256 | Intent intent = new Intent("com.android.camera.action.CROP"); | 259 | Intent intent = new Intent("com.android.camera.action.CROP"); |
| 257 | intent.setDataAndType(uri, "image/*"); | 260 | intent.setDataAndType(uri, "image/*"); |
| 258 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 261 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 259 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 262 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
| 260 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 263 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
| 261 | intent.putExtra("aspectY", 1);// x:y=1:1 | 264 | intent.putExtra("aspectY", 1);// x:y=1:1 |
| 262 | // intent.putExtra("outputX", 400);//图片输出大小 | 265 | // intent.putExtra("outputX", 400);//图片输出大小 |
| 263 | // intent.putExtra("outputY", 400); | 266 | // intent.putExtra("outputY", 400); |
| 264 | intent.putExtra("output", Uri.fromFile(file)); | 267 | intent.putExtra("output", Uri.fromFile(file)); |
| 265 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 268 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
| 266 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 269 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
| 267 | } | 270 | } |
| 268 | 271 | ||
| 269 | @Override | 272 | @Override |
| 270 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 273 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
| 271 | switch (requestCode) { | 274 | switch (requestCode) { |
| 272 | 275 | ||
| 273 | case PermissionUtil.REQUEST_SHOWCAMERA: | 276 | case PermissionUtil.REQUEST_SHOWCAMERA: |
| 274 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 277 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
| 275 | // Permission Granted | 278 | // Permission Granted |
| 276 | uploadAvatarFromPhotoRequest(); | 279 | uploadAvatarFromPhotoRequest(); |
| 277 | 280 | ||
| 278 | } else { | 281 | } else { |
| 279 | if (!SharedPreferenceMark.getHasShowCamera()) { | 282 | if (!SharedPreferenceMark.getHasShowCamera()) { |
| 280 | SharedPreferenceMark.setHasShowCamera(true); | 283 | SharedPreferenceMark.setHasShowCamera(true); |
| 281 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 284 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
| 282 | 285 | ||
| 283 | } else { | 286 | } else { |
| 284 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 287 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
| 285 | .show(); | 288 | .show(); |
| 286 | } | 289 | } |
| 287 | } | 290 | } |
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; | ||
| 27 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | ||
| 28 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | ||
| 29 | import com.facebook.drawee.generic.RoundingParams; | ||
| 30 | import com.facebook.drawee.interfaces.DraweeController; | ||
| 31 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 32 | import com.google.gson.Gson; | 26 | import com.google.gson.Gson; |
| 33 | import com.hjx.personalcenter.R; | 27 | import com.hjx.personalcenter.R; |
| 34 | import com.hjx.personalcenter.adapter.MianGridAdapter; | 28 | import com.hjx.personalcenter.adapter.MianGridAdapter; |
| 35 | import com.hjx.personalcenter.adapter.VideoAdapter; | 29 | import com.hjx.personalcenter.adapter.VideoAdapter; |
| 36 | import com.hjx.personalcenter.customdialog.HeadDialog; | 30 | import com.hjx.personalcenter.customdialog.HeadDialog; |
| 37 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 31 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
| 38 | import com.hjx.personalcenter.db.Content; | 32 | import com.hjx.personalcenter.db.Content; |
| 39 | import com.hjx.personalcenter.db.SaveParam; | 33 | import com.hjx.personalcenter.db.SaveParam; |
| 40 | import com.hjx.personalcenter.http.HttpCode; | 34 | import com.hjx.personalcenter.http.HttpCode; |
| 41 | import com.hjx.personalcenter.http.HttpManager; | 35 | import com.hjx.personalcenter.http.HttpManager; |
| 42 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 36 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 43 | import com.hjx.personalcenter.model.DefautPublishInfo; | 37 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 44 | import com.hjx.personalcenter.model.PesonalInfo; | 38 | import com.hjx.personalcenter.model.PesonalInfo; |
| 45 | import com.hjx.personalcenter.model.SignInfo; | 39 | import com.hjx.personalcenter.model.SignInfo; |
| 46 | import com.hjx.personalcenter.model.VideoInfo; | 40 | import com.hjx.personalcenter.model.VideoInfo; |
| 47 | import com.hjx.personalcenter.update.UpdateChecker; | 41 | import com.hjx.personalcenter.update.UpdateChecker; |
| 48 | import com.hjx.personalcenter.util.AlertUtils; | 42 | import com.hjx.personalcenter.util.AlertUtils; |
| 49 | import com.hjx.personalcenter.util.BrithdayStar; | 43 | import com.hjx.personalcenter.util.BrithdayStar; |
| 50 | import com.hjx.personalcenter.util.CropUtils; | 44 | import com.hjx.personalcenter.util.CropUtils; |
| 51 | import com.hjx.personalcenter.util.DialogPermission; | 45 | import com.hjx.personalcenter.util.DialogPermission; |
| 52 | import com.hjx.personalcenter.util.FileUtil; | 46 | import com.hjx.personalcenter.util.FileUtil; |
| 53 | import com.hjx.personalcenter.util.GetDevicesUtil; | 47 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 54 | import com.hjx.personalcenter.util.PermissionUtil; | 48 | import com.hjx.personalcenter.util.PermissionUtil; |
| 55 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 49 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
| 56 | import com.mylhyl.circledialog.CircleDialog; | 50 | import com.mylhyl.circledialog.CircleDialog; |
| 57 | import com.mylhyl.circledialog.callback.ConfigInput; | 51 | import com.mylhyl.circledialog.callback.ConfigInput; |
| 58 | import com.mylhyl.circledialog.params.InputParams; | 52 | import com.mylhyl.circledialog.params.InputParams; |
| 59 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 53 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
| 54 | import com.squareup.picasso.Picasso; | ||
| 60 | import com.zaaach.toprightmenu.MenuItem; | 55 | import com.zaaach.toprightmenu.MenuItem; |
| 61 | import com.zaaach.toprightmenu.TopRightMenu; | 56 | import com.zaaach.toprightmenu.TopRightMenu; |
| 62 | 57 | ||
| 63 | import org.json.JSONException; | 58 | import org.json.JSONException; |
| 64 | import org.json.JSONObject; | 59 | import org.json.JSONObject; |
| 65 | 60 | ||
| 66 | import java.io.File; | 61 | import java.io.File; |
| 67 | import java.io.UnsupportedEncodingException; | 62 | import java.io.UnsupportedEncodingException; |
| 68 | import java.util.ArrayList; | 63 | import java.util.ArrayList; |
| 69 | import java.util.List; | 64 | import java.util.List; |
| 70 | 65 | ||
| 71 | public class MainActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 66 | public class MainActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
| 72 | private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex, tv_edit_presoninfo; | 67 | private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex, tv_edit_presoninfo; |
| 73 | private TextView tv_sign, | 68 | private TextView tv_sign, |
| 74 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 69 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
| 75 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; | 70 | 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; | 71 | private TextView linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass, iv_look_card; |
| 77 | private TopRightMenu mTopRightMenu; | 72 | private TopRightMenu mTopRightMenu; |
| 78 | private LinearLayout view_novedeo; | 73 | private LinearLayout view_novedeo; |
| 79 | private View sssssssss; | 74 | private View sssssssss; |
| 80 | //水平滑动 | 75 | //水平滑动 |
| 81 | private RecyclerView mRecyclerView; | 76 | private RecyclerView mRecyclerView; |
| 82 | private GridView mRecyclerViewpublish; | 77 | private GridView mRecyclerViewpublish; |
| 83 | private VideoAdapter RecyclerViewadapter; | 78 | private VideoAdapter RecyclerViewadapter; |
| 84 | private MianGridAdapter RecyclerViewadapterpublish; | 79 | private MianGridAdapter RecyclerViewadapterpublish; |
| 85 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 80 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
| 86 | 81 | ||
| 87 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); | 82 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); |
| 88 | private boolean showIcon = false; | 83 | private boolean showIcon = false; |
| 89 | private boolean dimBg = false; | 84 | private boolean dimBg = false; |
| 90 | private boolean needAnim = true; | 85 | private boolean needAnim = true; |
| 91 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 86 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
| 92 | private static final int REQUEST_CODE_ALBUM = 2; | 87 | private static final int REQUEST_CODE_ALBUM = 2; |
| 93 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 88 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
| 94 | SimpleDraweeView mSimpleDraweeView; | 89 | private ImageView mSimpleDraweeView; |
| 95 | private File file; | 90 | private File file; |
| 96 | private Uri uri; | 91 | private Uri uri; |
| 92 | String portrait; | ||
| 97 | Handler handler = new Handler() { | 93 | Handler handler = new Handler() { |
| 98 | @Override | 94 | @Override |
| 99 | public void handleMessage(Message msg) { | 95 | public void handleMessage(Message msg) { |
| 100 | super.handleMessage(msg); | 96 | super.handleMessage(msg); |
| 101 | switch (msg.what) { | 97 | switch (msg.what) { |
| 102 | case HttpCode.GETINFO: | 98 | case HttpCode.GETINFO: |
| 103 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; | 99 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; |
| 104 | tv_username.setText(cardinfoBean.getNickName()); | 100 | tv_username.setText(cardinfoBean.getNickName()); |
| 105 | tv_username1.setText(cardinfoBean.getNickName()); | 101 | tv_username1.setText(cardinfoBean.getNickName()); |
| 106 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 102 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
| 107 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 103 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
| 108 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 104 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
| 109 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 105 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
| 110 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 106 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
| 111 | String sex = cardinfoBean.getGender(); | 107 | String sex = cardinfoBean.getGender(); |
| 112 | if ("0".equals(sex)) { | 108 | if ("0".equals(sex)) { |
| 113 | tv_sex.setText("男"); | 109 | tv_sex.setText("男"); |
| 114 | iv_sex.setImageResource(R.mipmap.men); | 110 | iv_sex.setImageResource(R.mipmap.men); |
| 115 | } else { | 111 | } else { |
| 116 | tv_sex.setText("女"); | 112 | tv_sex.setText("女"); |
| 117 | iv_sex.setImageResource(R.mipmap.women); | 113 | iv_sex.setImageResource(R.mipmap.women); |
| 118 | } | 114 | } |
| 119 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | 115 | portrait = cardinfoBean.getPortrait(); |
| 116 | //mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | ||
| 117 | if (portrait!=null&&!portrait.isEmpty()) { | ||
| 118 | Picasso.with(MainActivity.this).load(portrait).into(mSimpleDraweeView); | ||
| 119 | } | ||
| 120 | //加载星座 | 120 | //加载星座 |
| 121 | BrithdayStar brithdayStar = new BrithdayStar(); | 121 | BrithdayStar brithdayStar = new BrithdayStar(); |
| 122 | if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) { | 122 | if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) { |
| 123 | tv_mygad.setText(""); | 123 | tv_mygad.setText(""); |
| 124 | } else { | 124 | } else { |
| 125 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); | 125 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); |
| 126 | tv_mygad.setText(xiongzuo); | 126 | tv_mygad.setText(xiongzuo); |
| 127 | } | 127 | } |
| 128 | //保存个人信息 | 128 | //保存个人信息 |
| 129 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName()); | 129 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName()); |
| 130 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName()); | 130 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName()); |
| 131 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName()); | 131 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName()); |
| 132 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday()); | 132 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday()); |
| 133 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString()); | 133 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString()); |
| 134 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq()); | 134 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq()); |
| 135 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName()); | 135 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName()); |
| 136 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress()); | 136 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress()); |
| 137 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId()); | 137 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId()); |
| 138 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait()); | 138 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait()); |
| 139 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId()); | 139 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId()); |
| 140 | String graderID = cardinfoBean.getGrade().getGradeId(); | 140 | String graderID = cardinfoBean.getGrade().getGradeId(); |
| 141 | Log.e("test", "nianji" + graderID); | 141 | Log.e("test", "nianji" + graderID); |
| 142 | try { | 142 | try { |
| 143 | long auserID = Long.parseLong(graderID); | 143 | long auserID = Long.parseLong(graderID); |
| 144 | String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | 144 | String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); |
| 145 | // if ((auserID < 8) && (ss == null)) { | 145 | // if ((auserID < 8) && (ss == null)) { |
| 146 | // Intent intentbroad = new Intent(); | 146 | // Intent intentbroad = new Intent(); |
| 147 | // intentbroad.putExtra("info", "小学"); | 147 | // intentbroad.putExtra("info", "小学"); |
| 148 | // //4、定义广播发送的action | 148 | // //4、定义广播发送的action |
| 149 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 149 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
| 150 | // //5、发送广播 | 150 | // //5、发送广播 |
| 151 | // sendBroadcast(intentbroad); | 151 | // sendBroadcast(intentbroad); |
| 152 | // Log.i("---", "发送完了"); | 152 | // Log.i("---", "发送完了"); |
| 153 | // } | 153 | // } |
| 154 | } catch (NumberFormatException e) { | 154 | } catch (NumberFormatException e) { |
| 155 | e.printStackTrace(); | 155 | e.printStackTrace(); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | 158 | ||
| 159 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); | 159 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); |
| 160 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 160 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
| 161 | //账户类型 | 161 | //账户类型 |
| 162 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 162 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
| 163 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 163 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
| 164 | 164 | ||
| 165 | try { | 165 | try { |
| 166 | Object auserID; | 166 | Object auserID; |
| 167 | int type; | 167 | int type; |
| 168 | int graderIDs = Integer.parseInt(graderID); | 168 | int graderIDs = Integer.parseInt(graderID); |
| 169 | if ("2".equals(accounts)) { | 169 | if ("2".equals(accounts)) { |
| 170 | type = Integer.parseInt(accounts); | 170 | type = Integer.parseInt(accounts); |
| 171 | auserID = childID; | 171 | auserID = childID; |
| 172 | } else { | 172 | } else { |
| 173 | type = Integer.parseInt(accounts); | 173 | type = Integer.parseInt(accounts); |
| 174 | auserID = Long.parseLong(userID); | 174 | auserID = Long.parseLong(userID); |
| 175 | } | 175 | } |
| 176 | //获取版本信息 | 176 | //获取版本信息 |
| 177 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); | 177 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); |
| 178 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); | 178 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); |
| 179 | 179 | ||
| 180 | } catch (NumberFormatException e) { | 180 | } catch (NumberFormatException e) { |
| 181 | e.printStackTrace(); | 181 | e.printStackTrace(); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | break; | 184 | break; |
| 185 | case HttpCode.SIGN: | 185 | case HttpCode.SIGN: |
| 186 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; | 186 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; |
| 187 | if (dataBean.getSignature() == null) { | 187 | if (dataBean.getSignature() == null) { |
| 188 | tv_sign.setText("你还未设置个性签名"); | 188 | tv_sign.setText("你还未设置个性签名"); |
| 189 | } else { | 189 | } else { |
| 190 | tv_sign.setText(dataBean.getSignature()); | 190 | tv_sign.setText(dataBean.getSignature()); |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | break; | 193 | break; |
| 194 | case HttpCode.PUBLISH_SUCESS: | 194 | case HttpCode.PUBLISH_SUCESS: |
| 195 | defautPublishInfos.clear(); | 195 | defautPublishInfos.clear(); |
| 196 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 196 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
| 197 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 197 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
| 198 | Gson gson = new Gson(); | 198 | Gson gson = new Gson(); |
| 199 | Log.e("test", "(List<DefautPublishInfo.DataBean>) msg.obj" + gson.toJson(msg.obj)); | 199 | Log.e("test", "(List<DefautPublishInfo.DataBean>) msg.obj" + gson.toJson(msg.obj)); |
| 200 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj)); | 200 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj)); |
| 201 | break; | 201 | break; |
| 202 | case HttpCode.GETVIDIO_SUCESS: | 202 | case HttpCode.GETVIDIO_SUCESS: |
| 203 | videoinfo.clear(); | 203 | videoinfo.clear(); |
| 204 | view_novedeo.setVisibility(View.GONE); | 204 | view_novedeo.setVisibility(View.GONE); |
| 205 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); | 205 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); |
| 206 | RecyclerViewadapter.notifyDataSetChanged(); | 206 | RecyclerViewadapter.notifyDataSetChanged(); |
| 207 | break; | 207 | break; |
| 208 | case HttpCode.SUCHCARDINFOONE: | 208 | case HttpCode.SUCHCARDINFOONE: |
| 209 | JSONObject jsonObject; | 209 | JSONObject jsonObject; |
| 210 | String status; | 210 | String status; |
| 211 | try { | 211 | try { |
| 212 | jsonObject = new JSONObject((String) msg.obj); | 212 | jsonObject = new JSONObject((String) msg.obj); |
| 213 | status = jsonObject.getString("status"); | 213 | status = jsonObject.getString("status"); |
| 214 | if (status.equals("1")) { | 214 | if (status.equals("1")) { |
| 215 | sssssssss.setVisibility(View.VISIBLE); | 215 | //sssssssss.setVisibility(View.VISIBLE); |
| 216 | tv_yangji.setVisibility(View.INVISIBLE); | 216 | tv_yangji.setVisibility(View.GONE); |
| 217 | iv_look_card.setVisibility(View.VISIBLE); | 217 | iv_look_card.setVisibility(View.VISIBLE); |
| 218 | //客机没有保卡 | 218 | //客机没有保卡 |
| 219 | } else if (status.equals("2001")) { | 219 | } else if (status.equals("2001")) { |
| 220 | sssssssss.setVisibility(View.VISIBLE); | 220 | //sssssssss.setVisibility(View.VISIBLE); |
| 221 | tv_yangji.setVisibility(View.INVISIBLE); | 221 | tv_yangji.setVisibility(View.GONE); |
| 222 | iv_look_card.setVisibility(View.VISIBLE); | 222 | iv_look_card.setVisibility(View.VISIBLE); |
| 223 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录"); | 223 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录"); |
| 224 | Intent settingintent = new Intent(); | 224 | Intent settingintent = new Intent(); |
| 225 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 225 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 226 | startActivity(settingintent); | 226 | startActivity(settingintent); |
| 227 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 227 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 228 | } else if (status.equals("2002")) {//样机 | 228 | } else if (status.equals("2002")) {//样机 |
| 229 | sssssssss.setVisibility(View.INVISIBLE); | 229 | //sssssssss.setVisibility(View.INVISIBLE); |
| 230 | iv_look_card.setVisibility(View.INVISIBLE); | 230 | iv_look_card.setVisibility(View.INVISIBLE); |
| 231 | tv_yangji.setVisibility(View.VISIBLE); | 231 | tv_yangji.setVisibility(View.VISIBLE); |
| 232 | 232 | ||
| 233 | } else { | 233 | } else { |
| 234 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); | 234 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); |
| 235 | } | 235 | } |
| 236 | } catch (JSONException e) { | 236 | } catch (JSONException e) { |
| 237 | e.printStackTrace(); | 237 | e.printStackTrace(); |
| 238 | } | 238 | } |
| 239 | case HttpCode.TOUXIANG: | ||
| 240 | if (msg.obj.equals("1")){ | ||
| 241 | String s = SaveParam.getInstance().getLoginParam(MainActivity.this,SaveParam.PORTAIT); | ||
| 242 | if (portrait!=null&&!portrait.isEmpty()){ | ||
| 243 | Picasso.with(MainActivity.this).load(s).into(mSimpleDraweeView); | ||
| 244 | } | ||
| 245 | |||
| 246 | } | ||
| 247 | break; | ||
| 239 | 248 | ||
| 240 | 249 | ||
| 241 | } | 250 | } |
| 242 | } | 251 | } |
| 243 | }; | 252 | }; |
| 244 | 253 | ||
| 245 | @Override | 254 | @Override |
| 246 | protected void onCreate(Bundle savedInstanceState) { | 255 | protected void onCreate(Bundle savedInstanceState) { |
| 247 | super.onCreate(savedInstanceState); | 256 | super.onCreate(savedInstanceState); |
| 248 | Fresco.initialize(this); | ||
| 249 | setContentView(R.layout.activity_main); | 257 | setContentView(R.layout.activity_main); |
| 250 | SysApplication.getInstance().addActivity(this); | 258 | SysApplication.getInstance().addActivity(this); |
| 251 | initView(); | 259 | initView(); |
| 252 | initData(); | 260 | initData(); |
| 253 | initLister(); | 261 | initLister(); |
| 254 | updateVersion(); | 262 | updateVersion(); |
| 255 | } | 263 | } |
| 256 | 264 | ||
| 257 | //////版本更新 | 265 | //////版本更新 |
| 258 | private void updateVersion() { | 266 | private void updateVersion() { |
| 259 | UpdateChecker updateChecker = new UpdateChecker(this); | 267 | UpdateChecker updateChecker = new UpdateChecker(this); |
| 260 | updateChecker.checkForUpdates(); | 268 | updateChecker.checkForUpdates(); |
| 261 | 269 | ||
| 262 | 270 | ||
| 263 | } | 271 | } |
| 264 | 272 | ||
| 265 | private void initView() { | 273 | private void initView() { |
| 266 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 274 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
| 267 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); | 275 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); |
| 268 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); | 276 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); |
| 269 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 277 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
| 270 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 278 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
| 271 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 279 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
| 272 | //头像 | 280 | //头像 |
| 273 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 281 | mSimpleDraweeView = (ImageView) findViewById(R.id.iv_head); |
| 274 | //初始化个人信息 | 282 | //初始化个人信息 |
| 275 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 283 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
| 276 | tv_username = (TextView) findViewById(R.id.tv_username); | 284 | tv_username = (TextView) findViewById(R.id.tv_username); |
| 277 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 285 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
| 278 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 286 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
| 279 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 287 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
| 280 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 288 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
| 281 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 289 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
| 282 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 290 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
| 283 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 291 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
| 284 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 292 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
| 285 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); | 293 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); |
| 286 | //跳转其他应用 | 294 | //跳转其他应用 |
| 287 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); | 295 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); |
| 288 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); | 296 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); |
| 289 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); | 297 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); |
| 290 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); | 298 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); |
| 291 | // | 299 | // |
| 292 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 300 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
| 293 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); | 301 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); |
| 294 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); | 302 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); |
| 295 | 303 | ||
| 296 | sssssssss = findViewById(R.id.sssssssss); | 304 | //sssssssss = findViewById(R.id.sssssssss); |
| 297 | 305 | ||
| 298 | } | 306 | } |
| 299 | 307 | ||
| 300 | 308 | ||
| 301 | private void initData() { | 309 | private void initData() { |
| 302 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 310 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
| 303 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 311 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 304 | uri = Uri.fromFile(file); | 312 | uri = Uri.fromFile(file); |
| 305 | } else { | 313 | } else { |
| 306 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 314 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
| 307 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 315 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
| 308 | } | 316 | } |
| 309 | //设置布局管理器 | 317 | //设置布局管理器 |
| 310 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 318 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
| 311 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); | 319 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); |
| 312 | 320 | ||
| 313 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); | 321 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); |
| 314 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); | 322 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); |
| 315 | 323 | ||
| 316 | mRecyclerView.setLayoutManager(linearLayoutManager); | 324 | mRecyclerView.setLayoutManager(linearLayoutManager); |
| 317 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); | 325 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); |
| 318 | 326 | ||
| 319 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); | 327 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); |
| 320 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); | 328 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); |
| 321 | 329 | ||
| 322 | //设置视频适配器 | 330 | //设置视频适配器 |
| 323 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); | 331 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); |
| 324 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this); | 332 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this); |
| 325 | 333 | ||
| 326 | //版本信息适配器 | 334 | //版本信息适配器 |
| 327 | mRecyclerView.setAdapter(RecyclerViewadapter); | 335 | mRecyclerView.setAdapter(RecyclerViewadapter); |
| 328 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | 336 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); |
| 329 | 337 | ||
| 330 | //判断保卡信息是否为样机 | 338 | //判断保卡信息是否为样机 |
| 331 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); | 339 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); |
| 332 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); | 340 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); |
| 333 | Log.d("test","yangji"+yangji); | 341 | Log.d("test", "yangji" + yangji); |
| 334 | if ("1".equals(yangji)) { | 342 | if ("1".equals(yangji)) { |
| 335 | sssssssss.setVisibility(View.INVISIBLE); | 343 | //sssssssss.setVisibility(View.INVISIBLE); |
| 336 | iv_look_card.setVisibility(View.INVISIBLE); | 344 | iv_look_card.setVisibility(View.INVISIBLE); |
| 337 | tv_yangji.setVisibility(View.VISIBLE); | 345 | tv_yangji.setVisibility(View.VISIBLE); |
| 338 | } else { | 346 | } else { |
| 339 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.YANGJI, "0"); | 347 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.YANGJI, "0"); |
| 340 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); | 348 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); |
| 341 | 349 | ||
| 342 | } | 350 | } |
| 343 | 351 | ||
| 344 | 352 | ||
| 345 | } | 353 | } |
| 346 | 354 | ||
| 347 | private void initLister() { | 355 | private void initLister() { |
| 348 | iv_imformatioan.setOnClickListener(this); | 356 | iv_imformatioan.setOnClickListener(this); |
| 349 | iv_look_card.setOnClickListener(this); | 357 | iv_look_card.setOnClickListener(this); |
| 350 | tv_edit_presoninfo.setOnClickListener(this); | 358 | tv_edit_presoninfo.setOnClickListener(this); |
| 351 | iv_setting.setOnClickListener(this); | 359 | iv_setting.setOnClickListener(this); |
| 352 | iv_sign.setOnClickListener(this); | 360 | iv_sign.setOnClickListener(this); |
| 361 | tv_sign.setOnClickListener(this); | ||
| 353 | mSimpleDraweeView.setOnClickListener(this); | 362 | mSimpleDraweeView.setOnClickListener(this); |
| 354 | linel_mycuoti.setOnClickListener(this); | 363 | linel_mycuoti.setOnClickListener(this); |
| 355 | linel_mynote.setOnClickListener(this); | 364 | linel_mynote.setOnClickListener(this); |
| 356 | linel_mycollege.setOnClickListener(this); | 365 | linel_mycollege.setOnClickListener(this); |
| 357 | linel_myclass.setOnClickListener(this); | 366 | linel_myclass.setOnClickListener(this); |
| 358 | 367 | ||
| 359 | } | 368 | } |
| 360 | 369 | ||
| 361 | @Override | 370 | @Override |
| 362 | public void onClick(View v) { | 371 | public void onClick(View v) { |
| 363 | switch (v.getId()) { | 372 | switch (v.getId()) { |
| 364 | case R.id.iv_imformatioan: | 373 | case R.id.iv_imformatioan: |
| 365 | Intent intent = new Intent(); | 374 | Intent intent = new Intent(); |
| 366 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 375 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
| 367 | startActivity(intent); | 376 | startActivity(intent); |
| 368 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 377 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 369 | break; | 378 | break; |
| 370 | case R.id.iv_look_card: | 379 | case R.id.iv_look_card: |
| 371 | Intent lookintent = new Intent(); | 380 | Intent lookintent = new Intent(); |
| 372 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 381 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
| 373 | startActivity(lookintent); | 382 | startActivity(lookintent); |
| 374 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 383 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 375 | break; | 384 | break; |
| 376 | case R.id.tv_edit_presoninfo: | 385 | case R.id.tv_edit_presoninfo: |
| 377 | Intent editintent = new Intent(); | 386 | Intent editintent = new Intent(); |
| 378 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 387 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
| 379 | startActivity(editintent); | 388 | startActivity(editintent); |
| 380 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 389 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 381 | break; | 390 | break; |
| 382 | case R.id.iv_head: | 391 | case R.id.iv_head: |
| 383 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 392 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
| 384 | break; | 393 | break; |
| 385 | case R.id.iv_setting: | 394 | case R.id.iv_setting: |
| 386 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 395 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
| 387 | List<MenuItem> menuItems = new ArrayList<>(); | 396 | List<MenuItem> menuItems = new ArrayList<>(); |
| 388 | menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户")); | 397 | menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户")); |
| 389 | menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理")); | 398 | menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理")); |
| 390 | mTopRightMenu | 399 | mTopRightMenu |
| 391 | .setHeight(150) //默认高度480 | 400 | .setHeight(150) //默认高度480 |
| 392 | .setWidth(180) //默认宽度wrap_content | 401 | .setWidth(180) //默认宽度wrap_content |
| 393 | .showIcon(showIcon) //显示菜单图标,默认为true | 402 | .showIcon(showIcon) //显示菜单图标,默认为true |
| 394 | .dimBackground(dimBg) //背景变暗,默认为true | 403 | .dimBackground(dimBg) //背景变暗,默认为true |
| 395 | .needAnimationStyle(needAnim) //显示动画,默认为true | 404 | .needAnimationStyle(needAnim) //显示动画,默认为true |
| 396 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 405 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
| 397 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 406 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
| 398 | @Override | 407 | @Override |
| 399 | public void onMenuItemClick(int position) { | 408 | public void onMenuItemClick(int position) { |
| 400 | switch (position) { | 409 | switch (position) { |
| 401 | case 0: | 410 | case 0: |
| 402 | new CircleDialog.Builder(MainActivity.this) | 411 | new CircleDialog.Builder(MainActivity.this) |
| 403 | .setCanceledOnTouchOutside(false) | 412 | .setCanceledOnTouchOutside(false) |
| 404 | .setWidth(0.4f) | 413 | .setWidth(0.4f) |
| 405 | .setCancelable(false) | 414 | .setCancelable(false) |
| 406 | .setText("您确定要退出,更换其他账号登录吗?") | 415 | .setText("您确定要退出,更换其他账号登录吗?") |
| 407 | .setNegative("取消", null) | 416 | .setNegative("取消", null) |
| 408 | .setPositive("确定", new View.OnClickListener() { | 417 | .setPositive("确定", new View.OnClickListener() { |
| 409 | @Override | 418 | @Override |
| 410 | public void onClick(View v) { | 419 | public void onClick(View v) { |
| 411 | //String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | 420 | //String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); |
| 412 | //int graderIDs = Integer.parseInt(graderID); | 421 | //int graderIDs = Integer.parseInt(graderID); |
| 413 | // if (graderIDs < 8) { | 422 | // if (graderIDs < 8) { |
| 414 | // Intent intentbroad = new Intent(); | 423 | // Intent intentbroad = new Intent(); |
| 415 | // intentbroad.putExtra("info", "小学"); | 424 | // intentbroad.putExtra("info", "小学"); |
| 416 | // //4、定义广播发送的action | 425 | // //4、定义广播发送的action |
| 417 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 426 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
| 418 | // //5、发送广播 | 427 | // //5、发送广播 |
| 419 | // sendBroadcast(intentbroad); | 428 | // sendBroadcast(intentbroad); |
| 420 | // Log.i("---", "发送完了"); | 429 | // Log.i("---", "发送完了"); |
| 421 | // } | 430 | // } |
| 422 | //清除数据 | 431 | //清除数据 |
| 423 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this,SaveParam.ACCOUNT,"1"); | 432 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.ACCOUNT, "1"); |
| 424 | SaveParam.getInstance().clearData(MainActivity.this); | 433 | SaveParam.getInstance().clearData(MainActivity.this); |
| 425 | Intent settingintent = new Intent(); | 434 | Intent settingintent = new Intent(); |
| 426 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 435 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 427 | startActivity(settingintent); | 436 | startActivity(settingintent); |
| 428 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 437 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 429 | finish(); | 438 | finish(); |
| 430 | } | 439 | } |
| 431 | }) | 440 | }) |
| 432 | .show(); | 441 | .show(); |
| 433 | break; | 442 | break; |
| 434 | case 1: | 443 | case 1: |
| 435 | Intent accontMintent = new Intent(); | 444 | Intent accontMintent = new Intent(); |
| 436 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 445 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
| 437 | startActivity(accontMintent); | 446 | startActivity(accontMintent); |
| 438 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 447 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 439 | break; | 448 | break; |
| 440 | } | 449 | } |
| 441 | } | 450 | } |
| 442 | }) | 451 | }) |
| 443 | .addMenuList(menuItems) | 452 | .addMenuList(menuItems) |
| 444 | .showAsDropDown(iv_setting, -120, 0); | 453 | .showAsDropDown(iv_setting, -120, 0); |
| 445 | break; | 454 | break; |
| 446 | case R.id.iv_sign: | 455 | case R.id.iv_sign: |
| 456 | case R.id.tv_sign: | ||
| 447 | new CircleDialog.Builder(this) | 457 | new CircleDialog.Builder(this) |
| 448 | .setCanceledOnTouchOutside(false) | 458 | .setCanceledOnTouchOutside(false) |
| 449 | .setCancelable(true) | 459 | .setCancelable(true) |
| 450 | .setTitle("个性签名") | 460 | .setTitle("个性签名") |
| 451 | .setInputHint("请输入个性签名") | 461 | .setInputHint("请输入个性签名") |
| 452 | .setWidth(0.4f) | 462 | .setWidth(0.4f) |
| 453 | .setInputHeight(80) | 463 | .setInputHeight(80) |
| 454 | .configInput(new ConfigInput() { | 464 | .configInput(new ConfigInput() { |
| 455 | @Override | 465 | @Override |
| 456 | public void onConfig(InputParams params) { | 466 | public void onConfig(InputParams params) { |
| 457 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 467 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
| 458 | } | 468 | } |
| 459 | }) | 469 | }) |
| 460 | .setNegative("取消", new View.OnClickListener() { | 470 | .setNegative("取消", new View.OnClickListener() { |
| 461 | @Override | 471 | @Override |
| 462 | public void onClick(View v) { | 472 | public void onClick(View v) { |
| 463 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 473 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
| 464 | } | 474 | } |
| 465 | }) | 475 | }) |
| 466 | .setPositiveInput("确定", new OnInputClickListener() { | 476 | .setPositiveInput("确定", new OnInputClickListener() { |
| 467 | @Override | 477 | @Override |
| 468 | public void onClick(String text, View v) { | 478 | public void onClick(String text, View v) { |
| 469 | if (text.equals("")) { | 479 | if (text.equals("")) { |
| 470 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 480 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
| 471 | } else { | 481 | } else { |
| 472 | try { | 482 | try { |
| 473 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 483 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
| 474 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 484 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
| 475 | String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 485 | String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
| 476 | Object id = null; | 486 | Object id = null; |
| 477 | long auserID = Long.parseLong(userID); | 487 | long auserID = Long.parseLong(userID); |
| 478 | int typeaccount1 = Integer.parseInt(typeaccount); | 488 | int typeaccount1 = Integer.parseInt(typeaccount); |
| 479 | if (typeaccount1 ==2){ | 489 | if (typeaccount1 == 2) { |
| 480 | id =childsID; | 490 | id = childsID; |
| 481 | }else { | 491 | } else { |
| 482 | id =auserID; | 492 | id = auserID; |
| 483 | } | 493 | } |
| 484 | HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text); | 494 | HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text); |
| 485 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 495 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
| 486 | } catch (NumberFormatException e) { | 496 | } catch (NumberFormatException e) { |
| 487 | e.printStackTrace(); | 497 | e.printStackTrace(); |
| 488 | } | 498 | } |
| 489 | 499 | ||
| 490 | tv_sign.setText(text); | 500 | tv_sign.setText(text); |
| 491 | } | 501 | } |
| 492 | 502 | ||
| 493 | } | 503 | } |
| 494 | }) | 504 | }) |
| 495 | .show(); | 505 | .show(); |
| 496 | break; | 506 | break; |
| 497 | case R.id.linel_mycuoti: | 507 | case R.id.linel_mycuoti: |
| 498 | AlertUtils.showToast(this, "未安装该应用 "); | 508 | AlertUtils.showToast(this, "未安装该应用 "); |
| 499 | break; | 509 | break; |
| 500 | case R.id.linel_mynote: | 510 | case R.id.linel_mynote: |
| 501 | AlertUtils.showToast(this, "未安装该应用 "); | 511 | AlertUtils.showToast(this, "未安装该应用 "); |
| 502 | break; | 512 | break; |
| 503 | case R.id.linel_mycollege: | 513 | case R.id.linel_mycollege: |
| 504 | AlertUtils.showToast(this, "未安装该应用 "); | 514 | AlertUtils.showToast(this, "未安装该应用 "); |
| 505 | break; | 515 | break; |
| 506 | case R.id.linel_myclass: | 516 | case R.id.linel_myclass: |
| 507 | AlertUtils.showToast(this, "未安装该应用 "); | 517 | AlertUtils.showToast(this, "未安装该应用 "); |
| 508 | break; | 518 | break; |
| 509 | } | 519 | } |
| 510 | 520 | ||
| 511 | } | 521 | } |
| 512 | 522 | ||
| 513 | @Override | 523 | @Override |
| 514 | protected void onPause() { | 524 | protected void onPause() { |
| 515 | super.onPause(); | 525 | super.onPause(); |
| 516 | } | 526 | } |
| 517 | 527 | ||
| 518 | @Override | 528 | @Override |
| 519 | protected void onResume() { | 529 | protected void onResume() { |
| 520 | super.onResume(); | 530 | super.onResume(); |
| 521 | Content.changegradeinfoflag = 0; | 531 | Content.changegradeinfoflag = 0; |
| 522 | Content.changeadressinfoflag = 0; | 532 | Content.changeadressinfoflag = 0; |
| 523 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 533 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 524 | //获取个性签名 | 534 | //获取个性签名 |
| 525 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 535 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 526 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 536 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
| 527 | 537 | ||
| 528 | try { | 538 | try { |
| 529 | Object auserID = 1; | 539 | Object auserID = 1; |
| 530 | long id = Long.parseLong(userID); | 540 | long id = Long.parseLong(userID); |
| 531 | int typeaccount1 = Integer.parseInt(typeaccount); | 541 | int typeaccount1 = Integer.parseInt(typeaccount); |
| 532 | //获取个人信息 | 542 | //获取个人信息 |
| 533 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler); | 543 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler); |
| 534 | if (typeaccount1 == 2) { | 544 | if (typeaccount1 == 2) { |
| 535 | auserID = childsID; | 545 | auserID = childsID; |
| 536 | } else { | 546 | } else { |
| 537 | auserID = id; | 547 | auserID = id; |
| 538 | } | 548 | } |
| 539 | Log.e("test","个性签名的ID"+auserID); | 549 | Log.e("test", "个性签名的ID" + auserID); |
| 540 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); | 550 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); |
| 541 | //获取最近播放视频 | 551 | //获取最近播放视频 |
| 542 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); | 552 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); |
| 543 | 553 | ||
| 544 | } catch (NumberFormatException e) { | 554 | } catch (NumberFormatException e) { |
| 545 | e.printStackTrace(); | 555 | e.printStackTrace(); |
| 546 | } | 556 | } |
| 547 | 557 | ||
| 548 | } | 558 | } |
| 549 | 559 | ||
| 550 | //回调头像监听 | 560 | //回调头像监听 |
| 551 | @Override | 561 | @Override |
| 552 | public void heard(Context context, View v, int headpitiaon) { | 562 | public void heard(Context context, View v, int headpitiaon) { |
| 553 | String picUrl = ""; | 563 | String picUrl = ""; |
| 554 | String userID; | 564 | String userID; |
| 555 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 565 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 556 | if ("2".equals(typeaccount)) { | 566 | if ("2".equals(typeaccount)) { |
| 557 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 567 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
| 558 | } else { | 568 | } else { |
| 559 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 569 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 560 | } | 570 | } |
| 561 | switch (v.getId()) { | 571 | switch (v.getId()) { |
| 562 | //选择默认图片 | 572 | //选择默认图片 |
| 563 | case R.id.oktakephone: | 573 | case R.id.oktakephone: |
| 564 | if (headpitiaon == 1) { | 574 | if (headpitiaon == 1) { |
| 565 | mSimpleDraweeView.setImageDrawable(null); | 575 | mSimpleDraweeView.setImageDrawable(null); |
| 566 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 576 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
| 567 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/75f05c02-3dbc-44e3-aec9-a73eca60ca8b.png"; | 577 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/75f05c02-3dbc-44e3-aec9-a73eca60ca8b.png"; |
| 568 | try { | 578 | try { |
| 569 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 579 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 570 | } catch (UnsupportedEncodingException e) { | 580 | } catch (UnsupportedEncodingException e) { |
| 571 | e.printStackTrace(); | 581 | e.printStackTrace(); |
| 572 | } | 582 | } |
| 573 | } else if (headpitiaon == 2) { | 583 | } else if (headpitiaon == 2) { |
| 574 | mSimpleDraweeView.setImageDrawable(null); | 584 | mSimpleDraweeView.setImageDrawable(null); |
| 575 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 585 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
| 576 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/d102b0d8-435f-45a5-908f-ea43e02176d4.png"; | 586 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/d102b0d8-435f-45a5-908f-ea43e02176d4.png"; |
| 577 | try { | 587 | try { |
| 578 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 588 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 579 | } catch (UnsupportedEncodingException e) { | 589 | } catch (UnsupportedEncodingException e) { |
| 580 | e.printStackTrace(); | 590 | e.printStackTrace(); |
| 581 | } | 591 | } |
| 582 | } else if (headpitiaon == 3) { | 592 | } else if (headpitiaon == 3) { |
| 583 | mSimpleDraweeView.setImageDrawable(null); | 593 | mSimpleDraweeView.setImageDrawable(null); |
| 584 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 594 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
| 585 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/a623a8ba-5e56-4827-95d1-ffeb0d6874d5.png"; | 595 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/a623a8ba-5e56-4827-95d1-ffeb0d6874d5.png"; |
| 586 | try { | 596 | try { |
| 587 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 597 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 588 | } catch (UnsupportedEncodingException e) { | 598 | } catch (UnsupportedEncodingException e) { |
| 589 | e.printStackTrace(); | 599 | e.printStackTrace(); |
| 590 | } | 600 | } |
| 591 | } else if (headpitiaon == 4) { | 601 | } else if (headpitiaon == 4) { |
| 592 | mSimpleDraweeView.setImageDrawable(null); | 602 | mSimpleDraweeView.setImageDrawable(null); |
| 593 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 603 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
| 594 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/3d822736-a18d-47ae-b0b1-67752e027375.png"; | 604 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/3d822736-a18d-47ae-b0b1-67752e027375.png"; |
| 595 | try { | 605 | try { |
| 596 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 606 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 597 | } catch (UnsupportedEncodingException e) { | 607 | } catch (UnsupportedEncodingException e) { |
| 598 | e.printStackTrace(); | 608 | e.printStackTrace(); |
| 599 | } | 609 | } |
| 600 | } else { | 610 | } else { |
| 601 | mSimpleDraweeView.setImageDrawable(null); | 611 | mSimpleDraweeView.setImageDrawable(null); |
| 602 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); | 612 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); |
| 603 | ; | 613 | ; |
| 604 | } | 614 | } |
| 605 | 615 | ||
| 606 | break; | 616 | break; |
| 607 | case R.id.canceltakephone: | 617 | case R.id.canceltakephone: |
| 608 | 618 | ||
| 609 | break; | 619 | break; |
| 610 | //拍摄和相册 | 620 | //拍摄和相册 |
| 611 | case R.id.take_pic: | 621 | case R.id.take_pic: |
| 612 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 622 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
| 613 | uploadAvatarFromPhotoRequest(); | 623 | uploadAvatarFromPhotoRequest(); |
| 614 | } | 624 | } |
| 615 | break; | 625 | break; |
| 616 | case R.id.xiangce: | 626 | case R.id.xiangce: |
| 617 | uploadAvatarFromAlbumRequest(); | 627 | uploadAvatarFromAlbumRequest(); |
| 618 | break; | 628 | break; |
| 619 | 629 | ||
| 620 | } | 630 | } |
| 621 | 631 | ||
| 622 | } | 632 | } |
| 623 | 633 | ||
| 624 | //照相 | 634 | //照相 |
| 625 | private void uploadAvatarFromPhotoRequest() { | 635 | private void uploadAvatarFromPhotoRequest() { |
| 626 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 636 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
| 627 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 637 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 628 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 638 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
| 629 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 639 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
| 630 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 640 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
| 631 | } | 641 | } |
| 632 | 642 | ||
| 633 | //选择图库 | 643 | //选择图库 |
| 634 | private void uploadAvatarFromAlbumRequest() { | 644 | private void uploadAvatarFromAlbumRequest() { |
| 635 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 645 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
| 636 | photoPickerIntent.setType("image/*"); | 646 | photoPickerIntent.setType("image/*"); |
| 637 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 647 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
| 638 | } | 648 | } |
| 639 | 649 | ||
| 640 | //回掉 | 650 | //回掉 |
| 641 | @Override | 651 | @Override |
| 642 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 652 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 643 | super.onActivityResult(requestCode, resultCode, data); | 653 | super.onActivityResult(requestCode, resultCode, data); |
| 644 | if (resultCode != -1) { | 654 | if (resultCode != -1) { |
| 645 | return; | 655 | return; |
| 646 | } | 656 | } |
| 647 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 657 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
| 648 | Uri newUri; | 658 | Uri newUri; |
| 649 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 659 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 650 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 660 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
| 651 | } else { | 661 | } else { |
| 652 | newUri = data.getData(); | 662 | newUri = data.getData(); |
| 653 | } | 663 | } |
| 654 | if (newUri != null) { | 664 | if (newUri != null) { |
| 655 | startPhotoZoom(newUri); | 665 | startPhotoZoom(newUri); |
| 656 | } else { | 666 | } else { |
| 657 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 667 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
| 658 | } | 668 | } |
| 659 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 669 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
| 660 | //startPhotoZoom(uri); | 670 | //startPhotoZoom(uri); |
| 661 | uploadAvatarFromPhoto(); | 671 | uploadAvatarFromPhoto(); |
| 662 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 672 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
| 663 | uploadAvatarFromPhoto(); | 673 | uploadAvatarFromPhoto(); |
| 664 | } | 674 | } |
| 665 | } | 675 | } |
| 666 | 676 | ||
| 667 | private void uploadAvatarFromPhoto() { | 677 | private void uploadAvatarFromPhoto() { |
| 668 | compressAndUploadAvatar(file.getPath()); | 678 | compressAndUploadAvatar(file.getPath()); |
| 669 | 679 | ||
| 670 | } | 680 | } |
| 671 | 681 | ||
| 672 | private void compressAndUploadAvatar(String fileSrc) { | 682 | private void compressAndUploadAvatar(String fileSrc) { |
| 673 | 683 | ||
| 674 | 684 | ||
| 675 | //上传到服务器 | 685 | //上传到服务器 |
| 676 | 686 | ||
| 677 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 687 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
| 678 | String mimeType = "image/*"; | 688 | String mimeType = "image/*"; |
| 679 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 689 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
| 680 | //String fileName = cover.getName(); | 690 | //String fileName = cover.getName(); |
| 681 | String userID; | 691 | String userID; |
| 682 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 692 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 683 | if ("2".equals(typeaccount)) { | 693 | if ("2".equals(typeaccount)) { |
| 684 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 694 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
| 685 | } else { | 695 | } else { |
| 686 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 696 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 687 | } | 697 | } |
| 688 | 698 | ||
| 689 | //上传头像 | 699 | //上传头像 |
| 690 | 700 | ||
| 691 | try { | 701 | try { |
| 692 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc); | 702 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc,handler); |
| 693 | } catch (UnsupportedEncodingException e) { | 703 | } catch (UnsupportedEncodingException e) { |
| 694 | e.printStackTrace(); | 704 | e.printStackTrace(); |
| 695 | } | 705 | } |
| 696 | 706 | //mSimpleDraweeView.setImageURI(Uri.fromFile(new File(fileSrc))); | |
| 697 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 707 | |
| 698 | GenericDraweeHierarchy hierarchy = builder | 708 | // GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
| 699 | .setDesiredAspectRatio(1f) | 709 | // GenericDraweeHierarchy hierarchy = builder |
| 700 | .setFailureImage(R.mipmap.header_default) | 710 | // .setDesiredAspectRatio(1f) |
| 701 | //圆形头像 | 711 | // .setFailureImage(R.mipmap.header_default) |
| 702 | .setRoundingParams(RoundingParams.asCircle()) | 712 | // //圆形头像 |
| 703 | .build(); | 713 | // .setRoundingParams(RoundingParams.asCircle()) |
| 704 | 714 | // .build(); | |
| 705 | //加载本地图片 | 715 | // //OOM |
| 706 | Uri uri = Uri.fromFile(cover); | 716 | // ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) |
| 707 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 717 | // //根据View的尺寸放缩图片 |
| 708 | .setOldController(mSimpleDraweeView.getController()) | 718 | // .setResizeOptions(new ResizeOptions(mSimpleDraweeView.getWidth(), mSimpleDraweeView.getHeight())) |
| 709 | .setUri(uri) | 719 | // .build(); |
| 710 | .build(); | 720 | // |
| 711 | mSimpleDraweeView.setHierarchy(hierarchy); | 721 | // |
| 712 | mSimpleDraweeView.setController(controller); | 722 | // //加载本地图片 |
| 723 | // Uri uri = Uri.fromFile(cover); | ||
| 724 | //Picasso.with(MainActivity.this).load(uri).placeholder(R.mipmap.header_default).error(R.mipmap.header_default).transform(new RoundTransform(1000)).into(mSimpleDraweeView); | ||
| 725 | // DraweeController controller = Fresco.newDraweeControllerBuilder() | ||
| 726 | // .setOldController(mSimpleDraweeView.getController()) | ||
| 727 | // .setImageRequest(request) | ||
| 728 | // .setUri(uri) | ||
| 729 | // .build(); | ||
| 730 | // mSimpleDraweeView.setHierarchy(hierarchy); | ||
| 731 | // mSimpleDraweeView.setController(controller); | ||
| 713 | 732 | ||
| 714 | } | 733 | } |
| 715 | 734 | ||
| 716 | public void startPhotoZoom(Uri uri) { | 735 | public void startPhotoZoom(Uri uri) { |
| 717 | Intent intent = new Intent("com.android.camera.action.CROP"); | 736 | Intent intent = new Intent("com.android.camera.action.CROP"); |
| 718 | intent.setDataAndType(uri, "image/*"); | 737 | intent.setDataAndType(uri, "image/*"); |
| 719 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 738 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 720 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 739 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
| 721 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 740 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
| 722 | intent.putExtra("aspectY", 1);// x:y=1:1 | 741 | intent.putExtra("aspectY", 1);// x:y=1:1 |
| 723 | // intent.putExtra("outputX", 400);//图片输出大小 | 742 | // intent.putExtra("outputX", 400);//图片输出大小 |
| 724 | // intent.putExtra("outputY", 400); | 743 | // intent.putExtra("outputY", 400); |
| 725 | intent.putExtra("output", Uri.fromFile(file)); | 744 | intent.putExtra("output", Uri.fromFile(file)); |
| 726 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 745 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
| 727 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 746 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
| 728 | } | 747 | } |
| 729 | 748 | ||
| 730 | @Override | 749 | @Override |
| 731 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 750 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
| 732 | switch (requestCode) { | 751 | switch (requestCode) { |
| 733 | 752 | ||
| 734 | case PermissionUtil.REQUEST_SHOWCAMERA: | 753 | case PermissionUtil.REQUEST_SHOWCAMERA: |
| 735 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 754 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
| 736 | // Permission Granted | 755 | // Permission Granted |
| 737 | uploadAvatarFromPhotoRequest(); | 756 | uploadAvatarFromPhotoRequest(); |
| 738 | 757 | ||
| 739 | } else { | 758 | } else { |
| 740 | if (!SharedPreferenceMark.getHasShowCamera()) { | 759 | if (!SharedPreferenceMark.getHasShowCamera()) { |
| 741 | SharedPreferenceMark.setHasShowCamera(true); | 760 | SharedPreferenceMark.setHasShowCamera(true); |
| 742 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 761 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
| 743 | 762 | ||
| 744 | } else { | 763 | } else { |
| 745 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 764 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
| 746 | .show(); | 765 | .show(); |
| 747 | } | 766 | } |
| 748 | } | 767 | } |
| 749 | break; | 768 | break; |
| 750 | default: | 769 | default: |
| 751 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 770 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 752 | } | 771 | } |
| 753 | } | 772 | } |
| 754 | 773 | ||
| 755 | 774 | ||
| 756 | private long exitTime = 0; | 775 | private long exitTime = 0; |
| 757 | 776 | ||
| 758 | @Override | 777 | @Override |
| 759 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 778 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| 760 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 779 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 761 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 780 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
| 762 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 781 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
| 763 | Toast.LENGTH_SHORT).show(); | 782 | Toast.LENGTH_SHORT).show(); |
| 764 | exitTime = System.currentTimeMillis(); | 783 | exitTime = System.currentTimeMillis(); |
| 765 | } else { | 784 | } else { |
| 766 | //SysApplication.getInstance().finishActivity(MainActivity.this); | 785 | //SysApplication.getInstance().finishActivity(MainActivity.this); |
| 767 | SysApplication.getInstance().exit(); | 786 | SysApplication.getInstance().exit(); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MyApplication.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.app.Application; | 3 | import android.app.Application; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.graphics.drawable.Drawable; | 5 | import android.graphics.drawable.Drawable; |
| 6 | import android.os.Looper; | 6 | import android.os.Looper; |
| 7 | import android.view.Gravity; | 7 | import android.view.Gravity; |
| 8 | import android.widget.TextView; | 8 | import android.widget.TextView; |
| 9 | import android.widget.Toast; | 9 | import android.widget.Toast; |
| 10 | 10 | ||
| 11 | import com.facebook.drawee.backends.pipeline.Fresco; | ||
| 12 | import com.hjx.personalcenter.R; | 11 | import com.hjx.personalcenter.R; |
| 13 | import com.hjx.personalcenter.crash.CrashHandler; | 12 | import com.hjx.personalcenter.crash.CrashHandler; |
| 14 | import com.hjx.personalcenter.util.ImageCache; | 13 | import com.hjx.personalcenter.util.ImageCache; |
| 15 | import com.tencent.bugly.crashreport.CrashReport; | 14 | import com.tencent.bugly.crashreport.CrashReport; |
| 16 | 15 | ||
| 17 | /** | 16 | /** |
| 18 | * Created by ${yf} on 2017/2/16. | 17 | * Created by ${yf} on 2017/2/16. |
| 19 | */ | 18 | */ |
| 20 | 19 | ||
| 21 | public class MyApplication extends Application { | 20 | public class MyApplication extends Application { |
| 22 | 21 | ||
| 23 | private ImageCache mImageCache; | 22 | private ImageCache mImageCache; |
| 24 | private static Context context; | 23 | private static Context context; |
| 25 | private static MyApplication instance; | 24 | private static MyApplication instance; |
| 26 | @Override | 25 | @Override |
| 27 | public void onCreate() { | 26 | public void onCreate() { |
| 28 | context = getApplicationContext(); | 27 | context = getApplicationContext(); |
| 29 | //c初始化内存检测 | 28 | //c初始化内存检测 |
| 30 | // LeakCanary.install(this); | 29 | // LeakCanary.install(this); |
| 31 | //初始化Fresco | 30 | //初始化Fresco |
| 32 | Fresco.initialize(this); | ||
| 33 | mImageCache = new ImageCache(); | 31 | mImageCache = new ImageCache(); |
| 34 | instance = this; | 32 | instance = this; |
| 35 | CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false); | 33 | CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false); |
| 36 | CrashHandler crashHandler = CrashHandler.getInstance(); | 34 | CrashHandler crashHandler = CrashHandler.getInstance(); |
| 37 | //生成错误日志,上线的时候得放开 | 35 | //生成错误日志,上线的时候得放开 |
| 38 | //crashHandler.init(getApplicationContext()); | 36 | //crashHandler.init(getApplicationContext()); |
| 39 | crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { | 37 | crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { |
| 40 | 38 | ||
| 41 | @Override | 39 | @Override |
| 42 | public boolean handleCrash(final Context context, final Throwable ex) { | 40 | public boolean handleCrash(final Context context, final Throwable ex) { |
| 43 | new Thread(new Runnable() { | 41 | new Thread(new Runnable() { |
| 44 | 42 | ||
| 45 | @Override | 43 | @Override |
| 46 | public void run() { | 44 | public void run() { |
| 47 | Looper.prepare(); | 45 | Looper.prepare(); |
| 48 | System.out.println("bcz = " + ex.toString()); | 46 | System.out.println("bcz = " + ex.toString()); |
| 49 | Toast toast = new Toast(context); | 47 | Toast toast = new Toast(context); |
| 50 | TextView tv = new TextView(context); | 48 | TextView tv = new TextView(context); |
| 51 | tv.setText(" 很抱歉,"+context.getString(R.string.app_name)+"崩溃了,我们会尽快修复."); | 49 | tv.setText(" 很抱歉,"+context.getString(R.string.app_name)+"崩溃了,我们会尽快修复."); |
| 52 | tv.setPadding(10, 10, 10, 10); | 50 | tv.setPadding(10, 10, 10, 10); |
| 53 | tv.setTextSize(20); | 51 | tv.setTextSize(20); |
| 54 | tv.setBackgroundResource(R.drawable.black_btn_default); | 52 | tv.setBackgroundResource(R.drawable.black_btn_default); |
| 55 | tv.setTextColor(context.getResources().getColor(android.R.color.white)); | 53 | tv.setTextColor(context.getResources().getColor(android.R.color.white)); |
| 56 | Drawable drawable= context.getResources().getDrawable(R.drawable.sorry); | 54 | Drawable drawable= context.getResources().getDrawable(R.drawable.sorry); |
| 57 | drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); | 55 | drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); |
| 58 | tv.setCompoundDrawables(drawable,null,null,null); | 56 | tv.setCompoundDrawables(drawable,null,null,null); |
| 59 | toast.setView(tv); | 57 | toast.setView(tv); |
| 60 | toast.setGravity(Gravity.CENTER, 0, 0); | 58 | toast.setGravity(Gravity.CENTER, 0, 0); |
| 61 | toast.setDuration(Toast.LENGTH_LONG); | 59 | toast.setDuration(Toast.LENGTH_LONG); |
| 62 | toast.show(); | 60 | toast.show(); |
| 63 | Looper.loop(); | 61 | Looper.loop(); |
| 64 | } | 62 | } |
| 65 | }).start(); | 63 | }).start(); |
| 66 | try { | 64 | try { |
| 67 | Thread.sleep(1000); | 65 | Thread.sleep(1000); |
| 68 | } catch (InterruptedException e) { | 66 | } catch (InterruptedException e) { |
| 69 | // TODO Auto-generated catch block | 67 | // TODO Auto-generated catch block |
| 70 | e.printStackTrace(); | 68 | e.printStackTrace(); |
| 71 | } | 69 | } |
| 72 | return false; | 70 | return false; |
| 73 | } | 71 | } |
| 74 | }); | 72 | }); |
| 75 | super.onCreate(); | 73 | super.onCreate(); |
| 76 | } | 74 | } |
| 77 | public ImageCache getImageCache() { | 75 | public ImageCache getImageCache() { |
| 78 | return mImageCache; | 76 | return mImageCache; |
| 79 | } | 77 | } |
| 80 | 78 | ||
| 81 | public static Context getContext() { | 79 | public static Context getContext() { |
| 82 | return context; | 80 | return context; |
| 83 | } | 81 | } |
| 84 | public static MyApplication getInstance() { | 82 | public static MyApplication getInstance() { |
| 85 | return instance; | 83 | return instance; |
| 86 | } | 84 | } |
| 87 | 85 | ||
| 88 | } | 86 | } |
| 89 | 87 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/AccountChildsAdapter.java
| 1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
| 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.Intent; | 5 | import android.content.Intent; |
| 6 | import android.support.v4.app.FragmentActivity; | 6 | import android.support.v4.app.FragmentActivity; |
| 7 | import android.support.v7.widget.RecyclerView; | 7 | import android.support.v7.widget.RecyclerView; |
| 8 | import android.view.LayoutInflater; | 8 | import android.view.LayoutInflater; |
| 9 | import android.view.View; | 9 | import android.view.View; |
| 10 | import android.view.ViewGroup; | 10 | import android.view.ViewGroup; |
| 11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
| 12 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
| 13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
| 14 | 14 | ||
| 15 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 16 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
| 17 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | 16 | import com.hjx.personalcenter.activity.RegisterInfoActivity; |
| 18 | import com.hjx.personalcenter.db.Content; | 17 | import com.hjx.personalcenter.db.Content; |
| 19 | import com.hjx.personalcenter.db.SaveParam; | 18 | import com.hjx.personalcenter.db.SaveParam; |
| 20 | import com.hjx.personalcenter.http.HttpManager; | 19 | import com.hjx.personalcenter.http.HttpManager; |
| 21 | import com.hjx.personalcenter.model.ChildsInfo; | 20 | import com.hjx.personalcenter.model.ChildsInfo; |
| 22 | import com.hjx.personalcenter.util.GetDevicesUtil; | 21 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 23 | import com.mylhyl.circledialog.CircleDialog; | 22 | import com.mylhyl.circledialog.CircleDialog; |
| 23 | import com.squareup.picasso.Picasso; | ||
| 24 | 24 | ||
| 25 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
| 26 | import java.util.List; | 26 | import java.util.List; |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * Created by h on 2017/8/26. | 29 | * Created by h on 2017/8/26. |
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | public class AccountChildsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements View.OnClickListener { | 32 | public class AccountChildsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements View.OnClickListener { |
| 33 | private List<ChildsInfo.DataBean> specailList; | 33 | private List<ChildsInfo.DataBean> specailList; |
| 34 | private LayoutInflater mInflater; | 34 | private LayoutInflater mInflater; |
| 35 | private Context mContext; | 35 | private Context mContext; |
| 36 | private static final int BODY_TYPE = 00002; | 36 | private static final int BODY_TYPE = 00002; |
| 37 | private static final int FOOT_TYPE = 00003; | 37 | private static final int FOOT_TYPE = 00003; |
| 38 | private int footCount = 1;//尾部个数,后续可以自己拓展 | 38 | private int footCount = 1;//尾部个数,后续可以自己拓展 |
| 39 | 39 | ||
| 40 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList, Context context) { | 40 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList, Context context) { |
| 41 | this.mContext = context; | 41 | this.mContext = context; |
| 42 | this.specailList = specailList; | 42 | this.specailList = specailList; |
| 43 | mInflater = LayoutInflater.from(context); | 43 | mInflater = LayoutInflater.from(context); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | public OnItemClickListener mOnItemClickListener; | 46 | public OnItemClickListener mOnItemClickListener; |
| 47 | 47 | ||
| 48 | @Override | 48 | @Override |
| 49 | public void onClick(View v) { | 49 | public void onClick(View v) { |
| 50 | if (mOnItemClickListener == null) { | 50 | if (mOnItemClickListener == null) { |
| 51 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); | 51 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | private int getBodySize() { | 56 | private int getBodySize() { |
| 57 | return specailList.size(); | 57 | return specailList.size(); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | private boolean isFoot(int position) { | 60 | private boolean isFoot(int position) { |
| 61 | return footCount != 0 && (position >= (getBodySize())); | 61 | return footCount != 0 && (position >= (getBodySize())); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | @Override | 64 | @Override |
| 65 | public int getItemViewType(int position) { | 65 | public int getItemViewType(int position) { |
| 66 | if (isFoot(position)) { | 66 | if (isFoot(position)) { |
| 67 | return FOOT_TYPE; | 67 | return FOOT_TYPE; |
| 68 | } else { | 68 | } else { |
| 69 | return BODY_TYPE; | 69 | return BODY_TYPE; |
| 70 | } | 70 | } |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | public interface OnItemClickListener { | 73 | public interface OnItemClickListener { |
| 74 | void onItemClick(View view, int position); | 74 | void onItemClick(View view, int position); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { | 77 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { |
| 78 | this.mOnItemClickListener = mOnItemClickLitener; | 78 | this.mOnItemClickListener = mOnItemClickLitener; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | public void setList(List<ChildsInfo.DataBean> list) { | 81 | public void setList(List<ChildsInfo.DataBean> list) { |
| 82 | this.specailList = list; | 82 | this.specailList = list; |
| 83 | notifyDataSetChanged(); | 83 | notifyDataSetChanged(); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | @Override | 86 | @Override |
| 87 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 87 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
| 88 | switch (viewType) { | 88 | switch (viewType) { |
| 89 | case BODY_TYPE: | 89 | case BODY_TYPE: |
| 90 | return new AccountChildsHolder(mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false)); | 90 | return new AccountChildsHolder(mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false)); |
| 91 | case FOOT_TYPE: | 91 | case FOOT_TYPE: |
| 92 | return new FootViewHolder(mInflater.inflate(R.layout.activity_account_management_add, parent, false)); | 92 | return new FootViewHolder(mInflater.inflate(R.layout.activity_account_management_add, parent, false)); |
| 93 | default: | 93 | default: |
| 94 | return null; | 94 | return null; |
| 95 | } | 95 | } |
| 96 | // View view = ; | 96 | // View view = ; |
| 97 | // view.setOnClickListener(this); | 97 | // view.setOnClickListener(this); |
| 98 | // AccountChildsHolder holder = new AccountChildsHolder(view); | 98 | // AccountChildsHolder holder = new AccountChildsHolder(view); |
| 99 | // return holder; | 99 | // return holder; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | @Override | 102 | @Override |
| 103 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { | 103 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { |
| 104 | String account = SaveParam.getInstance().getCustomizeParam(mContext, SaveParam.ACCOUNT); | 104 | String account = SaveParam.getInstance().getCustomizeParam(mContext, SaveParam.ACCOUNT); |
| 105 | if (holder instanceof AccountChildsHolder) { | 105 | if (holder instanceof AccountChildsHolder) { |
| 106 | final ChildsInfo.DataBean bean = specailList.get(position); | 106 | final ChildsInfo.DataBean bean = specailList.get(position); |
| 107 | if (bean != null) { | 107 | if (bean != null) { |
| 108 | ((AccountChildsHolder) holder).mSimpleDraweeView.setImageURI(bean.getImage()); | 108 | if (bean.getImage()!=null&&!bean.getImage().isEmpty()) { |
| 109 | Picasso.with(mContext).load(bean.getImage()).into( ((AccountChildsHolder) holder).mSimpleDraweeView); | ||
| 110 | } | ||
| 109 | ((AccountChildsHolder) holder).iv_child_name.setText(bean.getName()); | 111 | ((AccountChildsHolder) holder).iv_child_name.setText(bean.getName()); |
| 110 | ((AccountChildsHolder) holder).iv_child_grade.setText(bean.getGrade()); | 112 | ((AccountChildsHolder) holder).iv_child_grade.setText(bean.getGrade()); |
| 111 | ((AccountChildsHolder) holder).iv_child_school.setText(bean.getSchool()); | 113 | ((AccountChildsHolder) holder).iv_child_school.setText(bean.getSchool()); |
| 112 | ((AccountChildsHolder) holder).iv_child_adress.setText(bean.getRegion()); | 114 | ((AccountChildsHolder) holder).iv_child_adress.setText(bean.getRegion()); |
| 113 | 115 | ||
| 114 | 116 | ||
| 115 | if (account.equals("1")) { | 117 | if (account.equals("1")) { |
| 116 | ((AccountChildsHolder) holder).chang_account.setText("切换用户"); | 118 | ((AccountChildsHolder) holder).chang_account.setText("切换用户"); |
| 117 | ((AccountChildsHolder) holder).chang_account.setEnabled(true); | 119 | ((AccountChildsHolder) holder).chang_account.setEnabled(true); |
| 118 | ((AccountChildsHolder) holder).delete_account.setEnabled(true); | 120 | ((AccountChildsHolder) holder).delete_account.setEnabled(true); |
| 119 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.GONE); | 121 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.GONE); |
| 120 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 122 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
| 121 | 123 | ||
| 122 | } else { | 124 | } else { |
| 123 | if ("已使用".equals(bean.getStatus())) { | 125 | if ("已使用".equals(bean.getStatus())) { |
| 124 | ((AccountChildsHolder) holder).chang_account.setText("使用中"); | 126 | ((AccountChildsHolder) holder).chang_account.setText("使用中"); |
| 125 | ((AccountChildsHolder) holder).chang_account.setEnabled(false); | 127 | ((AccountChildsHolder) holder).chang_account.setEnabled(false); |
| 126 | ((AccountChildsHolder) holder).delete_account.setEnabled(false); | 128 | ((AccountChildsHolder) holder).delete_account.setEnabled(false); |
| 127 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.VISIBLE); | 129 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.VISIBLE); |
| 128 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 130 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
| 129 | } else { | 131 | } else { |
| 130 | ((AccountChildsHolder) holder).chang_account.setText("切换用户"); | 132 | ((AccountChildsHolder) holder).chang_account.setText("切换用户"); |
| 131 | ((AccountChildsHolder) holder).chang_account.setEnabled(true); | 133 | ((AccountChildsHolder) holder).chang_account.setEnabled(true); |
| 132 | ((AccountChildsHolder) holder).delete_account.setEnabled(true); | 134 | ((AccountChildsHolder) holder).delete_account.setEnabled(true); |
| 133 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.GONE); | 135 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.GONE); |
| 134 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 136 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
| 135 | } | 137 | } |
| 136 | } | 138 | } |
| 137 | ((AccountChildsHolder) holder).delete_account.setOnClickListener(new View.OnClickListener() { | 139 | ((AccountChildsHolder) holder).delete_account.setOnClickListener(new View.OnClickListener() { |
| 138 | @Override | 140 | @Override |
| 139 | public void onClick(View v) { | 141 | public void onClick(View v) { |
| 140 | new CircleDialog.Builder((FragmentActivity) mContext) | 142 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 141 | .setCanceledOnTouchOutside(false) | 143 | .setCanceledOnTouchOutside(false) |
| 142 | .setWidth(0.4f) | 144 | .setWidth(0.4f) |
| 143 | .setCancelable(false) | 145 | .setCancelable(false) |
| 144 | .setText("您确定删除该子账户?") | 146 | .setText("您确定删除该子账户?") |
| 145 | .setNegative("取消", null) | 147 | .setNegative("取消", null) |
| 146 | .setPositive("确定", new View.OnClickListener() { | 148 | .setPositive("确定", new View.OnClickListener() { |
| 147 | @Override | 149 | @Override |
| 148 | public void onClick(View v) { | 150 | public void onClick(View v) { |
| 149 | HttpManager.getInstance().deletechildAccountinfo(mContext, bean.getSubAccountId()); | 151 | HttpManager.getInstance().deletechildAccountinfo(mContext, bean.getSubAccountId()); |
| 150 | } | 152 | } |
| 151 | }) | 153 | }) |
| 152 | .show(); | 154 | .show(); |
| 153 | 155 | ||
| 154 | 156 | ||
| 155 | } | 157 | } |
| 156 | }); | 158 | }); |
| 157 | ((AccountChildsHolder) holder).chang_account.setOnClickListener(new View.OnClickListener() { | 159 | ((AccountChildsHolder) holder).chang_account.setOnClickListener(new View.OnClickListener() { |
| 158 | @Override | 160 | @Override |
| 159 | public void onClick(View v) { | 161 | public void onClick(View v) { |
| 160 | new CircleDialog.Builder((FragmentActivity) mContext) | 162 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 161 | .setCanceledOnTouchOutside(false) | 163 | .setCanceledOnTouchOutside(false) |
| 162 | .setWidth(0.4f) | 164 | .setWidth(0.4f) |
| 163 | .setCancelable(false) | 165 | .setCancelable(false) |
| 164 | .setText("您确定切换为该子账户?") | 166 | .setText("您确定切换为该子账户?") |
| 165 | .setNegative("取消", null) | 167 | .setNegative("取消", null) |
| 166 | .setPositive("确定", new View.OnClickListener() { | 168 | .setPositive("确定", new View.OnClickListener() { |
| 167 | @Override | 169 | @Override |
| 168 | public void onClick(View v) { | 170 | public void onClick(View v) { |
| 169 | Content.changgeaccountflag = 2; | 171 | Content.changgeaccountflag = 2; |
| 170 | String ss = SaveParam.getInstance().getLoginParam(mContext, SaveParam.GRADENS); | 172 | String ss = SaveParam.getInstance().getLoginParam(mContext, SaveParam.GRADENS); |
| 171 | try { | 173 | try { |
| 172 | int zhugrade = Integer.parseInt(ss); | 174 | int zhugrade = Integer.parseInt(ss); |
| 173 | int zigrade =Integer.parseInt(bean.getGradeId()); | 175 | int zigrade =Integer.parseInt(bean.getGradeId()); |
| 174 | // if ((zhugrade < 8)&&(zigrade>=8)||(zhugrade >= 8)&&(zigrade<8)) { | 176 | // if ((zhugrade < 8)&&(zigrade>=8)||(zhugrade >= 8)&&(zigrade<8)) { |
| 175 | // Intent intentbroad = new Intent(); | 177 | // Intent intentbroad = new Intent(); |
| 176 | // intentbroad.putExtra("info", "小学"); | 178 | // intentbroad.putExtra("info", "小学"); |
| 177 | // //4、定义广播发送的action | 179 | // //4、定义广播发送的action |
| 178 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 180 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
| 179 | // //5、发送广播 | 181 | // //5、发送广播 |
| 180 | // mContext.sendBroadcast(intentbroad); | 182 | // mContext.sendBroadcast(intentbroad); |
| 181 | // Log.i("---", "发送完了"); | 183 | // Log.i("---", "发送完了"); |
| 182 | // } | 184 | // } |
| 183 | 185 | ||
| 184 | } catch (NumberFormatException e) { | 186 | } catch (NumberFormatException e) { |
| 185 | e.printStackTrace(); | 187 | e.printStackTrace(); |
| 186 | } | 188 | } |
| 187 | 189 | ||
| 188 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ACCOUNT, "2"); | 190 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ACCOUNT, "2"); |
| 189 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSID, bean.getSubAccountId()); | 191 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSID, bean.getSubAccountId()); |
| 190 | //保存子账号年级id | 192 | //保存子账号年级id |
| 191 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSGRADENSss, bean.getGradeId()); | 193 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSGRADENSss, bean.getGradeId()); |
| 192 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); | 194 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); |
| 193 | HttpManager.getInstance().changechildAccountinfo(mContext, bean.getSubAccountId(), bean.getParentId(), | 195 | HttpManager.getInstance().changechildAccountinfo(mContext, bean.getSubAccountId(), bean.getParentId(), |
| 194 | devicenumber, 2); | 196 | devicenumber, 2); |
| 195 | } | 197 | } |
| 196 | }) | 198 | }) |
| 197 | .show(); | 199 | .show(); |
| 198 | 200 | ||
| 199 | } | 201 | } |
| 200 | }); | 202 | }); |
| 201 | 203 | ||
| 202 | } | 204 | } |
| 203 | 205 | ||
| 204 | } else if (holder instanceof FootViewHolder) { | 206 | } else if (holder instanceof FootViewHolder) { |
| 205 | ((FootViewHolder) holder).add_account.setOnClickListener(new View.OnClickListener() { | 207 | ((FootViewHolder) holder).add_account.setOnClickListener(new View.OnClickListener() { |
| 206 | @Override | 208 | @Override |
| 207 | public void onClick(View v) { | 209 | public void onClick(View v) { |
| 208 | Content.accountflag = 2; | 210 | Content.accountflag = 2; |
| 209 | Intent account = new Intent(); | 211 | Intent account = new Intent(); |
| 210 | account.setClass(mContext, RegisterInfoActivity.class); | 212 | account.setClass(mContext, RegisterInfoActivity.class); |
| 211 | mContext.startActivity(account); | 213 | mContext.startActivity(account); |
| 212 | ((Activity) mContext).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 214 | ((Activity) mContext).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 213 | 215 | ||
| 214 | } | 216 | } |
| 215 | }); | 217 | }); |
| 216 | } | 218 | } |
| 217 | 219 | ||
| 218 | 220 | ||
| 219 | } | 221 | } |
| 220 | 222 | ||
| 221 | @Override | 223 | @Override |
| 222 | public int getItemCount() { | 224 | public int getItemCount() { |
| 223 | 225 | ||
| 224 | return getBodySize() + footCount; | 226 | return getBodySize() + footCount; |
| 225 | } | 227 | } |
| 226 | 228 | ||
| 227 | private static class AccountChildsHolder extends RecyclerView.ViewHolder { | 229 | private static class AccountChildsHolder extends RecyclerView.ViewHolder { |
| 228 | ImageView iv_using_pic; | 230 | ImageView iv_using_pic; |
| 229 | LinearLayout ll_backgrangd; | 231 | LinearLayout ll_backgrangd; |
| 230 | SimpleDraweeView mSimpleDraweeView; | 232 | ImageView mSimpleDraweeView; |
| 231 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, | 233 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, |
| 232 | delete_account, chang_account; | 234 | delete_account, chang_account; |
| 233 | 235 | ||
| 234 | public AccountChildsHolder(View itemView) { | 236 | public AccountChildsHolder(View itemView) { |
| 235 | super(itemView); | 237 | super(itemView); |
| 236 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); | 238 | mSimpleDraweeView = (ImageView) itemView.findViewById(R.id.iv_child_head); |
| 237 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); | 239 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); |
| 238 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); | 240 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); |
| 239 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); | 241 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); |
| 240 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); | 242 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); |
| 241 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); | 243 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); |
| 242 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); | 244 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); |
| 243 | iv_using_pic = (ImageView) itemView.findViewById(R.id.iv_using_pic); | 245 | iv_using_pic = (ImageView) itemView.findViewById(R.id.iv_using_pic); |
| 244 | ll_backgrangd = (LinearLayout) itemView.findViewById(R.id.ll_backgrangd); | 246 | ll_backgrangd = (LinearLayout) itemView.findViewById(R.id.ll_backgrangd); |
| 245 | 247 | ||
| 246 | } | 248 | } |
| 247 | } | 249 | } |
| 248 | 250 | ||
| 249 | private static class FootViewHolder extends RecyclerView.ViewHolder { | 251 | private static class FootViewHolder extends RecyclerView.ViewHolder { |
| 250 | LinearLayout add_account; | 252 | LinearLayout add_account; |
| 251 | 253 | ||
| 252 | public FootViewHolder(View itemView) { | 254 | public FootViewHolder(View itemView) { |
| 253 | super(itemView); | 255 | super(itemView); |
| 254 | add_account = (LinearLayout) itemView.findViewById(R.id.add_account); | 256 | add_account = (LinearLayout) itemView.findViewById(R.id.add_account); |
| 255 | } | 257 | } |
| 256 | } | 258 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/GalleryAdapter.java
| 1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.support.v7.widget.RecyclerView; | 4 | import android.support.v7.widget.RecyclerView; |
| 5 | import android.view.LayoutInflater; | 5 | import android.view.LayoutInflater; |
| 6 | import android.view.View; | 6 | import android.view.View; |
| 7 | import android.view.ViewGroup; | 7 | import android.view.ViewGroup; |
| 8 | import android.widget.ImageView; | ||
| 8 | import android.widget.TextView; | 9 | import android.widget.TextView; |
| 9 | 10 | ||
| 10 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 11 | import com.hjx.personalcenter.R; | 11 | import com.hjx.personalcenter.R; |
| 12 | import com.hjx.personalcenter.model.DefautPublishInfo; | 12 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 13 | 13 | ||
| 14 | import java.util.ArrayList; | 14 | import java.util.ArrayList; |
| 15 | 15 | ||
| 16 | public class GalleryAdapter extends | 16 | public class GalleryAdapter extends |
| 17 | RecyclerView.Adapter<GalleryAdapter.ViewHolder> | 17 | RecyclerView.Adapter<GalleryAdapter.ViewHolder> |
| 18 | { | 18 | { |
| 19 | 19 | ||
| 20 | private LayoutInflater mInflater; | 20 | private LayoutInflater mInflater; |
| 21 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; | 21 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; |
| 22 | 22 | ||
| 23 | public GalleryAdapter(Context context, ArrayList<DefautPublishInfo.DataBean> mDatas) | 23 | public GalleryAdapter(Context context, ArrayList<DefautPublishInfo.DataBean> mDatas) |
| 24 | { | 24 | { |
| 25 | mInflater = LayoutInflater.from(context); | 25 | mInflater = LayoutInflater.from(context); |
| 26 | defautPublishInfo = mDatas; | 26 | defautPublishInfo = mDatas; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | public static class ViewHolder extends RecyclerView.ViewHolder | 29 | public static class ViewHolder extends RecyclerView.ViewHolder |
| 30 | { | 30 | { |
| 31 | public ViewHolder(View arg0) | 31 | public ViewHolder(View arg0) |
| 32 | { | 32 | { |
| 33 | super(arg0); | 33 | super(arg0); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | SimpleDraweeView simpleDraweeView; | 36 | ImageView simpleDraweeView; |
| 37 | TextView subject; | 37 | TextView subject; |
| 38 | TextView publish; | 38 | TextView publish; |
| 39 | 39 | ||
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | @Override | 42 | @Override |
| 43 | public int getItemCount() | 43 | public int getItemCount() |
| 44 | { | 44 | { |
| 45 | return defautPublishInfo.size(); | 45 | return defautPublishInfo.size(); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| 49 | * 创建ViewHolder | 49 | * 创建ViewHolder |
| 50 | */ | 50 | */ |
| 51 | @Override | 51 | @Override |
| 52 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) | 52 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) |
| 53 | { | 53 | { |
| 54 | View view = mInflater.inflate(R.layout.fragment_changge_version_info_itmes2, | 54 | View view = mInflater.inflate(R.layout.fragment_changge_version_info_itmes2, |
| 55 | viewGroup, false); | 55 | viewGroup, false); |
| 56 | ViewHolder viewHolder = new ViewHolder(view); | 56 | ViewHolder viewHolder = new ViewHolder(view); |
| 57 | 57 | ||
| 58 | viewHolder.simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | 58 | viewHolder.simpleDraweeView = (ImageView) view.findViewById(R.id.image_publish); |
| 59 | viewHolder.subject = (TextView) view.findViewById(R.id.subject); | 59 | viewHolder.subject = (TextView) view.findViewById(R.id.subject); |
| 60 | viewHolder.publish = (TextView) view.findViewById(R.id.tv_publish); | 60 | viewHolder.publish = (TextView) view.findViewById(R.id.tv_publish); |
| 61 | return viewHolder; | 61 | return viewHolder; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | /** | 64 | /** |
| 65 | * 设置值 | 65 | * 设置值 |
| 66 | */ | 66 | */ |
| 67 | @Override | 67 | @Override |
| 68 | public void onBindViewHolder(final ViewHolder viewHolder, final int i) | 68 | public void onBindViewHolder(final ViewHolder viewHolder, final int i) |
| 69 | { | 69 | { |
| 70 | //viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(i).getCover()); | 70 | //viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(i).getCover()); |
| 71 | viewHolder.subject.setText(defautPublishInfo.get(i).getSubject()); | 71 | viewHolder.subject.setText(defautPublishInfo.get(i).getSubject()); |
| 72 | viewHolder.publish.setText(defautPublishInfo.get(i).getPress()); | 72 | viewHolder.publish.setText(defautPublishInfo.get(i).getPress()); |
| 73 | } | 73 | } |
| 74 | 74 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/GridAdapter.java
| 1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.view.View; | 4 | import android.view.View; |
| 5 | import android.view.ViewGroup; | 5 | import android.view.ViewGroup; |
| 6 | import android.widget.BaseAdapter; | 6 | import android.widget.BaseAdapter; |
| 7 | import android.widget.ImageView; | ||
| 7 | import android.widget.TextView; | 8 | import android.widget.TextView; |
| 8 | 9 | ||
| 9 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 10 | import com.hjx.personalcenter.R; | 10 | import com.hjx.personalcenter.R; |
| 11 | import com.hjx.personalcenter.model.DefautPublishInfo; | 11 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 12 | 12 | ||
| 13 | import java.util.ArrayList; | 13 | import java.util.ArrayList; |
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | * Created by h on 2017/9/12. | 16 | * Created by h on 2017/9/12. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | public class GridAdapter extends BaseAdapter { | 19 | public class GridAdapter extends BaseAdapter { |
| 20 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; | 20 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; |
| 21 | private int imageid[] = {R.mipmap.xiaoxueyuwen,R.mipmap.xiaoxueshuxue,R.mipmap.xiaoxueyinyu}; | 21 | private int imageid[] = {R.mipmap.xiaoxueyuwen,R.mipmap.xiaoxueshuxue,R.mipmap.xiaoxueyinyu}; |
| 22 | private int imageids[] = {R.mipmap.gaozhongyuwen,R.mipmap.gaozhongshuxue,R.mipmap.gaozhongyinyu | 22 | private int imageids[] = {R.mipmap.gaozhongyuwen,R.mipmap.gaozhongshuxue,R.mipmap.gaozhongyinyu |
| 23 | ,R.mipmap.gaozhongwuli,R.mipmap.gaozhonghuaxue | 23 | ,R.mipmap.gaozhongwuli,R.mipmap.gaozhonghuaxue |
| 24 | ,R.mipmap.gaozhongshengwu,R.mipmap.gaozhongzhengzhi,R.mipmap.gaozhonglishi | 24 | ,R.mipmap.gaozhongshengwu,R.mipmap.gaozhongzhengzhi,R.mipmap.gaozhonglishi |
| 25 | ,R.mipmap.gaozhongdili,R.mipmap.gaozhongkexue}; | 25 | ,R.mipmap.gaozhongdili,R.mipmap.gaozhongkexue}; |
| 26 | private Context context; | 26 | private Context context; |
| 27 | 27 | ||
| 28 | public GridAdapter(ArrayList<DefautPublishInfo.DataBean> defautPublishInfo, Context context) { | 28 | public GridAdapter(ArrayList<DefautPublishInfo.DataBean> defautPublishInfo, Context context) { |
| 29 | this.defautPublishInfo = defautPublishInfo; | 29 | this.defautPublishInfo = defautPublishInfo; |
| 30 | this.context = context; | 30 | this.context = context; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | @Override | 33 | @Override |
| 34 | public int getCount() { | 34 | public int getCount() { |
| 35 | return defautPublishInfo.size(); | 35 | return defautPublishInfo.size(); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | @Override | 38 | @Override |
| 39 | public Object getItem(int position) { | 39 | public Object getItem(int position) { |
| 40 | return position; | 40 | return position; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | @Override | 43 | @Override |
| 44 | public long getItemId(int position) { | 44 | public long getItemId(int position) { |
| 45 | return position; | 45 | return position; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | @Override | 48 | @Override |
| 49 | public View getView(int position, View convertView, ViewGroup parent) { | 49 | public View getView(int position, View convertView, ViewGroup parent) { |
| 50 | ViewHolder viewHolder = new ViewHolder(); | 50 | ViewHolder viewHolder = new ViewHolder(); |
| 51 | if (convertView == null) { | 51 | if (convertView == null) { |
| 52 | convertView = View.inflate(context, R.layout.fragment_changge_version_info_itmes3, null); | 52 | convertView = View.inflate(context, R.layout.fragment_changge_version_info_itmes3, null); |
| 53 | viewHolder.simpleDraweeView = (SimpleDraweeView) convertView.findViewById(R.id.image_publish); | 53 | viewHolder.simpleDraweeView = (ImageView) convertView.findViewById(R.id.image_publish); |
| 54 | viewHolder.subject = (TextView) convertView.findViewById(R.id.subject); | 54 | viewHolder.subject = (TextView) convertView.findViewById(R.id.subject); |
| 55 | viewHolder.publish = (TextView) convertView.findViewById(R.id.tv_publish); | 55 | viewHolder.publish = (TextView) convertView.findViewById(R.id.tv_publish); |
| 56 | convertView.setTag(viewHolder); | 56 | convertView.setTag(viewHolder); |
| 57 | } else { | 57 | } else { |
| 58 | viewHolder = (ViewHolder) convertView.getTag(); | 58 | viewHolder = (ViewHolder) convertView.getTag(); |
| 59 | } | 59 | } |
| 60 | if (position==2){ | 60 | if (position==2){ |
| 61 | viewHolder.simpleDraweeView.setBackgroundResource(imageid[position]); | 61 | viewHolder.simpleDraweeView.setBackgroundResource(imageid[position]); |
| 62 | }else { | 62 | }else { |
| 63 | viewHolder.simpleDraweeView.setBackgroundResource(imageids[position]); | 63 | viewHolder.simpleDraweeView.setBackgroundResource(imageids[position]); |
| 64 | } | 64 | } |
| 65 | viewHolder.subject.setText(defautPublishInfo.get(position).getSubject()); | 65 | viewHolder.subject.setText(defautPublishInfo.get(position).getSubject()); |
| 66 | viewHolder.publish.setText(defautPublishInfo.get(position).getPress()); | 66 | viewHolder.publish.setText(defautPublishInfo.get(position).getPress()); |
| 67 | return convertView; | 67 | return convertView; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | static class ViewHolder { | 70 | static class ViewHolder { |
| 71 | SimpleDraweeView simpleDraweeView; | 71 | ImageView simpleDraweeView; |
| 72 | TextView subject; | 72 | TextView subject; |
| 73 | TextView publish; | 73 | TextView publish; |
| 74 | } | 74 | } |
| 75 | } | 75 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/MianGridAdapter.java
| 1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.view.View; | 4 | import android.view.View; |
| 5 | import android.view.ViewGroup; | 5 | import android.view.ViewGroup; |
| 6 | import android.widget.BaseAdapter; | 6 | import android.widget.BaseAdapter; |
| 7 | import android.widget.ImageView; | ||
| 7 | import android.widget.TextView; | 8 | import android.widget.TextView; |
| 8 | 9 | ||
| 9 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 10 | import com.hjx.personalcenter.R; | 10 | import com.hjx.personalcenter.R; |
| 11 | import com.hjx.personalcenter.model.DefautPublishInfo; | 11 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 12 | 12 | ||
| 13 | import java.util.ArrayList; | 13 | import java.util.ArrayList; |
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | * Created by h on 2017/9/12. | 16 | * Created by h on 2017/9/12. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | public class MianGridAdapter extends BaseAdapter { | 19 | public class MianGridAdapter extends BaseAdapter { |
| 20 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; | 20 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; |
| 21 | private int imageid[] = {R.mipmap.xiaoxueyuwen,R.mipmap.xiaoxueshuxue,R.mipmap.xiaoxueyinyu}; | 21 | private int imageid[] = {R.mipmap.xiaoxueyuwen,R.mipmap.xiaoxueshuxue,R.mipmap.xiaoxueyinyu}; |
| 22 | private int imageids[] = {R.mipmap.gaozhongyuwen,R.mipmap.gaozhongshuxue,R.mipmap.gaozhongyinyu | 22 | private int imageids[] = {R.mipmap.gaozhongyuwen,R.mipmap.gaozhongshuxue,R.mipmap.gaozhongyinyu |
| 23 | ,R.mipmap.gaozhongwuli,R.mipmap.gaozhonghuaxue | 23 | ,R.mipmap.gaozhongwuli,R.mipmap.gaozhonghuaxue |
| 24 | ,R.mipmap.gaozhongshengwu,R.mipmap.gaozhongzhengzhi,R.mipmap.gaozhonglishi | 24 | ,R.mipmap.gaozhongshengwu,R.mipmap.gaozhongzhengzhi,R.mipmap.gaozhonglishi |
| 25 | ,R.mipmap.gaozhongdili,R.mipmap.gaozhongkexue}; | 25 | ,R.mipmap.gaozhongdili,R.mipmap.gaozhongkexue}; |
| 26 | private Context context; | 26 | private Context context; |
| 27 | 27 | ||
| 28 | public MianGridAdapter(ArrayList<DefautPublishInfo.DataBean> defautPublishInfo, Context context) { | 28 | public MianGridAdapter(ArrayList<DefautPublishInfo.DataBean> defautPublishInfo, Context context) { |
| 29 | this.defautPublishInfo = defautPublishInfo; | 29 | this.defautPublishInfo = defautPublishInfo; |
| 30 | this.context = context; | 30 | this.context = context; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | @Override | 33 | @Override |
| 34 | public int getCount() { | 34 | public int getCount() { |
| 35 | return defautPublishInfo.size(); | 35 | return defautPublishInfo.size(); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | @Override | 38 | @Override |
| 39 | public Object getItem(int position) { | 39 | public Object getItem(int position) { |
| 40 | return position; | 40 | return position; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | @Override | 43 | @Override |
| 44 | public long getItemId(int position) { | 44 | public long getItemId(int position) { |
| 45 | return position; | 45 | return position; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | @Override | 48 | @Override |
| 49 | public View getView(int position, View convertView, ViewGroup parent) { | 49 | public View getView(int position, View convertView, ViewGroup parent) { |
| 50 | ViewHolder viewHolder = new ViewHolder(); | 50 | ViewHolder viewHolder = new ViewHolder(); |
| 51 | if (convertView == null) { | 51 | if (convertView == null) { |
| 52 | convertView = View.inflate(context, R.layout.fragment_changge_version_info_itmes4, null); | 52 | convertView = View.inflate(context, R.layout.fragment_changge_version_info_itmes4, null); |
| 53 | viewHolder.simpleDraweeView = (SimpleDraweeView) convertView.findViewById(R.id.image_publish); | 53 | viewHolder.simpleDraweeView = (ImageView) convertView.findViewById(R.id.image_publish); |
| 54 | //viewHolder.subject = (TextView) convertView.findViewById(R.id.subject); | 54 | //viewHolder.subject = (TextView) convertView.findViewById(R.id.subject); |
| 55 | viewHolder.publish = (TextView) convertView.findViewById(R.id.tv_publish); | 55 | viewHolder.publish = (TextView) convertView.findViewById(R.id.tv_publish); |
| 56 | convertView.setTag(viewHolder); | 56 | convertView.setTag(viewHolder); |
| 57 | } else { | 57 | } else { |
| 58 | viewHolder = (ViewHolder) convertView.getTag(); | 58 | viewHolder = (ViewHolder) convertView.getTag(); |
| 59 | } | 59 | } |
| 60 | if (position==2){ | 60 | if (position==2){ |
| 61 | viewHolder.simpleDraweeView.setBackgroundResource(imageid[position]); | 61 | viewHolder.simpleDraweeView.setBackgroundResource(imageid[position]); |
| 62 | }else { | 62 | }else { |
| 63 | viewHolder.simpleDraweeView.setBackgroundResource(imageids[position]); | 63 | viewHolder.simpleDraweeView.setBackgroundResource(imageids[position]); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | //viewHolder.subject.setText(defautPublishInfo.get(position).getSubject()); | 66 | //viewHolder.subject.setText(defautPublishInfo.get(position).getSubject()); |
| 67 | viewHolder.publish.setText(defautPublishInfo.get(position).getPress()); | 67 | viewHolder.publish.setText(defautPublishInfo.get(position).getPress()); |
| 68 | //viewHolder.publish.setMovementMethod(new ScrollingMovementMethod()); | 68 | //viewHolder.publish.setMovementMethod(new ScrollingMovementMethod()); |
| 69 | return convertView; | 69 | return convertView; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | static class ViewHolder { | 72 | static class ViewHolder { |
| 73 | SimpleDraweeView simpleDraweeView; | 73 | ImageView simpleDraweeView; |
| 74 | // TextView subject; | 74 | // TextView subject; |
| 75 | TextView publish; | 75 | TextView publish; |
| 76 | } | 76 | } |
| 77 | } | 77 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/VideoAdapter.java
| 1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.support.v7.widget.RecyclerView; | 4 | import android.support.v7.widget.RecyclerView; |
| 5 | import android.view.LayoutInflater; | 5 | import android.view.LayoutInflater; |
| 6 | import android.view.View; | 6 | import android.view.View; |
| 7 | import android.view.ViewGroup; | 7 | import android.view.ViewGroup; |
| 8 | import android.widget.ImageView; | ||
| 8 | import android.widget.TextView; | 9 | import android.widget.TextView; |
| 9 | 10 | ||
| 10 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 11 | import com.hjx.personalcenter.R; | 11 | import com.hjx.personalcenter.R; |
| 12 | import com.hjx.personalcenter.model.VideoInfo; | 12 | import com.hjx.personalcenter.model.VideoInfo; |
| 13 | import com.squareup.picasso.Picasso; | ||
| 13 | 14 | ||
| 14 | import java.util.ArrayList; | 15 | import java.util.ArrayList; |
| 15 | 16 | ||
| 16 | public class VideoAdapter extends | 17 | public class VideoAdapter extends |
| 17 | RecyclerView.Adapter<VideoAdapter.ViewHolder> | 18 | RecyclerView.Adapter<VideoAdapter.ViewHolder> |
| 18 | { | 19 | { |
| 19 | 20 | ||
| 20 | private LayoutInflater mInflater; | 21 | private LayoutInflater mInflater; |
| 22 | private Context mcontext; | ||
| 21 | private ArrayList<VideoInfo.DataBean> defautPublishInfo; | 23 | private ArrayList<VideoInfo.DataBean> defautPublishInfo; |
| 22 | 24 | ||
| 23 | public VideoAdapter(Context context, ArrayList<VideoInfo.DataBean> mDatas) | 25 | public VideoAdapter(Context context, ArrayList<VideoInfo.DataBean> mDatas) |
| 24 | { | 26 | { |
| 25 | mInflater = LayoutInflater.from(context); | 27 | mInflater = LayoutInflater.from(context); |
| 26 | defautPublishInfo = mDatas; | 28 | defautPublishInfo = mDatas; |
| 29 | mcontext =context; | ||
| 27 | } | 30 | } |
| 28 | 31 | ||
| 29 | public static class ViewHolder extends RecyclerView.ViewHolder | 32 | public static class ViewHolder extends RecyclerView.ViewHolder |
| 30 | { | 33 | { |
| 31 | public ViewHolder(View arg0) | 34 | public ViewHolder(View arg0) |
| 32 | { | 35 | { |
| 33 | super(arg0); | 36 | super(arg0); |
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | SimpleDraweeView simpleDraweeView; | 39 | ImageView simpleDraweeView; |
| 37 | TextView subject; | 40 | TextView subject; |
| 38 | TextView publish; | 41 | TextView publish; |
| 39 | 42 | ||
| 40 | } | 43 | } |
| 41 | 44 | ||
| 42 | @Override | 45 | @Override |
| 43 | public int getItemCount() | 46 | public int getItemCount() |
| 44 | { | 47 | { |
| 45 | return defautPublishInfo.size(); | 48 | return defautPublishInfo.size(); |
| 46 | } | 49 | } |
| 47 | 50 | ||
| 48 | /** | 51 | /** |
| 49 | * 创建ViewHolder | 52 | * 创建ViewHolder |
| 50 | */ | 53 | */ |
| 51 | @Override | 54 | @Override |
| 52 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) | 55 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) |
| 53 | { | 56 | { |
| 54 | View view = mInflater.inflate(R.layout.fragment_changge_version_info_itmes, | 57 | View view = mInflater.inflate(R.layout.fragment_changge_version_info_itmes, |
| 55 | viewGroup, false); | 58 | viewGroup, false); |
| 56 | ViewHolder viewHolder = new ViewHolder(view); | 59 | ViewHolder viewHolder = new ViewHolder(view); |
| 57 | 60 | ||
| 58 | viewHolder.simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | 61 | viewHolder.simpleDraweeView = (ImageView) view.findViewById(R.id.image_publish); |
| 59 | viewHolder.subject = (TextView) view.findViewById(R.id.subject); | 62 | viewHolder.subject = (TextView) view.findViewById(R.id.subject); |
| 60 | viewHolder.publish = (TextView) view.findViewById(R.id.tv_publish); | 63 | viewHolder.publish = (TextView) view.findViewById(R.id.tv_publish); |
| 61 | return viewHolder; | 64 | return viewHolder; |
| 62 | } | 65 | } |
| 63 | 66 | ||
| 64 | /** | 67 | /** |
| 65 | * 设置值 | 68 | * 设置值 |
| 66 | */ | 69 | */ |
| 67 | @Override | 70 | @Override |
| 68 | public void onBindViewHolder(final ViewHolder viewHolder, final int i) | 71 | public void onBindViewHolder(final ViewHolder viewHolder, final int i) |
| 69 | { | 72 | { |
| 70 | viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(i).getVideoCover()); | 73 | if (defautPublishInfo.get(i).getVideoCover()!=null&&!defautPublishInfo.get(i).getVideoCover().isEmpty()) { |
| 74 | Picasso.with(mcontext).load(defautPublishInfo.get(i).getVideoCover()).into(viewHolder.simpleDraweeView); | ||
| 75 | } | ||
| 71 | viewHolder.subject.setText(defautPublishInfo.get(i).getVideoName()); | 76 | viewHolder.subject.setText(defautPublishInfo.get(i).getVideoName()); |
| 72 | //viewHolder.publish.setText(defautPublishInfo.get(i).getPress()); | 77 | //viewHolder.publish.setText(defautPublishInfo.get(i).getPress()); |
| 73 | } | 78 | } |
| 74 | 79 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/IllegalDialog.java
| 1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
| 2 | 2 | ||
| 3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.content.Intent; | 5 | import android.content.Intent; |
| 6 | import android.graphics.Color; | 6 | import android.graphics.Color; |
| 7 | import android.os.Bundle; | 7 | import android.os.Bundle; |
| 8 | import android.view.Gravity; | 8 | import android.view.Gravity; |
| 9 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
| 10 | import android.view.View; | 10 | import android.view.View; |
| 11 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
| 12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
| 13 | 13 | ||
| 14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
| 15 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 15 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
| 16 | import com.hjx.personalcenter.activity.SysApplication; | 16 | import com.hjx.personalcenter.activity.SysApplication; |
| 17 | import com.hjx.personalcenter.db.SaveParam; | ||
| 17 | import com.mylhyl.circledialog.BaseCircleDialog; | 18 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 18 | import com.mylhyl.circledialog.res.values.CircleDimen; | 19 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 19 | 20 | ||
| 20 | /** | 21 | /** |
| 21 | * Created by h on 2017/8/20. | 22 | * Created by h on 2017/8/20. |
| 22 | */ | 23 | */ |
| 23 | @SuppressLint("ValidFragment") | 24 | @SuppressLint("ValidFragment") |
| 24 | public class IllegalDialog extends BaseCircleDialog { | 25 | public class IllegalDialog extends BaseCircleDialog { |
| 25 | private View mView; | 26 | private View mView; |
| 26 | private TextView i_know; | 27 | private TextView i_know; |
| 27 | 28 | ||
| 28 | public static IllegalDialog getInstance() { | 29 | public static IllegalDialog getInstance() { |
| 29 | IllegalDialog dialogFragment = new IllegalDialog(); | 30 | IllegalDialog dialogFragment = new IllegalDialog(); |
| 30 | dialogFragment.setCanceledBack(true); | 31 | dialogFragment.setCanceledBack(true); |
| 31 | dialogFragment.setCanceledOnTouchOutside(false); | 32 | dialogFragment.setCanceledOnTouchOutside(false); |
| 32 | dialogFragment.setRadius(CircleDimen.RADIUS); | 33 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 33 | dialogFragment.setWidth(0.4f); | 34 | dialogFragment.setWidth(0.4f); |
| 34 | dialogFragment.setGravity(Gravity.CENTER); | 35 | dialogFragment.setGravity(Gravity.CENTER); |
| 35 | dialogFragment.setBackgroundColor(Color.WHITE); | 36 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 36 | return dialogFragment; | 37 | return dialogFragment; |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | @Override | 40 | @Override |
| 40 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 41 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 41 | if (mView == null) { | 42 | if (mView == null) { |
| 42 | mView = inflater.inflate(R.layout.custom_adilog_feifa, container, false); | 43 | mView = inflater.inflate(R.layout.custom_adilog_feifa, container, false); |
| 43 | } | 44 | } |
| 44 | return mView; | 45 | return mView; |
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | @Override | 48 | @Override |
| 48 | public void onActivityCreated(Bundle savedInstanceState) { | 49 | public void onActivityCreated(Bundle savedInstanceState) { |
| 49 | super.onActivityCreated(savedInstanceState); | 50 | super.onActivityCreated(savedInstanceState); |
| 50 | i_know = (TextView) mView.findViewById(R.id.tv_i_know); | 51 | i_know = (TextView) mView.findViewById(R.id.tv_i_know); |
| 51 | i_know.setOnClickListener(new View.OnClickListener() { | 52 | i_know.setOnClickListener(new View.OnClickListener() { |
| 52 | @Override | 53 | @Override |
| 53 | public void onClick(View v) { | 54 | public void onClick(View v) { |
| 55 | SaveParam.getInstance().saveCustomizeParam(getActivity(),SaveParam.CARDPHONE,""); | ||
| 54 | Intent intent = new Intent(); | 56 | Intent intent = new Intent(); |
| 55 | intent.setClass(getActivity(), LoginAndRegisterActivity.class); | 57 | intent.setClass(getActivity(), LoginAndRegisterActivity.class); |
| 56 | getActivity().startActivity(intent); | 58 | getActivity().startActivity(intent); |
| 57 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 59 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 58 | SysApplication.getInstance().exit(); | 60 | SysApplication.getInstance().exit(); |
| 59 | } | 61 | } |
| 60 | }); | 62 | }); |
| 61 | 63 | ||
| 62 | 64 | ||
| 63 | } | 65 | } |
| 64 | 66 | ||
| 65 | } | 67 | } |
| 66 | 68 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/VerSionDialog.java
| 1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
| 2 | 2 | ||
| 3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
| 6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 7 | import android.os.Handler; | 7 | import android.os.Handler; |
| 8 | import android.os.Message; | 8 | import android.os.Message; |
| 9 | import android.util.Log; | 9 | import android.util.Log; |
| 10 | import android.view.Gravity; | 10 | import android.view.Gravity; |
| 11 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
| 12 | import android.view.View; | 12 | import android.view.View; |
| 13 | import android.view.ViewGroup; | 13 | import android.view.ViewGroup; |
| 14 | import android.widget.AdapterView; | 14 | import android.widget.AdapterView; |
| 15 | import android.widget.ImageView; | 15 | import android.widget.ImageView; |
| 16 | import android.widget.ListView; | 16 | import android.widget.ListView; |
| 17 | import android.widget.TextView; | 17 | import android.widget.TextView; |
| 18 | 18 | ||
| 19 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 20 | import com.hjx.personalcenter.R; | 19 | import com.hjx.personalcenter.R; |
| 21 | import com.hjx.personalcenter.adapter.VersionAdapter; | 20 | import com.hjx.personalcenter.adapter.VersionAdapter; |
| 22 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
| 23 | import com.hjx.personalcenter.http.HttpCode; | 22 | import com.hjx.personalcenter.http.HttpCode; |
| 24 | import com.hjx.personalcenter.http.HttpManager; | 23 | import com.hjx.personalcenter.http.HttpManager; |
| 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 24 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 26 | import com.hjx.personalcenter.model.VersionInfo; | 25 | import com.hjx.personalcenter.model.VersionInfo; |
| 27 | import com.mylhyl.circledialog.BaseCircleDialog; | 26 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 28 | import com.mylhyl.circledialog.res.values.CircleDimen; | 27 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 29 | 28 | ||
| 30 | import java.util.ArrayList; | 29 | import java.util.ArrayList; |
| 31 | import java.util.List; | 30 | import java.util.List; |
| 32 | 31 | ||
| 33 | /** | 32 | /** |
| 34 | * 自定义版本信息列表对话框 | 33 | * 自定义版本信息列表对话框 |
| 35 | * Created by h on 2017/8/10. | 34 | * Created by h on 2017/8/10. |
| 36 | */ | 35 | */ |
| 37 | @SuppressLint("ValidFragment") | 36 | @SuppressLint("ValidFragment") |
| 38 | public class VerSionDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener{ | 37 | public class VerSionDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener{ |
| 39 | private VersionAdapter listadapter; | 38 | private VersionAdapter listadapter; |
| 40 | private ImageView cance; | 39 | private ImageView cance; |
| 41 | private ListView listView; | 40 | private ListView listView; |
| 42 | private TextView publish; | 41 | private TextView publish; |
| 43 | private SimpleDraweeView simpleDraweeView; | 42 | private ImageView simpleDraweeView; |
| 44 | private ArrayList<VersionInfo.DataBean> data = new ArrayList<>(); | 43 | private ArrayList<VersionInfo.DataBean> data = new ArrayList<>(); |
| 45 | private DialogCallBack.VersionCallBack mcallback; | 44 | private DialogCallBack.VersionCallBack mcallback; |
| 46 | public VerSionDialog(DialogCallBack.VersionCallBack callBack) { | 45 | public VerSionDialog(DialogCallBack.VersionCallBack callBack) { |
| 47 | this.mcallback = callBack; | 46 | this.mcallback = callBack; |
| 48 | } | 47 | } |
| 49 | Handler handler = new Handler(){ | 48 | Handler handler = new Handler(){ |
| 50 | @Override | 49 | @Override |
| 51 | public void handleMessage(Message msg) { | 50 | public void handleMessage(Message msg) { |
| 52 | super.handleMessage(msg); | 51 | super.handleMessage(msg); |
| 53 | switch (msg.what){ | 52 | switch (msg.what){ |
| 54 | case HttpCode.VERSION_SUCESS: | 53 | case HttpCode.VERSION_SUCESS: |
| 55 | data.clear(); | 54 | data.clear(); |
| 56 | data.addAll( (List<VersionInfo.DataBean>)msg.obj); | 55 | data.addAll( (List<VersionInfo.DataBean>)msg.obj); |
| 57 | listadapter.notifyDataSetChanged(); | 56 | listadapter.notifyDataSetChanged(); |
| 58 | 57 | ||
| 59 | break; | 58 | break; |
| 60 | } | 59 | } |
| 61 | } | 60 | } |
| 62 | }; | 61 | }; |
| 63 | 62 | ||
| 64 | public static VerSionDialog getInstance(DialogCallBack.VersionCallBack callBack) { | 63 | public static VerSionDialog getInstance(DialogCallBack.VersionCallBack callBack) { |
| 65 | VerSionDialog dialogFragment = new VerSionDialog(callBack); | 64 | VerSionDialog dialogFragment = new VerSionDialog(callBack); |
| 66 | dialogFragment.setCanceledBack(true); | 65 | dialogFragment.setCanceledBack(true); |
| 67 | dialogFragment.setCanceledOnTouchOutside(true); | 66 | dialogFragment.setCanceledOnTouchOutside(true); |
| 68 | dialogFragment.setRadius(CircleDimen.RADIUS); | 67 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 69 | dialogFragment.setWidth(0.5f); | 68 | dialogFragment.setWidth(0.5f); |
| 70 | dialogFragment.setGravity(Gravity.CENTER); | 69 | dialogFragment.setGravity(Gravity.CENTER); |
| 71 | dialogFragment.setBackgroundColor(Color.WHITE); | 70 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 72 | return dialogFragment; | 71 | return dialogFragment; |
| 73 | } | 72 | } |
| 74 | 73 | ||
| 75 | @Override | 74 | @Override |
| 76 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 75 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 77 | return inflater.inflate(R.layout.custom_adilog_publishlist, container, false); | 76 | return inflater.inflate(R.layout.custom_adilog_publishlist, container, false); |
| 78 | } | 77 | } |
| 79 | 78 | ||
| 80 | @Override | 79 | @Override |
| 81 | public void onActivityCreated(Bundle savedInstanceState) { | 80 | public void onActivityCreated(Bundle savedInstanceState) { |
| 82 | super.onActivityCreated(savedInstanceState); | 81 | super.onActivityCreated(savedInstanceState); |
| 83 | listView = (ListView) getView().findViewById(R.id.listadapter); | 82 | listView = (ListView) getView().findViewById(R.id.listadapter); |
| 84 | cance = (ImageView) getView().findViewById(R.id.cancel); | 83 | cance = (ImageView) getView().findViewById(R.id.cancel); |
| 85 | listadapter = new VersionAdapter(data,getActivity()); | 84 | listadapter = new VersionAdapter(data,getActivity()); |
| 86 | listView.setAdapter(listadapter); | 85 | listView.setAdapter(listadapter); |
| 87 | listView.setOnItemClickListener(this); | 86 | listView.setOnItemClickListener(this); |
| 88 | cance.setOnClickListener(new View.OnClickListener() { | 87 | cance.setOnClickListener(new View.OnClickListener() { |
| 89 | @Override | 88 | @Override |
| 90 | public void onClick(View v) { | 89 | public void onClick(View v) { |
| 91 | dismiss(); | 90 | dismiss(); |
| 92 | } | 91 | } |
| 93 | }); | 92 | }); |
| 94 | String subjectName = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.SUBJECT); | 93 | String subjectName = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.SUBJECT); |
| 95 | Log.e("test","选择的科目"+subjectName); | 94 | Log.e("test","选择的科目"+subjectName); |
| 96 | HttpManager.getInstance().versioninfo(getActivity(),subjectName,handler); | 95 | HttpManager.getInstance().versioninfo(getActivity(),subjectName,handler); |
| 97 | 96 | ||
| 98 | } | 97 | } |
| 99 | 98 | ||
| 100 | @Override | 99 | @Override |
| 101 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 100 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
| 102 | mcallback.versionOnItemClick(data,position,5); | 101 | mcallback.versionOnItemClick(data,position,5); |
| 103 | // String imageurl = data.get(position).getPressCover(); | 102 | // String imageurl = data.get(position).getPressCover(); |
| 104 | // String publishs = data.get(position).getPressName(); | 103 | // String publishs = data.get(position).getPressName(); |
| 105 | // Log.e("test","拿到的数据为"+imageurl+publish); | 104 | // Log.e("test","拿到的数据为"+imageurl+publish); |
| 106 | // simpleDraweeView.setImageURI(imageurl); | 105 | // simpleDraweeView.setImageURI(imageurl); |
| 107 | // publish.setText(publishs); | 106 | // publish.setText(publishs); |
| 108 | 107 | ||
| 109 | dismiss(); | 108 | dismiss(); |
| 110 | 109 | ||
| 111 | } | 110 | } |
| 112 | } | 111 | } |
| 113 | 112 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/VersionsInfoFragment.java
| 1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
| 2 | 2 | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | import android.os.Handler; | 4 | import android.os.Handler; |
| 5 | import android.os.Message; | 5 | import android.os.Message; |
| 6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
| 8 | import android.support.v4.view.ViewPager; | 8 | import android.support.v4.view.ViewPager; |
| 9 | import android.util.Log; | 9 | import android.util.Log; |
| 10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
| 11 | import android.view.View; | 11 | import android.view.View; |
| 12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
| 13 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
| 14 | import android.widget.GridView; | 14 | import android.widget.GridView; |
| 15 | import android.widget.ImageView; | 15 | import android.widget.ImageView; |
| 16 | import android.widget.LinearLayout; | 16 | import android.widget.LinearLayout; |
| 17 | import android.widget.TextView; | 17 | import android.widget.TextView; |
| 18 | 18 | ||
| 19 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 20 | import com.hjx.personalcenter.R; | 19 | import com.hjx.personalcenter.R; |
| 21 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; | 20 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; |
| 22 | import com.hjx.personalcenter.adapter.GridAdapter; | 21 | import com.hjx.personalcenter.adapter.GridAdapter; |
| 23 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 22 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
| 24 | import com.hjx.personalcenter.db.SaveParam; | 23 | import com.hjx.personalcenter.db.SaveParam; |
| 25 | import com.hjx.personalcenter.http.HttpCode; | 24 | import com.hjx.personalcenter.http.HttpCode; |
| 26 | import com.hjx.personalcenter.http.HttpManager; | 25 | import com.hjx.personalcenter.http.HttpManager; |
| 27 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 26 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 28 | import com.hjx.personalcenter.model.DefautPublishInfo; | 27 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 29 | import com.hjx.personalcenter.model.VersionInfo; | 28 | import com.hjx.personalcenter.model.VersionInfo; |
| 29 | import com.squareup.picasso.Picasso; | ||
| 30 | 30 | ||
| 31 | import java.util.ArrayList; | 31 | import java.util.ArrayList; |
| 32 | import java.util.List; | 32 | import java.util.List; |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| 35 | * Created by h on 2017/8/12. | 35 | * Created by h on 2017/8/12. |
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener, DialogCallBack.VersionCallBack { | 38 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener, DialogCallBack.VersionCallBack { |
| 39 | private GridView gridView; | 39 | private GridView gridView; |
| 40 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 40 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
| 41 | private GridAdapter sim_adapter; | 41 | private GridAdapter sim_adapter; |
| 42 | private View mView; | 42 | private View mView; |
| 43 | private int type; | 43 | private int type; |
| 44 | private ImageView cances; | 44 | private ImageView cances; |
| 45 | private LinearLayout tv_presons; | 45 | private LinearLayout tv_presons; |
| 46 | private TextView publish, sub; | 46 | private TextView publish, sub; |
| 47 | private SimpleDraweeView simpleDraweeView; | 47 | private ImageView simpleDraweeView; |
| 48 | public static String TABLAYOUT_FRAGMENT = "versionfragment"; | 48 | public static String TABLAYOUT_FRAGMENT = "versionfragment"; |
| 49 | 49 | ||
| 50 | private String chinese, math,english,physics,chemistry,history,geography,political,biology,science; | 50 | private String chinese, math,english,physics,chemistry,history,geography,political,biology,science; |
| 51 | public static VersionsInfoFragment newInstance(int type) { | 51 | public static VersionsInfoFragment newInstance(int type) { |
| 52 | VersionsInfoFragment fragment = new VersionsInfoFragment(); | 52 | VersionsInfoFragment fragment = new VersionsInfoFragment(); |
| 53 | Bundle bundle = new Bundle(); | 53 | Bundle bundle = new Bundle(); |
| 54 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 54 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
| 55 | fragment.setArguments(bundle); | 55 | fragment.setArguments(bundle); |
| 56 | return fragment; | 56 | return fragment; |
| 57 | 57 | ||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | Handler handler = new Handler() { | 60 | Handler handler = new Handler() { |
| 61 | @Override | 61 | @Override |
| 62 | public void handleMessage(Message msg) { | 62 | public void handleMessage(Message msg) { |
| 63 | super.handleMessage(msg); | 63 | super.handleMessage(msg); |
| 64 | switch (msg.what) { | 64 | switch (msg.what) { |
| 65 | case HttpCode.PUBLISH_SUCESS: | 65 | case HttpCode.PUBLISH_SUCESS: |
| 66 | defautPublishInfos.clear(); | 66 | defautPublishInfos.clear(); |
| 67 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 67 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
| 68 | sim_adapter.notifyDataSetChanged(); | 68 | sim_adapter.notifyDataSetChanged(); |
| 69 | for (int i = 0; i < defautPublishInfos.size(); i++) { | 69 | for (int i = 0; i < defautPublishInfos.size(); i++) { |
| 70 | String subject = defautPublishInfos.get(i).getSubject(); | 70 | String subject = defautPublishInfos.get(i).getSubject(); |
| 71 | if (subject.equals("语文")) { | 71 | if (subject.equals("语文")) { |
| 72 | chinese = defautPublishInfos.get(i).getPress(); | 72 | chinese = defautPublishInfos.get(i).getPress(); |
| 73 | } else if (subject.equals("数学")) { | 73 | } else if (subject.equals("数学")) { |
| 74 | math = defautPublishInfos.get(i).getPress(); | 74 | math = defautPublishInfos.get(i).getPress(); |
| 75 | } else if (subject.equals("英语")) { | 75 | } else if (subject.equals("英语")) { |
| 76 | english = defautPublishInfos.get(i).getPress(); | 76 | english = defautPublishInfos.get(i).getPress(); |
| 77 | } else if (subject.equals("物理")) { | 77 | } else if (subject.equals("物理")) { |
| 78 | physics = defautPublishInfos.get(i).getPress(); | 78 | physics = defautPublishInfos.get(i).getPress(); |
| 79 | } else if (subject.equals("化学")) { | 79 | } else if (subject.equals("化学")) { |
| 80 | chemistry = defautPublishInfos.get(i).getPress(); | 80 | chemistry = defautPublishInfos.get(i).getPress(); |
| 81 | } else if (subject.equals("历史")) { | 81 | } else if (subject.equals("历史")) { |
| 82 | history = defautPublishInfos.get(i).getPress(); | 82 | history = defautPublishInfos.get(i).getPress(); |
| 83 | } else if (subject.equals("地理")) { | 83 | } else if (subject.equals("地理")) { |
| 84 | geography = defautPublishInfos.get(i).getPress(); | 84 | geography = defautPublishInfos.get(i).getPress(); |
| 85 | } else if (subject.equals("政治")) { | 85 | } else if (subject.equals("政治")) { |
| 86 | political = defautPublishInfos.get(i).getPress(); | 86 | political = defautPublishInfos.get(i).getPress(); |
| 87 | }else if (subject.equals("生物")) { | 87 | }else if (subject.equals("生物")) { |
| 88 | biology = defautPublishInfos.get(i).getPress(); | 88 | biology = defautPublishInfos.get(i).getPress(); |
| 89 | }else if (subject.equals("科学")) { | 89 | }else if (subject.equals("科学")) { |
| 90 | science = defautPublishInfos.get(i).getPress(); | 90 | science = defautPublishInfos.get(i).getPress(); |
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | break; | 93 | break; |
| 94 | } | 94 | } |
| 95 | } | 95 | } |
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | @Override | 98 | @Override |
| 99 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 99 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 100 | if (mView == null) { | 100 | if (mView == null) { |
| 101 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); | 101 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); |
| 102 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 102 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
| 103 | String graderid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 103 | String graderid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
| 104 | // //子账户年级id | 104 | // //子账户年级id |
| 105 | // String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); | 105 | // String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); |
| 106 | //账户类型 | 106 | //账户类型 |
| 107 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 107 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
| 108 | String childID = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSID); | 108 | String childID = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSID); |
| 109 | try { | 109 | try { |
| 110 | Object auserID; | 110 | Object auserID; |
| 111 | int type; | 111 | int type; |
| 112 | int graderIDs =Integer.parseInt(graderid); | 112 | int graderIDs =Integer.parseInt(graderid); |
| 113 | if ("2".equals(accounts)){ | 113 | if ("2".equals(accounts)){ |
| 114 | type=Integer.parseInt(accounts); | 114 | type=Integer.parseInt(accounts); |
| 115 | auserID =childID; | 115 | auserID =childID; |
| 116 | }else { | 116 | }else { |
| 117 | type =Integer.parseInt(accounts); | 117 | type =Integer.parseInt(accounts); |
| 118 | auserID =Long.parseLong(userID); | 118 | auserID =Long.parseLong(userID); |
| 119 | } | 119 | } |
| 120 | //获取版本信息 | 120 | //获取版本信息 |
| 121 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderIDs,type,handler); | 121 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderIDs,type,handler); |
| 122 | 122 | ||
| 123 | } catch (NumberFormatException e) { | 123 | } catch (NumberFormatException e) { |
| 124 | e.printStackTrace(); | 124 | e.printStackTrace(); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | initView(mView); | 127 | initView(mView); |
| 128 | initData(); | 128 | initData(); |
| 129 | setLister(); | 129 | setLister(); |
| 130 | 130 | ||
| 131 | 131 | ||
| 132 | } | 132 | } |
| 133 | return mView; | 133 | return mView; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | //初始化 | 136 | //初始化 |
| 137 | private void initView(View mView) { | 137 | private void initView(View mView) { |
| 138 | gridView = (GridView) mView.findViewById(R.id.grideview); | 138 | gridView = (GridView) mView.findViewById(R.id.grideview); |
| 139 | cances = (ImageView) mView.findViewById(R.id.cancel); | 139 | cances = (ImageView) mView.findViewById(R.id.cancel); |
| 140 | sub = (TextView) mView.findViewById(R.id.version_sub); | 140 | sub = (TextView) mView.findViewById(R.id.version_sub); |
| 141 | tv_presons = (LinearLayout) mView.findViewById(R.id.tv_presons); | 141 | tv_presons = (LinearLayout) mView.findViewById(R.id.tv_presons); |
| 142 | 142 | ||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | private void initData() { | 145 | private void initData() { |
| 146 | sim_adapter = new GridAdapter(defautPublishInfos, getActivity()); | 146 | sim_adapter = new GridAdapter(defautPublishInfos, getActivity()); |
| 147 | //配置适配器 | 147 | //配置适配器 |
| 148 | gridView.setAdapter(sim_adapter); | 148 | gridView.setAdapter(sim_adapter); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | private void setLister() { | 151 | private void setLister() { |
| 152 | gridView.setOnItemClickListener(this); | 152 | gridView.setOnItemClickListener(this); |
| 153 | sub.setOnClickListener(this); | 153 | sub.setOnClickListener(this); |
| 154 | tv_presons.setOnClickListener(this); | 154 | tv_presons.setOnClickListener(this); |
| 155 | cances.setOnClickListener(this); | 155 | cances.setOnClickListener(this); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | @Override | 158 | @Override |
| 159 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 159 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
| 160 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); | 160 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); |
| 161 | VerSionDialog.getInstance(this).show(getChildFragmentManager(), "VerSionDialog"); | 161 | VerSionDialog.getInstance(this).show(getChildFragmentManager(), "VerSionDialog"); |
| 162 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | 162 | simpleDraweeView = (ImageView) view.findViewById(R.id.image_publish); |
| 163 | publish = (TextView) view.findViewById(R.id.tv_publish); | 163 | publish = (TextView) view.findViewById(R.id.tv_publish); |
| 164 | 164 | ||
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | @Override | 167 | @Override |
| 168 | public void setUserVisibleHint(boolean isVisibleToUser) { | 168 | public void setUserVisibleHint(boolean isVisibleToUser) { |
| 169 | super.setUserVisibleHint(isVisibleToUser); | 169 | super.setUserVisibleHint(isVisibleToUser); |
| 170 | if (isVisibleToUser){ | 170 | if (isVisibleToUser){ |
| 171 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 171 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
| 172 | //String graderid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 172 | //String graderid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
| 173 | String graderid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.VIEGREADE); | 173 | String graderid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.VIEGREADE); |
| 174 | // //子账户年级id | 174 | // //子账户年级id |
| 175 | // String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); | 175 | // String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); |
| 176 | //账户类型 | 176 | //账户类型 |
| 177 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 177 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
| 178 | String childID = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSID); | 178 | String childID = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSID); |
| 179 | try { | 179 | try { |
| 180 | Object auserID; | 180 | Object auserID; |
| 181 | int type; | 181 | int type; |
| 182 | int graderIDs =Integer.parseInt(graderid); | 182 | int graderIDs =Integer.parseInt(graderid); |
| 183 | if ("2".equals(accounts)){ | 183 | if ("2".equals(accounts)){ |
| 184 | type=Integer.parseInt(accounts); | 184 | type=Integer.parseInt(accounts); |
| 185 | auserID =childID; | 185 | auserID =childID; |
| 186 | }else { | 186 | }else { |
| 187 | type =Integer.parseInt(accounts); | 187 | type =Integer.parseInt(accounts); |
| 188 | auserID =Long.parseLong(userID); | 188 | auserID =Long.parseLong(userID); |
| 189 | } | 189 | } |
| 190 | //获取版本信息 | 190 | //获取版本信息 |
| 191 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderIDs,type,handler); | 191 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderIDs,type,handler); |
| 192 | 192 | ||
| 193 | } catch (NumberFormatException e) { | 193 | } catch (NumberFormatException e) { |
| 194 | e.printStackTrace(); | 194 | e.printStackTrace(); |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | } | 197 | } |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | @Override | 200 | @Override |
| 201 | public void onResume() { | 201 | public void onResume() { |
| 202 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 202 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
| 203 | String graderid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 203 | String graderid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
| 204 | // //子账户年级id | 204 | // //子账户年级id |
| 205 | // String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); | 205 | // String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); |
| 206 | //账户类型 | 206 | //账户类型 |
| 207 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 207 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
| 208 | String childID = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSID); | 208 | String childID = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSID); |
| 209 | try { | 209 | try { |
| 210 | Object auserID; | 210 | Object auserID; |
| 211 | int type; | 211 | int type; |
| 212 | int graderIDs =Integer.parseInt(graderid); | 212 | int graderIDs =Integer.parseInt(graderid); |
| 213 | if ("2".equals(accounts)){ | 213 | if ("2".equals(accounts)){ |
| 214 | type=Integer.parseInt(accounts); | 214 | type=Integer.parseInt(accounts); |
| 215 | auserID =childID; | 215 | auserID =childID; |
| 216 | }else { | 216 | }else { |
| 217 | type =Integer.parseInt(accounts); | 217 | type =Integer.parseInt(accounts); |
| 218 | auserID =Long.parseLong(userID); | 218 | auserID =Long.parseLong(userID); |
| 219 | } | 219 | } |
| 220 | //获取版本信息 | 220 | //获取版本信息 |
| 221 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderIDs,type,handler); | 221 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderIDs,type,handler); |
| 222 | 222 | ||
| 223 | } catch (NumberFormatException e) { | 223 | } catch (NumberFormatException e) { |
| 224 | e.printStackTrace(); | 224 | e.printStackTrace(); |
| 225 | } | 225 | } |
| 226 | super.onResume(); | 226 | super.onResume(); |
| 227 | 227 | ||
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | @Override | 230 | @Override |
| 231 | public void onClick(View v) { | 231 | public void onClick(View v) { |
| 232 | switch (v.getId()) { | 232 | switch (v.getId()) { |
| 233 | case R.id.version_sub: | 233 | case R.id.version_sub: |
| 234 | Log.e("test", "你提交版本信息"); | 234 | Log.e("test", "你提交版本信息"); |
| 235 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 235 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
| 236 | //子账户id | 236 | //子账户id |
| 237 | String childsidid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSID); | 237 | String childsidid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSID); |
| 238 | //账户类型 | 238 | //账户类型 |
| 239 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 239 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
| 240 | try { | 240 | try { |
| 241 | String id = null; | 241 | String id = null; |
| 242 | //String piblish = "清华大学出版社"; | 242 | //String piblish = "清华大学出版社"; |
| 243 | if ("2".equals(accounts)) { | 243 | if ("2".equals(accounts)) { |
| 244 | id = childsidid; | 244 | id = childsidid; |
| 245 | } else { | 245 | } else { |
| 246 | id = userID; | 246 | id = userID; |
| 247 | } | 247 | } |
| 248 | //修改版本信息 | 248 | //修改版本信息 |
| 249 | HttpManager.getInstance().changepublishinfo(getActivity(), id,chinese,math,english,physics,chemistry,history,geography,political,biology,science); | 249 | HttpManager.getInstance().changepublishinfo(getActivity(), id,chinese,math,english,physics,chemistry,history,geography,political,biology,science); |
| 250 | 250 | ||
| 251 | } catch (NumberFormatException e) { | 251 | } catch (NumberFormatException e) { |
| 252 | e.printStackTrace(); | 252 | e.printStackTrace(); |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | 255 | ||
| 256 | break; | 256 | break; |
| 257 | case R.id.tv_presons: | 257 | case R.id.tv_presons: |
| 258 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); | 258 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); |
| 259 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { | 259 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { |
| 260 | @Override | 260 | @Override |
| 261 | public void gotoFragment(ViewPager viewPager) { | 261 | public void gotoFragment(ViewPager viewPager) { |
| 262 | //fragment传递数据 | 262 | //fragment传递数据 |
| 263 | viewPager.setCurrentItem(0); | 263 | viewPager.setCurrentItem(0); |
| 264 | } | 264 | } |
| 265 | }); | 265 | }); |
| 266 | mainActivity.forSkip(); | 266 | mainActivity.forSkip(); |
| 267 | break; | 267 | break; |
| 268 | 268 | ||
| 269 | case R.id.cancel: | 269 | case R.id.cancel: |
| 270 | getActivity().finish(); | 270 | getActivity().finish(); |
| 271 | break; | 271 | break; |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | @Override | 276 | @Override |
| 277 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | 277 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { |
| 278 | String imageurl = data.get(position).getPressCover(); | 278 | String imageurl = data.get(position).getPressCover(); |
| 279 | String publishs = data.get(position).getPressName(); | 279 | String publishs = data.get(position).getPressName(); |
| 280 | 280 | ||
| 281 | simpleDraweeView.setImageURI(imageurl); | 281 | if (imageurl!=null&&!imageurl.isEmpty()) { |
| 282 | Picasso.with(getActivity()).load(imageurl).into(simpleDraweeView); | ||
| 283 | } | ||
| 282 | publish.setText(publishs); | 284 | publish.setText(publishs); |
| 283 | String subject = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SUBJECT); | 285 | String subject = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SUBJECT); |
| 284 | Log.e("test", "选择的科目" + subject); | 286 | Log.e("test", "选择的科目" + subject); |
| 285 | if ("语文".equals(subject)) { | 287 | if ("语文".equals(subject)) { |
| 286 | chinese = publishs; | 288 | chinese = publishs; |
| 287 | } else if ("数学".equals(subject)) { | 289 | } else if ("数学".equals(subject)) { |
| 288 | math = publishs; | 290 | math = publishs; |
| 289 | }else if ("英语".equals(subject)) { | 291 | }else if ("英语".equals(subject)) { |
| 290 | english = publishs; | 292 | english = publishs; |
| 291 | }else if ("物理".equals(subject)) { | 293 | }else if ("物理".equals(subject)) { |
| 292 | physics = publishs; | 294 | physics = publishs; |
| 293 | }else if ("化学".equals(subject)) { | 295 | }else if ("化学".equals(subject)) { |
| 294 | chemistry = publishs; | 296 | chemistry = publishs; |
| 295 | }else if ("历史".equals(subject)) { | 297 | }else if ("历史".equals(subject)) { |
| 296 | history = publishs; | 298 | history = publishs; |
| 297 | }else if ("地理".equals(subject)) { | 299 | }else if ("地理".equals(subject)) { |
| 298 | geography = publishs; | 300 | geography = publishs; |
| 299 | }else if ("政治".equals(subject)) { | 301 | }else if ("政治".equals(subject)) { |
| 300 | political = publishs; | 302 | political = publishs; |
| 301 | }else if ("生物".equals(subject)) { | 303 | }else if ("生物".equals(subject)) { |
| 302 | biology = publishs; | 304 | biology = publishs; |
| 303 | }else if ("科学".equals(subject)) { | 305 | }else if ("科学".equals(subject)) { |
| 304 | science = publishs; | 306 | science = publishs; |
| 305 | } | 307 | } |
| 306 | 308 | ||
| 307 | } | 309 | } |
| 308 | } | 310 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
| 1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * Created by wei on 2017/6/21. | 4 | * Created by wei on 2017/6/21. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | public class HttpCode { | 7 | public class HttpCode { |
| 8 | //查询保卡信息 | 8 | //查询保卡信息 |
| 9 | public static final int SUCHCARDINFO = 0; | 9 | public static final int SUCHCARDINFO = 0; |
| 10 | //是否填写保卡信息 | 10 | //是否填写保卡信息 |
| 11 | public static final int CHECKCARD = 1; | 11 | public static final int CHECKCARD = 1; |
| 12 | //注册 | 12 | //注册 |
| 13 | public static final int REGISTERED_SUCESS = 2; | 13 | public static final int REGISTERED_SUCESS = 2; |
| 14 | public static final int REGISTERED_FAIL = 3; | 14 | public static final int REGISTERED_FAIL = 3; |
| 15 | //注册验证码 | 15 | //注册验证码 |
| 16 | public static final int AUTHCODE_SUCESS = 4; | 16 | public static final int AUTHCODE_SUCESS = 4; |
| 17 | public static final int AUTHCODE_FAIL = 5; | 17 | public static final int AUTHCODE_FAIL = 5; |
| 18 | //忘记密码验证码 | 18 | //忘记密码验证码 |
| 19 | public static final int AUTHCODE_SUCESS1 = 6; | 19 | public static final int AUTHCODE_SUCESS1 = 6; |
| 20 | public static final int AUTHCODE_FAIL1 = 7; | 20 | public static final int AUTHCODE_FAIL1 = 7; |
| 21 | //是否已经注册 | 21 | //是否已经注册 |
| 22 | public static final int IS_REFISTER = 8; | 22 | public static final int IS_REFISTER = 8; |
| 23 | //忘记密码 | 23 | //忘记密码 |
| 24 | public static final int PASSWORD_SUCESS = 9; | 24 | public static final int PASSWORD_SUCESS = 9; |
| 25 | public static final int PASSWORD_FAIL = 10; | 25 | public static final int PASSWORD_FAIL = 10; |
| 26 | //s省 | 26 | //s省 |
| 27 | public static final int PROVICES = 11; | 27 | public static final int PROVICES = 11; |
| 28 | //市 | 28 | //市 |
| 29 | public static final int CITYS = 12; | 29 | public static final int CITYS = 12; |
| 30 | //区 | 30 | //区 |
| 31 | public static final int COUNTRY = 13; | 31 | public static final int COUNTRY = 13; |
| 32 | //学校 | 32 | //学校 |
| 33 | public static final int SCHOOL = 14; | 33 | public static final int SCHOOL = 14; |
| 34 | //年级 | 34 | //年级 |
| 35 | public static final int GRADER = 15; | 35 | public static final int GRADER = 15; |
| 36 | //获取个人信息 | 36 | //获取个人信息 |
| 37 | public static final int GETINFO = 16; | 37 | public static final int GETINFO = 16; |
| 38 | //获取个性签名 | 38 | //获取个性签名 |
| 39 | public static final int SIGN = 17; | 39 | public static final int SIGN = 17; |
| 40 | //登录 | 40 | //登录 |
| 41 | public static final int LOGIN_SUCESS = 18; | 41 | public static final int LOGIN_SUCESS = 18; |
| 42 | //获取子账户信息 | 42 | //获取子账户信息 |
| 43 | public static final int CHILDS_SUCESS = 19; | 43 | public static final int CHILDS_SUCESS = 19; |
| 44 | //版本升级 | 44 | //版本升级 |
| 45 | public static final int APPUPDATE_SUCESS = 20; | 45 | public static final int APPUPDATE_SUCESS = 20; |
| 46 | //获取出版社 | 46 | //获取出版社 |
| 47 | public static final int VERSION_SUCESS = 22; | 47 | public static final int VERSION_SUCESS = 22; |
| 48 | //注册信息是否完整 | 48 | //注册信息是否完整 |
| 49 | public static final int REGISTER_SUCESS = 23; | 49 | public static final int REGISTER_SUCESS = 23; |
| 50 | //获取默认版本信息 | 50 | //获取默认版本信息 |
| 51 | public static final int PUBLISH_SUCESS = 24; | 51 | public static final int PUBLISH_SUCESS = 24; |
| 52 | //注册信息提交 | 52 | //注册信息提交 |
| 53 | public static final int REGISTERINFO_SUCESS = 25; | 53 | public static final int REGISTERINFO_SUCESS = 25; |
| 54 | //获取视频信息 | 54 | //获取视频信息 |
| 55 | public static final int GETVIDIO_SUCESS = 26; | 55 | public static final int GETVIDIO_SUCESS = 26; |
| 56 | //查询保卡信息1 | 56 | //查询保卡信息1 |
| 57 | public static final int SUCHCARDINFOONE = 27; | 57 | public static final int SUCHCARDINFOONE = 27; |
| 58 | //个人信息 | 58 | //个人信息 |
| 59 | public static final int PESERNAOL = 28; | 59 | public static final int PESERNAOL = 28; |
| 60 | 60 | //touxan | |
| 61 | 61 | public static final int TOUXIANG = 29; | |
| 62 | |||
| 63 | 62 | ||
| 64 | 63 | ||
| 65 | } | 64 | } |
| 66 | 65 |
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.support.v4.app.FragmentActivity; |
| 10 | import android.util.Log; | 10 | import android.util.Log; |
| 11 | import android.view.KeyEvent; | 11 | import android.view.KeyEvent; |
| 12 | import android.widget.Toast; | 12 | import android.widget.Toast; |
| 13 | 13 | ||
| 14 | import com.google.gson.Gson; | 14 | import com.google.gson.Gson; |
| 15 | import com.google.gson.reflect.TypeToken; | 15 | import com.google.gson.reflect.TypeToken; |
| 16 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
| 17 | import com.hjx.personalcenter.activity.BangDingCode; | 17 | import com.hjx.personalcenter.activity.BangDingCode; |
| 18 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 18 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
| 19 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 19 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
| 20 | import com.hjx.personalcenter.customdialog.IllegalDialog; | 20 | import com.hjx.personalcenter.customdialog.IllegalDialog; |
| 21 | import com.hjx.personalcenter.db.Content; | 21 | import com.hjx.personalcenter.db.Content; |
| 22 | import com.hjx.personalcenter.db.SaveParam; | 22 | import com.hjx.personalcenter.db.SaveParam; |
| 23 | import com.hjx.personalcenter.gson.GsonTool; | 23 | import com.hjx.personalcenter.gson.GsonTool; |
| 24 | import com.hjx.personalcenter.model.AppVersion; | 24 | import com.hjx.personalcenter.model.AppVersion; |
| 25 | import com.hjx.personalcenter.model.CardInfo; | 25 | import com.hjx.personalcenter.model.CardInfo; |
| 26 | import com.hjx.personalcenter.model.ChildsInfo; | 26 | import com.hjx.personalcenter.model.ChildsInfo; |
| 27 | import com.hjx.personalcenter.model.CityInfo; | 27 | import com.hjx.personalcenter.model.CityInfo; |
| 28 | import com.hjx.personalcenter.model.CountyInfo; | 28 | import com.hjx.personalcenter.model.CountyInfo; |
| 29 | import com.hjx.personalcenter.model.DefautPublishInfo; | 29 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 30 | import com.hjx.personalcenter.model.GradeInfo; | 30 | import com.hjx.personalcenter.model.GradeInfo; |
| 31 | import com.hjx.personalcenter.model.PesonalInfo; | 31 | import com.hjx.personalcenter.model.PesonalInfo; |
| 32 | import com.hjx.personalcenter.model.ProvinceInfo; | 32 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 33 | import com.hjx.personalcenter.model.SchoolInfo; | 33 | import com.hjx.personalcenter.model.SchoolInfo; |
| 34 | import com.hjx.personalcenter.model.SignInfo; | 34 | import com.hjx.personalcenter.model.SignInfo; |
| 35 | import com.hjx.personalcenter.model.VersionInfo; | 35 | import com.hjx.personalcenter.model.VersionInfo; |
| 36 | import com.hjx.personalcenter.model.VideoInfo; | 36 | import com.hjx.personalcenter.model.VideoInfo; |
| 37 | import com.hjx.personalcenter.util.AlertUtils; | 37 | import com.hjx.personalcenter.util.AlertUtils; |
| 38 | import com.hjx.personalcenter.util.DialogPermission; | 38 | import com.hjx.personalcenter.util.DialogPermission; |
| 39 | import com.loopj.android.http.AsyncHttpResponseHandler; | 39 | import com.loopj.android.http.AsyncHttpResponseHandler; |
| 40 | import com.loopj.android.http.JsonHttpResponseHandler; | 40 | import com.loopj.android.http.JsonHttpResponseHandler; |
| 41 | import com.loopj.android.http.RequestParams; | 41 | import com.loopj.android.http.RequestParams; |
| 42 | 42 | ||
| 43 | import org.apache.http.Header; | 43 | import org.apache.http.Header; |
| 44 | import org.apache.http.entity.ByteArrayEntity; | 44 | import org.apache.http.entity.ByteArrayEntity; |
| 45 | import org.apache.http.message.BasicHeader; | 45 | import org.apache.http.message.BasicHeader; |
| 46 | import org.apache.http.protocol.HTTP; | 46 | import org.apache.http.protocol.HTTP; |
| 47 | import org.json.JSONException; | 47 | import org.json.JSONException; |
| 48 | import org.json.JSONObject; | 48 | import org.json.JSONObject; |
| 49 | 49 | ||
| 50 | import java.io.File; | 50 | import java.io.File; |
| 51 | import java.io.FileNotFoundException; | 51 | import java.io.FileNotFoundException; |
| 52 | import java.io.UnsupportedEncodingException; | 52 | import java.io.UnsupportedEncodingException; |
| 53 | import java.util.ArrayList; | 53 | import java.util.ArrayList; |
| 54 | import java.util.List; | 54 | import java.util.List; |
| 55 | 55 | ||
| 56 | public class HttpManager { | 56 | public class HttpManager { |
| 57 | private static HttpManager instance; | 57 | private static HttpManager instance; |
| 58 | private ProgressDialog mProgress = null; | 58 | private ProgressDialog mProgress = null; |
| 59 | 59 | ||
| 60 | public static HttpManager getInstance() { | 60 | public static HttpManager getInstance() { |
| 61 | if (instance == null) { | 61 | if (instance == null) { |
| 62 | instance = new HttpManager(); | 62 | instance = new HttpManager(); |
| 63 | } | 63 | } |
| 64 | return instance; | 64 | return instance; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | 67 | ||
| 68 | //登录接口 | 68 | //登录接口 |
| 69 | 69 | ||
| 70 | 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) { |
| 71 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 71 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
| 72 | true, true, null); | 72 | true, true, null); |
| 73 | 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"); |
| 74 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 74 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
| 75 | @Override | 75 | @Override |
| 76 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 76 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 77 | closeProgress(); | 77 | closeProgress(); |
| 78 | Message msg = Message.obtain(); | 78 | Message msg = Message.obtain(); |
| 79 | msg.what = HttpCode.LOGIN_SUCESS; | 79 | msg.what = HttpCode.LOGIN_SUCESS; |
| 80 | msg.obj = new String(arg2); | 80 | msg.obj = new String(arg2); |
| 81 | handler.sendMessage(msg); | 81 | handler.sendMessage(msg); |
| 82 | 82 | ||
| 83 | 83 | ||
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | @Override | 86 | @Override |
| 87 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 87 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 88 | closeProgress(); | 88 | closeProgress(); |
| 89 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 89 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 90 | } | 90 | } |
| 91 | }); | 91 | }); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | //注册接口 | 94 | //注册接口 |
| 95 | 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) { |
| 96 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 96 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
| 97 | false, true, null); | 97 | false, true, null); |
| 98 | JSONObject jsonObject = new JSONObject(); | 98 | JSONObject jsonObject = new JSONObject(); |
| 99 | ByteArrayEntity entity = null; | 99 | ByteArrayEntity entity = null; |
| 100 | try { | 100 | try { |
| 101 | jsonObject.put(HttpKey.USERNAME, username); | 101 | jsonObject.put(HttpKey.USERNAME, username); |
| 102 | jsonObject.put(HttpKey.PASSWORD, password); | 102 | jsonObject.put(HttpKey.PASSWORD, password); |
| 103 | jsonObject.put(HttpKey.SMSCODE, smscode); | 103 | jsonObject.put(HttpKey.SMSCODE, smscode); |
| 104 | jsonObject.put(HttpKey.SOURCE, source); | 104 | jsonObject.put(HttpKey.SOURCE, source); |
| 105 | Log.e("test", "jsonObject" + jsonObject); | 105 | Log.e("test", "jsonObject" + jsonObject); |
| 106 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 106 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
| 107 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 107 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
| 108 | } catch (JSONException e) { | 108 | } catch (JSONException e) { |
| 109 | e.printStackTrace(); | 109 | e.printStackTrace(); |
| 110 | } catch (UnsupportedEncodingException e) { | 110 | } catch (UnsupportedEncodingException e) { |
| 111 | e.printStackTrace(); | 111 | e.printStackTrace(); |
| 112 | } | 112 | } |
| 113 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 113 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 114 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 114 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
| 115 | @Override | 115 | @Override |
| 116 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 116 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 117 | super.onSuccess(statusCode, headers, response); | 117 | super.onSuccess(statusCode, headers, response); |
| 118 | closeProgress(); | 118 | closeProgress(); |
| 119 | Log.e("test", "onSuccess" + response); | 119 | Log.e("test", "onSuccess" + response); |
| 120 | Message msg = Message.obtain(); | 120 | Message msg = Message.obtain(); |
| 121 | msg.what = HttpCode.REGISTERED_SUCESS; | 121 | msg.what = HttpCode.REGISTERED_SUCESS; |
| 122 | msg.obj = response; | 122 | msg.obj = response; |
| 123 | handler.sendMessage(msg); | 123 | handler.sendMessage(msg); |
| 124 | 124 | ||
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | @Override | 127 | @Override |
| 128 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 128 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 129 | super.onFailure(statusCode, headers, throwable, errorResponse); | 129 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 130 | closeProgress(); | 130 | closeProgress(); |
| 131 | Log.e("test", "onFailure" + errorResponse); | 131 | Log.e("test", "onFailure" + errorResponse); |
| 132 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 132 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | }); | 135 | }); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | //注册验证码 | 138 | //注册验证码 |
| 139 | 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) { |
| 140 | RequestParams params = new RequestParams(); | 140 | RequestParams params = new RequestParams(); |
| 141 | params.put(HttpKey.TYPE, type); | 141 | params.put(HttpKey.TYPE, type); |
| 142 | params.put(HttpKey.MOBIL, mobile); | 142 | params.put(HttpKey.MOBIL, mobile); |
| 143 | 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"); |
| 144 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 144 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
| 145 | 145 | ||
| 146 | @Override | 146 | @Override |
| 147 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 147 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 148 | Log.e("test", "onSuccess-----" + response); | 148 | Log.e("test", "onSuccess-----" + response); |
| 149 | Message msg = Message.obtain(); | 149 | Message msg = Message.obtain(); |
| 150 | msg.what = HttpCode.AUTHCODE_SUCESS; | 150 | msg.what = HttpCode.AUTHCODE_SUCESS; |
| 151 | msg.obj = response; | 151 | msg.obj = response; |
| 152 | handler.sendMessage(msg); | 152 | handler.sendMessage(msg); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | @Override | 155 | @Override |
| 156 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 156 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 157 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 157 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 158 | } | 158 | } |
| 159 | }); | 159 | }); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | 162 | ||
| 163 | //手机号是否注册 | 163 | //手机号是否注册 |
| 164 | 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) { |
| 165 | RequestParams params = new RequestParams(); | 165 | RequestParams params = new RequestParams(); |
| 166 | params.put(HttpKey.USERNAME, mobile); | 166 | params.put(HttpKey.USERNAME, mobile); |
| 167 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 167 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
| 168 | @Override | 168 | @Override |
| 169 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 169 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 170 | Log.e("test", "isregistered" + response.toString()); | 170 | Log.e("test", "isregistered" + response.toString()); |
| 171 | Message msg = Message.obtain(); | 171 | Message msg = Message.obtain(); |
| 172 | msg.what = HttpCode.IS_REFISTER; | 172 | msg.what = HttpCode.IS_REFISTER; |
| 173 | msg.obj = response; | 173 | msg.obj = response; |
| 174 | handler.sendMessage(msg); | 174 | handler.sendMessage(msg); |
| 175 | 175 | ||
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | @Override | 178 | @Override |
| 179 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 179 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 180 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 180 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 181 | 181 | ||
| 182 | } | 182 | } |
| 183 | }); | 183 | }); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | //修改密码 | 186 | //修改密码 |
| 187 | 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) { |
| 188 | mProgress = DialogPermission.showProgress(context, null, "正在修改密码...", | 188 | mProgress = DialogPermission.showProgress(context, null, "正在修改密码...", |
| 189 | false, true, null); | 189 | false, true, null); |
| 190 | RequestParams params = new RequestParams(); | 190 | RequestParams params = new RequestParams(); |
| 191 | params.put(HttpKey.USERNAME, username); | 191 | params.put(HttpKey.USERNAME, username); |
| 192 | params.put(HttpKey.OLDPASS, old_pwd1); | 192 | params.put(HttpKey.OLDPASS, old_pwd1); |
| 193 | params.put(HttpKey.NEWPASS, newpassword3); | 193 | params.put(HttpKey.NEWPASS, newpassword3); |
| 194 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 194 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 195 | HttpClient.getInstance().setTimeout(10 * 1000); | 195 | HttpClient.getInstance().setTimeout(10 * 1000); |
| 196 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 196 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
| 197 | @Override | 197 | @Override |
| 198 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 198 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 199 | closeProgress(); | 199 | closeProgress(); |
| 200 | try { | 200 | try { |
| 201 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 201 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 202 | String status = jsonObject.optString("status"); | 202 | String status = jsonObject.optString("status"); |
| 203 | if (status.equals("100")) { | 203 | if (status.equals("100")) { |
| 204 | // Log.e("test", "onSuccess" + new String(bytes)); | 204 | // Log.e("test", "onSuccess" + new String(bytes)); |
| 205 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 205 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 206 | SaveParam.getInstance().clearData((Activity) context); | 206 | SaveParam.getInstance().clearData((Activity) context); |
| 207 | Intent intent = new Intent(); | 207 | Intent intent = new Intent(); |
| 208 | intent.setClass(context, LoginAndRegisterActivity.class); | 208 | intent.setClass(context, LoginAndRegisterActivity.class); |
| 209 | ((Activity) context).startActivity(intent); | 209 | ((Activity) context).startActivity(intent); |
| 210 | ((Activity) context).finish(); | 210 | ((Activity) context).finish(); |
| 211 | } else { | 211 | } else { |
| 212 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 212 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
| 213 | } | 213 | } |
| 214 | } catch (JSONException e) { | 214 | } catch (JSONException e) { |
| 215 | e.printStackTrace(); | 215 | e.printStackTrace(); |
| 216 | } | 216 | } |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | @Override | 219 | @Override |
| 220 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 220 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 221 | closeProgress(); | 221 | closeProgress(); |
| 222 | // Log.e("test", "onFailure" + new String(bytes)); | 222 | // Log.e("test", "onFailure" + new String(bytes)); |
| 223 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 223 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 224 | } | 224 | } |
| 225 | }); | 225 | }); |
| 226 | 226 | ||
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | //忘记密码 | 229 | //忘记密码 |
| 230 | 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) { |
| 231 | RequestParams params = new RequestParams(); | 231 | RequestParams params = new RequestParams(); |
| 232 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 232 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
| 233 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 233 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
| 234 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 234 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
| 235 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 235 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 236 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 236 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
| 237 | @Override | 237 | @Override |
| 238 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 238 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 239 | try { | 239 | try { |
| 240 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 240 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 241 | String status = jsonObject.optString("status"); | 241 | String status = jsonObject.optString("status"); |
| 242 | if (status.equals("100")) { | 242 | if (status.equals("100")) { |
| 243 | // Log.e("test", "onSuccess" + new String(bytes)); | 243 | // Log.e("test", "onSuccess" + new String(bytes)); |
| 244 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 244 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 245 | ((Activity) context).finish(); | 245 | ((Activity) context).finish(); |
| 246 | } else { | 246 | } else { |
| 247 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 247 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
| 248 | } | 248 | } |
| 249 | } catch (JSONException e) { | 249 | } catch (JSONException e) { |
| 250 | e.printStackTrace(); | 250 | e.printStackTrace(); |
| 251 | } | 251 | } |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | @Override | 254 | @Override |
| 255 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 255 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 256 | // Log.e("test", "onFailure" + new String(bytes)); | 256 | // Log.e("test", "onFailure" + new String(bytes)); |
| 257 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 257 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 258 | } | 258 | } |
| 259 | }); | 259 | }); |
| 260 | 260 | ||
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | //保存用户登录信息 | 263 | //保存用户登录信息 |
| 264 | 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) { |
| 265 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 265 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
| 266 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 266 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
| 267 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 267 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
| 268 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 268 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
| 269 | 269 | ||
| 270 | 270 | ||
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | //提交保卡信息 | 273 | //提交保卡信息 |
| 274 | 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, |
| 275 | String buyAddress, String buyTime, String alterSaleCall, | 275 | String buyAddress, String buyTime, String alterSaleCall, |
| 276 | String productModel, String deviceNumber, String macAddress, | 276 | String productModel, String deviceNumber, String macAddress, |
| 277 | String mobilePhone) { | 277 | String mobilePhone) { |
| 278 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 278 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
| 279 | false, true, null); | 279 | false, true, null); |
| 280 | RequestParams params = new RequestParams(); | 280 | RequestParams params = new RequestParams(); |
| 281 | 281 | ||
| 282 | params.put(HttpKey.USEID, userId); | 282 | params.put(HttpKey.USEID, userId); |
| 283 | params.put(HttpKey.CUSTOMENAME, customerName); | 283 | params.put(HttpKey.CUSTOMENAME, customerName); |
| 284 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 284 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
| 285 | params.put(HttpKey.BUYADREES, buyAddress); | 285 | params.put(HttpKey.BUYADREES, buyAddress); |
| 286 | params.put(HttpKey.BUYTIME, buyTime); | 286 | params.put(HttpKey.BUYTIME, buyTime); |
| 287 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 287 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
| 288 | params.put(HttpKey.PRODUCTMODEL, productModel); | 288 | params.put(HttpKey.PRODUCTMODEL, productModel); |
| 289 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 289 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
| 290 | params.put(HttpKey.MACADRESS, macAddress); | 290 | params.put(HttpKey.MACADRESS, macAddress); |
| 291 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 291 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
| 292 | 292 | ||
| 293 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 293 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 294 | 294 | ||
| 295 | Log.e("test", "params" + params); | 295 | Log.e("test", "params" + params); |
| 296 | HttpClient.getInstance().setTimeout(5 * 1000); | 296 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 297 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 297 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
| 298 | @Override | 298 | @Override |
| 299 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 299 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 300 | JSONObject jsonObject = null; | 300 | JSONObject jsonObject = null; |
| 301 | closeProgress(); | 301 | closeProgress(); |
| 302 | try { | 302 | try { |
| 303 | jsonObject = new JSONObject(new String(bytes)); | 303 | jsonObject = new JSONObject(new String(bytes)); |
| 304 | String status = jsonObject.optString("status"); | 304 | String status = jsonObject.optString("status"); |
| 305 | if (status.equals("1")) { | 305 | if (status.equals("1")) { |
| 306 | Log.e("test", "onSuccess" + jsonObject); | 306 | Log.e("test", "onSuccess" + jsonObject); |
| 307 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 307 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
| 308 | if (Content.cardintentflag == 1) { | 308 | if (Content.cardintentflag == 1) { |
| 309 | Intent intent = new Intent(); | 309 | Intent intent = new Intent(); |
| 310 | intent.setClass((Activity) context, TheStartPageActivity.class); | 310 | intent.setClass((Activity) context, TheStartPageActivity.class); |
| 311 | ((Activity) context).startActivity(intent); | 311 | ((Activity) context).startActivity(intent); |
| 312 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 312 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 313 | ((Activity) context).finish(); | 313 | ((Activity) context).finish(); |
| 314 | } else if (Content.cardintentflag == 2) { | 314 | } else if (Content.cardintentflag == 2) { |
| 315 | Intent intent = new Intent(); | 315 | Intent intent = new Intent(); |
| 316 | intent.setClass((Activity) context, BangDingCode.class); | 316 | intent.setClass((Activity) context, BangDingCode.class); |
| 317 | ((Activity) context).startActivity(intent); | 317 | ((Activity) context).startActivity(intent); |
| 318 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 318 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 319 | ((Activity) context).finish(); | 319 | ((Activity) context).finish(); |
| 320 | 320 | ||
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | 323 | ||
| 324 | } else if (status.equals("2003")){ | 324 | } else if (status.equals("2003")){ |
| 325 | IllegalDialog.getInstance().show(((FragmentActivity) context).getSupportFragmentManager(),"feifa"); | 325 | IllegalDialog.getInstance().show(((FragmentActivity) context).getSupportFragmentManager(),"feifa"); |
| 326 | 326 | ||
| 327 | }else { | 327 | }else { |
| 328 | SaveParam.getInstance().saveCustomizeParam((FragmentActivity) context,SaveParam.CARDPHONE,""); | ||
| 328 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 329 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
| 329 | } | 330 | } |
| 330 | } catch (JSONException e) { | 331 | } catch (JSONException e) { |
| 331 | e.printStackTrace(); | 332 | e.printStackTrace(); |
| 332 | } | 333 | } |
| 333 | 334 | ||
| 334 | 335 | ||
| 335 | } | 336 | } |
| 336 | 337 | ||
| 337 | @Override | 338 | @Override |
| 338 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 339 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 339 | Log.e("test", "onFailure" + (throwable)); | 340 | Log.e("test", "onFailure" + (throwable)); |
| 340 | closeProgress(); | 341 | closeProgress(); |
| 341 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 342 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 342 | 343 | ||
| 343 | } | 344 | } |
| 344 | }); | 345 | }); |
| 345 | 346 | ||
| 346 | } | 347 | } |
| 347 | 348 | ||
| 348 | //获取保卡信息 | 349 | //获取保卡信息 |
| 349 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { | 350 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { |
| 350 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 351 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
| 351 | false, true, null); | 352 | false, true, null); |
| 352 | HttpClient.getInstance().setTimeout(5 * 1000); | 353 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 353 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 354 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 354 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 355 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 355 | @Override | 356 | @Override |
| 356 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 357 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 357 | closeProgress(); | 358 | closeProgress(); |
| 358 | // Log.e("test", "保卡信息" + new String(arg2)); | 359 | // Log.e("test", "保卡信息" + new String(arg2)); |
| 359 | try { | 360 | try { |
| 360 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 361 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 361 | int status = jsonObject.optInt("status"); | 362 | int status = jsonObject.optInt("status"); |
| 362 | if (status == 1) { | 363 | if (status == 1) { |
| 363 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 364 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
| 364 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 365 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
| 365 | Message msg = Message.obtain(); | 366 | Message msg = Message.obtain(); |
| 366 | msg.what = HttpCode.SUCHCARDINFO; | 367 | msg.what = HttpCode.SUCHCARDINFO; |
| 367 | msg.obj = schoolInfoBeanList; | 368 | msg.obj = schoolInfoBeanList; |
| 368 | handler.sendMessage(msg); | 369 | handler.sendMessage(msg); |
| 369 | 370 | ||
| 370 | 371 | ||
| 371 | } else { | 372 | } else { |
| 372 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 373 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 373 | 374 | ||
| 374 | } | 375 | } |
| 375 | } catch (JSONException e) { | 376 | } catch (JSONException e) { |
| 376 | e.printStackTrace(); | 377 | e.printStackTrace(); |
| 377 | } | 378 | } |
| 378 | 379 | ||
| 379 | } | 380 | } |
| 380 | 381 | ||
| 381 | @Override | 382 | @Override |
| 382 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 383 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 383 | closeProgress(); | 384 | closeProgress(); |
| 384 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 385 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 385 | } | 386 | } |
| 386 | }); | 387 | }); |
| 387 | } | 388 | } |
| 388 | 389 | ||
| 389 | //获取是否为样机信息 | 390 | //获取是否为样机信息 |
| 390 | public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { | 391 | public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { |
| 391 | HttpClient.getInstance().setTimeout(5 * 1000); | 392 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 392 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 393 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 393 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 394 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 394 | @Override | 395 | @Override |
| 395 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 396 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 396 | closeProgress(); | 397 | closeProgress(); |
| 397 | // Log.e("test", "保卡信息" + new String(arg2)); | 398 | // Log.e("test", "保卡信息" + new String(arg2)); |
| 398 | Message msg = Message.obtain(); | 399 | Message msg = Message.obtain(); |
| 399 | msg.what = HttpCode.SUCHCARDINFOONE; | 400 | msg.what = HttpCode.SUCHCARDINFOONE; |
| 400 | msg.obj = new String(arg2); | 401 | msg.obj = new String(arg2); |
| 401 | handler.sendMessage(msg); | 402 | handler.sendMessage(msg); |
| 402 | 403 | ||
| 403 | } | 404 | } |
| 404 | 405 | ||
| 405 | @Override | 406 | @Override |
| 406 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 407 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 407 | closeProgress(); | 408 | closeProgress(); |
| 408 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 409 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 409 | } | 410 | } |
| 410 | }); | 411 | }); |
| 411 | } | 412 | } |
| 412 | 413 | ||
| 413 | //修改账户电话 | 414 | //修改账户电话 |
| 414 | public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { | 415 | public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { |
| 415 | RequestParams params = new RequestParams(); | 416 | RequestParams params = new RequestParams(); |
| 416 | params.put("userId", userId); | 417 | params.put("userId", userId); |
| 417 | params.put("username", username); | 418 | params.put("username", username); |
| 418 | params.put("authCode", authCode); | 419 | params.put("authCode", authCode); |
| 419 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 420 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 420 | HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { | 421 | HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { |
| 421 | @Override | 422 | @Override |
| 422 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 423 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 423 | try { | 424 | try { |
| 424 | // Log.e("test", "保卡信息" + new String(bytes)); | 425 | // Log.e("test", "保卡信息" + new String(bytes)); |
| 425 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 426 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 426 | String status = jsonObject.optString("status"); | 427 | String status = jsonObject.optString("status"); |
| 427 | if (status.equals("1")) { | 428 | if (status.equals("1")) { |
| 428 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 429 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 429 | SaveParam.getInstance().saveLoginParam(mContext, "username", username); | 430 | SaveParam.getInstance().saveLoginParam(mContext, "username", username); |
| 430 | ((Activity) mContext).finish(); | 431 | ((Activity) mContext).finish(); |
| 431 | } else if (status.equals("1001")) { | 432 | } else if (status.equals("1001")) { |
| 432 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 433 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 433 | } | 434 | } |
| 434 | else if (status.equals("1006")) { | 435 | else if (status.equals("1006")) { |
| 435 | AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); | 436 | AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); |
| 436 | } else { | 437 | } else { |
| 437 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 438 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 438 | } | 439 | } |
| 439 | } catch (JSONException e) { | 440 | } catch (JSONException e) { |
| 440 | e.printStackTrace(); | 441 | e.printStackTrace(); |
| 441 | } | 442 | } |
| 442 | } | 443 | } |
| 443 | 444 | ||
| 444 | @Override | 445 | @Override |
| 445 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 446 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 446 | //Log.e("test", "onFailure" + new String(bytes)); | 447 | //Log.e("test", "onFailure" + new String(bytes)); |
| 447 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 448 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 448 | } | 449 | } |
| 449 | }); | 450 | }); |
| 450 | } | 451 | } |
| 451 | 452 | ||
| 452 | //修改保卡信息电话 | 453 | //修改保卡信息电话 |
| 453 | public void changecardinfophone(final Context mContext, String userId, final String customerPhone, String authCode) { | 454 | public void changecardinfophone(final Context mContext, String userId, final String customerPhone, String authCode) { |
| 454 | RequestParams params = new RequestParams(); | 455 | RequestParams params = new RequestParams(); |
| 455 | params.put("deviceNumber", userId); | 456 | params.put("deviceNumber", userId); |
| 456 | params.put("customerPhone", customerPhone); | 457 | params.put("customerPhone", customerPhone); |
| 457 | params.put("authCode", authCode); | 458 | params.put("authCode", authCode); |
| 458 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 459 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 459 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 460 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 460 | @Override | 461 | @Override |
| 461 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 462 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 462 | try { | 463 | try { |
| 463 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 464 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 464 | String status = jsonObject.optString("status"); | 465 | String status = jsonObject.optString("status"); |
| 465 | if (status.equals("1")) { | 466 | if (status.equals("1")) { |
| 466 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 467 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 467 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 468 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
| 468 | ((Activity) mContext).finish(); | 469 | ((Activity) mContext).finish(); |
| 469 | } else if (status.equals("1001")) { | 470 | } else if (status.equals("1001")) { |
| 470 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 471 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 471 | } else { | 472 | } else { |
| 472 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 473 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 473 | } | 474 | } |
| 474 | } catch (JSONException e) { | 475 | } catch (JSONException e) { |
| 475 | e.printStackTrace(); | 476 | e.printStackTrace(); |
| 476 | } | 477 | } |
| 477 | } | 478 | } |
| 478 | 479 | ||
| 479 | @Override | 480 | @Override |
| 480 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 481 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 481 | // Log.e("test", "onFailure" + new String(bytes)); | 482 | // Log.e("test", "onFailure" + new String(bytes)); |
| 482 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 483 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 483 | } | 484 | } |
| 484 | }); | 485 | }); |
| 485 | } | 486 | } |
| 486 | 487 | ||
| 487 | //修改保卡信息地址 | 488 | //修改保卡信息地址 |
| 488 | public void changecardadressinfo(final Context mContext, String userId, final String customerPhone, String authCode, final String customerAddress) { | 489 | public void changecardadressinfo(final Context mContext, String userId, final String customerPhone, String authCode, final String customerAddress) { |
| 489 | RequestParams params = new RequestParams(); | 490 | RequestParams params = new RequestParams(); |
| 490 | params.put("deviceNumber", userId); | 491 | params.put("deviceNumber", userId); |
| 491 | params.put("customerPhone", customerPhone); | 492 | params.put("customerPhone", customerPhone); |
| 492 | params.put("authCode", authCode); | 493 | params.put("authCode", authCode); |
| 493 | params.put("customerAddress", customerAddress); | 494 | params.put("customerAddress", customerAddress); |
| 494 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 495 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 495 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 496 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 496 | @Override | 497 | @Override |
| 497 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 498 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 498 | try { | 499 | try { |
| 499 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 500 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 500 | String status = jsonObject.optString("status"); | 501 | String status = jsonObject.optString("status"); |
| 501 | if (status.equals("1")) { | 502 | if (status.equals("1")) { |
| 502 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); | 503 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); |
| 503 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 504 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
| 504 | ((Activity) mContext).finish(); | 505 | ((Activity) mContext).finish(); |
| 505 | } else if (status.equals("1001")) { | 506 | } else if (status.equals("1001")) { |
| 506 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 507 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 507 | } else { | 508 | } else { |
| 508 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 509 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 509 | } | 510 | } |
| 510 | } catch (JSONException e) { | 511 | } catch (JSONException e) { |
| 511 | e.printStackTrace(); | 512 | e.printStackTrace(); |
| 512 | } | 513 | } |
| 513 | } | 514 | } |
| 514 | 515 | ||
| 515 | @Override | 516 | @Override |
| 516 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 517 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 517 | // Log.e("test", "onFailure" + new String(bytes)); | 518 | // Log.e("test", "onFailure" + new String(bytes)); |
| 518 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 519 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 519 | } | 520 | } |
| 520 | }); | 521 | }); |
| 521 | } | 522 | } |
| 522 | 523 | ||
| 523 | //验证是否保卡信息 | 524 | //验证是否保卡信息 |
| 524 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { | 525 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { |
| 525 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 526 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
| 526 | false, true, null); | 527 | false, true, null); |
| 527 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 528 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 528 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 529 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 529 | @Override | 530 | @Override |
| 530 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 531 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 531 | // Log.e("test", "验证保卡" + new String(arg2)); | 532 | // Log.e("test", "验证保卡" + new String(arg2)); |
| 532 | closeProgress(); | 533 | closeProgress(); |
| 533 | Message msg = Message.obtain(); | 534 | Message msg = Message.obtain(); |
| 534 | msg.what = HttpCode.CHECKCARD; | 535 | msg.what = HttpCode.CHECKCARD; |
| 535 | msg.obj = new String(arg2); | 536 | msg.obj = new String(arg2); |
| 536 | handler.sendMessage(msg); | 537 | handler.sendMessage(msg); |
| 537 | 538 | ||
| 538 | 539 | ||
| 539 | } | 540 | } |
| 540 | 541 | ||
| 541 | @Override | 542 | @Override |
| 542 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 543 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 543 | closeProgress(); | 544 | closeProgress(); |
| 544 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 545 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 545 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 546 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
| 546 | } | 547 | } |
| 547 | }); | 548 | }); |
| 548 | } | 549 | } |
| 549 | 550 | ||
| 550 | ///获取年级 | 551 | ///获取年级 |
| 551 | public void getgrade(final Context mContext, final Handler handler) { | 552 | public void getgrade(final Context mContext, final Handler handler) { |
| 552 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 553 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 553 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 554 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
| 554 | @Override | 555 | @Override |
| 555 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 556 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 556 | // Log.e("test", "年级" + new String(arg2)); | 557 | // Log.e("test", "年级" + new String(arg2)); |
| 557 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 558 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
| 558 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 559 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
| 559 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 560 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
| 560 | String name = gradeInfo.getData().get(i).getName(); | 561 | String name = gradeInfo.getData().get(i).getName(); |
| 561 | int id = gradeInfo.getData().get(i).getId(); | 562 | int id = gradeInfo.getData().get(i).getId(); |
| 562 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 563 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
| 563 | for (int j = 0; j < gradeinfoList.size(); j++) { | 564 | for (int j = 0; j < gradeinfoList.size(); j++) { |
| 564 | String secondname = gradeinfoList.get(j).getName(); | 565 | String secondname = gradeinfoList.get(j).getName(); |
| 565 | int secondid = gradeinfoList.get(j).getId(); | 566 | int secondid = gradeinfoList.get(j).getId(); |
| 566 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 567 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
| 567 | dataBean.setName(secondname); | 568 | dataBean.setName(secondname); |
| 568 | dataBean.setId(secondid); | 569 | dataBean.setId(secondid); |
| 569 | gradeInfoLists.add(dataBean); | 570 | gradeInfoLists.add(dataBean); |
| 570 | } | 571 | } |
| 571 | 572 | ||
| 572 | } | 573 | } |
| 573 | 574 | ||
| 574 | Message message = Message.obtain(); | 575 | Message message = Message.obtain(); |
| 575 | message.what = HttpCode.GRADER; | 576 | message.what = HttpCode.GRADER; |
| 576 | message.obj = gradeInfoLists; | 577 | message.obj = gradeInfoLists; |
| 577 | handler.sendMessage(message); | 578 | handler.sendMessage(message); |
| 578 | 579 | ||
| 579 | 580 | ||
| 580 | } | 581 | } |
| 581 | 582 | ||
| 582 | @Override | 583 | @Override |
| 583 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 584 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 584 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 585 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 585 | } | 586 | } |
| 586 | }); | 587 | }); |
| 587 | } | 588 | } |
| 588 | 589 | ||
| 589 | /** | 590 | /** |
| 590 | * 获取学校 | 591 | * 获取学校 |
| 591 | * | 592 | * |
| 592 | * @param mContext | 593 | * @param mContext |
| 593 | * @param regionId | 594 | * @param regionId |
| 594 | * @param gradeId | 595 | * @param gradeId |
| 595 | * @param handler | 596 | * @param handler |
| 596 | */ | 597 | */ |
| 597 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 598 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
| 598 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 599 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 599 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 600 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
| 600 | @Override | 601 | @Override |
| 601 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 602 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 602 | // Log.e("test", "学校" + new String(arg2)); | 603 | // Log.e("test", "学校" + new String(arg2)); |
| 603 | try { | 604 | try { |
| 604 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 605 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 605 | int status = jsonObject.optInt("status"); | 606 | int status = jsonObject.optInt("status"); |
| 606 | if (status == 1) { | 607 | if (status == 1) { |
| 607 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 608 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
| 608 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 609 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
| 609 | Message message = Message.obtain(); | 610 | Message message = Message.obtain(); |
| 610 | message.what = HttpCode.SCHOOL; | 611 | message.what = HttpCode.SCHOOL; |
| 611 | message.obj = schoolInfoBeanList; | 612 | message.obj = schoolInfoBeanList; |
| 612 | handler.sendMessage(message); | 613 | handler.sendMessage(message); |
| 613 | 614 | ||
| 614 | 615 | ||
| 615 | } else { | 616 | } else { |
| 616 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 617 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 617 | 618 | ||
| 618 | } | 619 | } |
| 619 | } catch (JSONException e) { | 620 | } catch (JSONException e) { |
| 620 | e.printStackTrace(); | 621 | e.printStackTrace(); |
| 621 | } | 622 | } |
| 622 | 623 | ||
| 623 | } | 624 | } |
| 624 | 625 | ||
| 625 | @Override | 626 | @Override |
| 626 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 627 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 627 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 628 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 628 | } | 629 | } |
| 629 | }); | 630 | }); |
| 630 | } | 631 | } |
| 631 | 632 | ||
| 632 | 633 | ||
| 633 | /** | 634 | /** |
| 634 | * 获取个人信息 | 635 | * 获取个人信息 |
| 635 | * | 636 | * |
| 636 | * @param mContext | 637 | * @param mContext |
| 637 | * @param userId | 638 | * @param userId |
| 638 | * @param handler | 639 | * @param handler |
| 639 | */ | 640 | */ |
| 640 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { | 641 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
| 641 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 642 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
| 642 | // false, true, null); | 643 | // false, true, null); |
| 643 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 644 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 644 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 645 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
| 645 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 646 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 646 | @Override | 647 | @Override |
| 647 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 648 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 648 | closeProgress(); | 649 | closeProgress(); |
| 649 | // Log.e("test", "个人信息" + new String(arg2)); | 650 | // Log.e("test", "个人信息" + new String(arg2)); |
| 650 | try { | 651 | try { |
| 651 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 652 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 652 | int status = jsonObject.optInt("status"); | 653 | int status = jsonObject.optInt("status"); |
| 653 | if (status == 1) { | 654 | if (status == 1) { |
| 654 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 655 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
| 655 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 656 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
| 656 | Message message = Message.obtain(); | 657 | Message message = Message.obtain(); |
| 657 | message.what = HttpCode.GETINFO; | 658 | message.what = HttpCode.GETINFO; |
| 658 | message.obj = pesonalInfoBeanList; | 659 | message.obj = pesonalInfoBeanList; |
| 659 | handler.sendMessage(message); | 660 | handler.sendMessage(message); |
| 660 | 661 | ||
| 661 | 662 | ||
| 662 | } else { | 663 | } else { |
| 663 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 664 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 664 | 665 | ||
| 665 | } | 666 | } |
| 666 | } catch (JSONException e) { | 667 | } catch (JSONException e) { |
| 667 | e.printStackTrace(); | 668 | e.printStackTrace(); |
| 668 | } | 669 | } |
| 669 | 670 | ||
| 670 | 671 | ||
| 671 | } | 672 | } |
| 672 | 673 | ||
| 673 | @Override | 674 | @Override |
| 674 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 675 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 675 | closeProgress(); | 676 | closeProgress(); |
| 676 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 677 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 677 | } | 678 | } |
| 678 | }); | 679 | }); |
| 679 | } | 680 | } |
| 680 | 681 | ||
| 681 | //修改个人信息 | 682 | //修改个人信息 |
| 682 | public void changepresonalinfo(final Context mContext, Long id, int type | 683 | public void changepresonalinfo(final Context mContext, Long id, int type |
| 683 | , String name, String birthday, final int gradeId, long regionId, | 684 | , String name, String birthday, final int gradeId, long regionId, |
| 684 | Object schoolId, String qq, String gender | 685 | Object schoolId, String qq, String gender |
| 685 | , String regionName, String address, String devicenumber, final Handler handler) throws UnsupportedEncodingException { | 686 | , String regionName, String address, String devicenumber, final Handler handler) throws UnsupportedEncodingException { |
| 686 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 687 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
| 687 | false, true, null); | 688 | false, true, null); |
| 688 | RequestParams params = new RequestParams(); | 689 | RequestParams params = new RequestParams(); |
| 689 | 690 | ||
| 690 | params.put(HttpKey.USEID, id); | 691 | params.put(HttpKey.USEID, id); |
| 691 | params.put(HttpKey.TYPE, type); | 692 | params.put(HttpKey.TYPE, type); |
| 692 | params.put(HttpKey.NAME, name); | 693 | params.put(HttpKey.NAME, name); |
| 693 | params.put(HttpKey.BIRDays, birthday); | 694 | params.put(HttpKey.BIRDays, birthday); |
| 694 | params.put(HttpKey.GRADE, gradeId); | 695 | params.put(HttpKey.GRADE, gradeId); |
| 695 | params.put(HttpKey.REGION, regionId); | 696 | params.put(HttpKey.REGION, regionId); |
| 696 | params.put(HttpKey.SCHOOL, schoolId); | 697 | params.put(HttpKey.SCHOOL, schoolId); |
| 697 | params.put(HttpKey.QQ, qq); | 698 | params.put(HttpKey.QQ, qq); |
| 698 | params.put(HttpKey.GENDER, gender); | 699 | params.put(HttpKey.GENDER, gender); |
| 699 | params.put(HttpKey.REGIONNAME, regionName); | 700 | params.put(HttpKey.REGIONNAME, regionName); |
| 700 | params.put(HttpKey.ADDDRESS, address); | 701 | params.put(HttpKey.ADDDRESS, address); |
| 701 | params.put(HttpKey.DEVINUMBER, devicenumber); | 702 | params.put(HttpKey.DEVINUMBER, devicenumber); |
| 702 | Log.e("test", "个人信息" + params); | 703 | Log.e("test", "个人信息" + params); |
| 703 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 704 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 704 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { | 705 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { |
| 705 | @Override | 706 | @Override |
| 706 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 707 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 707 | super.onSuccess(statusCode, headers, response); | 708 | super.onSuccess(statusCode, headers, response); |
| 708 | closeProgress(); | 709 | closeProgress(); |
| 709 | String status = response.optString("status"); | 710 | String status = response.optString("status"); |
| 710 | if (status.equals("1")) { | 711 | if (status.equals("1")) { |
| 711 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 712 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
| 712 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.VIEGREADE,gradeId+""); | 713 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.VIEGREADE,gradeId+""); |
| 713 | Message message = Message.obtain(); | 714 | Message message = Message.obtain(); |
| 714 | message.what = HttpCode.PESERNAOL; | 715 | message.what = HttpCode.PESERNAOL; |
| 715 | message.obj = 1; | 716 | message.obj = 1; |
| 716 | handler.sendMessage(message); | 717 | handler.sendMessage(message); |
| 717 | } else { | 718 | } else { |
| 718 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 719 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 719 | } | 720 | } |
| 720 | 721 | ||
| 721 | } | 722 | } |
| 722 | 723 | ||
| 723 | @Override | 724 | @Override |
| 724 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 725 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 725 | super.onFailure(statusCode, headers, throwable, errorResponse); | 726 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 726 | closeProgress(); | 727 | closeProgress(); |
| 727 | Log.e("test", "onFailure" + errorResponse); | 728 | Log.e("test", "onFailure" + errorResponse); |
| 728 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 729 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 729 | } | 730 | } |
| 730 | 731 | ||
| 731 | }); | 732 | }); |
| 732 | } | 733 | } |
| 733 | 734 | ||
| 734 | //提交注册信息 | 735 | //提交注册信息 |
| 735 | public void subregisterinfo(final Context mContext, Long userId | 736 | public void subregisterinfo(final Context mContext, Long userId |
| 736 | , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese, | 737 | , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese, |
| 737 | String math, String english, String physics, String chemistry, | 738 | String math, String english, String physics, String chemistry, |
| 738 | String history, String geography, String political, String biology, String science, final Handler handler) { | 739 | String history, String geography, String political, String biology, String science, final Handler handler) { |
| 739 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 740 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
| 740 | false, true, null); | 741 | false, true, null); |
| 741 | RequestParams params = new RequestParams(); | 742 | RequestParams params = new RequestParams(); |
| 742 | 743 | ||
| 743 | params.put(HttpKey.USEID, userId); | 744 | params.put(HttpKey.USEID, userId); |
| 744 | params.put(HttpKey.NAME, name); | 745 | params.put(HttpKey.NAME, name); |
| 745 | params.put(HttpKey.GRADE, gradeId); | 746 | params.put(HttpKey.GRADE, gradeId); |
| 746 | params.put(HttpKey.REGION, regionId); | 747 | params.put(HttpKey.REGION, regionId); |
| 747 | params.put(HttpKey.SCHOOL, schoolId); | 748 | params.put(HttpKey.SCHOOL, schoolId); |
| 748 | params.put(HttpKey.REGIONNAME, regionName); | 749 | params.put(HttpKey.REGIONNAME, regionName); |
| 749 | params.put(HttpKey.MATH, math); | 750 | params.put(HttpKey.MATH, math); |
| 750 | params.put(HttpKey.ENGLISH, english); | 751 | params.put(HttpKey.ENGLISH, english); |
| 751 | params.put(HttpKey.CHINESE, chinese); | 752 | params.put(HttpKey.CHINESE, chinese); |
| 752 | params.put(HttpKey.PHYSICES, physics); | 753 | params.put(HttpKey.PHYSICES, physics); |
| 753 | params.put(HttpKey.CHEMISTRY, chemistry); | 754 | params.put(HttpKey.CHEMISTRY, chemistry); |
| 754 | params.put(HttpKey.HISTIRY, history); | 755 | params.put(HttpKey.HISTIRY, history); |
| 755 | params.put(HttpKey.GEOGRAPHY, geography); | 756 | params.put(HttpKey.GEOGRAPHY, geography); |
| 756 | params.put(HttpKey.POLITICAL, political); | 757 | params.put(HttpKey.POLITICAL, political); |
| 757 | params.put(HttpKey.BIOLOGY, biology); | 758 | params.put(HttpKey.BIOLOGY, biology); |
| 758 | params.put(HttpKey.SCIENCE, science); | 759 | params.put(HttpKey.SCIENCE, science); |
| 759 | 760 | ||
| 760 | Log.e("test", "注册信息" + params); | 761 | Log.e("test", "注册信息" + params); |
| 761 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 762 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 762 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { | 763 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { |
| 763 | @Override | 764 | @Override |
| 764 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 765 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 765 | super.onSuccess(statusCode, headers, response); | 766 | super.onSuccess(statusCode, headers, response); |
| 766 | closeProgress(); | 767 | closeProgress(); |
| 767 | Message message = Message.obtain(); | 768 | Message message = Message.obtain(); |
| 768 | message.what = HttpCode.REGISTERINFO_SUCESS; | 769 | message.what = HttpCode.REGISTERINFO_SUCESS; |
| 769 | message.obj = new String(String.valueOf(response)); | 770 | message.obj = new String(String.valueOf(response)); |
| 770 | handler.sendMessage(message); | 771 | handler.sendMessage(message); |
| 771 | 772 | ||
| 772 | } | 773 | } |
| 773 | 774 | ||
| 774 | @Override | 775 | @Override |
| 775 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 776 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 776 | super.onFailure(statusCode, headers, throwable, errorResponse); | 777 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 777 | closeProgress(); | 778 | closeProgress(); |
| 778 | Log.e("test", "onFailure" + errorResponse); | 779 | Log.e("test", "onFailure" + errorResponse); |
| 779 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 780 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 780 | } | 781 | } |
| 781 | 782 | ||
| 782 | }); | 783 | }); |
| 783 | } | 784 | } |
| 784 | 785 | ||
| 785 | //修改版本信息 | 786 | //修改版本信息 |
| 786 | public void changepublishinfo(final Context mContext, String userId, String chinese, | 787 | public void changepublishinfo(final Context mContext, String userId, String chinese, |
| 787 | String math, String english, String physics, String chemistry, | 788 | String math, String english, String physics, String chemistry, |
| 788 | String history, String geography, String political, String biology, String science) { | 789 | String history, String geography, String political, String biology, String science) { |
| 789 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存版本信息...", | 790 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存版本信息...", |
| 790 | false, true, null); | 791 | false, true, null); |
| 791 | RequestParams params = new RequestParams(); | 792 | RequestParams params = new RequestParams(); |
| 792 | params.put(HttpKey.USEID, userId); | 793 | params.put(HttpKey.USEID, userId); |
| 793 | params.put(HttpKey.CHINESE, chinese); | 794 | params.put(HttpKey.CHINESE, chinese); |
| 794 | params.put(HttpKey.MATH, math); | 795 | params.put(HttpKey.MATH, math); |
| 795 | params.put(HttpKey.ENGLISH, english); | 796 | params.put(HttpKey.ENGLISH, english); |
| 796 | params.put(HttpKey.PHYSICES, physics); | 797 | params.put(HttpKey.PHYSICES, physics); |
| 797 | params.put(HttpKey.CHEMISTRY, chemistry); | 798 | params.put(HttpKey.CHEMISTRY, chemistry); |
| 798 | params.put(HttpKey.HISTIRY, history); | 799 | params.put(HttpKey.HISTIRY, history); |
| 799 | params.put(HttpKey.GEOGRAPHY, geography); | 800 | params.put(HttpKey.GEOGRAPHY, geography); |
| 800 | params.put(HttpKey.POLITICAL, political); | 801 | params.put(HttpKey.POLITICAL, political); |
| 801 | params.put(HttpKey.BIOLOGY, biology); | 802 | params.put(HttpKey.BIOLOGY, biology); |
| 802 | params.put(HttpKey.SCIENCE, science); | 803 | params.put(HttpKey.SCIENCE, science); |
| 803 | 804 | ||
| 804 | Log.e("test", "版本信息信息" + params); | 805 | Log.e("test", "版本信息信息" + params); |
| 805 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 806 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 806 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { | 807 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { |
| 807 | @Override | 808 | @Override |
| 808 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 809 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 809 | super.onSuccess(statusCode, headers, response); | 810 | super.onSuccess(statusCode, headers, response); |
| 810 | closeProgress(); | 811 | closeProgress(); |
| 811 | String status = response.optString("status"); | 812 | String status = response.optString("status"); |
| 812 | if (status.equals("1")) { | 813 | if (status.equals("1")) { |
| 813 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); | 814 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); |
| 814 | ((Activity) mContext).finish(); | 815 | ((Activity) mContext).finish(); |
| 815 | } else { | 816 | } else { |
| 816 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 817 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 817 | } | 818 | } |
| 818 | 819 | ||
| 819 | } | 820 | } |
| 820 | 821 | ||
| 821 | @Override | 822 | @Override |
| 822 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 823 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 823 | super.onFailure(statusCode, headers, throwable, errorResponse); | 824 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 824 | closeProgress(); | 825 | closeProgress(); |
| 825 | Log.e("test", "onFailure" + errorResponse); | 826 | Log.e("test", "onFailure" + errorResponse); |
| 826 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 827 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 827 | } | 828 | } |
| 828 | 829 | ||
| 829 | }); | 830 | }); |
| 830 | } | 831 | } |
| 831 | 832 | ||
| 832 | //修改个性签名 | 833 | //修改个性签名 |
| 833 | public void changsignature(final Context mContext, Object userId, int type, final String signature) { | 834 | public void changsignature(final Context mContext, Object userId, int type, final String signature) { |
| 834 | RequestParams params = new RequestParams(); | 835 | RequestParams params = new RequestParams(); |
| 835 | params.put("userId", userId); | 836 | params.put("userId", userId); |
| 836 | params.put("type", type); | 837 | params.put("type", type); |
| 837 | params.put("signature", signature); | 838 | params.put("signature", signature); |
| 838 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 839 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 839 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 840 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
| 840 | @Override | 841 | @Override |
| 841 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 842 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 842 | try { | 843 | try { |
| 843 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 844 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 844 | String status = jsonObject.optString("status"); | 845 | String status = jsonObject.optString("status"); |
| 845 | if (status.equals("1")) { | 846 | if (status.equals("1")) { |
| 846 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 847 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
| 847 | } else { | 848 | } else { |
| 848 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 849 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 849 | } | 850 | } |
| 850 | } catch (JSONException e) { | 851 | } catch (JSONException e) { |
| 851 | e.printStackTrace(); | 852 | e.printStackTrace(); |
| 852 | } | 853 | } |
| 853 | } | 854 | } |
| 854 | 855 | ||
| 855 | @Override | 856 | @Override |
| 856 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 857 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 857 | //Log.e("test", "onFailure" + new String(bytes)); | 858 | //Log.e("test", "onFailure" + new String(bytes)); |
| 858 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 859 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 859 | } | 860 | } |
| 860 | }); | 861 | }); |
| 861 | } | 862 | } |
| 862 | 863 | ||
| 863 | /** | 864 | /** |
| 864 | * 获取个性签名 | 865 | * 获取个性签名 |
| 865 | * | 866 | * |
| 866 | * @param mContext | 867 | * @param mContext |
| 867 | * @param userId | 868 | * @param userId |
| 868 | * @param handler | 869 | * @param handler |
| 869 | */ | 870 | */ |
| 870 | public void getsignatures(final Context mContext, Object userId, int type, final Handler handler) { | 871 | public void getsignatures(final Context mContext, Object userId, int type, final Handler handler) { |
| 871 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 872 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 872 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 873 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 873 | @Override | 874 | @Override |
| 874 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 875 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 875 | // Log.e("test", "个性签名" + new String(arg2)); | 876 | // Log.e("test", "个性签名" + new String(arg2)); |
| 876 | try { | 877 | try { |
| 877 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 878 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 878 | int status = jsonObject.optInt("status"); | 879 | int status = jsonObject.optInt("status"); |
| 879 | if (status == 1) { | 880 | if (status == 1) { |
| 880 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 881 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
| 881 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 882 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
| 882 | Message message = Message.obtain(); | 883 | Message message = Message.obtain(); |
| 883 | message.what = HttpCode.SIGN; | 884 | message.what = HttpCode.SIGN; |
| 884 | message.obj = signInfoBeanList; | 885 | message.obj = signInfoBeanList; |
| 885 | handler.sendMessage(message); | 886 | handler.sendMessage(message); |
| 886 | 887 | ||
| 887 | 888 | ||
| 888 | } else if (status == 1000) { | 889 | } else if (status == 1000) { |
| 889 | //AlertUtils.showToast(mContext, "您还没有签名哦"); | 890 | //AlertUtils.showToast(mContext, "您还没有签名哦"); |
| 890 | 891 | ||
| 891 | } else { | 892 | } else { |
| 892 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 893 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 893 | } | 894 | } |
| 894 | } catch (JSONException e) { | 895 | } catch (JSONException e) { |
| 895 | e.printStackTrace(); | 896 | e.printStackTrace(); |
| 896 | } | 897 | } |
| 897 | 898 | ||
| 898 | 899 | ||
| 899 | } | 900 | } |
| 900 | 901 | ||
| 901 | @Override | 902 | @Override |
| 902 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 903 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 903 | //Log.e("test", "失败原因" + arg3); | 904 | //Log.e("test", "失败原因" + arg3); |
| 904 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 905 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 905 | } | 906 | } |
| 906 | }); | 907 | }); |
| 907 | } | 908 | } |
| 908 | 909 | ||
| 909 | /** | 910 | /** |
| 910 | * 用户反馈 | 911 | * 用户反馈 |
| 911 | * | 912 | * |
| 912 | * @param mContext | 913 | * @param mContext |
| 913 | * @param userId | 914 | * @param userId |
| 914 | * @param content | 915 | * @param content |
| 915 | * @param contact | 916 | * @param contact |
| 916 | * @param imgs | 917 | * @param imgs |
| 917 | * @param feedtype | 918 | * @param feedtype |
| 918 | * @throws UnsupportedEncodingException | 919 | * @throws UnsupportedEncodingException |
| 919 | */ | 920 | */ |
| 920 | public void feedback(final Context mContext, String userId, String content, | 921 | public void feedback(final Context mContext, String userId, String content, |
| 921 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { | 922 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { |
| 922 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 923 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
| 923 | false, true, null); | 924 | false, true, null); |
| 924 | File file = new File(imgs); | 925 | File file = new File(imgs); |
| 925 | RequestParams params = new RequestParams(); | 926 | RequestParams params = new RequestParams(); |
| 926 | try { | 927 | try { |
| 927 | params.put("userId", userId); | 928 | params.put("userId", userId); |
| 928 | params.put("content", content); | 929 | params.put("content", content); |
| 929 | params.put("contact", contact); | 930 | params.put("contact", contact); |
| 930 | if (file.exists() && file.length() > 0) { | 931 | if (file.exists() && file.length() > 0) { |
| 931 | params.put("imgs", file); | 932 | params.put("imgs", file); |
| 932 | } | 933 | } |
| 933 | params.put("feedtype", feedtype); | 934 | params.put("feedtype", feedtype); |
| 934 | } catch (FileNotFoundException e) { | 935 | } catch (FileNotFoundException e) { |
| 935 | e.printStackTrace(); | 936 | e.printStackTrace(); |
| 936 | } | 937 | } |
| 937 | Log.e("test", "onSuccess" + params); | 938 | Log.e("test", "onSuccess" + params); |
| 938 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { | 939 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { |
| 939 | @Override | 940 | @Override |
| 940 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 941 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 941 | closeProgress(); | 942 | closeProgress(); |
| 942 | // Log.e("test", "onSuccess" + new String(bytes)); | 943 | // Log.e("test", "onSuccess" + new String(bytes)); |
| 943 | try { | 944 | try { |
| 944 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 945 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 945 | String status = jsonObject.optString("status"); | 946 | String status = jsonObject.optString("status"); |
| 946 | if (status.equals("1")) { | 947 | if (status.equals("1")) { |
| 947 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); | 948 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); |
| 948 | ((Activity) mContext).finish(); | 949 | ((Activity) mContext).finish(); |
| 949 | } else { | 950 | } else { |
| 950 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 951 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 951 | } | 952 | } |
| 952 | } catch (JSONException e) { | 953 | } catch (JSONException e) { |
| 953 | e.printStackTrace(); | 954 | e.printStackTrace(); |
| 954 | } | 955 | } |
| 955 | } | 956 | } |
| 956 | 957 | ||
| 957 | @Override | 958 | @Override |
| 958 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 959 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 959 | closeProgress(); | 960 | closeProgress(); |
| 960 | //Log.e("test", "错误信息" + new String(bytes)); | 961 | //Log.e("test", "错误信息" + new String(bytes)); |
| 961 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 962 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 962 | 963 | ||
| 963 | } | 964 | } |
| 964 | }); | 965 | }); |
| 965 | 966 | ||
| 966 | } | 967 | } |
| 967 | 968 | ||
| 968 | /** | 969 | /** |
| 969 | * 查询子账户信息 | 970 | * 查询子账户信息 |
| 970 | * | 971 | * |
| 971 | * @param mContext | 972 | * @param mContext |
| 972 | * @param userId | 973 | * @param userId |
| 973 | * @param handler | 974 | * @param handler |
| 974 | */ | 975 | */ |
| 975 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { | 976 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { |
| 976 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", | 977 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", |
| 977 | false, true, null); | 978 | false, true, null); |
| 978 | 979 | ||
| 979 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); | 980 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); |
| 980 | HttpClient.getInstance().setTimeout(5 * 1000); | 981 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 981 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 982 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 982 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 983 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 983 | @Override | 984 | @Override |
| 984 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 985 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 985 | closeProgress(); | 986 | closeProgress(); |
| 986 | Log.e("test", "子账户信息" + new String(arg2)); | 987 | Log.e("test", "子账户信息" + new String(arg2)); |
| 987 | try { | 988 | try { |
| 988 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 989 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 989 | int status = jsonObject.optInt("status"); | 990 | int status = jsonObject.optInt("status"); |
| 990 | if (status == 1) { | 991 | if (status == 1) { |
| 991 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 992 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
| 992 | Log.e("test", "子账户信息" + childsInfo); | 993 | Log.e("test", "子账户信息" + childsInfo); |
| 993 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 994 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
| 994 | Log.e("test", "子账户信息" + schoolInfoBeanList); | 995 | Log.e("test", "子账户信息" + schoolInfoBeanList); |
| 995 | Message msg = Message.obtain(); | 996 | Message msg = Message.obtain(); |
| 996 | msg.what = HttpCode.CHILDS_SUCESS; | 997 | msg.what = HttpCode.CHILDS_SUCESS; |
| 997 | msg.obj = schoolInfoBeanList; | 998 | msg.obj = schoolInfoBeanList; |
| 998 | handler.sendMessage(msg); | 999 | handler.sendMessage(msg); |
| 999 | 1000 | ||
| 1000 | } else { | 1001 | } else { |
| 1001 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 1002 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
| 1002 | 1003 | ||
| 1003 | } | 1004 | } |
| 1004 | } catch (JSONException e) { | 1005 | } catch (JSONException e) { |
| 1005 | e.printStackTrace(); | 1006 | e.printStackTrace(); |
| 1006 | 1007 | ||
| 1007 | } | 1008 | } |
| 1008 | 1009 | ||
| 1009 | } | 1010 | } |
| 1010 | 1011 | ||
| 1011 | @Override | 1012 | @Override |
| 1012 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1013 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1013 | closeProgress(); | 1014 | closeProgress(); |
| 1014 | // Log.e("test", "错误信息" + new String(arg2)); | 1015 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1015 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1016 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1016 | } | 1017 | } |
| 1017 | }); | 1018 | }); |
| 1018 | 1019 | ||
| 1019 | } | 1020 | } |
| 1020 | 1021 | ||
| 1021 | /** | 1022 | /** |
| 1022 | * 删除子账户信息 | 1023 | * 删除子账户信息 |
| 1023 | * | 1024 | * |
| 1024 | * @param mContext | 1025 | * @param mContext |
| 1025 | * @param subAccountId | 1026 | * @param subAccountId |
| 1026 | */ | 1027 | */ |
| 1027 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { | 1028 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { |
| 1028 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 1029 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
| 1029 | false, true, null); | 1030 | false, true, null); |
| 1030 | HttpClient.getInstance().setTimeout(5 * 1000); | 1031 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1031 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1032 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1032 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 1033 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
| 1033 | @Override | 1034 | @Override |
| 1034 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1035 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1035 | closeProgress(); | 1036 | closeProgress(); |
| 1036 | // Log.e("test", "子账户信息" + new String(arg2)); | 1037 | // Log.e("test", "子账户信息" + new String(arg2)); |
| 1037 | try { | 1038 | try { |
| 1038 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1039 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1039 | int status = jsonObject.optInt("status"); | 1040 | int status = jsonObject.optInt("status"); |
| 1040 | if (status == 1) { | 1041 | if (status == 1) { |
| 1041 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 1042 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
| 1042 | ((Activity) mContext).finish(); | 1043 | ((Activity) mContext).finish(); |
| 1043 | } else { | 1044 | } else { |
| 1044 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 1045 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
| 1045 | 1046 | ||
| 1046 | } | 1047 | } |
| 1047 | } catch (JSONException e) { | 1048 | } catch (JSONException e) { |
| 1048 | e.printStackTrace(); | 1049 | e.printStackTrace(); |
| 1049 | } | 1050 | } |
| 1050 | 1051 | ||
| 1051 | } | 1052 | } |
| 1052 | 1053 | ||
| 1053 | @Override | 1054 | @Override |
| 1054 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1055 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1055 | closeProgress(); | 1056 | closeProgress(); |
| 1056 | // Log.e("test", "错误信息" + new String(arg2)); | 1057 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1057 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1058 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1058 | } | 1059 | } |
| 1059 | }); | 1060 | }); |
| 1060 | 1061 | ||
| 1061 | } | 1062 | } |
| 1062 | 1063 | ||
| 1063 | /** | 1064 | /** |
| 1064 | * 添加子账户信息 | 1065 | * 添加子账户信息 |
| 1065 | */ | 1066 | */ |
| 1066 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 1067 | public void addchildAccountinfo(final Context mContext, long parentId, String image, |
| 1067 | String name, final Long grade, Object school, Long region | 1068 | String name, final Long grade, Object school, Long region |
| 1068 | , String deviceNumber, String regionName) { | 1069 | , String deviceNumber, String regionName) { |
| 1069 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 1070 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
| 1070 | false, true, null); | 1071 | false, true, null); |
| 1071 | RequestParams params = new RequestParams(); | 1072 | RequestParams params = new RequestParams(); |
| 1072 | 1073 | ||
| 1073 | params.put(HttpKey.PARENTID, parentId); | 1074 | params.put(HttpKey.PARENTID, parentId); |
| 1074 | params.put(HttpKey.IMAGE, image); | 1075 | params.put(HttpKey.IMAGE, image); |
| 1075 | params.put(HttpKey.NAME, name); | 1076 | params.put(HttpKey.NAME, name); |
| 1076 | params.put(HttpKey.GRADE, grade); | 1077 | params.put(HttpKey.GRADE, grade); |
| 1077 | params.put(HttpKey.SCHOOL, school); | 1078 | params.put(HttpKey.SCHOOL, school); |
| 1078 | params.put(HttpKey.REGION, region); | 1079 | params.put(HttpKey.REGION, region); |
| 1079 | params.put(HttpKey.DEVINUMBER, deviceNumber); | 1080 | params.put(HttpKey.DEVINUMBER, deviceNumber); |
| 1080 | params.put(HttpKey.REGIONNAME, regionName); | 1081 | params.put(HttpKey.REGIONNAME, regionName); |
| 1081 | 1082 | ||
| 1082 | Log.e("test", "子账户信息" + params); | 1083 | Log.e("test", "子账户信息" + params); |
| 1083 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1084 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 1084 | HttpClient.getInstance().setTimeout(5 * 1000); | 1085 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1085 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1086 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1086 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 1087 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
| 1087 | @Override | 1088 | @Override |
| 1088 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1089 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1089 | closeProgress(); | 1090 | closeProgress(); |
| 1090 | 1091 | ||
| 1091 | Log.e("test", "子账户信息" + new String(arg2)); | 1092 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1092 | try { | 1093 | try { |
| 1093 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1094 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1094 | int status = jsonObject.optInt("status"); | 1095 | int status = jsonObject.optInt("status"); |
| 1095 | if (status == 1) { | 1096 | if (status == 1) { |
| 1096 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1097 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
| 1097 | ((Activity) mContext).finish(); | 1098 | ((Activity) mContext).finish(); |
| 1098 | } else { | 1099 | } else { |
| 1099 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1100 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
| 1100 | 1101 | ||
| 1101 | } | 1102 | } |
| 1102 | } catch (JSONException e) { | 1103 | } catch (JSONException e) { |
| 1103 | e.printStackTrace(); | 1104 | e.printStackTrace(); |
| 1104 | } | 1105 | } |
| 1105 | 1106 | ||
| 1106 | } | 1107 | } |
| 1107 | 1108 | ||
| 1108 | @Override | 1109 | @Override |
| 1109 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1110 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1110 | closeProgress(); | 1111 | closeProgress(); |
| 1111 | // Log.e("test", "错误信息" + new String(arg2)); | 1112 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1112 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1113 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1113 | } | 1114 | } |
| 1114 | }); | 1115 | }); |
| 1115 | 1116 | ||
| 1116 | } | 1117 | } |
| 1117 | 1118 | ||
| 1118 | /** | 1119 | /** |
| 1119 | * 切换子账户信息 | 1120 | * 切换子账户信息 |
| 1120 | * | 1121 | * |
| 1121 | * @param mContext | 1122 | * @param mContext |
| 1122 | * @param subAccountId | 1123 | * @param subAccountId |
| 1123 | */ | 1124 | */ |
| 1124 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId | 1125 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId |
| 1125 | , String deviceNumber, int type) { | 1126 | , String deviceNumber, int type) { |
| 1126 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1127 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
| 1127 | false, true, null); | 1128 | false, true, null); |
| 1128 | HttpClient.getInstance().setTimeout(5 * 1000); | 1129 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1129 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1130 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1130 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId | 1131 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId |
| 1131 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { | 1132 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1132 | @Override | 1133 | @Override |
| 1133 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1134 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1134 | closeProgress(); | 1135 | closeProgress(); |
| 1135 | // Log.e("test", "子账户信息" + new String(arg2)); | 1136 | // Log.e("test", "子账户信息" + new String(arg2)); |
| 1136 | try { | 1137 | try { |
| 1137 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1138 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1138 | int status = jsonObject.optInt("status"); | 1139 | int status = jsonObject.optInt("status"); |
| 1139 | if (status == 1) { | 1140 | if (status == 1) { |
| 1140 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1141 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
| 1141 | ((Activity) mContext).finish(); | 1142 | ((Activity) mContext).finish(); |
| 1142 | 1143 | ||
| 1143 | } else { | 1144 | } else { |
| 1144 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1145 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
| 1145 | 1146 | ||
| 1146 | } | 1147 | } |
| 1147 | } catch (JSONException e) { | 1148 | } catch (JSONException e) { |
| 1148 | e.printStackTrace(); | 1149 | e.printStackTrace(); |
| 1149 | } | 1150 | } |
| 1150 | 1151 | ||
| 1151 | } | 1152 | } |
| 1152 | 1153 | ||
| 1153 | @Override | 1154 | @Override |
| 1154 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1155 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1155 | closeProgress(); | 1156 | closeProgress(); |
| 1156 | //Log.e("test", "错误信息" + new String(arg2)); | 1157 | //Log.e("test", "错误信息" + new String(arg2)); |
| 1157 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1158 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1158 | } | 1159 | } |
| 1159 | }); | 1160 | }); |
| 1160 | 1161 | ||
| 1161 | } | 1162 | } |
| 1162 | 1163 | ||
| 1163 | /** | 1164 | /** |
| 1164 | * 切换主账户信息 | 1165 | * 切换主账户信息 |
| 1165 | * | 1166 | * |
| 1166 | * @param mContext | 1167 | * @param mContext |
| 1167 | * @param type | 1168 | * @param type |
| 1168 | */ | 1169 | */ |
| 1169 | public void Accountinfo(final Context mContext, long userId | 1170 | public void Accountinfo(final Context mContext, long userId |
| 1170 | , String deviceNumber, int type) { | 1171 | , String deviceNumber, int type) { |
| 1171 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", | 1172 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", |
| 1172 | false, true, null); | 1173 | false, true, null); |
| 1173 | HttpClient.getInstance().setTimeout(5 * 1000); | 1174 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1174 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1175 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1175 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber | 1176 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber |
| 1176 | + "&type=" + type, new AsyncHttpResponseHandler() { | 1177 | + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1177 | @Override | 1178 | @Override |
| 1178 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1179 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1179 | closeProgress(); | 1180 | closeProgress(); |
| 1180 | // Log.e("test", "子账户信息" + new String(arg2)); | 1181 | // Log.e("test", "子账户信息" + new String(arg2)); |
| 1181 | try { | 1182 | try { |
| 1182 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1183 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1183 | int status = jsonObject.optInt("status"); | 1184 | int status = jsonObject.optInt("status"); |
| 1184 | if (status == 1) { | 1185 | if (status == 1) { |
| 1185 | AlertUtils.showToast(mContext, "主账号切换成功!"); | 1186 | AlertUtils.showToast(mContext, "主账号切换成功!"); |
| 1186 | ((Activity) mContext).finish(); | 1187 | ((Activity) mContext).finish(); |
| 1187 | 1188 | ||
| 1188 | } else { | 1189 | } else { |
| 1189 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); | 1190 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); |
| 1190 | 1191 | ||
| 1191 | } | 1192 | } |
| 1192 | } catch (JSONException e) { | 1193 | } catch (JSONException e) { |
| 1193 | e.printStackTrace(); | 1194 | e.printStackTrace(); |
| 1194 | } | 1195 | } |
| 1195 | 1196 | ||
| 1196 | } | 1197 | } |
| 1197 | 1198 | ||
| 1198 | @Override | 1199 | @Override |
| 1199 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1200 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1200 | closeProgress(); | 1201 | closeProgress(); |
| 1201 | // Log.e("test", "错误信息" + new String(arg2)); | 1202 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1202 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1203 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1203 | } | 1204 | } |
| 1204 | }); | 1205 | }); |
| 1205 | 1206 | ||
| 1206 | } | 1207 | } |
| 1207 | 1208 | ||
| 1208 | /** | 1209 | /** |
| 1209 | * 头像拍张 | 1210 | * 头像拍张 |
| 1210 | * | 1211 | * |
| 1211 | * @param mContext | 1212 | * @param mContext |
| 1212 | * @param userId | 1213 | * @param userId |
| 1213 | * @param img | 1214 | * @param img |
| 1214 | * @throws UnsupportedEncodingException | 1215 | * @throws UnsupportedEncodingException |
| 1215 | */ | 1216 | */ |
| 1216 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { | 1217 | public void header(final Context mContext, String userId, String type, String img, final Handler handler) throws UnsupportedEncodingException { |
| 1218 | |||
| 1217 | File file = new File(img); | 1219 | File file = new File(img); |
| 1218 | if (file.exists() && file.length() > 0) { | 1220 | if (file.exists() && file.length() > 0) { |
| 1219 | RequestParams params = new RequestParams(); | 1221 | RequestParams params = new RequestParams(); |
| 1220 | try { | 1222 | try { |
| 1221 | params.put("userId", userId); | 1223 | params.put("userId", userId); |
| 1222 | params.put("type", type); | 1224 | params.put("type", type); |
| 1223 | params.put("img", file); | 1225 | params.put("img", file); |
| 1224 | } catch (FileNotFoundException e) { | 1226 | } catch (FileNotFoundException e) { |
| 1225 | e.printStackTrace(); | 1227 | e.printStackTrace(); |
| 1226 | } | 1228 | } |
| 1227 | Log.e("test", "params" + params); | 1229 | Log.e("test", "params" + params); |
| 1228 | HttpClient.getInstance().setTimeout(5 * 1000); | 1230 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1229 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { | 1231 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { |
| 1230 | @Override | 1232 | @Override |
| 1231 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1233 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 1232 | // Log.e("test", "onSuccess" + new String(bytes)); | 1234 | // Log.e("test", "onSuccess" + new String(bytes)); |
| 1233 | try { | 1235 | try { |
| 1234 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1236 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 1235 | String status = jsonObject.optString("status"); | 1237 | String status = jsonObject.optString("status"); |
| 1236 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); | 1238 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); |
| 1237 | String imagUrl = jsonObject1.optString("imgUrl"); | 1239 | String imagUrl = jsonObject1.optString("imgUrl"); |
| 1238 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); | 1240 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); |
| 1239 | if (status.equals("1")) { | 1241 | if (status.equals("1")) { |
| 1240 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1242 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
| 1241 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); | 1243 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); |
| 1244 | Message msg = Message.obtain(); | ||
| 1245 | msg.what = HttpCode.TOUXIANG; | ||
| 1246 | msg.obj = status; | ||
| 1247 | handler.sendMessage(msg); | ||
| 1242 | } else { | 1248 | } else { |
| 1243 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1249 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 1244 | } | 1250 | } |
| 1245 | } catch (JSONException e) { | 1251 | } catch (JSONException e) { |
| 1246 | e.printStackTrace(); | 1252 | e.printStackTrace(); |
| 1247 | } | 1253 | } |
| 1248 | } | 1254 | } |
| 1249 | 1255 | ||
| 1250 | @Override | 1256 | @Override |
| 1251 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1257 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 1252 | closeProgress(); | 1258 | closeProgress(); |
| 1253 | // Log.e("test", "错误信息" + new String(bytes)); | 1259 | // Log.e("test", "错误信息" + new String(bytes)); |
| 1254 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1260 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1255 | 1261 | ||
| 1256 | } | 1262 | } |
| 1257 | }); | 1263 | }); |
| 1258 | } else { | 1264 | } else { |
| 1259 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 1265 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); |
| 1260 | } | 1266 | } |
| 1261 | } | 1267 | } |
| 1262 | 1268 | ||
| 1263 | /** | 1269 | /** |
| 1264 | * 头像默认 | 1270 | * 头像默认 |
| 1265 | * | 1271 | * |
| 1266 | * @param mContext | 1272 | * @param mContext |
| 1267 | * @param userId | 1273 | * @param userId |
| 1268 | * @param | 1274 | * @param |
| 1269 | * @throws UnsupportedEncodingException | 1275 | * @throws UnsupportedEncodingException |
| 1270 | */ | 1276 | */ |
| 1271 | public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { | 1277 | public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { |
| 1272 | RequestParams params = new RequestParams(); | 1278 | RequestParams params = new RequestParams(); |
| 1273 | params.put("userId", userId); | 1279 | params.put("userId", userId); |
| 1274 | params.put("type", type); | 1280 | params.put("type", type); |
| 1275 | params.put("defaultImg", defaultImg); | 1281 | params.put("defaultImg", defaultImg); |
| 1276 | Log.e("test", "params" + params); | 1282 | Log.e("test", "params" + params); |
| 1277 | HttpClient.getInstance().setTimeout(5 * 1000); | 1283 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1278 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { | 1284 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { |
| 1279 | @Override | 1285 | @Override |
| 1280 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1286 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 1281 | //Log.e("test", "onSuccess" + new String(bytes)); | 1287 | //Log.e("test", "onSuccess" + new String(bytes)); |
| 1282 | try { | 1288 | try { |
| 1283 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1289 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 1284 | String status = jsonObject.optString("status"); | 1290 | String status = jsonObject.optString("status"); |
| 1285 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); | 1291 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); |
| 1286 | String imagUrl = jsonObject1.optString("imgUrl"); | 1292 | String imagUrl = jsonObject1.optString("imgUrl"); |
| 1287 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); | 1293 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); |
| 1288 | if (status.equals("1")) { | 1294 | if (status.equals("1")) { |
| 1289 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1295 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
| 1290 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); | 1296 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); |
| 1291 | } else { | 1297 | } else { |
| 1292 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1298 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 1293 | } | 1299 | } |
| 1294 | } catch (JSONException e) { | 1300 | } catch (JSONException e) { |
| 1295 | e.printStackTrace(); | 1301 | e.printStackTrace(); |
| 1296 | } | 1302 | } |
| 1297 | } | 1303 | } |
| 1298 | 1304 | ||
| 1299 | @Override | 1305 | @Override |
| 1300 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1306 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 1301 | closeProgress(); | 1307 | closeProgress(); |
| 1302 | //.e("test", "错误信息" + new String(bytes)); | 1308 | //.e("test", "错误信息" + new String(bytes)); |
| 1303 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1309 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1304 | 1310 | ||
| 1305 | } | 1311 | } |
| 1306 | }); | 1312 | }); |
| 1307 | } | 1313 | } |
| 1308 | 1314 | ||
| 1309 | /** | 1315 | /** |
| 1310 | * 检查注册信息是否完整 | 1316 | * 检查注册信息是否完整 |
| 1311 | * | 1317 | * |
| 1312 | * @param mContext | 1318 | * @param mContext |
| 1313 | * @param userId | 1319 | * @param userId |
| 1314 | */ | 1320 | */ |
| 1315 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { | 1321 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { |
| 1316 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", | 1322 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", |
| 1317 | false, true, null); | 1323 | false, true, null); |
| 1318 | HttpClient.getInstance().setTimeout(5 * 1000); | 1324 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1319 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1325 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1320 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1326 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 1321 | @Override | 1327 | @Override |
| 1322 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1328 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1323 | closeProgress(); | 1329 | closeProgress(); |
| 1324 | //Log.e("test", "注册信息" + new String(arg2)); | 1330 | //Log.e("test", "注册信息" + new String(arg2)); |
| 1325 | Message msg = Message.obtain(); | 1331 | Message msg = Message.obtain(); |
| 1326 | msg.what = HttpCode.REGISTER_SUCESS; | 1332 | msg.what = HttpCode.REGISTER_SUCESS; |
| 1327 | msg.obj = new String(arg2); | 1333 | msg.obj = new String(arg2); |
| 1328 | handler.sendMessage(msg); | 1334 | handler.sendMessage(msg); |
| 1329 | 1335 | ||
| 1330 | } | 1336 | } |
| 1331 | 1337 | ||
| 1332 | @Override | 1338 | @Override |
| 1333 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1339 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1334 | closeProgress(); | 1340 | closeProgress(); |
| 1335 | // Log.e("test", "错误信息" + new String(arg2)); | 1341 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1336 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1342 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1337 | 1343 | ||
| 1338 | } | 1344 | } |
| 1339 | }); | 1345 | }); |
| 1340 | 1346 | ||
| 1341 | } | 1347 | } |
| 1342 | 1348 | ||
| 1343 | /** | 1349 | /** |
| 1344 | * 获取最近学习视频 | 1350 | * 获取最近学习视频 |
| 1345 | * | 1351 | * |
| 1346 | * @param mContext | 1352 | * @param mContext |
| 1347 | * @param userId | 1353 | * @param userId |
| 1348 | */ | 1354 | */ |
| 1349 | public void getstuyvidioinfo(final Context mContext, Object userId, final Handler handler) { | 1355 | public void getstuyvidioinfo(final Context mContext, Object userId, final Handler handler) { |
| 1350 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", | 1356 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", |
| 1351 | false, true, null); | 1357 | false, true, null); |
| 1352 | HttpClient.getInstance().setTimeout(5 * 1000); | 1358 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1353 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1359 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1354 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1360 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 1355 | @Override | 1361 | @Override |
| 1356 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1362 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1357 | closeProgress(); | 1363 | closeProgress(); |
| 1358 | //Log.e("test", "近学习视频" + new String(arg2)); | 1364 | //Log.e("test", "近学习视频" + new String(arg2)); |
| 1359 | try { | 1365 | try { |
| 1360 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1366 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1361 | int status = jsonObject.optInt("status"); | 1367 | int status = jsonObject.optInt("status"); |
| 1362 | if (status == 1) { | 1368 | if (status == 1) { |
| 1363 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 | 1369 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 |
| 1364 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); | 1370 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); |
| 1365 | Message msg = Message.obtain(); | 1371 | Message msg = Message.obtain(); |
| 1366 | msg.what = HttpCode.GETVIDIO_SUCESS; | 1372 | msg.what = HttpCode.GETVIDIO_SUCESS; |
| 1367 | msg.obj = schoolInfoBeanList; | 1373 | msg.obj = schoolInfoBeanList; |
| 1368 | handler.sendMessage(msg); | 1374 | handler.sendMessage(msg); |
| 1369 | 1375 | ||
| 1370 | } else if (status == 1000){ | 1376 | } else if (status == 1000){ |
| 1371 | //AlertUtils.showToast(mContext, "暂无最近学习视频!"); | 1377 | //AlertUtils.showToast(mContext, "暂无最近学习视频!"); |
| 1372 | 1378 | ||
| 1373 | }else { | 1379 | }else { |
| 1374 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1380 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1375 | } | 1381 | } |
| 1376 | } catch (JSONException e) { | 1382 | } catch (JSONException e) { |
| 1377 | e.printStackTrace(); | 1383 | e.printStackTrace(); |
| 1378 | 1384 | ||
| 1379 | } | 1385 | } |
| 1380 | 1386 | ||
| 1381 | } | 1387 | } |
| 1382 | 1388 | ||
| 1383 | @Override | 1389 | @Override |
| 1384 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1390 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1385 | closeProgress(); | 1391 | closeProgress(); |
| 1386 | // Log.e("test", "错误信息" + new String(arg2)); | 1392 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1387 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1393 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1388 | 1394 | ||
| 1389 | } | 1395 | } |
| 1390 | }); | 1396 | }); |
| 1391 | 1397 | ||
| 1392 | } | 1398 | } |
| 1393 | 1399 | ||
| 1394 | 1400 | ||
| 1395 | /** | 1401 | /** |
| 1396 | * 系统升级 | 1402 | * 系统升级 |
| 1397 | * | 1403 | * |
| 1398 | * @param mContext | 1404 | * @param mContext |
| 1399 | * @param pid appName | 1405 | * @param pid appName |
| 1400 | */ | 1406 | */ |
| 1401 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1407 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
| 1402 | // mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", | 1408 | // mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", |
| 1403 | // false, true, null); | 1409 | // false, true, null); |
| 1404 | HttpClient.getInstance().setTimeout(5 * 1000); | 1410 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1405 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1411 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1406 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1412 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
| 1407 | @Override | 1413 | @Override |
| 1408 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1414 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1409 | //closeProgress(); | 1415 | //closeProgress(); |
| 1410 | // Log.e("test", "版本升级信息" + new String(arg2)); | 1416 | // Log.e("test", "版本升级信息" + new String(arg2)); |
| 1411 | Gson gson = new Gson(); | 1417 | Gson gson = new Gson(); |
| 1412 | List<AppVersion> applist = gson.fromJson(new String(arg2), | 1418 | List<AppVersion> applist = gson.fromJson(new String(arg2), |
| 1413 | new TypeToken<List<AppVersion>>() {}.getType()); | 1419 | new TypeToken<List<AppVersion>>() {}.getType()); |
| 1414 | Log.e("test", "版本升级信息" + applist); | 1420 | Log.e("test", "版本升级信息" + applist); |
| 1415 | Message msg = Message.obtain(); | 1421 | Message msg = Message.obtain(); |
| 1416 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1422 | msg.what = HttpCode.APPUPDATE_SUCESS; |
| 1417 | msg.obj = applist; | 1423 | msg.obj = applist; |
| 1418 | handler.sendMessage(msg); | 1424 | handler.sendMessage(msg); |
| 1419 | 1425 | ||
| 1420 | 1426 | ||
| 1421 | 1427 | ||
| 1422 | } | 1428 | } |
| 1423 | 1429 | ||
| 1424 | @Override | 1430 | @Override |
| 1425 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1431 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1426 | //closeProgress(); | 1432 | //closeProgress(); |
| 1427 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1433 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1428 | } | 1434 | } |
| 1429 | }); | 1435 | }); |
| 1430 | 1436 | ||
| 1431 | } | 1437 | } |
| 1432 | 1438 | ||
| 1433 | //版本信息 | 1439 | //版本信息 |
| 1434 | public void versioninfo(final Context mContext, String subjectName, final Handler handler) { | 1440 | public void versioninfo(final Context mContext, String subjectName, final Handler handler) { |
| 1435 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1441 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1436 | HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { | 1442 | HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { |
| 1437 | @Override | 1443 | @Override |
| 1438 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1444 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1439 | //Log.e("test", "版本信息" + new String(arg2)); | 1445 | //Log.e("test", "版本信息" + new String(arg2)); |
| 1440 | try { | 1446 | try { |
| 1441 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1447 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1442 | int status = jsonObject.optInt("status"); | 1448 | int status = jsonObject.optInt("status"); |
| 1443 | if (status == 1) { | 1449 | if (status == 1) { |
| 1444 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 | 1450 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 |
| 1445 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); | 1451 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); |
| 1446 | Message message = Message.obtain(); | 1452 | Message message = Message.obtain(); |
| 1447 | message.what = HttpCode.VERSION_SUCESS; | 1453 | message.what = HttpCode.VERSION_SUCESS; |
| 1448 | message.obj = versionInfoList; | 1454 | message.obj = versionInfoList; |
| 1449 | handler.sendMessage(message); | 1455 | handler.sendMessage(message); |
| 1450 | 1456 | ||
| 1451 | } else if (status == 1000) { | 1457 | } else if (status == 1000) { |
| 1452 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); | 1458 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); |
| 1453 | 1459 | ||
| 1454 | } else { | 1460 | } else { |
| 1455 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1461 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1456 | } | 1462 | } |
| 1457 | } catch (JSONException e) { | 1463 | } catch (JSONException e) { |
| 1458 | e.printStackTrace(); | 1464 | e.printStackTrace(); |
| 1459 | } | 1465 | } |
| 1460 | 1466 | ||
| 1461 | 1467 | ||
| 1462 | } | 1468 | } |
| 1463 | 1469 | ||
| 1464 | @Override | 1470 | @Override |
| 1465 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1471 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1466 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1472 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1467 | } | 1473 | } |
| 1468 | }); | 1474 | }); |
| 1469 | } | 1475 | } |
| 1470 | 1476 | ||
| 1471 | 1477 | ||
| 1472 | ///省级接口 | 1478 | ///省级接口 |
| 1473 | public void provices(final Context mContext, final Handler handler) { | 1479 | public void provices(final Context mContext, final Handler handler) { |
| 1474 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1480 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1475 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1481 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
| 1476 | @Override | 1482 | @Override |
| 1477 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1483 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1478 | // Log.e("test", "省" + new String(arg2)); | 1484 | // Log.e("test", "省" + new String(arg2)); |
| 1479 | try { | 1485 | try { |
| 1480 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1486 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1481 | int status = jsonObject.optInt("status"); | 1487 | int status = jsonObject.optInt("status"); |
| 1482 | if (status == 100) { | 1488 | if (status == 100) { |
| 1483 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1489 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
| 1484 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1490 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
| 1485 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1491 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
| 1486 | Message message = Message.obtain(); | 1492 | Message message = Message.obtain(); |
| 1487 | message.what = HttpCode.PROVICES; | 1493 | message.what = HttpCode.PROVICES; |
| 1488 | message.obj = provincesBeanList; | 1494 | message.obj = provincesBeanList; |
| 1489 | handler.sendMessage(message); | 1495 | handler.sendMessage(message); |
| 1490 | 1496 | ||
| 1491 | 1497 | ||
| 1492 | } else { | 1498 | } else { |
| 1493 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1499 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1494 | 1500 | ||
| 1495 | } | 1501 | } |
| 1496 | } catch (JSONException e) { | 1502 | } catch (JSONException e) { |
| 1497 | e.printStackTrace(); | 1503 | e.printStackTrace(); |
| 1498 | } | 1504 | } |
| 1499 | 1505 | ||
| 1500 | 1506 | ||
| 1501 | } | 1507 | } |
| 1502 | 1508 | ||
| 1503 | @Override | 1509 | @Override |
| 1504 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1510 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1505 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1511 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1506 | } | 1512 | } |
| 1507 | }); | 1513 | }); |
| 1508 | } | 1514 | } |
| 1509 | 1515 | ||
| 1510 | //获取版本信息接口 | 1516 | //获取版本信息接口 |
| 1511 | public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { | 1517 | public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { |
| 1512 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1518 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1513 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { | 1519 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1514 | @Override | 1520 | @Override |
| 1515 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1521 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1516 | // Log.e("test", "获取版本信息接口" + new String(arg2)); | 1522 | // Log.e("test", "获取版本信息接口" + new String(arg2)); |
| 1517 | try { | 1523 | try { |
| 1518 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1524 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1519 | int status = jsonObject.optInt("status"); | 1525 | int status = jsonObject.optInt("status"); |
| 1520 | if (status == 1) { | 1526 | if (status == 1) { |
| 1521 | Gson gson = new Gson(); | 1527 | Gson gson = new Gson(); |
| 1522 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); | 1528 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); |
| 1523 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); | 1529 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); |
| 1524 | Message message = Message.obtain(); | 1530 | Message message = Message.obtain(); |
| 1525 | message.what = HttpCode.PUBLISH_SUCESS; | 1531 | message.what = HttpCode.PUBLISH_SUCESS; |
| 1526 | message.obj = defautPublishInfoBeanList; | 1532 | message.obj = defautPublishInfoBeanList; |
| 1527 | handler.sendMessage(message); | 1533 | handler.sendMessage(message); |
| 1528 | 1534 | ||
| 1529 | } else { | 1535 | } else { |
| 1530 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1536 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1531 | 1537 | ||
| 1532 | } | 1538 | } |
| 1533 | } catch (JSONException e) { | 1539 | } catch (JSONException e) { |
| 1534 | e.printStackTrace(); | 1540 | e.printStackTrace(); |
| 1535 | } | 1541 | } |
| 1536 | 1542 | ||
| 1537 | 1543 | ||
| 1538 | } | 1544 | } |
| 1539 | 1545 | ||
| 1540 | @Override | 1546 | @Override |
| 1541 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1547 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1542 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1548 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1543 | } | 1549 | } |
| 1544 | }); | 1550 | }); |
| 1545 | } | 1551 | } |
| 1546 | 1552 | ||
| 1547 | 1553 | ||
| 1548 | //市级接口 | 1554 | //市级接口 |
| 1549 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1555 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
| 1550 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1556 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1551 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1557 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
| 1552 | @Override | 1558 | @Override |
| 1553 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1559 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1554 | // Log.e("test", "市" + new String(arg2)); | 1560 | // Log.e("test", "市" + new String(arg2)); |
| 1555 | try { | 1561 | try { |
| 1556 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1562 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1557 | int status = jsonObject.optInt("status"); | 1563 | int status = jsonObject.optInt("status"); |
| 1558 | if (status == 100) { | 1564 | if (status == 100) { |
| 1559 | Gson gson = new Gson(); | 1565 | Gson gson = new Gson(); |
| 1560 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1566 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
| 1561 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1567 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
| 1562 | Message message = Message.obtain(); | 1568 | Message message = Message.obtain(); |
| 1563 | message.what = HttpCode.CITYS; | 1569 | message.what = HttpCode.CITYS; |
| 1564 | message.obj = cityInfoBeanList; | 1570 | message.obj = cityInfoBeanList; |
| 1565 | handler.sendMessage(message); | 1571 | handler.sendMessage(message); |
| 1566 | 1572 | ||
| 1567 | } else { | 1573 | } else { |
| 1568 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1574 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1569 | 1575 | ||
| 1570 | } | 1576 | } |
| 1571 | } catch (JSONException e) { | 1577 | } catch (JSONException e) { |
| 1572 | e.printStackTrace(); | 1578 | e.printStackTrace(); |
| 1573 | } | 1579 | } |
| 1574 | 1580 | ||
| 1575 | 1581 | ||
| 1576 | } | 1582 | } |
| 1577 | 1583 | ||
| 1578 | @Override | 1584 | @Override |
| 1579 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1585 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1580 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1586 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1581 | } | 1587 | } |
| 1582 | }); | 1588 | }); |
| 1583 | } | 1589 | } |
| 1584 | 1590 | ||
| 1585 | //区县级接口 | 1591 | //区县级接口 |
| 1586 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1592 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
| 1587 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1593 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1588 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1594 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
| 1589 | @Override | 1595 | @Override |
| 1590 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1596 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1591 | // Log.e("test", "区" + new String(arg2)); | 1597 | // Log.e("test", "区" + new String(arg2)); |
| 1592 | try { | 1598 | try { |
| 1593 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1599 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1594 | int status = jsonObject.optInt("status"); | 1600 | int status = jsonObject.optInt("status"); |
| 1595 | if (status == 100) { | 1601 | if (status == 100) { |
| 1596 | Gson gson = new Gson(); | 1602 | Gson gson = new Gson(); |
| 1597 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1603 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
| 1598 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1604 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
| 1599 | Message message = Message.obtain(); | 1605 | Message message = Message.obtain(); |
| 1600 | message.what = HttpCode.COUNTRY; | 1606 | message.what = HttpCode.COUNTRY; |
| 1601 | message.obj = countyInfoInfoBeanList; | 1607 | message.obj = countyInfoInfoBeanList; |
| 1602 | handler.sendMessage(message); | 1608 | handler.sendMessage(message); |
| 1603 | } else { | 1609 | } else { |
| 1604 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1610 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1605 | 1611 | ||
| 1606 | } | 1612 | } |
| 1607 | } catch (JSONException e) { | 1613 | } catch (JSONException e) { |
| 1608 | e.printStackTrace(); | 1614 | e.printStackTrace(); |
| 1609 | } | 1615 | } |
| 1610 | 1616 | ||
| 1611 | 1617 | ||
| 1612 | } | 1618 | } |
| 1613 | 1619 | ||
| 1614 | @Override | 1620 | @Override |
| 1615 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1621 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1616 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1622 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1617 | } | 1623 | } |
| 1618 | }); | 1624 | }); |
| 1619 | } | 1625 | } |
| 1620 | 1626 | ||
| 1621 | 1627 | ||
| 1622 | private void closeProgress() { | 1628 | private void closeProgress() { |
| 1623 | try { | 1629 | try { |
| 1624 | if (mProgress != null) { | 1630 | if (mProgress != null) { |
| 1625 | mProgress.dismiss(); | 1631 | mProgress.dismiss(); |
| 1626 | mProgress = null; | 1632 | mProgress = null; |
| 1627 | } | 1633 | } |
| 1628 | } catch (Exception e) { | 1634 | } catch (Exception e) { |
| 1629 | e.printStackTrace(); | 1635 | e.printStackTrace(); |
| 1630 | } | 1636 | } |
| 1631 | } | 1637 | } |
| 1632 | 1638 | ||
| 1633 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 1639 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| 1634 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 1640 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 1635 | 1641 | ||
| 1636 | HttpManager.getInstance().closeProgress(); | 1642 | HttpManager.getInstance().closeProgress(); |
| 1637 | } | 1643 | } |
| 1638 | 1644 | ||
| 1639 | return false; | 1645 | return false; |
| 1640 | 1646 | ||
| 1641 | } | 1647 | } |
| 1642 | 1648 | ||
| 1643 | } | 1649 | } |
| 1644 | 1650 |
PersonalCenter/app/src/main/res/layout/activity_account_management.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
| 6 | android: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="wrap_content" | 12 | android:layout_height="wrap_content" |
| 13 | android:background="@color/login_text_blue" | 13 | android:background="@color/login_text_blue" |
| 14 | android:minHeight="50dp"> | 14 | android:minHeight="50dp"> |
| 15 | 15 | ||
| 16 | <ImageView | 16 | <ImageView |
| 17 | android:id="@+id/cancel" | 17 | android:id="@+id/cancel" |
| 18 | android:layout_width="wrap_content" | 18 | android:layout_width="wrap_content" |
| 19 | android:layout_height="wrap_content" | 19 | android:layout_height="wrap_content" |
| 20 | android:layout_centerVertical="true" | 20 | android:layout_centerVertical="true" |
| 21 | android:paddingLeft="20dp" | 21 | android:paddingLeft="20dp" |
| 22 | android:paddingRight="20dp" | 22 | android:paddingRight="20dp" |
| 23 | android:src="@mipmap/title_back" /> | 23 | android:src="@mipmap/title_back" /> |
| 24 | 24 | ||
| 25 | <TextView | 25 | <TextView |
| 26 | android:id="@+id/menu_title" | 26 | android:id="@+id/menu_title" |
| 27 | android:layout_width="wrap_content" | 27 | android:layout_width="wrap_content" |
| 28 | android:layout_height="wrap_content" | 28 | android:layout_height="wrap_content" |
| 29 | android:layout_centerInParent="true" | 29 | android:layout_centerInParent="true" |
| 30 | android:text="@string/account_management" | 30 | android:text="@string/account_management" |
| 31 | android:textColor="@android:color/white" | 31 | android:textColor="@android:color/white" |
| 32 | android:textSize="22sp" /> | 32 | android:textSize="22sp" /> |
| 33 | </RelativeLayout> | 33 | </RelativeLayout> |
| 34 | 34 | ||
| 35 | <LinearLayout | 35 | <LinearLayout |
| 36 | android:layout_width="wrap_content" | 36 | android:layout_width="wrap_content" |
| 37 | android:layout_height="wrap_content" | 37 | android:layout_height="wrap_content" |
| 38 | android:layout_margin="20dp" | 38 | android:layout_margin="20dp" |
| 39 | android:gravity="center_vertical" | 39 | android:gravity="center_vertical" |
| 40 | android:orientation="horizontal"> | 40 | android:orientation="horizontal"> |
| 41 | 41 | ||
| 42 | <View | 42 | <View |
| 43 | android:layout_width="5dp" | 43 | android:layout_width="5dp" |
| 44 | android:layout_height="20dp" | 44 | android:layout_height="20dp" |
| 45 | android:background="@color/login_text_blue"> | 45 | android:background="@color/login_text_blue"> |
| 46 | 46 | ||
| 47 | </View> | 47 | </View> |
| 48 | 48 | ||
| 49 | <TextView | 49 | <TextView |
| 50 | android:layout_width="wrap_content" | 50 | android:layout_width="wrap_content" |
| 51 | android:layout_height="wrap_content" | 51 | android:layout_height="wrap_content" |
| 52 | android:layout_marginLeft="5dp" | 52 | android:layout_marginLeft="5dp" |
| 53 | android:text="账户安全" | 53 | android:text="账户安全" |
| 54 | android:textSize="22sp" /> | 54 | android:textSize="22sp" /> |
| 55 | 55 | ||
| 56 | </LinearLayout> | 56 | </LinearLayout> |
| 57 | 57 | ||
| 58 | <LinearLayout | 58 | <LinearLayout |
| 59 | android:layout_width="match_parent" | 59 | android:layout_width="match_parent" |
| 60 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
| 61 | android:layout_marginLeft="60dp" | 61 | android:layout_marginLeft="60dp" |
| 62 | android:orientation="vertical"> | 62 | android:orientation="vertical"> |
| 63 | 63 | ||
| 64 | <LinearLayout | 64 | <LinearLayout |
| 65 | android:layout_width="match_parent" | 65 | android:layout_width="match_parent" |
| 66 | android:layout_height="wrap_content"> | 66 | android:layout_height="wrap_content"> |
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | <TextView | 69 | <TextView |
| 70 | android:layout_width="0dp" | 70 | android:layout_width="0dp" |
| 71 | android:layout_height="wrap_content" | 71 | android:layout_height="wrap_content" |
| 72 | android:layout_weight="1.5" | 72 | android:layout_weight="1.5" |
| 73 | android:text="当前绑定手机号" | 73 | android:text="当前绑定手机号" |
| 74 | android:textSize="22sp" /> | 74 | android:textSize="22sp" /> |
| 75 | 75 | ||
| 76 | <TextView | 76 | <TextView |
| 77 | android:id="@+id/cunt_username" | 77 | android:id="@+id/cunt_username" |
| 78 | android:layout_width="0dp" | 78 | android:layout_width="0dp" |
| 79 | android:layout_height="wrap_content" | 79 | android:layout_height="wrap_content" |
| 80 | android:layout_marginLeft="50dp" | 80 | android:layout_marginLeft="50dp" |
| 81 | android:layout_weight="6" | 81 | android:layout_weight="6" |
| 82 | android:text="" | 82 | android:text="" |
| 83 | android:textSize="22sp" /> | 83 | android:textSize="22sp" /> |
| 84 | 84 | ||
| 85 | <TextView | 85 | <TextView |
| 86 | android:id="@+id/changBangding" | 86 | android:id="@+id/changBangding" |
| 87 | android:layout_width="0dp" | 87 | android:layout_width="0dp" |
| 88 | android:layout_height="wrap_content" | 88 | android:layout_height="wrap_content" |
| 89 | android:layout_weight="1" | 89 | android:layout_weight="1" |
| 90 | android:text="更换绑定" | 90 | android:background="@drawable/blue_btn_bg_pressed" |
| 91 | android:gravity="center" | 91 | android:gravity="center" |
| 92 | android:text="更换绑定" | ||
| 92 | android:textColor="@color/white" | 93 | android:textColor="@color/white" |
| 93 | android:background="@drawable/blue_btn_bg_pressed" | ||
| 94 | android:textSize="22sp" /> | 94 | android:textSize="22sp" /> |
| 95 | 95 | ||
| 96 | <ImageView | 96 | <ImageView |
| 97 | android:layout_width="wrap_content" | 97 | android:layout_width="wrap_content" |
| 98 | android:layout_height="wrap_content" | 98 | android:layout_height="wrap_content" |
| 99 | android:layout_weight="0.1" | 99 | android:layout_weight="0.1" |
| 100 | android:padding="10dp" | 100 | android:padding="10dp" |
| 101 | android:src="@mipmap/youjiantou" /> | 101 | android:src="@mipmap/youjiantou" /> |
| 102 | </LinearLayout> | 102 | </LinearLayout> |
| 103 | 103 | ||
| 104 | <LinearLayout | 104 | <LinearLayout |
| 105 | android:layout_width="match_parent" | 105 | android:layout_width="match_parent" |
| 106 | android:layout_height="wrap_content" | 106 | android:layout_height="wrap_content" |
| 107 | android:layout_marginTop="30dp"> | 107 | android:layout_marginTop="30dp"> |
| 108 | 108 | ||
| 109 | 109 | ||
| 110 | <TextView | 110 | <TextView |
| 111 | android:layout_width="0dp" | 111 | android:layout_width="0dp" |
| 112 | android:layout_height="wrap_content" | 112 | android:layout_height="wrap_content" |
| 113 | android:layout_weight="1.5" | 113 | android:layout_weight="1.5" |
| 114 | android:text="登录密码" | 114 | android:text="登录密码" |
| 115 | android:textSize="22sp" /> | 115 | android:textSize="22sp" /> |
| 116 | 116 | ||
| 117 | <TextView | 117 | <TextView |
| 118 | android:layout_width="0dp" | 118 | android:layout_width="0dp" |
| 119 | android:layout_height="wrap_content" | 119 | android:layout_height="wrap_content" |
| 120 | android:layout_marginLeft="50dp" | 120 | android:layout_marginLeft="50dp" |
| 121 | android:layout_weight="6" | 121 | android:layout_weight="6" |
| 122 | android:text="已设置" | 122 | android:text="已设置" |
| 123 | android:textSize="22sp" /> | 123 | android:textSize="22sp" /> |
| 124 | 124 | ||
| 125 | <TextView | 125 | <TextView |
| 126 | android:id="@+id/changpassword" | 126 | android:id="@+id/changpassword" |
| 127 | android:layout_width="0dp" | 127 | android:layout_width="0dp" |
| 128 | android:layout_height="wrap_content" | 128 | android:layout_height="wrap_content" |
| 129 | android:layout_weight="1" | 129 | android:layout_weight="1" |
| 130 | android:text="修改密码" | 130 | android:background="@drawable/blue_btn_bg_pressed" |
| 131 | android:gravity="center" | 131 | android:gravity="center" |
| 132 | android:text="修改密码" | ||
| 132 | android:textColor="@color/white" | 133 | android:textColor="@color/white" |
| 133 | android:background="@drawable/blue_btn_bg_pressed" | ||
| 134 | android:textSize="22sp" /> | 134 | android:textSize="22sp" /> |
| 135 | 135 | ||
| 136 | <ImageView | 136 | <ImageView |
| 137 | android:layout_width="wrap_content" | 137 | android:layout_width="wrap_content" |
| 138 | android:layout_height="wrap_content" | 138 | android:layout_height="wrap_content" |
| 139 | android:layout_weight="0.1" | 139 | android:layout_weight="0.1" |
| 140 | android:padding="10dp" | 140 | android:padding="10dp" |
| 141 | android:src="@mipmap/youjiantou" /> | 141 | android:src="@mipmap/youjiantou" /> |
| 142 | </LinearLayout> | 142 | </LinearLayout> |
| 143 | 143 | ||
| 144 | </LinearLayout> | 144 | </LinearLayout> |
| 145 | 145 | ||
| 146 | <View | 146 | <View |
| 147 | android:layout_width="match_parent" | 147 | android:layout_width="match_parent" |
| 148 | android:layout_height="0.7dp" | 148 | android:layout_height="0.7dp" |
| 149 | android:layout_margin="20dp" | 149 | android:layout_margin="20dp" |
| 150 | android:background="#FF909090" /> | 150 | android:background="#FF909090" /> |
| 151 | 151 | ||
| 152 | <LinearLayout | 152 | <LinearLayout |
| 153 | android:layout_width="wrap_content" | 153 | android:layout_width="wrap_content" |
| 154 | android:layout_height="wrap_content" | 154 | android:layout_height="wrap_content" |
| 155 | android:layout_margin="20dp" | 155 | android:layout_margin="20dp" |
| 156 | android:gravity="center_vertical" | 156 | android:gravity="center_vertical" |
| 157 | android:orientation="horizontal"> | 157 | android:orientation="horizontal"> |
| 158 | 158 | ||
| 159 | <View | 159 | <View |
| 160 | android:layout_width="5dp" | 160 | android:layout_width="5dp" |
| 161 | android:layout_height="20dp" | 161 | android:layout_height="20dp" |
| 162 | android:background="@color/login_text_blue"> | 162 | android:background="@color/login_text_blue"> |
| 163 | 163 | ||
| 164 | </View> | 164 | </View> |
| 165 | 165 | ||
| 166 | <TextView | 166 | <TextView |
| 167 | android:layout_width="wrap_content" | 167 | android:layout_width="wrap_content" |
| 168 | android:layout_height="wrap_content" | 168 | android:layout_height="wrap_content" |
| 169 | android:layout_marginLeft="5dp" | 169 | android:layout_marginLeft="5dp" |
| 170 | android:text="子账户管理" | 170 | android:text="子账户管理" |
| 171 | android:textSize="22sp" /> | 171 | android:textSize="22sp" /> |
| 172 | 172 | ||
| 173 | </LinearLayout> | 173 | </LinearLayout> |
| 174 | 174 | ||
| 175 | <LinearLayout | 175 | <LinearLayout |
| 176 | android:layout_width="match_parent" | 176 | android:layout_width="match_parent" |
| 177 | android:layout_height="match_parent" | 177 | android:layout_height="match_parent" |
| 178 | android:layout_marginLeft="30dp" | 178 | android:layout_marginLeft="30dp" |
| 179 | android:orientation="vertical"> | 179 | android:orientation="vertical"> |
| 180 | 180 | ||
| 181 | <LinearLayout | 181 | <LinearLayout |
| 182 | android:layout_width="match_parent" | 182 | android:layout_width="match_parent" |
| 183 | android:layout_height="wrap_content"> | 183 | android:layout_height="wrap_content"> |
| 184 | 184 | ||
| 185 | <LinearLayout | 185 | <LinearLayout |
| 186 | android:layout_width="0dp" | 186 | android:layout_width="0dp" |
| 187 | android:layout_height="wrap_content" | 187 | android:layout_height="wrap_content" |
| 188 | android:layout_weight="1"> | 188 | android:layout_weight="1"> |
| 189 | 189 | ||
| 190 | <LinearLayout | 190 | <LinearLayout |
| 191 | android:id="@+id/ll_zhu_backgrangd" | 191 | android:id="@+id/ll_zhu_backgrangd" |
| 192 | android:layout_width="400dp" | 192 | android:layout_width="400dp" |
| 193 | android:layout_height="wrap_content" | 193 | android:layout_height="wrap_content" |
| 194 | android:layout_marginLeft="5dp" | 194 | android:layout_marginLeft="5dp" |
| 195 | android:background="@drawable/corcle_blue_bg" | 195 | android:background="@drawable/corcle_blue_bg" |
| 196 | android:orientation="vertical"> | 196 | android:orientation="vertical"> |
| 197 | 197 | ||
| 198 | <LinearLayout | 198 | <LinearLayout |
| 199 | android:layout_width="match_parent" | 199 | android:layout_width="match_parent" |
| 200 | android:layout_height="wrap_content" | 200 | android:layout_height="wrap_content" |
| 201 | android:background="@mipmap/bg_zhuzhanghu" | 201 | android:background="@mipmap/bg_zhuzhanghu" |
| 202 | android:orientation="horizontal"> | 202 | android:orientation="horizontal"> |
| 203 | 203 | ||
| 204 | <com.facebook.drawee.view.SimpleDraweeView | 204 | <com.hjx.personalcenter.View.RoundImageView60dip |
| 205 | android:id="@+id/tv_account_head" | 205 | android:id="@+id/tv_account_head" |
| 206 | android:layout_width="60dp" | 206 | android:layout_width="60dp" |
| 207 | android:layout_height="60dp" | 207 | android:layout_height="60dp" |
| 208 | android:layout_margin="10dp" | 208 | android:layout_margin="10dp" |
| 209 | fresco:placeholderImage="@mipmap/header_default" | 209 | android:background="@mipmap/header_default" |
| 210 | fresco:placeholderImageScaleType="fitCenter" | 210 | android:scaleType="centerCrop" /> |
| 211 | fresco:roundAsCircle="true" /> | 211 | |
| 212 | 212 | ||
| 213 | <LinearLayout | 213 | <LinearLayout |
| 214 | android:layout_width="0dp" | 214 | android:layout_width="0dp" |
| 215 | android:layout_height="wrap_content" | 215 | android:layout_height="wrap_content" |
| 216 | android:layout_marginLeft="10dp" | 216 | android:layout_marginLeft="10dp" |
| 217 | android:layout_marginTop="10dp" | 217 | android:layout_marginTop="10dp" |
| 218 | android:layout_weight="1" | 218 | android:layout_weight="1" |
| 219 | android:orientation="vertical"> | 219 | android:orientation="vertical"> |
| 220 | 220 | ||
| 221 | <TextView | 221 | <TextView |
| 222 | android:id="@+id/tv_account_name" | 222 | android:id="@+id/tv_account_name" |
| 223 | android:layout_width="wrap_content" | 223 | android:layout_width="wrap_content" |
| 224 | android:layout_height="wrap_content" | 224 | android:layout_height="wrap_content" |
| 225 | android:text="" | 225 | android:text="" |
| 226 | android:textSize="18sp" /> | 226 | android:textSize="18sp" /> |
| 227 | 227 | ||
| 228 | <TextView | 228 | <TextView |
| 229 | android:id="@+id/tv_account_grade" | 229 | android:id="@+id/tv_account_grade" |
| 230 | android:layout_width="wrap_content" | 230 | android:layout_width="wrap_content" |
| 231 | android:layout_height="wrap_content" | 231 | android:layout_height="wrap_content" |
| 232 | android:text="" | 232 | android:text="" |
| 233 | android:textSize="18sp" /> | 233 | android:textSize="18sp" /> |
| 234 | 234 | ||
| 235 | <TextView | 235 | <TextView |
| 236 | android:id="@+id/tv_account_school" | 236 | android:id="@+id/tv_account_school" |
| 237 | android:layout_width="wrap_content" | 237 | android:layout_width="wrap_content" |
| 238 | android:layout_height="wrap_content" | 238 | android:layout_height="wrap_content" |
| 239 | android:text="" | 239 | android:text="" |
| 240 | android:textSize="18sp" /> | 240 | android:textSize="18sp" /> |
| 241 | 241 | ||
| 242 | <TextView | 242 | <TextView |
| 243 | android:id="@+id/tv_account_adress" | 243 | android:id="@+id/tv_account_adress" |
| 244 | android:layout_width="wrap_content" | 244 | android:layout_width="wrap_content" |
| 245 | android:layout_height="wrap_content" | 245 | android:layout_height="wrap_content" |
| 246 | android:text="" | 246 | android:text="" |
| 247 | android:textSize="18sp" /> | 247 | android:textSize="18sp" /> |
| 248 | 248 | ||
| 249 | 249 | ||
| 250 | </LinearLayout> | 250 | </LinearLayout> |
| 251 | 251 | ||
| 252 | <ImageView | 252 | <ImageView |
| 253 | android:id="@+id/iv_shiyongzhong" | 253 | android:id="@+id/iv_shiyongzhong" |
| 254 | android:layout_width="wrap_content" | 254 | android:layout_width="wrap_content" |
| 255 | android:layout_height="wrap_content" | 255 | android:layout_height="wrap_content" |
| 256 | android:layout_gravity="right" | 256 | android:layout_gravity="right" |
| 257 | android:layout_marginLeft="60dp" | 257 | android:layout_marginLeft="60dp" |
| 258 | android:src="@mipmap/shiyongzhong" | 258 | android:src="@mipmap/shiyongzhong" |
| 259 | android:visibility="gone" /> | 259 | android:visibility="gone" /> |
| 260 | 260 | ||
| 261 | </LinearLayout> | 261 | </LinearLayout> |
| 262 | 262 | ||
| 263 | <View | 263 | <View |
| 264 | android:layout_width="match_parent" | 264 | android:layout_width="match_parent" |
| 265 | android:layout_height="0.7dp" | 265 | android:layout_height="0.7dp" |
| 266 | android:layout_marginBottom="10dp" | 266 | android:layout_marginBottom="10dp" |
| 267 | android:background="@color/cutoff_line"> | 267 | android:background="@color/cutoff_line"> |
| 268 | 268 | ||
| 269 | </View> | 269 | </View> |
| 270 | 270 | ||
| 271 | <LinearLayout | 271 | <LinearLayout |
| 272 | android:layout_width="match_parent" | 272 | android:layout_width="match_parent" |
| 273 | android:layout_height="wrap_content" | 273 | android:layout_height="wrap_content" |
| 274 | android:layout_marginBottom="10dp" | 274 | android:layout_marginBottom="10dp" |
| 275 | android:orientation="horizontal"> | 275 | android:orientation="horizontal"> |
| 276 | 276 | ||
| 277 | <TextView | 277 | <TextView |
| 278 | android:id="@+id/change_zhu_account" | 278 | android:id="@+id/change_zhu_account" |
| 279 | android:layout_width="0dp" | 279 | android:layout_width="0dp" |
| 280 | android:layout_height="wrap_content" | 280 | android:layout_height="wrap_content" |
| 281 | android:layout_weight="1" | 281 | android:layout_weight="1" |
| 282 | android:gravity="center" | 282 | android:gravity="center" |
| 283 | android:text="切换主账户" | 283 | android:text="切换主账户" |
| 284 | android:textSize="18sp" /> | 284 | android:textSize="18sp" /> |
| 285 | 285 | ||
| 286 | 286 | ||
| 287 | </LinearLayout> | 287 | </LinearLayout> |
| 288 | 288 | ||
| 289 | </LinearLayout> | 289 | </LinearLayout> |
| 290 | 290 | ||
| 291 | 291 | ||
| 292 | </LinearLayout> | 292 | </LinearLayout> |
| 293 | 293 | ||
| 294 | <LinearLayout | 294 | <LinearLayout |
| 295 | android:layout_width="0dp" | 295 | android:layout_width="0dp" |
| 296 | android:layout_height="wrap_content" | 296 | android:layout_height="wrap_content" |
| 297 | android:layout_weight="1"> | 297 | android:layout_weight="1"> |
| 298 | 298 | ||
| 299 | </LinearLayout> | 299 | </LinearLayout> |
| 300 | 300 | ||
| 301 | <LinearLayout | 301 | <LinearLayout |
| 302 | android:layout_width="0dp" | 302 | android:layout_width="0dp" |
| 303 | android:layout_height="wrap_content" | 303 | android:layout_height="wrap_content" |
| 304 | android:layout_weight="1"> | 304 | android:layout_weight="1"> |
| 305 | 305 | ||
| 306 | </LinearLayout> | 306 | </LinearLayout> |
| 307 | </LinearLayout> | 307 | </LinearLayout> |
| 308 | 308 | ||
| 309 | <RelativeLayout | 309 | <RelativeLayout |
| 310 | android:layout_width="match_parent" | 310 | android:layout_width="match_parent" |
| 311 | android:layout_height="wrap_content" | 311 | android:layout_height="wrap_content" |
| 312 | android:layout_marginTop="20dp" | 312 | android:layout_marginTop="20dp" |
| 313 | android:orientation="horizontal"> | 313 | android:orientation="horizontal"> |
| 314 | 314 | ||
| 315 | <android.support.v7.widget.RecyclerView | 315 | <android.support.v7.widget.RecyclerView |
| 316 | android:id="@+id/id_recyclerview_horizontal" | 316 | android:id="@+id/id_recyclerview_horizontal" |
| 317 | android:layout_width="wrap_content" | 317 | android:layout_width="wrap_content" |
| 318 | android:layout_height="wrap_content" | 318 | android:layout_height="wrap_content" |
| 319 | android:layout_centerVertical="true" | 319 | android:layout_centerVertical="true" |
| 320 | android:scrollbars="none"> | 320 | android:scrollbars="none"> |
| 321 | 321 | ||
| 322 | </android.support.v7.widget.RecyclerView> | 322 | </android.support.v7.widget.RecyclerView> |
| 323 | 323 | ||
| 324 | 324 | ||
| 325 | |||
| 326 | </RelativeLayout> | 325 | </RelativeLayout> |
| 327 | 326 | ||
| 328 | </LinearLayout> | 327 | </LinearLayout> |
| 329 | 328 |
PersonalCenter/app/src/main/res/layout/activity_feedback.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/tools" | 3 | xmlns:fresco="http://schemas.android.com/tools" |
| 4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| 7 | android:background="@color/backgerangde_laout"> | 7 | android:background="@color/backgerangde_laout"> |
| 8 | <RelativeLayout | 8 | <RelativeLayout |
| 9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
| 10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 11 | android:layout_height="50dp" | 11 | android:layout_height="50dp" |
| 12 | android:background="@color/login_text_blue"> | 12 | android:background="@color/login_text_blue"> |
| 13 | 13 | ||
| 14 | <ImageView | 14 | <ImageView |
| 15 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
| 16 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
| 17 | android:layout_height="match_parent" | 17 | android:layout_height="match_parent" |
| 18 | android:paddingLeft="20dp" | 18 | android:paddingLeft="20dp" |
| 19 | android:paddingRight="20dp" | 19 | android:paddingRight="20dp" |
| 20 | android:src="@mipmap/title_back" /> | 20 | android:src="@mipmap/title_back" /> |
| 21 | 21 | ||
| 22 | <TextView | 22 | <TextView |
| 23 | android:id="@+id/menu_title" | 23 | android:id="@+id/menu_title" |
| 24 | android:layout_width="wrap_content" | 24 | android:layout_width="wrap_content" |
| 25 | android:layout_height="match_parent" | 25 | android:layout_height="match_parent" |
| 26 | android:layout_centerInParent="true" | 26 | android:layout_centerInParent="true" |
| 27 | android:gravity="center_vertical" | 27 | android:gravity="center_vertical" |
| 28 | android:text="意见反馈" | 28 | android:text="意见反馈" |
| 29 | android:textColor="@android:color/white" | 29 | android:textColor="@android:color/white" |
| 30 | android:textSize="22sp" /> | 30 | android:textSize="22sp" /> |
| 31 | <TextView | 31 | <TextView |
| 32 | android:id="@+id/feedback_sub" | 32 | android:id="@+id/feedback_sub" |
| 33 | android:layout_width="wrap_content" | 33 | android:layout_width="wrap_content" |
| 34 | android:layout_height="match_parent" | 34 | android:layout_height="match_parent" |
| 35 | android:paddingLeft="20dp" | 35 | android:paddingLeft="20dp" |
| 36 | android:paddingRight="20dp" | 36 | android:paddingRight="20dp" |
| 37 | android:gravity="center_vertical" | 37 | android:gravity="center_vertical" |
| 38 | android:layout_alignParentRight="true" | 38 | android:layout_alignParentRight="true" |
| 39 | android:text="提交" | 39 | android:text="提交" |
| 40 | android:textColor="@android:color/white" | 40 | android:textColor="@android:color/white" |
| 41 | android:textSize="22sp" /> | 41 | android:textSize="22sp" /> |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | </RelativeLayout> | 44 | </RelativeLayout> |
| 45 | <EditText | 45 | <EditText |
| 46 | android:id="@+id/feedback_content" | 46 | android:id="@+id/feedback_content" |
| 47 | android:layout_width="match_parent" | 47 | android:layout_width="match_parent" |
| 48 | android:layout_height="250dp" | 48 | android:layout_height="250dp" |
| 49 | android:hint="@string/feedback" | 49 | android:hint="@string/feedback" |
| 50 | android:textColor="@color/electronic_text" | 50 | android:textColor="@color/electronic_text" |
| 51 | android:textSize="18sp" | 51 | android:textSize="18sp" |
| 52 | android:textScaleX="1" | 52 | android:textScaleX="1" |
| 53 | android:padding="20dp" | 53 | android:padding="20dp" |
| 54 | android:gravity="top" | 54 | android:gravity="top" |
| 55 | android:background="@color/white"/> | 55 | android:background="@color/white"/> |
| 56 | <LinearLayout | 56 | <LinearLayout |
| 57 | android:id="@+id/take_phone" | 57 | android:id="@+id/take_phone" |
| 58 | android:layout_width="match_parent" | 58 | android:layout_width="match_parent" |
| 59 | android:layout_height="wrap_content" | 59 | android:layout_height="wrap_content" |
| 60 | android:background="@color/white"> | 60 | android:background="@color/white"> |
| 61 | <ImageView | 61 | <ImageView |
| 62 | android:id="@+id/iv_take" | 62 | android:id="@+id/iv_take" |
| 63 | android:layout_margin="20dp" | 63 | android:layout_margin="20dp" |
| 64 | android:layout_width="wrap_content" | 64 | android:layout_width="wrap_content" |
| 65 | android:layout_height="wrap_content" | 65 | android:layout_height="wrap_content" |
| 66 | android:src="@mipmap/feedback_take_phone"/> | 66 | android:src="@mipmap/feedback_take_phone"/> |
| 67 | 67 | ||
| 68 | <com.facebook.drawee.view.SimpleDraweeView | 68 | |
| 69 | <ImageView | ||
| 69 | android:id="@+id/show_iv" | 70 | android:id="@+id/show_iv" |
| 70 | android:layout_width="54dp" | 71 | android:layout_width="60dp" |
| 71 | android:layout_height="54dp" | 72 | android:layout_height="60dp" |
| 72 | android:layout_gravity="center" | 73 | android:layout_margin="10dp" |
| 73 | fresco:placeholderImage="@mipmap/title_back" | 74 | /> |
| 74 | fresco:roundAsCircle="true" | ||
| 75 | fresco:placeholderImageScaleType="fitCenter" /> | ||
| 76 | 75 | ||
| 77 | </LinearLayout> | 76 | </LinearLayout> |
| 78 | <EditText | 77 | <EditText |
| 79 | android:id="@+id/feedback_phone" | 78 | android:id="@+id/feedback_phone" |
| 80 | android:layout_width="match_parent" | 79 | android:layout_width="match_parent" |
| 81 | android:layout_marginTop="20dp" | 80 | android:layout_marginTop="20dp" |
| 82 | android:background="@color/white" | 81 | android:background="@color/white" |
| 83 | android:hint="@string/qq" | 82 | android:hint="@string/qq" |
| 84 | android:inputType="number" | 83 | android:inputType="number" |
| 85 | android:padding="20dp" | 84 | android:padding="20dp" |
| 86 | android:layout_height="wrap_content" /> | 85 | android:layout_height="wrap_content" /> |
| 87 | <TextView | 86 | <TextView |
| 88 | android:layout_width="match_parent" | 87 | android:layout_width="match_parent" |
| 89 | android:text="@string/hint" | 88 | android:text="@string/hint" |
| 90 | android:padding="20dp" | 89 | android:padding="20dp" |
| 91 | android:textSize="18sp" | 90 | android:textSize="18sp" |
| 92 | android:layout_height="wrap_content" /> | 91 | android:layout_height="wrap_content" /> |
| 93 | 92 | ||
| 94 | 93 | ||
| 95 | 94 |
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.2" |
| 82 | android:orientation="vertical"> | 82 | android:orientation="vertical" |
| 83 | android:background="@mipmap/head_bg"> | ||
| 83 | <RelativeLayout | 84 | <RelativeLayout |
| 84 | android:layout_width="wrap_content" | 85 | android:layout_width="wrap_content" |
| 85 | android:layout_height="250sp" | 86 | android:layout_marginTop="118dp" |
| 86 | android:background="@mipmap/head_bg"> | 87 | android:layout_height="250sp"> |
| 87 | 88 | ||
| 88 | <LinearLayout | 89 | <LinearLayout |
| 89 | android:id="@+id/ssss" | 90 | android:id="@+id/ssss" |
| 90 | android:layout_width="match_parent" | 91 | android:layout_width="match_parent" |
| 91 | android:layout_height="wrap_content" | 92 | android:layout_height="wrap_content" |
| 92 | android:layout_marginTop="28dp" | 93 | android:layout_marginTop="28dp" |
| 93 | android:gravity="center" | 94 | android:gravity="center" |
| 94 | android:orientation="horizontal"> | 95 | android:orientation="horizontal"> |
| 95 | <com.facebook.drawee.view.SimpleDraweeView | 96 | <com.hjx.personalcenter.View.RoundImageView60dip |
| 96 | android:id="@+id/iv_head" | 97 | android:id="@+id/iv_head" |
| 97 | android:layout_width="65dp" | 98 | android:layout_width="70dp" |
| 98 | android:layout_height="65dp" | 99 | android:layout_height="70dp" |
| 99 | fresco:placeholderImage="@mipmap/header_default" | 100 | android:scaleType="centerCrop" |
| 100 | fresco:roundAsCircle="true" | 101 | android:background="@mipmap/header_default" |
| 101 | fresco:placeholderImageScaleType="fitCenter" /> | 102 | /> |
| 102 | 103 | ||
| 103 | <TextView | 104 | <TextView |
| 104 | android:layout_width="wrap_content" | 105 | android:layout_width="wrap_content" |
| 105 | android:layout_height="wrap_content" | 106 | android:layout_height="wrap_content" |
| 106 | android:layout_marginLeft="18dp" | 107 | android:layout_marginLeft="18dp" |
| 107 | android:layout_marginTop="20dp" | 108 | android:layout_marginTop="20dp" |
| 108 | android:background="@drawable/corcle_blue_bg" | 109 | android:background="@drawable/corcle_blue_bg" |
| 109 | android:paddingLeft="5dp" | 110 | android:paddingLeft="5dp" |
| 110 | android:paddingRight="5dp" | 111 | android:paddingRight="5dp" |
| 111 | android:gravity="center_vertical" | 112 | android:gravity="center_vertical" |
| 112 | android:text="签到" | 113 | android:text="签到" |
| 113 | android:textColor="@color/login_text_blue" | 114 | android:textColor="@color/login_text_blue" |
| 114 | android:visibility="gone" | 115 | android:visibility="gone" |
| 115 | android:textSize="18sp" /> | 116 | android:textSize="18sp" /> |
| 116 | 117 | ||
| 117 | </LinearLayout> | 118 | </LinearLayout> |
| 118 | 119 | ||
| 119 | <LinearLayout | 120 | <LinearLayout |
| 120 | android:id="@+id/sssssss" | 121 | android:id="@+id/sssssss" |
| 121 | android:layout_width="match_parent" | 122 | android:layout_width="match_parent" |
| 122 | android:layout_height="wrap_content" | 123 | android:layout_height="wrap_content" |
| 123 | android:layout_marginLeft="20dp" | 124 | android:layout_marginLeft="20dp" |
| 124 | android:layout_below="@id/ssss" | 125 | android:layout_below="@id/ssss" |
| 125 | android:layout_marginTop="20dp" | 126 | android:layout_marginTop="25dp" |
| 126 | android:gravity="center" | 127 | android:gravity="center" |
| 127 | android:orientation="horizontal"> | 128 | android:orientation="horizontal"> |
| 128 | 129 | ||
| 129 | <TextView | 130 | <TextView |
| 130 | android:id="@+id/tv_username" | 131 | android:id="@+id/tv_username" |
| 131 | android:layout_width="wrap_content" | 132 | android:layout_width="wrap_content" |
| 132 | android:layout_height="wrap_content" | 133 | android:layout_height="wrap_content" |
| 133 | android:text="" | 134 | android:text="" |
| 134 | android:textSize="20sp" /> | 135 | android:gravity="center" |
| 136 | android:textSize="22sp" /> | ||
| 135 | <TextView | 137 | <TextView |
| 136 | android:id="@+id/tv_yangji" | 138 | android:id="@+id/tv_yangji" |
| 137 | android:layout_marginLeft="5dp" | 139 | android:layout_marginLeft="5dp" |
| 138 | android:layout_width="wrap_content" | 140 | android:layout_width="wrap_content" |
| 139 | android:layout_height="wrap_content" | 141 | android:layout_height="wrap_content" |
| 140 | android:text="(样机)" | 142 | android:text="(样机)" |
| 141 | android:textSize="20dp" | 143 | android:textSize="20dp" |
| 142 | android:visibility="gone"/> | 144 | android:visibility="gone"/> |
| 143 | 145 | ||
| 144 | <ImageView | 146 | <ImageView |
| 145 | android:id="@+id/iv_sex" | 147 | android:id="@+id/iv_sex" |
| 146 | android:layout_width="wrap_content" | 148 | android:layout_width="wrap_content" |
| 147 | android:layout_height="wrap_content" | 149 | android:layout_height="wrap_content" |
| 148 | android:layout_gravity="center_vertical" | 150 | android:layout_gravity="center_vertical" |
| 149 | android:layout_marginLeft="5dp" | 151 | android:layout_marginLeft="5dp" |
| 150 | android:src="@mipmap/men" /> | 152 | android:src="@mipmap/men" /> |
| 151 | 153 | ||
| 152 | </LinearLayout> | 154 | </LinearLayout> |
| 153 | 155 | ||
| 154 | <LinearLayout | 156 | <LinearLayout |
| 155 | android:layout_below="@id/sssssss" | 157 | android:layout_below="@id/sssssss" |
| 156 | android:layout_width="match_parent" | 158 | android:layout_width="match_parent" |
| 157 | android:layout_height="wrap_content" | 159 | android:layout_height="wrap_content" |
| 158 | android:layout_marginLeft="20dp" | 160 | android:layout_marginLeft="20dp" |
| 159 | android:layout_marginTop="10dp" | 161 | android:layout_marginTop="10dp" |
| 160 | android:gravity="center" | 162 | android:gravity="center" |
| 161 | android:orientation="horizontal"> | 163 | android:orientation="horizontal"> |
| 162 | 164 | ||
| 163 | <TextView | 165 | <TextView |
| 164 | android:id="@+id/tv_sign" | 166 | android:id="@+id/tv_sign" |
| 165 | android:layout_height="wrap_content" | 167 | android:layout_height="wrap_content" |
| 166 | android:layout_width="wrap_content" | 168 | android:layout_width="wrap_content" |
| 167 | android:hint="请输入个性签名" | 169 | android:hint="请输入个性签名" |
| 168 | android:maxLines="3" | 170 | android:maxLines="3" |
| 171 | android:padding="10dp" | ||
| 172 | android:gravity="center" | ||
| 169 | android:maxLength="40" | 173 | android:maxLength="40" |
| 170 | android:ellipsize="end" | 174 | android:ellipsize="end" |
| 171 | android:textSize="16sp" /> | 175 | android:textSize="16sp" |
| 176 | android:drawableRight="@mipmap/gerenxinxibianji"/> | ||
| 172 | 177 | ||
| 173 | <ImageView | 178 | <ImageView |
| 174 | android:id="@+id/iv_sign" | 179 | android:id="@+id/iv_sign" |
| 175 | android:layout_width="wrap_content" | 180 | android:layout_width="wrap_content" |
| 176 | android:layout_height="wrap_content" | 181 | android:layout_height="wrap_content" |
| 182 | android:scaleType="center" | ||
| 177 | android:padding="10dp" | 183 | android:padding="10dp" |
| 178 | android:src="@mipmap/qianming" /> | 184 | android:visibility="gone" |
| 185 | android:src="@mipmap/gerenxinxibianji" /> | ||
| 179 | 186 | ||
| 180 | 187 | ||
| 181 | </LinearLayout> | 188 | </LinearLayout> |
| 182 | </RelativeLayout> | 189 | </RelativeLayout> |
| 183 | <View | 190 | <View |
| 184 | android:layout_width="match_parent" | 191 | android:layout_width="match_parent" |
| 185 | android:layout_height="0.7dp" | 192 | android:layout_height="0.7dp" |
| 186 | android:background="@color/cutoff_line"> | 193 | android:background="@color/cutoff_line" |
| 194 | android:visibility="gone"> | ||
| 187 | 195 | ||
| 188 | </View> | 196 | </View> |
| 189 | 197 | ||
| 190 | <LinearLayout | 198 | <LinearLayout |
| 191 | android:layout_width="match_parent" | 199 | android:layout_width="match_parent" |
| 192 | android:layout_height="wrap_content" | 200 | android:layout_height="50dp" |
| 193 | android:orientation="vertical"> | 201 | android:orientation="vertical" |
| 202 | android:visibility="invisible"> | ||
| 194 | 203 | ||
| 195 | <LinearLayout | 204 | <LinearLayout |
| 196 | android:layout_width="match_parent" | 205 | android:layout_width="match_parent" |
| 197 | android:layout_height="wrap_content" | 206 | android:layout_height="wrap_content" |
| 198 | android:gravity="center_vertical" | 207 | android:gravity="center_vertical" |
| 199 | android:orientation="horizontal"> | 208 | android:orientation="horizontal"> |
| 200 | 209 | ||
| 201 | <ImageView | 210 | <ImageView |
| 202 | android:layout_width="0dp" | 211 | android:layout_width="0dp" |
| 203 | android:layout_height="wrap_content" | 212 | android:layout_height="wrap_content" |
| 204 | android:layout_weight="1" | 213 | android:layout_weight="1" |
| 205 | android:paddingTop="20dp" | 214 | android:paddingTop="20dp" |
| 206 | android:paddingBottom="20dp" | 215 | android:paddingBottom="20dp" |
| 207 | android:src="@mipmap/wodecuoti1" /> | 216 | android:src="@mipmap/wodecuoti1" /> |
| 208 | 217 | ||
| 209 | <TextView | 218 | <TextView |
| 210 | android:id="@+id/linel_mycuoti" | 219 | android:id="@+id/linel_mycuoti" |
| 211 | android:layout_width="0dp" | 220 | android:layout_width="0dp" |
| 212 | android:layout_height="wrap_content" | 221 | android:layout_height="wrap_content" |
| 213 | android:layout_weight="1" | 222 | android:layout_weight="1" |
| 214 | android:paddingTop="20dp" | 223 | android:paddingTop="20dp" |
| 215 | android:paddingBottom="20dp" | 224 | android:paddingBottom="20dp" |
| 216 | android:text="我的错题" | 225 | android:text="我的错题" |
| 217 | android:textSize="20sp" /> | 226 | android:textSize="20sp" /> |
| 218 | <View | 227 | <View |
| 219 | android:layout_width="1dp" | 228 | android:layout_width="1dp" |
| 220 | android:layout_height="match_parent" | 229 | android:layout_height="match_parent" |
| 221 | android:background="@color/cutoff_line"> | 230 | android:background="@color/cutoff_line"> |
| 222 | 231 | ||
| 223 | </View> | 232 | </View> |
| 224 | 233 | ||
| 225 | <ImageView | 234 | <ImageView |
| 226 | android:layout_width="0dp" | 235 | android:layout_width="0dp" |
| 227 | android:layout_height="wrap_content" | 236 | android:layout_height="wrap_content" |
| 228 | android:layout_weight="1" | 237 | android:layout_weight="1" |
| 229 | android:paddingTop="20dp" | 238 | android:paddingTop="20dp" |
| 230 | android:paddingBottom="20dp" | 239 | android:paddingBottom="20dp" |
| 231 | android:src="@mipmap/wodebiji1" /> | 240 | android:src="@mipmap/wodebiji1" /> |
| 232 | <TextView | 241 | <TextView |
| 233 | android:id="@+id/linel_mynote" | 242 | android:id="@+id/linel_mynote" |
| 234 | android:layout_width="0dp" | 243 | android:layout_width="0dp" |
| 235 | android:layout_height="wrap_content" | 244 | android:layout_height="wrap_content" |
| 236 | android:layout_weight="1" | 245 | android:layout_weight="1" |
| 237 | android:paddingTop="20dp" | 246 | android:paddingTop="20dp" |
| 238 | android:paddingBottom="20dp" | 247 | android:paddingBottom="20dp" |
| 239 | android:text="我的笔记" | 248 | android:text="我的笔记" |
| 240 | android:textSize="20sp" /> | 249 | android:textSize="20sp" /> |
| 241 | 250 | ||
| 242 | </LinearLayout> | 251 | </LinearLayout> |
| 243 | <View | 252 | <View |
| 244 | android:layout_width="match_parent" | 253 | android:layout_width="match_parent" |
| 245 | android:layout_height="1dp" | 254 | android:layout_height="1dp" |
| 246 | android:background="@color/cutoff_line"> | 255 | android:background="@color/cutoff_line"> |
| 247 | 256 | ||
| 248 | </View> | 257 | </View> |
| 249 | <LinearLayout | 258 | <LinearLayout |
| 250 | android:layout_width="match_parent" | 259 | android:layout_width="match_parent" |
| 251 | android:layout_height="wrap_content" | 260 | android:layout_height="wrap_content" |
| 252 | android:gravity="center_vertical" | 261 | android:gravity="center_vertical" |
| 253 | android:orientation="horizontal"> | 262 | android:orientation="horizontal"> |
| 254 | 263 | ||
| 255 | <ImageView | 264 | <ImageView |
| 256 | android:layout_width="0dp" | 265 | android:layout_width="0dp" |
| 257 | android:layout_height="wrap_content" | 266 | android:layout_height="wrap_content" |
| 258 | android:layout_weight="1" | 267 | android:layout_weight="1" |
| 259 | android:paddingTop="20dp" | 268 | android:paddingTop="20dp" |
| 260 | android:paddingBottom="20dp" | 269 | android:paddingBottom="20dp" |
| 261 | android:src="@mipmap/wodeshoucang" /> | 270 | android:src="@mipmap/wodeshoucang" /> |
| 262 | 271 | ||
| 263 | <TextView | 272 | <TextView |
| 264 | android:id="@+id/linel_mycollege" | 273 | android:id="@+id/linel_mycollege" |
| 265 | android:layout_width="0dp" | 274 | android:layout_width="0dp" |
| 266 | android:layout_height="wrap_content" | 275 | android:layout_height="wrap_content" |
| 267 | android:layout_weight="1" | 276 | android:layout_weight="1" |
| 268 | android:paddingTop="20dp" | 277 | android:paddingTop="20dp" |
| 269 | android:paddingBottom="20dp" | 278 | android:paddingBottom="20dp" |
| 270 | android:text="我的收藏" | 279 | android:text="我的收藏" |
| 271 | android:textSize="20sp" /> | 280 | android:textSize="20sp" /> |
| 272 | <View | 281 | <View |
| 273 | android:layout_width="1dp" | 282 | android:layout_width="1dp" |
| 274 | android:layout_height="match_parent" | 283 | android:layout_height="match_parent" |
| 275 | android:background="@color/cutoff_line"> | 284 | android:background="@color/cutoff_line"> |
| 276 | 285 | ||
| 277 | </View> | 286 | </View> |
| 278 | 287 | ||
| 279 | <ImageView | 288 | <ImageView |
| 280 | android:layout_width="0dp" | 289 | android:layout_width="0dp" |
| 281 | android:layout_height="wrap_content" | 290 | android:layout_height="wrap_content" |
| 282 | android:layout_weight="1" | 291 | android:layout_weight="1" |
| 283 | android:paddingTop="20dp" | 292 | android:paddingTop="20dp" |
| 284 | android:paddingBottom="20dp" | 293 | android:paddingBottom="20dp" |
| 285 | android:src="@mipmap/wodebanji1" /> | 294 | android:src="@mipmap/wodebanji1" /> |
| 286 | <TextView | 295 | <TextView |
| 287 | android:id="@+id/linel_myclass" | 296 | android:id="@+id/linel_myclass" |
| 288 | android:layout_width="0dp" | 297 | android:layout_width="0dp" |
| 289 | android:layout_height="wrap_content" | 298 | android:layout_height="wrap_content" |
| 290 | android:layout_weight="1" | 299 | android:layout_weight="1" |
| 291 | android:text="我的生词" | 300 | android:text="我的生词" |
| 292 | android:paddingTop="20dp" | 301 | android:paddingTop="20dp" |
| 293 | android:paddingBottom="20dp" | 302 | android:paddingBottom="20dp" |
| 294 | android:textSize="20sp" /> | 303 | android:textSize="20sp" /> |
| 295 | 304 | ||
| 296 | </LinearLayout> | 305 | </LinearLayout> |
| 297 | 306 | ||
| 298 | <View | 307 | <View |
| 299 | android:layout_width="match_parent" | 308 | android:layout_width="match_parent" |
| 300 | android:layout_height="0.7dp" | 309 | android:layout_height="0.7dp" |
| 301 | android:background="@color/cutoff_line"> | 310 | android:background="@color/cutoff_line"> |
| 302 | 311 | ||
| 303 | </View> | 312 | </View> |
| 304 | 313 | ||
| 305 | </LinearLayout> | 314 | </LinearLayout> |
| 306 | <TextView | 315 | <LinearLayout |
| 307 | android:id="@+id/iv_look_card" | ||
| 308 | android:layout_width="wrap_content" | 316 | android:layout_width="wrap_content" |
| 309 | android:layout_height="wrap_content" | 317 | android:layout_height="wrap_content" |
| 310 | android:paddingTop="10dp" | 318 | android:paddingTop="10dp" |
| 311 | android:paddingLeft="10dp" | 319 | android:paddingLeft="10dp" |
| 312 | android:paddingRight="10dp" | 320 | android:paddingRight="10dp" |
| 313 | android:layout_gravity="center" | 321 | android:layout_gravity="center" |
| 314 | android:layout_marginTop="120dp" | 322 | android:layout_marginTop="150dp"> |
| 315 | android:textColor="@color/login_text_blue" | 323 | <TextView |
| 316 | android:text="好记星电子产品保修卡" /> | 324 | android:id="@+id/iv_look_card" |
| 317 | <View | 325 | android:layout_width="wrap_content" |
| 318 | android:id="@+id/sssssssss" | 326 | android:layout_height="wrap_content" |
| 319 | android:layout_width="135dp" | 327 | android:textColor="@color/bgstudy_baoka" |
| 320 | android:layout_marginTop="2dp" | 328 | android:text="好记星电子产品保修卡" /> |
| 321 | android:layout_gravity="center" | 329 | <ImageView |
| 322 | android:background="@color/login_text_blue" | 330 | android:layout_width="wrap_content" |
| 323 | android:layout_height="0.7dp"> | 331 | android:layout_height="wrap_content" |
| 324 | 332 | android:layout_gravity="center_vertical" | |
| 325 | </View> | 333 | android:src="@mipmap/ahah" /> |
| 334 | </LinearLayout> | ||
| 326 | 335 | ||
| 336 | <!-- | ||
| 327 | <LinearLayout | 337 | <LinearLayout |
| 328 | android:layout_marginTop="10dp" | 338 | android:layout_marginTop="10dp" |
| 329 | android:layout_width="match_parent" | 339 | android:layout_width="match_parent" |
| 330 | android:layout_height="100dp" | 340 | android:layout_height="100dp" |
| 331 | android:gravity="bottom" | 341 | android:gravity="bottom" |
| 332 | android:background="@mipmap/xiaoguanggao"> | 342 | android:background="@mipmap/xiaoguanggao"> |
| 333 | 343 | ||
| 334 | </LinearLayout> | 344 | </LinearLayout>--> |
| 335 | 345 | ||
| 336 | 346 | ||
| 337 | </LinearLayout> | 347 | </LinearLayout> |
| 338 | 348 | ||
| 339 | 349 | ||
| 340 | <View | 350 | <View |
| 341 | android:layout_width="0.7dp" | 351 | android:layout_width="0.7dp" |
| 342 | android:layout_height="match_parent" | 352 | android:layout_height="match_parent" |
| 343 | android:background="@color/cutoff_line"> | 353 | android:background="@color/cutoff_line"> |
| 344 | 354 | ||
| 345 | </View> | 355 | </View> |
| 346 | 356 | ||
| 347 | <LinearLayout | 357 | <LinearLayout |
| 348 | android:layout_width="0dp" | 358 | android:layout_width="0dp" |
| 349 | android:layout_height="match_parent" | 359 | android:layout_height="match_parent" |
| 350 | android:layout_weight="2.5" | 360 | android:layout_weight="2.8" |
| 351 | android:orientation="vertical"> | 361 | android:orientation="vertical"> |
| 352 | 362 | ||
| 353 | <LinearLayout | 363 | <LinearLayout |
| 354 | android:layout_width="match_parent" | 364 | android:layout_width="match_parent" |
| 355 | android:layout_height="wrap_content" | 365 | android:layout_height="wrap_content" |
| 356 | android:layout_margin="10dp" | 366 | android:layout_margin="10dp" |
| 357 | android:gravity="center_vertical" | 367 | android:gravity="center_vertical" |
| 358 | android:orientation="horizontal"> | 368 | android:orientation="horizontal"> |
| 359 | 369 | ||
| 360 | <View | 370 | <View |
| 361 | android:layout_width="5dp" | 371 | android:layout_width="5dp" |
| 362 | android:layout_height="20dp" | 372 | android:layout_height="20dp" |
| 363 | android:background="@color/login_text_blue"> | 373 | android:background="@color/login_text_blue"> |
| 364 | 374 | ||
| 365 | </View> | 375 | </View> |
| 366 | 376 | ||
| 367 | <TextView | 377 | <TextView |
| 368 | android:layout_width="0dp" | 378 | android:layout_width="0dp" |
| 369 | android:layout_height="wrap_content" | 379 | android:layout_height="wrap_content" |
| 370 | android:layout_marginLeft="5dp" | 380 | android:layout_marginLeft="5dp" |
| 371 | android:layout_weight="5" | 381 | android:layout_weight="5" |
| 372 | android:text="个人信息" | 382 | android:text="个人信息" |
| 373 | android:textSize="22sp" /> | 383 | android:textSize="22sp" /> |
| 374 | 384 | ||
| 375 | <TextView | 385 | <TextView |
| 376 | android:layout_width="0dp" | 386 | android:layout_width="0dp" |
| 377 | android:layout_height="wrap_content" | 387 | android:layout_height="wrap_content" |
| 378 | android:layout_marginLeft="10dp" | 388 | android:layout_marginLeft="10dp" |
| 379 | android:layout_weight="0.1" | 389 | android:layout_weight="0.1" |
| 380 | android:text="" | 390 | android:text="" |
| 381 | android:textSize="18sp" /> | 391 | android:textSize="18sp" /> |
| 382 | 392 | ||
| 383 | <ImageView | 393 | <ImageView |
| 384 | android:id="@+id/tv_edit_presoninfo" | 394 | android:id="@+id/tv_edit_presoninfo" |
| 385 | android:padding="10dp" | 395 | android:padding="10dp" |
| 386 | android:layout_width="0dp" | 396 | android:layout_width="0dp" |
| 387 | android:layout_height="wrap_content" | 397 | android:layout_height="wrap_content" |
| 388 | android:layout_weight="0.4" | 398 | android:layout_weight="0.4" |
| 389 | android:src="@mipmap/gerenxinxibianji" /> | 399 | android:src="@mipmap/gerenxinxibianji" /> |
| 390 | 400 | ||
| 391 | 401 | ||
| 392 | </LinearLayout> | 402 | </LinearLayout> |
| 393 | 403 | ||
| 394 | <LinearLayout | 404 | <LinearLayout |
| 395 | android:layout_width="match_parent" | 405 | android:layout_width="match_parent" |
| 396 | android:layout_height="wrap_content" | 406 | android:layout_height="wrap_content" |
| 397 | android:layout_marginLeft="50dp" | 407 | android:layout_marginLeft="50dp" |
| 398 | android:orientation="vertical"> | 408 | android:orientation="vertical"> |
| 399 | 409 | ||
| 400 | <LinearLayout | 410 | <LinearLayout |
| 401 | android:layout_width="match_parent" | 411 | android:layout_width="match_parent" |
| 402 | android:layout_height="wrap_content" | 412 | android:layout_height="wrap_content" |
| 403 | android:gravity="center_vertical" | 413 | android:gravity="center_vertical" |
| 404 | android:orientation="horizontal"> | 414 | android:orientation="horizontal"> |
| 405 | 415 | ||
| 406 | <TextView | 416 | <TextView |
| 407 | android:layout_width="0dp" | 417 | android:layout_width="0dp" |
| 408 | android:layout_height="wrap_content" | 418 | android:layout_height="wrap_content" |
| 409 | android:textColor="@color/login_edittext_hint" | 419 | android:textColor="@color/login_edittext_hint" |
| 410 | android:layout_weight="1" | 420 | android:layout_weight="1" |
| 411 | android:text="昵称" | 421 | android:text="昵称" |
| 412 | android:textSize="20sp" /> | 422 | android:textSize="20sp" /> |
| 413 | 423 | ||
| 414 | <TextView | 424 | <TextView |
| 415 | android:id="@+id/tv_username1" | 425 | android:id="@+id/tv_username1" |
| 416 | android:layout_width="0dp" | 426 | android:layout_width="0dp" |
| 417 | android:layout_height="wrap_content" | 427 | android:layout_height="wrap_content" |
| 418 | android:layout_weight="2" | 428 | android:layout_weight="2" |
| 419 | android:hint="未填写" | 429 | android:hint="未填写" |
| 420 | android:textSize="20sp" /> | 430 | android:textSize="20sp" /> |
| 421 | 431 | ||
| 422 | <TextView | 432 | <TextView |
| 423 | android:layout_width="1dp" | 433 | android:layout_width="1dp" |
| 424 | android:layout_height="wrap_content" | 434 | android:layout_height="wrap_content" |
| 425 | android:layout_weight="1" | 435 | android:layout_weight="1" |
| 426 | android:textColor="@color/login_edittext_hint" | 436 | android:textColor="@color/login_edittext_hint" |
| 427 | android:text="星座" | 437 | android:text="星座" |
| 428 | android:textSize="20sp" /> | 438 | android:textSize="20sp" /> |
| 429 | 439 | ||
| 430 | <TextView | 440 | <TextView |
| 431 | android:id="@+id/tv_mygad" | 441 | android:id="@+id/tv_mygad" |
| 432 | android:layout_width="0dp" | 442 | android:layout_width="0dp" |
| 433 | android:layout_height="wrap_content" | 443 | android:layout_height="wrap_content" |
| 434 | android:layout_weight="2" | 444 | android:layout_weight="2" |
| 435 | android:hint="未填写" | 445 | android:hint="未填写" |
| 436 | android:textSize="20sp" /> | 446 | android:textSize="20sp" /> |
| 437 | </LinearLayout> | 447 | </LinearLayout> |
| 438 | 448 | ||
| 439 | <LinearLayout | 449 | <LinearLayout |
| 440 | android:layout_width="match_parent" | 450 | android:layout_width="match_parent" |
| 441 | android:layout_height="wrap_content" | 451 | android:layout_height="wrap_content" |
| 442 | android:layout_marginTop="15dp" | 452 | android:layout_marginTop="15dp" |
| 443 | android:gravity="center_vertical" | 453 | android:gravity="center_vertical" |
| 444 | android:orientation="horizontal"> | 454 | android:orientation="horizontal"> |
| 445 | 455 | ||
| 446 | <TextView | 456 | <TextView |
| 447 | android:layout_width="0dp" | 457 | android:layout_width="0dp" |
| 448 | android:layout_height="wrap_content" | 458 | android:layout_height="wrap_content" |
| 449 | android:textColor="@color/login_edittext_hint" | 459 | android:textColor="@color/login_edittext_hint" |
| 450 | android:layout_weight="1" | 460 | android:layout_weight="1" |
| 451 | android:text="性别" | 461 | android:text="性别" |
| 452 | android:textSize="20sp" /> | 462 | android:textSize="20sp" /> |
| 453 | 463 | ||
| 454 | <TextView | 464 | <TextView |
| 455 | android:id="@+id/tv_sex" | 465 | android:id="@+id/tv_sex" |
| 456 | android:layout_width="0dp" | 466 | android:layout_width="0dp" |
| 457 | android:layout_height="wrap_content" | 467 | android:layout_height="wrap_content" |
| 458 | android:layout_weight="2" | 468 | android:layout_weight="2" |
| 459 | android:hint="未填写" | 469 | android:hint="未填写" |
| 460 | android:textSize="20sp" /> | 470 | android:textSize="20sp" /> |
| 461 | 471 | ||
| 462 | <TextView | 472 | <TextView |
| 463 | android:layout_width="1dp" | 473 | android:layout_width="1dp" |
| 464 | android:layout_height="wrap_content" | 474 | android:layout_height="wrap_content" |
| 465 | android:textColor="@color/login_edittext_hint" | 475 | android:textColor="@color/login_edittext_hint" |
| 466 | android:layout_weight="1" | 476 | android:layout_weight="1" |
| 467 | android:text="地区" | 477 | android:text="地区" |
| 468 | android:textSize="20sp" /> | 478 | android:textSize="20sp" /> |
| 469 | 479 | ||
| 470 | <TextView | 480 | <TextView |
| 471 | android:id="@+id/tv_useinfo_adress" | 481 | android:id="@+id/tv_useinfo_adress" |
| 472 | android:layout_width="0dp" | 482 | android:layout_width="0dp" |
| 473 | android:layout_height="wrap_content" | 483 | android:layout_height="wrap_content" |
| 474 | android:layout_weight="2" | 484 | android:layout_weight="2" |
| 475 | android:hint="未填写" | 485 | android:hint="未填写" |
| 476 | android:maxLines="2" | 486 | android:maxLines="2" |
| 477 | android:ellipsize="end" | 487 | android:ellipsize="end" |
| 478 | android:textSize="20sp" /> | 488 | android:textSize="20sp" /> |
| 479 | </LinearLayout> | 489 | </LinearLayout> |
| 480 | 490 | ||
| 481 | <LinearLayout | 491 | <LinearLayout |
| 482 | android:layout_width="match_parent" | 492 | android:layout_width="match_parent" |
| 483 | android:layout_height="wrap_content" | 493 | android:layout_height="wrap_content" |
| 484 | android:layout_marginTop="15dp" | 494 | android:layout_marginTop="15dp" |
| 485 | android:gravity="center_vertical" | 495 | android:gravity="center_vertical" |
| 486 | android:orientation="horizontal"> | 496 | android:orientation="horizontal"> |
| 487 | 497 | ||
| 488 | <TextView | 498 | <TextView |
| 489 | android:layout_width="0dp" | 499 | android:layout_width="0dp" |
| 490 | android:layout_height="wrap_content" | 500 | android:layout_height="wrap_content" |
| 491 | android:layout_weight="1" | 501 | android:layout_weight="1" |
| 492 | android:text="生日" | 502 | android:text="生日" |
| 493 | android:textColor="@color/login_edittext_hint" | 503 | android:textColor="@color/login_edittext_hint" |
| 494 | 504 | ||
| 495 | android:textSize="20sp" /> | 505 | android:textSize="20sp" /> |
| 496 | 506 | ||
| 497 | <TextView | 507 | <TextView |
| 498 | android:id="@+id/tv_useinfo_birthday" | 508 | android:id="@+id/tv_useinfo_birthday" |
| 499 | android:layout_width="0dp" | 509 | android:layout_width="0dp" |
| 500 | android:layout_height="wrap_content" | 510 | android:layout_height="wrap_content" |
| 501 | android:layout_weight="2" | 511 | android:layout_weight="2" |
| 502 | android:hint="未填写" | 512 | android:hint="未填写" |
| 503 | android:textSize="20sp" /> | 513 | android:textSize="20sp" /> |
| 504 | 514 | ||
| 505 | <TextView | 515 | <TextView |
| 506 | android:layout_width="1dp" | 516 | android:layout_width="1dp" |
| 507 | android:layout_height="wrap_content" | 517 | android:layout_height="wrap_content" |
| 508 | android:layout_weight="1" | 518 | android:layout_weight="1" |
| 509 | android:textColor="@color/login_edittext_hint" | 519 | android:textColor="@color/login_edittext_hint" |
| 510 | 520 | ||
| 511 | android:text="学校" | 521 | android:text="学校" |
| 512 | android:textSize="20sp" /> | 522 | android:textSize="20sp" /> |
| 513 | 523 | ||
| 514 | <TextView | 524 | <TextView |
| 515 | android:id="@+id/tv_useinfo_school" | 525 | android:id="@+id/tv_useinfo_school" |
| 516 | android:layout_width="0dp" | 526 | android:layout_width="0dp" |
| 517 | android:layout_height="wrap_content" | 527 | android:layout_height="wrap_content" |
| 518 | android:layout_weight="2" | 528 | android:layout_weight="2" |
| 519 | android:hint="未填写" | 529 | android:hint="未填写" |
| 520 | android:textSize="20sp" /> | 530 | android:textSize="20sp" /> |
| 521 | </LinearLayout> | 531 | </LinearLayout> |
| 522 | 532 | ||
| 523 | <LinearLayout | 533 | <LinearLayout |
| 524 | android:layout_width="match_parent" | 534 | android:layout_width="match_parent" |
| 525 | android:layout_height="wrap_content" | 535 | android:layout_height="wrap_content" |
| 526 | android:layout_marginTop="15dp" | 536 | android:layout_marginTop="15dp" |
| 527 | android:gravity="center_vertical" | 537 | android:gravity="center_vertical" |
| 528 | android:orientation="horizontal"> | 538 | android:orientation="horizontal"> |
| 529 | 539 | ||
| 530 | <TextView | 540 | <TextView |
| 531 | android:layout_width="0dp" | 541 | android:layout_width="0dp" |
| 532 | android:layout_height="wrap_content" | 542 | android:layout_height="wrap_content" |
| 533 | android:layout_weight="1" | 543 | android:layout_weight="1" |
| 534 | android:textColor="@color/login_edittext_hint" | 544 | android:textColor="@color/login_edittext_hint" |
| 535 | android:text=" Q Q" | 545 | android:text=" Q Q" |
| 536 | android:textSize="20sp" /> | 546 | android:textSize="20sp" /> |
| 537 | 547 | ||
| 538 | <TextView | 548 | <TextView |
| 539 | android:id="@+id/tv_useinfo_qq" | 549 | android:id="@+id/tv_useinfo_qq" |
| 540 | android:layout_width="0dp" | 550 | android:layout_width="0dp" |
| 541 | android:layout_height="wrap_content" | 551 | android:layout_height="wrap_content" |
| 542 | android:layout_weight="2" | 552 | android:layout_weight="2" |
| 543 | android:hint="未填写" | 553 | android:hint="未填写" |
| 544 | android:textSize="20sp" /> | 554 | android:textSize="20sp" /> |
| 545 | 555 | ||
| 546 | <TextView | 556 | <TextView |
| 547 | android:layout_width="1dp" | 557 | android:layout_width="1dp" |
| 548 | android:layout_height="wrap_content" | 558 | android:layout_height="wrap_content" |
| 549 | android:layout_weight="1" | 559 | android:layout_weight="1" |
| 550 | android:text="年级" | 560 | android:text="年级" |
| 551 | android:textColor="@color/login_edittext_hint" | 561 | android:textColor="@color/login_edittext_hint" |
| 552 | 562 | ||
| 553 | android:textSize="20sp" /> | 563 | android:textSize="20sp" /> |
| 554 | 564 | ||
| 555 | <TextView | 565 | <TextView |
| 556 | android:id="@+id/tv_useinfo_gender" | 566 | android:id="@+id/tv_useinfo_gender" |
| 557 | android:layout_width="0dp" | 567 | android:layout_width="0dp" |
| 558 | android:layout_height="wrap_content" | 568 | android:layout_height="wrap_content" |
| 559 | android:layout_weight="2" | 569 | android:layout_weight="2" |
| 560 | android:hint="未填写" | 570 | android:hint="未填写" |
| 561 | android:textSize="20sp" /> | 571 | android:textSize="20sp" /> |
| 562 | </LinearLayout> | 572 | </LinearLayout> |
| 563 | 573 | ||
| 564 | 574 | ||
| 565 | </LinearLayout> | 575 | </LinearLayout> |
| 566 | <View | 576 | <View |
| 567 | android:layout_width="match_parent" | 577 | android:layout_width="match_parent" |
| 568 | android:layout_height="0.7dp" | 578 | android:layout_height="0.7dp" |
| 569 | android:layout_marginTop="40dp" | 579 | android:layout_marginTop="40dp" |
| 570 | android:background="@color/cutoff_line"> | 580 | android:background="@color/cutoff_line"> |
| 571 | 581 | ||
| 572 | </View> | 582 | </View> |
| 573 | <LinearLayout | 583 | <LinearLayout |
| 574 | android:layout_width="match_parent" | 584 | android:layout_width="match_parent" |
| 575 | android:layout_height="wrap_content" | 585 | android:layout_height="wrap_content" |
| 576 | android:layout_margin="10dp" | 586 | android:layout_margin="10dp" |
| 577 | android:gravity="center_vertical" | 587 | android:gravity="center_vertical" |
| 578 | android:orientation="horizontal"> | 588 | android:orientation="horizontal"> |
| 579 | 589 | ||
| 580 | <View | 590 | <View |
| 581 | android:layout_width="5dp" | 591 | android:layout_width="5dp" |
| 582 | android:layout_height="20dp" | 592 | android:layout_height="20dp" |
| 583 | android:layout_marginTop="10dp" | 593 | android:layout_marginTop="10dp" |
| 584 | android:background="@color/login_text_blue"> | 594 | android:background="@color/login_text_blue"> |
| 585 | 595 | ||
| 586 | </View> | 596 | </View> |
| 587 | 597 | ||
| 588 | <TextView | 598 | <TextView |
| 589 | android:layout_width="wrap_content" | 599 | android:layout_width="wrap_content" |
| 590 | android:layout_height="wrap_content" | 600 | android:layout_height="wrap_content" |
| 591 | android:layout_marginTop="10dp" | 601 | android:layout_marginTop="10dp" |
| 592 | android:layout_marginLeft="5dp" | 602 | android:layout_marginLeft="5dp" |
| 593 | android:text="版本信息" | 603 | android:text="版本信息" |
| 594 | android:textSize="22sp" /> | 604 | android:textSize="22sp" /> |
| 595 | 605 | ||
| 596 | </LinearLayout> | 606 | </LinearLayout> |
| 597 | 607 | ||
| 598 | <LinearLayout | 608 | <LinearLayout |
| 599 | android:layout_width="wrap_content" | 609 | android:layout_width="wrap_content" |
| 600 | android:layout_height="wrap_content" | 610 | android:layout_height="wrap_content" |
| 601 | android:orientation="vertical" | 611 | android:orientation="vertical" |
| 602 | android:gravity="center"> | 612 | android:gravity="center"> |
| 603 | 613 | ||
| 604 | 614 | ||
| 605 | <GridView | 615 | <GridView |
| 606 | android:id="@+id/id_recyclerview_pubish" | 616 | android:id="@+id/id_recyclerview_pubish" |
| 607 | android:layout_margin="3dp" | 617 | android:layout_margin="3dp" |
| 608 | android:layout_width="match_parent" | 618 | android:layout_width="match_parent" |
| 609 | android:layout_height="wrap_content" | 619 | android:layout_height="wrap_content" |
| 610 | android:gravity="center_vertical" | 620 | android:gravity="center_vertical" |
| 611 | android:verticalSpacing="20dp" | 621 | android:verticalSpacing="20dp" |
| 612 | android:numColumns="5"> | 622 | android:numColumns="5"> |
| 613 | 623 | ||
| 614 | </GridView> | 624 | </GridView> |
| 615 | 625 | ||
| 616 | 626 | ||
| 617 | </LinearLayout> | 627 | </LinearLayout> |
| 618 | 628 | ||
| 619 | 629 | ||
| 620 | </LinearLayout> | 630 | </LinearLayout> |
| 621 | <LinearLayout | 631 | <LinearLayout |
| 622 | android:layout_width="0dp" | 632 | android:layout_width="0dp" |
| 623 | android:layout_height="match_parent" | 633 | android:layout_height="match_parent" |
| 624 | android:layout_weight="1" | 634 | android:layout_weight="1" |
| 625 | android:background="@color/bgstudy_laout" | 635 | android:background="@color/bgstudy_laout" |
| 626 | android:orientation="vertical"> | 636 | android:orientation="vertical"> |
| 627 | <LinearLayout | 637 | <LinearLayout |
| 628 | android:layout_width="match_parent" | 638 | android:layout_width="match_parent" |
| 629 | android:layout_height="wrap_content" | 639 | android:layout_height="wrap_content" |
| 630 | android:layout_margin="20dp" | 640 | android:layout_margin="20dp" |
| 631 | android:gravity="center_vertical" | 641 | android:gravity="center_vertical" |
| 632 | android:orientation="horizontal"> | 642 | android:orientation="horizontal"> |
| 633 | 643 | ||
| 634 | <View | 644 | <View |
| 635 | android:layout_width="5dp" | 645 | android:layout_width="5dp" |
| 636 | android:layout_height="20dp" | 646 | android:layout_height="20dp" |
| 637 | android:background="@color/login_text_blue"> | 647 | android:background="@color/login_text_blue"> |
| 638 | 648 | ||
| 639 | </View> | 649 | </View> |
| 640 | 650 | ||
| 641 | <TextView | 651 | <TextView |
| 642 | android:layout_width="wrap_content" | 652 | android:layout_width="wrap_content" |
| 643 | android:layout_height="wrap_content" | 653 | android:layout_height="wrap_content" |
| 644 | android:layout_marginLeft="5dp" | 654 | android:layout_marginLeft="5dp" |
| 645 | android:text="最近学习" | 655 | android:text="最近学习" |
| 646 | android:textSize="22sp" /> | 656 | android:textSize="22sp" /> |
| 647 | 657 | ||
| 648 | </LinearLayout> | 658 | </LinearLayout> |
| 649 | 659 | ||
| 650 | <LinearLayout | 660 | <LinearLayout |
| 651 | android:layout_width="match_parent" | 661 | android:layout_width="match_parent" |
| 652 | android:layout_height="match_parent" | 662 | android:layout_height="match_parent" |
| 653 | android:gravity="center" | 663 | android:gravity="center" |
| 654 | android:orientation="vertical" | 664 | android:orientation="vertical" |
| 655 | > | 665 | > |
| 656 | <LinearLayout | 666 | <LinearLayout |
| 657 | android:id="@+id/view_novedeo" | 667 | android:id="@+id/view_novedeo" |
| 658 | android:layout_width="match_parent" | 668 | android:layout_width="match_parent" |
| 659 | android:layout_height="match_parent" | 669 | android:layout_height="match_parent" |
| 660 | android:gravity="center" | 670 | android:gravity="center" |
| 661 | android:orientation="vertical"> | 671 | android:orientation="vertical"> |
| 662 | <ImageView | 672 | <ImageView |
| 663 | android:layout_width="wrap_content" | 673 | android:layout_width="wrap_content" |
| 664 | android:layout_height="wrap_content" | 674 | android:layout_height="wrap_content" |
| 665 | android:src="@mipmap/nostudy"/> | 675 | android:src="@mipmap/nostudy"/> |
| 666 | <TextView | 676 | <TextView |
| 667 | android:layout_width="wrap_content" | 677 | android:layout_width="wrap_content" |
| 668 | android:layout_height="wrap_content" | 678 | android:layout_height="wrap_content" |
| 669 | android:layout_marginTop="20dp" | 679 | android:layout_marginTop="20dp" |
| 670 | android:text="小主人最近还没有学习哦" | 680 | android:text="小主人最近还没有学习哦" |
| 671 | android:textSize="14sp" /> | 681 | android:textSize="14sp" /> |
| 672 | <TextView | 682 | <TextView |
| 673 | android:layout_width="wrap_content" | 683 | android:layout_width="wrap_content" |
| 674 | android:layout_height="wrap_content" | 684 | android:layout_height="wrap_content" |
| 675 | android:text="快去学习吧" | 685 | android:text="快去学习吧" |
| 676 | android:textSize="14sp" /> | 686 | android:textSize="14sp" /> |
| 677 | </LinearLayout> | 687 | </LinearLayout> |
| 678 | <android.support.v7.widget.RecyclerView | 688 | <android.support.v7.widget.RecyclerView |
| 679 | android:id="@+id/id_recyclerview_horizontal" | 689 | android:id="@+id/id_recyclerview_horizontal" |
| 680 | android:layout_width="wrap_content" | 690 | android:layout_width="wrap_content" |
| 681 | android:layout_height="wrap_content" | 691 | android:layout_height="wrap_content" |
| 692 | android:layout_marginLeft="20dp" | ||
| 682 | android:layout_gravity="top" | 693 | android:layout_gravity="top" |
| 683 | android:scrollbars="none" /> | 694 | android:scrollbars="none" /> |
| 684 | </LinearLayout> | 695 | </LinearLayout> |
| 685 | 696 | ||
| 686 | </LinearLayout> | 697 | </LinearLayout> |
| 687 | 698 | ||
| 688 | 699 | ||
| 689 | </LinearLayout> | 700 | </LinearLayout> |
| 690 | 701 | ||
| 691 | 702 | ||
| 692 | </LinearLayout> | 703 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
| 5 | android:layout_marginLeft="10dp" | 5 | android:layout_marginLeft="10dp" |
| 6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
| 7 | android:layout_height="wrap_content" | 7 | android:layout_height="wrap_content" |
| 8 | android:gravity="center"> | 8 | android:gravity="center"> |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | <com.facebook.drawee.view.SimpleDraweeView | 11 | <ImageView |
| 12 | android:id="@+id/image_publish" | 12 | android:id="@+id/image_publish" |
| 13 | android:layout_width="180dp" | 13 | android:layout_width="180dp" |
| 14 | android:layout_height="120dp" | 14 | android:layout_height="120dp" |
| 15 | android:layout_gravity="center" | 15 | android:layout_gravity="center" |
| 16 | android:background="@drawable/corcle_black_bg" | 16 | android:scaleType="centerCrop" |
| 17 | fresco:placeholderImage="@mipmap/header_default" | 17 | android:background="@drawable/corcle_black_bg" /> |
| 18 | fresco:placeholderImageScaleType="fitCenter" /> | ||
| 19 | 18 | ||
| 20 | <!-- <TextView | 19 | <!-- <TextView |
| 21 | 20 | ||
| 22 | android:layout_marginTop="5dp" | 21 | android:layout_marginTop="5dp" |
| 23 | android:textSize="18sp" | 22 | android:textSize="18sp" |
| 24 | android:layout_width="160dp" | 23 | android:layout_width="160dp" |
| 25 | android:layout_height="wrap_content" | 24 | android:layout_height="wrap_content" |
| 26 | android:width="100dp" | 25 | android:width="100dp" |
| 27 | android:singleLine="true" | 26 | android:singleLine="true" |
| 28 | android:gravity="center" | 27 | android:gravity="center" |
| 29 | android:ellipsize="end" | 28 | android:ellipsize="end" |
| 30 | android:textColor="@color/login_text_black" | 29 | android:textColor="@color/login_text_black" |
| 31 | android:text="" | 30 | android:text="" |
| 32 | />--> | 31 | />--> |
| 33 | <com.hjx.personalcenter.View.AutoHorizontalScrollTextView | 32 | <com.hjx.personalcenter.View.AutoHorizontalScrollTextView |
| 34 | android:layout_marginTop="5dp" | 33 | android:layout_marginTop="5dp" |
| 35 | android:textSize="20sp" | 34 | android:textSize="20sp" |
| 36 | android:id="@+id/subject" | 35 | android:id="@+id/subject" |
| 37 | android:layout_width="160dp" | 36 | android:layout_width="160dp" |
| 38 | android:width="100dp" | 37 | android:width="100dp" |
| 39 | android:gravity="center" | 38 | android:gravity="center" |
| 40 | android:textColor="@color/login_text_black" | 39 | android:textColor="@color/login_text_black" |
| 41 | android:layout_height="wrap_content" | 40 | android:layout_height="wrap_content" |
| 42 | android:singleLine="true" | 41 | android:singleLine="true" |
| 43 | android:padding="5dp"/> | 42 | android:padding="5dp"/> |
| 44 | 43 | ||
| 45 | </LinearLayout> | 44 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes2.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
| 5 | android:layout_width="wrap_content" | 5 | android:layout_width="wrap_content" |
| 6 | android:layout_height="wrap_content" | 6 | android:layout_height="wrap_content" |
| 7 | android:layout_marginLeft="10dp" | 7 | android:layout_marginLeft="10dp" |
| 8 | android:gravity="center"> | 8 | android:gravity="center"> |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | <com.facebook.drawee.view.SimpleDraweeView | 11 | <ImageView |
| 12 | android:id="@+id/image_publish" | 12 | android:id="@+id/image_publish" |
| 13 | android:layout_width="80dp" | 13 | android:layout_width="80dp" |
| 14 | android:layout_height="100dp" | 14 | android:layout_height="100dp" |
| 15 | android:layout_gravity="center" | 15 | android:layout_gravity="center" |
| 16 | fresco:placeholderImage="@mipmap/bgsubject" | 16 | android:scaleType="centerCrop" /> |
| 17 | fresco:placeholderImageScaleType="fitCenter" /> | ||
| 18 | 17 | ||
| 19 | <TextView | 18 | <TextView |
| 20 | android:id="@+id/subject" | 19 | android:id="@+id/subject" |
| 21 | android:layout_marginTop="5dp" | 20 | android:layout_marginTop="5dp" |
| 22 | android:textSize="18sp" | 21 | android:textSize="18sp" |
| 23 | android:width="80dp" | 22 | android:width="80dp" |
| 24 | android:singleLine="true" | 23 | android:singleLine="true" |
| 25 | android:ellipsize="end" | 24 | android:ellipsize="end" |
| 26 | android:gravity="center" | 25 | android:gravity="center" |
| 27 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
| 28 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
| 29 | android:textColor="@color/login_text_black" | 28 | android:textColor="@color/login_text_black" |
| 30 | android:text="" | 29 | android:text="" |
| 31 | /> | 30 | /> |
| 32 | <TextView | 31 | <TextView |
| 33 | android:id="@+id/tv_publish" | 32 | android:id="@+id/tv_publish" |
| 34 | android:layout_marginTop="10dp" | 33 | android:layout_marginTop="10dp" |
| 35 | android:textSize="16sp" | 34 | android:textSize="16sp" |
| 36 | android:width="80dp" | 35 | android:width="80dp" |
| 37 | android:singleLine="true" | 36 | android:singleLine="true" |
| 38 | android:ellipsize="end" | 37 | android:ellipsize="end" |
| 39 | android:layout_width="80dp" | 38 | android:layout_width="80dp" |
| 40 | android:gravity="center" | 39 | android:gravity="center" |
| 41 | android:layout_height="wrap_content" | 40 | android:layout_height="wrap_content" |
| 42 | android:textColor="@color/login_text_black" | 41 | android:textColor="@color/login_text_black" |
| 43 | android:text="" | 42 | android:text="" |
| 44 | /> | 43 | /> |
| 45 | 44 | ||
| 46 | </LinearLayout> | 45 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes3.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| 7 | android:gravity="center"> | 7 | android:gravity="center"> |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | <com.facebook.drawee.view.SimpleDraweeView | 10 | <ImageView |
| 11 | android:id="@+id/image_publish" | 11 | android:id="@+id/image_publish" |
| 12 | android:layout_width="100dp" | 12 | android:layout_width="100dp" |
| 13 | android:layout_height="150dp" | 13 | android:layout_height="150dp" |
| 14 | android:layout_gravity="center" | 14 | android:layout_gravity="center" |
| 15 | fresco:placeholderImageScaleType="fitCenter" /> | 15 | android:scaleType="centerCrop"/> |
| 16 | 16 | ||
| 17 | <TextView | 17 | <TextView |
| 18 | android:id="@+id/subject" | 18 | android:id="@+id/subject" |
| 19 | android:layout_marginTop="5dp" | 19 | android:layout_marginTop="5dp" |
| 20 | android:textSize="22sp" | 20 | android:textSize="22sp" |
| 21 | android:gravity="center" | 21 | android:gravity="center" |
| 22 | android:layout_width="match_parent" | 22 | android:layout_width="match_parent" |
| 23 | android:layout_height="wrap_content" | 23 | android:layout_height="wrap_content" |
| 24 | android:textColor="@color/login_text_black" | 24 | android:textColor="@color/login_text_black" |
| 25 | android:text="" | 25 | android:text="" |
| 26 | /> | 26 | /> |
| 27 | <TextView | 27 | <TextView |
| 28 | android:id="@+id/tv_publish" | 28 | android:id="@+id/tv_publish" |
| 29 | android:layout_marginTop="10dp" | 29 | android:layout_marginTop="10dp" |
| 30 | android:textSize="18sp" | 30 | android:textSize="18sp" |
| 31 | android:layout_width="wrap_content" | 31 | android:layout_width="wrap_content" |
| 32 | android:gravity="center" | 32 | android:gravity="center" |
| 33 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
| 34 | android:textColor="@color/login_text_black" | 34 | android:textColor="@color/login_text_black" |
| 35 | android:text="" | 35 | android:text="" |
| 36 | /> | 36 | /> |
| 37 | 37 | ||
| 38 | </LinearLayout> | 38 | </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 | <ImageView |
| 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 | /> |
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | <TextView | 18 | <TextView |
| 19 | android:id="@+id/tv_publish" | 19 | android:id="@+id/tv_publish" |
| 20 | android:layout_width="80dp" | 20 | android:layout_width="80dp" |
| 21 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
| 22 | android:layout_marginTop="5dp" | 22 | android:layout_marginTop="5dp" |
| 23 | android:width="80dp" | 23 | android:width="80dp" |
| 24 | android:ellipsize="end" | 24 | android:ellipsize="end" |
| 25 | android:gravity="center" | 25 | android:gravity="center" |
| 26 | android:singleLine="true" | 26 | android:singleLine="true" |
| 27 | android:text="" | 27 | android:text="" |
| 28 | android:textColor="@color/login_text_black" | 28 | android:textColor="@color/login_text_black" |
| 29 | android:textSize="16sp" /> | 29 | android:textSize="16sp" /> |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | </LinearLayout> | 32 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/recycler_childaccunt_item_view.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
| 5 | android:layout_width="400dp" | 5 | android:layout_width="400dp" |
| 6 | android:layout_height="match_parent"> | 6 | android:layout_height="match_parent"> |
| 7 | <LinearLayout | 7 | <LinearLayout |
| 8 | android:id="@+id/ll_backgrangd" | 8 | android:id="@+id/ll_backgrangd" |
| 9 | android:layout_width="wrap_content" | 9 | android:layout_width="wrap_content" |
| 10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
| 11 | android:background="@drawable/corcle_black_bg" | 11 | android:background="@drawable/corcle_black_bg" |
| 12 | android:orientation="vertical"> | 12 | android:orientation="vertical"> |
| 13 | 13 | ||
| 14 | <LinearLayout | 14 | <LinearLayout |
| 15 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
| 16 | android:layout_height="wrap_content" | 16 | android:layout_height="wrap_content" |
| 17 | android:background="@mipmap/zizhanghu" | 17 | android:background="@mipmap/zizhanghu" |
| 18 | android:orientation="horizontal"> | 18 | android:orientation="horizontal"> |
| 19 | <com.facebook.drawee.view.SimpleDraweeView | 19 | <com.hjx.personalcenter.View.RoundImageView60dip |
| 20 | android:id="@+id/iv_child_head" | 20 | android:id="@+id/iv_child_head" |
| 21 | android:layout_width="60dp" | 21 | android:layout_width="60dp" |
| 22 | android:layout_height="60dp" | 22 | android:layout_height="60dp" |
| 23 | android:layout_margin="10dp" | 23 | android:layout_margin="10dp" |
| 24 | fresco:placeholderImage="@mipmap/header_default" | 24 | android:scaleType="centerCrop" |
| 25 | fresco:roundAsCircle="true" | 25 | android:background="@mipmap/header_default" |
| 26 | fresco:placeholderImageScaleType="fitCenter" /> | 26 | /> |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | <LinearLayout | 29 | <LinearLayout |
| 30 | android:layout_width="0dp" | 30 | android:layout_width="0dp" |
| 31 | android:layout_height="wrap_content" | 31 | android:layout_height="wrap_content" |
| 32 | android:layout_marginLeft="10dp" | 32 | android:layout_marginLeft="10dp" |
| 33 | android:layout_marginTop="10dp" | 33 | android:layout_marginTop="10dp" |
| 34 | android:layout_weight="1" | 34 | android:layout_weight="1" |
| 35 | android:orientation="vertical"> | 35 | android:orientation="vertical"> |
| 36 | 36 | ||
| 37 | <TextView | 37 | <TextView |
| 38 | android:id="@+id/iv_child_name" | 38 | android:id="@+id/iv_child_name" |
| 39 | android:layout_width="wrap_content" | 39 | android:layout_width="wrap_content" |
| 40 | android:layout_height="wrap_content" | 40 | android:layout_height="wrap_content" |
| 41 | android:text="" | 41 | android:text="" |
| 42 | android:textSize="18sp" /> | 42 | android:textSize="18sp" /> |
| 43 | 43 | ||
| 44 | <TextView | 44 | <TextView |
| 45 | android:id="@+id/iv_child_grade" | 45 | android:id="@+id/iv_child_grade" |
| 46 | android:layout_width="wrap_content" | 46 | android:layout_width="wrap_content" |
| 47 | android:layout_height="wrap_content" | 47 | android:layout_height="wrap_content" |
| 48 | android:text="" | 48 | android:text="" |
| 49 | android:textSize="18sp" /> | 49 | android:textSize="18sp" /> |
| 50 | 50 | ||
| 51 | <TextView | 51 | <TextView |
| 52 | android:id="@+id/iv_child_school" | 52 | android:id="@+id/iv_child_school" |
| 53 | android:layout_width="wrap_content" | 53 | android:layout_width="wrap_content" |
| 54 | android:layout_height="wrap_content" | 54 | android:layout_height="wrap_content" |
| 55 | android:text="" | 55 | android:text="" |
| 56 | android:textSize="18sp" /> | 56 | android:textSize="18sp" /> |
| 57 | 57 | ||
| 58 | <TextView | 58 | <TextView |
| 59 | android:id="@+id/iv_child_adress" | 59 | android:id="@+id/iv_child_adress" |
| 60 | android:layout_width="wrap_content" | 60 | android:layout_width="wrap_content" |
| 61 | android:layout_height="wrap_content" | 61 | android:layout_height="wrap_content" |
| 62 | android:text="" | 62 | android:text="" |
| 63 | android:textSize="18sp" /> | 63 | android:textSize="18sp" /> |
| 64 | 64 | ||
| 65 | </LinearLayout> | 65 | </LinearLayout> |
| 66 | <ImageView | 66 | <ImageView |
| 67 | android:id="@+id/iv_using_pic" | 67 | android:id="@+id/iv_using_pic" |
| 68 | android:layout_width="wrap_content" | 68 | android:layout_width="wrap_content" |
| 69 | android:layout_height="wrap_content" | 69 | android:layout_height="wrap_content" |
| 70 | android:layout_gravity="right" | 70 | android:layout_gravity="right" |
| 71 | android:layout_marginLeft="60dp" | 71 | android:layout_marginLeft="60dp" |
| 72 | android:visibility="gone" | 72 | android:visibility="gone" |
| 73 | android:src="@mipmap/shiyongzhong" /> | 73 | android:src="@mipmap/shiyongzhong" /> |
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | 76 | ||
| 77 | </LinearLayout> | 77 | </LinearLayout> |
| 78 | 78 | ||
| 79 | <View | 79 | <View |
| 80 | android:layout_width="wrap_content" | 80 | android:layout_width="wrap_content" |
| 81 | android:layout_height="0.7dp" | 81 | android:layout_height="0.7dp" |
| 82 | android:layout_marginBottom="10dp" | 82 | android:layout_marginBottom="10dp" |
| 83 | android:background="@color/cutoff_line"> | 83 | android:background="@color/cutoff_line"> |
| 84 | 84 | ||
| 85 | </View> | 85 | </View> |
| 86 | 86 | ||
| 87 | <LinearLayout | 87 | <LinearLayout |
| 88 | android:layout_width="match_parent" | 88 | android:layout_width="match_parent" |
| 89 | android:layout_height="wrap_content" | 89 | android:layout_height="wrap_content" |
| 90 | android:layout_marginBottom="10dp" | 90 | android:layout_marginBottom="10dp" |
| 91 | android:orientation="horizontal"> | 91 | android:orientation="horizontal"> |
| 92 | 92 | ||
| 93 | <TextView | 93 | <TextView |
| 94 | android:id="@+id/delete_child_account" | 94 | android:id="@+id/delete_child_account" |
| 95 | android:layout_width="0dp" | 95 | android:layout_width="0dp" |
| 96 | android:layout_height="wrap_content" | 96 | android:layout_height="wrap_content" |
| 97 | android:layout_weight="1" | 97 | android:layout_weight="1" |
| 98 | android:gravity="center" | 98 | android:gravity="center" |
| 99 | android:text="删除用户" | 99 | android:text="删除用户" |
| 100 | android:textSize="18sp" /> | 100 | android:textSize="18sp" /> |
| 101 | 101 | ||
| 102 | <TextView | 102 | <TextView |
| 103 | android:id="@+id/chang_account" | 103 | android:id="@+id/chang_account" |
| 104 | android:layout_width="0dp" | 104 | android:layout_width="0dp" |
| 105 | android:layout_height="wrap_content" | 105 | android:layout_height="wrap_content" |
| 106 | android:layout_weight="1" | 106 | android:layout_weight="1" |
| 107 | android:gravity="center" | 107 | android:gravity="center" |
| 108 | android:text="切换使用" | 108 | android:text="切换使用" |
| 109 | android:textSize="18sp" /> | 109 | android:textSize="18sp" /> |
| 110 | 110 | ||
| 111 | 111 | ||
| 112 | </LinearLayout> | 112 | </LinearLayout> |
| 113 | 113 | ||
| 114 | </LinearLayout> | 114 | </LinearLayout> |
| 115 | 115 | ||
| 116 | </LinearLayout> | 116 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/recycler_study_tem_view.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:layout_width="120dp" | 3 | android:layout_width="120dp" |
| 4 | android:layout_height="120dp" | 4 | android:layout_height="120dp" |
| 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto"> | 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto"> |
| 6 | <com.facebook.drawee.view.SimpleDraweeView | 6 | <ImageView |
| 7 | android:id="@+id/id_index_gallery_item_image" | 7 | android:id="@+id/id_index_gallery_item_image" |
| 8 | android:layout_width="60dp" | 8 | android:layout_width="60dp" |
| 9 | android:layout_height="60dp" | 9 | android:layout_height="60dp" |
| 10 | android:scaleType="centerCrop" | ||
| 11 | android:layout_alignParentTop="true" | 10 | android:layout_alignParentTop="true" |
| 12 | android:layout_centerHorizontal="true" | 11 | android:layout_centerHorizontal="true" |
| 13 | fresco:placeholderImage="@mipmap/header_default" | 12 | android:scaleType="centerCrop" |
| 14 | fresco:roundAsCircle="true" | 13 | android:background="@mipmap/header_default" /> |
| 15 | fresco:placeholderImageScaleType="fitCenter" /> | ||
| 16 | <TextView | 14 | <TextView |
| 17 | android:id="@+id/id_index_gallery_item_text" | 15 | android:id="@+id/id_index_gallery_item_text" |
| 18 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
| 19 | android:layout_height="wrap_content" | 17 | android:layout_height="wrap_content" |
| 20 | android:layout_below="@id/id_index_gallery_item_image" | 18 | android:layout_below="@id/id_index_gallery_item_image" |
| 21 | android:layout_centerHorizontal="true" | 19 | android:layout_centerHorizontal="true" |
| 22 | android:layout_marginBottom="5dp" | 20 | android:layout_marginBottom="5dp" |
| 23 | android:layout_marginTop="5dp" | 21 | android:layout_marginTop="5dp" |
| 24 | android:textColor="#ff0000" | 22 | android:textColor="#ff0000" |
| 25 | android:text="some info" | 23 | android:text="some info" |
| 26 | android:textSize="12dp" /> | 24 | android:textSize="12dp" /> |
| 27 | 25 | ||
| 28 | </RelativeLayout> | 26 | </RelativeLayout> |
PersonalCenter/app/src/main/res/mipmap-hdpi/ahah.png
1.19 KB
PersonalCenter/app/src/main/res/mipmap-hdpi/head_bg.png
151 KB
PersonalCenter/app/src/main/res/mipmap-hdpi/vidio_bg.png
3.23 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/head_bg.png
93.7 KB
PersonalCenter/app/src/main/res/values/colors.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <resources> | 2 | <resources> |
| 3 | <color name="colorPrimary">#3F51B5</color> | 3 | <color name="colorPrimary">#3F51B5</color> |
| 4 | <color name="colorPrimaryDark">#303F9F</color> | 4 | <color name="colorPrimaryDark">#303F9F</color> |
| 5 | <color name="colorAccent">#FF4081</color> | 5 | <color name="colorAccent">#FF4081</color> |
| 6 | <color name="white">#ffffffff</color> | 6 | <color name="white">#ffffffff</color> |
| 7 | <color name="login_edittext_hint">#afafaf</color> | 7 | <color name="login_edittext_hint">#afafaf</color> |
| 8 | <color name="login_text_blue">#1cb8ff</color> | 8 | <color name="login_text_blue">#1cb8ff</color> |
| 9 | <color name="login_text_black">#313131</color> | 9 | <color name="login_text_black">#313131</color> |
| 10 | <color name="login_edittext_normal">#d4d4d4</color> | 10 | <color name="login_edittext_normal">#d4d4d4</color> |
| 11 | <color name="error_hint">#ED1c24</color> | 11 | <color name="error_hint">#ED1c24</color> |
| 12 | <color name="login_edittext_pressed">#1cb8ff</color> | 12 | <color name="login_edittext_pressed">#1cb8ff</color> |
| 13 | <color name="cutoff_line">#CCCCCC</color> | 13 | <color name="cutoff_line">#CCCCCC</color> |
| 14 | <color name="electronic_card">#ff480f</color> | 14 | <color name="electronic_card">#ff480f</color> |
| 15 | <color name="electronic_text">#afafaf</color> | 15 | <color name="electronic_text">#afafaf</color> |
| 16 | <color name="backgerangde_laout">#eeeeee</color> | 16 | <color name="backgerangde_laout">#eeeeee</color> |
| 17 | <color name="bgstudy_laout">#F0F0F0</color> | 17 | <color name="bgstudy_laout">#F0F0F0</color> |
| 18 | <color name="bgstudy_baoka">#0088c6</color> | ||
| 19 | |||
| 20 | |||
| 18 | 21 | ||
| 19 | </resources> | 22 | </resources> |
| 20 | 23 |