Commit 5750ce3862b0873cc0ef55ece46e48a6c530ef7d
1 parent
9c450bb01a
Exists in
master
获取版本信息接口,和AIDL生成JAR处理
Showing
29 changed files
with
620 additions
and
46 deletions
Show diff stats
PersonalCenter/.idea/gradle.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project version="4"> | 2 | <project version="4"> |
| 3 | <component name="GradleSettings"> | 3 | <component name="GradleSettings"> |
| 4 | <option name="linkedExternalProjectsSettings"> | 4 | <option name="linkedExternalProjectsSettings"> |
| 5 | <GradleProjectSettings> | 5 | <GradleProjectSettings> |
| 6 | <option name="distributionType" value="LOCAL" /> | 6 | <option name="distributionType" value="LOCAL" /> |
| 7 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> | 7 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> |
| 8 | <option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" /> | 8 | <option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" /> |
| 9 | <option name="modules"> | 9 | <option name="modules"> |
| 10 | <set> | 10 | <set> |
| 11 | <option value="$PROJECT_DIR$" /> | 11 | <option value="$PROJECT_DIR$" /> |
| 12 | <option value="$PROJECT_DIR$/app" /> | 12 | <option value="$PROJECT_DIR$/app" /> |
| 13 | <option value="$PROJECT_DIR$/circledialog" /> | 13 | <option value="$PROJECT_DIR$/circledialog" /> |
| 14 | <option value="$PROJECT_DIR$/mypresonallibrary" /> | ||
| 14 | <option value="$PROJECT_DIR$/pickerview" /> | 15 | <option value="$PROJECT_DIR$/pickerview" /> |
| 15 | </set> | 16 | </set> |
| 16 | </option> | 17 | </option> |
| 17 | <option name="resolveModulePerSourceSet" value="false" /> | 18 | <option name="resolveModulePerSourceSet" value="false" /> |
| 18 | </GradleProjectSettings> | 19 | </GradleProjectSettings> |
| 19 | </option> | 20 | </option> |
| 20 | </component> | 21 | </component> |
| 21 | </project> | 22 | </project> |
PersonalCenter/.idea/misc.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project version="4"> | 2 | <project version="4"> |
| 3 | <component name="EntryPointsManager"> | 3 | <component name="EntryPointsManager"> |
| 4 | <entry_points version="2.0" /> | 4 | <entry_points version="2.0" /> |
| 5 | </component> | 5 | </component> |
| 6 | <component name="NullableNotNullManager"> | 6 | <component name="NullableNotNullManager"> |
| 7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> | 7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> |
| 8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> | 8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> |
| 9 | <option name="myNullables"> | 9 | <option name="myNullables"> |
| 10 | <value> | 10 | <value> |
| 11 | <list size="4"> | 11 | <list size="4"> |
| 12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | 12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> |
| 13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | 13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> |
| 14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | 14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> |
| 15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | 15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> |
| 16 | </list> | 16 | </list> |
| 17 | </value> | 17 | </value> |
| 18 | </option> | 18 | </option> |
| 19 | <option name="myNotNulls"> | 19 | <option name="myNotNulls"> |
| 20 | <value> | 20 | <value> |
| 21 | <list size="4"> | 21 | <list size="4"> |
| 22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | 22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> |
| 23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | 23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> |
| 24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | 24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> |
| 25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | 25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> |
| 26 | </list> | 26 | </list> |
| 27 | </value> | 27 | </value> |
| 28 | </option> | 28 | </option> |
| 29 | </component> | 29 | </component> |
| 30 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> | 30 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> |
| 31 | <OptionsSetting value="true" id="Add" /> | 31 | <OptionsSetting value="true" id="Add" /> |
| 32 | <OptionsSetting value="true" id="Remove" /> | 32 | <OptionsSetting value="true" id="Remove" /> |
| 33 | <OptionsSetting value="true" id="Checkout" /> | 33 | <OptionsSetting value="true" id="Checkout" /> |
| 34 | <OptionsSetting value="true" id="Update" /> | 34 | <OptionsSetting value="true" id="Update" /> |
| 35 | <OptionsSetting value="true" id="Status" /> | 35 | <OptionsSetting value="true" id="Status" /> |
| 36 | <OptionsSetting value="true" id="Edit" /> | 36 | <OptionsSetting value="true" id="Edit" /> |
| 37 | <ConfirmationsSetting value="0" id="Add" /> | 37 | <ConfirmationsSetting value="0" id="Add" /> |
| 38 | <ConfirmationsSetting value="0" id="Remove" /> | 38 | <ConfirmationsSetting value="0" id="Remove" /> |
| 39 | </component> | 39 | </component> |
| 40 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 40 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
| 41 | <output url="file://$PROJECT_DIR$/build/classes" /> | 41 | <output url="file://$PROJECT_DIR$/build/classes" /> |
| 42 | </component> | 42 | </component> |
| 43 | <component name="ProjectType"> | 43 | <component name="ProjectType"> |
| 44 | <option name="id" value="Android" /> | 44 | <option name="id" value="Android" /> |
| 45 | </component> | 45 | </component> |
| 46 | </project> | 46 | </project> |
PersonalCenter/.idea/modules.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project version="4"> | 2 | <project version="4"> |
| 3 | <component name="ProjectModuleManager"> | 3 | <component name="ProjectModuleManager"> |
| 4 | <modules> | 4 | <modules> |
| 5 | <module fileurl="file://$PROJECT_DIR$/PersonalCenter.iml" filepath="$PROJECT_DIR$/PersonalCenter.iml" /> | 5 | <module fileurl="file://$PROJECT_DIR$/PersonalCenter.iml" filepath="$PROJECT_DIR$/PersonalCenter.iml" /> |
| 6 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> | 6 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> |
| 7 | <module fileurl="file://$PROJECT_DIR$/circledialog/circledialog.iml" filepath="$PROJECT_DIR$/circledialog/circledialog.iml" /> | 7 | <module fileurl="file://$PROJECT_DIR$/circledialog/circledialog.iml" filepath="$PROJECT_DIR$/circledialog/circledialog.iml" /> |
| 8 | <module fileurl="file://$PROJECT_DIR$/mypresonallibrary/mypresonallibrary.iml" filepath="$PROJECT_DIR$/mypresonallibrary/mypresonallibrary.iml" /> | ||
| 8 | <module fileurl="file://$PROJECT_DIR$/pickerview/pickerview.iml" filepath="$PROJECT_DIR$/pickerview/pickerview.iml" /> | 9 | <module fileurl="file://$PROJECT_DIR$/pickerview/pickerview.iml" filepath="$PROJECT_DIR$/pickerview/pickerview.iml" /> |
| 9 | </modules> | 10 | </modules> |
| 10 | </component> | 11 | </component> |
| 11 | </project> | 12 | </project> |
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 1 |
| 11 | versionName "1.0.0" | 11 | versionName "1.0.0" |
| 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 | sourceSets { | 21 | sourceSets { |
| 22 | main { | 22 | main { |
| 23 | jniLibs.srcDirs = ['libs'] | 23 | jniLibs.srcDirs = ['libs'] |
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | dependencies { | 28 | dependencies { |
| 29 | compile fileTree(include: ['*.jar'], dir: 'libs') | 29 | compile fileTree(include: ['*.jar'], dir: 'libs') |
| 30 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | 30 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { |
| 31 | exclude group: 'com.android.support', module: 'support-annotations' | 31 | exclude group: 'com.android.support', module: 'support-annotations' |
| 32 | }) | 32 | }) |
| 33 | compile 'com.tencent.bugly:crashreport:latest.release' | 33 | compile 'com.tencent.bugly:crashreport:latest.release' |
| 34 | compile 'org.apache.httpcomponents:httpcore:4.4.1' | 34 | compile 'org.apache.httpcomponents:httpcore:4.4.1' |
| 35 | compile 'org.apache.httpcomponents:httpclient:4.5' | 35 | compile 'org.apache.httpcomponents:httpclient:4.5' |
| 36 | compile 'com.android.support:appcompat-v7:25.3.1' | 36 | compile 'com.android.support:appcompat-v7:25.3.1' |
| 37 | testCompile 'junit:junit:4.12' | 37 | testCompile 'junit:junit:4.12' |
| 38 | compile project(':circledialog') | 38 | compile project(':circledialog') |
| 39 | compile project(':pickerview') | 39 | compile project(':pickerview') |
| 40 | compile files('libs/android-async-http-1.4.8.jar') | 40 | compile files('libs/android-async-http-1.4.8.jar') |
| 41 | compile 'com.google.code.gson:gson:2.7' | 41 | compile 'com.google.code.gson:gson:2.7' |
| 42 | compile 'com.zaaach:toprightmenu:1.0' | 42 | compile 'com.zaaach:toprightmenu:1.0' |
| 43 | compile 'com.facebook.fresco:fresco:1.1.0' | 43 | compile 'com.facebook.fresco:fresco:1.1.0' |
| 44 | compile 'com.android.support:recyclerview-v7:25.+' | 44 | compile 'com.android.support:recyclerview-v7:25.+' |
| 45 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' | 45 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' |
| 46 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' | 46 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' |
| 47 | compile 'com.google.zxing:core:3.3.0' | 47 | compile 'com.google.zxing:core:3.3.0' |
| 48 | compile 'com.google.zxing:android-core:3.3.0' | 48 | compile 'com.google.zxing:android-core:3.3.0' |
| 49 | compile project(':mypresonallibrary') | ||
| 49 | } | 50 | } |
| 50 | 51 |
PersonalCenter/app/src/main/AndroidManifest.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | package="com.hjx.personalcenter"> | 3 | package="com.hjx.personalcenter"> |
| 4 | 4 | ||
| 5 | <application | 5 | <application |
| 6 | android:name=".activity.MyApplication" | 6 | android:name=".activity.MyApplication" |
| 7 | android:allowBackup="true" | 7 | android:allowBackup="true" |
| 8 | android:icon="@mipmap/ic_launcher" | 8 | android:icon="@mipmap/ic_launcher" |
| 9 | android:label="@string/app_name" | 9 | android:label="@string/app_name" |
| 10 | android:supportsRtl="true" | 10 | android:supportsRtl="true" |
| 11 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> | 11 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> |
| 12 | <activity | 12 | <activity |
| 13 | android:name=".activity.MainActivity" | 13 | android:name=".activity.MainActivity" |
| 14 | android:launchMode="singleTask" | 14 | android:launchMode="singleTask" |
| 15 | android:screenOrientation="landscape"> | 15 | android:screenOrientation="landscape"> |
| 16 | </activity> | 16 | </activity> |
| 17 | <activity | 17 | <activity |
| 18 | android:name=".activity.LoginAndRegisterActivity" | 18 | android:name=".activity.LoginAndRegisterActivity" |
| 19 | android:launchMode="singleTask" | 19 | android:launchMode="singleTask" |
| 20 | 20 | ||
| 21 | android:screenOrientation="landscape"> | 21 | android:screenOrientation="landscape"> |
| 22 | <intent-filter> | 22 | <intent-filter> |
| 23 | <action android:name="android.intent.action.MAIN" /> | 23 | <action android:name="android.intent.action.MAIN" /> |
| 24 | 24 | ||
| 25 | <category android:name="android.intent.category.LAUNCHER" /> | 25 | <category android:name="android.intent.category.LAUNCHER" /> |
| 26 | </intent-filter> | 26 | </intent-filter> |
| 27 | 27 | ||
| 28 | </activity> | 28 | </activity> |
| 29 | <activity | 29 | <activity |
| 30 | android:name=".activity.ForgotPasswordActivity" | 30 | android:name=".activity.ForgotPasswordActivity" |
| 31 | android:launchMode="singleTask" | 31 | android:launchMode="singleTask" |
| 32 | android:screenOrientation="landscape"> | 32 | android:screenOrientation="landscape"> |
| 33 | 33 | ||
| 34 | </activity> | 34 | </activity> |
| 35 | <activity | 35 | <activity |
| 36 | android:name=".activity.ChangePasswordActivity" | 36 | android:name=".activity.ChangePasswordActivity" |
| 37 | android:launchMode="singleTask" | 37 | android:launchMode="singleTask" |
| 38 | android:screenOrientation="landscape"> | 38 | android:screenOrientation="landscape"> |
| 39 | 39 | ||
| 40 | </activity> | 40 | </activity> |
| 41 | <activity | 41 | <activity |
| 42 | android:name=".activity.RegisterInfoActivity" | 42 | android:name=".activity.RegisterInfoActivity" |
| 43 | android:launchMode="singleTask" | 43 | android:launchMode="singleTask" |
| 44 | android:screenOrientation="landscape"> | 44 | android:screenOrientation="landscape"> |
| 45 | 45 | ||
| 46 | </activity> | 46 | </activity> |
| 47 | <activity | 47 | <activity |
| 48 | android:name=".activity.ElectronicCardValidationActivity" | 48 | android:name=".activity.ElectronicCardValidationActivity" |
| 49 | android:launchMode="singleTask" | 49 | android:launchMode="singleTask" |
| 50 | android:screenOrientation="landscape"> | 50 | android:screenOrientation="landscape"> |
| 51 | 51 | ||
| 52 | </activity> | 52 | </activity> |
| 53 | <activity | 53 | <activity |
| 54 | android:name=".activity.ChangeBangDingActivity" | 54 | android:name=".activity.ChangeBangDingActivity" |
| 55 | android:launchMode="singleTask" | 55 | android:launchMode="singleTask" |
| 56 | android:screenOrientation="landscape"> | 56 | android:screenOrientation="landscape"> |
| 57 | 57 | ||
| 58 | </activity> | 58 | </activity> |
| 59 | <activity | 59 | <activity |
| 60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" | 60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" |
| 61 | android:launchMode="singleTask" | 61 | android:launchMode="singleTask" |
| 62 | android:screenOrientation="landscape"> | 62 | android:screenOrientation="landscape"> |
| 63 | 63 | ||
| 64 | </activity> | 64 | </activity> |
| 65 | <activity | 65 | <activity |
| 66 | android:name=".activity.ChangeEletronicCardPhoneActivity" | 66 | android:name=".activity.ChangeEletronicCardPhoneActivity" |
| 67 | android:launchMode="singleTask" | 67 | android:launchMode="singleTask" |
| 68 | android:screenOrientation="landscape"> | 68 | android:screenOrientation="landscape"> |
| 69 | 69 | ||
| 70 | </activity> | 70 | </activity> |
| 71 | <activity | 71 | <activity |
| 72 | android:name=".activity.ChoiseTextBookActivity" | 72 | android:name=".activity.ChoiseTextBookActivity" |
| 73 | android:launchMode="singleTask" | 73 | android:launchMode="singleTask" |
| 74 | android:screenOrientation="landscape"> | 74 | android:screenOrientation="landscape"> |
| 75 | 75 | ||
| 76 | </activity> | 76 | </activity> |
| 77 | <activity | 77 | <activity |
| 78 | android:name=".activity.TheStartPageActivity" | 78 | android:name=".activity.TheStartPageActivity" |
| 79 | android:launchMode="singleTask" | 79 | android:launchMode="singleTask" |
| 80 | android:screenOrientation="landscape"> | 80 | android:screenOrientation="landscape"> |
| 81 | 81 | ||
| 82 | </activity> | 82 | </activity> |
| 83 | <activity | 83 | <activity |
| 84 | android:name=".activity.ElectronicCardEditInfoActivity" | 84 | android:name=".activity.ElectronicCardEditInfoActivity" |
| 85 | android:launchMode="singleTask" | 85 | android:launchMode="singleTask" |
| 86 | android:screenOrientation="landscape"> | 86 | android:screenOrientation="landscape"> |
| 87 | 87 | ||
| 88 | </activity> | 88 | </activity> |
| 89 | <activity | 89 | <activity |
| 90 | android:name=".activity.ElectronicCardInfoOKActivity" | 90 | android:name=".activity.ElectronicCardInfoOKActivity" |
| 91 | android:launchMode="singleTask" | 91 | android:launchMode="singleTask" |
| 92 | android:screenOrientation="landscape"> | 92 | android:screenOrientation="landscape"> |
| 93 | 93 | ||
| 94 | </activity> | 94 | </activity> |
| 95 | <activity | 95 | <activity |
| 96 | android:name=".activity.ElectronicCardLookInfoActivity" | 96 | android:name=".activity.ElectronicCardLookInfoActivity" |
| 97 | android:launchMode="singleTask" | 97 | android:launchMode="singleTask" |
| 98 | android:screenOrientation="landscape"> | 98 | android:screenOrientation="landscape"> |
| 99 | 99 | ||
| 100 | </activity> | 100 | </activity> |
| 101 | <activity | 101 | <activity |
| 102 | android:name=".activity.FeedBackActivity" | 102 | android:name=".activity.FeedBackActivity" |
| 103 | android:launchMode="singleTask" | 103 | android:launchMode="singleTask" |
| 104 | android:screenOrientation="landscape"> | 104 | android:screenOrientation="landscape"> |
| 105 | 105 | ||
| 106 | </activity> | 106 | </activity> |
| 107 | <activity | 107 | <activity |
| 108 | android:name=".activity.AccountManagementActivity" | 108 | android:name=".activity.AccountManagementActivity" |
| 109 | android:launchMode="singleTask" | 109 | android:launchMode="singleTask" |
| 110 | android:screenOrientation="landscape"> | 110 | android:screenOrientation="landscape"> |
| 111 | 111 | ||
| 112 | </activity> | 112 | </activity> |
| 113 | <activity | 113 | <activity |
| 114 | android:name=".activity.ChangePresonalInfoActivity" | 114 | android:name=".activity.ChangePresonalInfoActivity" |
| 115 | android:launchMode="singleTask" | 115 | android:launchMode="singleTask" |
| 116 | android:screenOrientation="landscape"> | 116 | android:screenOrientation="landscape"> |
| 117 | 117 | ||
| 118 | </activity> | 118 | </activity> |
| 119 | <activity | 119 | <activity |
| 120 | android:name=".activity.BangDingCode" | 120 | android:name=".activity.BangDingCode" |
| 121 | android:launchMode="singleTask" | 121 | android:launchMode="singleTask" |
| 122 | android:screenOrientation="landscape"> | 122 | android:screenOrientation="landscape"> |
| 123 | 123 | ||
| 124 | </activity> | 124 | </activity> |
| 125 | <service | 125 | <service android:name="com.hjx.personalcenter.service.CenterService" |
| 126 | android:name="com.hjx.personalcenter.service.TestService" | 126 | android:enabled="true" |
| 127 | android:process=":remote" | 127 | android:exported="true"> |
| 128 | > | ||
| 129 | <intent-filter> | 128 | <intent-filter> |
| 130 | <action android:name="com.hjx.personalcenter.service.GetLoginInfoService"> | 129 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> |
| 131 | |||
| 132 | </action> | ||
| 133 | </intent-filter> | 130 | </intent-filter> |
| 134 | </service> | 131 | </service> |
| 135 | 132 | ||
| 136 | </application> | 133 | </application> |
| 137 | <!--权限--> | 134 | <!--权限--> |
| 138 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 135 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| 139 | <uses-permission android:name="android.permission.CAMERA" /> | 136 | <uses-permission android:name="android.permission.CAMERA" /> |
| 140 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 137 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
| 141 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | 138 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
| 142 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 139 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
| 143 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 140 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| 144 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 141 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| 145 | <uses-permission android:name="android.permission.CALL_PHONE" /> | 142 | <uses-permission android:name="android.permission.CALL_PHONE" /> |
| 146 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 143 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
| 147 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | 144 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> |
| 148 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 145 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
| 149 | <uses-permission android:name="android.permission.INTERNET" /> | 146 | <uses-permission android:name="android.permission.INTERNET" /> |
| 150 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 147 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
| 151 | <uses-permission android:name="android.permission.READ_LOGS" /> | 148 | <uses-permission android:name="android.permission.READ_LOGS" /> |
| 152 | 149 | ||
| 153 | </manifest> | 150 | </manifest> |
PersonalCenter/app/src/main/aidl/com/hjx/personalcenter/service/IPresonalInterface.aidl
| 1 | // IPresonalInterface.aidl | File was deleted | |
| 2 | package com.hjx.personalcenter.service; | ||
| 3 | |||
| 4 | // Declare any non-default types here with import statements | ||
| 5 | |||
| 6 | interface IPresonalInterface { | ||
| 7 | String sayHello(); | ||
| 8 | } | ||
| 9 | 1 | // IPresonalInterface.aidl |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MyApplication.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.app.Application; | 3 | import android.app.Application; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.graphics.drawable.Drawable; | 5 | import android.graphics.drawable.Drawable; |
| 6 | import android.os.Looper; | 6 | import android.os.Looper; |
| 7 | import android.view.Gravity; | 7 | import android.view.Gravity; |
| 8 | import android.widget.TextView; | 8 | import android.widget.TextView; |
| 9 | import android.widget.Toast; | 9 | import android.widget.Toast; |
| 10 | 10 | ||
| 11 | import com.facebook.drawee.backends.pipeline.Fresco; | 11 | import com.facebook.drawee.backends.pipeline.Fresco; |
| 12 | import com.hjx.personalcenter.R; | 12 | import com.hjx.personalcenter.R; |
| 13 | import com.hjx.personalcenter.crash.CrashHandler; | 13 | import com.hjx.personalcenter.crash.CrashHandler; |
| 14 | import com.hjx.personalcenter.util.ImageCache; | 14 | import com.hjx.personalcenter.util.ImageCache; |
| 15 | import com.squareup.leakcanary.LeakCanary; | 15 | import com.squareup.leakcanary.LeakCanary; |
| 16 | import com.tencent.bugly.crashreport.CrashReport; | 16 | import com.tencent.bugly.crashreport.CrashReport; |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | * Created by ${yf} on 2017/2/16. | 19 | * Created by ${yf} on 2017/2/16. |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | public class MyApplication extends Application { | 22 | public class MyApplication extends Application { |
| 23 | 23 | ||
| 24 | private ImageCache mImageCache; | 24 | private ImageCache mImageCache; |
| 25 | private static Context context; | 25 | private static Context context; |
| 26 | private static MyApplication instance; | 26 | private static MyApplication instance; |
| 27 | @Override | 27 | @Override |
| 28 | public void onCreate() { | 28 | public void onCreate() { |
| 29 | context = getApplicationContext(); | 29 | context = getApplicationContext(); |
| 30 | //c初始化内存检测 | 30 | //c初始化内存检测 |
| 31 | LeakCanary.install(this); | 31 | LeakCanary.install(this); |
| 32 | //初始化Fresco | 32 | //初始化Fresco |
| 33 | Fresco.initialize(this); | 33 | Fresco.initialize(this); |
| 34 | mImageCache = new ImageCache(); | 34 | mImageCache = new ImageCache(); |
| 35 | instance = this; | 35 | instance = this; |
| 36 | CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false); | 36 | CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false); |
| 37 | CrashHandler crashHandler = CrashHandler.getInstance(); | 37 | CrashHandler crashHandler = CrashHandler.getInstance(); |
| 38 | //生成错误日志,测试的时候得放开 | ||
| 38 | crashHandler.init(getApplicationContext()); | 39 | crashHandler.init(getApplicationContext()); |
| 39 | crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { | 40 | crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { |
| 40 | 41 | ||
| 41 | @Override | 42 | @Override |
| 42 | public boolean handleCrash(final Context context, final Throwable ex) { | 43 | public boolean handleCrash(final Context context, final Throwable ex) { |
| 43 | new Thread(new Runnable() { | 44 | new Thread(new Runnable() { |
| 44 | 45 | ||
| 45 | @Override | 46 | @Override |
| 46 | public void run() { | 47 | public void run() { |
| 47 | Looper.prepare(); | 48 | Looper.prepare(); |
| 48 | System.out.println("bcz = " + ex.toString()); | 49 | System.out.println("bcz = " + ex.toString()); |
| 49 | Toast toast = new Toast(context); | 50 | Toast toast = new Toast(context); |
| 50 | TextView tv = new TextView(context); | 51 | TextView tv = new TextView(context); |
| 51 | tv.setText(" 很抱歉,"+context.getString(R.string.app_name)+"崩溃了,我们会尽快修复."); | 52 | tv.setText(" 很抱歉,"+context.getString(R.string.app_name)+"崩溃了,我们会尽快修复."); |
| 52 | tv.setPadding(10, 10, 10, 10); | 53 | tv.setPadding(10, 10, 10, 10); |
| 53 | tv.setTextSize(20); | 54 | tv.setTextSize(20); |
| 54 | tv.setBackgroundResource(R.drawable.black_btn_default); | 55 | tv.setBackgroundResource(R.drawable.black_btn_default); |
| 55 | tv.setTextColor(context.getResources().getColor(android.R.color.white)); | 56 | tv.setTextColor(context.getResources().getColor(android.R.color.white)); |
| 56 | Drawable drawable= context.getResources().getDrawable(R.drawable.sorry); | 57 | Drawable drawable= context.getResources().getDrawable(R.drawable.sorry); |
| 57 | drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); | 58 | drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); |
| 58 | tv.setCompoundDrawables(drawable,null,null,null); | 59 | tv.setCompoundDrawables(drawable,null,null,null); |
| 59 | toast.setView(tv); | 60 | toast.setView(tv); |
| 60 | toast.setGravity(Gravity.CENTER, 0, 0); | 61 | toast.setGravity(Gravity.CENTER, 0, 0); |
| 61 | toast.setDuration(Toast.LENGTH_LONG); | 62 | toast.setDuration(Toast.LENGTH_LONG); |
| 62 | toast.show(); | 63 | toast.show(); |
| 63 | Looper.loop(); | 64 | Looper.loop(); |
| 64 | } | 65 | } |
| 65 | }).start(); | 66 | }).start(); |
| 66 | try { | 67 | try { |
| 67 | Thread.sleep(1000); | 68 | Thread.sleep(1000); |
| 68 | } catch (InterruptedException e) { | 69 | } catch (InterruptedException e) { |
| 69 | // TODO Auto-generated catch block | 70 | // TODO Auto-generated catch block |
| 70 | e.printStackTrace(); | 71 | e.printStackTrace(); |
| 71 | } | 72 | } |
| 72 | return false; | 73 | return false; |
| 73 | } | 74 | } |
| 74 | }); | 75 | }); |
| 75 | super.onCreate(); | 76 | super.onCreate(); |
| 76 | } | 77 | } |
| 77 | public ImageCache getImageCache() { | 78 | public ImageCache getImageCache() { |
| 78 | return mImageCache; | 79 | return mImageCache; |
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | public static Context getContext() { | 82 | public static Context getContext() { |
| 82 | return context; | 83 | return context; |
| 83 | } | 84 | } |
| 84 | public static MyApplication getInstance() { | 85 | public static MyApplication getInstance() { |
| 85 | return instance; | 86 | return instance; |
| 86 | } | 87 | } |
| 87 | 88 | ||
| 88 | } | 89 | } |
| 89 | 90 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/VersionAdapter.java
| File was created | 1 | package com.hjx.personalcenter.adapter; | |
| 2 | |||
| 3 | import android.content.Context; | ||
| 4 | import android.view.View; | ||
| 5 | import android.view.ViewGroup; | ||
| 6 | import android.widget.BaseAdapter; | ||
| 7 | import android.widget.TextView; | ||
| 8 | |||
| 9 | import com.hjx.personalcenter.R; | ||
| 10 | import com.hjx.personalcenter.model.VersionInfo; | ||
| 11 | |||
| 12 | import java.util.ArrayList; | ||
| 13 | |||
| 14 | /** | ||
| 15 | * Created by l on 2017/7/18. | ||
| 16 | */ | ||
| 17 | |||
| 18 | public class VersionAdapter extends BaseAdapter { | ||
| 19 | ArrayList<VersionInfo.DataBean> objects; | ||
| 20 | private Context context; | ||
| 21 | |||
| 22 | public VersionAdapter(ArrayList<VersionInfo.DataBean> objects, Context context) { | ||
| 23 | this.objects = objects; | ||
| 24 | this.context = context; | ||
| 25 | } | ||
| 26 | |||
| 27 | @Override | ||
| 28 | public int getCount() { | ||
| 29 | return objects.size(); | ||
| 30 | } | ||
| 31 | |||
| 32 | @Override | ||
| 33 | public Object getItem(int position) { | ||
| 34 | return position; | ||
| 35 | } | ||
| 36 | |||
| 37 | @Override | ||
| 38 | public long getItemId(int position) { | ||
| 39 | return position; | ||
| 40 | } | ||
| 41 | |||
| 42 | @Override | ||
| 43 | public View getView(final int position, View convertView, ViewGroup parent) { | ||
| 44 | |||
| 45 | ViewHolder holder = null; | ||
| 46 | |||
| 47 | if (convertView == null) { | ||
| 48 | convertView = View.inflate(context, R.layout.custom_adilog_list_item, null); | ||
| 49 | holder = new ViewHolder(); | ||
| 50 | holder.nameText = (TextView) convertView.findViewById(R.id.list_items); | ||
| 51 | convertView.setTag(holder); | ||
| 52 | } else { | ||
| 53 | holder = (VersionAdapter.ViewHolder) convertView.getTag(); | ||
| 54 | } | ||
| 55 | |||
| 56 | holder.nameText.setText(objects.get(position).getPressName()); | ||
| 57 | |||
| 58 | return convertView; | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | static class ViewHolder { | ||
| 63 | TextView nameText; | ||
| 64 | } | ||
| 65 | } | ||
| 66 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/VerSionDialog.java
| File was created | 1 | package com.hjx.personalcenter.customdialog; | |
| 2 | |||
| 3 | import android.content.Context; | ||
| 4 | import android.graphics.Color; | ||
| 5 | import android.os.Bundle; | ||
| 6 | import android.os.Handler; | ||
| 7 | import android.os.Message; | ||
| 8 | import android.util.Log; | ||
| 9 | import android.view.Gravity; | ||
| 10 | import android.view.LayoutInflater; | ||
| 11 | import android.view.View; | ||
| 12 | import android.view.ViewGroup; | ||
| 13 | import android.widget.AdapterView; | ||
| 14 | import android.widget.ImageView; | ||
| 15 | import android.widget.ListView; | ||
| 16 | |||
| 17 | import com.hjx.personalcenter.R; | ||
| 18 | import com.hjx.personalcenter.adapter.VersionAdapter; | ||
| 19 | import com.hjx.personalcenter.db.SaveParam; | ||
| 20 | import com.hjx.personalcenter.http.HttpCode; | ||
| 21 | import com.hjx.personalcenter.http.HttpManager; | ||
| 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | ||
| 23 | import com.hjx.personalcenter.model.VersionInfo; | ||
| 24 | import com.mylhyl.circledialog.BaseCircleDialog; | ||
| 25 | import com.mylhyl.circledialog.res.values.CircleDimen; | ||
| 26 | |||
| 27 | import java.util.ArrayList; | ||
| 28 | import java.util.List; | ||
| 29 | |||
| 30 | /** | ||
| 31 | * 自定义版本信息列表对话框 | ||
| 32 | * Created by h on 2017/8/10. | ||
| 33 | */ | ||
| 34 | |||
| 35 | public class VerSionDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | ||
| 36 | private VersionAdapter listadapter; | ||
| 37 | private ImageView cance; | ||
| 38 | private ListView listView; | ||
| 39 | private ArrayList<VersionInfo.DataBean> data = new ArrayList<>(); | ||
| 40 | |||
| 41 | private DialogCallBack.VersionCallBack mCallBack; | ||
| 42 | |||
| 43 | Handler handler = new Handler(){ | ||
| 44 | @Override | ||
| 45 | public void handleMessage(Message msg) { | ||
| 46 | super.handleMessage(msg); | ||
| 47 | switch (msg.what){ | ||
| 48 | case HttpCode.VERSION_SUCESS: | ||
| 49 | data.clear(); | ||
| 50 | data.addAll( (List<VersionInfo.DataBean>)msg.obj); | ||
| 51 | listadapter.notifyDataSetChanged(); | ||
| 52 | |||
| 53 | break; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | }; | ||
| 57 | public VerSionDialog(DialogCallBack.VersionCallBack callBack) { | ||
| 58 | this.mCallBack = callBack; | ||
| 59 | } | ||
| 60 | |||
| 61 | public static VerSionDialog getInstance(DialogCallBack.VersionCallBack callBack) { | ||
| 62 | VerSionDialog dialogFragment = new VerSionDialog(callBack); | ||
| 63 | dialogFragment.setCanceledBack(true); | ||
| 64 | dialogFragment.setCanceledOnTouchOutside(true); | ||
| 65 | dialogFragment.setRadius(CircleDimen.RADIUS); | ||
| 66 | dialogFragment.setWidth(0.5f); | ||
| 67 | dialogFragment.setGravity(Gravity.CENTER); | ||
| 68 | dialogFragment.setBackgroundColor(Color.WHITE); | ||
| 69 | return dialogFragment; | ||
| 70 | } | ||
| 71 | |||
| 72 | @Override | ||
| 73 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | ||
| 74 | return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); | ||
| 75 | } | ||
| 76 | |||
| 77 | @Override | ||
| 78 | public void onActivityCreated(Bundle savedInstanceState) { | ||
| 79 | super.onActivityCreated(savedInstanceState); | ||
| 80 | listView = (ListView) getView().findViewById(R.id.listadapter); | ||
| 81 | cance = (ImageView) getView().findViewById(R.id.cancel); | ||
| 82 | listadapter = new VersionAdapter(data,getActivity()); | ||
| 83 | listView.setAdapter(listadapter); | ||
| 84 | listView.setOnItemClickListener(this); | ||
| 85 | cance.setOnClickListener(new View.OnClickListener() { | ||
| 86 | @Override | ||
| 87 | public void onClick(View v) { | ||
| 88 | dismiss(); | ||
| 89 | } | ||
| 90 | }); | ||
| 91 | String subjectName = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.VERSION); | ||
| 92 | Log.e("test","选择的科目"+subjectName); | ||
| 93 | HttpManager.getInstance().versioninfo(getActivity(),subjectName,handler); | ||
| 94 | |||
| 95 | } | ||
| 96 | |||
| 97 | @Override | ||
| 98 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | ||
| 99 | //Toast.makeText(getActivity(), "你点击了第" + position + "个", Toast.LENGTH_LONG).show(); | ||
| 100 | //SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.PROVINCES, ""+data.get(position).getRegionId()); | ||
| 101 | mCallBack.versionOnItemClick(data,position,1); | ||
| 102 | dismiss(); | ||
| 103 | |||
| 104 | } | ||
| 105 | } | ||
| 106 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
| 1 | package com.hjx.personalcenter.db; | 1 | package com.hjx.personalcenter.db; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.content.SharedPreferences; | 5 | import android.content.SharedPreferences; |
| 6 | 6 | ||
| 7 | public class SaveParam { | 7 | public class SaveParam { |
| 8 | 8 | ||
| 9 | private static SaveParam instance; | 9 | private static SaveParam instance; |
| 10 | public static SaveParam getInstance(){ | 10 | public static SaveParam getInstance(){ |
| 11 | if (instance==null){ | 11 | if (instance==null){ |
| 12 | instance = new SaveParam(); | 12 | instance = new SaveParam(); |
| 13 | } | 13 | } |
| 14 | return instance; | 14 | return instance; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | public static String GRADENS = "gradens";//年级id | 17 | public static String GRADENS = "gradens";//年级id |
| 18 | public static String SCHOOOlID = "schoolid";//年级id | 18 | public static String SCHOOOlID = "schoolid";//年级id |
| 19 | //个人信息 | 19 | //个人信息 |
| 20 | public static String USERNAME = "usernames";//昵称 | 20 | public static String USERNAME = "usernames";//昵称 |
| 21 | public static String ADRESS = "adress";//地址 | 21 | public static String ADRESS = "adress";//地址 |
| 22 | public static String GRADES = "gadens";//年级 | 22 | public static String GRADES = "gadens";//年级 |
| 23 | public static String SCHOOL = "school";//学校 | 23 | public static String SCHOOL = "school";//学校 |
| 24 | public static String CONSTELLATION = "constellations";//星座 | 24 | public static String CONSTELLATION = "constellations";//星座 |
| 25 | public static String HEADURL = "headurl";//星座 | 25 | public static String HEADURL = "headurl";//星座 |
| 26 | 26 | ||
| 27 | //电子保卡信息 | 27 | //电子保卡信息 |
| 28 | public static String CARDPHONE = "cardphone";//保卡手机号 | 28 | public static String CARDPHONE = "cardphone";//保卡手机号 |
| 29 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 | 29 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 |
| 30 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 | 30 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 |
| 31 | public static String SHOPTIME = "shoptime";//购买时间 | 31 | public static String SHOPTIME = "shoptime";//购买时间 |
| 32 | public static String SHOPADRESS = "shopadress";//购买地址 | 32 | public static String SHOPADRESS = "shopadress";//购买地址 |
| 33 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 | 33 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 |
| 34 | 34 | ||
| 35 | //省市区参数、 | 35 | //省市区参数、 |
| 36 | public static String PROVINCES = "provinces";//省 | 36 | public static String PROVINCES = "provinces";//省 |
| 37 | public static String CITYS = "citys";//市 | 37 | public static String CITYS = "citys";//市 |
| 38 | public static String COUNTRY = "country";//区 | 38 | public static String COUNTRY = "country";//区 |
| 39 | 39 | ||
| 40 | //账户管理 | 40 | //账户管理 |
| 41 | public static String ACCOUNT = "account";//账户类型 | 41 | public static String ACCOUNT = "account";//账户类型 |
| 42 | //版本信息 | ||
| 43 | public static String VERSION = "version"; | ||
| 42 | 44 | ||
| 43 | 45 | ||
| 44 | public void saveLoginParam(Context context,String spname, String spstr) { | 46 | public void saveLoginParam(Context context,String spname, String spstr) { |
| 45 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 47 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 46 | Activity.MODE_PRIVATE); | 48 | Activity.MODE_PRIVATE); |
| 47 | 49 | ||
| 48 | sp.edit().putString(spname, spstr).commit(); | 50 | sp.edit().putString(spname, spstr).commit(); |
| 49 | } | 51 | } |
| 50 | 52 | ||
| 51 | 53 | ||
| 52 | public String getLoginParam(Context context,String spname) { | 54 | public String getLoginParam(Context context,String spname) { |
| 53 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 55 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 54 | Activity.MODE_PRIVATE); | 56 | Activity.MODE_PRIVATE); |
| 55 | String param = sp.getString(spname, null); | 57 | String param = sp.getString(spname, null); |
| 56 | return param; | 58 | return param; |
| 57 | } | 59 | } |
| 58 | public void clearData(Context context) { | 60 | public void clearData(Context context) { |
| 59 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 61 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 60 | Activity.MODE_PRIVATE); | 62 | Activity.MODE_PRIVATE); |
| 61 | sp.edit().clear().commit(); | 63 | sp.edit().clear().commit(); |
| 62 | } | 64 | } |
| 63 | 65 | ||
| 64 | public void saveCustomizeParam(Context context,String spname, String spstr) { | 66 | public void saveCustomizeParam(Context context,String spname, String spstr) { |
| 65 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 67 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 66 | Activity.MODE_PRIVATE); | 68 | Activity.MODE_PRIVATE); |
| 67 | 69 | ||
| 68 | sp.edit().putString(spname, spstr).commit(); | 70 | sp.edit().putString(spname, spstr).commit(); |
| 69 | 71 | ||
| 70 | } | 72 | } |
| 71 | 73 | ||
| 72 | public String getCustomizeParam(Context context,String spname) { | 74 | public String getCustomizeParam(Context context,String spname) { |
| 73 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 75 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 74 | Activity.MODE_PRIVATE); | 76 | Activity.MODE_PRIVATE); |
| 75 | String param = sp.getString(spname, null); | 77 | String param = sp.getString(spname, null); |
| 76 | return param; | 78 | return param; |
| 77 | } | 79 | } |
| 78 | 80 | ||
| 79 | public void clearCustomizeParam(Context context ){ | 81 | public void clearCustomizeParam(Context context ){ |
| 80 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 82 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 81 | Activity.MODE_PRIVATE); | 83 | Activity.MODE_PRIVATE); |
| 82 | sp.edit().clear().commit(); | 84 | sp.edit().clear().commit(); |
| 83 | } | 85 | } |
| 84 | } | 86 | } |
| 85 | 87 |
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.support.annotation.Nullable; | 4 | import android.support.annotation.Nullable; |
| 5 | import android.support.v4.app.Fragment; | 5 | import android.support.v4.app.Fragment; |
| 6 | import android.view.LayoutInflater; | 6 | import android.view.LayoutInflater; |
| 7 | import android.view.View; | 7 | import android.view.View; |
| 8 | import android.view.ViewGroup; | 8 | import android.view.ViewGroup; |
| 9 | import android.widget.AdapterView; | ||
| 9 | import android.widget.GridView; | 10 | import android.widget.GridView; |
| 10 | import android.widget.SimpleAdapter; | 11 | import android.widget.SimpleAdapter; |
| 11 | 12 | ||
| 12 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
| 14 | import com.hjx.personalcenter.customdialog.VerSionDialog; | ||
| 15 | import com.hjx.personalcenter.db.SaveParam; | ||
| 16 | import com.hjx.personalcenter.interfaces.DialogCallBack; | ||
| 17 | import com.hjx.personalcenter.model.VersionInfo; | ||
| 18 | import com.hjx.personalcenter.util.AlertUtils; | ||
| 13 | 19 | ||
| 14 | import java.util.ArrayList; | 20 | import java.util.ArrayList; |
| 15 | import java.util.HashMap; | 21 | import java.util.HashMap; |
| 16 | import java.util.List; | 22 | import java.util.List; |
| 17 | import java.util.Map; | 23 | import java.util.Map; |
| 18 | 24 | ||
| 19 | /** | 25 | /** |
| 20 | * Created by h on 2017/8/12. | 26 | * Created by h on 2017/8/12. |
| 21 | */ | 27 | */ |
| 22 | 28 | ||
| 23 | public class VersionsInfoFragment extends Fragment { | 29 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener,DialogCallBack.VersionCallBack { |
| 24 | private GridView gridView; | 30 | private GridView gridView; |
| 25 | private List<Map<String, Object>> data_list; | 31 | private List<Map<String, Object>> data_list; |
| 26 | private SimpleAdapter sim_adapter; | 32 | private SimpleAdapter sim_adapter; |
| 27 | private View mView; | 33 | private View mView; |
| 28 | private int type; | 34 | private int type; |
| 29 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 35 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
| 30 | 36 | ||
| 31 | public static VersionsInfoFragment newInstance(int type) { | 37 | public static VersionsInfoFragment newInstance(int type) { |
| 32 | VersionsInfoFragment fragment = new VersionsInfoFragment(); | 38 | VersionsInfoFragment fragment = new VersionsInfoFragment(); |
| 33 | Bundle bundle = new Bundle(); | 39 | Bundle bundle = new Bundle(); |
| 34 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 40 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
| 35 | fragment.setArguments(bundle); | 41 | fragment.setArguments(bundle); |
| 36 | return fragment; | 42 | return fragment; |
| 37 | 43 | ||
| 38 | } | 44 | } |
| 39 | // 图片封装为一个数组 | 45 | // 图片封装为一个数组 |
| 40 | private int[] icon = { R.mipmap.ic_launcher, R.mipmap.ic_launcher, | 46 | private int[] icon = { R.mipmap.ic_launcher, R.mipmap.ic_launcher, |
| 41 | R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, | 47 | R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, |
| 42 | R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, | 48 | R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, |
| 43 | R.mipmap.ic_launcher}; | 49 | R.mipmap.ic_launcher}; |
| 44 | private String[] subject = { "语文", "数学", "英语", "物理", "化学", "生物", "政治", | 50 | private String[] subject = { "语文", "数学", "英语", "物理", "化学", "生物", "政治", |
| 45 | "历史", "地理" }; | 51 | "历史", "地理" }; |
| 46 | private String[] publish = { "人民教育出版社", "人民教育出版社", "人民教育出版社", | 52 | private String[] publish = { "人民教育出版社", "人民教育出版社", "人民教育出版社", |
| 47 | "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社", | 53 | "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社", |
| 48 | "人民教育出版社", "人民教育出版社" }; | 54 | "人民教育出版社", "人民教育出版社" }; |
| 49 | @Override | 55 | @Override |
| 50 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 56 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 51 | if (mView == null) { | 57 | if (mView == null) { |
| 52 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); | 58 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); |
| 53 | initView(mView); | 59 | initView(mView); |
| 54 | initData(); | 60 | initData(); |
| 55 | setLister(); | 61 | setLister(); |
| 56 | 62 | ||
| 57 | 63 | ||
| 58 | } | 64 | } |
| 59 | return mView; | 65 | return mView; |
| 60 | } | 66 | } |
| 61 | //初始化 | 67 | //初始化 |
| 62 | private void initView(View mView) { | 68 | private void initView(View mView) { |
| 63 | gridView =(GridView) mView.findViewById(R.id.grideview); | 69 | gridView =(GridView) mView.findViewById(R.id.grideview); |
| 64 | 70 | ||
| 65 | } | 71 | } |
| 66 | private void initData() { | 72 | private void initData() { |
| 67 | data_list = new ArrayList<Map<String, Object>>(); | 73 | data_list = new ArrayList<Map<String, Object>>(); |
| 68 | getData(); | 74 | getData(); |
| 69 | String [] from ={"image","text","text1"}; | 75 | String [] from ={"image","text","text1"}; |
| 70 | int [] to = {R.id.image,R.id.text}; | 76 | int [] to = {R.id.image,R.id.text}; |
| 71 | sim_adapter = new SimpleAdapter(getActivity(), data_list, R.layout.fragment_changge_version_info_itmes, from, to); | 77 | sim_adapter = new SimpleAdapter(getActivity(), data_list, R.layout.fragment_changge_version_info_itmes, from, to); |
| 72 | //配置适配器 | 78 | //配置适配器 |
| 73 | gridView.setAdapter(sim_adapter); | 79 | gridView.setAdapter(sim_adapter); |
| 74 | } | 80 | } |
| 75 | public List<Map<String, Object>> getData(){ | 81 | public List<Map<String, Object>> getData(){ |
| 76 | //cion和iconName的长度是相同的,这里任选其一都可以 | 82 | //cion和iconName的长度是相同的,这里任选其一都可以 |
| 77 | for(int i=0;i<icon.length;i++){ | 83 | for(int i=0;i<icon.length;i++){ |
| 78 | Map<String, Object> map = new HashMap<String, Object>(); | 84 | Map<String, Object> map = new HashMap<String, Object>(); |
| 79 | map.put("image", icon[i]); | 85 | map.put("image", icon[i]); |
| 80 | map.put("text", subject[i]); | 86 | map.put("text", subject[i]); |
| 81 | map.put("text1", publish[i]); | 87 | map.put("text1", publish[i]); |
| 82 | data_list.add(map); | 88 | data_list.add(map); |
| 83 | } | 89 | } |
| 84 | 90 | ||
| 85 | return data_list; | 91 | return data_list; |
| 86 | } | 92 | } |
| 87 | private void setLister() { | 93 | private void setLister() { |
| 94 | gridView.setOnItemClickListener(this); | ||
| 95 | } | ||
| 96 | |||
| 97 | @Override | ||
| 98 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | ||
| 99 | switch (position){ | ||
| 100 | |||
| 101 | case 0: | ||
| 102 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"语文"); | ||
| 103 | break; | ||
| 104 | case 1: | ||
| 105 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"数学"); | ||
| 106 | break; | ||
| 107 | case 2: | ||
| 108 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"英语"); | ||
| 109 | break; | ||
| 110 | case 3: | ||
| 111 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"物理"); | ||
| 112 | break; | ||
| 113 | case 4: | ||
| 114 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"化学"); | ||
| 115 | break; | ||
| 116 | case 5: | ||
| 117 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"生物"); | ||
| 118 | break; | ||
| 119 | case 6: | ||
| 120 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"政治"); | ||
| 121 | break; | ||
| 122 | case 7: | ||
| 123 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"历史"); | ||
| 124 | break; | ||
| 125 | case 8: | ||
| 126 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"地理"); | ||
| 127 | break; | ||
| 128 | } | ||
| 129 | |||
| 130 | VerSionDialog.getInstance((DialogCallBack.VersionCallBack) this).show(getChildFragmentManager(), "VerSionDialog"); | ||
| 131 | |||
| 132 | } | ||
| 133 | |||
| 134 | @Override | ||
| 135 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | ||
| 136 | String regionName = data.get(position).getPressName(); | ||
| 137 | //SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); | ||
| 138 | AlertUtils.showToast(getActivity(),regionName); | ||
| 139 | |||
| 140 | |||
| 88 | } | 141 | } |
| 89 | } | 142 | } |
| 90 | 143 |
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 | //获取版本信息 | ||
| 47 | public static final int VERSION_SUCESS = 22; | ||
| 46 | 48 | ||
| 47 | 49 | ||
| 48 | 50 | ||
| 49 | 51 | ||
| 50 | } | 52 | } |
| 51 | 53 |
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.provider.Settings; | 9 | import android.provider.Settings; |
| 10 | import android.support.v4.app.FragmentActivity; | 10 | import android.support.v4.app.FragmentActivity; |
| 11 | import android.util.Log; | 11 | import android.util.Log; |
| 12 | import android.view.Gravity; | 12 | import android.view.Gravity; |
| 13 | import android.view.View; | 13 | import android.view.View; |
| 14 | import android.widget.Toast; | 14 | import android.widget.Toast; |
| 15 | 15 | ||
| 16 | import com.google.gson.Gson; | 16 | import com.google.gson.Gson; |
| 17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
| 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.db.Content; | 20 | import com.hjx.personalcenter.db.Content; |
| 21 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
| 22 | import com.hjx.personalcenter.gson.GsonTool; | 22 | import com.hjx.personalcenter.gson.GsonTool; |
| 23 | import com.hjx.personalcenter.model.AppVersion; | 23 | import com.hjx.personalcenter.model.AppVersion; |
| 24 | import com.hjx.personalcenter.model.CardInfo; | 24 | import com.hjx.personalcenter.model.CardInfo; |
| 25 | import com.hjx.personalcenter.model.ChildsInfo; | 25 | import com.hjx.personalcenter.model.ChildsInfo; |
| 26 | import com.hjx.personalcenter.model.CityInfo; | 26 | import com.hjx.personalcenter.model.CityInfo; |
| 27 | import com.hjx.personalcenter.model.CountyInfo; | 27 | import com.hjx.personalcenter.model.CountyInfo; |
| 28 | import com.hjx.personalcenter.model.GradeInfo; | 28 | import com.hjx.personalcenter.model.GradeInfo; |
| 29 | import com.hjx.personalcenter.model.PesonalInfo; | 29 | import com.hjx.personalcenter.model.PesonalInfo; |
| 30 | import com.hjx.personalcenter.model.ProvinceInfo; | 30 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 31 | import com.hjx.personalcenter.model.SchoolInfo; | 31 | import com.hjx.personalcenter.model.SchoolInfo; |
| 32 | import com.hjx.personalcenter.model.SignInfo; | 32 | import com.hjx.personalcenter.model.SignInfo; |
| 33 | import com.hjx.personalcenter.model.VersionInfo; | ||
| 33 | import com.hjx.personalcenter.util.AlertUtils; | 34 | import com.hjx.personalcenter.util.AlertUtils; |
| 34 | import com.hjx.personalcenter.util.DialogPermission; | 35 | import com.hjx.personalcenter.util.DialogPermission; |
| 35 | import com.loopj.android.http.AsyncHttpResponseHandler; | 36 | import com.loopj.android.http.AsyncHttpResponseHandler; |
| 36 | import com.loopj.android.http.JsonHttpResponseHandler; | 37 | import com.loopj.android.http.JsonHttpResponseHandler; |
| 37 | import com.loopj.android.http.RequestParams; | 38 | import com.loopj.android.http.RequestParams; |
| 38 | import com.mylhyl.circledialog.CircleDialog; | 39 | import com.mylhyl.circledialog.CircleDialog; |
| 39 | import com.mylhyl.circledialog.callback.ConfigText; | 40 | import com.mylhyl.circledialog.callback.ConfigText; |
| 40 | import com.mylhyl.circledialog.params.TextParams; | 41 | import com.mylhyl.circledialog.params.TextParams; |
| 41 | 42 | ||
| 42 | import org.apache.http.Header; | 43 | import org.apache.http.Header; |
| 43 | import org.apache.http.entity.ByteArrayEntity; | 44 | import org.apache.http.entity.ByteArrayEntity; |
| 44 | import org.apache.http.message.BasicHeader; | 45 | import org.apache.http.message.BasicHeader; |
| 45 | import org.apache.http.protocol.HTTP; | 46 | import org.apache.http.protocol.HTTP; |
| 46 | import org.json.JSONException; | 47 | import org.json.JSONException; |
| 47 | import org.json.JSONObject; | 48 | import org.json.JSONObject; |
| 48 | 49 | ||
| 49 | import java.io.File; | 50 | import java.io.File; |
| 50 | import java.io.FileNotFoundException; | 51 | import java.io.FileNotFoundException; |
| 51 | import java.io.UnsupportedEncodingException; | 52 | import java.io.UnsupportedEncodingException; |
| 52 | import java.util.ArrayList; | 53 | import java.util.ArrayList; |
| 53 | import java.util.List; | 54 | import java.util.List; |
| 54 | 55 | ||
| 55 | public class HttpManager { | 56 | public class HttpManager { |
| 56 | private static HttpManager instance; | 57 | private static HttpManager instance; |
| 57 | private ProgressDialog mProgress = null; | 58 | private ProgressDialog mProgress = null; |
| 58 | 59 | ||
| 59 | public static HttpManager getInstance() { | 60 | public static HttpManager getInstance() { |
| 60 | if (instance == null) { | 61 | if (instance == null) { |
| 61 | instance = new HttpManager(); | 62 | instance = new HttpManager(); |
| 62 | } | 63 | } |
| 63 | return instance; | 64 | return instance; |
| 64 | } | 65 | } |
| 65 | 66 | ||
| 66 | 67 | ||
| 67 | //登录接口 | 68 | //登录接口 |
| 68 | 69 | ||
| 69 | 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) { |
| 70 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 71 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
| 71 | false, true, null); | 72 | false, true, null); |
| 72 | 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"); |
| 73 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 74 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
| 74 | @Override | 75 | @Override |
| 75 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 76 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 76 | closeProgress(); | 77 | closeProgress(); |
| 77 | Message msg = Message.obtain(); | 78 | Message msg = Message.obtain(); |
| 78 | msg.what = HttpCode.LOGIN_SUCESS; | 79 | msg.what = HttpCode.LOGIN_SUCESS; |
| 79 | msg.obj = new String(arg2); | 80 | msg.obj = new String(arg2); |
| 80 | handler.sendMessage(msg); | 81 | handler.sendMessage(msg); |
| 81 | 82 | ||
| 82 | 83 | ||
| 83 | } | 84 | } |
| 84 | 85 | ||
| 85 | @Override | 86 | @Override |
| 86 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 87 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 87 | closeProgress(); | 88 | closeProgress(); |
| 88 | new CircleDialog.Builder((FragmentActivity) mContext) | 89 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 89 | .setCanceledOnTouchOutside(false) | 90 | .setCanceledOnTouchOutside(false) |
| 90 | .setCancelable(false) | 91 | .setCancelable(false) |
| 91 | .setWidth(0.5f) | 92 | .setWidth(0.5f) |
| 92 | .configText(new ConfigText() { | 93 | .configText(new ConfigText() { |
| 93 | @Override | 94 | @Override |
| 94 | public void onConfig(TextParams params) { | 95 | public void onConfig(TextParams params) { |
| 95 | params.gravity = Gravity.CENTER; | 96 | params.gravity = Gravity.CENTER; |
| 96 | params.padding = new int[]{50, 50, 50, 50}; | 97 | params.padding = new int[]{50, 50, 50, 50}; |
| 97 | } | 98 | } |
| 98 | }) | 99 | }) |
| 99 | .setText("当前无网络,请检查网络设置") | 100 | .setText("当前无网络,请检查网络设置") |
| 100 | .setNegative("继续使用", null) | 101 | .setNegative("继续使用", null) |
| 101 | .setPositive("设置网络", new View.OnClickListener() { | 102 | .setPositive("设置网络", new View.OnClickListener() { |
| 102 | @Override | 103 | @Override |
| 103 | public void onClick(View v) { | 104 | public void onClick(View v) { |
| 104 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 105 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 105 | mContext.startActivity(intent); | 106 | mContext.startActivity(intent); |
| 106 | } | 107 | } |
| 107 | }) | 108 | }) |
| 108 | .show(); | 109 | .show(); |
| 109 | } | 110 | } |
| 110 | }); | 111 | }); |
| 111 | } | 112 | } |
| 112 | 113 | ||
| 113 | //注册接口 | 114 | //注册接口 |
| 114 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 115 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
| 115 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 116 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
| 116 | false, true, null); | 117 | false, true, null); |
| 117 | JSONObject jsonObject = new JSONObject(); | 118 | JSONObject jsonObject = new JSONObject(); |
| 118 | ByteArrayEntity entity = null; | 119 | ByteArrayEntity entity = null; |
| 119 | try { | 120 | try { |
| 120 | jsonObject.put(HttpKey.USERNAME, username); | 121 | jsonObject.put(HttpKey.USERNAME, username); |
| 121 | jsonObject.put(HttpKey.PASSWORD, password); | 122 | jsonObject.put(HttpKey.PASSWORD, password); |
| 122 | jsonObject.put(HttpKey.SMSCODE, smscode); | 123 | jsonObject.put(HttpKey.SMSCODE, smscode); |
| 123 | jsonObject.put(HttpKey.SOURCE, source); | 124 | jsonObject.put(HttpKey.SOURCE, source); |
| 124 | Log.e("test", "jsonObject" + jsonObject); | 125 | Log.e("test", "jsonObject" + jsonObject); |
| 125 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 126 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
| 126 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 127 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
| 127 | } catch (JSONException e) { | 128 | } catch (JSONException e) { |
| 128 | e.printStackTrace(); | 129 | e.printStackTrace(); |
| 129 | } catch (UnsupportedEncodingException e) { | 130 | } catch (UnsupportedEncodingException e) { |
| 130 | e.printStackTrace(); | 131 | e.printStackTrace(); |
| 131 | } | 132 | } |
| 132 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 133 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 133 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 134 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
| 134 | @Override | 135 | @Override |
| 135 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 136 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 136 | super.onSuccess(statusCode, headers, response); | 137 | super.onSuccess(statusCode, headers, response); |
| 137 | closeProgress(); | 138 | closeProgress(); |
| 138 | Log.e("test", "onSuccess" + response); | 139 | Log.e("test", "onSuccess" + response); |
| 139 | Message msg = Message.obtain(); | 140 | Message msg = Message.obtain(); |
| 140 | msg.what = HttpCode.REGISTERED_SUCESS; | 141 | msg.what = HttpCode.REGISTERED_SUCESS; |
| 141 | msg.obj = response; | 142 | msg.obj = response; |
| 142 | handler.sendMessage(msg); | 143 | handler.sendMessage(msg); |
| 143 | 144 | ||
| 144 | } | 145 | } |
| 145 | 146 | ||
| 146 | @Override | 147 | @Override |
| 147 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 148 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 148 | super.onFailure(statusCode, headers, throwable, errorResponse); | 149 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 149 | closeProgress(); | 150 | closeProgress(); |
| 150 | Log.e("test", "onFailure" + errorResponse); | 151 | Log.e("test", "onFailure" + errorResponse); |
| 151 | new CircleDialog.Builder((FragmentActivity) context) | 152 | new CircleDialog.Builder((FragmentActivity) context) |
| 152 | .setCanceledOnTouchOutside(false) | 153 | .setCanceledOnTouchOutside(false) |
| 153 | .setCancelable(false) | 154 | .setCancelable(false) |
| 154 | .setWidth(0.5f) | 155 | .setWidth(0.5f) |
| 155 | .configText(new ConfigText() { | 156 | .configText(new ConfigText() { |
| 156 | @Override | 157 | @Override |
| 157 | public void onConfig(TextParams params) { | 158 | public void onConfig(TextParams params) { |
| 158 | params.gravity = Gravity.CENTER; | 159 | params.gravity = Gravity.CENTER; |
| 159 | params.padding = new int[]{50, 50, 50, 50}; | 160 | params.padding = new int[]{50, 50, 50, 50}; |
| 160 | } | 161 | } |
| 161 | }) | 162 | }) |
| 162 | .setText("当前无网络,请检查网络设置") | 163 | .setText("当前无网络,请检查网络设置") |
| 163 | .setNegative("继续使用", null) | 164 | .setNegative("继续使用", null) |
| 164 | .setPositive("设置网络", new View.OnClickListener() { | 165 | .setPositive("设置网络", new View.OnClickListener() { |
| 165 | @Override | 166 | @Override |
| 166 | public void onClick(View v) { | 167 | public void onClick(View v) { |
| 167 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 168 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 168 | context.startActivity(intent); | 169 | context.startActivity(intent); |
| 169 | } | 170 | } |
| 170 | }) | 171 | }) |
| 171 | .show(); | 172 | .show(); |
| 172 | } | 173 | } |
| 173 | 174 | ||
| 174 | }); | 175 | }); |
| 175 | } | 176 | } |
| 176 | 177 | ||
| 177 | //注册验证码 | 178 | //注册验证码 |
| 178 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 179 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
| 179 | RequestParams params = new RequestParams(); | 180 | RequestParams params = new RequestParams(); |
| 180 | params.put(HttpKey.TYPE, type); | 181 | params.put(HttpKey.TYPE, type); |
| 181 | params.put(HttpKey.MOBIL, mobile); | 182 | params.put(HttpKey.MOBIL, mobile); |
| 182 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 183 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 183 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 184 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
| 184 | 185 | ||
| 185 | @Override | 186 | @Override |
| 186 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 187 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 187 | Log.e("test", "onSuccess-----" + response); | 188 | Log.e("test", "onSuccess-----" + response); |
| 188 | Message msg = Message.obtain(); | 189 | Message msg = Message.obtain(); |
| 189 | msg.what = HttpCode.AUTHCODE_SUCESS; | 190 | msg.what = HttpCode.AUTHCODE_SUCESS; |
| 190 | msg.obj = response; | 191 | msg.obj = response; |
| 191 | handler.sendMessage(msg); | 192 | handler.sendMessage(msg); |
| 192 | } | 193 | } |
| 193 | 194 | ||
| 194 | @Override | 195 | @Override |
| 195 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 196 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 196 | new CircleDialog.Builder((FragmentActivity) mContext) | 197 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 197 | .setCanceledOnTouchOutside(false) | 198 | .setCanceledOnTouchOutside(false) |
| 198 | .setCancelable(false) | 199 | .setCancelable(false) |
| 199 | .setWidth(0.5f) | 200 | .setWidth(0.5f) |
| 200 | .configText(new ConfigText() { | 201 | .configText(new ConfigText() { |
| 201 | @Override | 202 | @Override |
| 202 | public void onConfig(TextParams params) { | 203 | public void onConfig(TextParams params) { |
| 203 | params.gravity = Gravity.CENTER; | 204 | params.gravity = Gravity.CENTER; |
| 204 | params.padding = new int[]{50, 50, 50, 50}; | 205 | params.padding = new int[]{50, 50, 50, 50}; |
| 205 | } | 206 | } |
| 206 | }) | 207 | }) |
| 207 | .setText("当前无网络,请检查网络设置") | 208 | .setText("当前无网络,请检查网络设置") |
| 208 | .setNegative("继续使用", null) | 209 | .setNegative("继续使用", null) |
| 209 | .setPositive("设置网络", new View.OnClickListener() { | 210 | .setPositive("设置网络", new View.OnClickListener() { |
| 210 | @Override | 211 | @Override |
| 211 | public void onClick(View v) { | 212 | public void onClick(View v) { |
| 212 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 213 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 213 | mContext.startActivity(intent); | 214 | mContext.startActivity(intent); |
| 214 | } | 215 | } |
| 215 | }) | 216 | }) |
| 216 | .show(); | 217 | .show(); |
| 217 | } | 218 | } |
| 218 | }); | 219 | }); |
| 219 | } | 220 | } |
| 220 | 221 | ||
| 221 | 222 | ||
| 222 | //手机号是否注册 | 223 | //手机号是否注册 |
| 223 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 224 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
| 224 | RequestParams params = new RequestParams(); | 225 | RequestParams params = new RequestParams(); |
| 225 | params.put(HttpKey.USERNAME, mobile); | 226 | params.put(HttpKey.USERNAME, mobile); |
| 226 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 227 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
| 227 | @Override | 228 | @Override |
| 228 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 229 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 229 | Log.e("test", "isregistered" + response.toString()); | 230 | Log.e("test", "isregistered" + response.toString()); |
| 230 | Message msg = Message.obtain(); | 231 | Message msg = Message.obtain(); |
| 231 | msg.what = HttpCode.IS_REFISTER; | 232 | msg.what = HttpCode.IS_REFISTER; |
| 232 | msg.obj = response; | 233 | msg.obj = response; |
| 233 | handler.sendMessage(msg); | 234 | handler.sendMessage(msg); |
| 234 | 235 | ||
| 235 | } | 236 | } |
| 236 | 237 | ||
| 237 | @Override | 238 | @Override |
| 238 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 239 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 239 | new CircleDialog.Builder((FragmentActivity) mContext) | 240 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 240 | .setCanceledOnTouchOutside(false) | 241 | .setCanceledOnTouchOutside(false) |
| 241 | .setCancelable(false) | 242 | .setCancelable(false) |
| 242 | .setWidth(0.5f) | 243 | .setWidth(0.5f) |
| 243 | .configText(new ConfigText() { | 244 | .configText(new ConfigText() { |
| 244 | @Override | 245 | @Override |
| 245 | public void onConfig(TextParams params) { | 246 | public void onConfig(TextParams params) { |
| 246 | params.gravity = Gravity.CENTER; | 247 | params.gravity = Gravity.CENTER; |
| 247 | params.padding = new int[]{50, 50, 50, 50}; | 248 | params.padding = new int[]{50, 50, 50, 50}; |
| 248 | } | 249 | } |
| 249 | }) | 250 | }) |
| 250 | .setText("当前无网络,请检查网络设置") | 251 | .setText("当前无网络,请检查网络设置") |
| 251 | .setNegative("继续使用", null) | 252 | .setNegative("继续使用", null) |
| 252 | .setPositive("设置网络", new View.OnClickListener() { | 253 | .setPositive("设置网络", new View.OnClickListener() { |
| 253 | @Override | 254 | @Override |
| 254 | public void onClick(View v) { | 255 | public void onClick(View v) { |
| 255 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 256 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 256 | mContext.startActivity(intent); | 257 | mContext.startActivity(intent); |
| 257 | } | 258 | } |
| 258 | }) | 259 | }) |
| 259 | .show(); | 260 | .show(); |
| 260 | 261 | ||
| 261 | } | 262 | } |
| 262 | }); | 263 | }); |
| 263 | } | 264 | } |
| 264 | 265 | ||
| 265 | //修改密码 | 266 | //修改密码 |
| 266 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 267 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
| 267 | RequestParams params = new RequestParams(); | 268 | RequestParams params = new RequestParams(); |
| 268 | params.put(HttpKey.USERNAME, username); | 269 | params.put(HttpKey.USERNAME, username); |
| 269 | params.put(HttpKey.OLDPASS, old_pwd1); | 270 | params.put(HttpKey.OLDPASS, old_pwd1); |
| 270 | params.put(HttpKey.NEWPASS, newpassword3); | 271 | params.put(HttpKey.NEWPASS, newpassword3); |
| 271 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 272 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 272 | HttpClient.getInstance().setTimeout(10 * 1000); | 273 | HttpClient.getInstance().setTimeout(10 * 1000); |
| 273 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 274 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
| 274 | @Override | 275 | @Override |
| 275 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 276 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 276 | try { | 277 | try { |
| 277 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 278 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 278 | String status = jsonObject.optString("status"); | 279 | String status = jsonObject.optString("status"); |
| 279 | if (status.equals("100")) { | 280 | if (status.equals("100")) { |
| 280 | Log.e("test", "onSuccess" + new String(bytes)); | 281 | Log.e("test", "onSuccess" + new String(bytes)); |
| 281 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 282 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 282 | SaveParam.getInstance().clearData((Activity) context); | 283 | SaveParam.getInstance().clearData((Activity) context); |
| 283 | Intent intent = new Intent(); | 284 | Intent intent = new Intent(); |
| 284 | intent.setClass(context, LoginAndRegisterActivity.class); | 285 | intent.setClass(context, LoginAndRegisterActivity.class); |
| 285 | ((Activity) context).startActivity(intent); | 286 | ((Activity) context).startActivity(intent); |
| 286 | ((Activity) context).finish(); | 287 | ((Activity) context).finish(); |
| 287 | } else { | 288 | } else { |
| 288 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 289 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
| 289 | } | 290 | } |
| 290 | } catch (JSONException e) { | 291 | } catch (JSONException e) { |
| 291 | e.printStackTrace(); | 292 | e.printStackTrace(); |
| 292 | } | 293 | } |
| 293 | } | 294 | } |
| 294 | 295 | ||
| 295 | @Override | 296 | @Override |
| 296 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 297 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 297 | Log.e("test", "onFailure" + new String(bytes)); | 298 | Log.e("test", "onFailure" + new String(bytes)); |
| 298 | new CircleDialog.Builder((FragmentActivity) context) | 299 | new CircleDialog.Builder((FragmentActivity) context) |
| 299 | .setCanceledOnTouchOutside(false) | 300 | .setCanceledOnTouchOutside(false) |
| 300 | .setCancelable(false) | 301 | .setCancelable(false) |
| 301 | .setWidth(0.5f) | 302 | .setWidth(0.5f) |
| 302 | .configText(new ConfigText() { | 303 | .configText(new ConfigText() { |
| 303 | @Override | 304 | @Override |
| 304 | public void onConfig(TextParams params) { | 305 | public void onConfig(TextParams params) { |
| 305 | params.gravity = Gravity.CENTER; | 306 | params.gravity = Gravity.CENTER; |
| 306 | params.padding = new int[]{50, 50, 50, 50}; | 307 | params.padding = new int[]{50, 50, 50, 50}; |
| 307 | } | 308 | } |
| 308 | }) | 309 | }) |
| 309 | .setText("当前无网络,请检查网络设置") | 310 | .setText("当前无网络,请检查网络设置") |
| 310 | .setNegative("继续使用", null) | 311 | .setNegative("继续使用", null) |
| 311 | .setPositive("设置网络", new View.OnClickListener() { | 312 | .setPositive("设置网络", new View.OnClickListener() { |
| 312 | @Override | 313 | @Override |
| 313 | public void onClick(View v) { | 314 | public void onClick(View v) { |
| 314 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 315 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 315 | context.startActivity(intent); | 316 | context.startActivity(intent); |
| 316 | } | 317 | } |
| 317 | }) | 318 | }) |
| 318 | .show(); | 319 | .show(); |
| 319 | } | 320 | } |
| 320 | }); | 321 | }); |
| 321 | 322 | ||
| 322 | } | 323 | } |
| 323 | 324 | ||
| 324 | //忘记密码 | 325 | //忘记密码 |
| 325 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 326 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
| 326 | RequestParams params = new RequestParams(); | 327 | RequestParams params = new RequestParams(); |
| 327 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 328 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
| 328 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 329 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
| 329 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 330 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
| 330 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 331 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 331 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 332 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
| 332 | @Override | 333 | @Override |
| 333 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 334 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 334 | try { | 335 | try { |
| 335 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 336 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 336 | String status = jsonObject.optString("status"); | 337 | String status = jsonObject.optString("status"); |
| 337 | if (status.equals("100")) { | 338 | if (status.equals("100")) { |
| 338 | Log.e("test", "onSuccess" + new String(bytes)); | 339 | Log.e("test", "onSuccess" + new String(bytes)); |
| 339 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 340 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 340 | ((Activity) context).finish(); | 341 | ((Activity) context).finish(); |
| 341 | } else { | 342 | } else { |
| 342 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 343 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
| 343 | } | 344 | } |
| 344 | } catch (JSONException e) { | 345 | } catch (JSONException e) { |
| 345 | e.printStackTrace(); | 346 | e.printStackTrace(); |
| 346 | } | 347 | } |
| 347 | } | 348 | } |
| 348 | 349 | ||
| 349 | @Override | 350 | @Override |
| 350 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 351 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 351 | Log.e("test", "onFailure" + new String(bytes)); | 352 | Log.e("test", "onFailure" + new String(bytes)); |
| 352 | new CircleDialog.Builder((FragmentActivity) context) | 353 | new CircleDialog.Builder((FragmentActivity) context) |
| 353 | .setCanceledOnTouchOutside(false) | 354 | .setCanceledOnTouchOutside(false) |
| 354 | .setCancelable(false) | 355 | .setCancelable(false) |
| 355 | .setWidth(0.5f) | 356 | .setWidth(0.5f) |
| 356 | .configText(new ConfigText() { | 357 | .configText(new ConfigText() { |
| 357 | @Override | 358 | @Override |
| 358 | public void onConfig(TextParams params) { | 359 | public void onConfig(TextParams params) { |
| 359 | params.gravity = Gravity.CENTER; | 360 | params.gravity = Gravity.CENTER; |
| 360 | params.padding = new int[]{50, 50, 50, 50}; | 361 | params.padding = new int[]{50, 50, 50, 50}; |
| 361 | } | 362 | } |
| 362 | }) | 363 | }) |
| 363 | .setText("当前无网络,请检查网络设置") | 364 | .setText("当前无网络,请检查网络设置") |
| 364 | .setNegative("继续使用", null) | 365 | .setNegative("继续使用", null) |
| 365 | .setPositive("设置网络", new View.OnClickListener() { | 366 | .setPositive("设置网络", new View.OnClickListener() { |
| 366 | @Override | 367 | @Override |
| 367 | public void onClick(View v) { | 368 | public void onClick(View v) { |
| 368 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 369 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 369 | context.startActivity(intent); | 370 | context.startActivity(intent); |
| 370 | } | 371 | } |
| 371 | }) | 372 | }) |
| 372 | .show(); | 373 | .show(); |
| 373 | } | 374 | } |
| 374 | }); | 375 | }); |
| 375 | 376 | ||
| 376 | } | 377 | } |
| 377 | 378 | ||
| 378 | //保存用户登录信息 | 379 | //保存用户登录信息 |
| 379 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { | 380 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { |
| 380 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 381 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
| 381 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 382 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
| 382 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 383 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
| 383 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); | 384 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); |
| 384 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 385 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
| 385 | 386 | ||
| 386 | 387 | ||
| 387 | } | 388 | } |
| 388 | 389 | ||
| 389 | //提交保卡信息 | 390 | //提交保卡信息 |
| 390 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 391 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
| 391 | String buyAddress, String buyTime, String alterSaleCall, | 392 | String buyAddress, String buyTime, String alterSaleCall, |
| 392 | String productModel, String deviceNumber, String macAddress, | 393 | String productModel, String deviceNumber, String macAddress, |
| 393 | String mobilePhone) { | 394 | String mobilePhone) { |
| 394 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 395 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
| 395 | false, true, null); | 396 | false, true, null); |
| 396 | RequestParams params = new RequestParams(); | 397 | RequestParams params = new RequestParams(); |
| 397 | 398 | ||
| 398 | params.put(HttpKey.USEID, userId); | 399 | params.put(HttpKey.USEID, userId); |
| 399 | params.put(HttpKey.CUSTOMENAME, customerName); | 400 | params.put(HttpKey.CUSTOMENAME, customerName); |
| 400 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 401 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
| 401 | params.put(HttpKey.BUYADREES, buyAddress); | 402 | params.put(HttpKey.BUYADREES, buyAddress); |
| 402 | params.put(HttpKey.BUYTIME, buyTime); | 403 | params.put(HttpKey.BUYTIME, buyTime); |
| 403 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 404 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
| 404 | params.put(HttpKey.PRODUCTMODEL, productModel); | 405 | params.put(HttpKey.PRODUCTMODEL, productModel); |
| 405 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 406 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
| 406 | params.put(HttpKey.MACADRESS, macAddress); | 407 | params.put(HttpKey.MACADRESS, macAddress); |
| 407 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 408 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
| 408 | 409 | ||
| 409 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 410 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 410 | 411 | ||
| 411 | Log.e("test", "params" + params); | 412 | Log.e("test", "params" + params); |
| 412 | HttpClient.getInstance().setTimeout(5 * 1000); | 413 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 413 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 414 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
| 414 | @Override | 415 | @Override |
| 415 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 416 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 416 | JSONObject jsonObject = null; | 417 | JSONObject jsonObject = null; |
| 417 | closeProgress(); | 418 | closeProgress(); |
| 418 | try { | 419 | try { |
| 419 | jsonObject = new JSONObject(new String(bytes)); | 420 | jsonObject = new JSONObject(new String(bytes)); |
| 420 | String status = jsonObject.optString("status"); | 421 | String status = jsonObject.optString("status"); |
| 421 | if (status.equals("1")) { | 422 | if (status.equals("1")) { |
| 422 | Log.e("test", "onSuccess" + jsonObject); | 423 | Log.e("test", "onSuccess" + jsonObject); |
| 423 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 424 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
| 424 | Intent intent = new Intent(); | 425 | Intent intent = new Intent(); |
| 425 | intent.setClass((Activity) context, TheStartPageActivity.class); | 426 | intent.setClass((Activity) context, TheStartPageActivity.class); |
| 426 | ((Activity) context).startActivity(intent); | 427 | ((Activity) context).startActivity(intent); |
| 427 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 428 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 428 | ((Activity) context).finish(); | 429 | ((Activity) context).finish(); |
| 429 | } else { | 430 | } else { |
| 430 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 431 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
| 431 | } | 432 | } |
| 432 | } catch (JSONException e) { | 433 | } catch (JSONException e) { |
| 433 | e.printStackTrace(); | 434 | e.printStackTrace(); |
| 434 | } | 435 | } |
| 435 | 436 | ||
| 436 | 437 | ||
| 437 | } | 438 | } |
| 438 | 439 | ||
| 439 | @Override | 440 | @Override |
| 440 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 441 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 441 | Log.e("test", "onFailure" + (throwable)); | 442 | Log.e("test", "onFailure" + (throwable)); |
| 442 | closeProgress(); | 443 | closeProgress(); |
| 443 | new CircleDialog.Builder((FragmentActivity) context) | 444 | new CircleDialog.Builder((FragmentActivity) context) |
| 444 | .setCanceledOnTouchOutside(false) | 445 | .setCanceledOnTouchOutside(false) |
| 445 | .setCancelable(false) | 446 | .setCancelable(false) |
| 446 | .setWidth(0.5f) | 447 | .setWidth(0.5f) |
| 447 | .configText(new ConfigText() { | 448 | .configText(new ConfigText() { |
| 448 | @Override | 449 | @Override |
| 449 | public void onConfig(TextParams params) { | 450 | public void onConfig(TextParams params) { |
| 450 | params.gravity = Gravity.CENTER; | 451 | params.gravity = Gravity.CENTER; |
| 451 | params.padding = new int[]{50, 50, 50, 50}; | 452 | params.padding = new int[]{50, 50, 50, 50}; |
| 452 | } | 453 | } |
| 453 | }) | 454 | }) |
| 454 | .setText("当前无网络,请检查网络设置") | 455 | .setText("当前无网络,请检查网络设置") |
| 455 | .setNegative("继续使用", null) | 456 | .setNegative("继续使用", null) |
| 456 | .setPositive("设置网络", new View.OnClickListener() { | 457 | .setPositive("设置网络", new View.OnClickListener() { |
| 457 | @Override | 458 | @Override |
| 458 | public void onClick(View v) { | 459 | public void onClick(View v) { |
| 459 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 460 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 460 | context.startActivity(intent); | 461 | context.startActivity(intent); |
| 461 | } | 462 | } |
| 462 | }) | 463 | }) |
| 463 | .show(); | 464 | .show(); |
| 464 | 465 | ||
| 465 | } | 466 | } |
| 466 | }); | 467 | }); |
| 467 | 468 | ||
| 468 | } | 469 | } |
| 469 | 470 | ||
| 470 | //获取保卡信息 | 471 | //获取保卡信息 |
| 471 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { | 472 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { |
| 472 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 473 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
| 473 | false, true, null); | 474 | false, true, null); |
| 474 | HttpClient.getInstance().setTimeout(5 * 1000); | 475 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 475 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 476 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 476 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { | 477 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 477 | @Override | 478 | @Override |
| 478 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 479 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 479 | closeProgress(); | 480 | closeProgress(); |
| 480 | Log.e("test", "保卡信息" + new String(arg2)); | 481 | Log.e("test", "保卡信息" + new String(arg2)); |
| 481 | try { | 482 | try { |
| 482 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 483 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 483 | int status = jsonObject.optInt("status"); | 484 | int status = jsonObject.optInt("status"); |
| 484 | if (status == 1) { | 485 | if (status == 1) { |
| 485 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 486 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
| 486 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 487 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
| 487 | Message msg = Message.obtain(); | 488 | Message msg = Message.obtain(); |
| 488 | msg.what = HttpCode.SUCHCARDINFO; | 489 | msg.what = HttpCode.SUCHCARDINFO; |
| 489 | msg.obj = schoolInfoBeanList; | 490 | msg.obj = schoolInfoBeanList; |
| 490 | handler.sendMessage(msg); | 491 | handler.sendMessage(msg); |
| 491 | 492 | ||
| 492 | 493 | ||
| 493 | } else { | 494 | } else { |
| 494 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 495 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 495 | 496 | ||
| 496 | } | 497 | } |
| 497 | } catch (JSONException e) { | 498 | } catch (JSONException e) { |
| 498 | e.printStackTrace(); | 499 | e.printStackTrace(); |
| 499 | } | 500 | } |
| 500 | 501 | ||
| 501 | } | 502 | } |
| 502 | 503 | ||
| 503 | @Override | 504 | @Override |
| 504 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 505 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 505 | closeProgress(); | 506 | closeProgress(); |
| 506 | new CircleDialog.Builder((FragmentActivity) mContext) | 507 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 507 | .setCanceledOnTouchOutside(false) | 508 | .setCanceledOnTouchOutside(false) |
| 508 | .setCancelable(false) | 509 | .setCancelable(false) |
| 509 | .setWidth(0.5f) | 510 | .setWidth(0.5f) |
| 510 | .configText(new ConfigText() { | 511 | .configText(new ConfigText() { |
| 511 | @Override | 512 | @Override |
| 512 | public void onConfig(TextParams params) { | 513 | public void onConfig(TextParams params) { |
| 513 | params.gravity = Gravity.CENTER; | 514 | params.gravity = Gravity.CENTER; |
| 514 | params.padding = new int[]{50, 50, 50, 50}; | 515 | params.padding = new int[]{50, 50, 50, 50}; |
| 515 | } | 516 | } |
| 516 | }) | 517 | }) |
| 517 | .setText("当前无网络,请检查网络设置") | 518 | .setText("当前无网络,请检查网络设置") |
| 518 | .setNegative("继续使用", null) | 519 | .setNegative("继续使用", null) |
| 519 | .setPositive("设置网络", new View.OnClickListener() { | 520 | .setPositive("设置网络", new View.OnClickListener() { |
| 520 | @Override | 521 | @Override |
| 521 | public void onClick(View v) { | 522 | public void onClick(View v) { |
| 522 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 523 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 523 | mContext.startActivity(intent); | 524 | mContext.startActivity(intent); |
| 524 | } | 525 | } |
| 525 | }) | 526 | }) |
| 526 | .show(); | 527 | .show(); |
| 527 | } | 528 | } |
| 528 | }); | 529 | }); |
| 529 | } | 530 | } |
| 530 | 531 | ||
| 531 | //修改保卡信息电话 | 532 | //修改保卡信息电话 |
| 532 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { | 533 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { |
| 533 | RequestParams params = new RequestParams(); | 534 | RequestParams params = new RequestParams(); |
| 534 | params.put("userId", userId); | 535 | params.put("userId", userId); |
| 535 | params.put("customerPhone", customerPhone); | 536 | params.put("customerPhone", customerPhone); |
| 536 | params.put("authCode", authCode); | 537 | params.put("authCode", authCode); |
| 537 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 538 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 538 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 539 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 539 | @Override | 540 | @Override |
| 540 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 541 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 541 | try { | 542 | try { |
| 542 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 543 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 543 | String status = jsonObject.optString("status"); | 544 | String status = jsonObject.optString("status"); |
| 544 | if (status.equals("1")) { | 545 | if (status.equals("1")) { |
| 545 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 546 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 546 | if (Content.authcodeflag==2){ | 547 | if (Content.authcodeflag==2){ |
| 547 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 548 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
| 548 | }else if (Content.authcodeflag==1){ | 549 | }else if (Content.authcodeflag==1){ |
| 549 | SaveParam.getInstance().saveLoginParam(mContext, "username", customerPhone); | 550 | SaveParam.getInstance().saveLoginParam(mContext, "username", customerPhone); |
| 550 | }else { | 551 | }else { |
| 551 | AlertUtils.showToast(mContext, "修改未知的手机号"); | 552 | AlertUtils.showToast(mContext, "修改未知的手机号"); |
| 552 | } | 553 | } |
| 553 | ((Activity) mContext).finish(); | 554 | ((Activity) mContext).finish(); |
| 554 | } else if (status.equals("1001")) { | 555 | } else if (status.equals("1001")) { |
| 555 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 556 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 556 | } else { | 557 | } else { |
| 557 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 558 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 558 | } | 559 | } |
| 559 | } catch (JSONException e) { | 560 | } catch (JSONException e) { |
| 560 | e.printStackTrace(); | 561 | e.printStackTrace(); |
| 561 | } | 562 | } |
| 562 | } | 563 | } |
| 563 | 564 | ||
| 564 | @Override | 565 | @Override |
| 565 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 566 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 566 | Log.e("test", "onFailure" + new String(bytes)); | 567 | Log.e("test", "onFailure" + new String(bytes)); |
| 567 | new CircleDialog.Builder((FragmentActivity) mContext) | 568 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 568 | .setCanceledOnTouchOutside(false) | 569 | .setCanceledOnTouchOutside(false) |
| 569 | .setCancelable(false) | 570 | .setCancelable(false) |
| 570 | .setWidth(0.5f) | 571 | .setWidth(0.5f) |
| 571 | .configText(new ConfigText() { | 572 | .configText(new ConfigText() { |
| 572 | @Override | 573 | @Override |
| 573 | public void onConfig(TextParams params) { | 574 | public void onConfig(TextParams params) { |
| 574 | params.gravity = Gravity.CENTER; | 575 | params.gravity = Gravity.CENTER; |
| 575 | params.padding = new int[]{50, 50, 50, 50}; | 576 | params.padding = new int[]{50, 50, 50, 50}; |
| 576 | } | 577 | } |
| 577 | }) | 578 | }) |
| 578 | .setText("当前无网络,请检查网络设置") | 579 | .setText("当前无网络,请检查网络设置") |
| 579 | .setNegative("继续使用", null) | 580 | .setNegative("继续使用", null) |
| 580 | .setPositive("设置网络", new View.OnClickListener() { | 581 | .setPositive("设置网络", new View.OnClickListener() { |
| 581 | @Override | 582 | @Override |
| 582 | public void onClick(View v) { | 583 | public void onClick(View v) { |
| 583 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 584 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 584 | mContext.startActivity(intent); | 585 | mContext.startActivity(intent); |
| 585 | } | 586 | } |
| 586 | }) | 587 | }) |
| 587 | .show(); | 588 | .show(); |
| 588 | } | 589 | } |
| 589 | }); | 590 | }); |
| 590 | } | 591 | } |
| 591 | 592 | ||
| 592 | //修改保卡信息地址 | 593 | //修改保卡信息地址 |
| 593 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { | 594 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { |
| 594 | RequestParams params = new RequestParams(); | 595 | RequestParams params = new RequestParams(); |
| 595 | params.put("userId", userId); | 596 | params.put("userId", userId); |
| 596 | params.put("customerPhone", customerPhone); | 597 | params.put("customerPhone", customerPhone); |
| 597 | params.put("authCode", authCode); | 598 | params.put("authCode", authCode); |
| 598 | params.put("customerAddress", customerAddress); | 599 | params.put("customerAddress", customerAddress); |
| 599 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 600 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 600 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 601 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 601 | @Override | 602 | @Override |
| 602 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 603 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 603 | try { | 604 | try { |
| 604 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 605 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 605 | String status = jsonObject.optString("status"); | 606 | String status = jsonObject.optString("status"); |
| 606 | if (status.equals("1")) { | 607 | if (status.equals("1")) { |
| 607 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 608 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 608 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 609 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
| 609 | ((Activity) mContext).finish(); | 610 | ((Activity) mContext).finish(); |
| 610 | } else { | 611 | } else { |
| 611 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 612 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 612 | } | 613 | } |
| 613 | } catch (JSONException e) { | 614 | } catch (JSONException e) { |
| 614 | e.printStackTrace(); | 615 | e.printStackTrace(); |
| 615 | } | 616 | } |
| 616 | } | 617 | } |
| 617 | 618 | ||
| 618 | @Override | 619 | @Override |
| 619 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 620 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 620 | Log.e("test", "onFailure" + new String(bytes)); | 621 | Log.e("test", "onFailure" + new String(bytes)); |
| 621 | new CircleDialog.Builder((FragmentActivity) mContext) | 622 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 622 | .setCanceledOnTouchOutside(false) | 623 | .setCanceledOnTouchOutside(false) |
| 623 | .setCancelable(false) | 624 | .setCancelable(false) |
| 624 | .setWidth(0.5f) | 625 | .setWidth(0.5f) |
| 625 | .configText(new ConfigText() { | 626 | .configText(new ConfigText() { |
| 626 | @Override | 627 | @Override |
| 627 | public void onConfig(TextParams params) { | 628 | public void onConfig(TextParams params) { |
| 628 | params.gravity = Gravity.CENTER; | 629 | params.gravity = Gravity.CENTER; |
| 629 | params.padding = new int[]{50, 50, 50, 50}; | 630 | params.padding = new int[]{50, 50, 50, 50}; |
| 630 | } | 631 | } |
| 631 | }) | 632 | }) |
| 632 | .setText("当前无网络,请检查网络设置") | 633 | .setText("当前无网络,请检查网络设置") |
| 633 | .setNegative("继续使用", null) | 634 | .setNegative("继续使用", null) |
| 634 | .setPositive("设置网络", new View.OnClickListener() { | 635 | .setPositive("设置网络", new View.OnClickListener() { |
| 635 | @Override | 636 | @Override |
| 636 | public void onClick(View v) { | 637 | public void onClick(View v) { |
| 637 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 638 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 638 | mContext.startActivity(intent); | 639 | mContext.startActivity(intent); |
| 639 | } | 640 | } |
| 640 | }) | 641 | }) |
| 641 | .show(); | 642 | .show(); |
| 642 | } | 643 | } |
| 643 | }); | 644 | }); |
| 644 | } | 645 | } |
| 645 | 646 | ||
| 646 | //验证是否保卡信息 | 647 | //验证是否保卡信息 |
| 647 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { | 648 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { |
| 648 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 649 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
| 649 | false, true, null); | 650 | false, true, null); |
| 650 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 651 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 651 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { | 652 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 652 | @Override | 653 | @Override |
| 653 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 654 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 654 | Log.e("test", "---" + new String(arg2)); | 655 | Log.e("test", "---" + new String(arg2)); |
| 655 | closeProgress(); | 656 | closeProgress(); |
| 656 | Message msg = Message.obtain(); | 657 | Message msg = Message.obtain(); |
| 657 | msg.what = HttpCode.CHECKCARD; | 658 | msg.what = HttpCode.CHECKCARD; |
| 658 | msg.obj = new String(arg2); | 659 | msg.obj = new String(arg2); |
| 659 | handler.sendMessage(msg); | 660 | handler.sendMessage(msg); |
| 660 | 661 | ||
| 661 | 662 | ||
| 662 | } | 663 | } |
| 663 | 664 | ||
| 664 | @Override | 665 | @Override |
| 665 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 666 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 666 | closeProgress(); | 667 | closeProgress(); |
| 667 | new CircleDialog.Builder((FragmentActivity) mContext) | 668 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 668 | .setCanceledOnTouchOutside(false) | 669 | .setCanceledOnTouchOutside(false) |
| 669 | .setCancelable(false) | 670 | .setCancelable(false) |
| 670 | .setWidth(0.5f) | 671 | .setWidth(0.5f) |
| 671 | .configText(new ConfigText() { | 672 | .configText(new ConfigText() { |
| 672 | @Override | 673 | @Override |
| 673 | public void onConfig(TextParams params) { | 674 | public void onConfig(TextParams params) { |
| 674 | params.gravity = Gravity.CENTER; | 675 | params.gravity = Gravity.CENTER; |
| 675 | params.padding = new int[]{50, 50, 50, 50}; | 676 | params.padding = new int[]{50, 50, 50, 50}; |
| 676 | } | 677 | } |
| 677 | }) | 678 | }) |
| 678 | .setText("当前无网络,请检查网络设置") | 679 | .setText("当前无网络,请检查网络设置") |
| 679 | .setNegative("继续使用", null) | 680 | .setNegative("继续使用", null) |
| 680 | .setPositive("设置网络", new View.OnClickListener() { | 681 | .setPositive("设置网络", new View.OnClickListener() { |
| 681 | @Override | 682 | @Override |
| 682 | public void onClick(View v) { | 683 | public void onClick(View v) { |
| 683 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 684 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 684 | mContext.startActivity(intent); | 685 | mContext.startActivity(intent); |
| 685 | } | 686 | } |
| 686 | }) | 687 | }) |
| 687 | .show(); | 688 | .show(); |
| 688 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 689 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
| 689 | } | 690 | } |
| 690 | }); | 691 | }); |
| 691 | } | 692 | } |
| 692 | 693 | ||
| 693 | ///获取年级 | 694 | ///获取年级 |
| 694 | public void getgrade(final Context mContext, final Handler handler) { | 695 | public void getgrade(final Context mContext, final Handler handler) { |
| 695 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 696 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 696 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 697 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
| 697 | @Override | 698 | @Override |
| 698 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 699 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 699 | Log.e("test", "年级" + new String(arg2)); | 700 | Log.e("test", "年级" + new String(arg2)); |
| 700 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 701 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
| 701 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 702 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
| 702 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 703 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
| 703 | String name = gradeInfo.getData().get(i).getName(); | 704 | String name = gradeInfo.getData().get(i).getName(); |
| 704 | int id = gradeInfo.getData().get(i).getId(); | 705 | int id = gradeInfo.getData().get(i).getId(); |
| 705 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 706 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
| 706 | for (int j = 0; j < gradeinfoList.size(); j++) { | 707 | for (int j = 0; j < gradeinfoList.size(); j++) { |
| 707 | String secondname = gradeinfoList.get(j).getName(); | 708 | String secondname = gradeinfoList.get(j).getName(); |
| 708 | int secondid = gradeinfoList.get(j).getId(); | 709 | int secondid = gradeinfoList.get(j).getId(); |
| 709 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 710 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
| 710 | dataBean.setName(secondname); | 711 | dataBean.setName(secondname); |
| 711 | dataBean.setId(secondid); | 712 | dataBean.setId(secondid); |
| 712 | gradeInfoLists.add(dataBean); | 713 | gradeInfoLists.add(dataBean); |
| 713 | } | 714 | } |
| 714 | 715 | ||
| 715 | } | 716 | } |
| 716 | 717 | ||
| 717 | Message message = Message.obtain(); | 718 | Message message = Message.obtain(); |
| 718 | message.what = HttpCode.GRADER; | 719 | message.what = HttpCode.GRADER; |
| 719 | message.obj = gradeInfoLists; | 720 | message.obj = gradeInfoLists; |
| 720 | handler.sendMessage(message); | 721 | handler.sendMessage(message); |
| 721 | 722 | ||
| 722 | 723 | ||
| 723 | } | 724 | } |
| 724 | 725 | ||
| 725 | @Override | 726 | @Override |
| 726 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 727 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 727 | new CircleDialog.Builder((FragmentActivity) mContext) | 728 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 728 | .setCanceledOnTouchOutside(false) | 729 | .setCanceledOnTouchOutside(false) |
| 729 | .setCancelable(false) | 730 | .setCancelable(false) |
| 730 | .setWidth(0.5f) | 731 | .setWidth(0.5f) |
| 731 | .configText(new ConfigText() { | 732 | .configText(new ConfigText() { |
| 732 | @Override | 733 | @Override |
| 733 | public void onConfig(TextParams params) { | 734 | public void onConfig(TextParams params) { |
| 734 | params.gravity = Gravity.CENTER; | 735 | params.gravity = Gravity.CENTER; |
| 735 | params.padding = new int[]{50, 50, 50, 50}; | 736 | params.padding = new int[]{50, 50, 50, 50}; |
| 736 | } | 737 | } |
| 737 | }) | 738 | }) |
| 738 | .setText("当前无网络,请检查网络设置") | 739 | .setText("当前无网络,请检查网络设置") |
| 739 | .setNegative("继续使用", null) | 740 | .setNegative("继续使用", null) |
| 740 | .setPositive("设置网络", new View.OnClickListener() { | 741 | .setPositive("设置网络", new View.OnClickListener() { |
| 741 | @Override | 742 | @Override |
| 742 | public void onClick(View v) { | 743 | public void onClick(View v) { |
| 743 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 744 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 744 | mContext.startActivity(intent); | 745 | mContext.startActivity(intent); |
| 745 | } | 746 | } |
| 746 | }) | 747 | }) |
| 747 | .show(); | 748 | .show(); |
| 748 | } | 749 | } |
| 749 | }); | 750 | }); |
| 750 | } | 751 | } |
| 751 | 752 | ||
| 752 | /** | 753 | /** |
| 753 | * 获取学校 | 754 | * 获取学校 |
| 754 | * | 755 | * |
| 755 | * @param mContext | 756 | * @param mContext |
| 756 | * @param regionId | 757 | * @param regionId |
| 757 | * @param gradeId | 758 | * @param gradeId |
| 758 | * @param handler | 759 | * @param handler |
| 759 | */ | 760 | */ |
| 760 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 761 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
| 761 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 762 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 762 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 763 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
| 763 | @Override | 764 | @Override |
| 764 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 765 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 765 | Log.e("test", "学校" + new String(arg2)); | 766 | Log.e("test", "学校" + new String(arg2)); |
| 766 | try { | 767 | try { |
| 767 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 768 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 768 | int status = jsonObject.optInt("status"); | 769 | int status = jsonObject.optInt("status"); |
| 769 | if (status == 1) { | 770 | if (status == 1) { |
| 770 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 771 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
| 771 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 772 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
| 772 | Message message = Message.obtain(); | 773 | Message message = Message.obtain(); |
| 773 | message.what = HttpCode.SCHOOL; | 774 | message.what = HttpCode.SCHOOL; |
| 774 | message.obj = schoolInfoBeanList; | 775 | message.obj = schoolInfoBeanList; |
| 775 | handler.sendMessage(message); | 776 | handler.sendMessage(message); |
| 776 | 777 | ||
| 777 | 778 | ||
| 778 | } else { | 779 | } else { |
| 779 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 780 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 780 | 781 | ||
| 781 | } | 782 | } |
| 782 | } catch (JSONException e) { | 783 | } catch (JSONException e) { |
| 783 | e.printStackTrace(); | 784 | e.printStackTrace(); |
| 784 | } | 785 | } |
| 785 | 786 | ||
| 786 | } | 787 | } |
| 787 | 788 | ||
| 788 | @Override | 789 | @Override |
| 789 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 790 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 790 | new CircleDialog.Builder((FragmentActivity) mContext) | 791 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 791 | .setCanceledOnTouchOutside(false) | 792 | .setCanceledOnTouchOutside(false) |
| 792 | .setCancelable(false) | 793 | .setCancelable(false) |
| 793 | .setWidth(0.5f) | 794 | .setWidth(0.5f) |
| 794 | .configText(new ConfigText() { | 795 | .configText(new ConfigText() { |
| 795 | @Override | 796 | @Override |
| 796 | public void onConfig(TextParams params) { | 797 | public void onConfig(TextParams params) { |
| 797 | params.gravity = Gravity.CENTER; | 798 | params.gravity = Gravity.CENTER; |
| 798 | params.padding = new int[]{50, 50, 50, 50}; | 799 | params.padding = new int[]{50, 50, 50, 50}; |
| 799 | } | 800 | } |
| 800 | }) | 801 | }) |
| 801 | .setText("当前无网络,请检查网络设置") | 802 | .setText("当前无网络,请检查网络设置") |
| 802 | .setNegative("继续使用", null) | 803 | .setNegative("继续使用", null) |
| 803 | .setPositive("设置网络", new View.OnClickListener() { | 804 | .setPositive("设置网络", new View.OnClickListener() { |
| 804 | @Override | 805 | @Override |
| 805 | public void onClick(View v) { | 806 | public void onClick(View v) { |
| 806 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 807 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 807 | mContext.startActivity(intent); | 808 | mContext.startActivity(intent); |
| 808 | } | 809 | } |
| 809 | }) | 810 | }) |
| 810 | .show(); | 811 | .show(); |
| 811 | } | 812 | } |
| 812 | }); | 813 | }); |
| 813 | } | 814 | } |
| 814 | 815 | ||
| 815 | 816 | ||
| 816 | /** | 817 | /** |
| 817 | * 获取个人信息 | 818 | * 获取个人信息 |
| 818 | * | 819 | * |
| 819 | * @param mContext | 820 | * @param mContext |
| 820 | * @param userId | 821 | * @param userId |
| 821 | * @param handler | 822 | * @param handler |
| 822 | */ | 823 | */ |
| 823 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { | 824 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
| 824 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 825 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
| 825 | false, true, null); | 826 | false, true, null); |
| 826 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 827 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 827 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 828 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
| 828 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 829 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 829 | @Override | 830 | @Override |
| 830 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 831 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 831 | closeProgress(); | 832 | closeProgress(); |
| 832 | Log.e("test", "个人信息" + new String(arg2)); | 833 | Log.e("test", "个人信息" + new String(arg2)); |
| 833 | try { | 834 | try { |
| 834 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 835 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 835 | int status = jsonObject.optInt("status"); | 836 | int status = jsonObject.optInt("status"); |
| 836 | if (status == 1) { | 837 | if (status == 1) { |
| 837 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 838 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
| 838 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 839 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
| 839 | Message message = Message.obtain(); | 840 | Message message = Message.obtain(); |
| 840 | message.what = HttpCode.GETINFO; | 841 | message.what = HttpCode.GETINFO; |
| 841 | message.obj = pesonalInfoBeanList; | 842 | message.obj = pesonalInfoBeanList; |
| 842 | handler.sendMessage(message); | 843 | handler.sendMessage(message); |
| 843 | 844 | ||
| 844 | 845 | ||
| 845 | } else { | 846 | } else { |
| 846 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 847 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 847 | 848 | ||
| 848 | } | 849 | } |
| 849 | } catch (JSONException e) { | 850 | } catch (JSONException e) { |
| 850 | e.printStackTrace(); | 851 | e.printStackTrace(); |
| 851 | } | 852 | } |
| 852 | 853 | ||
| 853 | 854 | ||
| 854 | } | 855 | } |
| 855 | 856 | ||
| 856 | @Override | 857 | @Override |
| 857 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 858 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 858 | closeProgress(); | 859 | closeProgress(); |
| 859 | new CircleDialog.Builder((FragmentActivity) mContext) | 860 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 860 | .setCanceledOnTouchOutside(false) | 861 | .setCanceledOnTouchOutside(false) |
| 861 | .setCancelable(false) | 862 | .setCancelable(false) |
| 862 | .setWidth(0.5f) | 863 | .setWidth(0.5f) |
| 863 | .configText(new ConfigText() { | 864 | .configText(new ConfigText() { |
| 864 | @Override | 865 | @Override |
| 865 | public void onConfig(TextParams params) { | 866 | public void onConfig(TextParams params) { |
| 866 | params.gravity = Gravity.CENTER; | 867 | params.gravity = Gravity.CENTER; |
| 867 | params.padding = new int[]{50, 50, 50, 50}; | 868 | params.padding = new int[]{50, 50, 50, 50}; |
| 868 | } | 869 | } |
| 869 | }) | 870 | }) |
| 870 | .setText("当前无网络,请检查网络设置") | 871 | .setText("当前无网络,请检查网络设置") |
| 871 | .setNegative("继续使用", null) | 872 | .setNegative("继续使用", null) |
| 872 | .setPositive("设置网络", new View.OnClickListener() { | 873 | .setPositive("设置网络", new View.OnClickListener() { |
| 873 | @Override | 874 | @Override |
| 874 | public void onClick(View v) { | 875 | public void onClick(View v) { |
| 875 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 876 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 876 | mContext.startActivity(intent); | 877 | mContext.startActivity(intent); |
| 877 | } | 878 | } |
| 878 | }) | 879 | }) |
| 879 | .show(); | 880 | .show(); |
| 880 | } | 881 | } |
| 881 | }); | 882 | }); |
| 882 | } | 883 | } |
| 883 | 884 | ||
| 884 | //修改个人信息 | 885 | //修改个人信息 |
| 885 | public void changepresonalinfo(final Context mContext, Long id, int type | 886 | public void changepresonalinfo(final Context mContext, Long id, int type |
| 886 | , String name, String birthday, int gradeId, long regionId, | 887 | , String name, String birthday, int gradeId, long regionId, |
| 887 | Object schoolId, String qq, String gender | 888 | Object schoolId, String qq, String gender |
| 888 | , String regionName, String devicenumber) throws UnsupportedEncodingException { | 889 | , String regionName, String devicenumber) throws UnsupportedEncodingException { |
| 889 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 890 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
| 890 | false, true, null); | 891 | false, true, null); |
| 891 | RequestParams params = new RequestParams(); | 892 | RequestParams params = new RequestParams(); |
| 892 | 893 | ||
| 893 | params.put(HttpKey.USEID, id); | 894 | params.put(HttpKey.USEID, id); |
| 894 | params.put(HttpKey.TYPE, type); | 895 | params.put(HttpKey.TYPE, type); |
| 895 | params.put(HttpKey.NAME, name); | 896 | params.put(HttpKey.NAME, name); |
| 896 | params.put(HttpKey.BIRDays, birthday); | 897 | params.put(HttpKey.BIRDays, birthday); |
| 897 | params.put(HttpKey.GRADE, gradeId); | 898 | params.put(HttpKey.GRADE, gradeId); |
| 898 | params.put(HttpKey.REGION, regionId); | 899 | params.put(HttpKey.REGION, regionId); |
| 899 | params.put(HttpKey.SCHOOL, schoolId); | 900 | params.put(HttpKey.SCHOOL, schoolId); |
| 900 | params.put(HttpKey.QQ, qq); | 901 | params.put(HttpKey.QQ, qq); |
| 901 | params.put(HttpKey.GENDER, gender); | 902 | params.put(HttpKey.GENDER, gender); |
| 902 | params.put(HttpKey.REGIONNAME, regionName); | 903 | params.put(HttpKey.REGIONNAME, regionName); |
| 903 | params.put(HttpKey.DEVINUMBER, devicenumber); | 904 | params.put(HttpKey.DEVINUMBER, devicenumber); |
| 904 | Log.e("test", "个人信息" + params); | 905 | Log.e("test", "个人信息" + params); |
| 905 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 906 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 906 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { | 907 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { |
| 907 | @Override | 908 | @Override |
| 908 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 909 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 909 | super.onSuccess(statusCode, headers, response); | 910 | super.onSuccess(statusCode, headers, response); |
| 910 | closeProgress(); | 911 | closeProgress(); |
| 911 | String status = response.optString("status"); | 912 | String status = response.optString("status"); |
| 912 | if (status.equals("1")) { | 913 | if (status.equals("1")) { |
| 913 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 914 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
| 914 | ((Activity) mContext).finish(); | 915 | ((Activity) mContext).finish(); |
| 915 | } else { | 916 | } else { |
| 916 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 917 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 917 | } | 918 | } |
| 918 | 919 | ||
| 919 | } | 920 | } |
| 920 | 921 | ||
| 921 | @Override | 922 | @Override |
| 922 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 923 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 923 | super.onFailure(statusCode, headers, throwable, errorResponse); | 924 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 924 | closeProgress(); | 925 | closeProgress(); |
| 925 | Log.e("test", "onFailure" + errorResponse); | 926 | Log.e("test", "onFailure" + errorResponse); |
| 926 | new CircleDialog.Builder((FragmentActivity) mContext) | 927 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 927 | .setCanceledOnTouchOutside(false) | 928 | .setCanceledOnTouchOutside(false) |
| 928 | .setCancelable(false) | 929 | .setCancelable(false) |
| 929 | .setWidth(0.5f) | 930 | .setWidth(0.5f) |
| 930 | .configText(new ConfigText() { | 931 | .configText(new ConfigText() { |
| 931 | @Override | 932 | @Override |
| 932 | public void onConfig(TextParams params) { | 933 | public void onConfig(TextParams params) { |
| 933 | params.gravity = Gravity.CENTER; | 934 | params.gravity = Gravity.CENTER; |
| 934 | params.padding = new int[]{50, 50, 50, 50}; | 935 | params.padding = new int[]{50, 50, 50, 50}; |
| 935 | } | 936 | } |
| 936 | }) | 937 | }) |
| 937 | .setText("当前无网络,请检查网络设置") | 938 | .setText("当前无网络,请检查网络设置") |
| 938 | .setNegative("继续使用", null) | 939 | .setNegative("继续使用", null) |
| 939 | .setPositive("设置网络", new View.OnClickListener() { | 940 | .setPositive("设置网络", new View.OnClickListener() { |
| 940 | @Override | 941 | @Override |
| 941 | public void onClick(View v) { | 942 | public void onClick(View v) { |
| 942 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 943 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 943 | mContext.startActivity(intent); | 944 | mContext.startActivity(intent); |
| 944 | } | 945 | } |
| 945 | }) | 946 | }) |
| 946 | .show(); | 947 | .show(); |
| 947 | } | 948 | } |
| 948 | 949 | ||
| 949 | }); | 950 | }); |
| 950 | } | 951 | } |
| 951 | 952 | ||
| 952 | //修改个性签名 | 953 | //修改个性签名 |
| 953 | public void changsignature(final Context mContext, long userId, int type, final String signature) { | 954 | public void changsignature(final Context mContext, long userId, int type, final String signature) { |
| 954 | RequestParams params = new RequestParams(); | 955 | RequestParams params = new RequestParams(); |
| 955 | params.put("userId", userId); | 956 | params.put("userId", userId); |
| 956 | params.put("type", type); | 957 | params.put("type", type); |
| 957 | params.put("signature", signature); | 958 | params.put("signature", signature); |
| 958 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 959 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 959 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 960 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
| 960 | @Override | 961 | @Override |
| 961 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 962 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 962 | try { | 963 | try { |
| 963 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 964 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 964 | String status = jsonObject.optString("status"); | 965 | String status = jsonObject.optString("status"); |
| 965 | if (status.equals("1")) { | 966 | if (status.equals("1")) { |
| 966 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 967 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
| 967 | } else { | 968 | } else { |
| 968 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 969 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 969 | } | 970 | } |
| 970 | } catch (JSONException e) { | 971 | } catch (JSONException e) { |
| 971 | e.printStackTrace(); | 972 | e.printStackTrace(); |
| 972 | } | 973 | } |
| 973 | } | 974 | } |
| 974 | 975 | ||
| 975 | @Override | 976 | @Override |
| 976 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 977 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 977 | Log.e("test", "onFailure" + new String(bytes)); | 978 | Log.e("test", "onFailure" + new String(bytes)); |
| 978 | new CircleDialog.Builder((FragmentActivity) mContext) | 979 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 979 | .setCanceledOnTouchOutside(false) | 980 | .setCanceledOnTouchOutside(false) |
| 980 | .setCancelable(false) | 981 | .setCancelable(false) |
| 981 | .setWidth(0.5f) | 982 | .setWidth(0.5f) |
| 982 | .configText(new ConfigText() { | 983 | .configText(new ConfigText() { |
| 983 | @Override | 984 | @Override |
| 984 | public void onConfig(TextParams params) { | 985 | public void onConfig(TextParams params) { |
| 985 | params.gravity = Gravity.CENTER; | 986 | params.gravity = Gravity.CENTER; |
| 986 | params.padding = new int[]{50, 50, 50, 50}; | 987 | params.padding = new int[]{50, 50, 50, 50}; |
| 987 | } | 988 | } |
| 988 | }) | 989 | }) |
| 989 | .setText("当前无网络,请检查网络设置") | 990 | .setText("当前无网络,请检查网络设置") |
| 990 | .setNegative("继续使用", null) | 991 | .setNegative("继续使用", null) |
| 991 | .setPositive("设置网络", new View.OnClickListener() { | 992 | .setPositive("设置网络", new View.OnClickListener() { |
| 992 | @Override | 993 | @Override |
| 993 | public void onClick(View v) { | 994 | public void onClick(View v) { |
| 994 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 995 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 995 | mContext.startActivity(intent); | 996 | mContext.startActivity(intent); |
| 996 | } | 997 | } |
| 997 | }) | 998 | }) |
| 998 | .show(); | 999 | .show(); |
| 999 | } | 1000 | } |
| 1000 | }); | 1001 | }); |
| 1001 | } | 1002 | } |
| 1002 | 1003 | ||
| 1003 | /** | 1004 | /** |
| 1004 | * 获取个性签名 | 1005 | * 获取个性签名 |
| 1005 | * | 1006 | * |
| 1006 | * @param mContext | 1007 | * @param mContext |
| 1007 | * @param userId | 1008 | * @param userId |
| 1008 | * @param handler | 1009 | * @param handler |
| 1009 | */ | 1010 | */ |
| 1010 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { | 1011 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { |
| 1011 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1012 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1012 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 1013 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1013 | @Override | 1014 | @Override |
| 1014 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1015 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1015 | Log.e("test", "个性签名" + new String(arg2)); | 1016 | Log.e("test", "个性签名" + new String(arg2)); |
| 1016 | try { | 1017 | try { |
| 1017 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1018 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1018 | int status = jsonObject.optInt("status"); | 1019 | int status = jsonObject.optInt("status"); |
| 1019 | if (status == 1) { | 1020 | if (status == 1) { |
| 1020 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 1021 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
| 1021 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 1022 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
| 1022 | Message message = Message.obtain(); | 1023 | Message message = Message.obtain(); |
| 1023 | message.what = HttpCode.SIGN; | 1024 | message.what = HttpCode.SIGN; |
| 1024 | message.obj = signInfoBeanList; | 1025 | message.obj = signInfoBeanList; |
| 1025 | handler.sendMessage(message); | 1026 | handler.sendMessage(message); |
| 1026 | 1027 | ||
| 1027 | 1028 | ||
| 1028 | } else if (status == 1000) { | 1029 | } else if (status == 1000) { |
| 1029 | AlertUtils.showToast(mContext, "您还没有签名哦"); | 1030 | AlertUtils.showToast(mContext, "您还没有签名哦"); |
| 1030 | 1031 | ||
| 1031 | } else { | 1032 | } else { |
| 1032 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1033 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1033 | } | 1034 | } |
| 1034 | } catch (JSONException e) { | 1035 | } catch (JSONException e) { |
| 1035 | e.printStackTrace(); | 1036 | e.printStackTrace(); |
| 1036 | } | 1037 | } |
| 1037 | 1038 | ||
| 1038 | 1039 | ||
| 1039 | } | 1040 | } |
| 1040 | 1041 | ||
| 1041 | @Override | 1042 | @Override |
| 1042 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1043 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1043 | Log.e("test", "失败原因" + arg3); | 1044 | Log.e("test", "失败原因" + arg3); |
| 1044 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1045 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1045 | } | 1046 | } |
| 1046 | }); | 1047 | }); |
| 1047 | } | 1048 | } |
| 1048 | 1049 | ||
| 1049 | /** | 1050 | /** |
| 1050 | * 用户反馈 | 1051 | * 用户反馈 |
| 1051 | * | 1052 | * |
| 1052 | * @param mContext | 1053 | * @param mContext |
| 1053 | * @param userId | 1054 | * @param userId |
| 1054 | * @param content | 1055 | * @param content |
| 1055 | * @param contact | 1056 | * @param contact |
| 1056 | * @param imgs | 1057 | * @param imgs |
| 1057 | * @param feedtype | 1058 | * @param feedtype |
| 1058 | * @throws UnsupportedEncodingException | 1059 | * @throws UnsupportedEncodingException |
| 1059 | */ | 1060 | */ |
| 1060 | public void feedback(final Context mContext, String userId, String content, | 1061 | public void feedback(final Context mContext, String userId, String content, |
| 1061 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { | 1062 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { |
| 1062 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 1063 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
| 1063 | false, true, null); | 1064 | false, true, null); |
| 1064 | File file = new File(imgs); | 1065 | File file = new File(imgs); |
| 1065 | if (file.exists() && file.length() > 0) { | 1066 | if (file.exists() && file.length() > 0) { |
| 1066 | RequestParams params = new RequestParams(); | 1067 | RequestParams params = new RequestParams(); |
| 1067 | try { | 1068 | try { |
| 1068 | params.put("userId", userId); | 1069 | params.put("userId", userId); |
| 1069 | params.put("content", content); | 1070 | params.put("content", content); |
| 1070 | params.put("contact", contact); | 1071 | params.put("contact", contact); |
| 1071 | params.put("imgs", file); | 1072 | params.put("imgs", file); |
| 1072 | params.put("feedtype", feedtype); | 1073 | params.put("feedtype", feedtype); |
| 1073 | } catch (FileNotFoundException e) { | 1074 | } catch (FileNotFoundException e) { |
| 1074 | e.printStackTrace(); | 1075 | e.printStackTrace(); |
| 1075 | } | 1076 | } |
| 1076 | Log.e("test", "onSuccess" + params); | 1077 | Log.e("test", "onSuccess" + params); |
| 1077 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { | 1078 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { |
| 1078 | @Override | 1079 | @Override |
| 1079 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1080 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 1080 | closeProgress(); | 1081 | closeProgress(); |
| 1081 | Log.e("test", "onSuccess" + new String(bytes)); | 1082 | Log.e("test", "onSuccess" + new String(bytes)); |
| 1082 | try { | 1083 | try { |
| 1083 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1084 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 1084 | String status = jsonObject.optString("status"); | 1085 | String status = jsonObject.optString("status"); |
| 1085 | if (status.equals("1")) { | 1086 | if (status.equals("1")) { |
| 1086 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); | 1087 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); |
| 1087 | ((Activity) mContext).finish(); | 1088 | ((Activity) mContext).finish(); |
| 1088 | } else { | 1089 | } else { |
| 1089 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1090 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 1090 | } | 1091 | } |
| 1091 | } catch (JSONException e) { | 1092 | } catch (JSONException e) { |
| 1092 | e.printStackTrace(); | 1093 | e.printStackTrace(); |
| 1093 | } | 1094 | } |
| 1094 | } | 1095 | } |
| 1095 | 1096 | ||
| 1096 | @Override | 1097 | @Override |
| 1097 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1098 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 1098 | closeProgress(); | 1099 | closeProgress(); |
| 1099 | Log.e("test", "错误信息" + new String(bytes)); | 1100 | Log.e("test", "错误信息" + new String(bytes)); |
| 1100 | new CircleDialog.Builder((FragmentActivity) mContext) | 1101 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1101 | .setCanceledOnTouchOutside(false) | 1102 | .setCanceledOnTouchOutside(false) |
| 1102 | .setCancelable(false) | 1103 | .setCancelable(false) |
| 1103 | .setWidth(0.5f) | 1104 | .setWidth(0.5f) |
| 1104 | .configText(new ConfigText() { | 1105 | .configText(new ConfigText() { |
| 1105 | @Override | 1106 | @Override |
| 1106 | public void onConfig(TextParams params) { | 1107 | public void onConfig(TextParams params) { |
| 1107 | params.gravity = Gravity.CENTER; | 1108 | params.gravity = Gravity.CENTER; |
| 1108 | params.padding = new int[]{50, 50, 50, 50}; | 1109 | params.padding = new int[]{50, 50, 50, 50}; |
| 1109 | } | 1110 | } |
| 1110 | }) | 1111 | }) |
| 1111 | .setText("当前无网络,请检查网络设置") | 1112 | .setText("当前无网络,请检查网络设置") |
| 1112 | .setNegative("继续使用", null) | 1113 | .setNegative("继续使用", null) |
| 1113 | .setPositive("设置网络", new View.OnClickListener() { | 1114 | .setPositive("设置网络", new View.OnClickListener() { |
| 1114 | @Override | 1115 | @Override |
| 1115 | public void onClick(View v) { | 1116 | public void onClick(View v) { |
| 1116 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1117 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1117 | mContext.startActivity(intent); | 1118 | mContext.startActivity(intent); |
| 1118 | } | 1119 | } |
| 1119 | }) | 1120 | }) |
| 1120 | .show(); | 1121 | .show(); |
| 1121 | 1122 | ||
| 1122 | } | 1123 | } |
| 1123 | }); | 1124 | }); |
| 1124 | } else { | 1125 | } else { |
| 1125 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 1126 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); |
| 1126 | } | 1127 | } |
| 1127 | } | 1128 | } |
| 1128 | 1129 | ||
| 1129 | /** | 1130 | /** |
| 1130 | * 查询子账户信息 | 1131 | * 查询子账户信息 |
| 1131 | * | 1132 | * |
| 1132 | * @param mContext | 1133 | * @param mContext |
| 1133 | * @param userId | 1134 | * @param userId |
| 1134 | * @param handler | 1135 | * @param handler |
| 1135 | */ | 1136 | */ |
| 1136 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { | 1137 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { |
| 1137 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", | 1138 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", |
| 1138 | false, true, null); | 1139 | false, true, null); |
| 1139 | 1140 | ||
| 1140 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); | 1141 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); |
| 1141 | HttpClient.getInstance().setTimeout(5 * 1000); | 1142 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1142 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1143 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1143 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 1144 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 1144 | @Override | 1145 | @Override |
| 1145 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1146 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1146 | closeProgress(); | 1147 | closeProgress(); |
| 1147 | Log.e("test", "子账户信息" + new String(arg2)); | 1148 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1148 | try { | 1149 | try { |
| 1149 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1150 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1150 | int status = jsonObject.optInt("status"); | 1151 | int status = jsonObject.optInt("status"); |
| 1151 | if (status == 1) { | 1152 | if (status == 1) { |
| 1152 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 1153 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
| 1153 | Log.e("test", "子账户信息" + childsInfo); | 1154 | Log.e("test", "子账户信息" + childsInfo); |
| 1154 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 1155 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
| 1155 | Log.e("test", "子账户信息" + schoolInfoBeanList); | 1156 | Log.e("test", "子账户信息" + schoolInfoBeanList); |
| 1156 | Message msg = Message.obtain(); | 1157 | Message msg = Message.obtain(); |
| 1157 | msg.what = HttpCode.CHILDS_SUCESS; | 1158 | msg.what = HttpCode.CHILDS_SUCESS; |
| 1158 | msg.obj = schoolInfoBeanList; | 1159 | msg.obj = schoolInfoBeanList; |
| 1159 | handler.sendMessage(msg); | 1160 | handler.sendMessage(msg); |
| 1160 | 1161 | ||
| 1161 | }else { | 1162 | }else { |
| 1162 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 1163 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
| 1163 | 1164 | ||
| 1164 | } | 1165 | } |
| 1165 | } catch (JSONException e) { | 1166 | } catch (JSONException e) { |
| 1166 | e.printStackTrace(); | 1167 | e.printStackTrace(); |
| 1167 | 1168 | ||
| 1168 | } | 1169 | } |
| 1169 | 1170 | ||
| 1170 | } | 1171 | } |
| 1171 | 1172 | ||
| 1172 | @Override | 1173 | @Override |
| 1173 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1174 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1174 | closeProgress(); | 1175 | closeProgress(); |
| 1175 | // Log.e("test", "错误信息" + new String(arg2)); | 1176 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1176 | new CircleDialog.Builder((FragmentActivity) mContext) | 1177 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1177 | .setCanceledOnTouchOutside(false) | 1178 | .setCanceledOnTouchOutside(false) |
| 1178 | .setCancelable(false) | 1179 | .setCancelable(false) |
| 1179 | .setWidth(0.5f) | 1180 | .setWidth(0.5f) |
| 1180 | .configText(new ConfigText() { | 1181 | .configText(new ConfigText() { |
| 1181 | @Override | 1182 | @Override |
| 1182 | public void onConfig(TextParams params) { | 1183 | public void onConfig(TextParams params) { |
| 1183 | params.gravity = Gravity.CENTER; | 1184 | params.gravity = Gravity.CENTER; |
| 1184 | params.padding = new int[]{50, 50, 50, 50}; | 1185 | params.padding = new int[]{50, 50, 50, 50}; |
| 1185 | } | 1186 | } |
| 1186 | }) | 1187 | }) |
| 1187 | .setText("当前无网络,请检查网络设置") | 1188 | .setText("当前无网络,请检查网络设置") |
| 1188 | .setNegative("继续使用", null) | 1189 | .setNegative("继续使用", null) |
| 1189 | .setPositive("设置网络", new View.OnClickListener() { | 1190 | .setPositive("设置网络", new View.OnClickListener() { |
| 1190 | @Override | 1191 | @Override |
| 1191 | public void onClick(View v) { | 1192 | public void onClick(View v) { |
| 1192 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1193 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1193 | mContext.startActivity(intent); | 1194 | mContext.startActivity(intent); |
| 1194 | } | 1195 | } |
| 1195 | }) | 1196 | }) |
| 1196 | .show(); | 1197 | .show(); |
| 1197 | } | 1198 | } |
| 1198 | }); | 1199 | }); |
| 1199 | 1200 | ||
| 1200 | } | 1201 | } |
| 1201 | 1202 | ||
| 1202 | /** | 1203 | /** |
| 1203 | * 删除子账户信息 | 1204 | * 删除子账户信息 |
| 1204 | * | 1205 | * |
| 1205 | * @param mContext | 1206 | * @param mContext |
| 1206 | * @param subAccountId | 1207 | * @param subAccountId |
| 1207 | */ | 1208 | */ |
| 1208 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { | 1209 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { |
| 1209 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 1210 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
| 1210 | false, true, null); | 1211 | false, true, null); |
| 1211 | HttpClient.getInstance().setTimeout(5 * 1000); | 1212 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1212 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1213 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1213 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 1214 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
| 1214 | @Override | 1215 | @Override |
| 1215 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1216 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1216 | closeProgress(); | 1217 | closeProgress(); |
| 1217 | Log.e("test", "子账户信息" + new String(arg2)); | 1218 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1218 | try { | 1219 | try { |
| 1219 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1220 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1220 | int status = jsonObject.optInt("status"); | 1221 | int status = jsonObject.optInt("status"); |
| 1221 | if (status == 1) { | 1222 | if (status == 1) { |
| 1222 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 1223 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
| 1223 | ((Activity) mContext).finish(); | 1224 | ((Activity) mContext).finish(); |
| 1224 | } else { | 1225 | } else { |
| 1225 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 1226 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
| 1226 | 1227 | ||
| 1227 | } | 1228 | } |
| 1228 | } catch (JSONException e) { | 1229 | } catch (JSONException e) { |
| 1229 | e.printStackTrace(); | 1230 | e.printStackTrace(); |
| 1230 | } | 1231 | } |
| 1231 | 1232 | ||
| 1232 | } | 1233 | } |
| 1233 | 1234 | ||
| 1234 | @Override | 1235 | @Override |
| 1235 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1236 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1236 | closeProgress(); | 1237 | closeProgress(); |
| 1237 | Log.e("test", "错误信息" + new String(arg2)); | 1238 | Log.e("test", "错误信息" + new String(arg2)); |
| 1238 | new CircleDialog.Builder((FragmentActivity) mContext) | 1239 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1239 | .setCanceledOnTouchOutside(false) | 1240 | .setCanceledOnTouchOutside(false) |
| 1240 | .setCancelable(false) | 1241 | .setCancelable(false) |
| 1241 | .setWidth(0.5f) | 1242 | .setWidth(0.5f) |
| 1242 | .configText(new ConfigText() { | 1243 | .configText(new ConfigText() { |
| 1243 | @Override | 1244 | @Override |
| 1244 | public void onConfig(TextParams params) { | 1245 | public void onConfig(TextParams params) { |
| 1245 | params.gravity = Gravity.CENTER; | 1246 | params.gravity = Gravity.CENTER; |
| 1246 | params.padding = new int[]{50, 50, 50, 50}; | 1247 | params.padding = new int[]{50, 50, 50, 50}; |
| 1247 | } | 1248 | } |
| 1248 | }) | 1249 | }) |
| 1249 | .setText("当前无网络,请检查网络设置") | 1250 | .setText("当前无网络,请检查网络设置") |
| 1250 | .setNegative("继续使用", null) | 1251 | .setNegative("继续使用", null) |
| 1251 | .setPositive("设置网络", new View.OnClickListener() { | 1252 | .setPositive("设置网络", new View.OnClickListener() { |
| 1252 | @Override | 1253 | @Override |
| 1253 | public void onClick(View v) { | 1254 | public void onClick(View v) { |
| 1254 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1255 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1255 | mContext.startActivity(intent); | 1256 | mContext.startActivity(intent); |
| 1256 | } | 1257 | } |
| 1257 | }) | 1258 | }) |
| 1258 | .show(); | 1259 | .show(); |
| 1259 | } | 1260 | } |
| 1260 | }); | 1261 | }); |
| 1261 | 1262 | ||
| 1262 | } | 1263 | } |
| 1263 | 1264 | ||
| 1264 | /** | 1265 | /** |
| 1265 | * 添加子账户信息 | 1266 | * 添加子账户信息 |
| 1266 | */ | 1267 | */ |
| 1267 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 1268 | public void addchildAccountinfo(final Context mContext, long parentId, String image, |
| 1268 | String name, Long grade, Object school, Long region | 1269 | String name, Long grade, Object school, Long region |
| 1269 | , String deviceNumber, String regionName) { | 1270 | , String deviceNumber, String regionName) { |
| 1270 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 1271 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
| 1271 | false, true, null); | 1272 | false, true, null); |
| 1272 | RequestParams params = new RequestParams(); | 1273 | RequestParams params = new RequestParams(); |
| 1273 | 1274 | ||
| 1274 | params.put(HttpKey.PARENTID, parentId); | 1275 | params.put(HttpKey.PARENTID, parentId); |
| 1275 | params.put(HttpKey.IMAGE, image); | 1276 | params.put(HttpKey.IMAGE, image); |
| 1276 | params.put(HttpKey.NAME, name); | 1277 | params.put(HttpKey.NAME, name); |
| 1277 | params.put(HttpKey.GRADE, grade); | 1278 | params.put(HttpKey.GRADE, grade); |
| 1278 | params.put(HttpKey.SCHOOL, school); | 1279 | params.put(HttpKey.SCHOOL, school); |
| 1279 | params.put(HttpKey.REGION, region); | 1280 | params.put(HttpKey.REGION, region); |
| 1280 | params.put(HttpKey.DEVINUMBER, deviceNumber); | 1281 | params.put(HttpKey.DEVINUMBER, deviceNumber); |
| 1281 | params.put(HttpKey.REGIONNAME, regionName); | 1282 | params.put(HttpKey.REGIONNAME, regionName); |
| 1282 | 1283 | ||
| 1283 | Log.e("test", "子账户信息" + params); | 1284 | Log.e("test", "子账户信息" + params); |
| 1284 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1285 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 1285 | HttpClient.getInstance().setTimeout(5 * 1000); | 1286 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1286 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1287 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1287 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 1288 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
| 1288 | @Override | 1289 | @Override |
| 1289 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1290 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1290 | closeProgress(); | 1291 | closeProgress(); |
| 1291 | 1292 | ||
| 1292 | Log.e("test", "子账户信息" + new String(arg2)); | 1293 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1293 | try { | 1294 | try { |
| 1294 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1295 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1295 | int status = jsonObject.optInt("status"); | 1296 | int status = jsonObject.optInt("status"); |
| 1296 | if (status == 1) { | 1297 | if (status == 1) { |
| 1297 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1298 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
| 1298 | ((Activity) mContext).finish(); | 1299 | ((Activity) mContext).finish(); |
| 1299 | } else { | 1300 | } else { |
| 1300 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1301 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
| 1301 | 1302 | ||
| 1302 | } | 1303 | } |
| 1303 | } catch (JSONException e) { | 1304 | } catch (JSONException e) { |
| 1304 | e.printStackTrace(); | 1305 | e.printStackTrace(); |
| 1305 | } | 1306 | } |
| 1306 | 1307 | ||
| 1307 | } | 1308 | } |
| 1308 | 1309 | ||
| 1309 | @Override | 1310 | @Override |
| 1310 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1311 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1311 | closeProgress(); | 1312 | closeProgress(); |
| 1312 | Log.e("test", "错误信息" + new String(arg2)); | 1313 | Log.e("test", "错误信息" + new String(arg2)); |
| 1313 | new CircleDialog.Builder((FragmentActivity) mContext) | 1314 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1314 | .setCanceledOnTouchOutside(false) | 1315 | .setCanceledOnTouchOutside(false) |
| 1315 | .setCancelable(false) | 1316 | .setCancelable(false) |
| 1316 | .setWidth(0.5f) | 1317 | .setWidth(0.5f) |
| 1317 | .configText(new ConfigText() { | 1318 | .configText(new ConfigText() { |
| 1318 | @Override | 1319 | @Override |
| 1319 | public void onConfig(TextParams params) { | 1320 | public void onConfig(TextParams params) { |
| 1320 | params.gravity = Gravity.CENTER; | 1321 | params.gravity = Gravity.CENTER; |
| 1321 | params.padding = new int[]{50, 50, 50, 50}; | 1322 | params.padding = new int[]{50, 50, 50, 50}; |
| 1322 | } | 1323 | } |
| 1323 | }) | 1324 | }) |
| 1324 | .setText("当前无网络,请检查网络设置") | 1325 | .setText("当前无网络,请检查网络设置") |
| 1325 | .setNegative("继续使用", null) | 1326 | .setNegative("继续使用", null) |
| 1326 | .setPositive("设置网络", new View.OnClickListener() { | 1327 | .setPositive("设置网络", new View.OnClickListener() { |
| 1327 | @Override | 1328 | @Override |
| 1328 | public void onClick(View v) { | 1329 | public void onClick(View v) { |
| 1329 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1330 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1330 | mContext.startActivity(intent); | 1331 | mContext.startActivity(intent); |
| 1331 | } | 1332 | } |
| 1332 | }) | 1333 | }) |
| 1333 | .show(); | 1334 | .show(); |
| 1334 | } | 1335 | } |
| 1335 | }); | 1336 | }); |
| 1336 | 1337 | ||
| 1337 | } | 1338 | } |
| 1338 | 1339 | ||
| 1339 | /** | 1340 | /** |
| 1340 | * 切换子账户信息 | 1341 | * 切换子账户信息 |
| 1341 | * | 1342 | * |
| 1342 | * @param mContext | 1343 | * @param mContext |
| 1343 | * @param subAccountId | 1344 | * @param subAccountId |
| 1344 | */ | 1345 | */ |
| 1345 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId | 1346 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId |
| 1346 | , String deviceNumber, int type) { | 1347 | , String deviceNumber, int type) { |
| 1347 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1348 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
| 1348 | false, true, null); | 1349 | false, true, null); |
| 1349 | HttpClient.getInstance().setTimeout(5 * 1000); | 1350 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1350 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1351 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1351 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId | 1352 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId |
| 1352 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { | 1353 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1353 | @Override | 1354 | @Override |
| 1354 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1355 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1355 | closeProgress(); | 1356 | closeProgress(); |
| 1356 | Log.e("test", "子账户信息" + new String(arg2)); | 1357 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1357 | try { | 1358 | try { |
| 1358 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1359 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1359 | int status = jsonObject.optInt("status"); | 1360 | int status = jsonObject.optInt("status"); |
| 1360 | if (status == 1) { | 1361 | if (status == 1) { |
| 1361 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1362 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
| 1362 | ((Activity) mContext).finish(); | 1363 | ((Activity) mContext).finish(); |
| 1363 | 1364 | ||
| 1364 | } else { | 1365 | } else { |
| 1365 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1366 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
| 1366 | 1367 | ||
| 1367 | } | 1368 | } |
| 1368 | } catch (JSONException e) { | 1369 | } catch (JSONException e) { |
| 1369 | e.printStackTrace(); | 1370 | e.printStackTrace(); |
| 1370 | } | 1371 | } |
| 1371 | 1372 | ||
| 1372 | } | 1373 | } |
| 1373 | 1374 | ||
| 1374 | @Override | 1375 | @Override |
| 1375 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1376 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1376 | closeProgress(); | 1377 | closeProgress(); |
| 1377 | Log.e("test", "错误信息" + new String(arg2)); | 1378 | Log.e("test", "错误信息" + new String(arg2)); |
| 1378 | new CircleDialog.Builder((FragmentActivity) mContext) | 1379 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1379 | .setCanceledOnTouchOutside(false) | 1380 | .setCanceledOnTouchOutside(false) |
| 1380 | .setCancelable(false) | 1381 | .setCancelable(false) |
| 1381 | .setWidth(0.5f) | 1382 | .setWidth(0.5f) |
| 1382 | .configText(new ConfigText() { | 1383 | .configText(new ConfigText() { |
| 1383 | @Override | 1384 | @Override |
| 1384 | public void onConfig(TextParams params) { | 1385 | public void onConfig(TextParams params) { |
| 1385 | params.gravity = Gravity.CENTER; | 1386 | params.gravity = Gravity.CENTER; |
| 1386 | params.padding = new int[]{50, 50, 50, 50}; | 1387 | params.padding = new int[]{50, 50, 50, 50}; |
| 1387 | } | 1388 | } |
| 1388 | }) | 1389 | }) |
| 1389 | .setText("当前无网络,请检查网络设置") | 1390 | .setText("当前无网络,请检查网络设置") |
| 1390 | .setNegative("继续使用", null) | 1391 | .setNegative("继续使用", null) |
| 1391 | .setPositive("设置网络", new View.OnClickListener() { | 1392 | .setPositive("设置网络", new View.OnClickListener() { |
| 1392 | @Override | 1393 | @Override |
| 1393 | public void onClick(View v) { | 1394 | public void onClick(View v) { |
| 1394 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1395 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1395 | mContext.startActivity(intent); | 1396 | mContext.startActivity(intent); |
| 1396 | } | 1397 | } |
| 1397 | }) | 1398 | }) |
| 1398 | .show(); | 1399 | .show(); |
| 1399 | } | 1400 | } |
| 1400 | }); | 1401 | }); |
| 1401 | 1402 | ||
| 1402 | } | 1403 | } |
| 1403 | 1404 | ||
| 1404 | /** | 1405 | /** |
| 1405 | * 切换主账户信息 | 1406 | * 切换主账户信息 |
| 1406 | * | 1407 | * |
| 1407 | * @param mContext | 1408 | * @param mContext |
| 1408 | * @param type | 1409 | * @param type |
| 1409 | */ | 1410 | */ |
| 1410 | public void Accountinfo(final Context mContext, long userId | 1411 | public void Accountinfo(final Context mContext, long userId |
| 1411 | , String deviceNumber, int type) { | 1412 | , String deviceNumber, int type) { |
| 1412 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", | 1413 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", |
| 1413 | false, true, null); | 1414 | false, true, null); |
| 1414 | HttpClient.getInstance().setTimeout(5 * 1000); | 1415 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1415 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1416 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1416 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber | 1417 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber |
| 1417 | + "&type=" + type, new AsyncHttpResponseHandler() { | 1418 | + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1418 | @Override | 1419 | @Override |
| 1419 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1420 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1420 | closeProgress(); | 1421 | closeProgress(); |
| 1421 | Log.e("test", "子账户信息" + new String(arg2)); | 1422 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1422 | try { | 1423 | try { |
| 1423 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1424 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1424 | int status = jsonObject.optInt("status"); | 1425 | int status = jsonObject.optInt("status"); |
| 1425 | if (status == 1) { | 1426 | if (status == 1) { |
| 1426 | AlertUtils.showToast(mContext, "主账号切换成功!"); | 1427 | AlertUtils.showToast(mContext, "主账号切换成功!"); |
| 1427 | ((Activity) mContext).finish(); | 1428 | ((Activity) mContext).finish(); |
| 1428 | 1429 | ||
| 1429 | } else { | 1430 | } else { |
| 1430 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); | 1431 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); |
| 1431 | 1432 | ||
| 1432 | } | 1433 | } |
| 1433 | } catch (JSONException e) { | 1434 | } catch (JSONException e) { |
| 1434 | e.printStackTrace(); | 1435 | e.printStackTrace(); |
| 1435 | } | 1436 | } |
| 1436 | 1437 | ||
| 1437 | } | 1438 | } |
| 1438 | 1439 | ||
| 1439 | @Override | 1440 | @Override |
| 1440 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1441 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1441 | closeProgress(); | 1442 | closeProgress(); |
| 1442 | Log.e("test", "错误信息" + new String(arg2)); | 1443 | Log.e("test", "错误信息" + new String(arg2)); |
| 1443 | new CircleDialog.Builder((FragmentActivity) mContext) | 1444 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1444 | .setCanceledOnTouchOutside(false) | 1445 | .setCanceledOnTouchOutside(false) |
| 1445 | .setCancelable(false) | 1446 | .setCancelable(false) |
| 1446 | .setWidth(0.5f) | 1447 | .setWidth(0.5f) |
| 1447 | .configText(new ConfigText() { | 1448 | .configText(new ConfigText() { |
| 1448 | @Override | 1449 | @Override |
| 1449 | public void onConfig(TextParams params) { | 1450 | public void onConfig(TextParams params) { |
| 1450 | params.gravity = Gravity.CENTER; | 1451 | params.gravity = Gravity.CENTER; |
| 1451 | params.padding = new int[]{50, 50, 50, 50}; | 1452 | params.padding = new int[]{50, 50, 50, 50}; |
| 1452 | } | 1453 | } |
| 1453 | }) | 1454 | }) |
| 1454 | .setText("当前无网络,请检查网络设置") | 1455 | .setText("当前无网络,请检查网络设置") |
| 1455 | .setNegative("继续使用", null) | 1456 | .setNegative("继续使用", null) |
| 1456 | .setPositive("设置网络", new View.OnClickListener() { | 1457 | .setPositive("设置网络", new View.OnClickListener() { |
| 1457 | @Override | 1458 | @Override |
| 1458 | public void onClick(View v) { | 1459 | public void onClick(View v) { |
| 1459 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1460 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1460 | mContext.startActivity(intent); | 1461 | mContext.startActivity(intent); |
| 1461 | } | 1462 | } |
| 1462 | }) | 1463 | }) |
| 1463 | .show(); | 1464 | .show(); |
| 1464 | } | 1465 | } |
| 1465 | }); | 1466 | }); |
| 1466 | 1467 | ||
| 1467 | } | 1468 | } |
| 1468 | 1469 | ||
| 1469 | /** | 1470 | /** |
| 1470 | * 头像拍张 | 1471 | * 头像拍张 |
| 1471 | * | 1472 | * |
| 1472 | * @param mContext | 1473 | * @param mContext |
| 1473 | * @param userId | 1474 | * @param userId |
| 1474 | * @param img | 1475 | * @param img |
| 1475 | * @throws UnsupportedEncodingException | 1476 | * @throws UnsupportedEncodingException |
| 1476 | */ | 1477 | */ |
| 1477 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { | 1478 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { |
| 1478 | File file = new File(img); | 1479 | File file = new File(img); |
| 1479 | if (file.exists() && file.length() > 0) { | 1480 | if (file.exists() && file.length() > 0) { |
| 1480 | RequestParams params = new RequestParams(); | 1481 | RequestParams params = new RequestParams(); |
| 1481 | try { | 1482 | try { |
| 1482 | params.put("userId", userId); | 1483 | params.put("userId", userId); |
| 1483 | params.put("type", type); | 1484 | params.put("type", type); |
| 1484 | params.put("img", file); | 1485 | params.put("img", file); |
| 1485 | } catch (FileNotFoundException e) { | 1486 | } catch (FileNotFoundException e) { |
| 1486 | e.printStackTrace(); | 1487 | e.printStackTrace(); |
| 1487 | } | 1488 | } |
| 1488 | Log.e("test", "params" + params); | 1489 | Log.e("test", "params" + params); |
| 1489 | HttpClient.getInstance().setTimeout(5 * 1000); | 1490 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1490 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { | 1491 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { |
| 1491 | @Override | 1492 | @Override |
| 1492 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1493 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 1493 | Log.e("test", "onSuccess" + new String(bytes)); | 1494 | Log.e("test", "onSuccess" + new String(bytes)); |
| 1494 | try { | 1495 | try { |
| 1495 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1496 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 1496 | String status = jsonObject.optString("status"); | 1497 | String status = jsonObject.optString("status"); |
| 1497 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); | 1498 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); |
| 1498 | String imagUrl = jsonObject1.optString("imgUrl"); | 1499 | String imagUrl = jsonObject1.optString("imgUrl"); |
| 1499 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); | 1500 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); |
| 1500 | if (status.equals("1")) { | 1501 | if (status.equals("1")) { |
| 1501 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1502 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
| 1502 | } else { | 1503 | } else { |
| 1503 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1504 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 1504 | } | 1505 | } |
| 1505 | } catch (JSONException e) { | 1506 | } catch (JSONException e) { |
| 1506 | e.printStackTrace(); | 1507 | e.printStackTrace(); |
| 1507 | } | 1508 | } |
| 1508 | } | 1509 | } |
| 1509 | 1510 | ||
| 1510 | @Override | 1511 | @Override |
| 1511 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1512 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 1512 | closeProgress(); | 1513 | closeProgress(); |
| 1513 | Log.e("test", "错误信息" + new String(bytes)); | 1514 | Log.e("test", "错误信息" + new String(bytes)); |
| 1514 | new CircleDialog.Builder((FragmentActivity) mContext) | 1515 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1515 | .setCanceledOnTouchOutside(false) | 1516 | .setCanceledOnTouchOutside(false) |
| 1516 | .setCancelable(false) | 1517 | .setCancelable(false) |
| 1517 | .setWidth(0.5f) | 1518 | .setWidth(0.5f) |
| 1518 | .configText(new ConfigText() { | 1519 | .configText(new ConfigText() { |
| 1519 | @Override | 1520 | @Override |
| 1520 | public void onConfig(TextParams params) { | 1521 | public void onConfig(TextParams params) { |
| 1521 | params.gravity = Gravity.CENTER; | 1522 | params.gravity = Gravity.CENTER; |
| 1522 | params.padding = new int[]{50, 50, 50, 50}; | 1523 | params.padding = new int[]{50, 50, 50, 50}; |
| 1523 | } | 1524 | } |
| 1524 | }) | 1525 | }) |
| 1525 | .setText("当前无网络,请检查网络设置") | 1526 | .setText("当前无网络,请检查网络设置") |
| 1526 | .setNegative("继续使用", null) | 1527 | .setNegative("继续使用", null) |
| 1527 | .setPositive("设置网络", new View.OnClickListener() { | 1528 | .setPositive("设置网络", new View.OnClickListener() { |
| 1528 | @Override | 1529 | @Override |
| 1529 | public void onClick(View v) { | 1530 | public void onClick(View v) { |
| 1530 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1531 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1531 | mContext.startActivity(intent); | 1532 | mContext.startActivity(intent); |
| 1532 | } | 1533 | } |
| 1533 | }) | 1534 | }) |
| 1534 | .show(); | 1535 | .show(); |
| 1535 | 1536 | ||
| 1536 | } | 1537 | } |
| 1537 | }); | 1538 | }); |
| 1538 | } else { | 1539 | } else { |
| 1539 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 1540 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); |
| 1540 | } | 1541 | } |
| 1541 | } | 1542 | } |
| 1542 | /** | 1543 | /** |
| 1543 | * 头像默认 | 1544 | * 头像默认 |
| 1544 | * | 1545 | * |
| 1545 | * @param mContext | 1546 | * @param mContext |
| 1546 | * @param userId | 1547 | * @param userId |
| 1547 | * @param | 1548 | * @param |
| 1548 | * @throws UnsupportedEncodingException | 1549 | * @throws UnsupportedEncodingException |
| 1549 | */ | 1550 | */ |
| 1550 | public void headerdeft(final Context mContext, String userId, String type,String defaultImg) throws UnsupportedEncodingException { | 1551 | public void headerdeft(final Context mContext, String userId, String type,String defaultImg) throws UnsupportedEncodingException { |
| 1551 | RequestParams params = new RequestParams(); | 1552 | RequestParams params = new RequestParams(); |
| 1552 | params.put("userId", userId); | 1553 | params.put("userId", userId); |
| 1553 | params.put("type", type); | 1554 | params.put("type", type); |
| 1554 | params.put("defaultImg", defaultImg); | 1555 | params.put("defaultImg", defaultImg); |
| 1555 | Log.e("test", "params" + params); | 1556 | Log.e("test", "params" + params); |
| 1556 | HttpClient.getInstance().setTimeout(5 * 1000); | 1557 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1557 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { | 1558 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { |
| 1558 | @Override | 1559 | @Override |
| 1559 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1560 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 1560 | Log.e("test", "onSuccess" + new String(bytes)); | 1561 | Log.e("test", "onSuccess" + new String(bytes)); |
| 1561 | try { | 1562 | try { |
| 1562 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1563 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 1563 | String status = jsonObject.optString("status"); | 1564 | String status = jsonObject.optString("status"); |
| 1564 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); | 1565 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); |
| 1565 | String imagUrl = jsonObject1.optString("imgUrl"); | 1566 | String imagUrl = jsonObject1.optString("imgUrl"); |
| 1566 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); | 1567 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); |
| 1567 | if (status.equals("1")) { | 1568 | if (status.equals("1")) { |
| 1568 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1569 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
| 1569 | } else { | 1570 | } else { |
| 1570 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1571 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 1571 | } | 1572 | } |
| 1572 | } catch (JSONException e) { | 1573 | } catch (JSONException e) { |
| 1573 | e.printStackTrace(); | 1574 | e.printStackTrace(); |
| 1574 | } | 1575 | } |
| 1575 | } | 1576 | } |
| 1576 | 1577 | ||
| 1577 | @Override | 1578 | @Override |
| 1578 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1579 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 1579 | closeProgress(); | 1580 | closeProgress(); |
| 1580 | Log.e("test", "错误信息" + new String(bytes)); | 1581 | Log.e("test", "错误信息" + new String(bytes)); |
| 1581 | new CircleDialog.Builder((FragmentActivity) mContext) | 1582 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1582 | .setCanceledOnTouchOutside(false) | 1583 | .setCanceledOnTouchOutside(false) |
| 1583 | .setCancelable(false) | 1584 | .setCancelable(false) |
| 1584 | .setWidth(0.5f) | 1585 | .setWidth(0.5f) |
| 1585 | .configText(new ConfigText() { | 1586 | .configText(new ConfigText() { |
| 1586 | @Override | 1587 | @Override |
| 1587 | public void onConfig(TextParams params) { | 1588 | public void onConfig(TextParams params) { |
| 1588 | params.gravity = Gravity.CENTER; | 1589 | params.gravity = Gravity.CENTER; |
| 1589 | params.padding = new int[]{50, 50, 50, 50}; | 1590 | params.padding = new int[]{50, 50, 50, 50}; |
| 1590 | } | 1591 | } |
| 1591 | }) | 1592 | }) |
| 1592 | .setText("当前无网络,请检查网络设置") | 1593 | .setText("当前无网络,请检查网络设置") |
| 1593 | .setNegative("继续使用", null) | 1594 | .setNegative("继续使用", null) |
| 1594 | .setPositive("设置网络", new View.OnClickListener() { | 1595 | .setPositive("设置网络", new View.OnClickListener() { |
| 1595 | @Override | 1596 | @Override |
| 1596 | public void onClick(View v) { | 1597 | public void onClick(View v) { |
| 1597 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1598 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1598 | mContext.startActivity(intent); | 1599 | mContext.startActivity(intent); |
| 1599 | } | 1600 | } |
| 1600 | }) | 1601 | }) |
| 1601 | .show(); | 1602 | .show(); |
| 1602 | 1603 | ||
| 1603 | } | 1604 | } |
| 1604 | }); | 1605 | }); |
| 1605 | } | 1606 | } |
| 1606 | 1607 | ||
| 1607 | 1608 | ||
| 1608 | /** | 1609 | /** |
| 1609 | * 系统升级 | 1610 | * 系统升级 |
| 1610 | * | 1611 | * |
| 1611 | * @param mContext | 1612 | * @param mContext |
| 1612 | * @param pid appName | 1613 | * @param pid appName |
| 1613 | */ | 1614 | */ |
| 1614 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1615 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
| 1615 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1616 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
| 1616 | false, true, null); | 1617 | false, true, null); |
| 1617 | HttpClient.getInstance().setTimeout(5 * 1000); | 1618 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1618 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1619 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1619 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1620 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
| 1620 | @Override | 1621 | @Override |
| 1621 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1622 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1622 | closeProgress(); | 1623 | closeProgress(); |
| 1623 | Log.e("test", "版本升级信息" + new String(arg2)); | 1624 | Log.e("test", "版本升级信息" + new String(arg2)); |
| 1624 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 | 1625 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 |
| 1625 | Message msg = Message.obtain(); | 1626 | Message msg = Message.obtain(); |
| 1626 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1627 | msg.what = HttpCode.APPUPDATE_SUCESS; |
| 1627 | msg.obj = appVersion; | 1628 | msg.obj = appVersion; |
| 1628 | handler.sendMessage(msg); | 1629 | handler.sendMessage(msg); |
| 1629 | 1630 | ||
| 1630 | 1631 | ||
| 1631 | } | 1632 | } |
| 1632 | 1633 | ||
| 1633 | @Override | 1634 | @Override |
| 1634 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1635 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1635 | closeProgress(); | 1636 | closeProgress(); |
| 1636 | Log.e("test", "错误信息" + new String(arg2)); | 1637 | Log.e("test", "错误信息" + new String(arg2)); |
| 1637 | new CircleDialog.Builder((FragmentActivity) mContext) | 1638 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1638 | .setCanceledOnTouchOutside(false) | 1639 | .setCanceledOnTouchOutside(false) |
| 1639 | .setCancelable(false) | 1640 | .setCancelable(false) |
| 1640 | .setWidth(0.5f) | 1641 | .setWidth(0.5f) |
| 1641 | .configText(new ConfigText() { | 1642 | .configText(new ConfigText() { |
| 1642 | @Override | 1643 | @Override |
| 1643 | public void onConfig(TextParams params) { | 1644 | public void onConfig(TextParams params) { |
| 1644 | params.gravity = Gravity.CENTER; | 1645 | params.gravity = Gravity.CENTER; |
| 1645 | params.padding = new int[]{50, 50, 50, 50}; | 1646 | params.padding = new int[]{50, 50, 50, 50}; |
| 1646 | } | 1647 | } |
| 1647 | }) | 1648 | }) |
| 1648 | .setText("当前无网络,请检查网络设置") | 1649 | .setText("当前无网络,请检查网络设置") |
| 1649 | .setNegative("继续使用", null) | 1650 | .setNegative("继续使用", null) |
| 1650 | .setPositive("设置网络", new View.OnClickListener() { | 1651 | .setPositive("设置网络", new View.OnClickListener() { |
| 1651 | @Override | 1652 | @Override |
| 1652 | public void onClick(View v) { | 1653 | public void onClick(View v) { |
| 1653 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1654 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1654 | mContext.startActivity(intent); | 1655 | mContext.startActivity(intent); |
| 1655 | } | 1656 | } |
| 1656 | }) | 1657 | }) |
| 1657 | .show(); | 1658 | .show(); |
| 1658 | } | 1659 | } |
| 1659 | }); | 1660 | }); |
| 1660 | 1661 | ||
| 1661 | } | 1662 | } |
| 1663 | //版本信息 | ||
| 1664 | public void versioninfo(final Context mContext,String subjectName, final Handler handler) { | ||
| 1665 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | ||
| 1666 | HttpClient.getInstance().get(HttpUrl.getversionURL+"?subjectName="+subjectName, new AsyncHttpResponseHandler() { | ||
| 1667 | @Override | ||
| 1668 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | ||
| 1669 | Log.e("test", "版本信息" + new String(arg2)); | ||
| 1670 | try { | ||
| 1671 | JSONObject jsonObject = new JSONObject(new String(arg2)); | ||
| 1672 | int status = jsonObject.optInt("status"); | ||
| 1673 | if (status == 1) { | ||
| 1674 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 | ||
| 1675 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); | ||
| 1676 | Message message = Message.obtain(); | ||
| 1677 | message.what = HttpCode.VERSION_SUCESS; | ||
| 1678 | message.obj = versionInfoList; | ||
| 1679 | handler.sendMessage(message); | ||
| 1680 | |||
| 1681 | } else if(status == 1000){ | ||
| 1682 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); | ||
| 1683 | |||
| 1684 | }else { | ||
| 1685 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | ||
| 1686 | } | ||
| 1687 | } catch (JSONException e) { | ||
| 1688 | e.printStackTrace(); | ||
| 1689 | } | ||
| 1690 | |||
| 1691 | |||
| 1692 | } | ||
| 1693 | |||
| 1694 | @Override | ||
| 1695 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | ||
| 1696 | new CircleDialog.Builder((FragmentActivity) mContext) | ||
| 1697 | .setCanceledOnTouchOutside(false) | ||
| 1698 | .setCancelable(false) | ||
| 1699 | .setWidth(0.5f) | ||
| 1700 | .configText(new ConfigText() { | ||
| 1701 | @Override | ||
| 1702 | public void onConfig(TextParams params) { | ||
| 1703 | params.gravity = Gravity.CENTER; | ||
| 1704 | params.padding = new int[]{50, 50, 50, 50}; | ||
| 1705 | } | ||
| 1706 | }) | ||
| 1707 | .setText("当前无网络,请检查网络设置") | ||
| 1708 | .setNegative("继续使用", null) | ||
| 1709 | .setPositive("设置网络", new View.OnClickListener() { | ||
| 1710 | @Override | ||
| 1711 | public void onClick(View v) { | ||
| 1712 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | ||
| 1713 | mContext.startActivity(intent); | ||
| 1714 | } | ||
| 1715 | }) | ||
| 1716 | .show(); | ||
| 1717 | } | ||
| 1718 | }); | ||
| 1719 | } | ||
| 1662 | 1720 | ||
| 1663 | 1721 | ||
| 1664 | ///省级接口 | 1722 | ///省级接口 |
| 1665 | public void provices(final Context mContext, final Handler handler) { | 1723 | public void provices(final Context mContext, final Handler handler) { |
| 1666 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1724 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1667 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1725 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
| 1668 | @Override | 1726 | @Override |
| 1669 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1727 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1670 | Log.e("test", "省" + new String(arg2)); | 1728 | Log.e("test", "省" + new String(arg2)); |
| 1671 | try { | 1729 | try { |
| 1672 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1730 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1673 | int status = jsonObject.optInt("status"); | 1731 | int status = jsonObject.optInt("status"); |
| 1674 | if (status == 100) { | 1732 | if (status == 100) { |
| 1675 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1733 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
| 1676 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1734 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
| 1677 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1735 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
| 1678 | Message message = Message.obtain(); | 1736 | Message message = Message.obtain(); |
| 1679 | message.what = HttpCode.PROVICES; | 1737 | message.what = HttpCode.PROVICES; |
| 1680 | message.obj = provincesBeanList; | 1738 | message.obj = provincesBeanList; |
| 1681 | handler.sendMessage(message); | 1739 | handler.sendMessage(message); |
| 1682 | 1740 | ||
| 1683 | 1741 | ||
| 1684 | } else { | 1742 | } else { |
| 1685 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1743 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1686 | 1744 | ||
| 1687 | } | 1745 | } |
| 1688 | } catch (JSONException e) { | 1746 | } catch (JSONException e) { |
| 1689 | e.printStackTrace(); | 1747 | e.printStackTrace(); |
| 1690 | } | 1748 | } |
| 1691 | 1749 | ||
| 1692 | 1750 | ||
| 1693 | } | 1751 | } |
| 1694 | 1752 | ||
| 1695 | @Override | 1753 | @Override |
| 1696 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1754 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1697 | new CircleDialog.Builder((FragmentActivity) mContext) | 1755 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1698 | .setCanceledOnTouchOutside(false) | 1756 | .setCanceledOnTouchOutside(false) |
| 1699 | .setCancelable(false) | 1757 | .setCancelable(false) |
| 1700 | .setWidth(0.5f) | 1758 | .setWidth(0.5f) |
| 1701 | .configText(new ConfigText() { | 1759 | .configText(new ConfigText() { |
| 1702 | @Override | 1760 | @Override |
| 1703 | public void onConfig(TextParams params) { | 1761 | public void onConfig(TextParams params) { |
| 1704 | params.gravity = Gravity.CENTER; | 1762 | params.gravity = Gravity.CENTER; |
| 1705 | params.padding = new int[]{50, 50, 50, 50}; | 1763 | params.padding = new int[]{50, 50, 50, 50}; |
| 1706 | } | 1764 | } |
| 1707 | }) | 1765 | }) |
| 1708 | .setText("当前无网络,请检查网络设置") | 1766 | .setText("当前无网络,请检查网络设置") |
| 1709 | .setNegative("继续使用", null) | 1767 | .setNegative("继续使用", null) |
| 1710 | .setPositive("设置网络", new View.OnClickListener() { | 1768 | .setPositive("设置网络", new View.OnClickListener() { |
| 1711 | @Override | 1769 | @Override |
| 1712 | public void onClick(View v) { | 1770 | public void onClick(View v) { |
| 1713 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1771 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1714 | mContext.startActivity(intent); | 1772 | mContext.startActivity(intent); |
| 1715 | } | 1773 | } |
| 1716 | }) | 1774 | }) |
| 1717 | .show(); | 1775 | .show(); |
| 1718 | } | 1776 | } |
| 1719 | }); | 1777 | }); |
| 1720 | } | 1778 | } |
| 1721 | 1779 | ||
| 1722 | //市级接口 | 1780 | //市级接口 |
| 1723 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1781 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
| 1724 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1782 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1725 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1783 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
| 1726 | @Override | 1784 | @Override |
| 1727 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1785 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1728 | Log.e("test", "市" + new String(arg2)); | 1786 | Log.e("test", "市" + new String(arg2)); |
| 1729 | try { | 1787 | try { |
| 1730 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1788 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1731 | int status = jsonObject.optInt("status"); | 1789 | int status = jsonObject.optInt("status"); |
| 1732 | if (status == 100) { | 1790 | if (status == 100) { |
| 1733 | Gson gson = new Gson(); | 1791 | Gson gson = new Gson(); |
| 1734 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1792 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
| 1735 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1793 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
| 1736 | Message message = Message.obtain(); | 1794 | Message message = Message.obtain(); |
| 1737 | message.what = HttpCode.CITYS; | 1795 | message.what = HttpCode.CITYS; |
| 1738 | message.obj = cityInfoBeanList; | 1796 | message.obj = cityInfoBeanList; |
| 1739 | handler.sendMessage(message); | 1797 | handler.sendMessage(message); |
| 1740 | 1798 | ||
| 1741 | } else { | 1799 | } else { |
| 1742 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1800 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1743 | 1801 | ||
| 1744 | } | 1802 | } |
| 1745 | } catch (JSONException e) { | 1803 | } catch (JSONException e) { |
| 1746 | e.printStackTrace(); | 1804 | e.printStackTrace(); |
| 1747 | } | 1805 | } |
| 1748 | 1806 | ||
| 1749 | 1807 | ||
| 1750 | } | 1808 | } |
| 1751 | 1809 | ||
| 1752 | @Override | 1810 | @Override |
| 1753 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1811 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1754 | new CircleDialog.Builder((FragmentActivity) mContext) | 1812 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1755 | .setCanceledOnTouchOutside(false) | 1813 | .setCanceledOnTouchOutside(false) |
| 1756 | .setCancelable(false) | 1814 | .setCancelable(false) |
| 1757 | .setWidth(0.5f) | 1815 | .setWidth(0.5f) |
| 1758 | .configText(new ConfigText() { | 1816 | .configText(new ConfigText() { |
| 1759 | @Override | 1817 | @Override |
| 1760 | public void onConfig(TextParams params) { | 1818 | public void onConfig(TextParams params) { |
| 1761 | params.gravity = Gravity.CENTER; | 1819 | params.gravity = Gravity.CENTER; |
| 1762 | params.padding = new int[]{50, 50, 50, 50}; | 1820 | params.padding = new int[]{50, 50, 50, 50}; |
| 1763 | } | 1821 | } |
| 1764 | }) | 1822 | }) |
| 1765 | .setText("当前无网络,请检查网络设置") | 1823 | .setText("当前无网络,请检查网络设置") |
| 1766 | .setNegative("继续使用", null) | 1824 | .setNegative("继续使用", null) |
| 1767 | .setPositive("设置网络", new View.OnClickListener() { | 1825 | .setPositive("设置网络", new View.OnClickListener() { |
| 1768 | @Override | 1826 | @Override |
| 1769 | public void onClick(View v) { | 1827 | public void onClick(View v) { |
| 1770 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1828 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1771 | mContext.startActivity(intent); | 1829 | mContext.startActivity(intent); |
| 1772 | } | 1830 | } |
| 1773 | }) | 1831 | }) |
| 1774 | .show(); | 1832 | .show(); |
| 1775 | } | 1833 | } |
| 1776 | }); | 1834 | }); |
| 1777 | } | 1835 | } |
| 1778 | 1836 | ||
| 1779 | //区县级接口 | 1837 | //区县级接口 |
| 1780 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1838 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
| 1781 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1839 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1782 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1840 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
| 1783 | @Override | 1841 | @Override |
| 1784 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1842 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1785 | Log.e("test", "区" + new String(arg2)); | 1843 | Log.e("test", "区" + new String(arg2)); |
| 1786 | try { | 1844 | try { |
| 1787 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1845 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1788 | int status = jsonObject.optInt("status"); | 1846 | int status = jsonObject.optInt("status"); |
| 1789 | if (status == 100) { | 1847 | if (status == 100) { |
| 1790 | Gson gson = new Gson(); | 1848 | Gson gson = new Gson(); |
| 1791 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1849 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
| 1792 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1850 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
| 1793 | Message message = Message.obtain(); | 1851 | Message message = Message.obtain(); |
| 1794 | message.what = HttpCode.COUNTRY; | 1852 | message.what = HttpCode.COUNTRY; |
| 1795 | message.obj = countyInfoInfoBeanList; | 1853 | message.obj = countyInfoInfoBeanList; |
| 1796 | handler.sendMessage(message); | 1854 | handler.sendMessage(message); |
| 1797 | } else { | 1855 | } else { |
| 1798 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1856 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1799 | 1857 | ||
| 1800 | } | 1858 | } |
| 1801 | } catch (JSONException e) { | 1859 | } catch (JSONException e) { |
| 1802 | e.printStackTrace(); | 1860 | e.printStackTrace(); |
| 1803 | } | 1861 | } |
| 1804 | 1862 | ||
| 1805 | 1863 | ||
| 1806 | } | 1864 | } |
| 1807 | 1865 | ||
| 1808 | @Override | 1866 | @Override |
| 1809 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1867 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1810 | new CircleDialog.Builder((FragmentActivity) mContext) | 1868 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1811 | .setCanceledOnTouchOutside(false) | 1869 | .setCanceledOnTouchOutside(false) |
| 1812 | .setCancelable(false) | 1870 | .setCancelable(false) |
| 1813 | .setWidth(0.5f) | 1871 | .setWidth(0.5f) |
| 1814 | .configText(new ConfigText() { | 1872 | .configText(new ConfigText() { |
| 1815 | @Override | 1873 | @Override |
| 1816 | public void onConfig(TextParams params) { | 1874 | public void onConfig(TextParams params) { |
| 1817 | params.gravity = Gravity.CENTER; | 1875 | params.gravity = Gravity.CENTER; |
| 1818 | params.padding = new int[]{50, 50, 50, 50}; | 1876 | params.padding = new int[]{50, 50, 50, 50}; |
| 1819 | } | 1877 | } |
| 1820 | }) | 1878 | }) |
| 1821 | .setText("当前无网络,请检查网络设置") | 1879 | .setText("当前无网络,请检查网络设置") |
| 1822 | .setNegative("继续使用", null) | 1880 | .setNegative("继续使用", null) |
| 1823 | .setPositive("设置网络", new View.OnClickListener() { | 1881 | .setPositive("设置网络", new View.OnClickListener() { |
| 1824 | @Override | 1882 | @Override |
| 1825 | public void onClick(View v) { | 1883 | public void onClick(View v) { |
| 1826 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1884 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1827 | mContext.startActivity(intent); | 1885 | mContext.startActivity(intent); |
| 1828 | } | 1886 | } |
| 1829 | }) | 1887 | }) |
| 1830 | .show(); | 1888 | .show(); |
| 1831 | } | 1889 | } |
| 1832 | }); | 1890 | }); |
| 1833 | } | 1891 | } |
| 1834 | 1892 | ||
| 1835 | 1893 | ||
| 1836 | private void closeProgress() { | 1894 | private void closeProgress() { |
| 1837 | try { | 1895 | try { |
| 1838 | if (mProgress != null) { | 1896 | if (mProgress != null) { |
| 1839 | mProgress.dismiss(); | 1897 | mProgress.dismiss(); |
| 1840 | mProgress = null; | 1898 | mProgress = null; |
| 1841 | } | 1899 | } |
| 1842 | } catch (Exception e) { | 1900 | } catch (Exception e) { |
| 1843 | e.printStackTrace(); | 1901 | e.printStackTrace(); |
| 1844 | } | 1902 | } |
| 1845 | } | 1903 | } |
| 1846 | 1904 | ||
| 1847 | } | 1905 | } |
| 1848 | 1906 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
| 1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * Created by h on 2017/8/15. | 4 | * Created by h on 2017/8/15. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | public class HttpUrl { | 7 | public class HttpUrl { |
| 8 | private final static String Enviroment = "DEVELOPMENT"; | 8 | private final static String Enviroment = "DEVELOPMENT"; |
| 9 | 9 | ||
| 10 | public static String GetDomain(){ | 10 | public static String GetDomain(){ |
| 11 | return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; | 11 | return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 | 14 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 |
| 15 | public static String schoolUrl = GetDomain()+"/school/get";//学校 | 15 | public static String schoolUrl = GetDomain()+"/school/get";//学校 |
| 16 | public static String gradesUrl = GetDomain()+"/grades";//年级 | 16 | public static String gradesUrl = GetDomain()+"/grades";//年级 |
| 17 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 | 17 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 |
| 18 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 | 18 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 |
| 19 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 | 19 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 |
| 20 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ | 20 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ |
| 21 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 | 21 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 |
| 22 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 | 22 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 |
| 23 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 | 23 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 |
| 24 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 | 24 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 |
| 25 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 | 25 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 |
| 26 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 | 26 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 |
| 27 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 | 27 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 |
| 28 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 | 28 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 |
| 29 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 | 29 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 |
| 30 | public static String getpresonalinfo=GetDomain()+"/personal/get";//获取个人信息 | 30 | public static String getpresonalinfo=GetDomain()+"/personal/get";//获取个人信息 |
| 31 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 | 31 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 |
| 32 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 | 32 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 |
| 33 | public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 | 33 | public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 |
| 34 | public static String childUserURL=GetDomain()+"/childUser/info";//获取子账户信息 | 34 | public static String childUserURL=GetDomain()+"/childUser/info";//获取子账户信息 |
| 35 | public static String deletechildUserURL=GetDomain()+"/childUser/delete";//删除子账户 | 35 | public static String deletechildUserURL=GetDomain()+"/childUser/delete";//删除子账户 |
| 36 | public static String addchildUserURL=GetDomain()+"/childUser/addChildUser";//添加子账户 | 36 | public static String addchildUserURL=GetDomain()+"/childUser/addChildUser";//添加子账户 |
| 37 | public static String changechildUserURL=GetDomain()+"/childUser/update";//切换子账户 | 37 | public static String changechildUserURL=GetDomain()+"/childUser/update";//切换子账户 |
| 38 | public static String updateappURL=GetDomain()+"/general/release/version";//系统升级 | 38 | public static String updateappURL=GetDomain()+"/general/release/version";//系统升级 |
| 39 | public static String headerURL=GetDomain()+"/profile/picture/update";//头像上传 | 39 | public static String headerURL=GetDomain()+"/profile/picture/update";//头像上传 |
| 40 | public static String headerdefaultURL=GetDomain()+"/profile/picture/default";//默认头像上传 | 40 | public static String headerdefaultURL=GetDomain()+"/profile/picture/default";//默认头像上传 |
| 41 | public static String getversionURL=GetDomain()+"/press/list";//获取版本信息 | ||
| 41 | 42 | ||
| 42 | 43 | ||
| 43 | 44 | ||
| 44 | 45 | ||
| 45 | 46 | ||
| 46 | 47 | ||
| 47 | } | 48 | } |
| 48 | 49 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/interfaces/DialogCallBack.java
| 1 | package com.hjx.personalcenter.interfaces; | 1 | package com.hjx.personalcenter.interfaces; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.view.View; | 4 | import android.view.View; |
| 5 | 5 | ||
| 6 | import com.hjx.personalcenter.model.CityInfo; | 6 | import com.hjx.personalcenter.model.CityInfo; |
| 7 | import com.hjx.personalcenter.model.CountyInfo; | 7 | import com.hjx.personalcenter.model.CountyInfo; |
| 8 | import com.hjx.personalcenter.model.GradeInfo; | 8 | import com.hjx.personalcenter.model.GradeInfo; |
| 9 | import com.hjx.personalcenter.model.ProvinceInfo; | 9 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 10 | import com.hjx.personalcenter.model.SchoolInfo; | 10 | import com.hjx.personalcenter.model.SchoolInfo; |
| 11 | import com.hjx.personalcenter.model.VersionInfo; | ||
| 11 | 12 | ||
| 12 | import java.util.ArrayList; | 13 | import java.util.ArrayList; |
| 13 | 14 | ||
| 14 | /** | 15 | /** |
| 15 | * Created by wei on 2017/8/17. | 16 | * Created by wei on 2017/8/17. |
| 16 | */ | 17 | */ |
| 17 | 18 | ||
| 18 | public class DialogCallBack { | 19 | public class DialogCallBack { |
| 19 | //对话框回调 | 20 | //对话框回调 |
| 20 | public interface ProvincesCallBack{ | 21 | public interface ProvincesCallBack{ |
| 21 | void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type); | 22 | void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type); |
| 22 | } | 23 | } |
| 23 | public interface CitysCallBack{ | 24 | public interface CitysCallBack{ |
| 24 | void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type); | 25 | void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type); |
| 25 | } | 26 | } |
| 26 | public interface CountryCallBack{ | 27 | public interface CountryCallBack{ |
| 27 | void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type); | 28 | void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type); |
| 28 | } | 29 | } |
| 29 | public interface GradeCallBack{ | 30 | public interface GradeCallBack{ |
| 30 | void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type); | 31 | void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type); |
| 31 | } | 32 | } |
| 32 | public interface SchoolCallBack{ | 33 | public interface SchoolCallBack{ |
| 33 | void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type); | 34 | void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type); |
| 34 | } | 35 | } |
| 35 | //头像回调 | 36 | //头像回调 |
| 36 | public interface CallBackView{ | 37 | public interface CallBackView{ |
| 37 | void heard(Context context,View v,int headpitiaon); | 38 | void heard(Context context,View v,int headpitiaon); |
| 38 | } | 39 | } |
| 40 | //出版社回调 | ||
| 41 | public interface VersionCallBack{ | ||
| 42 | void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type); | ||
| 43 | } | ||
| 39 | } | 44 | } |
| 40 | 45 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/VersionInfo.java
| File was created | 1 | package com.hjx.personalcenter.model; | |
| 2 | |||
| 3 | import java.io.Serializable; | ||
| 4 | import java.util.List; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * Created by h on 2017/9/9. | ||
| 8 | */ | ||
| 9 | |||
| 10 | public class VersionInfo implements Serializable{ | ||
| 11 | |||
| 12 | |||
| 13 | /** | ||
| 14 | * status : 1 | ||
| 15 | * pageSize : 0 | ||
| 16 | * data : [{"pressName":"外语教学与研究出版社","pressCover":""},{"pressName":"文汇出版社","pressCover":""},{"pressName":"北京出版社","pressCover":""},{"pressName":"北京出版社_北京教育出版社","pressCover":""},{"pressName":"北京师范大学出版社","pressCover":""},{"pressName":"上海译文出版社","pressCover":""},{"pressName":"接力出版社","pressCover":""},{"pressName":"重庆大学出版社","pressCover":""},{"pressName":"教育科学出版社","pressCover":""},{"pressName":"黑龙江少年儿童出版社","pressCover":""},{"pressName":"人民教育出版社","pressCover":""},{"pressName":"福建教育出版社","pressCover":""},{"pressName":"广东人民出版社","pressCover":""},{"pressName":"中国大百科全书出版社","pressCover":""},{"pressName":"河北教育出版社","pressCover":""},{"pressName":"湖北教育出版社","pressCover":""},{"pressName":"湖南少年儿童出版社","pressCover":""},{"pressName":"湖南教育出版社_山东教育出版社","pressCover":""},{"pressName":"湖南教育出版社","pressCover":""},{"pressName":"西安交通大学出版社","pressCover":""},{"pressName":"高等教育出版社","pressCover":""},{"pressName":"辽宁师范大学出版社","pressCover":""},{"pressName":"科学普及出版社","pressCover":""},{"pressName":"西藏人民出版社","pressCover":""},{"pressName":"培生朗文出版社","pressCover":""},{"pressName":"清华大学出版社","pressCover":""},{"pressName":"上海外语教育出版社","pressCover":""},{"pressName":"上海教育出版社","pressCover":""},{"pressName":"四川人民出版社","pressCover":""},{"pressName":"四川教育出版社","pressCover":""},{"pressName":"山东教育出版社","pressCover":""},{"pressName":"山东科学技术出版社","pressCover":""},{"pressName":"外语教学与研究出版社_广东教育出版社","pressCover":""},{"pressName":"陕西旅游出版社","pressCover":""},{"pressName":"湖南潇影音像出版社","pressCover":""},{"pressName":"金盾出版社","pressCover":""},{"pressName":"外研教学与研究出版社_湖南教育出版社_培生朗文出版社","pressCover":""},{"pressName":"新蕾出版社","pressCover":""},{"pressName":"译林出版社","pressCover":""}] | ||
| 17 | * msg : success | ||
| 18 | * pageNum : 0 | ||
| 19 | */ | ||
| 20 | |||
| 21 | private int status; | ||
| 22 | private int pageSize; | ||
| 23 | private String msg; | ||
| 24 | private int pageNum; | ||
| 25 | private List<DataBean> data; | ||
| 26 | |||
| 27 | public int getStatus() { | ||
| 28 | return status; | ||
| 29 | } | ||
| 30 | |||
| 31 | public void setStatus(int status) { | ||
| 32 | this.status = status; | ||
| 33 | } | ||
| 34 | |||
| 35 | public int getPageSize() { | ||
| 36 | return pageSize; | ||
| 37 | } | ||
| 38 | |||
| 39 | public void setPageSize(int pageSize) { | ||
| 40 | this.pageSize = pageSize; | ||
| 41 | } | ||
| 42 | |||
| 43 | public String getMsg() { | ||
| 44 | return msg; | ||
| 45 | } | ||
| 46 | |||
| 47 | public void setMsg(String msg) { | ||
| 48 | this.msg = msg; | ||
| 49 | } | ||
| 50 | |||
| 51 | public int getPageNum() { | ||
| 52 | return pageNum; | ||
| 53 | } | ||
| 54 | |||
| 55 | public void setPageNum(int pageNum) { | ||
| 56 | this.pageNum = pageNum; | ||
| 57 | } | ||
| 58 | |||
| 59 | public List<DataBean> getData() { | ||
| 60 | return data; | ||
| 61 | } | ||
| 62 | |||
| 63 | public void setData(List<DataBean> data) { | ||
| 64 | this.data = data; | ||
| 65 | } | ||
| 66 | |||
| 67 | public static class DataBean { | ||
| 68 | /** | ||
| 69 | * pressName : 外语教学与研究出版社 | ||
| 70 | * pressCover : | ||
| 71 | */ | ||
| 72 | |||
| 73 | private String pressName; | ||
| 74 | private String pressCover; | ||
| 75 | |||
| 76 | public String getPressName() { | ||
| 77 | return pressName; | ||
| 78 | } | ||
| 79 | |||
| 80 | public void setPressName(String pressName) { | ||
| 81 | this.pressName = pressName; | ||
| 82 | } | ||
| 83 | |||
| 84 | public String getPressCover() { | ||
| 85 | return pressCover; | ||
| 86 | } | ||
| 87 | |||
| 88 | public void setPressCover(String pressCover) { | ||
| 89 | this.pressCover = pressCover; | ||
| 90 | } | ||
| 91 | } | ||
| 92 | } | ||
| 93 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/BaseService.java
| File was created | 1 | /** | |
| 2 | * HaoJiXing Teacher Q&A | ||
| 3 | * copyright(C)2013- Acorn International | ||
| 4 | * | ||
| 5 | * packeage:com.ozing.center.service.BaseService.java | ||
| 6 | * create:2013年11月5日下午6:05:40 | ||
| 7 | */ | ||
| 8 | package com.hjx.personalcenter.service; | ||
| 9 | |||
| 10 | import android.app.Service; | ||
| 11 | import android.content.Intent; | ||
| 12 | import android.content.res.Configuration; | ||
| 13 | import android.os.IBinder; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author jixiaolong<jixiaolong@chinadrtv.com> | ||
| 17 | * @code: 015261 | ||
| 18 | */ | ||
| 19 | public class BaseService extends Service { | ||
| 20 | |||
| 21 | @Override | ||
| 22 | public IBinder onBind(Intent intent) { | ||
| 23 | return null; | ||
| 24 | } | ||
| 25 | |||
| 26 | @Override | ||
| 27 | public void onCreate() { | ||
| 28 | // TODO Auto-generated method stub | ||
| 29 | super.onCreate(); | ||
| 30 | } | ||
| 31 | |||
| 32 | @Override | ||
| 33 | public int onStartCommand(Intent intent, int flags, int startId) { | ||
| 34 | return super.onStartCommand(intent, flags, startId); | ||
| 35 | }; | ||
| 36 | |||
| 37 | @Override | ||
| 38 | public void onDestroy() { | ||
| 39 | super.onDestroy(); | ||
| 40 | } | ||
| 41 | |||
| 42 | @Override | ||
| 43 | public boolean onUnbind(Intent intent) { | ||
| 44 | // TODO Auto-generated method stub | ||
| 45 | return super.onUnbind(intent); | ||
| 46 | } | ||
| 47 | |||
| 48 | @Override | ||
| 49 | public void onLowMemory() { | ||
| 50 | // TODO Auto-generated method stub | ||
| 51 | super.onLowMemory(); | ||
| 52 | } | ||
| 53 | |||
| 54 | @Override | ||
| 55 | public void onRebind(Intent intent) { | ||
| 56 | // TODO Auto-generated method stub | ||
| 57 | super.onRebind(intent); | ||
| 58 | } | ||
| 59 | |||
| 60 | @Override | ||
| 61 | public void onConfigurationChanged(Configuration newConfig) { | ||
| 62 | // TODO Auto-generated method stub | ||
| 63 | super.onConfigurationChanged(newConfig); | ||
| 64 | } | ||
| 65 | |||
| 66 | } | ||
| 67 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/CenterService.java
| File was created | 1 | package com.hjx.personalcenter.service; | |
| 2 | |||
| 3 | import android.content.Intent; | ||
| 4 | import android.os.IBinder; | ||
| 5 | import android.os.RemoteException; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * Created by h on 2017/9/1. | ||
| 9 | */ | ||
| 10 | |||
| 11 | public class CenterService extends BaseService { | ||
| 12 | public CenterService(){ | ||
| 13 | |||
| 14 | } | ||
| 15 | IPresonalInterface.Stub binder = new IPresonalInterface.Stub() { | ||
| 16 | @Override | ||
| 17 | public String sayHello() throws RemoteException { | ||
| 18 | return "这是测试AIDL的方法"; | ||
| 19 | } | ||
| 20 | |||
| 21 | @Override | ||
| 22 | public String viewPage(String action) throws RemoteException { | ||
| 23 | return null; | ||
| 24 | } | ||
| 25 | |||
| 26 | @Override | ||
| 27 | public String getSimpleUser() throws RemoteException { | ||
| 28 | return null; | ||
| 29 | } | ||
| 30 | |||
| 31 | @Override | ||
| 32 | public String getcardUser() throws RemoteException { | ||
| 33 | return null; | ||
| 34 | } | ||
| 35 | }; | ||
| 36 | |||
| 37 | @Override | ||
| 38 | public IBinder onBind(Intent intent) { | ||
| 39 | return binder; | ||
| 40 | } | ||
| 41 | } | ||
| 42 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/TestService.java
| 1 | package com.hjx.personalcenter.service; | File was deleted | |
| 2 | |||
| 3 | import android.app.Service; | ||
| 4 | import android.content.Intent; | ||
| 5 | import android.os.IBinder; | ||
| 6 | import android.os.RemoteException; | ||
| 7 | |||
| 8 | /** | ||
| 9 | * Created by h on 2017/9/1. | ||
| 10 | */ | ||
| 11 | |||
| 12 | public class TestService extends Service { | ||
| 13 | public TestService(){ | ||
| 14 | |||
| 15 | } | ||
| 16 | IPresonalInterface.Stub binder = new IPresonalInterface.Stub() { | ||
| 17 | @Override | ||
| 18 | public String sayHello() throws RemoteException { | ||
| 19 | return "这是测试AIDL的方法"; | ||
| 20 | } | ||
| 21 | }; | ||
| 22 | |||
| 23 | @Override | ||
| 24 | public IBinder onBind(Intent intent) { | ||
| 25 | return binder; | ||
| 26 | } | ||
| 27 | } | ||
| 28 | 1 | package com.hjx.personalcenter.service; |
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 | android:orientation="vertical" | 3 | android:orientation="vertical" |
| 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 | 7 | ||
| 8 | 8 | ||
| 9 | <ImageView | 9 | <ImageView |
| 10 | android:src="@mipmap/ic_launcher" | 10 | android:src="@mipmap/ic_launcher" |
| 11 | android:id="@+id/image" | 11 | android:id="@+id/image" |
| 12 | android:layout_width="100dp" | 12 | android:layout_width="100dp" |
| 13 | android:background="@drawable/corcle_black_bg" | 13 | android:background="@drawable/corcle_black_bg" |
| 14 | android:layout_height="150dp" | 14 | android:layout_height="150dp" |
| 15 | 15 | ||
| 16 | /> | 16 | /> |
| 17 | <TextView | 17 | <TextView |
| 18 | android:id="@+id/text" | 18 | android:id="@+id/text" |
| 19 | android:layout_marginTop="5dp" | 19 | android:layout_marginTop="5dp" |
| 20 | android:textSize="22sp" | 20 | android:textSize="22sp" |
| 21 | android:layout_width="wrap_content" | 21 | android:layout_width="wrap_content" |
| 22 | android:layout_height="wrap_content" | 22 | android:layout_height="wrap_content" |
| 23 | android:textColor="@color/login_text_black" | 23 | android:textColor="@color/login_text_black" |
| 24 | android:text="语文" | 24 | android:text="" |
| 25 | /> | 25 | /> |
| 26 | <TextView | 26 | <TextView |
| 27 | android:id="@+id/tv_publish" | 27 | android:id="@+id/tv_publish" |
| 28 | android:layout_marginTop="10dp" | 28 | android:layout_marginTop="10dp" |
| 29 | android:textSize="18sp" | 29 | android:textSize="18sp" |
| 30 | android:layout_width="wrap_content" | 30 | android:layout_width="wrap_content" |
| 31 | android:layout_height="wrap_content" | 31 | android:layout_height="wrap_content" |
| 32 | android:textColor="@color/login_text_black" | 32 | android:textColor="@color/login_text_black" |
| 33 | android:text="人民教育出版社" | 33 | android:text="人民教育出版社" |
| 34 | /> | 34 | /> |
| 35 | 35 | ||
| 36 | </LinearLayout> | 36 | </LinearLayout> |
PersonalCenter/mypresonallibrary/.gitignore
| File was created | 1 | /build | |
| 2 |
PersonalCenter/mypresonallibrary/build.gradle
| File was created | 1 | apply plugin: 'com.android.library' | |
| 2 | |||
| 3 | android { | ||
| 4 | compileSdkVersion 25 | ||
| 5 | buildToolsVersion "25.0.3" | ||
| 6 | |||
| 7 | defaultConfig { | ||
| 8 | minSdkVersion 15 | ||
| 9 | targetSdkVersion 25 | ||
| 10 | versionCode 1 | ||
| 11 | versionName "1.0" | ||
| 12 | |||
| 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
| 14 | |||
| 15 | } | ||
| 16 | buildTypes { | ||
| 17 | release { | ||
| 18 | minifyEnabled false | ||
| 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | dependencies { | ||
| 25 | compile fileTree(dir: 'libs', include: ['*.jar']) | ||
| 26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
| 27 | exclude group: 'com.android.support', module: 'support-annotations' | ||
| 28 | }) | ||
| 29 | compile 'com.android.support:appcompat-v7:25.3.1' | ||
| 30 | testCompile 'junit:junit:4.12' | ||
| 31 | } | ||
| 32 |
PersonalCenter/mypresonallibrary/proguard-rules.pro
| File was created | 1 | # Add project specific ProGuard rules here. | |
| 2 | # By default, the flags in this file are appended to flags specified | ||
| 3 | # in C:\Users\h\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt | ||
| 4 | # You can edit the include path and order by changing the proguardFiles | ||
| 5 | # directive in build.gradle. | ||
| 6 | # | ||
| 7 | # For more details, see | ||
| 8 | # http://developer.android.com/guide/developing/tools/proguard.html | ||
| 9 | |||
| 10 | # Add any project specific keep options here: | ||
| 11 | |||
| 12 | # If your project uses WebView with JS, uncomment the following | ||
| 13 | # and specify the fully qualified class name to the JavaScript interface | ||
| 14 | # class: | ||
| 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
| 16 | # public *; | ||
| 17 | #} | ||
| 18 |
PersonalCenter/mypresonallibrary/src/androidTest/java/com/hjx/mypresonallibrary/ExampleInstrumentedTest.java
| File was created | 1 | package com.hjx.mypresonallibrary; | |
| 2 | |||
| 3 | import android.content.Context; | ||
| 4 | import android.support.test.InstrumentationRegistry; | ||
| 5 | import android.support.test.runner.AndroidJUnit4; | ||
| 6 | |||
| 7 | import org.junit.Test; | ||
| 8 | import org.junit.runner.RunWith; | ||
| 9 | |||
| 10 | import static org.junit.Assert.*; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * Instrumentation test, which will execute on an Android device. | ||
| 14 | * | ||
| 15 | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 16 | */ | ||
| 17 | @RunWith(AndroidJUnit4.class) | ||
| 18 | public class ExampleInstrumentedTest { | ||
| 19 | @Test | ||
| 20 | public void useAppContext() throws Exception { | ||
| 21 | // Context of the app under test. | ||
| 22 | Context appContext = InstrumentationRegistry.getTargetContext(); | ||
| 23 | |||
| 24 | assertEquals("com.hjx.mypresonallibrary.test", appContext.getPackageName()); | ||
| 25 | } | ||
| 26 | } | ||
| 27 |
PersonalCenter/mypresonallibrary/src/main/AndroidManifest.xml
| File was created | 1 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | package="com.hjx.mypresonallibrary"> | ||
| 3 | |||
| 4 | <application android:allowBackup="true" android:label="@string/app_name"> | ||
| 5 | |||
| 6 | </application> | ||
| 7 | |||
| 8 | </manifest> | ||
| 9 |
PersonalCenter/mypresonallibrary/src/main/aidl/com/hjx/personalcenter/service/IPresonalInterface.aidl
| File was created | 1 | // IPresonalInterface.aidl | |
| 2 | package com.hjx.personalcenter.service; | ||
| 3 | |||
| 4 | // Declare any non-default types here with import statements | ||
| 5 | |||
| 6 | interface IPresonalInterface { | ||
| 7 | //测试AIDL | ||
| 8 | String sayHello(); | ||
| 9 | //UI view 所有的页面 | ||
| 10 | String viewPage(String action); | ||
| 11 | //得到用户登录信息 | ||
| 12 | String getSimpleUser(); | ||
| 13 | //得到用户保卡信息 | ||
| 14 | String getcardUser(); | ||
| 15 | } | ||
| 16 |
PersonalCenter/mypresonallibrary/src/main/res/values/strings.xml
| File was created | 1 | <resources> | |
| 2 | <string name="app_name">MyPresonalLibrary</string> | ||
| 3 | </resources> | ||
| 4 |
PersonalCenter/mypresonallibrary/src/test/java/com/hjx/mypresonallibrary/ExampleUnitTest.java
| File was created | 1 | package com.hjx.mypresonallibrary; | |
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | |||
| 5 | import static org.junit.Assert.*; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * Example local unit test, which will execute on the development machine (host). | ||
| 9 | * | ||
| 10 | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 11 | */ | ||
| 12 | public class ExampleUnitTest { | ||
| 13 | @Test | ||
| 14 | public void addition_isCorrect() throws Exception { | ||
| 15 | assertEquals(4, 2 + 2); | ||
| 16 | } | ||
| 17 | } |
PersonalCenter/settings.gradle
| 1 | include ':app', ':circledialog', ':pickerview' | 1 | include ':app', ':circledialog', ':pickerview', ':mypresonallibrary' |
| 2 | 2 |