Commit 73ba0df5f612ffcb3b9801a47d085c3db93bd0bf
1 parent
a5bcfdbccf
Exists in
master
测试个人中心
Showing
32 changed files
with
833 additions
and
185 deletions
Show diff stats
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_8" 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_7" 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/app/src/main/AndroidManifest.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | package="com.hjx.personalcenter"> | 3 | package="com.hjx.personalcenter"> |
4 | 4 | ||
5 | <application | 5 | <application |
6 | android:name=".activity.MyApplication" | 6 | android:name=".activity.MyApplication" |
7 | android:allowBackup="true" | 7 | android:allowBackup="true" |
8 | android:icon="@mipmap/ic_launcher" | 8 | android:icon="@mipmap/ic_launcher" |
9 | android:label="@string/app_name" | 9 | android:label="@string/app_name" |
10 | android:supportsRtl="true" | 10 | android:supportsRtl="true" |
11 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> | 11 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> |
12 | <activity | 12 | <activity |
13 | android:name=".activity.MainActivity" | 13 | android:name=".activity.MainActivity" |
14 | android:launchMode="singleTask" | 14 | android:launchMode="singleTask" |
15 | android:screenOrientation="landscape"> | 15 | android:screenOrientation="landscape"> |
16 | </activity> | 16 | </activity> |
17 | <activity | 17 | <activity |
18 | android:name=".activity.LoginAndRegisterActivity" | 18 | android:name=".activity.LoginAndRegisterActivity" |
19 | android:launchMode="singleTask" | 19 | android:launchMode="singleTask" |
20 | 20 | ||
21 | android:screenOrientation="landscape"> | 21 | android:screenOrientation="landscape"> |
22 | <intent-filter> | 22 | <intent-filter> |
23 | <action android:name="android.intent.action.MAIN" /> | 23 | <action android:name="android.intent.action.MAIN" /> |
24 | 24 | ||
25 | <category android:name="android.intent.category.LAUNCHER" /> | 25 | <category android:name="android.intent.category.LAUNCHER" /> |
26 | </intent-filter> | 26 | </intent-filter> |
27 | 27 | ||
28 | </activity> | 28 | </activity> |
29 | <activity | 29 | <activity |
30 | android:name=".activity.ForgotPasswordActivity" | 30 | android:name=".activity.ForgotPasswordActivity" |
31 | android:launchMode="singleTask" | 31 | android:launchMode="singleTask" |
32 | android:screenOrientation="landscape"> | 32 | android:screenOrientation="landscape"> |
33 | 33 | ||
34 | </activity> | 34 | </activity> |
35 | <activity | 35 | <activity |
36 | android:name=".activity.ChangePasswordActivity" | 36 | android:name=".activity.ChangePasswordActivity" |
37 | android:launchMode="singleTask" | 37 | android:launchMode="singleTask" |
38 | android:screenOrientation="landscape"> | 38 | android:screenOrientation="landscape"> |
39 | 39 | ||
40 | </activity> | 40 | </activity> |
41 | <activity | 41 | <activity |
42 | android:name=".activity.RegisterInfoActivity" | 42 | android:name=".activity.RegisterInfoActivity" |
43 | android:launchMode="singleTask" | 43 | android:launchMode="singleTask" |
44 | android:screenOrientation="landscape"> | 44 | android:screenOrientation="landscape"> |
45 | 45 | ||
46 | </activity> | 46 | </activity> |
47 | <activity | 47 | <activity |
48 | android:name=".activity.ElectronicCardValidationActivity" | 48 | android:name=".activity.ElectronicCardValidationActivity" |
49 | android:launchMode="singleTask" | 49 | android:launchMode="singleTask" |
50 | android:screenOrientation="landscape"> | 50 | android:screenOrientation="landscape"> |
51 | 51 | ||
52 | </activity> | 52 | </activity> |
53 | <activity | 53 | <activity |
54 | android:name=".activity.ChangeBangDingActivity" | 54 | android:name=".activity.ChangeBangDingActivity" |
55 | android:launchMode="singleTask" | 55 | android:launchMode="singleTask" |
56 | android:screenOrientation="landscape"> | 56 | android:screenOrientation="landscape"> |
57 | 57 | ||
58 | </activity> | 58 | </activity> |
59 | <activity | 59 | <activity |
60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" | 60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" |
61 | android:launchMode="singleTask" | 61 | android:launchMode="singleTask" |
62 | android:screenOrientation="landscape"> | 62 | android:screenOrientation="landscape"> |
63 | 63 | ||
64 | </activity> | 64 | </activity> |
65 | <activity | 65 | <activity |
66 | android:name=".activity.ChangeEletronicCardPhoneActivity" | 66 | android:name=".activity.ChangeEletronicCardPhoneActivity" |
67 | android:launchMode="singleTask" | 67 | android:launchMode="singleTask" |
68 | android:screenOrientation="landscape"> | 68 | android:screenOrientation="landscape"> |
69 | 69 | ||
70 | </activity> | 70 | </activity> |
71 | <activity | 71 | <activity |
72 | android:name=".activity.ChoiseTextBookActivity" | 72 | android:name=".activity.ChoiseTextBookActivity" |
73 | android:launchMode="singleTask" | 73 | android:launchMode="singleTask" |
74 | android:screenOrientation="landscape"> | 74 | android:screenOrientation="landscape"> |
75 | 75 | ||
76 | </activity> | 76 | </activity> |
77 | <activity | 77 | <activity |
78 | android:name=".activity.TheStartPageActivity" | 78 | android:name=".activity.TheStartPageActivity" |
79 | android:launchMode="singleTask" | 79 | android:launchMode="singleTask" |
80 | android:screenOrientation="landscape"> | 80 | android:screenOrientation="landscape"> |
81 | 81 | ||
82 | </activity> | 82 | </activity> |
83 | <activity | 83 | <activity |
84 | android:name=".activity.ElectronicCardEditInfoActivity" | 84 | android:name=".activity.ElectronicCardEditInfoActivity" |
85 | android:launchMode="singleTask" | 85 | android:launchMode="singleTask" |
86 | android:screenOrientation="landscape"> | 86 | android:screenOrientation="landscape"> |
87 | 87 | ||
88 | </activity> | 88 | </activity> |
89 | <activity | 89 | <activity |
90 | android:name=".activity.ElectronicCardInfoOKActivity" | 90 | android:name=".activity.ElectronicCardInfoOKActivity" |
91 | android:launchMode="singleTask" | 91 | android:launchMode="singleTask" |
92 | android:screenOrientation="landscape"> | 92 | android:screenOrientation="landscape"> |
93 | 93 | ||
94 | </activity> | 94 | </activity> |
95 | <activity | 95 | <activity |
96 | android:name=".activity.ElectronicCardLookInfoActivity" | 96 | android:name=".activity.ElectronicCardLookInfoActivity" |
97 | android:launchMode="singleTask" | 97 | android:launchMode="singleTask" |
98 | android:screenOrientation="landscape"> | 98 | android:screenOrientation="landscape"> |
99 | 99 | ||
100 | </activity> | 100 | </activity> |
101 | <activity | 101 | <activity |
102 | android:name=".activity.FeedBackActivity" | 102 | android:name=".activity.FeedBackActivity" |
103 | android:launchMode="singleTask" | 103 | android:launchMode="singleTask" |
104 | android:screenOrientation="landscape"> | 104 | android:screenOrientation="landscape"> |
105 | 105 | ||
106 | </activity> | 106 | </activity> |
107 | <activity | 107 | <activity |
108 | android:name=".activity.AccountManagementActivity" | 108 | android:name=".activity.AccountManagementActivity" |
109 | android:launchMode="singleTask" | 109 | android:launchMode="singleTask" |
110 | android:screenOrientation="landscape"> | 110 | android:screenOrientation="landscape"> |
111 | 111 | ||
112 | </activity> | 112 | </activity> |
113 | <activity | 113 | <activity |
114 | android:name=".activity.ChangePresonalInfoActivity" | 114 | android:name=".activity.ChangePresonalInfoActivity" |
115 | android:launchMode="singleTask" | 115 | android:launchMode="singleTask" |
116 | android:screenOrientation="landscape"> | 116 | android:screenOrientation="landscape"> |
117 | 117 | ||
118 | </activity> | 118 | </activity> |
119 | <activity | 119 | <activity |
120 | android:name=".activity.BangDingCode" | 120 | android:name=".activity.BangDingCode" |
121 | android:launchMode="singleTask" | 121 | android:launchMode="singleTask" |
122 | android:screenOrientation="landscape"> | 122 | android:screenOrientation="landscape"> |
123 | 123 | ||
124 | </activity> | 124 | </activity> |
125 | <service android:name="com.hjx.personalcenter.service.CenterService" | 125 | <service android:name="com.hjx.personalcenter.service.CenterService" |
126 | android:enabled="true" | 126 | android:enabled="true" |
127 | android:exported="true"> | 127 | android:exported="true"> |
128 | <intent-filter> | 128 | <intent-filter> |
129 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> | 129 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> |
130 | </intent-filter> | 130 | </intent-filter> |
131 | </service> | 131 | </service> |
132 | 132 | ||
133 | </application> | 133 | </application> |
134 | <!--权限--> | 134 | <!--权限--> |
135 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 135 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
136 | <uses-permission android:name="android.permission.CAMERA" /> | 136 | <uses-permission android:name="android.permission.CAMERA" /> |
137 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 137 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
138 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | 138 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
139 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 139 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
140 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 140 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
141 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 141 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
142 | <uses-permission android:name="android.permission.CALL_PHONE" /> | 142 | <uses-permission android:name="android.permission.CALL_PHONE" /> |
143 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 143 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
144 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | 144 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> |
145 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 145 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
146 | <uses-permission android:name="android.permission.INTERNET" /> | 146 | <uses-permission android:name="android.permission.INTERNET" /> |
147 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 147 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
148 | <uses-permission android:name="android.permission.READ_LOGS" /> | 148 | <uses-permission android:name="android.permission.READ_LOGS" /> |
149 | <uses-permission android:name="android.permission.RESTART_PACKAGES\"/> | ||
149 | 150 | ||
150 | </manifest> | 151 | </manifest> |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/AccountManagementActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
8 | import android.support.v7.widget.LinearLayoutManager; | 8 | import android.support.v7.widget.LinearLayoutManager; |
9 | import android.support.v7.widget.RecyclerView; | 9 | import android.support.v7.widget.RecyclerView; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
12 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
14 | 14 | ||
15 | import com.facebook.drawee.view.SimpleDraweeView; | 15 | import com.facebook.drawee.view.SimpleDraweeView; |
16 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; | 17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; |
18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
19 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.http.HttpCode; | 21 | import com.hjx.personalcenter.http.HttpCode; |
22 | import com.hjx.personalcenter.http.HttpManager; | 22 | import com.hjx.personalcenter.http.HttpManager; |
23 | import com.hjx.personalcenter.model.ChildsInfo; | 23 | import com.hjx.personalcenter.model.ChildsInfo; |
24 | import com.hjx.personalcenter.util.AlertUtils; | 24 | import com.hjx.personalcenter.util.AlertUtils; |
25 | import com.hjx.personalcenter.util.GetDevicesUtil; | 25 | import com.hjx.personalcenter.util.GetDevicesUtil; |
26 | 26 | ||
27 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
28 | import java.util.List; | 28 | import java.util.List; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * 账户管理 熊巍 | 31 | * 账户管理 熊巍 |
32 | * Created by h on 2017/8/12. | 32 | * Created by h on 2017/8/12. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener { | 35 | public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener { |
36 | private TextView changbangding, changpassword, usernames, | 36 | private TextView changbangding, changpassword, usernames, |
37 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; | 37 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; |
38 | private ImageView iv_useing, cancel; | 38 | private ImageView iv_useing, cancel; |
39 | private SimpleDraweeView mSimpleDraweeView; | 39 | private SimpleDraweeView mSimpleDraweeView; |
40 | private RecyclerView listview; | 40 | private RecyclerView listview; |
41 | private LinearLayout add_accunt, ll_zhu_backgrangd; | 41 | private LinearLayout add_accunt, ll_zhu_backgrangd; |
42 | private AccountChildsAdapter childsAdapter; | 42 | private AccountChildsAdapter childsAdapter; |
43 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); | 43 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); |
44 | Handler handler = new Handler() { | 44 | Handler handler = new Handler() { |
45 | @Override | 45 | @Override |
46 | public void handleMessage(Message msg) { | 46 | public void handleMessage(Message msg) { |
47 | super.handleMessage(msg); | 47 | super.handleMessage(msg); |
48 | switch (msg.what) { | 48 | switch (msg.what) { |
49 | case HttpCode.CHILDS_SUCESS: | 49 | case HttpCode.CHILDS_SUCESS: |
50 | ChildsInfo childsInfo = new ChildsInfo(); | 50 | ChildsInfo childsInfo = new ChildsInfo(); |
51 | if (childsInfo.getStatus()==1000) { | 51 | if (childsInfo.getStatus()==1000) { |
52 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.USERNAME); | 52 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.USERNAME); |
53 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.ADRESS); | 53 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.ADRESS); |
54 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); | 54 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); |
55 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); | 55 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); |
56 | tv_username.setText(names); | 56 | tv_username.setText(names); |
57 | tv_grade.setText(grades); | 57 | tv_grade.setText(grades); |
58 | tv_school.setText(schools); | 58 | tv_school.setText(schools); |
59 | tv_adress.setText(adress); | 59 | tv_adress.setText(adress); |
60 | tv_changzhu.setText("使用中"); | 60 | tv_changzhu.setText("使用中"); |
61 | tv_changzhu.setEnabled(false); | 61 | tv_changzhu.setEnabled(false); |
62 | iv_useing.setVisibility(View.VISIBLE); | 62 | iv_useing.setVisibility(View.VISIBLE); |
63 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 63 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
64 | //mSimpleDraweeView.setImageURI(phote); | 64 | //mSimpleDraweeView.setImageURI(phote); |
65 | 65 | ||
66 | } else { | 66 | } else { |
67 | String name = null; | 67 | String name = null; |
68 | String grade = null; | 68 | String grade = null; |
69 | String school = null; | 69 | String school = null; |
70 | String addr = null; | 70 | String addr = null; |
71 | String phote = null; | 71 | String phote = null; |
72 | String subAccountId = null; | ||
72 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); | 73 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); |
73 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; | 74 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; |
74 | for (int i = 0; i < list.size(); i++) { | 75 | for (int i = 0; i < list.size(); i++) { |
75 | int type = list.get(i).getType(); | 76 | int type = list.get(i).getType(); |
76 | if (type == 1) { | 77 | if (type == 1) { |
77 | name = list.get(i).getName(); | 78 | name = list.get(i).getName(); |
78 | grade = list.get(i).getGrade(); | 79 | grade = list.get(i).getGrade(); |
79 | school = list.get(i).getSchool(); | 80 | school = list.get(i).getSchool(); |
80 | addr = list.get(i).getRegion(); | 81 | addr = list.get(i).getRegion(); |
81 | phote = list.get(i).getImage(); | 82 | phote = list.get(i).getImage(); |
83 | subAccountId = list.get(i).getSubAccountId(); | ||
82 | } else if (type == 2) { | 84 | } else if (type == 2) { |
83 | childList.add(list.get(i)); | 85 | childList.add(list.get(i)); |
84 | } | 86 | } |
85 | } | 87 | } |
86 | tv_username.setText(name); | 88 | tv_username.setText(name); |
87 | tv_grade.setText(grade); | 89 | tv_grade.setText(grade); |
88 | tv_school.setText(school); | 90 | tv_school.setText(school); |
89 | tv_adress.setText(addr); | 91 | tv_adress.setText(addr); |
90 | mSimpleDraweeView.setImageURI(phote); | 92 | mSimpleDraweeView.setImageURI(phote); |
91 | data.clear(); | 93 | data.clear(); |
92 | data.addAll(childList); | 94 | data.addAll(childList); |
93 | childsAdapter.notifyDataSetChanged(); | 95 | childsAdapter.notifyDataSetChanged(); |
94 | } | 96 | } |
95 | break; | 97 | break; |
96 | } | 98 | } |
97 | } | 99 | } |
98 | }; | 100 | }; |
99 | 101 | ||
100 | @Override | 102 | @Override |
101 | protected void onCreate(Bundle savedInstanceState) { | 103 | protected void onCreate(Bundle savedInstanceState) { |
102 | super.onCreate(savedInstanceState); | 104 | super.onCreate(savedInstanceState); |
103 | setContentView(R.layout.activity_account_management); | 105 | setContentView(R.layout.activity_account_management); |
104 | 106 | ||
105 | initView(); | 107 | initView(); |
106 | initData(); | 108 | initData(); |
107 | initLister(); | 109 | initLister(); |
108 | } | 110 | } |
109 | 111 | ||
110 | private void initView() { | 112 | private void initView() { |
111 | changbangding = (TextView) findViewById(R.id.changBangding); | 113 | changbangding = (TextView) findViewById(R.id.changBangding); |
112 | changpassword = (TextView) findViewById(R.id.changpassword); | 114 | changpassword = (TextView) findViewById(R.id.changpassword); |
113 | usernames = (TextView) findViewById(R.id.cunt_username); | 115 | usernames = (TextView) findViewById(R.id.cunt_username); |
114 | tv_username = (TextView) findViewById(R.id.tv_account_name); | 116 | tv_username = (TextView) findViewById(R.id.tv_account_name); |
115 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); | 117 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); |
116 | tv_school = (TextView) findViewById(R.id.tv_account_school); | 118 | tv_school = (TextView) findViewById(R.id.tv_account_school); |
117 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); | 119 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); |
118 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.tv_account_head); | 120 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.tv_account_head); |
119 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); | 121 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); |
120 | cancel = (ImageView) findViewById(R.id.cancel); | 122 | cancel = (ImageView) findViewById(R.id.cancel); |
121 | add_accunt = (LinearLayout) findViewById(R.id.add_account); | 123 | add_accunt = (LinearLayout) findViewById(R.id.add_account); |
122 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); | 124 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); |
123 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); | 125 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); |
124 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 126 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
125 | } | 127 | } |
126 | 128 | ||
127 | private void initData() { | 129 | private void initData() { |
128 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); | 130 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
129 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 131 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
130 | usernames.setText(cunt_username); | 132 | usernames.setText(cunt_username); |
131 | 133 | ||
132 | if (account.equals("1")) { | 134 | if (account.equals("1")) { |
133 | tv_changzhu.setText("使用中"); | 135 | tv_changzhu.setText("使用中"); |
134 | tv_changzhu.setEnabled(false); | 136 | tv_changzhu.setEnabled(false); |
135 | iv_useing.setVisibility(View.VISIBLE); | 137 | iv_useing.setVisibility(View.VISIBLE); |
136 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 138 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
137 | } else { | 139 | } else { |
138 | 140 | ||
139 | tv_changzhu.setText("切换主账户"); | 141 | tv_changzhu.setText("切换主账户"); |
140 | tv_changzhu.setEnabled(true); | 142 | tv_changzhu.setEnabled(true); |
141 | iv_useing.setVisibility(View.GONE); | 143 | iv_useing.setVisibility(View.GONE); |
142 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 144 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
143 | } | 145 | } |
144 | 146 | ||
145 | 147 | ||
146 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 148 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
147 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 149 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
148 | listview.setLayoutManager(linearLayoutManager); | 150 | listview.setLayoutManager(linearLayoutManager); |
149 | childsAdapter = new AccountChildsAdapter(data, this); | 151 | childsAdapter = new AccountChildsAdapter(data, this); |
150 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); | 152 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); |
151 | listview.setAdapter(childsAdapter); | 153 | listview.setAdapter(childsAdapter); |
152 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { | 154 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { |
153 | @Override | 155 | @Override |
154 | public void onItemClick(View view, int position) { | 156 | public void onItemClick(View view, int position) { |
155 | 157 | ||
156 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); | 158 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); |
157 | } | 159 | } |
158 | }); | 160 | }); |
159 | 161 | ||
160 | } | 162 | } |
161 | 163 | ||
162 | 164 | ||
163 | private void initLister() { | 165 | private void initLister() { |
164 | changbangding.setOnClickListener(this); | 166 | changbangding.setOnClickListener(this); |
165 | changpassword.setOnClickListener(this); | 167 | changpassword.setOnClickListener(this); |
166 | cancel.setOnClickListener(this); | 168 | cancel.setOnClickListener(this); |
167 | add_accunt.setOnClickListener(this); | 169 | add_accunt.setOnClickListener(this); |
168 | tv_changzhu.setOnClickListener(this); | 170 | tv_changzhu.setOnClickListener(this); |
169 | 171 | ||
170 | 172 | ||
171 | } | 173 | } |
172 | 174 | ||
173 | @Override | 175 | @Override |
174 | public void onClick(View v) { | 176 | public void onClick(View v) { |
175 | switch (v.getId()) { | 177 | switch (v.getId()) { |
176 | case R.id.changBangding: | 178 | case R.id.changBangding: |
177 | Content.authcodeflag = 1; | 179 | Content.authcodeflag = 1; |
178 | Intent changebangding = new Intent(); | 180 | Intent changebangding = new Intent(); |
179 | changebangding.setClass(AccountManagementActivity.this, ElectronicCardValidationActivity.class); | 181 | changebangding.setClass(AccountManagementActivity.this, ElectronicCardValidationActivity.class); |
180 | startActivity(changebangding); | 182 | startActivity(changebangding); |
181 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 183 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
182 | break; | 184 | break; |
183 | case R.id.changpassword: | 185 | case R.id.changpassword: |
184 | Intent changpwd = new Intent(); | 186 | Intent changpwd = new Intent(); |
185 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); | 187 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); |
186 | startActivity(changpwd); | 188 | startActivity(changpwd); |
187 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 189 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
188 | break; | 190 | break; |
189 | case R.id.add_account: | 191 | case R.id.add_account: |
192 | Content.accountflag =2; | ||
190 | Intent account = new Intent(); | 193 | Intent account = new Intent(); |
191 | account.setClass(AccountManagementActivity.this, RegisterInfoActivity.class); | 194 | account.setClass(AccountManagementActivity.this, RegisterInfoActivity.class); |
192 | startActivity(account); | 195 | startActivity(account); |
193 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 196 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
194 | 197 | ||
195 | break; | 198 | break; |
196 | case R.id.change_zhu_account: | 199 | case R.id.change_zhu_account: |
197 | Content.changgeaccountflag = 1; | 200 | Content.changgeaccountflag = 1; |
198 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 201 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
199 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); | 202 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); |
200 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 203 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
201 | try { | 204 | try { |
202 | long auserID = Long.parseLong(userID); | 205 | long auserID = Long.parseLong(userID); |
203 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, | 206 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, |
204 | devicenumber, 1); | 207 | devicenumber, 1); |
205 | 208 | ||
206 | } catch (NumberFormatException e) { | 209 | } catch (NumberFormatException e) { |
207 | e.printStackTrace(); | 210 | e.printStackTrace(); |
208 | } | 211 | } |
209 | 212 | ||
210 | 213 | ||
211 | break; | 214 | break; |
212 | case R.id.cancel: | 215 | case R.id.cancel: |
213 | finish(); | 216 | finish(); |
214 | break; | 217 | break; |
215 | 218 | ||
216 | } | 219 | } |
217 | 220 | ||
218 | } | 221 | } |
219 | 222 | ||
220 | @Override | 223 | @Override |
221 | protected void onResume() { | 224 | protected void onResume() { |
222 | super.onResume(); | 225 | super.onResume(); |
223 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 226 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
224 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 227 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
225 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); | 228 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
226 | usernames.setText(cunt_username); | 229 | usernames.setText(cunt_username); |
227 | try { | 230 | try { |
228 | long auserID = Long.parseLong(userID); | 231 | long auserID = Long.parseLong(userID); |
229 | HttpManager.getInstance().getchildAccountinfo(this, auserID, devicenumber, handler); | 232 | HttpManager.getInstance().getchildAccountinfo(this, auserID, devicenumber, handler); |
230 | 233 | ||
231 | } catch (NumberFormatException e) { | 234 | } catch (NumberFormatException e) { |
232 | e.printStackTrace(); | 235 | e.printStackTrace(); |
233 | } | 236 | } |
234 | } | 237 | } |
235 | } | 238 | } |
236 | 239 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
8 | import android.util.Log; | ||
9 | import android.view.View; | 8 | import android.view.View; |
10 | import android.widget.AdapterView; | 9 | import android.widget.AdapterView; |
11 | import android.widget.Button; | 10 | import android.widget.Button; |
12 | import android.widget.GridView; | 11 | import android.widget.GridView; |
13 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
13 | import android.widget.TextView; | ||
14 | import android.widget.Toast; | ||
14 | 15 | ||
16 | import com.facebook.drawee.view.SimpleDraweeView; | ||
15 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.adapter.GridAdapter; | 18 | import com.hjx.personalcenter.adapter.GridAdapter; |
17 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 19 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
18 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 20 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
19 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
20 | import com.hjx.personalcenter.http.HttpCode; | 22 | import com.hjx.personalcenter.http.HttpCode; |
21 | import com.hjx.personalcenter.http.HttpManager; | 23 | import com.hjx.personalcenter.http.HttpManager; |
22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | ||
23 | import com.hjx.personalcenter.model.DefautPublishInfo; | 24 | import com.hjx.personalcenter.model.DefautPublishInfo; |
24 | import com.hjx.personalcenter.model.VersionInfo; | ||
25 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
26 | 26 | ||
27 | import org.json.JSONException; | 27 | import org.json.JSONException; |
28 | import org.json.JSONObject; | 28 | import org.json.JSONObject; |
29 | 29 | ||
30 | import java.util.ArrayList; | 30 | import java.util.ArrayList; |
31 | import java.util.List; | 31 | import java.util.List; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * 选择教材 | 34 | * 选择教材 |
35 | * Created by h on 2017/8/10. | 35 | * Created by h on 2017/8/10. |
36 | */ | 36 | */ |
37 | 37 | ||
38 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { | 38 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener{ |
39 | private GridView gridView; | 39 | private GridView gridView; |
40 | private Button btn_ok; | 40 | private Button btn_ok; |
41 | private ImageView cancel; | 41 | private ImageView cancel; |
42 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 42 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
43 | private GridAdapter sim_adapter; | 43 | private GridAdapter sim_adapter; |
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | Handler handler = new Handler() { | 47 | Handler handler = new Handler() { |
48 | @Override | 48 | @Override |
49 | public void handleMessage(Message msg) { | 49 | public void handleMessage(Message msg) { |
50 | super.handleMessage(msg); | 50 | super.handleMessage(msg); |
51 | JSONObject jsonObject; | 51 | JSONObject jsonObject; |
52 | String status; | 52 | String status; |
53 | switch (msg.what) { | 53 | switch (msg.what) { |
54 | case HttpCode.CHECKCARD: | 54 | case HttpCode.CHECKCARD: |
55 | try { | 55 | try { |
56 | jsonObject = new JSONObject((String) msg.obj); | 56 | jsonObject = new JSONObject((String) msg.obj); |
57 | status = jsonObject.optString("status"); | 57 | status = jsonObject.optString("status"); |
58 | if (status.equals("1")) { | 58 | if (status.equals("1")) { |
59 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); | 59 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); |
60 | Intent intent = new Intent(); | 60 | Intent intent = new Intent(); |
61 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 61 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
62 | ChoiseTextBookActivity.this.startActivity(intent); | 62 | ChoiseTextBookActivity.this.startActivity(intent); |
63 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 63 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
64 | } else if (status.equals("2001")) { | 64 | } else if (status.equals("2001")) { |
65 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); | 65 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); |
66 | } | 66 | } |
67 | 67 | ||
68 | } catch (JSONException e) { | 68 | } catch (JSONException e) { |
69 | e.printStackTrace(); | 69 | e.printStackTrace(); |
70 | } | 70 | } |
71 | 71 | ||
72 | break; | 72 | break; |
73 | case HttpCode.PUBLISH_SUCESS: | 73 | case HttpCode.PUBLISH_SUCESS: |
74 | defautPublishInfos.clear(); | 74 | defautPublishInfos.clear(); |
75 | defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); | 75 | defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); |
76 | sim_adapter.notifyDataSetChanged(); | 76 | sim_adapter.notifyDataSetChanged(); |
77 | break; | 77 | break; |
78 | case HttpCode.REGISTERINFO_SUCESS: | ||
79 | try { | ||
80 | jsonObject = new JSONObject((String) msg.obj); | ||
81 | String statusregister = jsonObject.optString("status"); | ||
82 | if (statusregister.equals("1")) { | ||
83 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); | ||
84 | String userID = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, "userId"); | ||
85 | try { | ||
86 | if (userID == null) { | ||
87 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | ||
88 | |||
89 | } else { | ||
90 | long auserID = Long.parseLong(userID); | ||
91 | //验证保卡信息 | ||
92 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, auserID, handler); | ||
93 | } | ||
94 | |||
95 | } catch (NumberFormatException e) { | ||
96 | e.printStackTrace(); | ||
97 | } | ||
98 | |||
99 | } else { | ||
100 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); | ||
101 | } | ||
102 | } catch (JSONException e) { | ||
103 | e.printStackTrace(); | ||
104 | } | ||
105 | |||
106 | |||
107 | break; | ||
78 | 108 | ||
79 | } | 109 | } |
80 | 110 | ||
81 | } | 111 | } |
82 | }; | 112 | }; |
83 | 113 | ||
84 | @Override | 114 | @Override |
85 | protected void onCreate(Bundle savedInstanceState) { | 115 | protected void onCreate(Bundle savedInstanceState) { |
86 | super.onCreate(savedInstanceState); | 116 | super.onCreate(savedInstanceState); |
87 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 117 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
88 | String graderid = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADENS); | 118 | String graderid = SaveParam.getInstance().getCustomizeParam(this,SaveParam.GRADENS); |
89 | try { | 119 | try { |
90 | long auserID = Long.parseLong(userID); | 120 | long auserID = Long.parseLong(userID); |
91 | int graderID = Integer.parseInt(graderid); | 121 | int graderID = Integer.parseInt(graderid); |
92 | //获取个人信息 | 122 | //获取版本信息 |
93 | HttpManager.getInstance().getpublishinfo(this,auserID,graderID,handler); | 123 | HttpManager.getInstance().getpublishinfo(this,auserID,graderID,handler); |
94 | 124 | ||
95 | } catch (NumberFormatException e) { | 125 | } catch (NumberFormatException e) { |
96 | e.printStackTrace(); | 126 | e.printStackTrace(); |
97 | } | 127 | } |
98 | setContentView(R.layout.activity_choisetextbook); | 128 | setContentView(R.layout.activity_choisetextbook); |
99 | initView(); | 129 | initView(); |
100 | initData(); | 130 | initData(); |
101 | initLister(); | 131 | initLister(); |
102 | } | 132 | } |
103 | 133 | ||
104 | private void initView() { | 134 | private void initView() { |
105 | gridView = (GridView) findViewById(R.id.grideview); | 135 | gridView = (GridView) findViewById(R.id.grideview); |
106 | cancel = (ImageView) findViewById(R.id.cancel); | 136 | cancel = (ImageView) findViewById(R.id.cancel); |
107 | btn_ok = (Button) findViewById(R.id.btn_ok); | 137 | btn_ok = (Button) findViewById(R.id.btn_ok); |
108 | } | 138 | } |
109 | 139 | ||
110 | private void initData() { | 140 | private void initData() { |
111 | sim_adapter = new GridAdapter(defautPublishInfos,this); | 141 | sim_adapter = new GridAdapter(defautPublishInfos,this); |
112 | //配置适配器 | 142 | //配置适配器 |
113 | gridView.setAdapter(sim_adapter); | 143 | gridView.setAdapter(sim_adapter); |
114 | 144 | ||
115 | } | 145 | } |
116 | 146 | ||
117 | private void initLister() { | 147 | private void initLister() { |
118 | btn_ok.setOnClickListener(this); | 148 | btn_ok.setOnClickListener(this); |
119 | cancel.setOnClickListener(this); | 149 | cancel.setOnClickListener(this); |
120 | gridView.setOnItemClickListener(this); | 150 | gridView.setOnItemClickListener(this); |
121 | 151 | ||
122 | } | 152 | } |
123 | 153 | ||
124 | @Override | 154 | @Override |
125 | public void onClick(View v) { | 155 | public void onClick(View v) { |
126 | switch (v.getId()) { | 156 | switch (v.getId()) { |
127 | case R.id.btn_ok: | 157 | case R.id.btn_ok: |
128 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 158 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
159 | String regionId = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); | ||
160 | String regionId1 = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CITYS); | ||
161 | if (regionId == null) { | ||
162 | regionId = regionId1; | ||
163 | } | ||
164 | String grade = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this, SaveParam.GRADENS); | ||
165 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); | ||
166 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.USERNAME); | ||
167 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADRESS); | ||
168 | String togoth ="人民教育出版社"; | ||
169 | |||
129 | try { | 170 | try { |
130 | if (userID == null) { | 171 | if (userID == null) { |
131 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 172 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
132 | 173 | ||
133 | } else { | 174 | } else { |
175 | Object schoolID; | ||
134 | long auserID = Long.parseLong(userID); | 176 | long auserID = Long.parseLong(userID); |
135 | //验证保卡信息 | 177 | int gradeID = Integer.parseInt(grade); |
136 | HttpManager.getInstance().cardinfocheck(this, auserID, handler); | 178 | long regionID = Long.parseLong(regionId); |
179 | if (schoolid==null){ | ||
180 | schoolID =null; | ||
181 | }else { | ||
182 | schoolID = Long.parseLong(schoolid); | ||
183 | } | ||
184 | |||
137 | //提交注册信息 | 185 | //提交注册信息 |
138 | HttpManager.getInstance().cardinfocheck(this, auserID, handler); | 186 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, |
187 | name ,gradeID,regionID,regeionname,schoolID,togoth,togoth,togoth,togoth | ||
188 | ,togoth,togoth,togoth,togoth,togoth,togoth,handler); | ||
139 | } | 189 | } |
140 | 190 | ||
141 | } catch (NumberFormatException e) { | 191 | } catch (NumberFormatException e) { |
142 | e.printStackTrace(); | 192 | e.printStackTrace(); |
143 | } | 193 | } |
144 | 194 | ||
145 | break; | 195 | break; |
146 | case R.id.cancel: | 196 | case R.id.cancel: |
147 | finish(); | 197 | finish(); |
148 | break; | 198 | break; |
149 | } | 199 | } |
150 | 200 | ||
151 | } | 201 | } |
152 | 202 | ||
153 | @Override | 203 | @Override |
154 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 204 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
155 | SaveParam.getInstance().saveLoginParam(this,SaveParam.VERSION,defautPublishInfos.get(position).getSubject()); | 205 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SUBJECT,defautPublishInfos.get(position).getSubject()); |
156 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); | 206 | VerSionDialog.getInstance().show(getSupportFragmentManager(), "VerSionDialog"); |
157 | 207 | ||
158 | 208 | String imgurl = SaveParam.getInstance().getLoginParam(this, SaveParam.IMGURL); | |
209 | String version = SaveParam.getInstance().getLoginParam(this, SaveParam.VERSION); | ||
210 | SimpleDraweeView simpleDraweeView = (SimpleDraweeView) parent.findViewById(R.id.image_publish); | ||
211 | TextView publish = (TextView) parent.findViewById(R.id.tv_publish); | ||
212 | simpleDraweeView.setImageURI(imgurl); | ||
213 | publish.setText(version); | ||
159 | } | 214 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardEditInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
6 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
7 | import android.view.View; | 7 | import android.view.View; |
8 | import android.widget.Button; | 8 | import android.widget.Button; |
9 | import android.widget.EditText; | 9 | import android.widget.EditText; |
10 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
11 | import android.widget.LinearLayout; | 11 | import android.widget.LinearLayout; |
12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
13 | 13 | ||
14 | import com.bigkoo.pickerview.TimePickerView; | 14 | import com.bigkoo.pickerview.TimePickerView; |
15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 16 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
17 | import com.hjx.personalcenter.customdialog.CountryDialog; | 17 | import com.hjx.personalcenter.customdialog.CountryDialog; |
18 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 18 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
19 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
22 | import com.hjx.personalcenter.model.CityInfo; | 22 | import com.hjx.personalcenter.model.CityInfo; |
23 | import com.hjx.personalcenter.model.CountyInfo; | 23 | import com.hjx.personalcenter.model.CountyInfo; |
24 | import com.hjx.personalcenter.model.ProvinceInfo; | 24 | import com.hjx.personalcenter.model.ProvinceInfo; |
25 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
26 | import com.hjx.personalcenter.util.GetDate; | 26 | import com.hjx.personalcenter.util.GetDate; |
27 | 27 | ||
28 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
29 | 29 | ||
30 | /**填写保卡信息 熊巍 | 30 | /**填写保卡信息 熊巍 |
31 | * Created by h on 2017/8/11. | 31 | * Created by h on 2017/8/11. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | public class ElectronicCardEditInfoActivity extends AppCompatActivity implements View.OnClickListener | 34 | public class ElectronicCardEditInfoActivity extends AppCompatActivity implements View.OnClickListener |
35 | ,DialogCallBack.ProvincesCallBack | 35 | ,DialogCallBack.ProvincesCallBack |
36 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ | 36 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ |
37 | private LinearLayout lineL_buy_time; | 37 | private LinearLayout lineL_buy_time; |
38 | private TextView tv_buy_time,adress_shop,adress_custem; | 38 | private TextView tv_buy_time,adress_shop,adress_custem; |
39 | private EditText username,store,detalAdress,telphone; | 39 | private EditText username,store,detalAdress,telphone; |
40 | private TimePickerView pvTime; | 40 | private TimePickerView pvTime; |
41 | private Button btn_change_info; | 41 | private Button btn_change_info; |
42 | private ImageView iv_card_back; | 42 | private ImageView iv_card_back,shop_adress,custom_adress; |
43 | 43 | ||
44 | @Override | 44 | @Override |
45 | protected void onCreate(Bundle savedInstanceState) { | 45 | protected void onCreate(Bundle savedInstanceState) { |
46 | super.onCreate(savedInstanceState); | 46 | super.onCreate(savedInstanceState); |
47 | setContentView(R.layout.activity_electroniccard_info); | 47 | setContentView(R.layout.activity_electroniccard_info); |
48 | initView(); | 48 | initView(); |
49 | initData(); | 49 | initData(); |
50 | initLister(); | 50 | initLister(); |
51 | } | 51 | } |
52 | 52 | ||
53 | private void initView() { | 53 | private void initView() { |
54 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); | 54 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); |
55 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); | 55 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); |
56 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); | 56 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); |
57 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); | 57 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); |
58 | username = (EditText) findViewById(R.id.et_edit_username); | 58 | username = (EditText) findViewById(R.id.et_edit_username); |
59 | store = (EditText) findViewById(R.id.et_edit_store); | 59 | store = (EditText) findViewById(R.id.et_edit_store); |
60 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); | 60 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); |
61 | telphone = (EditText) findViewById(R.id.et_edit_telphone); | 61 | telphone = (EditText) findViewById(R.id.et_edit_telphone); |
62 | btn_change_info = (Button) findViewById(R.id.btn_change_info); | 62 | btn_change_info = (Button) findViewById(R.id.btn_change_info); |
63 | iv_card_back = (ImageView) findViewById(R.id.iv_card_back); | 63 | iv_card_back = (ImageView) findViewById(R.id.iv_card_back); |
64 | shop_adress = (ImageView) findViewById(R.id.shopdizhi); | ||
65 | custom_adress = (ImageView) findViewById(R.id.cunstomdizhi); | ||
64 | } | 66 | } |
65 | 67 | ||
66 | private void initData() { | 68 | private void initData() { |
67 | GetDate date = new GetDate(); | 69 | GetDate date = new GetDate(); |
68 | tv_buy_time.setText(date.getYMD().toString()); | 70 | tv_buy_time.setText(date.getYMD().toString()); |
69 | 71 | ||
70 | } | 72 | } |
71 | 73 | ||
72 | private void initLister() { | 74 | private void initLister() { |
73 | adress_shop.setOnClickListener(this); | 75 | adress_shop.setOnClickListener(this); |
74 | adress_custem.setOnClickListener(this); | 76 | adress_custem.setOnClickListener(this); |
75 | btn_change_info.setOnClickListener(this); | 77 | btn_change_info.setOnClickListener(this); |
78 | iv_card_back.setOnClickListener(this); | ||
79 | shop_adress.setOnClickListener(this); | ||
80 | custom_adress.setOnClickListener(this); | ||
76 | 81 | ||
77 | } | 82 | } |
78 | 83 | ||
79 | @Override | 84 | @Override |
80 | public void onClick(View v) { | 85 | public void onClick(View v) { |
81 | switch (v.getId()){ | 86 | switch (v.getId()){ |
82 | case R.id.btn_change_info: | 87 | case R.id.btn_change_info: |
83 | String info1 =username.getText().toString().trim(); | 88 | String info1 =username.getText().toString().trim(); |
84 | String info2 =adress_custem.getText().toString().trim(); | 89 | String info2 =adress_custem.getText().toString().trim(); |
85 | String info3 =detalAdress.getText().toString().trim(); | 90 | String info3 =detalAdress.getText().toString().trim(); |
86 | String info4 =tv_buy_time.getText().toString().trim(); | 91 | String info4 =tv_buy_time.getText().toString().trim(); |
87 | String info5 =adress_shop.getText().toString().trim(); | 92 | String info5 =adress_shop.getText().toString().trim(); |
88 | String info6 =store.getText().toString().trim(); | 93 | String info6 =store.getText().toString().trim(); |
89 | String info7 =telphone.getText().toString().trim(); | 94 | String info7 =telphone.getText().toString().trim(); |
90 | 95 | ||
91 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2)||TextUtils.isEmpty(info3) | 96 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2)||TextUtils.isEmpty(info3) |
92 | ||TextUtils.isEmpty(info4)||TextUtils.isEmpty(info5)||TextUtils.isEmpty(info6) | 97 | ||TextUtils.isEmpty(info4)||TextUtils.isEmpty(info5)||TextUtils.isEmpty(info6) |
93 | ||TextUtils.isEmpty(info7)) { | 98 | ||TextUtils.isEmpty(info7)) { |
94 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); | 99 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); |
95 | return; | 100 | return; |
96 | }else { | 101 | }else { |
97 | savedata(); | 102 | savedata(); |
98 | Intent intent = new Intent(); | 103 | Intent intent = new Intent(); |
99 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); | 104 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); |
100 | startActivity(intent); | 105 | startActivity(intent); |
101 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 106 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
102 | } | 107 | } |
103 | 108 | ||
104 | break; | 109 | break; |
105 | case R.id.tv_edit_adress_shop: | 110 | case R.id.tv_edit_adress_shop: |
111 | case R.id.shopdizhi: | ||
106 | Content.adressflag =1; | 112 | Content.adressflag =1; |
107 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 113 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
108 | 114 | ||
109 | break; | 115 | break; |
110 | case R.id.tv_edit_adress_custem: | 116 | case R.id.tv_edit_adress_custem: |
117 | case R.id.cunstomdizhi: | ||
111 | Content.adressflag =2; | 118 | Content.adressflag =2; |
112 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 119 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
113 | 120 | ||
114 | break; | 121 | break; |
115 | case R.id.iv_card_back: | 122 | case R.id.iv_card_back: |
116 | finish(); | 123 | finish(); |
117 | break; | 124 | break; |
118 | 125 | ||
119 | } | 126 | } |
120 | 127 | ||
121 | 128 | ||
122 | } | 129 | } |
123 | //保存数据 | 130 | //保存数据 |
124 | private void savedata() { | 131 | private void savedata() { |
125 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CUNSTEMNAME, username.getText().toString().trim()); | 132 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CUNSTEMNAME, username.getText().toString().trim()); |
126 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim()+detalAdress.getText().toString().trim()); | 133 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim()+detalAdress.getText().toString().trim()); |
127 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); | 134 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); |
128 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPADRESS, adress_shop.getText().toString().trim()+store.getText().toString().trim()); | 135 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPADRESS, adress_shop.getText().toString().trim()+store.getText().toString().trim()); |
129 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); | 136 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); |
130 | 137 | ||
131 | } | 138 | } |
132 | 139 | ||
133 | @Override | 140 | @Override |
134 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 141 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
135 | String regionName = data.get(position).getRegionName(); | 142 | String regionName = data.get(position).getRegionName(); |
136 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 143 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
137 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 144 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
138 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 145 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
139 | if (Content.adressflag ==1){ | 146 | if (Content.adressflag ==1){ |
140 | adress_shop.setText(""); | 147 | adress_shop.setText(""); |
141 | adress_shop.setText(provice+regionName); | 148 | adress_shop.setText(provice+regionName); |
142 | }else { | 149 | }else { |
143 | adress_custem.setText(""); | 150 | adress_custem.setText(""); |
144 | adress_custem.setText(provice+regionName); | 151 | adress_custem.setText(provice+regionName); |
145 | } | 152 | } |
146 | 153 | ||
147 | } | 154 | } |
148 | 155 | ||
149 | @Override | 156 | @Override |
150 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 157 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
151 | String regionName = data.get(position).getRegionName(); | 158 | String regionName = data.get(position).getRegionName(); |
152 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 159 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
153 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 160 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
154 | if (Content.adressflag ==1){ | 161 | if (Content.adressflag ==1){ |
155 | adress_shop.setText(""); | 162 | adress_shop.setText(""); |
156 | adress_shop.setText(provices+citys+regionName); | 163 | adress_shop.setText(provices+citys+regionName); |
157 | }else { | 164 | }else { |
158 | adress_custem.setText(""); | 165 | adress_custem.setText(""); |
159 | adress_custem.setText(provices+citys+regionName); | 166 | adress_custem.setText(provices+citys+regionName); |
160 | } | 167 | } |
161 | 168 | ||
162 | 169 | ||
163 | 170 | ||
164 | } | 171 | } |
165 | 172 | ||
166 | @Override | 173 | @Override |
167 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 174 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
168 | String regionName = data.get(position).getRegionName(); | 175 | String regionName = data.get(position).getRegionName(); |
169 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 176 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
170 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 177 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
171 | adress_custem.setText(""); | 178 | adress_custem.setText(""); |
172 | adress_custem.setText(regionName); | 179 | adress_custem.setText(regionName); |
173 | 180 | ||
174 | } | 181 | } |
175 | } | 182 | } |
176 | 183 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.content.Context; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
6 | import android.net.Uri; | 6 | import android.net.Uri; |
7 | import android.os.Build; | 7 | import android.os.Build; |
8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
9 | import android.os.Handler; | 9 | import android.os.Handler; |
10 | import android.os.Message; | 10 | import android.os.Message; |
11 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
12 | import android.support.annotation.NonNull; | 12 | import android.support.annotation.NonNull; |
13 | import android.support.v4.content.FileProvider; | 13 | import android.support.v4.content.FileProvider; |
14 | import android.support.v7.app.AppCompatActivity; | 14 | import android.support.v7.app.AppCompatActivity; |
15 | import android.support.v7.widget.LinearLayoutManager; | 15 | import android.support.v7.widget.LinearLayoutManager; |
16 | import android.support.v7.widget.RecyclerView; | 16 | import android.support.v7.widget.RecyclerView; |
17 | import android.view.KeyEvent; | 17 | import android.view.KeyEvent; |
18 | import android.view.View; | 18 | import android.view.View; |
19 | import android.widget.ImageView; | 19 | import android.widget.ImageView; |
20 | import android.widget.LinearLayout; | 20 | import android.widget.LinearLayout; |
21 | import android.widget.TextView; | 21 | import android.widget.TextView; |
22 | import android.widget.Toast; | 22 | import android.widget.Toast; |
23 | 23 | ||
24 | import com.facebook.drawee.backends.pipeline.Fresco; | 24 | import com.facebook.drawee.backends.pipeline.Fresco; |
25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
27 | import com.facebook.drawee.generic.RoundingParams; | 27 | import com.facebook.drawee.generic.RoundingParams; |
28 | import com.facebook.drawee.interfaces.DraweeController; | 28 | import com.facebook.drawee.interfaces.DraweeController; |
29 | import com.facebook.drawee.view.SimpleDraweeView; | 29 | import com.facebook.drawee.view.SimpleDraweeView; |
30 | import com.hjx.personalcenter.R; | 30 | import com.hjx.personalcenter.R; |
31 | import com.hjx.personalcenter.adapter.GalleryAdapter; | 31 | import com.hjx.personalcenter.adapter.GalleryAdapter; |
32 | import com.hjx.personalcenter.adapter.VideoAdapter; | ||
32 | import com.hjx.personalcenter.customdialog.HeadDialog; | 33 | import com.hjx.personalcenter.customdialog.HeadDialog; |
34 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | ||
33 | import com.hjx.personalcenter.db.SaveParam; | 35 | import com.hjx.personalcenter.db.SaveParam; |
34 | import com.hjx.personalcenter.http.HttpCode; | 36 | import com.hjx.personalcenter.http.HttpCode; |
35 | import com.hjx.personalcenter.http.HttpManager; | 37 | import com.hjx.personalcenter.http.HttpManager; |
36 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 38 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
39 | import com.hjx.personalcenter.model.DefautPublishInfo; | ||
37 | import com.hjx.personalcenter.model.PesonalInfo; | 40 | import com.hjx.personalcenter.model.PesonalInfo; |
38 | import com.hjx.personalcenter.model.SignInfo; | 41 | import com.hjx.personalcenter.model.SignInfo; |
42 | import com.hjx.personalcenter.model.VideoInfo; | ||
39 | import com.hjx.personalcenter.update.UpdateChecker; | 43 | import com.hjx.personalcenter.update.UpdateChecker; |
40 | import com.hjx.personalcenter.util.AlertUtils; | 44 | import com.hjx.personalcenter.util.AlertUtils; |
41 | import com.hjx.personalcenter.util.CropUtils; | 45 | import com.hjx.personalcenter.util.CropUtils; |
42 | import com.hjx.personalcenter.util.DialogPermission; | 46 | import com.hjx.personalcenter.util.DialogPermission; |
43 | import com.hjx.personalcenter.util.FileUtil; | 47 | import com.hjx.personalcenter.util.FileUtil; |
44 | import com.hjx.personalcenter.util.PermissionUtil; | 48 | import com.hjx.personalcenter.util.PermissionUtil; |
45 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 49 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
46 | import com.mylhyl.circledialog.CircleDialog; | 50 | import com.mylhyl.circledialog.CircleDialog; |
47 | import com.mylhyl.circledialog.callback.ConfigInput; | 51 | import com.mylhyl.circledialog.callback.ConfigInput; |
48 | import com.mylhyl.circledialog.params.InputParams; | 52 | import com.mylhyl.circledialog.params.InputParams; |
49 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 53 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
50 | import com.zaaach.toprightmenu.MenuItem; | 54 | import com.zaaach.toprightmenu.MenuItem; |
51 | import com.zaaach.toprightmenu.TopRightMenu; | 55 | import com.zaaach.toprightmenu.TopRightMenu; |
52 | 56 | ||
53 | import java.io.File; | 57 | import java.io.File; |
54 | import java.io.UnsupportedEncodingException; | 58 | import java.io.UnsupportedEncodingException; |
55 | import java.util.ArrayList; | 59 | import java.util.ArrayList; |
56 | import java.util.Arrays; | ||
57 | import java.util.List; | 60 | import java.util.List; |
58 | 61 | ||
59 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 62 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
60 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; | 63 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; |
61 | private TextView tv_edit_presoninfo, tv_sign, | 64 | private TextView tv_edit_presoninfo, tv_sign, |
62 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 65 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
63 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; | 66 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; |
64 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; | 67 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; |
65 | private TopRightMenu mTopRightMenu; | 68 | private TopRightMenu mTopRightMenu; |
66 | //水平滑动 | 69 | //水平滑动 |
67 | private RecyclerView mRecyclerView; | 70 | private RecyclerView mRecyclerView; |
68 | private GalleryAdapter RecyclerViewadapter; | 71 | private RecyclerView mRecyclerViewpublish; |
69 | private List<Integer> mDatas = new ArrayList<Integer>(Arrays.asList(R.mipmap.default_avatar2, | 72 | private VideoAdapter RecyclerViewadapter; |
70 | R.mipmap.default_avatar2, R.mipmap.default_avatar2, R.mipmap.default_avatar2)); | 73 | private GalleryAdapter RecyclerViewadapterpublish; |
74 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | ||
75 | |||
76 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); | ||
71 | private boolean showIcon = true; | 77 | private boolean showIcon = true; |
72 | private boolean dimBg = true; | 78 | private boolean dimBg = true; |
73 | private boolean needAnim = true; | 79 | private boolean needAnim = true; |
74 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 80 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
75 | private static final int REQUEST_CODE_ALBUM = 2; | 81 | private static final int REQUEST_CODE_ALBUM = 2; |
76 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 82 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
77 | SimpleDraweeView mSimpleDraweeView; | 83 | SimpleDraweeView mSimpleDraweeView; |
78 | private File file; | 84 | private File file; |
79 | private Uri uri; | 85 | private Uri uri; |
80 | Handler handler = new Handler(){ | 86 | Handler handler = new Handler(){ |
81 | @Override | 87 | @Override |
82 | public void handleMessage(Message msg) { | 88 | public void handleMessage(Message msg) { |
83 | super.handleMessage(msg); | 89 | super.handleMessage(msg); |
84 | switch (msg.what){ | 90 | switch (msg.what){ |
85 | case HttpCode.GETINFO: | 91 | case HttpCode.GETINFO: |
86 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; | 92 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; |
87 | tv_username.setText(cardinfoBean.getNickName()); | 93 | tv_username.setText(cardinfoBean.getNickName()); |
88 | tv_username1.setText(cardinfoBean.getNickName()); | 94 | tv_username1.setText(cardinfoBean.getNickName()); |
89 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 95 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
90 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 96 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
91 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 97 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
92 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 98 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
93 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 99 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
94 | String sex = cardinfoBean.getGender(); | 100 | String sex = cardinfoBean.getGender(); |
95 | if ("0".equals(sex)){ | 101 | if ("0".equals(sex)){ |
96 | tv_sex.setText("男"); | 102 | tv_sex.setText("男"); |
97 | iv_sex.setImageResource(R.mipmap.men); | 103 | iv_sex.setImageResource(R.mipmap.men); |
98 | }else { | 104 | }else { |
99 | tv_sex.setText("女"); | 105 | tv_sex.setText("女"); |
100 | iv_sex.setImageResource(R.mipmap.women); | 106 | iv_sex.setImageResource(R.mipmap.women); |
101 | } | 107 | } |
102 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | 108 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); |
103 | break; | 109 | break; |
104 | case HttpCode.SIGN: | 110 | case HttpCode.SIGN: |
105 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; | 111 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; |
106 | if (dataBean.getSignature()==null){ | 112 | if (dataBean.getSignature()==null){ |
107 | tv_sign.setText("你还未设置个性签名"); | 113 | tv_sign.setText("你还未设置个性签名"); |
108 | }else { | 114 | }else { |
109 | tv_sign.setText(dataBean.getSignature()); | 115 | tv_sign.setText(dataBean.getSignature()); |
110 | } | 116 | } |
111 | 117 | ||
112 | break; | 118 | break; |
119 | case HttpCode.PUBLISH_SUCESS: | ||
120 | defautPublishInfos.clear(); | ||
121 | defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); | ||
122 | RecyclerViewadapterpublish.notifyDataSetChanged(); | ||
123 | break; | ||
124 | case HttpCode.GETVIDIO_SUCESS: | ||
125 | videoinfo.clear(); | ||
126 | videoinfo.addAll( (List<VideoInfo.DataBean>)msg.obj); | ||
127 | RecyclerViewadapter.notifyDataSetChanged(); | ||
128 | break; | ||
113 | } | 129 | } |
114 | } | 130 | } |
115 | }; | 131 | }; |
116 | 132 | ||
117 | @Override | 133 | @Override |
118 | protected void onCreate(Bundle savedInstanceState) { | 134 | protected void onCreate(Bundle savedInstanceState) { |
119 | super.onCreate(savedInstanceState); | 135 | super.onCreate(savedInstanceState); |
120 | Fresco.initialize(this); | 136 | Fresco.initialize(this); |
121 | setContentView(R.layout.activity_main); | 137 | setContentView(R.layout.activity_main); |
122 | initView(); | 138 | initView(); |
123 | initData(); | 139 | initData(); |
124 | initLister(); | 140 | initLister(); |
125 | updateVersion(); | 141 | updateVersion(); |
126 | // String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 142 | // String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
127 | // Log.e("test","......."+devicenumber); | 143 | // Log.e("test","......."+devicenumber); |
128 | } | 144 | } |
129 | //////版本更新 | 145 | //////版本更新 |
130 | private void updateVersion() { | 146 | private void updateVersion() { |
131 | UpdateChecker updateChecker = new UpdateChecker(this); | 147 | UpdateChecker updateChecker = new UpdateChecker(this); |
132 | updateChecker.checkForUpdates(); | 148 | updateChecker.checkForUpdates(); |
133 | 149 | ||
134 | 150 | ||
135 | } | 151 | } |
136 | 152 | ||
137 | private void initView() { | 153 | private void initView() { |
138 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 154 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
139 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); | 155 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); |
140 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); | 156 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); |
141 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 157 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
142 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 158 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
143 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 159 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
144 | //头像 | 160 | //头像 |
145 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 161 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
146 | //初始化个人信息 | 162 | //初始化个人信息 |
147 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 163 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
148 | tv_username = (TextView) findViewById(R.id.tv_username); | 164 | tv_username = (TextView) findViewById(R.id.tv_username); |
149 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 165 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
150 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 166 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
151 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 167 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
152 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 168 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
153 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 169 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
154 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 170 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
155 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 171 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
156 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 172 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
157 | //跳转其他应用 | 173 | //跳转其他应用 |
158 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); | 174 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); |
159 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); | 175 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); |
160 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); | 176 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); |
161 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); | 177 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); |
162 | // | 178 | // |
163 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 179 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
180 | mRecyclerViewpublish =(RecyclerView) findViewById(R.id.id_recyclerview_pubish); | ||
164 | 181 | ||
165 | } | 182 | } |
166 | 183 | ||
167 | 184 | ||
168 | private void initData() { | 185 | private void initData() { |
169 | //加载最近学习视频 | ||
170 | |||
171 | |||
172 | //设置布局管理器 | 186 | //设置布局管理器 |
173 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 187 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
174 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 188 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
189 | |||
190 | LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); | ||
191 | linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); | ||
192 | |||
175 | mRecyclerView.setLayoutManager(linearLayoutManager); | 193 | mRecyclerView.setLayoutManager(linearLayoutManager); |
176 | //设置适配器 | 194 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); |
177 | RecyclerViewadapter = new GalleryAdapter(this, mDatas); | 195 | |
196 | mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); | ||
197 | mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); | ||
198 | |||
199 | //设置视频适配器 | ||
200 | RecyclerViewadapter = new VideoAdapter(this,videoinfo); | ||
201 | RecyclerViewadapterpublish= new GalleryAdapter(this,defautPublishInfos); | ||
202 | |||
203 | //版本信息适配器 | ||
178 | mRecyclerView.setAdapter(RecyclerViewadapter); | 204 | mRecyclerView.setAdapter(RecyclerViewadapter); |
205 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | ||
179 | 206 | ||
180 | //加载个人信息 | 207 | //加载个人信息 |
181 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); | 208 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); |
182 | if (xiongzuo==null){ | 209 | if (xiongzuo==null){ |
183 | tv_mygad.setText(""); | 210 | tv_mygad.setText(""); |
184 | }else { | 211 | }else { |
185 | tv_mygad.setText(xiongzuo); | 212 | tv_mygad.setText(xiongzuo); |
186 | } | 213 | } |
187 | //加载版本信息 | 214 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
188 | |||
189 | 215 | ||
190 | //获取个性签名 | 216 | //获取个性签名 |
191 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | ||
192 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 217 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
193 | try { | 218 | try { |
194 | long auserID = Long.parseLong(userID); | 219 | long auserID = Long.parseLong(userID); |
195 | int typeaccount1=Integer.parseInt(typeaccount); | 220 | int typeaccount1=Integer.parseInt(typeaccount); |
196 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,typeaccount1,handler); | 221 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,typeaccount1,handler); |
197 | 222 | ||
198 | } catch (NumberFormatException e) { | 223 | } catch (NumberFormatException e) { |
199 | e.printStackTrace(); | 224 | e.printStackTrace(); |
200 | } | 225 | } |
201 | 226 | ||
202 | 227 | ||
203 | 228 | ||
204 | //初始化图片 | 229 | //初始化图片 |
205 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 230 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
206 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 231 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
207 | uri = Uri.fromFile(file); | 232 | uri = Uri.fromFile(file); |
208 | } else { | 233 | } else { |
209 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 234 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
210 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 235 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
211 | } | 236 | } |
212 | 237 | ||
213 | } | 238 | } |
214 | 239 | ||
215 | private void initLister() { | 240 | private void initLister() { |
216 | iv_imformatioan.setOnClickListener(this); | 241 | iv_imformatioan.setOnClickListener(this); |
217 | iv_look_card.setOnClickListener(this); | 242 | iv_look_card.setOnClickListener(this); |
218 | tv_edit_presoninfo.setOnClickListener(this); | 243 | tv_edit_presoninfo.setOnClickListener(this); |
219 | iv_setting.setOnClickListener(this); | 244 | iv_setting.setOnClickListener(this); |
220 | iv_sign.setOnClickListener(this); | 245 | iv_sign.setOnClickListener(this); |
221 | mSimpleDraweeView.setOnClickListener(this); | 246 | mSimpleDraweeView.setOnClickListener(this); |
222 | linel_mycuoti.setOnClickListener(this); | 247 | linel_mycuoti.setOnClickListener(this); |
223 | linel_mynote.setOnClickListener(this); | 248 | linel_mynote.setOnClickListener(this); |
224 | linel_mycollege.setOnClickListener(this); | 249 | linel_mycollege.setOnClickListener(this); |
225 | linel_myclass.setOnClickListener(this); | 250 | linel_myclass.setOnClickListener(this); |
226 | 251 | ||
227 | } | 252 | } |
228 | 253 | ||
229 | @Override | 254 | @Override |
230 | public void onClick(View v) { | 255 | public void onClick(View v) { |
231 | switch (v.getId()) { | 256 | switch (v.getId()) { |
232 | case R.id.iv_imformatioan: | 257 | case R.id.iv_imformatioan: |
233 | Intent intent = new Intent(); | 258 | Intent intent = new Intent(); |
234 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 259 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
235 | startActivity(intent); | 260 | startActivity(intent); |
236 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 261 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
237 | break; | 262 | break; |
238 | case R.id.iv_look_card: | 263 | case R.id.iv_look_card: |
239 | Intent lookintent = new Intent(); | 264 | Intent lookintent = new Intent(); |
240 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 265 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
241 | startActivity(lookintent); | 266 | startActivity(lookintent); |
242 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 267 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
243 | break; | 268 | break; |
244 | case R.id.tv_edit_presoninfo: | 269 | case R.id.tv_edit_presoninfo: |
245 | Intent editintent = new Intent(); | 270 | Intent editintent = new Intent(); |
246 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 271 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
247 | startActivity(editintent); | 272 | startActivity(editintent); |
248 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 273 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
249 | break; | 274 | break; |
250 | case R.id.iv_head: | 275 | case R.id.iv_head: |
251 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 276 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
252 | break; | 277 | break; |
253 | case R.id.iv_setting: | 278 | case R.id.iv_setting: |
254 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 279 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
255 | List<MenuItem> menuItems = new ArrayList<>(); | 280 | List<MenuItem> menuItems = new ArrayList<>(); |
256 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 281 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); |
257 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 282 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); |
258 | mTopRightMenu | 283 | mTopRightMenu |
259 | .setHeight(150) //默认高度480 | 284 | .setHeight(150) //默认高度480 |
260 | .setWidth(320) //默认宽度wrap_content | 285 | .setWidth(320) //默认宽度wrap_content |
261 | .showIcon(showIcon) //显示菜单图标,默认为true | 286 | .showIcon(showIcon) //显示菜单图标,默认为true |
262 | .dimBackground(dimBg) //背景变暗,默认为true | 287 | .dimBackground(dimBg) //背景变暗,默认为true |
263 | .needAnimationStyle(needAnim) //显示动画,默认为true | 288 | .needAnimationStyle(needAnim) //显示动画,默认为true |
264 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 289 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
265 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 290 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
266 | @Override | 291 | @Override |
267 | public void onMenuItemClick(int position) { | 292 | public void onMenuItemClick(int position) { |
268 | switch (position) { | 293 | switch (position) { |
269 | case 0: | 294 | case 0: |
270 | //清除数据 | 295 | //清除数据 |
271 | SaveParam.getInstance().clearData(MainActivity.this); | 296 | SaveParam.getInstance().clearData(MainActivity.this); |
272 | Intent settingintent = new Intent(); | 297 | Intent settingintent = new Intent(); |
273 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 298 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
274 | startActivity(settingintent); | 299 | startActivity(settingintent); |
275 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 300 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
276 | finish(); | 301 | finish(); |
277 | break; | 302 | break; |
278 | case 1: | 303 | case 1: |
279 | Intent accontMintent = new Intent(); | 304 | Intent accontMintent = new Intent(); |
280 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 305 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
281 | startActivity(accontMintent); | 306 | startActivity(accontMintent); |
282 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 307 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
283 | break; | 308 | break; |
284 | } | 309 | } |
285 | } | 310 | } |
286 | }) | 311 | }) |
287 | .addMenuList(menuItems) | 312 | .addMenuList(menuItems) |
288 | .showAsDropDown(iv_setting, -250, 0); | 313 | .showAsDropDown(iv_setting, -250, 0); |
289 | break; | 314 | break; |
290 | case R.id.iv_sign: | 315 | case R.id.iv_sign: |
291 | new CircleDialog.Builder(this) | 316 | new CircleDialog.Builder(this) |
292 | .setCanceledOnTouchOutside(false) | 317 | .setCanceledOnTouchOutside(false) |
293 | .setCancelable(true) | 318 | .setCancelable(true) |
294 | .setTitle("个性签名") | 319 | .setTitle("个性签名") |
295 | .setInputHint("请输入个性签名") | 320 | .setInputHint("请输入个性签名") |
296 | .setWidth(0.5f) | 321 | .setWidth(0.5f) |
297 | .configInput(new ConfigInput() { | 322 | .configInput(new ConfigInput() { |
298 | @Override | 323 | @Override |
299 | public void onConfig(InputParams params) { | 324 | public void onConfig(InputParams params) { |
300 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 325 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
301 | } | 326 | } |
302 | }) | 327 | }) |
303 | .setNegative("取消", null) | 328 | .setNegative("取消", null) |
304 | .setPositiveInput("确定", new OnInputClickListener() { | 329 | .setPositiveInput("确定", new OnInputClickListener() { |
305 | @Override | 330 | @Override |
306 | public void onClick(String text, View v) { | 331 | public void onClick(String text, View v) { |
307 | if (text.equals("")) { | 332 | if (text.equals("")) { |
308 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 333 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
309 | } else { | 334 | } else { |
310 | try { | 335 | try { |
311 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this,SaveParam.ACCOUNT); | 336 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this,SaveParam.ACCOUNT); |
312 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); | 337 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); |
313 | long auserID = Long.parseLong(userID); | 338 | long auserID = Long.parseLong(userID); |
314 | int typeaccount1=Integer.parseInt(typeaccount); | 339 | int typeaccount1=Integer.parseInt(typeaccount); |
315 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,typeaccount1,text); | 340 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,typeaccount1,text); |
316 | } catch (NumberFormatException e) { | 341 | } catch (NumberFormatException e) { |
317 | e.printStackTrace(); | 342 | e.printStackTrace(); |
318 | } | 343 | } |
319 | 344 | ||
320 | tv_sign.setText(text); | 345 | tv_sign.setText(text); |
321 | } | 346 | } |
322 | 347 | ||
323 | } | 348 | } |
324 | }) | 349 | }) |
325 | .show(); | 350 | .show(); |
326 | break; | 351 | break; |
327 | case R.id.linel_mycuoti: | 352 | case R.id.linel_mycuoti: |
328 | AlertUtils.showToast(this, "hhahahah "); | 353 | AlertUtils.showToast(this, "hhahahah "); |
329 | break; | 354 | break; |
330 | case R.id.linel_mynote: | 355 | case R.id.linel_mynote: |
331 | AlertUtils.showToast(this, "hhahahah "); | 356 | AlertUtils.showToast(this, "hhahahah "); |
332 | break; | 357 | break; |
333 | case R.id.linel_mycollege: | 358 | case R.id.linel_mycollege: |
334 | AlertUtils.showToast(this, "hhahahah "); | 359 | AlertUtils.showToast(this, "hhahahah "); |
335 | break; | 360 | break; |
336 | case R.id.linel_myclass: | 361 | case R.id.linel_myclass: |
337 | AlertUtils.showToast(this, "hhahahah "); | 362 | AlertUtils.showToast(this, "hhahahah "); |
338 | break; | 363 | break; |
339 | } | 364 | } |
340 | 365 | ||
341 | } | 366 | } |
342 | 367 | ||
343 | @Override | 368 | @Override |
344 | protected void onResume() { | 369 | protected void onResume() { |
345 | super.onResume(); | 370 | super.onResume(); |
346 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 371 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
347 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 372 | String graderid = SaveParam.getInstance().getCustomizeParam(this,SaveParam.GRADENS); |
373 | //子账户年级id | ||
374 | String graderidchilds = SaveParam.getInstance().getCustomizeParam(this,SaveParam.CHILDSGRADENS); | ||
375 | //账户类型 | ||
376 | String accounts = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | ||
348 | try { | 377 | try { |
378 | int graderID; | ||
349 | long auserID = Long.parseLong(userID); | 379 | long auserID = Long.parseLong(userID); |
350 | int typeaccount1=Integer.parseInt(typeaccount); | 380 | int typeaccount1=Integer.parseInt(accounts); |
381 | if ("2".equals(accounts)){ | ||
382 | graderID = Integer.parseInt(graderidchilds); | ||
383 | }else { | ||
384 | graderID = Integer.parseInt(graderid); | ||
385 | } | ||
351 | //获取个人信息 | 386 | //获取个人信息 |
352 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,typeaccount1,handler); | 387 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,typeaccount1,handler); |
388 | //获取版本信息 | ||
389 | HttpManager.getInstance().getpublishinfo(this,auserID,graderID,handler); | ||
390 | //获取最近播放视频 | ||
391 | HttpManager.getInstance().getstuyvidioinfo(this,auserID,handler); | ||
353 | 392 | ||
354 | } catch (NumberFormatException e) { | 393 | } catch (NumberFormatException e) { |
355 | e.printStackTrace(); | 394 | e.printStackTrace(); |
356 | } | 395 | } |
357 | 396 | ||
358 | } | 397 | } |
359 | 398 | ||
360 | //回调头像监听 | 399 | //回调头像监听 |
361 | @Override | 400 | @Override |
362 | public void heard(Context context, View v,int headpitiaon) { | 401 | public void heard(Context context, View v,int headpitiaon) { |
363 | String picUrl = ""; | 402 | String picUrl = ""; |
364 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 403 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
365 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 404 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
366 | switch (v.getId()){ | 405 | switch (v.getId()){ |
367 | //选择默认图片 | 406 | //选择默认图片 |
368 | case R.id.oktakephone: | 407 | case R.id.oktakephone: |
369 | if (headpitiaon==1){ | 408 | if (headpitiaon==1){ |
370 | mSimpleDraweeView.setImageDrawable(null); | 409 | mSimpleDraweeView.setImageDrawable(null); |
371 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 410 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
372 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; | 411 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; |
373 | try { | 412 | try { |
374 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 413 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
375 | } catch (UnsupportedEncodingException e) { | 414 | } catch (UnsupportedEncodingException e) { |
376 | e.printStackTrace(); | 415 | e.printStackTrace(); |
377 | } | 416 | } |
378 | }else if (headpitiaon==2){ | 417 | }else if (headpitiaon==2){ |
379 | mSimpleDraweeView.setImageDrawable(null); | 418 | mSimpleDraweeView.setImageDrawable(null); |
380 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 419 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
381 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; | 420 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; |
382 | try { | 421 | try { |
383 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 422 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
384 | } catch (UnsupportedEncodingException e) { | 423 | } catch (UnsupportedEncodingException e) { |
385 | e.printStackTrace(); | 424 | e.printStackTrace(); |
386 | } | 425 | } |
387 | }else if (headpitiaon==3){ | 426 | }else if (headpitiaon==3){ |
388 | mSimpleDraweeView.setImageDrawable(null); | 427 | mSimpleDraweeView.setImageDrawable(null); |
389 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 428 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
390 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; | 429 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; |
391 | try { | 430 | try { |
392 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 431 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
393 | } catch (UnsupportedEncodingException e) { | 432 | } catch (UnsupportedEncodingException e) { |
394 | e.printStackTrace(); | 433 | e.printStackTrace(); |
395 | } | 434 | } |
396 | }else if (headpitiaon==4){ | 435 | }else if (headpitiaon==4){ |
397 | mSimpleDraweeView.setImageDrawable(null); | 436 | mSimpleDraweeView.setImageDrawable(null); |
398 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 437 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
399 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; | 438 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; |
400 | try { | 439 | try { |
401 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 440 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
402 | } catch (UnsupportedEncodingException e) { | 441 | } catch (UnsupportedEncodingException e) { |
403 | e.printStackTrace(); | 442 | e.printStackTrace(); |
404 | } | 443 | } |
405 | }else{ | 444 | }else{ |
406 | mSimpleDraweeView.setImageDrawable(null); | 445 | mSimpleDraweeView.setImageDrawable(null); |
407 | mSimpleDraweeView.setImageResource(R.mipmap.header_default);; | 446 | mSimpleDraweeView.setImageResource(R.mipmap.header_default);; |
408 | } | 447 | } |
409 | 448 | ||
410 | break; | 449 | break; |
411 | case R.id.canceltakephone: | 450 | case R.id.canceltakephone: |
412 | 451 | ||
413 | break; | 452 | break; |
414 | //拍摄和相册 | 453 | //拍摄和相册 |
415 | case R.id.take_pic: | 454 | case R.id.take_pic: |
416 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 455 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
417 | uploadAvatarFromPhotoRequest(); | 456 | uploadAvatarFromPhotoRequest(); |
418 | } | 457 | } |
419 | 458 | ||
420 | break; | 459 | break; |
421 | case R.id.xiangce: | 460 | case R.id.xiangce: |
422 | uploadAvatarFromAlbumRequest(); | 461 | uploadAvatarFromAlbumRequest(); |
423 | break; | 462 | break; |
424 | 463 | ||
425 | } | 464 | } |
426 | 465 | ||
427 | } | 466 | } |
428 | 467 | ||
429 | //照相 | 468 | //照相 |
430 | private void uploadAvatarFromPhotoRequest() { | 469 | private void uploadAvatarFromPhotoRequest() { |
431 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 470 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
432 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 471 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
433 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 472 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
434 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 473 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
435 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 474 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
436 | } | 475 | } |
437 | 476 | ||
438 | //选择图库 | 477 | //选择图库 |
439 | private void uploadAvatarFromAlbumRequest() { | 478 | private void uploadAvatarFromAlbumRequest() { |
440 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 479 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
441 | photoPickerIntent.setType("image/*"); | 480 | photoPickerIntent.setType("image/*"); |
442 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 481 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
443 | } | 482 | } |
444 | //回掉 | 483 | //回掉 |
445 | @Override | 484 | @Override |
446 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 485 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
447 | super.onActivityResult(requestCode, resultCode, data); | 486 | super.onActivityResult(requestCode, resultCode, data); |
448 | if (resultCode != -1) { | 487 | if (resultCode != -1) { |
449 | return; | 488 | return; |
450 | } | 489 | } |
451 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 490 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
452 | Uri newUri; | 491 | Uri newUri; |
453 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 492 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
454 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 493 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
455 | } else { | 494 | } else { |
456 | newUri = data.getData(); | 495 | newUri = data.getData(); |
457 | } | 496 | } |
458 | if (newUri != null) { | 497 | if (newUri != null) { |
459 | startPhotoZoom(newUri); | 498 | startPhotoZoom(newUri); |
460 | } else { | 499 | } else { |
461 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 500 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
462 | } | 501 | } |
463 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 502 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
464 | startPhotoZoom(uri); | 503 | startPhotoZoom(uri); |
465 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 504 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
466 | uploadAvatarFromPhoto(); | 505 | uploadAvatarFromPhoto(); |
467 | } | 506 | } |
468 | } | 507 | } |
469 | 508 | ||
470 | private void uploadAvatarFromPhoto() { | 509 | private void uploadAvatarFromPhoto() { |
471 | compressAndUploadAvatar(file.getPath()); | 510 | compressAndUploadAvatar(file.getPath()); |
472 | 511 | ||
473 | } | 512 | } |
474 | private void compressAndUploadAvatar(String fileSrc) { | 513 | private void compressAndUploadAvatar(String fileSrc) { |
475 | 514 | ||
476 | 515 | ||
477 | //上传到服务器 | 516 | //上传到服务器 |
478 | 517 | ||
479 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 518 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
480 | String mimeType = "image/*"; | 519 | String mimeType = "image/*"; |
481 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 520 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
482 | //String fileName = cover.getName(); | 521 | //String fileName = cover.getName(); |
483 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 522 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
484 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 523 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
485 | 524 | ||
486 | //上传头像 | 525 | //上传头像 |
487 | 526 | ||
488 | try { | 527 | try { |
489 | HttpManager.getInstance().header(this, userID,typeaccount,file.getPath()); | 528 | HttpManager.getInstance().header(this, userID,typeaccount,file.getPath()); |
490 | } catch (UnsupportedEncodingException e) { | 529 | } catch (UnsupportedEncodingException e) { |
491 | e.printStackTrace(); | 530 | e.printStackTrace(); |
492 | } | 531 | } |
493 | 532 | ||
494 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 533 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
495 | //Fresco设置圆形头像 | 534 | //Fresco设置圆形头像 |
496 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 535 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
497 | GenericDraweeHierarchy hierarchy = builder | 536 | GenericDraweeHierarchy hierarchy = builder |
498 | .setDesiredAspectRatio(1f) | 537 | .setDesiredAspectRatio(1f) |
499 | .setFailureImage(R.mipmap.blank) | 538 | .setFailureImage(R.mipmap.blank) |
500 | //圆形头像 | 539 | //圆形头像 |
501 | .setRoundingParams(RoundingParams.asCircle()) | 540 | .setRoundingParams(RoundingParams.asCircle()) |
502 | .build(); | 541 | .build(); |
503 | 542 | ||
504 | //加载本地图片 | 543 | //加载本地图片 |
505 | Uri uri = Uri.fromFile(cover); | 544 | Uri uri = Uri.fromFile(cover); |
506 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 545 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
507 | .setOldController(mSimpleDraweeView.getController()) | 546 | .setOldController(mSimpleDraweeView.getController()) |
508 | .setUri(uri) | 547 | .setUri(uri) |
509 | .build(); | 548 | .build(); |
510 | mSimpleDraweeView.setHierarchy(hierarchy); | 549 | mSimpleDraweeView.setHierarchy(hierarchy); |
511 | mSimpleDraweeView.setController(controller); | 550 | mSimpleDraweeView.setController(controller); |
512 | 551 | ||
513 | } | 552 | } |
514 | 553 | ||
515 | public void startPhotoZoom(Uri uri) { | 554 | public void startPhotoZoom(Uri uri) { |
516 | Intent intent = new Intent("com.android.camera.action.CROP"); | 555 | Intent intent = new Intent("com.android.camera.action.CROP"); |
517 | intent.setDataAndType(uri, "image/*"); | 556 | intent.setDataAndType(uri, "image/*"); |
518 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 557 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
519 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 558 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
520 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 559 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
521 | intent.putExtra("aspectY", 1);// x:y=1:1 | 560 | intent.putExtra("aspectY", 1);// x:y=1:1 |
522 | // intent.putExtra("outputX", 400);//图片输出大小 | 561 | // intent.putExtra("outputX", 400);//图片输出大小 |
523 | // intent.putExtra("outputY", 400); | 562 | // intent.putExtra("outputY", 400); |
524 | intent.putExtra("output", Uri.fromFile(file)); | 563 | intent.putExtra("output", Uri.fromFile(file)); |
525 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 564 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
526 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 565 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
527 | } | 566 | } |
528 | 567 | ||
529 | @Override | 568 | @Override |
530 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 569 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
531 | switch (requestCode) { | 570 | switch (requestCode) { |
532 | 571 | ||
533 | case PermissionUtil.REQUEST_SHOWCAMERA: | 572 | case PermissionUtil.REQUEST_SHOWCAMERA: |
534 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 573 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
535 | // Permission Granted | 574 | // Permission Granted |
536 | uploadAvatarFromPhotoRequest(); | 575 | uploadAvatarFromPhotoRequest(); |
537 | 576 | ||
538 | } else { | 577 | } else { |
539 | if (!SharedPreferenceMark.getHasShowCamera()) { | 578 | if (!SharedPreferenceMark.getHasShowCamera()) { |
540 | SharedPreferenceMark.setHasShowCamera(true); | 579 | SharedPreferenceMark.setHasShowCamera(true); |
541 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 580 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
542 | 581 | ||
543 | } else { | 582 | } else { |
544 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 583 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
545 | .show(); | 584 | .show(); |
546 | } | 585 | } |
547 | } | 586 | } |
548 | break; | 587 | break; |
549 | default: | 588 | default: |
550 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 589 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
551 | } | 590 | } |
552 | } | 591 | } |
553 | private long exitTime = 0; | 592 | private long exitTime = 0; |
554 | @Override | 593 | @Override |
555 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 594 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
556 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 595 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
557 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 596 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
558 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 597 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
559 | Toast.LENGTH_SHORT).show(); | 598 | Toast.LENGTH_SHORT).show(); |
560 | exitTime = System.currentTimeMillis(); | 599 | exitTime = System.currentTimeMillis(); |
561 | } else { | 600 | } else { |
562 | finish(); | 601 | MainActivity.this.finish(); |
563 | System.exit(0); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
6 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
7 | import android.view.KeyEvent; | 7 | import android.view.KeyEvent; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.Button; | 9 | import android.widget.Button; |
10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
11 | import android.widget.TextView; | 11 | import android.widget.TextView; |
12 | 12 | ||
13 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
14 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 14 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
15 | import com.hjx.personalcenter.customdialog.CountryDialog; | 15 | import com.hjx.personalcenter.customdialog.CountryDialog; |
16 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 16 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
19 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.http.HttpManager; | 21 | import com.hjx.personalcenter.http.HttpManager; |
22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
23 | import com.hjx.personalcenter.model.CityInfo; | 23 | import com.hjx.personalcenter.model.CityInfo; |
24 | import com.hjx.personalcenter.model.CountyInfo; | 24 | import com.hjx.personalcenter.model.CountyInfo; |
25 | import com.hjx.personalcenter.model.GradeInfo; | 25 | import com.hjx.personalcenter.model.GradeInfo; |
26 | import com.hjx.personalcenter.model.ProvinceInfo; | 26 | import com.hjx.personalcenter.model.ProvinceInfo; |
27 | import com.hjx.personalcenter.model.SchoolInfo; | 27 | import com.hjx.personalcenter.model.SchoolInfo; |
28 | import com.hjx.personalcenter.util.AlertUtils; | 28 | import com.hjx.personalcenter.util.AlertUtils; |
29 | import com.hjx.personalcenter.util.GetDevicesUtil; | 29 | import com.hjx.personalcenter.util.GetDevicesUtil; |
30 | 30 | ||
31 | import java.util.ArrayList; | 31 | import java.util.ArrayList; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * 填写注册信息 熊巍 | 34 | * 填写注册信息 熊巍 |
35 | * Created by h on 2017/8/9. | 35 | * Created by h on 2017/8/9. |
36 | */ | 36 | */ |
37 | 37 | ||
38 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 38 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
39 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 39 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
40 | private EditText et_username; | 40 | private EditText et_username; |
41 | private TextView et_region, et_grade, et_school; | 41 | private TextView et_region, et_grade, et_school; |
42 | private Button btn_ok; | 42 | private Button btn_ok; |
43 | 43 | ||
44 | @Override | 44 | @Override |
45 | protected void onCreate(Bundle savedInstanceState) { | 45 | protected void onCreate(Bundle savedInstanceState) { |
46 | super.onCreate(savedInstanceState); | 46 | super.onCreate(savedInstanceState); |
47 | setContentView(R.layout.activity_registerinfo); | 47 | setContentView(R.layout.activity_registerinfo); |
48 | initView(); | 48 | initView(); |
49 | initData(); | 49 | initData(); |
50 | initLister(); | 50 | initLister(); |
51 | } | 51 | } |
52 | 52 | ||
53 | private void initView() { | 53 | private void initView() { |
54 | et_username = (EditText) findViewById(R.id.et_username); | 54 | et_username = (EditText) findViewById(R.id.et_username); |
55 | et_region = (TextView) findViewById(R.id.et_region); | 55 | et_region = (TextView) findViewById(R.id.et_region); |
56 | et_grade = (TextView) findViewById(R.id.et_grade); | 56 | et_grade = (TextView) findViewById(R.id.et_grade); |
57 | et_school = (TextView) findViewById(R.id.et_school); | 57 | et_school = (TextView) findViewById(R.id.et_school); |
58 | btn_ok = (Button) findViewById(R.id.btn_ok); | 58 | btn_ok = (Button) findViewById(R.id.btn_ok); |
59 | 59 | ||
60 | 60 | ||
61 | } | 61 | } |
62 | 62 | ||
63 | private void initData() { | 63 | private void initData() { |
64 | if (Content.accountflag == 2) { | 64 | if (Content.accountflag == 2) { |
65 | btn_ok.setText("提交"); | 65 | btn_ok.setText("提交"); |
66 | 66 | ||
67 | } | 67 | } |
68 | 68 | ||
69 | } | 69 | } |
70 | 70 | ||
71 | private void initLister() { | 71 | private void initLister() { |
72 | et_region.setOnClickListener(this); | 72 | et_region.setOnClickListener(this); |
73 | et_grade.setOnClickListener(this); | 73 | et_grade.setOnClickListener(this); |
74 | et_school.setOnClickListener(this); | 74 | et_school.setOnClickListener(this); |
75 | btn_ok.setOnClickListener(this); | 75 | btn_ok.setOnClickListener(this); |
76 | 76 | ||
77 | 77 | ||
78 | } | 78 | } |
79 | 79 | ||
80 | @Override | 80 | @Override |
81 | public void onClick(View v) { | 81 | public void onClick(View v) { |
82 | String register1 = et_username.getText().toString().trim(); | 82 | String register1 = et_username.getText().toString().trim(); |
83 | String register2 = et_region.getText().toString().trim(); | 83 | String register2 = et_region.getText().toString().trim(); |
84 | String register3 = et_grade.getText().toString().trim(); | 84 | String register3 = et_grade.getText().toString().trim(); |
85 | String register4 = et_school.getText().toString().trim(); | 85 | String register4 = et_school.getText().toString().trim(); |
86 | switch (v.getId()) { | 86 | switch (v.getId()) { |
87 | case R.id.et_region: | 87 | case R.id.et_region: |
88 | choiseregion(); | 88 | choiseregion(); |
89 | break; | 89 | break; |
90 | case R.id.et_grade: | 90 | case R.id.et_grade: |
91 | choisegrade(); | 91 | choisegrade(); |
92 | break; | 92 | break; |
93 | case R.id.et_school: | 93 | case R.id.et_school: |
94 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { | 94 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
95 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); | 95 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); |
96 | return; | 96 | return; |
97 | } else { | 97 | } else { |
98 | choiseschool(); | 98 | choiseschool(); |
99 | } | 99 | } |
100 | 100 | ||
101 | break; | 101 | break; |
102 | case R.id.btn_ok: | 102 | case R.id.btn_ok: |
103 | if (TextUtils.isEmpty(register1) || | 103 | if (TextUtils.isEmpty(register1) || |
104 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { | 104 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
105 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | 105 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
106 | return; | 106 | return; |
107 | } else { | 107 | } else { |
108 | String register5 = et_username.getText().toString().trim(); | 108 | String register5 = et_username.getText().toString().trim(); |
109 | String register6 = et_region.getText().toString().trim(); | 109 | String register6 = et_region.getText().toString().trim(); |
110 | String register7 = et_grade.getText().toString().trim(); | 110 | String register7 = et_grade.getText().toString().trim(); |
111 | String register8 = et_school.getText().toString().trim(); | 111 | String register8 = et_school.getText().toString().trim(); |
112 | if (Content.accountflag == 2) { | 112 | if (Content.accountflag == 2) { |
113 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 113 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
114 | String grade = SaveParam.getInstance().getLoginParam(this, SaveParam.GRADENS); | 114 | String grade = SaveParam.getInstance().getCustomizeParam(this, SaveParam.GRADENS); |
115 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); | 115 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); |
116 | String regionId = SaveParam.getInstance().getLoginParam(this, SaveParam.COUNTRY); | 116 | String regionId = SaveParam.getInstance().getLoginParam(this, SaveParam.COUNTRY); |
117 | String regionId1 = SaveParam.getInstance().getLoginParam(this, SaveParam.CITYS); | 117 | String regionId1 = SaveParam.getInstance().getLoginParam(this, SaveParam.CITYS); |
118 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 118 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
119 | if (regionId == null) { | 119 | if (regionId == null) { |
120 | regionId = regionId1; | 120 | regionId = regionId1; |
121 | } | 121 | } |
122 | 122 | ||
123 | try { | 123 | try { |
124 | Object schoolss; | 124 | Object schoolss; |
125 | long auserID = Long.parseLong(userID); | 125 | long auserID = Long.parseLong(userID); |
126 | long grades = Long.parseLong(grade); | 126 | long grades = Long.parseLong(grade); |
127 | if (TextUtils.isEmpty(register8)) { | 127 | if (TextUtils.isEmpty(register8)) { |
128 | schoolss = null; | 128 | schoolss = null; |
129 | } else { | 129 | } else { |
130 | schoolss = Long.parseLong(School); | 130 | schoolss = Long.parseLong(School); |
131 | } | 131 | } |
132 | long regionIds = Long.parseLong(regionId); | 132 | long regionIds = Long.parseLong(regionId); |
133 | HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this, auserID, "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png", | 133 | HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this, auserID, "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png", |
134 | register5, grades, schoolss, regionIds, devicenumber, register6); | 134 | register5, grades, schoolss, regionIds, devicenumber, register6); |
135 | 135 | ||
136 | } catch (NumberFormatException e) { | 136 | } catch (NumberFormatException e) { |
137 | e.printStackTrace(); | 137 | e.printStackTrace(); |
138 | } | 138 | } |
139 | 139 | ||
140 | } else { | 140 | } else { |
141 | savedata(); | ||
141 | Intent intent = new Intent(); | 142 | Intent intent = new Intent(); |
142 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); | 143 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); |
143 | startActivity(intent); | 144 | startActivity(intent); |
144 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 145 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
145 | } | 146 | } |
146 | 147 | ||
147 | } | 148 | } |
148 | 149 | ||
149 | break; | 150 | break; |
150 | } | 151 | } |
151 | 152 | ||
152 | } | 153 | } |
153 | 154 | ||
155 | private void savedata() { | ||
156 | String register9 = et_username.getText().toString().trim(); | ||
157 | String register10 = et_region.getText().toString().trim(); | ||
158 | String register11 = et_grade.getText().toString().trim(); | ||
159 | String register12 = et_school.getText().toString().trim(); | ||
160 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register9); | ||
161 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register10); | ||
162 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register11); | ||
163 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register12); | ||
164 | |||
165 | } | ||
166 | |||
154 | @Override | 167 | @Override |
155 | protected void onResume() { | 168 | protected void onResume() { |
156 | super.onResume(); | 169 | super.onResume(); |
157 | } | 170 | } |
158 | 171 | ||
159 | 172 | ||
160 | //选择地区 | 173 | //选择地区 |
161 | private void choiseregion() { | 174 | private void choiseregion() { |
162 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 175 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
163 | 176 | ||
164 | } | 177 | } |
165 | 178 | ||
166 | //选择年级 | 179 | //选择年级 |
167 | private void choisegrade() { | 180 | private void choisegrade() { |
168 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); | 181 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); |
169 | 182 | ||
170 | } | 183 | } |
171 | 184 | ||
172 | //选择学校 | 185 | //选择学校 |
173 | private void choiseschool() { | 186 | private void choiseschool() { |
174 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); | 187 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); |
175 | 188 | ||
176 | } | 189 | } |
177 | 190 | ||
178 | 191 | ||
179 | @Override | 192 | @Override |
180 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 193 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
181 | String regionName = data.get(position).getRegionName(); | 194 | String regionName = data.get(position).getRegionName(); |
182 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); | 195 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); |
183 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 196 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
184 | et_region.setText(""); | 197 | et_region.setText(""); |
185 | et_region.setText(regionName); | 198 | et_region.setText(regionName); |
186 | 199 | ||
187 | } | 200 | } |
188 | 201 | ||
189 | @Override | 202 | @Override |
190 | public boolean onKeyUp(int keyCode, KeyEvent event) { | 203 | public boolean onKeyUp(int keyCode, KeyEvent event) { |
191 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 204 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
192 | finish(); | 205 | finish(); |
193 | 206 | ||
194 | } | 207 | } |
195 | return super.onKeyUp(keyCode, event); | 208 | return super.onKeyUp(keyCode, event); |
196 | } | 209 | } |
197 | 210 | ||
198 | @Override | 211 | @Override |
199 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 212 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
200 | String regionName = data.get(position).getName(); | 213 | String regionName = data.get(position).getName(); |
201 | et_grade.setText(regionName); | 214 | et_grade.setText(regionName); |
202 | 215 | ||
203 | } | 216 | } |
204 | 217 | ||
205 | @Override | 218 | @Override |
206 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 219 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
207 | String regionName = data.get(position).getRegionName(); | 220 | String regionName = data.get(position).getRegionName(); |
208 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); | 221 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); |
209 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); | 222 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); |
210 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 223 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
211 | et_region.setText(""); | 224 | et_region.setText(""); |
212 | et_region.setText(provice + regionName); | 225 | et_region.setText(provice + regionName); |
213 | 226 | ||
214 | } | 227 | } |
215 | 228 | ||
216 | @Override | 229 | @Override |
217 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 230 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
218 | String regionName = data.get(position).getRegionName(); | 231 | String regionName = data.get(position).getRegionName(); |
219 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); | 232 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); |
220 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); | 233 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); |
221 | et_region.setText(""); | 234 | et_region.setText(""); |
222 | et_region.setText(provices + citys + regionName); | 235 | et_region.setText(provices + citys + regionName); |
223 | 236 | ||
224 | } | 237 | } |
225 | 238 | ||
226 | @Override | 239 | @Override |
227 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 240 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
228 | String regionName = data.get(position).getSchoolName(); | 241 | String regionName = data.get(position).getSchoolName(); |
229 | et_school.setText(regionName); | 242 | et_school.setText(regionName); |
230 | 243 | ||
231 | } | 244 | } |
232 | } | 245 | } |
233 | 246 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/AccountChildsAdapter.java
1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.content.Context; |
4 | import android.support.v4.app.FragmentActivity; | 4 | import android.support.v4.app.FragmentActivity; |
5 | import android.support.v7.widget.RecyclerView; | 5 | import android.support.v7.widget.RecyclerView; |
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.ImageView; | 9 | import android.widget.ImageView; |
10 | import android.widget.LinearLayout; | 10 | import android.widget.LinearLayout; |
11 | import android.widget.TextView; | 11 | import android.widget.TextView; |
12 | 12 | ||
13 | import com.facebook.drawee.view.SimpleDraweeView; | 13 | import com.facebook.drawee.view.SimpleDraweeView; |
14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
15 | import com.hjx.personalcenter.db.Content; | 15 | import com.hjx.personalcenter.db.Content; |
16 | import com.hjx.personalcenter.db.SaveParam; | 16 | import com.hjx.personalcenter.db.SaveParam; |
17 | import com.hjx.personalcenter.http.HttpManager; | 17 | import com.hjx.personalcenter.http.HttpManager; |
18 | import com.hjx.personalcenter.model.ChildsInfo; | 18 | import com.hjx.personalcenter.model.ChildsInfo; |
19 | import com.hjx.personalcenter.util.GetDevicesUtil; | 19 | import com.hjx.personalcenter.util.GetDevicesUtil; |
20 | import com.mylhyl.circledialog.CircleDialog; | 20 | import com.mylhyl.circledialog.CircleDialog; |
21 | 21 | ||
22 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
23 | import java.util.List; | 23 | import java.util.List; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Created by h on 2017/8/26. | 26 | * Created by h on 2017/8/26. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> implements View.OnClickListener { | 29 | public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> implements View.OnClickListener { |
30 | private List<ChildsInfo.DataBean> specailList; | 30 | private List<ChildsInfo.DataBean> specailList; |
31 | private LayoutInflater mInflater; | 31 | private LayoutInflater mInflater; |
32 | private Context mContext ; | 32 | private Context mContext ; |
33 | 33 | ||
34 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) { | 34 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) { |
35 | this.mContext = context; | 35 | this.mContext = context; |
36 | this.specailList = specailList; | 36 | this.specailList = specailList; |
37 | mInflater = LayoutInflater.from(context); | 37 | mInflater = LayoutInflater.from(context); |
38 | } | 38 | } |
39 | 39 | ||
40 | public OnItemClickListener mOnItemClickListener; | 40 | public OnItemClickListener mOnItemClickListener; |
41 | 41 | ||
42 | @Override | 42 | @Override |
43 | public void onClick(View v) { | 43 | public void onClick(View v) { |
44 | if (mOnItemClickListener ==null){ | 44 | if (mOnItemClickListener ==null){ |
45 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); | 45 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); |
46 | } | 46 | } |
47 | 47 | ||
48 | } | 48 | } |
49 | 49 | ||
50 | public interface OnItemClickListener { | 50 | public interface OnItemClickListener { |
51 | void onItemClick(View view, int position); | 51 | void onItemClick(View view, int position); |
52 | } | 52 | } |
53 | 53 | ||
54 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { | 54 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { |
55 | this.mOnItemClickListener = mOnItemClickLitener; | 55 | this.mOnItemClickListener = mOnItemClickLitener; |
56 | } | 56 | } |
57 | 57 | ||
58 | public void setList(List<ChildsInfo.DataBean> list) { | 58 | public void setList(List<ChildsInfo.DataBean> list) { |
59 | this.specailList = list; | 59 | this.specailList = list; |
60 | notifyDataSetChanged(); | 60 | notifyDataSetChanged(); |
61 | } | 61 | } |
62 | 62 | ||
63 | @Override | 63 | @Override |
64 | public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 64 | public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
65 | View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false); | 65 | View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false); |
66 | view.setOnClickListener(this); | 66 | view.setOnClickListener(this); |
67 | AccountChildsHolder holder = new AccountChildsHolder(view); | 67 | AccountChildsHolder holder = new AccountChildsHolder(view); |
68 | return holder; | 68 | return holder; |
69 | } | 69 | } |
70 | 70 | ||
71 | @Override | 71 | @Override |
72 | public void onBindViewHolder(AccountChildsHolder holder, int position) { | 72 | public void onBindViewHolder(AccountChildsHolder holder, int position) { |
73 | final ChildsInfo.DataBean bean = specailList.get(position); | 73 | final ChildsInfo.DataBean bean = specailList.get(position); |
74 | if (bean != null) { | 74 | if (bean != null) { |
75 | holder.mSimpleDraweeView.setImageURI(bean.getImage()); | 75 | holder.mSimpleDraweeView.setImageURI(bean.getImage()); |
76 | holder.iv_child_name.setText(bean.getName()); | 76 | holder.iv_child_name.setText(bean.getName()); |
77 | holder.iv_child_grade.setText(bean.getGrade()); | 77 | holder.iv_child_grade.setText(bean.getGrade()); |
78 | holder.iv_child_school.setText(bean.getSchool()); | 78 | holder.iv_child_school.setText(bean.getSchool()); |
79 | holder.iv_child_adress.setText(bean.getRegion()); | 79 | holder.iv_child_adress.setText(bean.getRegion()); |
80 | if ("已使用".equals(bean.getStatus())){ | 80 | if ("已使用".equals(bean.getStatus())){ |
81 | holder.chang_account.setText("使用中"); | 81 | holder.chang_account.setText("使用中"); |
82 | holder.chang_account.setEnabled(false); | 82 | holder.chang_account.setEnabled(false); |
83 | holder.delete_account.setEnabled(false); | 83 | holder.delete_account.setEnabled(false); |
84 | holder.iv_using_pic.setVisibility(View.VISIBLE); | 84 | holder.iv_using_pic.setVisibility(View.VISIBLE); |
85 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 85 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
86 | }else { | 86 | }else { |
87 | holder.chang_account.setText("切换用户"); | 87 | holder.chang_account.setText("切换用户"); |
88 | holder.chang_account.setEnabled(true); | 88 | holder.chang_account.setEnabled(true); |
89 | holder.delete_account.setEnabled(true); | 89 | holder.delete_account.setEnabled(true); |
90 | holder.iv_using_pic.setVisibility(View.GONE); | 90 | holder.iv_using_pic.setVisibility(View.GONE); |
91 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 91 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
92 | } | 92 | } |
93 | holder.delete_account.setOnClickListener(new View.OnClickListener() { | 93 | holder.delete_account.setOnClickListener(new View.OnClickListener() { |
94 | @Override | 94 | @Override |
95 | public void onClick(View v) { | 95 | public void onClick(View v) { |
96 | new CircleDialog.Builder((FragmentActivity)mContext) | 96 | new CircleDialog.Builder((FragmentActivity)mContext) |
97 | .setCanceledOnTouchOutside(false) | 97 | .setCanceledOnTouchOutside(false) |
98 | .setWidth(0.4f) | 98 | .setWidth(0.4f) |
99 | .setCancelable(false) | 99 | .setCancelable(false) |
100 | .setText("您确定删除该子账户?") | 100 | .setText("您确定删除该子账户?") |
101 | .setNegative("取消", null) | 101 | .setNegative("取消", null) |
102 | .setPositive("确定", new View.OnClickListener() { | 102 | .setPositive("确定", new View.OnClickListener() { |
103 | @Override | 103 | @Override |
104 | public void onClick(View v) { | 104 | public void onClick(View v) { |
105 | HttpManager.getInstance().deletechildAccountinfo(mContext,bean.getSubAccountId()); | 105 | HttpManager.getInstance().deletechildAccountinfo(mContext,bean.getSubAccountId()); |
106 | } | 106 | } |
107 | }) | 107 | }) |
108 | .show(); | 108 | .show(); |
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | } | 112 | } |
113 | }); | 113 | }); |
114 | holder.chang_account.setOnClickListener(new View.OnClickListener() { | 114 | holder.chang_account.setOnClickListener(new View.OnClickListener() { |
115 | @Override | 115 | @Override |
116 | public void onClick(View v) { | 116 | public void onClick(View v) { |
117 | new CircleDialog.Builder((FragmentActivity)mContext) | 117 | new CircleDialog.Builder((FragmentActivity)mContext) |
118 | .setCanceledOnTouchOutside(false) | 118 | .setCanceledOnTouchOutside(false) |
119 | .setWidth(0.4f) | 119 | .setWidth(0.4f) |
120 | .setCancelable(false) | 120 | .setCancelable(false) |
121 | .setText("您确定切换为该子账户?") | 121 | .setText("您确定切换为该子账户?") |
122 | .setNegative("取消", null) | 122 | .setNegative("取消", null) |
123 | .setPositive("确定", new View.OnClickListener() { | 123 | .setPositive("确定", new View.OnClickListener() { |
124 | @Override | 124 | @Override |
125 | public void onClick(View v) { | 125 | public void onClick(View v) { |
126 | Content.changgeaccountflag =2; | 126 | Content.changgeaccountflag =2; |
127 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ACCOUNT,"2"); | 127 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ACCOUNT,"2"); |
128 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CHILDSID,bean.getSubAccountId()); | ||
129 | //保存子账号年级id | ||
130 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSGRADENS,bean.getGradeId() ); | ||
128 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); | 131 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); |
129 | HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId(), | 132 | HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId(), |
130 | devicenumber,2); | 133 | devicenumber,2); |
131 | } | 134 | } |
132 | }) | 135 | }) |
133 | .show(); | 136 | .show(); |
134 | 137 | ||
135 | } | 138 | } |
136 | }); | 139 | }); |
137 | 140 | ||
138 | } | 141 | } |
139 | 142 | ||
140 | 143 | ||
141 | } | 144 | } |
142 | 145 | ||
143 | @Override | 146 | @Override |
144 | public int getItemCount() { | 147 | public int getItemCount() { |
145 | 148 | ||
146 | return specailList.size(); | 149 | return specailList.size(); |
147 | } | 150 | } |
148 | 151 | ||
149 | class AccountChildsHolder extends RecyclerView.ViewHolder { | 152 | class AccountChildsHolder extends RecyclerView.ViewHolder { |
150 | ImageView iv_using_pic; | 153 | ImageView iv_using_pic; |
151 | LinearLayout ll_backgrangd; | 154 | LinearLayout ll_backgrangd; |
152 | SimpleDraweeView mSimpleDraweeView; | 155 | SimpleDraweeView mSimpleDraweeView; |
153 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, | 156 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, |
154 | delete_account,chang_account; | 157 | delete_account,chang_account; |
155 | public AccountChildsHolder(View itemView) { | 158 | public AccountChildsHolder(View itemView) { |
156 | super(itemView); | 159 | super(itemView); |
157 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); | 160 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); |
158 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); | 161 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); |
159 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); | 162 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); |
160 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); | 163 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); |
161 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); | 164 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); |
162 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); | 165 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); |
163 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); | 166 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); |
164 | iv_using_pic = (ImageView) itemView.findViewById(R.id.iv_using_pic); | 167 | iv_using_pic = (ImageView) itemView.findViewById(R.id.iv_using_pic); |
165 | ll_backgrangd = (LinearLayout) itemView.findViewById(R.id.ll_backgrangd); | 168 | ll_backgrangd = (LinearLayout) itemView.findViewById(R.id.ll_backgrangd); |
166 | 169 | ||
167 | } | 170 | } |
168 | } | 171 | } |
169 | } | 172 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/GalleryAdapter.java
1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.content.Context; |
4 | import android.support.v7.widget.RecyclerView; | 4 | import android.support.v7.widget.RecyclerView; |
5 | import android.view.LayoutInflater; | 5 | import android.view.LayoutInflater; |
6 | import android.view.View; | 6 | import android.view.View; |
7 | import android.view.ViewGroup; | 7 | import android.view.ViewGroup; |
8 | import android.widget.TextView; | 8 | import android.widget.TextView; |
9 | 9 | ||
10 | import com.facebook.drawee.view.SimpleDraweeView; | 10 | import com.facebook.drawee.view.SimpleDraweeView; |
11 | import com.hjx.personalcenter.R; | 11 | import com.hjx.personalcenter.R; |
12 | import com.hjx.personalcenter.model.DefautPublishInfo; | ||
12 | 13 | ||
13 | import java.util.List; | 14 | import java.util.ArrayList; |
14 | 15 | ||
15 | public class GalleryAdapter extends | 16 | public class GalleryAdapter extends |
16 | RecyclerView.Adapter<GalleryAdapter.ViewHolder> | 17 | RecyclerView.Adapter<GalleryAdapter.ViewHolder> |
17 | { | 18 | { |
18 | 19 | ||
19 | private LayoutInflater mInflater; | 20 | private LayoutInflater mInflater; |
20 | private List<Integer> mDatas; | 21 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; |
21 | 22 | ||
22 | public GalleryAdapter(Context context, List<Integer> datats) | 23 | public GalleryAdapter(Context context, ArrayList<DefautPublishInfo.DataBean> mDatas) |
23 | { | 24 | { |
24 | mInflater = LayoutInflater.from(context); | 25 | mInflater = LayoutInflater.from(context); |
25 | mDatas = datats; | 26 | defautPublishInfo = mDatas; |
26 | } | 27 | } |
27 | 28 | ||
28 | public static class ViewHolder extends RecyclerView.ViewHolder | 29 | public static class ViewHolder extends RecyclerView.ViewHolder |
29 | { | 30 | { |
30 | public ViewHolder(View arg0) | 31 | public ViewHolder(View arg0) |
31 | { | 32 | { |
32 | super(arg0); | 33 | super(arg0); |
33 | } | 34 | } |
34 | 35 | ||
35 | SimpleDraweeView mSimpleDraweeView; | 36 | SimpleDraweeView simpleDraweeView; |
36 | TextView mTxt; | 37 | TextView subject; |
38 | TextView publish; | ||
39 | |||
37 | } | 40 | } |
38 | 41 | ||
39 | @Override | 42 | @Override |
40 | public int getItemCount() | 43 | public int getItemCount() |
41 | { | 44 | { |
42 | return mDatas.size(); | 45 | return defautPublishInfo.size(); |
43 | } | 46 | } |
44 | 47 | ||
45 | /** | 48 | /** |
46 | * 创建ViewHolder | 49 | * 创建ViewHolder |
47 | */ | 50 | */ |
48 | @Override | 51 | @Override |
49 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) | 52 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) |
50 | { | 53 | { |
51 | View view = mInflater.inflate(R.layout.recycler_study_tem_view, | 54 | View view = mInflater.inflate(R.layout.fragment_changge_version_info_itmes2, |
52 | viewGroup, false); | 55 | viewGroup, false); |
53 | ViewHolder viewHolder = new ViewHolder(view); | 56 | ViewHolder viewHolder = new ViewHolder(view); |
54 | 57 | ||
55 | viewHolder.mSimpleDraweeView = (SimpleDraweeView) view | 58 | viewHolder.simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); |
56 | .findViewById(R.id.id_index_gallery_item_image); | 59 | viewHolder.subject = (TextView) view.findViewById(R.id.subject); |
60 | viewHolder.publish = (TextView) view.findViewById(R.id.tv_publish); | ||
57 | return viewHolder; | 61 | return viewHolder; |
58 | } | 62 | } |
59 | 63 | ||
60 | /** | 64 | /** |
61 | * 设置值 | 65 | * 设置值 |
62 | */ | 66 | */ |
63 | @Override | 67 | @Override |
64 | public void onBindViewHolder(final ViewHolder viewHolder, final int i) | 68 | public void onBindViewHolder(final ViewHolder viewHolder, final int i) |
65 | { | 69 | { |
66 | viewHolder.mSimpleDraweeView.setImageResource(mDatas.get(i)); | 70 | viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(i).getCover()); |
71 | viewHolder.subject.setText(defautPublishInfo.get(i).getSubject()); | ||
72 | viewHolder.publish.setText(defautPublishInfo.get(i).getPress()); | ||
67 | } | 73 | } |
68 | 74 | ||
69 | } | 75 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/GridAdapter.java
1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.content.Context; |
4 | import android.view.View; | 4 | import android.view.View; |
5 | import android.view.ViewGroup; | 5 | import android.view.ViewGroup; |
6 | import android.widget.BaseAdapter; | 6 | import android.widget.BaseAdapter; |
7 | import android.widget.TextView; | 7 | import android.widget.TextView; |
8 | 8 | ||
9 | import com.facebook.drawee.view.SimpleDraweeView; | 9 | import com.facebook.drawee.view.SimpleDraweeView; |
10 | import com.hjx.personalcenter.R; | 10 | import com.hjx.personalcenter.R; |
11 | import com.hjx.personalcenter.model.DefautPublishInfo; | 11 | import com.hjx.personalcenter.model.DefautPublishInfo; |
12 | 12 | ||
13 | import java.util.ArrayList; | 13 | import java.util.ArrayList; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Created by h on 2017/9/12. | 16 | * Created by h on 2017/9/12. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | public class GridAdapter extends BaseAdapter { | 19 | public class GridAdapter extends BaseAdapter { |
20 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; | 20 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; |
21 | private Context context; | 21 | private Context context; |
22 | 22 | ||
23 | public GridAdapter(ArrayList<DefautPublishInfo.DataBean> defautPublishInfo, Context context) { | 23 | public GridAdapter(ArrayList<DefautPublishInfo.DataBean> defautPublishInfo, Context context) { |
24 | this.defautPublishInfo = defautPublishInfo; | 24 | this.defautPublishInfo = defautPublishInfo; |
25 | this.context = context; | 25 | this.context = context; |
26 | } | 26 | } |
27 | 27 | ||
28 | @Override | 28 | @Override |
29 | public int getCount() { | 29 | public int getCount() { |
30 | return defautPublishInfo.size(); | 30 | return defautPublishInfo.size(); |
31 | } | 31 | } |
32 | 32 | ||
33 | @Override | 33 | @Override |
34 | public Object getItem(int position) { | 34 | public Object getItem(int position) { |
35 | return position; | 35 | return position; |
36 | } | 36 | } |
37 | 37 | ||
38 | @Override | 38 | @Override |
39 | public long getItemId(int position) { | 39 | public long getItemId(int position) { |
40 | return position; | 40 | return position; |
41 | } | 41 | } |
42 | 42 | ||
43 | @Override | 43 | @Override |
44 | public View getView(int position, View convertView, ViewGroup parent) { | 44 | public View getView(int position, View convertView, ViewGroup parent) { |
45 | ViewHolder viewHolder = new ViewHolder(); | 45 | ViewHolder viewHolder = new ViewHolder(); |
46 | if (convertView == null) { | 46 | if (convertView == null) { |
47 | convertView = View.inflate(context, R.layout.fragment_changge_version_info_itmes, null); | 47 | convertView = View.inflate(context, R.layout.fragment_changge_version_info_itmes3, null); |
48 | viewHolder.simpleDraweeView = (SimpleDraweeView) convertView.findViewById(R.id.image_publish); | 48 | viewHolder.simpleDraweeView = (SimpleDraweeView) convertView.findViewById(R.id.image_publish); |
49 | viewHolder.subject = (TextView) convertView.findViewById(R.id.subject); | 49 | viewHolder.subject = (TextView) convertView.findViewById(R.id.subject); |
50 | viewHolder.publish = (TextView) convertView.findViewById(R.id.tv_publish); | 50 | viewHolder.publish = (TextView) convertView.findViewById(R.id.tv_publish); |
51 | convertView.setTag(viewHolder); | 51 | convertView.setTag(viewHolder); |
52 | } else { | 52 | } else { |
53 | viewHolder = (ViewHolder) convertView.getTag(); | 53 | viewHolder = (ViewHolder) convertView.getTag(); |
54 | } | 54 | } |
55 | viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(position).getCover()); | 55 | viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(position).getCover()); |
56 | viewHolder.subject.setText(defautPublishInfo.get(position).getSubject()); | 56 | viewHolder.subject.setText(defautPublishInfo.get(position).getSubject()); |
57 | viewHolder.publish.setText(defautPublishInfo.get(position).getPress()); | 57 | viewHolder.publish.setText(defautPublishInfo.get(position).getPress()); |
58 | return convertView; | 58 | return convertView; |
59 | } | 59 | } |
60 | 60 | ||
61 | static class ViewHolder { | 61 | static class ViewHolder { |
62 | SimpleDraweeView simpleDraweeView; | 62 | SimpleDraweeView simpleDraweeView; |
63 | TextView subject; | 63 | TextView subject; |
64 | TextView publish; | 64 | TextView publish; |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/VideoAdapter.java
File was created | 1 | package com.hjx.personalcenter.adapter; | |
2 | |||
3 | import android.content.Context; | ||
4 | import android.support.v7.widget.RecyclerView; | ||
5 | import android.view.LayoutInflater; | ||
6 | import android.view.View; | ||
7 | import android.view.ViewGroup; | ||
8 | import android.widget.TextView; | ||
9 | |||
10 | import com.facebook.drawee.view.SimpleDraweeView; | ||
11 | import com.hjx.personalcenter.R; | ||
12 | import com.hjx.personalcenter.model.VideoInfo; | ||
13 | |||
14 | import java.util.ArrayList; | ||
15 | |||
16 | public class VideoAdapter extends | ||
17 | RecyclerView.Adapter<VideoAdapter.ViewHolder> | ||
18 | { | ||
19 | |||
20 | private LayoutInflater mInflater; | ||
21 | private ArrayList<VideoInfo.DataBean> defautPublishInfo; | ||
22 | |||
23 | public VideoAdapter(Context context, ArrayList<VideoInfo.DataBean> mDatas) | ||
24 | { | ||
25 | mInflater = LayoutInflater.from(context); | ||
26 | defautPublishInfo = mDatas; | ||
27 | } | ||
28 | |||
29 | public static class ViewHolder extends RecyclerView.ViewHolder | ||
30 | { | ||
31 | public ViewHolder(View arg0) | ||
32 | { | ||
33 | super(arg0); | ||
34 | } | ||
35 | |||
36 | SimpleDraweeView simpleDraweeView; | ||
37 | TextView subject; | ||
38 | TextView publish; | ||
39 | |||
40 | } | ||
41 | |||
42 | @Override | ||
43 | public int getItemCount() | ||
44 | { | ||
45 | return defautPublishInfo.size(); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * 创建ViewHolder | ||
50 | */ | ||
51 | @Override | ||
52 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) | ||
53 | { | ||
54 | View view = mInflater.inflate(R.layout.fragment_changge_version_info_itmes, | ||
55 | viewGroup, false); | ||
56 | ViewHolder viewHolder = new ViewHolder(view); | ||
57 | |||
58 | viewHolder.simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | ||
59 | viewHolder.subject = (TextView) view.findViewById(R.id.subject); | ||
60 | viewHolder.publish = (TextView) view.findViewById(R.id.tv_publish); | ||
61 | return viewHolder; | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * 设置值 | ||
66 | */ | ||
67 | @Override | ||
68 | public void onBindViewHolder(final ViewHolder viewHolder, final int i) | ||
69 | { | ||
70 | viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(i).getVideoCover()); | ||
71 | viewHolder.subject.setText(defautPublishInfo.get(i).getVideoName()); | ||
72 | //viewHolder.publish.setText(defautPublishInfo.get(i).getPress()); | ||
73 | } | ||
74 | |||
75 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/GradeListDialog.java
1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
2 | 2 | ||
3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | import android.os.Handler; | 7 | import android.os.Handler; |
8 | import android.os.Message; | 8 | import android.os.Message; |
9 | import android.view.Gravity; | 9 | import android.view.Gravity; |
10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
13 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
14 | import android.widget.ImageView; | 14 | import android.widget.ImageView; |
15 | import android.widget.ListView; | 15 | import android.widget.ListView; |
16 | 16 | ||
17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.adapter.GrandeAdapter; | 18 | import com.hjx.personalcenter.adapter.GrandeAdapter; |
19 | import com.hjx.personalcenter.db.SaveParam; | 19 | import com.hjx.personalcenter.db.SaveParam; |
20 | import com.hjx.personalcenter.http.HttpCode; | 20 | import com.hjx.personalcenter.http.HttpCode; |
21 | import com.hjx.personalcenter.http.HttpManager; | 21 | import com.hjx.personalcenter.http.HttpManager; |
22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
23 | import com.hjx.personalcenter.model.GradeInfo; | 23 | import com.hjx.personalcenter.model.GradeInfo; |
24 | import com.mylhyl.circledialog.BaseCircleDialog; | 24 | import com.mylhyl.circledialog.BaseCircleDialog; |
25 | import com.mylhyl.circledialog.res.values.CircleDimen; | 25 | import com.mylhyl.circledialog.res.values.CircleDimen; |
26 | 26 | ||
27 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
28 | import java.util.List; | 28 | import java.util.List; |
29 | 29 | ||
30 | /**自定义年级列表对话框 | 30 | /**自定义年级列表对话框 |
31 | * Created by h on 2017/8/10. | 31 | * Created by h on 2017/8/10. |
32 | */ | 32 | */ |
33 | @SuppressLint("ValidFragment") | 33 | @SuppressLint("ValidFragment") |
34 | public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 34 | public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
35 | private GrandeAdapter listadapter; | 35 | private GrandeAdapter listadapter; |
36 | private ListView listView; | 36 | private ListView listView; |
37 | private ImageView cance; | 37 | private ImageView cance; |
38 | ArrayList<GradeInfo.DataBean.ChildrenBean> data = new ArrayList<>(); | 38 | ArrayList<GradeInfo.DataBean.ChildrenBean> data = new ArrayList<>(); |
39 | private DialogCallBack.GradeCallBack mCallBack; | 39 | private DialogCallBack.GradeCallBack mCallBack; |
40 | public GradeListDialog(DialogCallBack.GradeCallBack callBack) { | 40 | public GradeListDialog(DialogCallBack.GradeCallBack callBack) { |
41 | this.mCallBack = callBack; | 41 | this.mCallBack = callBack; |
42 | } | 42 | } |
43 | public static GradeListDialog getInstance(DialogCallBack.GradeCallBack callBack) { | 43 | public static GradeListDialog getInstance(DialogCallBack.GradeCallBack callBack) { |
44 | GradeListDialog dialogFragment = new GradeListDialog(callBack); | 44 | GradeListDialog dialogFragment = new GradeListDialog(callBack); |
45 | dialogFragment.setCanceledBack(true); | 45 | dialogFragment.setCanceledBack(true); |
46 | dialogFragment.setCanceledOnTouchOutside(true); | 46 | dialogFragment.setCanceledOnTouchOutside(true); |
47 | dialogFragment.setRadius(CircleDimen.RADIUS); | 47 | dialogFragment.setRadius(CircleDimen.RADIUS); |
48 | dialogFragment.setWidth(0.5f); | 48 | dialogFragment.setWidth(0.5f); |
49 | dialogFragment.setGravity(Gravity.CENTER); | 49 | dialogFragment.setGravity(Gravity.CENTER); |
50 | dialogFragment.setBackgroundColor(Color.WHITE); | 50 | dialogFragment.setBackgroundColor(Color.WHITE); |
51 | return dialogFragment; | 51 | return dialogFragment; |
52 | } | 52 | } |
53 | Handler handler = new Handler(){ | 53 | Handler handler = new Handler(){ |
54 | @Override | 54 | @Override |
55 | public void handleMessage(Message msg) { | 55 | public void handleMessage(Message msg) { |
56 | super.handleMessage(msg); | 56 | super.handleMessage(msg); |
57 | switch (msg.what){ | 57 | switch (msg.what){ |
58 | case HttpCode.GRADER: | 58 | case HttpCode.GRADER: |
59 | data.clear(); | 59 | data.clear(); |
60 | data.addAll( (List<GradeInfo.DataBean.ChildrenBean>)msg.obj); | 60 | data.addAll( (List<GradeInfo.DataBean.ChildrenBean>)msg.obj); |
61 | listadapter.notifyDataSetChanged(); | 61 | listadapter.notifyDataSetChanged(); |
62 | break; | 62 | break; |
63 | } | 63 | } |
64 | } | 64 | } |
65 | }; | 65 | }; |
66 | @Override | 66 | @Override |
67 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 67 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
68 | 68 | ||
69 | return inflater.inflate(R.layout.custom_adilog_gradelist, container, false); | 69 | return inflater.inflate(R.layout.custom_adilog_gradelist, container, false); |
70 | } | 70 | } |
71 | @Override | 71 | @Override |
72 | public void onActivityCreated(Bundle savedInstanceState) { | 72 | public void onActivityCreated(Bundle savedInstanceState) { |
73 | super.onActivityCreated(savedInstanceState); | 73 | super.onActivityCreated(savedInstanceState); |
74 | listView = (ListView) getView().findViewById(R.id.listadapter); | 74 | listView = (ListView) getView().findViewById(R.id.listadapter); |
75 | cance = (ImageView) getView().findViewById(R.id.cancel); | 75 | cance = (ImageView) getView().findViewById(R.id.cancel); |
76 | listadapter = new GrandeAdapter(data,getActivity()); | 76 | listadapter = new GrandeAdapter(data,getActivity()); |
77 | listView.setAdapter(listadapter); | 77 | listView.setAdapter(listadapter); |
78 | listView.setOnItemClickListener(this); | 78 | listView.setOnItemClickListener(this); |
79 | cance.setOnClickListener(new View.OnClickListener() { | 79 | cance.setOnClickListener(new View.OnClickListener() { |
80 | @Override | 80 | @Override |
81 | public void onClick(View v) { | 81 | public void onClick(View v) { |
82 | dismiss(); | 82 | dismiss(); |
83 | } | 83 | } |
84 | }); | 84 | }); |
85 | HttpManager.getInstance().getgrade(getActivity(),handler); | 85 | HttpManager.getInstance().getgrade(getActivity(),handler); |
86 | 86 | ||
87 | } | 87 | } |
88 | 88 | ||
89 | @Override | 89 | @Override |
90 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 90 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
91 | 91 | ||
92 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.GRADENS, ""+data.get(position).getId()); | 92 | SaveParam.getInstance().saveCustomizeParam(getActivity(), SaveParam.GRADENS, ""+data.get(position).getId()); |
93 | mCallBack.province3OnItemClick(data,position,5); | 93 | mCallBack.province3OnItemClick(data,position,5); |
94 | dismiss(); | 94 | dismiss(); |
95 | 95 | ||
96 | 96 | ||
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/SchoolListDialog.java
1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
2 | 2 | ||
3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | import android.os.Handler; | 7 | import android.os.Handler; |
8 | import android.os.Message; | 8 | import android.os.Message; |
9 | import android.text.Editable; | 9 | import android.text.Editable; |
10 | import android.text.TextWatcher; | 10 | import android.text.TextWatcher; |
11 | import android.view.Gravity; | 11 | import android.view.Gravity; |
12 | import android.view.LayoutInflater; | 12 | import android.view.LayoutInflater; |
13 | import android.view.View; | 13 | import android.view.View; |
14 | import android.view.ViewGroup; | 14 | import android.view.ViewGroup; |
15 | import android.widget.AdapterView; | 15 | import android.widget.AdapterView; |
16 | import android.widget.EditText; | 16 | import android.widget.EditText; |
17 | import android.widget.ImageView; | 17 | import android.widget.ImageView; |
18 | import android.widget.ListView; | 18 | import android.widget.ListView; |
19 | 19 | ||
20 | import com.hjx.personalcenter.R; | 20 | import com.hjx.personalcenter.R; |
21 | import com.hjx.personalcenter.adapter.SchoolAdapter; | 21 | import com.hjx.personalcenter.adapter.SchoolAdapter; |
22 | import com.hjx.personalcenter.db.SaveParam; | 22 | import com.hjx.personalcenter.db.SaveParam; |
23 | import com.hjx.personalcenter.http.HttpCode; | 23 | import com.hjx.personalcenter.http.HttpCode; |
24 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
25 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
26 | import com.hjx.personalcenter.model.SchoolInfo; | 26 | import com.hjx.personalcenter.model.SchoolInfo; |
27 | import com.mylhyl.circledialog.BaseCircleDialog; | 27 | import com.mylhyl.circledialog.BaseCircleDialog; |
28 | import com.mylhyl.circledialog.res.values.CircleDimen; | 28 | import com.mylhyl.circledialog.res.values.CircleDimen; |
29 | 29 | ||
30 | import java.util.ArrayList; | 30 | import java.util.ArrayList; |
31 | import java.util.List; | 31 | import java.util.List; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Created by h on 2017/8/21. | 34 | * Created by h on 2017/8/21. |
35 | */ | 35 | */ |
36 | @SuppressLint("ValidFragment") | 36 | @SuppressLint("ValidFragment") |
37 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 37 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
38 | private ListView school_list; | 38 | private ListView school_list; |
39 | private EditText school_sech; | 39 | private EditText school_sech; |
40 | private SchoolAdapter listadapter; | 40 | private SchoolAdapter listadapter; |
41 | private ImageView cance; | 41 | private ImageView cance; |
42 | private View mView; | 42 | private View mView; |
43 | boolean isFilter; | 43 | boolean isFilter; |
44 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); | 44 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); |
45 | private DialogCallBack.SchoolCallBack mCallBack; | 45 | private DialogCallBack.SchoolCallBack mCallBack; |
46 | 46 | ||
47 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { | 47 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { |
48 | // this.mCallBack = callBack; | 48 | // this.mCallBack = callBack; |
49 | // } | 49 | // } |
50 | public SchoolListDialog(DialogCallBack.SchoolCallBack callBack) { | 50 | public SchoolListDialog(DialogCallBack.SchoolCallBack callBack) { |
51 | this.mCallBack = callBack; | 51 | this.mCallBack = callBack; |
52 | } | 52 | } |
53 | 53 | ||
54 | public static SchoolListDialog getInstance(DialogCallBack.SchoolCallBack mCallBack) { | 54 | public static SchoolListDialog getInstance(DialogCallBack.SchoolCallBack mCallBack) { |
55 | SchoolListDialog dialogFragment = new SchoolListDialog(mCallBack); | 55 | SchoolListDialog dialogFragment = new SchoolListDialog(mCallBack); |
56 | dialogFragment.setCanceledBack(true); | 56 | dialogFragment.setCanceledBack(true); |
57 | dialogFragment.setCanceledOnTouchOutside(true); | 57 | dialogFragment.setCanceledOnTouchOutside(true); |
58 | dialogFragment.setRadius(CircleDimen.RADIUS); | 58 | dialogFragment.setRadius(CircleDimen.RADIUS); |
59 | dialogFragment.setWidth(0.5f); | 59 | dialogFragment.setWidth(0.5f); |
60 | dialogFragment.setGravity(Gravity.CENTER); | 60 | dialogFragment.setGravity(Gravity.CENTER); |
61 | dialogFragment.setBackgroundColor(Color.WHITE); | 61 | dialogFragment.setBackgroundColor(Color.WHITE); |
62 | return dialogFragment; | 62 | return dialogFragment; |
63 | } | 63 | } |
64 | 64 | ||
65 | Handler handler = new Handler(){ | 65 | Handler handler = new Handler(){ |
66 | @Override | 66 | @Override |
67 | public void handleMessage(Message msg) { | 67 | public void handleMessage(Message msg) { |
68 | super.handleMessage(msg); | 68 | super.handleMessage(msg); |
69 | switch (msg.what){ | 69 | switch (msg.what){ |
70 | case HttpCode.SCHOOL: | 70 | case HttpCode.SCHOOL: |
71 | data.clear(); | 71 | data.clear(); |
72 | data.addAll( (List<SchoolInfo.DataBean>)msg.obj); | 72 | data.addAll( (List<SchoolInfo.DataBean>)msg.obj); |
73 | listadapter.notifyDataSetChanged(); | 73 | listadapter.notifyDataSetChanged(); |
74 | break; | 74 | break; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | @Override | 80 | @Override |
81 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 81 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
82 | 82 | ||
83 | if (mView == null) { | 83 | if (mView == null) { |
84 | mView = inflater.inflate(R.layout.custom_adilog_school_list, container, false); | 84 | mView = inflater.inflate(R.layout.custom_adilog_school_list, container, false); |
85 | //mCallBack.provinceOnItemClick(context, inflater, container); | 85 | //mCallBack.provinceOnItemClick(context, inflater, container); |
86 | } | 86 | } |
87 | return mView; | 87 | return mView; |
88 | } | 88 | } |
89 | 89 | ||
90 | @Override | 90 | @Override |
91 | public void onActivityCreated(Bundle savedInstanceState) { | 91 | public void onActivityCreated(Bundle savedInstanceState) { |
92 | super.onActivityCreated(savedInstanceState); | 92 | super.onActivityCreated(savedInstanceState); |
93 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); | 93 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); |
94 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); | 94 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); |
95 | cance = (ImageView) getView().findViewById(R.id.cancel); | 95 | cance = (ImageView) getView().findViewById(R.id.cancel); |
96 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 96 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
97 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 97 | String grade = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); |
98 | listadapter = new SchoolAdapter(data, getActivity()); | 98 | listadapter = new SchoolAdapter(data, getActivity()); |
99 | school_list.setAdapter(listadapter); | 99 | school_list.setAdapter(listadapter); |
100 | school_list.setOnItemClickListener(this); | 100 | school_list.setOnItemClickListener(this); |
101 | cance.setOnClickListener(new View.OnClickListener() { | 101 | cance.setOnClickListener(new View.OnClickListener() { |
102 | @Override | 102 | @Override |
103 | public void onClick(View v) { | 103 | public void onClick(View v) { |
104 | dismiss(); | 104 | dismiss(); |
105 | } | 105 | } |
106 | }); | 106 | }); |
107 | try { | 107 | try { |
108 | int a = Integer.parseInt(citys); | 108 | int a = Integer.parseInt(citys); |
109 | int b = Integer.parseInt(grade); | 109 | int b = Integer.parseInt(grade); |
110 | HttpManager.getInstance().getschool(getActivity(),a,b,handler); | 110 | HttpManager.getInstance().getschool(getActivity(),a,b,handler); |
111 | } catch (NumberFormatException e) { | 111 | } catch (NumberFormatException e) { |
112 | e.printStackTrace(); | 112 | e.printStackTrace(); |
113 | } | 113 | } |
114 | intiEditView(); | 114 | intiEditView(); |
115 | 115 | ||
116 | 116 | ||
117 | } | 117 | } |
118 | private void intiEditView() { | 118 | private void intiEditView() { |
119 | school_sech.addTextChangedListener(new TextWatcher() { | 119 | school_sech.addTextChangedListener(new TextWatcher() { |
120 | @Override | 120 | @Override |
121 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | 121 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
122 | 122 | ||
123 | } | 123 | } |
124 | 124 | ||
125 | @Override | 125 | @Override |
126 | public void onTextChanged(CharSequence s, int start, int before, int count) { | 126 | public void onTextChanged(CharSequence s, int start, int before, int count) { |
127 | // mAdapter.getFilter().filter(s); | 127 | // mAdapter.getFilter().filter(s); |
128 | 128 | ||
129 | listadapter.getFilter().filter(s); | 129 | listadapter.getFilter().filter(s); |
130 | } | 130 | } |
131 | 131 | ||
132 | @Override | 132 | @Override |
133 | public void afterTextChanged(Editable s) { | 133 | public void afterTextChanged(Editable s) { |
134 | 134 | ||
135 | } | 135 | } |
136 | }); | 136 | }); |
137 | } | 137 | } |
138 | 138 | ||
139 | @Override | 139 | @Override |
140 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 140 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
141 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SCHOOOlID, ""+data.get(position).getSchoolId()); | 141 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SCHOOOlID, ""+data.get(position).getSchoolId()); |
142 | mCallBack.provinceO4nItemClick(data,position,4); | 142 | mCallBack.provinceO4nItemClick(data,position,4); |
143 | dismiss(); | 143 | dismiss(); |
144 | 144 | ||
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/VerSionDialog.java
1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
2 | 2 | ||
3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | import android.os.Handler; | 7 | import android.os.Handler; |
8 | import android.os.Message; | 8 | import android.os.Message; |
9 | import android.util.Log; | 9 | import android.util.Log; |
10 | import android.view.Gravity; | 10 | import android.view.Gravity; |
11 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
12 | import android.view.View; | 12 | import android.view.View; |
13 | import android.view.ViewGroup; | 13 | import android.view.ViewGroup; |
14 | import android.widget.AdapterView; | 14 | import android.widget.AdapterView; |
15 | import android.widget.ImageView; | 15 | import android.widget.ImageView; |
16 | import android.widget.ListView; | 16 | import android.widget.ListView; |
17 | 17 | ||
18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
19 | import com.hjx.personalcenter.adapter.VersionAdapter; | 19 | import com.hjx.personalcenter.adapter.VersionAdapter; |
20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.http.HttpCode; | 21 | import com.hjx.personalcenter.http.HttpCode; |
22 | import com.hjx.personalcenter.http.HttpManager; | 22 | import com.hjx.personalcenter.http.HttpManager; |
23 | import com.hjx.personalcenter.interfaces.DialogCallBack; | ||
24 | import com.hjx.personalcenter.model.VersionInfo; | 23 | import com.hjx.personalcenter.model.VersionInfo; |
25 | import com.mylhyl.circledialog.BaseCircleDialog; | 24 | import com.mylhyl.circledialog.BaseCircleDialog; |
26 | import com.mylhyl.circledialog.res.values.CircleDimen; | 25 | import com.mylhyl.circledialog.res.values.CircleDimen; |
27 | 26 | ||
28 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
29 | import java.util.List; | 28 | import java.util.List; |
30 | 29 | ||
31 | /** | 30 | /** |
32 | * 自定义版本信息列表对话框 | 31 | * 自定义版本信息列表对话框 |
33 | * Created by h on 2017/8/10. | 32 | * Created by h on 2017/8/10. |
34 | */ | 33 | */ |
35 | @SuppressLint("ValidFragment") | 34 | @SuppressLint("ValidFragment") |
36 | public class VerSionDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 35 | public class VerSionDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
37 | private VersionAdapter listadapter; | 36 | private VersionAdapter listadapter; |
38 | private ImageView cance; | 37 | private ImageView cance; |
39 | private ListView listView; | 38 | private ListView listView; |
40 | private ArrayList<VersionInfo.DataBean> data = new ArrayList<>(); | 39 | private ArrayList<VersionInfo.DataBean> data = new ArrayList<>(); |
41 | 40 | ||
42 | private DialogCallBack.VersionCallBack mCallBack; | ||
43 | |||
44 | Handler handler = new Handler(){ | 41 | Handler handler = new Handler(){ |
45 | @Override | 42 | @Override |
46 | public void handleMessage(Message msg) { | 43 | public void handleMessage(Message msg) { |
47 | super.handleMessage(msg); | 44 | super.handleMessage(msg); |
48 | switch (msg.what){ | 45 | switch (msg.what){ |
49 | case HttpCode.VERSION_SUCESS: | 46 | case HttpCode.VERSION_SUCESS: |
50 | data.clear(); | 47 | data.clear(); |
51 | data.addAll( (List<VersionInfo.DataBean>)msg.obj); | 48 | data.addAll( (List<VersionInfo.DataBean>)msg.obj); |
52 | listadapter.notifyDataSetChanged(); | 49 | listadapter.notifyDataSetChanged(); |
53 | 50 | ||
54 | break; | 51 | break; |
55 | } | 52 | } |
56 | } | 53 | } |
57 | }; | 54 | }; |
58 | public VerSionDialog(DialogCallBack.VersionCallBack callBack) { | ||
59 | this.mCallBack = callBack; | ||
60 | } | ||
61 | 55 | ||
62 | public static VerSionDialog getInstance(DialogCallBack.VersionCallBack callBack) { | 56 | public static VerSionDialog getInstance() { |
63 | VerSionDialog dialogFragment = new VerSionDialog(callBack); | 57 | VerSionDialog dialogFragment = new VerSionDialog(); |
64 | dialogFragment.setCanceledBack(true); | 58 | dialogFragment.setCanceledBack(true); |
65 | dialogFragment.setCanceledOnTouchOutside(true); | 59 | dialogFragment.setCanceledOnTouchOutside(true); |
66 | dialogFragment.setRadius(CircleDimen.RADIUS); | 60 | dialogFragment.setRadius(CircleDimen.RADIUS); |
67 | dialogFragment.setWidth(0.5f); | 61 | dialogFragment.setWidth(0.5f); |
68 | dialogFragment.setGravity(Gravity.CENTER); | 62 | dialogFragment.setGravity(Gravity.CENTER); |
69 | dialogFragment.setBackgroundColor(Color.WHITE); | 63 | dialogFragment.setBackgroundColor(Color.WHITE); |
70 | return dialogFragment; | 64 | return dialogFragment; |
71 | } | 65 | } |
72 | 66 | ||
73 | @Override | 67 | @Override |
74 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 68 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
75 | return inflater.inflate(R.layout.custom_adilog_publishlist, container, false); | 69 | return inflater.inflate(R.layout.custom_adilog_publishlist, container, false); |
76 | } | 70 | } |
77 | 71 | ||
78 | @Override | 72 | @Override |
79 | public void onActivityCreated(Bundle savedInstanceState) { | 73 | public void onActivityCreated(Bundle savedInstanceState) { |
80 | super.onActivityCreated(savedInstanceState); | 74 | super.onActivityCreated(savedInstanceState); |
81 | listView = (ListView) getView().findViewById(R.id.listadapter); | 75 | listView = (ListView) getView().findViewById(R.id.listadapter); |
82 | cance = (ImageView) getView().findViewById(R.id.cancel); | 76 | cance = (ImageView) getView().findViewById(R.id.cancel); |
83 | listadapter = new VersionAdapter(data,getActivity()); | 77 | listadapter = new VersionAdapter(data,getActivity()); |
84 | listView.setAdapter(listadapter); | 78 | listView.setAdapter(listadapter); |
85 | listView.setOnItemClickListener(this); | 79 | listView.setOnItemClickListener(this); |
86 | cance.setOnClickListener(new View.OnClickListener() { | 80 | cance.setOnClickListener(new View.OnClickListener() { |
87 | @Override | 81 | @Override |
88 | public void onClick(View v) { | 82 | public void onClick(View v) { |
89 | dismiss(); | 83 | dismiss(); |
90 | } | 84 | } |
91 | }); | 85 | }); |
92 | String subjectName = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.VERSION); | 86 | String subjectName = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.SUBJECT); |
93 | Log.e("test","选择的科目"+subjectName); | 87 | Log.e("test","选择的科目"+subjectName); |
94 | HttpManager.getInstance().versioninfo(getActivity(),subjectName,handler); | 88 | HttpManager.getInstance().versioninfo(getActivity(),subjectName,handler); |
95 | 89 | ||
96 | } | 90 | } |
97 | 91 | ||
98 | @Override | 92 | @Override |
99 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 93 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
100 | mCallBack.versionOnItemClick(data,position,1100); | 94 | String imageurl = data.get(position).getPressCover(); |
95 | String publish = data.get(position).getPressName(); | ||
96 | Log.e("test","拿到的数据为"+imageurl+publish); | ||
97 | |||
98 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.IMGURL,imageurl); | ||
99 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,publish); |
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 | public static String CHILDSID = "childID";//子账号id | |
17 | public static String CHILDSGRADENS = "childs";//子账号年级id | ||
17 | public static String GRADENS = "gradens";//年级id | 18 | public static String GRADENS = "gradens";//年级id |
18 | public static String SCHOOOlID = "schoolid";//年级id | 19 | public static String SCHOOOlID = "schoolid";//学校id |
19 | //个人信息 | 20 | //个人信息 |
20 | public static String USERNAME = "usernames";//昵称 | 21 | public static String USERNAME = "usernames";//昵称 |
21 | public static String ADRESS = "adress";//地址 | 22 | public static String ADRESS = "adress";//地址 |
22 | public static String GRADES = "gadens";//年级 | 23 | public static String GRADES = "gadens";//年级 |
23 | public static String SCHOOL = "school";//学校 | 24 | public static String SCHOOL = "school";//学校 |
24 | public static String CONSTELLATION = "constellations";//星座 | 25 | public static String CONSTELLATION = "constellations";//星座 |
25 | public static String HEADURL = "headurl";//星座 | 26 | public static String HEADURL = "headurl";//星座 |
26 | 27 | ||
27 | //电子保卡信息 | 28 | //电子保卡信息 |
28 | public static String CARDPHONE = "cardphone";//保卡手机号 | 29 | public static String CARDPHONE = "cardphone";//保卡手机号 |
29 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 | 30 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 |
30 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 | 31 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 |
31 | public static String SHOPTIME = "shoptime";//购买时间 | 32 | public static String SHOPTIME = "shoptime";//购买时间 |
32 | public static String SHOPADRESS = "shopadress";//购买地址 | 33 | public static String SHOPADRESS = "shopadress";//购买地址 |
33 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 | 34 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 |
34 | 35 | ||
35 | //省市区参数、 | 36 | //省市区参数、 |
36 | public static String PROVINCES = "provinces";//省 | 37 | public static String PROVINCES = "provinces";//省 |
37 | public static String CITYS = "citys";//市 | 38 | public static String CITYS = "citys";//市 |
38 | public static String COUNTRY = "country";//区 | 39 | public static String COUNTRY = "country";//区 |
39 | 40 | ||
40 | //账户管理 | 41 | //账户管理 |
41 | public static String ACCOUNT = "account";//账户类型 | 42 | public static String ACCOUNT = "account";//账户类型 |
42 | //版本信息 | 43 | //科目信息 |
44 | public static String SUBJECT = "subject"; | ||
45 | //图片URL | ||
46 | public static String IMGURL = "imgurl"; | ||
47 | //版本名称 | ||
43 | public static String VERSION = "version"; | 48 | public static String VERSION = "version"; |
44 | 49 | ||
45 | 50 | ||
46 | public void saveLoginParam(Context context,String spname, String spstr) { | 51 | public void saveLoginParam(Context context,String spname, String spstr) { |
47 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 52 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
48 | Activity.MODE_PRIVATE); | 53 | Activity.MODE_PRIVATE); |
49 | 54 | ||
50 | sp.edit().putString(spname, spstr).commit(); | 55 | sp.edit().putString(spname, spstr).commit(); |
51 | } | 56 | } |
52 | 57 | ||
53 | 58 | ||
54 | public String getLoginParam(Context context,String spname) { | 59 | public String getLoginParam(Context context,String spname) { |
55 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 60 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
56 | Activity.MODE_PRIVATE); | 61 | Activity.MODE_PRIVATE); |
57 | String param = sp.getString(spname, null); | 62 | String param = sp.getString(spname, null); |
58 | return param; | 63 | return param; |
59 | } | 64 | } |
60 | public void clearData(Context context) { | 65 | public void clearData(Context context) { |
61 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 66 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
62 | Activity.MODE_PRIVATE); | 67 | Activity.MODE_PRIVATE); |
63 | sp.edit().clear().commit(); | 68 | sp.edit().clear().commit(); |
64 | } | 69 | } |
65 | 70 | ||
66 | public void saveCustomizeParam(Context context,String spname, String spstr) { | 71 | public void saveCustomizeParam(Context context,String spname, String spstr) { |
67 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 72 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
68 | Activity.MODE_PRIVATE); | 73 | Activity.MODE_PRIVATE); |
69 | 74 | ||
70 | sp.edit().putString(spname, spstr).commit(); | 75 | sp.edit().putString(spname, spstr).commit(); |
71 | 76 | ||
72 | } | 77 | } |
73 | 78 | ||
74 | public String getCustomizeParam(Context context,String spname) { | 79 | public String getCustomizeParam(Context context,String spname) { |
75 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 80 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
76 | Activity.MODE_PRIVATE); | 81 | Activity.MODE_PRIVATE); |
77 | String param = sp.getString(spname, null); | 82 | String param = sp.getString(spname, null); |
78 | return param; | 83 | return param; |
79 | } | 84 | } |
80 | 85 | ||
81 | public void clearCustomizeParam(Context context ){ | 86 | public void clearCustomizeParam(Context context ){ |
82 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 87 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
83 | Activity.MODE_PRIVATE); | 88 | Activity.MODE_PRIVATE); |
84 | sp.edit().clear().commit(); | 89 | sp.edit().clear().commit(); |
85 | } | 90 | } |
86 | } | 91 | } |
87 | 92 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/LoginFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
8 | import android.support.v4.app.Fragment; | 8 | import android.support.v4.app.Fragment; |
9 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
13 | import android.widget.Button; | 13 | import android.widget.Button; |
14 | import android.widget.EditText; | 14 | import android.widget.EditText; |
15 | import android.widget.TextView; | 15 | import android.widget.TextView; |
16 | import android.widget.Toast; | 16 | import android.widget.Toast; |
17 | 17 | ||
18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; | 19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; |
20 | import com.hjx.personalcenter.activity.MainActivity; | 20 | import com.hjx.personalcenter.activity.MainActivity; |
21 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | 21 | import com.hjx.personalcenter.activity.RegisterInfoActivity; |
22 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 22 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
23 | import com.hjx.personalcenter.db.Content; | ||
23 | import com.hjx.personalcenter.db.SaveParam; | 24 | import com.hjx.personalcenter.db.SaveParam; |
24 | import com.hjx.personalcenter.http.HttpCode; | 25 | import com.hjx.personalcenter.http.HttpCode; |
25 | import com.hjx.personalcenter.http.HttpManager; | 26 | import com.hjx.personalcenter.http.HttpManager; |
26 | import com.hjx.personalcenter.util.AlertUtils; | 27 | import com.hjx.personalcenter.util.AlertUtils; |
27 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 28 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
28 | 29 | ||
29 | import org.json.JSONException; | 30 | import org.json.JSONException; |
30 | import org.json.JSONObject; | 31 | import org.json.JSONObject; |
31 | 32 | ||
32 | /** | 33 | /** |
33 | * 登录 | 34 | * 登录 |
34 | * Created by h on 2017/8/8. | 35 | * Created by h on 2017/8/8. |
35 | */ | 36 | */ |
36 | 37 | ||
37 | public class LoginFragment extends Fragment implements View.OnClickListener { | 38 | public class LoginFragment extends Fragment implements View.OnClickListener { |
38 | private View mView; | 39 | private View mView; |
39 | private int type; | 40 | private int type; |
40 | private TextView tv_forget_pwd; | 41 | private TextView tv_forget_pwd; |
41 | private Button btn_login; | 42 | private Button btn_login; |
42 | private EditText phonenumber,login_pwwd; | 43 | private EditText phonenumber,login_pwwd; |
43 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 44 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
44 | Intent intent = new Intent(); | 45 | Intent intent = new Intent(); |
45 | public static LoginFragment newInstance(int type) { | 46 | public static LoginFragment newInstance(int type) { |
46 | LoginFragment fragment = new LoginFragment(); | 47 | LoginFragment fragment = new LoginFragment(); |
47 | Bundle bundle = new Bundle(); | 48 | Bundle bundle = new Bundle(); |
48 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 49 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
49 | fragment.setArguments(bundle); | 50 | fragment.setArguments(bundle); |
50 | return fragment; | 51 | return fragment; |
51 | 52 | ||
52 | } | 53 | } |
53 | Handler handler = new Handler(){ | 54 | Handler handler = new Handler(){ |
54 | @Override | 55 | @Override |
55 | public void handleMessage(Message msg) { | 56 | public void handleMessage(Message msg) { |
56 | super.handleMessage(msg); | 57 | super.handleMessage(msg); |
57 | 58 | ||
58 | switch (msg.what){ | 59 | switch (msg.what){ |
59 | case HttpCode.LOGIN_SUCESS: | 60 | case HttpCode.LOGIN_SUCESS: |
60 | JSONObject jsonObject; | 61 | JSONObject jsonObject; |
61 | String status; | 62 | String status; |
62 | try { | 63 | try { |
63 | jsonObject = new JSONObject((String) msg.obj); | 64 | jsonObject = new JSONObject((String) msg.obj); |
64 | status = jsonObject.getString("status"); | 65 | status = jsonObject.getString("status"); |
65 | if (status.equals("100")) { | 66 | if (status.equals("100")) { |
66 | String access_token = jsonObject.getString("access_token"); | 67 | String access_token = jsonObject.getString("access_token"); |
67 | String userId = jsonObject.getString("userId"); | 68 | String userId = jsonObject.getString("userId"); |
68 | final String name = phonenumber.getText().toString().trim(); | 69 | final String name = phonenumber.getText().toString().trim(); |
69 | final String pwd = login_pwwd.getText().toString().trim(); | 70 | final String pwd = login_pwwd.getText().toString().trim(); |
70 | // | 71 | // |
71 | try { | 72 | try { |
72 | long auserID = Long.parseLong(userId); | 73 | long auserID = Long.parseLong(userId); |
73 | //检测注册信息是否完整 | 74 | //检测注册信息是否完整 |
74 | HttpManager.getInstance().registerinfocheck(getActivity(),auserID,handler); | 75 | HttpManager.getInstance().registerinfocheck(getActivity(),auserID,handler); |
75 | //登录成功,保存登录数据并且获取个人信息 | 76 | //登录成功,保存登录数据并且获取个人信息 |
76 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, userId); | 77 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, userId); |
77 | 78 | ||
78 | 79 | ||
79 | 80 | ||
80 | } catch (NumberFormatException e) { | 81 | } catch (NumberFormatException e) { |
81 | e.printStackTrace(); | 82 | e.printStackTrace(); |
82 | } | 83 | } |
83 | 84 | ||
84 | 85 | ||
85 | } else if (status.equals("200")) { | 86 | } else if (status.equals("200")) { |
86 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); | 87 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); |
87 | return; | 88 | return; |
88 | } else if (status.equals("204")) { | 89 | } else if (status.equals("204")) { |
89 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); | 90 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); |
90 | } else { | 91 | } else { |
91 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); | 92 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); |
92 | 93 | ||
93 | 94 | ||
94 | } | 95 | } |
95 | } catch (JSONException e) { | 96 | } catch (JSONException e) { |
96 | e.printStackTrace(); | 97 | e.printStackTrace(); |
97 | } | 98 | } |
98 | break; | 99 | break; |
99 | case HttpCode.REGISTER_SUCESS: | 100 | case HttpCode.REGISTER_SUCESS: |
100 | try { | 101 | try { |
101 | jsonObject = new JSONObject( (String) msg.obj); | 102 | jsonObject = new JSONObject( (String) msg.obj); |
102 | status = jsonObject.optString("status"); | 103 | status = jsonObject.optString("status"); |
103 | JSONObject isregisterinfo = (JSONObject) jsonObject.opt("data"); | 104 | JSONObject isregisterinfo = (JSONObject) jsonObject.opt("data"); |
104 | boolean isRegisterInfoComplete =isregisterinfo.optBoolean("isRegisterInfoComplete"); | 105 | boolean isRegisterInfoComplete =isregisterinfo.optBoolean("isRegisterInfoComplete"); |
105 | if (status.equals("1")){ | 106 | if (status.equals("1")){ |
106 | if (!isRegisterInfoComplete){ | 107 | if (!isRegisterInfoComplete){ |
108 | Content.accountflag = 1; | ||
107 | Intent intent = new Intent(); | 109 | Intent intent = new Intent(); |
108 | intent.setClass(getActivity(), RegisterInfoActivity.class); | 110 | intent.setClass(getActivity(), RegisterInfoActivity.class); |
109 | getActivity().startActivity(intent); | 111 | getActivity().startActivity(intent); |
110 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 112 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
111 | }else { | 113 | }else { |
112 | String userID = SaveParam.getInstance().getLoginParam(getActivity(),"userId"); | 114 | String userID = SaveParam.getInstance().getLoginParam(getActivity(),"userId"); |
113 | try { | 115 | try { |
114 | long auserID = Long.parseLong(userID); | 116 | long auserID = Long.parseLong(userID); |
115 | //是否填写保卡 | 117 | //是否填写保卡 |
116 | HttpManager.getInstance().cardinfocheck(getActivity(),auserID,handler); | 118 | HttpManager.getInstance().cardinfocheck(getActivity(),auserID,handler); |
117 | } catch (NumberFormatException e) { | 119 | } catch (NumberFormatException e) { |
118 | e.printStackTrace(); | 120 | e.printStackTrace(); |
119 | } | 121 | } |
120 | 122 | ||
121 | 123 | ||
122 | } | 124 | } |
123 | 125 | ||
124 | }else{ | 126 | }else{ |
125 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | 127 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); |
126 | } | 128 | } |
127 | 129 | ||
128 | } catch (JSONException e) { | 130 | } catch (JSONException e) { |
129 | e.printStackTrace(); | 131 | e.printStackTrace(); |
130 | } | 132 | } |
131 | 133 | ||
132 | break; | 134 | break; |
133 | case HttpCode.CHECKCARD: | 135 | case HttpCode.CHECKCARD: |
134 | try { | 136 | try { |
135 | jsonObject = new JSONObject( (String) msg.obj); | 137 | jsonObject = new JSONObject( (String) msg.obj); |
136 | status = jsonObject.optString("status"); | 138 | status = jsonObject.optString("status"); |
137 | if (status.equals("1")){ | 139 | if (status.equals("1")){ |
138 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); | 140 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); |
139 | Intent intent = new Intent(); | 141 | Intent intent = new Intent(); |
140 | intent.setClass(getActivity(), MainActivity.class); | 142 | intent.setClass(getActivity(), MainActivity.class); |
141 | getActivity().startActivity(intent); | 143 | getActivity().startActivity(intent); |
142 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 144 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
143 | 145 | ||
144 | }else if(status.equals("2001")){ | 146 | }else if(status.equals("2001")){ |
145 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); | 147 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); |
146 | }else{ | 148 | }else{ |
147 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | 149 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); |
148 | } | 150 | } |
149 | 151 | ||
150 | } catch (JSONException e) { | 152 | } catch (JSONException e) { |
151 | e.printStackTrace(); | 153 | e.printStackTrace(); |
152 | } | 154 | } |
153 | 155 | ||
154 | break; | 156 | break; |
155 | } | 157 | } |
156 | } | 158 | } |
157 | }; | 159 | }; |
158 | 160 | ||
159 | @Override | 161 | @Override |
160 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 162 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
161 | if (mView == null) { | 163 | if (mView == null) { |
162 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); | 164 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); |
163 | initView(mView); | 165 | initView(mView); |
164 | initData(); | 166 | initData(); |
165 | setLister(); | 167 | setLister(); |
166 | 168 | ||
167 | 169 | ||
168 | } | 170 | } |
169 | return mView; | 171 | return mView; |
170 | } | 172 | } |
171 | //初始化 | 173 | //初始化 |
172 | private void initView(View mView) { | 174 | private void initView(View mView) { |
173 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); | 175 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); |
174 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); | 176 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); |
175 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); | 177 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); |
176 | btn_login = (Button) mView.findViewById(R.id.btn_login); | 178 | btn_login = (Button) mView.findViewById(R.id.btn_login); |
177 | 179 | ||
178 | } | 180 | } |
179 | private void initData() { | 181 | private void initData() { |
180 | } | 182 | } |
181 | private void setLister() { | 183 | private void setLister() { |
182 | tv_forget_pwd.setOnClickListener(this); | 184 | tv_forget_pwd.setOnClickListener(this); |
183 | btn_login.setOnClickListener(this); | 185 | btn_login.setOnClickListener(this); |
184 | } | 186 | } |
185 | 187 | ||
186 | 188 | ||
187 | @Override | 189 | @Override |
188 | public void onClick(View v) { | 190 | public void onClick(View v) { |
189 | switch (v.getId()){ | 191 | switch (v.getId()){ |
190 | case R.id.tv_forget_pwd: | 192 | case R.id.tv_forget_pwd: |
191 | intent.setClass(getActivity(),ForgotPasswordActivity.class); | 193 | intent.setClass(getActivity(),ForgotPasswordActivity.class); |
192 | startActivity(intent); | 194 | startActivity(intent); |
193 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 195 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
194 | break; | 196 | break; |
195 | case R.id.btn_login: | 197 | case R.id.btn_login: |
196 | login(); | 198 | login(); |
197 | break; | 199 | break; |
198 | } | 200 | } |
199 | 201 | ||
200 | } | 202 | } |
201 | 203 | ||
202 | private void login() { | 204 | private void login() { |
203 | final String name = phonenumber.getText().toString().trim(); | 205 | final String name = phonenumber.getText().toString().trim(); |
204 | final String pwd = login_pwwd.getText().toString().trim(); | 206 | final String pwd = login_pwwd.getText().toString().trim(); |
205 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { | 207 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { |
206 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); | 208 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); |
207 | return; | 209 | return; |
208 | }else if (!PhoneNumCheckUtils.isPhone(name)){ | 210 | }else if (!PhoneNumCheckUtils.isPhone(name)){ |
209 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); | 211 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); |
210 | }else { | 212 | }else { |
211 | //登录接口 | 213 | //登录接口 |
212 | HttpManager.getInstance().login(name,pwd, getActivity(),handler); | 214 | HttpManager.getInstance().login(name,pwd, getActivity(),handler); |
213 | } | 215 | } |
214 | 216 | ||
215 | 217 | ||
216 | } | 218 | } |
217 | } | 219 | } |
218 | 220 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.graphics.Color; | 4 | import android.graphics.Color; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
8 | import android.util.Log; | ||
8 | import android.view.Gravity; | 9 | import android.view.Gravity; |
9 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
10 | import android.view.View; | 11 | import android.view.View; |
11 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
12 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
13 | import android.widget.EditText; | 14 | import android.widget.EditText; |
15 | import android.widget.ImageView; | ||
14 | import android.widget.TextView; | 16 | import android.widget.TextView; |
15 | 17 | ||
16 | import com.bigkoo.pickerview.TimePickerView; | 18 | import com.bigkoo.pickerview.TimePickerView; |
17 | import com.hjx.personalcenter.R; | 19 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 20 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
19 | import com.hjx.personalcenter.customdialog.CountryDialog; | 21 | import com.hjx.personalcenter.customdialog.CountryDialog; |
20 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 22 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
21 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 23 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
22 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 24 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
25 | import com.hjx.personalcenter.db.Content; | ||
23 | import com.hjx.personalcenter.db.SaveParam; | 26 | import com.hjx.personalcenter.db.SaveParam; |
24 | import com.hjx.personalcenter.http.HttpManager; | 27 | import com.hjx.personalcenter.http.HttpManager; |
25 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 28 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
26 | import com.hjx.personalcenter.model.CityInfo; | 29 | import com.hjx.personalcenter.model.CityInfo; |
27 | import com.hjx.personalcenter.model.CountyInfo; | 30 | import com.hjx.personalcenter.model.CountyInfo; |
28 | import com.hjx.personalcenter.model.GradeInfo; | 31 | import com.hjx.personalcenter.model.GradeInfo; |
29 | import com.hjx.personalcenter.model.ProvinceInfo; | 32 | import com.hjx.personalcenter.model.ProvinceInfo; |
30 | import com.hjx.personalcenter.model.SchoolInfo; | 33 | import com.hjx.personalcenter.model.SchoolInfo; |
31 | import com.hjx.personalcenter.util.AlertUtils; | 34 | import com.hjx.personalcenter.util.AlertUtils; |
32 | import com.hjx.personalcenter.util.BrithdayStar; | 35 | import com.hjx.personalcenter.util.BrithdayStar; |
33 | import com.hjx.personalcenter.util.GetDevicesUtil; | 36 | import com.hjx.personalcenter.util.GetDevicesUtil; |
34 | import com.mylhyl.circledialog.CircleDialog; | 37 | import com.mylhyl.circledialog.CircleDialog; |
35 | import com.mylhyl.circledialog.callback.ConfigDialog; | 38 | import com.mylhyl.circledialog.callback.ConfigDialog; |
36 | import com.mylhyl.circledialog.params.DialogParams; | 39 | import com.mylhyl.circledialog.params.DialogParams; |
37 | 40 | ||
38 | import org.apache.http.util.TextUtils; | 41 | import org.apache.http.util.TextUtils; |
39 | 42 | ||
40 | import java.text.SimpleDateFormat; | 43 | import java.text.SimpleDateFormat; |
41 | import java.util.ArrayList; | 44 | import java.util.ArrayList; |
42 | import java.util.Date; | 45 | import java.util.Date; |
43 | 46 | ||
44 | /** | 47 | /** |
45 | * Created by h on 2017/8/12. | 48 | * Created by h on 2017/8/12. |
46 | */ | 49 | */ |
47 | 50 | ||
48 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 51 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
49 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 52 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
50 | private View mView; | 53 | private View mView; |
51 | private int type; | 54 | private int type; |
52 | private TimePickerView pvTime; | 55 | private TimePickerView pvTime; |
53 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; | 56 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
54 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; | 57 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; |
55 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 58 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; |
59 | private ImageView my_adress,my_sex,my_bthday,my_grade,my_school; | ||
56 | 60 | ||
57 | public static PresonInfoFragment newInstance(int type) { | 61 | public static PresonInfoFragment newInstance(int type) { |
58 | PresonInfoFragment fragment = new PresonInfoFragment(); | 62 | PresonInfoFragment fragment = new PresonInfoFragment(); |
59 | Bundle bundle = new Bundle(); | 63 | Bundle bundle = new Bundle(); |
60 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 64 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
61 | fragment.setArguments(bundle); | 65 | fragment.setArguments(bundle); |
62 | return fragment; | 66 | return fragment; |
63 | 67 | ||
64 | } | 68 | } |
65 | 69 | ||
66 | @Override | 70 | @Override |
67 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 71 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
68 | if (mView == null) { | 72 | if (mView == null) { |
69 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 73 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
70 | initView(mView); | 74 | initView(mView); |
71 | initData(); | 75 | initData(); |
72 | setLister(); | 76 | setLister(); |
73 | initTimePicker(); | 77 | initTimePicker(); |
74 | 78 | ||
75 | 79 | ||
76 | } | 80 | } |
77 | return mView; | 81 | return mView; |
78 | } | 82 | } |
79 | 83 | ||
80 | //初始化 | 84 | //初始化 |
81 | private void initView(View mView) { | 85 | private void initView(View mView) { |
82 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 86 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
83 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 87 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
84 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 88 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
85 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 89 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
86 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 90 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
87 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 91 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
88 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 92 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
89 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 93 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
94 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); | ||
95 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); | ||
96 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); | ||
97 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); | ||
98 | my_school = (ImageView) mView.findViewById(R.id.my_school); | ||
90 | 99 | ||
91 | 100 | ||
92 | } | 101 | } |
93 | 102 | ||
94 | private void initData() { | 103 | private void initData() { |
95 | } | 104 | } |
96 | 105 | ||
97 | private void setLister() { | 106 | private void setLister() { |
98 | tv_sex.setOnClickListener(this); | 107 | tv_sex.setOnClickListener(this); |
99 | tv_useinfo_adress.setOnClickListener(this); | 108 | tv_useinfo_adress.setOnClickListener(this); |
100 | tv_useinfo_birthday.setOnClickListener(this); | 109 | tv_useinfo_birthday.setOnClickListener(this); |
101 | tv_useinfo_school.setOnClickListener(this); | 110 | tv_useinfo_school.setOnClickListener(this); |
102 | tv_useinfo_gender.setOnClickListener(this); | 111 | tv_useinfo_gender.setOnClickListener(this); |
112 | my_adress.setOnClickListener(this); | ||
113 | my_sex.setOnClickListener(this); | ||
114 | my_bthday.setOnClickListener(this); | ||
115 | my_grade.setOnClickListener(this); | ||
116 | my_school.setOnClickListener(this); | ||
103 | } | 117 | } |
104 | 118 | ||
105 | @Override | 119 | @Override |
106 | public void onClick(View v) { | 120 | public void onClick(View v) { |
107 | String presonal1 = tv_username1.getText().toString().trim(); | 121 | String presonal1 = tv_username1.getText().toString().trim(); |
108 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | 122 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); |
109 | String presonal3 = tv_sex.getText().toString().trim(); | 123 | String presonal3 = tv_sex.getText().toString().trim(); |
110 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | 124 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); |
111 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | 125 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); |
112 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | 126 | String presonal6 = tv_useinfo_school.getText().toString().trim(); |
113 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | 127 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); |
114 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | 128 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); |
115 | switch (v.getId()) { | 129 | switch (v.getId()) { |
116 | case R.id.tv_sex: | 130 | case R.id.tv_sex: |
131 | case R.id.my_sex: | ||
117 | final String[] items = {"男", "女"}; | 132 | final String[] items = {"男", "女"}; |
118 | new CircleDialog.Builder(getActivity()) | 133 | new CircleDialog.Builder(getActivity()) |
119 | .configDialog(new ConfigDialog() { | 134 | .configDialog(new ConfigDialog() { |
120 | @Override | 135 | @Override |
121 | public void onConfig(DialogParams params) { | 136 | public void onConfig(DialogParams params) { |
122 | //增加弹出动画 | 137 | //增加弹出动画 |
123 | params.gravity = Gravity.CENTER; | 138 | params.gravity = Gravity.CENTER; |
124 | } | 139 | } |
125 | }) | 140 | }) |
126 | .setTitle("请选择性别") | 141 | .setTitle("请选择性别") |
127 | .setWidth(0.5f) | 142 | .setWidth(0.5f) |
128 | .setItems(items, new AdapterView.OnItemClickListener() { | 143 | .setItems(items, new AdapterView.OnItemClickListener() { |
129 | @Override | 144 | @Override |
130 | public void onItemClick(AdapterView<?> parent, View view, int | 145 | public void onItemClick(AdapterView<?> parent, View view, int |
131 | position, long id) { | 146 | position, long id) { |
132 | switch (position) { | 147 | switch (position) { |
133 | case 0: | 148 | case 0: |
134 | tv_sex.setText("男"); | 149 | tv_sex.setText("男"); |
135 | break; | 150 | break; |
136 | case 1: | 151 | case 1: |
137 | tv_sex.setText("女"); | 152 | tv_sex.setText("女"); |
138 | break; | 153 | break; |
139 | } | 154 | } |
140 | 155 | ||
141 | } | 156 | } |
142 | }) | 157 | }) |
143 | .show(); | 158 | .show(); |
144 | break; | 159 | break; |
145 | case R.id.tv_useinfo_adress: | 160 | case R.id.tv_useinfo_adress: |
161 | case R.id.my_adress: | ||
146 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); | 162 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
147 | break; | 163 | break; |
148 | case R.id.tv_useinfo_birthday: | 164 | case R.id.tv_useinfo_birthday: |
165 | case R.id.my_bthday: | ||
149 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 166 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
150 | break; | 167 | break; |
151 | case R.id.tv_useinfo_school: | 168 | case R.id.tv_useinfo_school: |
169 | case R.id.my_school: | ||
152 | if (TextUtils.isEmpty(presonal4) || | 170 | if (TextUtils.isEmpty(presonal4) || |
153 | TextUtils.isEmpty(presonal7)) { | 171 | TextUtils.isEmpty(presonal7)) { |
154 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | 172 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); |
155 | return; | 173 | return; |
156 | } else { | 174 | } else { |
157 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | 175 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); |
158 | } | 176 | } |
159 | 177 | ||
160 | 178 | ||
161 | break; | 179 | break; |
162 | case R.id.tv_useinfo_gender: | 180 | case R.id.tv_useinfo_gender: |
181 | case R.id.my_grade: | ||
163 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); | 182 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
164 | break; | 183 | break; |
165 | case R.id.presonal_sub: | 184 | case R.id.presonal_sub: |
166 | if (TextUtils.isEmpty(presonal1) || | 185 | if (Content.changeinfoflag == 1) { |
167 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || | 186 | Log.e("test","你提交个人信息"); |
168 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || | 187 | if (TextUtils.isEmpty(presonal1) || |
169 | TextUtils.isEmpty(presonal8)) { | 188 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || |
170 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); | 189 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || |
171 | return; | 190 | TextUtils.isEmpty(presonal8)) { |
172 | } else { | 191 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
173 | 192 | return; | |
174 | int a = 0, b = 0; | ||
175 | int d = 1; | ||
176 | Object schoolids; | ||
177 | Long f = null; | ||
178 | //保存星座 | ||
179 | BrithdayStar brithdayStar = new BrithdayStar(); | ||
180 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | ||
181 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); | ||
182 | |||
183 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); | ||
184 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | ||
185 | if (regionId == null) { | ||
186 | regionId = regionId1; | ||
187 | } | ||
188 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | ||
189 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | ||
190 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | ||
191 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | ||
192 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | ||
193 | String changeinfo = null; | ||
194 | if ("男".equals(presonal3)) { | ||
195 | changeinfo = "male"; | ||
196 | } else { | 193 | } else { |
197 | changeinfo = "female"; | 194 | |
198 | } | 195 | int a = 0, b = 0; |
199 | try { | 196 | int d = 1; |
200 | a = Integer.parseInt(regionId); | 197 | Object schoolids; |
201 | b = Integer.parseInt(grade); | 198 | Long f = null; |
202 | if (TextUtils.isEmpty(presonal6)) { | 199 | //保存星座 |
203 | schoolids = null; | 200 | BrithdayStar brithdayStar = new BrithdayStar(); |
201 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | ||
202 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); | ||
203 | |||
204 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); | ||
205 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | ||
206 | if (regionId == null) { | ||
207 | regionId = regionId1; | ||
208 | } | ||
209 | String grade = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); | ||
210 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | ||
211 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | ||
212 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | ||
213 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | ||
214 | String changeinfo = null; | ||
215 | if ("男".equals(presonal3)) { | ||
216 | changeinfo = "male"; | ||
204 | } else { | 217 | } else { |
205 | schoolids = Long.parseLong(schoolid); | 218 | changeinfo = "female"; |
219 | } | ||
220 | try { | ||
221 | a = Integer.parseInt(regionId); | ||
222 | b = Integer.parseInt(grade); | ||
223 | if (TextUtils.isEmpty(presonal6)) { | ||
224 | schoolids = null; | ||
225 | } else { | ||
226 | schoolids = Long.parseLong(schoolid); | ||
227 | } | ||
228 | d = Integer.parseInt(type); | ||
229 | f = Long.parseLong(userID); | ||
230 | //提交个人信息 | ||
231 | HttpManager.getInstance().changepresonalinfo(getActivity(), | ||
232 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 + presonal2, devicenumber); | ||
233 | |||
234 | } catch (Exception e) { | ||
235 | e.printStackTrace(); | ||
206 | } | 236 | } |
207 | d = Integer.parseInt(type); | ||
208 | f = Long.parseLong(userID); | ||
209 | //提交个人信息 | ||
210 | HttpManager.getInstance().changepresonalinfo(getActivity(), | ||
211 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 + presonal2, devicenumber); | ||
212 | |||
213 | } catch (Exception e) { | ||
214 | e.printStackTrace(); | ||
215 | } | 237 | } |
216 | 238 | ||
217 | break; | 239 | break; |
218 | } | 240 | } |
219 | } | 241 | } |
220 | } | 242 | } |
221 | 243 | ||
222 | //自定义时间选择器 | 244 | //自定义时间选择器 |
223 | private void initTimePicker() { | 245 | private void initTimePicker() { |
224 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 246 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
225 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 247 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
226 | // Calendar selectedDate = Calendar.getInstance(); | 248 | // Calendar selectedDate = Calendar.getInstance(); |
227 | // Calendar startDate = Calendar.getInstance(); | 249 | // Calendar startDate = Calendar.getInstance(); |
228 | // startDate.set(1900, 1, 1); | 250 | // startDate.set(1900, 1, 1); |
229 | // Calendar endDate = Calendar.getInstance(); | 251 | // Calendar endDate = Calendar.getInstance(); |
230 | // endDate.set(2100, 1, 1); | 252 | // endDate.set(2100, 1, 1); |
231 | //时间选择器 | 253 | //时间选择器 |
232 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 254 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
233 | @Override | 255 | @Override |
234 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 256 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
235 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 257 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
236 | /*btn_Time.setText(getTime(date));*/ | 258 | /*btn_Time.setText(getTime(date));*/ |
237 | TextView btn = (TextView) v; | 259 | TextView btn = (TextView) v; |
238 | btn.setText(getTime(date)); | 260 | btn.setText(getTime(date)); |
239 | } | 261 | } |
240 | }) | 262 | }) |
241 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 263 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
242 | .setType(new boolean[]{true, true, true, false, false, false}) | 264 | .setType(new boolean[]{true, true, true, false, false, false}) |
243 | .setLabel("", "", "", "", "", "") | 265 | .setLabel("", "", "", "", "", "") |
244 | .isCenterLabel(false) | 266 | .isCenterLabel(false) |
245 | .setDividerColor(Color.DKGRAY) | 267 | .setDividerColor(Color.DKGRAY) |
246 | .setContentSize(21) | 268 | .setContentSize(21) |
247 | // .setDate(selectedDate) | 269 | // .setDate(selectedDate) |
248 | // .setRangDate(startDate, endDate) | 270 | // .setRangDate(startDate, endDate) |
249 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 271 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
250 | .setDecorView(null) | 272 | .setDecorView(null) |
251 | .setTitleText("出生日期") | 273 | .setTitleText("出生日期") |
252 | .setTitleSize(22) | 274 | .setTitleSize(22) |
253 | .setCancelColor(Color.GRAY) | 275 | .setCancelColor(Color.GRAY) |
254 | .setSubCalSize(22) | 276 | .setSubCalSize(22) |
255 | .setDividerColor(Color.GRAY) | 277 | .setDividerColor(Color.GRAY) |
256 | .setSubmitColor(Color.GRAY) | 278 | .setSubmitColor(Color.GRAY) |
257 | .build(); | 279 | .build(); |
258 | } | 280 | } |
259 | 281 | ||
260 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 282 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
261 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 283 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
262 | return format.format(date); | 284 | return format.format(date); |
263 | } | 285 | } |
264 | 286 | ||
265 | @Override | 287 | @Override |
266 | public void onAttach(Activity activity) { | 288 | public void onAttach(Activity activity) { |
267 | super.onAttach(activity); | 289 | super.onAttach(activity); |
268 | View rootView = activity.getWindow().getDecorView(); | 290 | View rootView = activity.getWindow().getDecorView(); |
269 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | 291 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); |
270 | sub.setOnClickListener(this); | 292 | sub.setOnClickListener(this); |
271 | } | 293 | } |
272 | 294 | ||
273 | @Override | 295 | @Override |
274 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 296 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
275 | String regionName = data.get(position).getRegionName(); | 297 | String regionName = data.get(position).getRegionName(); |
276 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 298 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
277 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | 299 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); |
278 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | 300 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); |
279 | tv_useinfo_adress.setText(""); | 301 | tv_useinfo_adress.setText(""); |
280 | tv_useinfo_adress.setText(provice + regionName); | 302 | tv_useinfo_adress.setText(provice + regionName); |
281 | 303 | ||
282 | 304 | ||
283 | } | 305 | } |
284 | 306 | ||
285 | @Override | 307 | @Override |
286 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 308 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
287 | String regionName = data.get(position).getRegionName(); | 309 | String regionName = data.get(position).getRegionName(); |
288 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 310 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/RegisterFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
8 | import android.support.v4.app.Fragment; | 8 | import android.support.v4.app.Fragment; |
9 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
10 | import android.text.method.HideReturnsTransformationMethod; | 10 | import android.text.method.HideReturnsTransformationMethod; |
11 | import android.text.method.PasswordTransformationMethod; | 11 | import android.text.method.PasswordTransformationMethod; |
12 | import android.view.LayoutInflater; | 12 | import android.view.LayoutInflater; |
13 | import android.view.View; | 13 | import android.view.View; |
14 | import android.view.ViewGroup; | 14 | import android.view.ViewGroup; |
15 | import android.widget.Button; | 15 | import android.widget.Button; |
16 | import android.widget.EditText; | 16 | import android.widget.EditText; |
17 | import android.widget.ImageView; | 17 | import android.widget.ImageView; |
18 | 18 | ||
19 | import com.hjx.personalcenter.R; | 19 | import com.hjx.personalcenter.R; |
20 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | 20 | import com.hjx.personalcenter.activity.RegisterInfoActivity; |
21 | import com.hjx.personalcenter.db.Content; | 21 | import com.hjx.personalcenter.db.Content; |
22 | import com.hjx.personalcenter.db.SaveParam; | ||
22 | import com.hjx.personalcenter.http.HttpCode; | 23 | import com.hjx.personalcenter.http.HttpCode; |
23 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
24 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
25 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 26 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
26 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 27 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
27 | 28 | ||
28 | import org.json.JSONException; | 29 | import org.json.JSONException; |
29 | import org.json.JSONObject; | 30 | import org.json.JSONObject; |
30 | 31 | ||
31 | import java.util.TimerTask; | 32 | import java.util.TimerTask; |
32 | 33 | ||
33 | /** | 34 | /** |
34 | * 注册 | 35 | * 注册 |
35 | * Created by Administrator on 2016/11/7. | 36 | * Created by Administrator on 2016/11/7. |
36 | */ | 37 | */ |
37 | 38 | ||
38 | public class RegisterFragment extends Fragment implements View.OnClickListener { | 39 | public class RegisterFragment extends Fragment implements View.OnClickListener { |
39 | private View mView; | 40 | private View mView; |
40 | 41 | ||
41 | private Button btn_register,get_authcode; | 42 | private Button btn_register,get_authcode; |
42 | private EditText phonenumber,password,anth_6num;//;//密码 | 43 | private EditText phonenumber,password,anth_6num;//;//密码 |
43 | private ImageView openeyes; | 44 | private ImageView openeyes; |
44 | private String sourceStr ="android"; | 45 | private String sourceStr ="android"; |
45 | private String typeStr = "register"; | 46 | private String typeStr = "register"; |
46 | private int delayTime=60; | 47 | private int delayTime=60; |
47 | private java.util.Timer Delaytimer; | 48 | private java.util.Timer Delaytimer; |
48 | private int type; | 49 | private int type; |
49 | public static Boolean showPassword = false; | 50 | public static Boolean showPassword = false; |
50 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 51 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
51 | 52 | ||
52 | public static RegisterFragment newInstance(int type) { | 53 | public static RegisterFragment newInstance(int type) { |
53 | RegisterFragment fragment = new RegisterFragment(); | 54 | RegisterFragment fragment = new RegisterFragment(); |
54 | Bundle bundle = new Bundle(); | 55 | Bundle bundle = new Bundle(); |
55 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 56 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
56 | fragment.setArguments(bundle); | 57 | fragment.setArguments(bundle); |
57 | return fragment; | 58 | return fragment; |
58 | 59 | ||
59 | } | 60 | } |
60 | Handler handler = new Handler() { | 61 | Handler handler = new Handler() { |
61 | @Override | 62 | @Override |
62 | public void handleMessage(Message msg) { | 63 | public void handleMessage(Message msg) { |
63 | super.handleMessage(msg); | 64 | super.handleMessage(msg); |
64 | try { | 65 | try { |
65 | JSONObject jsonObject; | 66 | JSONObject jsonObject; |
66 | String status; | 67 | String status; |
67 | switch (msg.what) { | 68 | switch (msg.what) { |
68 | case HttpCode.REGISTERED_SUCESS: | 69 | case HttpCode.REGISTERED_SUCESS: |
69 | jsonObject = (JSONObject) msg.obj; | 70 | jsonObject = (JSONObject) msg.obj; |
70 | status = jsonObject.getString("status"); | 71 | status = jsonObject.getString("status"); |
71 | //AlertUtils.showToast(RegisterActivity.this, jsonObject.optString("message")); | 72 | //AlertUtils.showToast(RegisterActivity.this, jsonObject.optString("message")); |
72 | String access_token = jsonObject.getString("access_token"); | 73 | String access_token = jsonObject.getString("access_token"); |
73 | String userId = jsonObject.getString("userId"); | 74 | String userId = jsonObject.getString("userId"); |
74 | if (status.equals("100")) { | 75 | if (status.equals("100")) { |
75 | String usernameStr = phonenumber.getText().toString().trim(); | 76 | String usernameStr = phonenumber.getText().toString().trim(); |
76 | String passwordStr = password.getText().toString().trim(); | 77 | String passwordStr = password.getText().toString().trim(); |
77 | HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,userId); | 78 | HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,userId); |
79 | SaveParam.getInstance().saveCustomizeParam(getActivity(), SaveParam.ACCOUNT, "1"); | ||
78 | AlertUtils.showToast(getActivity(), "注册成功!"); | 80 | AlertUtils.showToast(getActivity(), "注册成功!"); |
79 | Content.accountflag =1; | 81 | Content.accountflag =1; |
80 | Intent intent = new Intent(); | 82 | Intent intent = new Intent(); |
81 | intent.setClass(getActivity(),RegisterInfoActivity.class); | 83 | intent.setClass(getActivity(),RegisterInfoActivity.class); |
82 | startActivity(intent); | 84 | startActivity(intent); |
83 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 85 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
84 | getActivity().finish(); | 86 | getActivity().finish(); |
87 | }else if(status.equals("209")){ | ||
88 | AlertUtils.showToast(getActivity(), "验证码错误!"); | ||
85 | } | 89 | } |
86 | break; | 90 | break; |
87 | case HttpCode.REGISTERED_FAIL: | 91 | case HttpCode.REGISTERED_FAIL: |
88 | AlertUtils.showToast(getActivity(), "注册失败"); | 92 | AlertUtils.showToast(getActivity(), "注册失败"); |
89 | break; | 93 | break; |
90 | case HttpCode.AUTHCODE_SUCESS: | 94 | case HttpCode.AUTHCODE_SUCESS: |
91 | jsonObject = (JSONObject) msg.obj; | 95 | jsonObject = (JSONObject) msg.obj; |
92 | status = jsonObject.optString("status"); | 96 | status = jsonObject.optString("status"); |
93 | if (status.equals("100")) { | 97 | if (status.equals("100")) { |
94 | AlertUtils.showToast(getActivity(), "验证码发送成功"); | 98 | AlertUtils.showToast(getActivity(), "验证码发送成功"); |
95 | } | 99 | } |
96 | 100 | ||
97 | break; | 101 | break; |
98 | case HttpCode.AUTHCODE_FAIL: | 102 | case HttpCode.AUTHCODE_FAIL: |
99 | jsonObject = (JSONObject) msg.obj; | 103 | jsonObject = (JSONObject) msg.obj; |
100 | AlertUtils.showToast(getActivity(), "验证码发送失败"); | 104 | AlertUtils.showToast(getActivity(), "验证码发送失败"); |
101 | break; | 105 | break; |
102 | case HttpCode.IS_REFISTER: | 106 | case HttpCode.IS_REFISTER: |
103 | jsonObject = (JSONObject) msg.obj; | 107 | jsonObject = (JSONObject) msg.obj; |
104 | status = jsonObject.getString("status"); | 108 | status = jsonObject.getString("status"); |
105 | if (!status.equals("true")) { | 109 | if (!status.equals("true")) { |
106 | getauthcode(); | 110 | getauthcode(); |
107 | 111 | ||
108 | }else { | 112 | }else { |
109 | AlertUtils.showToast(getActivity(), "该手机号已经注册过了"); | 113 | AlertUtils.showToast(getActivity(), "该手机号已经注册过了"); |
110 | } | 114 | } |
111 | break; | 115 | break; |
112 | case 21: | 116 | case 21: |
113 | if(delayTime<=0){ | 117 | if(delayTime<=0){ |
114 | if(Delaytimer!=null){ | 118 | if(Delaytimer!=null){ |
115 | Delaytimer.cancel(); | 119 | Delaytimer.cancel(); |
116 | } | 120 | } |
117 | get_authcode.setEnabled(true); | 121 | get_authcode.setEnabled(true); |
118 | get_authcode.setClickable(true); | 122 | get_authcode.setClickable(true); |
119 | get_authcode.setText("获取验证码"); | 123 | get_authcode.setText("获取验证码"); |
120 | delayTime=60; | 124 | delayTime=60; |
121 | }else{ | 125 | }else{ |
122 | get_authcode.setEnabled(false); | 126 | get_authcode.setEnabled(false); |
123 | get_authcode.setClickable(false); | 127 | get_authcode.setClickable(false); |
124 | get_authcode.setText(delayTime + " s"); | 128 | get_authcode.setText(delayTime + " s"); |
125 | } | 129 | } |
126 | break; | 130 | break; |
127 | } | 131 | } |
128 | } catch (JSONException e) { | 132 | } catch (JSONException e) { |
129 | e.printStackTrace(); | 133 | e.printStackTrace(); |
130 | } | 134 | } |
131 | } | 135 | } |
132 | }; | 136 | }; |
133 | @Override | 137 | @Override |
134 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 138 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
135 | if (mView == null) { | 139 | if (mView == null) { |
136 | mView = inflater.inflate(R.layout.fragment_loginandregister_register, container, false); | 140 | mView = inflater.inflate(R.layout.fragment_loginandregister_register, container, false); |
137 | initView(mView); | 141 | initView(mView); |
138 | initData(); | 142 | initData(); |
139 | setLister(); | 143 | setLister(); |
140 | 144 | ||
141 | 145 | ||
142 | } | 146 | } |
143 | return mView; | 147 | return mView; |
144 | } | 148 | } |
145 | 149 | ||
146 | private void initView(View mView) { | 150 | private void initView(View mView) { |
147 | get_authcode = (Button) mView.findViewById(R.id.btn_authcode); | 151 | get_authcode = (Button) mView.findViewById(R.id.btn_authcode); |
148 | anth_6num = (EditText) mView.findViewById(R.id.et_authcode); | 152 | anth_6num = (EditText) mView.findViewById(R.id.et_authcode); |
149 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); | 153 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); |
150 | password = (EditText) mView.findViewById(R.id.et_password); | 154 | password = (EditText) mView.findViewById(R.id.et_password); |
151 | openeyes= (ImageView) mView.findViewById(R.id.iv_pwd_change); | 155 | openeyes= (ImageView) mView.findViewById(R.id.iv_pwd_change); |
152 | btn_register = (Button) mView.findViewById(R.id.btn_register); | 156 | btn_register = (Button) mView.findViewById(R.id.btn_register); |
153 | 157 | ||
154 | } | 158 | } |
155 | private void initData() { | 159 | private void initData() { |
156 | } | 160 | } |
157 | private void setLister() { | 161 | private void setLister() { |
158 | get_authcode.setOnClickListener(this); | 162 | get_authcode.setOnClickListener(this); |
159 | openeyes.setOnClickListener(this); | 163 | openeyes.setOnClickListener(this); |
160 | btn_register.setOnClickListener(this); | 164 | btn_register.setOnClickListener(this); |
161 | } | 165 | } |
162 | 166 | ||
163 | 167 | ||
164 | @Override | 168 | @Override |
165 | public void onClick(View v) { | 169 | public void onClick(View v) { |
166 | switch (v.getId()){ | 170 | switch (v.getId()){ |
167 | case R.id.btn_register: | 171 | case R.id.btn_register: |
168 | //测试 | 172 | //测试 |
169 | // | 173 | // |
170 | 174 | ||
171 | String usernameStr = phonenumber.getText().toString().trim(); | 175 | String usernameStr = phonenumber.getText().toString().trim(); |
172 | String authcodeStr = anth_6num.getText().toString().trim(); | 176 | String authcodeStr = anth_6num.getText().toString().trim(); |
173 | String passwordStr = password.getText().toString().trim(); | 177 | String passwordStr = password.getText().toString().trim(); |
174 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)||TextUtils.isEmpty(passwordStr)) { | 178 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)||TextUtils.isEmpty(passwordStr)) { |
175 | AlertUtils.showToast(getActivity(), "手机号,密码和验证码不能为空"); | 179 | AlertUtils.showToast(getActivity(), "手机号,密码和验证码不能为空"); |
176 | return; | 180 | return; |
177 | } else if(passwordStr.length()<8){ | 181 | } else if(passwordStr.length()<8){ |
178 | AlertUtils.showToast(getActivity(), "密码不能少于8位"); | 182 | AlertUtils.showToast(getActivity(), "密码不能少于8位"); |
179 | }else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 183 | }else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ |
180 | AlertUtils.showToast(getActivity(), "手机号码输入错误"); | 184 | AlertUtils.showToast(getActivity(), "手机号码输入错误"); |
181 | 185 | ||
182 | }else if(!passwordStr.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ | 186 | }else if(!passwordStr.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ |
183 | AlertUtils.showToast(getActivity(), "密码由英文和数字组成"); | 187 | AlertUtils.showToast(getActivity(), "密码由英文和数字组成"); |
184 | }else { | 188 | }else { |
185 | register(); | 189 | register(); |
186 | } | 190 | } |
187 | 191 | ||
188 | break; | 192 | break; |
189 | case R.id.iv_pwd_change: | 193 | case R.id.iv_pwd_change: |
190 | if(showPassword){//显示密码 | 194 | if(showPassword){//显示密码 |
191 | showPassword = !showPassword; | 195 | showPassword = !showPassword; |
192 | openeyes.setImageResource(R.mipmap.pwd_open); | 196 | openeyes.setImageResource(R.mipmap.pwd_open); |
193 | password.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 197 | password.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
194 | password.setSelection(password.getText().toString().length()); | 198 | password.setSelection(password.getText().toString().length()); |
195 | }else{//隐藏密码 | 199 | }else{//隐藏密码 |
196 | showPassword = !showPassword; | 200 | showPassword = !showPassword; |
197 | openeyes.setImageResource(R.mipmap.pwd_hide); | 201 | openeyes.setImageResource(R.mipmap.pwd_hide); |
198 | password.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 202 | password.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
199 | password.setSelection(password.getText().toString().length()); | 203 | password.setSelection(password.getText().toString().length()); |
200 | } | 204 | } |
201 | break; | 205 | break; |
202 | case R.id.btn_authcode: | 206 | case R.id.btn_authcode: |
203 | usernameStr = phonenumber.getText().toString().trim(); | 207 | usernameStr = phonenumber.getText().toString().trim(); |
204 | if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 208 | if (!PhoneNumCheckUtils.isPhone(usernameStr)){ |
205 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); | 209 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); |
206 | }else { | 210 | }else { |
207 | anth_6num.requestFocus(); | 211 | anth_6num.requestFocus(); |
208 | ifregister(); | 212 | ifregister(); |
209 | } | 213 | } |
210 | 214 | ||
211 | break; | 215 | break; |
212 | } | 216 | } |
213 | 217 | ||
214 | } | 218 | } |
215 | //获取验证码 | 219 | //获取验证码 |
216 | private void getauthcode() { | 220 | private void getauthcode() { |
217 | String usernameStr = phonenumber.getText().toString().trim(); | 221 | String usernameStr = phonenumber.getText().toString().trim(); |
218 | HttpManager.getInstance().authCode(typeStr, usernameStr, handler, getActivity()); | 222 | HttpManager.getInstance().authCode(typeStr, usernameStr, handler, getActivity()); |
219 | valiDelay(); | 223 | valiDelay(); |
220 | } | 224 | } |
221 | 225 | ||
222 | private void ifregister() { | 226 | private void ifregister() { |
223 | String usernameStr = phonenumber.getText().toString().trim(); | 227 | String usernameStr = phonenumber.getText().toString().trim(); |
224 | HttpManager.getInstance().isregistered(usernameStr, handler, getActivity()); | 228 | HttpManager.getInstance().isregistered(usernameStr, handler, getActivity()); |
225 | } | 229 | } |
226 | 230 | ||
227 | private void register() { | 231 | private void register() { |
228 | String usernameStr = phonenumber.getText().toString().trim(); | 232 | String usernameStr = phonenumber.getText().toString().trim(); |
229 | String authcodeStr = anth_6num.getText().toString().trim(); | 233 | String authcodeStr = anth_6num.getText().toString().trim(); |
230 | String passwordStr = password.getText().toString().trim(); | 234 | String passwordStr = password.getText().toString().trim(); |
231 | HttpManager.getInstance().register(getActivity(), usernameStr, passwordStr, authcodeStr, sourceStr,handler); | 235 | HttpManager.getInstance().register(getActivity(), usernameStr, passwordStr, authcodeStr, sourceStr,handler); |
232 | } | 236 | } |
233 | // 线程类 定时器 | 237 | // 线程类 定时器 |
234 | public void valiDelay() { | 238 | public void valiDelay() { |
235 | 239 | ||
236 | Delaytimer = new java.util.Timer(true); | 240 | Delaytimer = new java.util.Timer(true); |
237 | 241 | ||
238 | 242 | ||
239 | TimerTask task = new TimerTask() { | 243 | TimerTask task = new TimerTask() { |
240 | public void run() { | 244 | public void run() { |
241 | //每次需要执行的代码放到这里面。 | 245 | //每次需要执行的代码放到这里面。 |
242 | delayTime--; | 246 | delayTime--; |
243 | handler.sendEmptyMessage(21); | 247 | handler.sendEmptyMessage(21); |
244 | } | 248 | } |
245 | }; | 249 | }; |
246 | Delaytimer.schedule(task, 1000,1000); | 250 | Delaytimer.schedule(task, 1000,1000); |
247 | } | 251 | } |
248 | } | 252 | } |
249 | 253 |
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.app.Activity; | ||
3 | import android.os.Bundle; | 4 | import android.os.Bundle; |
4 | import android.os.Handler; | 5 | import android.os.Handler; |
5 | import android.os.Message; | 6 | import android.os.Message; |
6 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
7 | import android.support.v4.app.Fragment; | 8 | import android.support.v4.app.Fragment; |
9 | import android.util.Log; | ||
8 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
9 | import android.view.View; | 11 | import android.view.View; |
10 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
11 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
12 | import android.widget.GridView; | 14 | import android.widget.GridView; |
15 | import android.widget.TextView; | ||
13 | 16 | ||
17 | import com.facebook.drawee.view.SimpleDraweeView; | ||
14 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
15 | import com.hjx.personalcenter.adapter.GridAdapter; | 19 | import com.hjx.personalcenter.adapter.GridAdapter; |
16 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 20 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
21 | import com.hjx.personalcenter.db.Content; | ||
17 | import com.hjx.personalcenter.db.SaveParam; | 22 | import com.hjx.personalcenter.db.SaveParam; |
18 | import com.hjx.personalcenter.http.HttpCode; | 23 | import com.hjx.personalcenter.http.HttpCode; |
19 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
20 | import com.hjx.personalcenter.interfaces.DialogCallBack; | ||
21 | import com.hjx.personalcenter.model.DefautPublishInfo; | 25 | import com.hjx.personalcenter.model.DefautPublishInfo; |
22 | 26 | ||
23 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
24 | import java.util.List; | 28 | import java.util.List; |
25 | 29 | ||
26 | /** | 30 | /** |
27 | * Created by h on 2017/8/12. | 31 | * Created by h on 2017/8/12. |
28 | */ | 32 | */ |
29 | 33 | ||
30 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener{ | 34 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener { |
31 | private GridView gridView; | 35 | private GridView gridView; |
32 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 36 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
33 | private GridAdapter sim_adapter; | 37 | private GridAdapter sim_adapter; |
34 | private View mView; | 38 | private View mView; |
35 | private int type; | 39 | private int type; |
36 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 40 | public static String TABLAYOUT_FRAGMENT = "versionfragment"; |
37 | 41 | ||
38 | public static VersionsInfoFragment newInstance(int type) { | 42 | public static VersionsInfoFragment newInstance(int type) { |
39 | VersionsInfoFragment fragment = new VersionsInfoFragment(); | 43 | VersionsInfoFragment fragment = new VersionsInfoFragment(); |
40 | Bundle bundle = new Bundle(); | 44 | Bundle bundle = new Bundle(); |
41 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 45 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
42 | fragment.setArguments(bundle); | 46 | fragment.setArguments(bundle); |
43 | return fragment; | 47 | return fragment; |
44 | 48 | ||
45 | } | 49 | } |
46 | Handler handler = new Handler(){ | 50 | Handler handler = new Handler(){ |
47 | @Override | 51 | @Override |
48 | public void handleMessage(Message msg) { | 52 | public void handleMessage(Message msg) { |
49 | super.handleMessage(msg); | 53 | super.handleMessage(msg); |
50 | switch (msg.what){ | 54 | switch (msg.what){ |
51 | case HttpCode.PUBLISH_SUCESS: | 55 | case HttpCode.PUBLISH_SUCESS: |
52 | defautPublishInfos.clear(); | 56 | defautPublishInfos.clear(); |
53 | defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); | 57 | defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); |
54 | sim_adapter.notifyDataSetChanged(); | 58 | sim_adapter.notifyDataSetChanged(); |
55 | break; | 59 | break; |
56 | } | 60 | } |
57 | } | 61 | } |
58 | }; | 62 | }; |
59 | @Override | 63 | @Override |
60 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 64 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
61 | if (mView == null) { | 65 | if (mView == null) { |
62 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); | 66 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); |
63 | String userID = SaveParam.getInstance().getLoginParam(getActivity(),"userId"); | 67 | String userID = SaveParam.getInstance().getLoginParam(getActivity(),"userId"); |
64 | String graderid = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.GRADENS); | 68 | String graderid = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.GRADENS); |
65 | 69 | //子账户年级id | |
70 | String graderidchilds = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.CHILDSGRADENS); | ||
71 | //账户类型 | ||
72 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.ACCOUNT); | ||
66 | try { | 73 | try { |
74 | int graderID; | ||
67 | long auserID = Long.parseLong(userID); | 75 | long auserID = Long.parseLong(userID); |
68 | int graderID = Integer.parseInt(graderid); | 76 | if ("2".equals(accounts)){ |
77 | graderID = Integer.parseInt(graderidchilds); | ||
78 | }else { | ||
79 | graderID = Integer.parseInt(graderid); | ||
80 | } | ||
81 | |||
69 | //获取版本信息 | 82 | //获取版本信息 |
70 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderID,handler); | 83 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderID,handler); |
71 | 84 | ||
72 | } catch (NumberFormatException e) { | 85 | } catch (NumberFormatException e) { |
73 | e.printStackTrace(); | 86 | e.printStackTrace(); |
74 | } | 87 | } |
75 | 88 | ||
76 | initView(mView); | 89 | initView(mView); |
77 | initData(); | 90 | initData(); |
78 | setLister(); | 91 | setLister(); |
79 | 92 | ||
80 | 93 | ||
81 | } | 94 | } |
82 | return mView; | 95 | return mView; |
83 | } | 96 | } |
84 | //初始化 | 97 | //初始化 |
85 | private void initView(View mView) { | 98 | private void initView(View mView) { |
86 | gridView =(GridView) mView.findViewById(R.id.grideview); | 99 | gridView =(GridView) mView.findViewById(R.id.grideview); |
87 | 100 | ||
88 | } | 101 | } |
89 | private void initData() { | 102 | private void initData() { |
90 | sim_adapter = new GridAdapter(defautPublishInfos,getActivity()); | 103 | sim_adapter = new GridAdapter(defautPublishInfos,getActivity()); |
91 | //配置适配器 | 104 | //配置适配器 |
92 | gridView.setAdapter(sim_adapter); | 105 | gridView.setAdapter(sim_adapter); |
93 | } | 106 | } |
94 | 107 | ||
95 | private void setLister() { | 108 | private void setLister() { |
96 | gridView.setOnItemClickListener(this); | 109 | gridView.setOnItemClickListener(this); |
97 | } | 110 | } |
98 | 111 | ||
99 | @Override | 112 | @Override |
100 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 113 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
101 | switch (position){ | 114 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.SUBJECT,defautPublishInfos.get(position).getSubject()); |
115 | VerSionDialog.getInstance().show(getChildFragmentManager(), "VerSionDialog"); | ||
102 | 116 | ||
103 | case 0: | ||
104 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"语文"); | ||
105 | break; | ||
106 | case 1: | ||
107 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"数学"); | ||
108 | break; | ||
109 | case 2: | ||
110 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"英语"); | ||
111 | break; | ||
112 | case 3: | ||
113 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"物理"); | ||
114 | break; | ||
115 | case 4: | ||
116 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"化学"); | ||
117 | break; | ||
118 | case 5: | ||
119 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"生物"); | ||
120 | break; | ||
121 | case 6: | ||
122 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"政治"); | ||
123 | break; | ||
124 | case 7: | ||
125 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"历史"); | ||
126 | break; | ||
127 | case 8: | ||
128 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.VERSION,"地理"); | ||
129 | break; | ||
130 | } | ||
131 | 117 | ||
132 | VerSionDialog.getInstance((DialogCallBack.VersionCallBack)VersionsInfoFragment.this).show(getChildFragmentManager(), "VerSionDialog"); | 118 | String imgurl = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.IMGURL); |
119 | String version = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.VERSION); | ||
120 | SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | ||
121 | TextView publish = (TextView) view.findViewById(R.id.tv_publish); | ||
122 | simpleDraweeView.setImageURI(imgurl); | ||
123 | publish.setText(version); | ||
133 | 124 | ||
134 | } | 125 | } |
135 | 126 | ||
127 | @Override | ||
128 | public void onAttach(Activity activity) { | ||
129 | super.onAttach(activity); | ||
130 | View rootView = activity.getWindow().getDecorView(); | ||
131 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | ||
132 | sub.setOnClickListener(this); | ||
133 | } | ||
134 | |||
136 | 135 | ||
137 | 136 | ||
138 | @Override | 137 | @Override |
139 | public void onResume() { | 138 | public void onResume() { |
140 | super.onResume(); | 139 | super.onResume(); |
141 | 140 | ||
142 | } | 141 | } |
142 | |||
143 | @Override | ||
144 | public void onClick(View v) { | ||
145 | switch (v.getId()){ | ||
146 | case R.id.presonal_sub: | ||
147 | if (Content.changeinfoflag ==2){ | ||
148 | Log.e("test","你提交版本信息"); | ||
149 | } | ||
150 | |||
151 | String userID = SaveParam.getInstance().getLoginParam(getActivity(),"userId"); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Created by wei on 2017/6/21. | 4 | * Created by wei on 2017/6/21. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | public class HttpCode { | 7 | public class HttpCode { |
8 | //查询保卡信息 | 8 | //查询保卡信息 |
9 | public static final int SUCHCARDINFO = 0; | 9 | public static final int SUCHCARDINFO = 0; |
10 | //是否填写保卡信息 | 10 | //是否填写保卡信息 |
11 | public static final int CHECKCARD = 1; | 11 | public static final int CHECKCARD = 1; |
12 | //注册 | 12 | //注册 |
13 | public static final int REGISTERED_SUCESS = 2; | 13 | public static final int REGISTERED_SUCESS = 2; |
14 | public static final int REGISTERED_FAIL = 3; | 14 | public static final int REGISTERED_FAIL = 3; |
15 | //注册验证码 | 15 | //注册验证码 |
16 | public static final int AUTHCODE_SUCESS = 4; | 16 | public static final int AUTHCODE_SUCESS = 4; |
17 | public static final int AUTHCODE_FAIL = 5; | 17 | public static final int AUTHCODE_FAIL = 5; |
18 | //忘记密码验证码 | 18 | //忘记密码验证码 |
19 | public static final int AUTHCODE_SUCESS1 = 6; | 19 | public static final int AUTHCODE_SUCESS1 = 6; |
20 | public static final int AUTHCODE_FAIL1 = 7; | 20 | public static final int AUTHCODE_FAIL1 = 7; |
21 | //是否已经注册 | 21 | //是否已经注册 |
22 | public static final int IS_REFISTER = 8; | 22 | public static final int IS_REFISTER = 8; |
23 | //忘记密码 | 23 | //忘记密码 |
24 | public static final int PASSWORD_SUCESS = 9; | 24 | public static final int PASSWORD_SUCESS = 9; |
25 | public static final int PASSWORD_FAIL = 10; | 25 | public static final int PASSWORD_FAIL = 10; |
26 | //s省 | 26 | //s省 |
27 | public static final int PROVICES = 11; | 27 | public static final int PROVICES = 11; |
28 | //市 | 28 | //市 |
29 | public static final int CITYS = 12; | 29 | public static final int CITYS = 12; |
30 | //区 | 30 | //区 |
31 | public static final int COUNTRY = 13; | 31 | public static final int COUNTRY = 13; |
32 | //学校 | 32 | //学校 |
33 | public static final int SCHOOL = 14; | 33 | public static final int SCHOOL = 14; |
34 | //年级 | 34 | //年级 |
35 | public static final int GRADER = 15; | 35 | public static final int GRADER = 15; |
36 | //获取个人信息 | 36 | //获取个人信息 |
37 | public static final int GETINFO = 16; | 37 | public static final int GETINFO = 16; |
38 | //获取个性签名 | 38 | //获取个性签名 |
39 | public static final int SIGN = 17; | 39 | public static final int SIGN = 17; |
40 | //登录 | 40 | //登录 |
41 | public static final int LOGIN_SUCESS = 18; | 41 | public static final int LOGIN_SUCESS = 18; |
42 | //获取子账户信息 | 42 | //获取子账户信息 |
43 | public static final int CHILDS_SUCESS = 19; | 43 | public static final int CHILDS_SUCESS = 19; |
44 | //版本升级 | 44 | //版本升级 |
45 | public static final int APPUPDATE_SUCESS = 20; | 45 | public static final int APPUPDATE_SUCESS = 20; |
46 | //获取出版社 | 46 | //获取出版社 |
47 | public static final int VERSION_SUCESS = 22; | 47 | public static final int VERSION_SUCESS = 22; |
48 | //注册信息是否完整 | 48 | //注册信息是否完整 |
49 | public static final int REGISTER_SUCESS = 23; | 49 | public static final int REGISTER_SUCESS = 23; |
50 | //获取默认版本信息 | 50 | //获取默认版本信息 |
51 | public static final int PUBLISH_SUCESS = 24; | 51 | public static final int PUBLISH_SUCESS = 24; |
52 | //注册信息提交 | ||
53 | public static final int REGISTERINFO_SUCESS = 25; | ||
54 | //获取视频信息 | ||
55 | public static final int GETVIDIO_SUCESS = 26; | ||
56 | |||
52 | 57 | ||
53 | 58 | ||
54 | 59 | ||
55 | 60 | ||
56 | } | 61 | } |
57 | 62 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpKey.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | /**请求参数 | 3 | /**请求参数 |
4 | * Created by wei on 2017/6/20. | 4 | * Created by wei on 2017/6/20. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | public class HttpKey { | 7 | public class HttpKey { |
8 | //注册key | 8 | //注册key |
9 | public static String USERNAME = "username"; | 9 | public static String USERNAME = "username"; |
10 | public static String PASSWORD = "password"; | 10 | public static String PASSWORD = "password"; |
11 | public static String SMSCODE = "smscode"; | 11 | public static String SMSCODE = "smscode"; |
12 | public static String SOURCE = "source"; | 12 | public static String SOURCE = "source"; |
13 | //忘记密码 | 13 | //忘记密码 |
14 | public static String AUTHCODE = "authCode"; | 14 | public static String AUTHCODE = "authCode"; |
15 | //注册验证码和忘记密码验证码 | 15 | //注册验证码和忘记密码验证码 |
16 | public static String TYPE = "type"; | 16 | public static String TYPE = "type"; |
17 | public static String MOBIL = "mobile"; | 17 | public static String MOBIL = "mobile"; |
18 | //修改密码 | 18 | //修改密码 |
19 | public static String OLDPASS = "oldPass"; | 19 | public static String OLDPASS = "oldPass"; |
20 | public static String NEWPASS = "newPass"; | 20 | public static String NEWPASS = "newPass"; |
21 | //提交保卡 | 21 | //提交保卡 |
22 | public static String USEID = "userId"; | 22 | public static String USEID = "userId"; |
23 | public static String CUSTOMENAME = "customerName"; | 23 | public static String CUSTOMENAME = "customerName"; |
24 | public static String CUSTOMADRESS = "customerAddress"; | 24 | public static String CUSTOMADRESS = "customerAddress"; |
25 | public static String BUYADREES = "buyAddress"; | 25 | public static String BUYADREES = "buyAddress"; |
26 | public static String BUYTIME = "buyTime"; | 26 | public static String BUYTIME = "buyTime"; |
27 | public static String ALTERSALECALL = "alterSaleCall"; | 27 | public static String ALTERSALECALL = "alterSaleCall"; |
28 | public static String PRODUCTMODEL = "productModel"; | 28 | public static String PRODUCTMODEL = "productModel"; |
29 | public static String DEVICENUMBER = "deviceNumber"; | 29 | public static String DEVICENUMBER = "deviceNumber"; |
30 | public static String MACADRESS = "macAddress"; | 30 | public static String MACADRESS = "macAddress"; |
31 | public static String MOBILPHONE = "customerPhone"; | 31 | public static String MOBILPHONE = "customerPhone"; |
32 | //提交子账户信息 | 32 | //提交子账户信息 |
33 | public static String PARENTID = "parentId"; | 33 | public static String PARENTID = "parentId"; |
34 | public static String IMAGE = "image"; | 34 | public static String IMAGE = "image"; |
35 | public static String NAME = "name"; | 35 | public static String NAME = "name"; |
36 | public static String GRADE = "gradeId"; | 36 | public static String GRADE = "gradeId"; |
37 | public static String SCHOOL = "schoolId"; | 37 | public static String SCHOOL = "schoolId"; |
38 | public static String REGION = "regionId"; | 38 | public static String REGION = "regionId"; |
39 | public static String DEVINUMBER = "deviceNumber"; | 39 | public static String DEVINUMBER = "deviceNumber"; |
40 | public static String REGIONNAME = "regionName"; | 40 | public static String REGIONNAME = "regionName"; |
41 | //提交个人信息 | 41 | //提交个人信息 |
42 | public static String ID = "id"; | 42 | public static String ID = "id"; |
43 | public static String BIRDays = "birthday"; | 43 | public static String BIRDays = "birthday"; |
44 | public static String QQ = "qq"; | 44 | public static String QQ = "qq"; |
45 | public static String GENDER = "gender"; | 45 | public static String GENDER = "gender"; |
46 | //版本信息 | ||
47 | public static String CHINESE = "chinese"; | ||
48 | public static String MATH = "math"; | ||
49 | public static String ENGLISH = "english"; | ||
50 | public static String PHYSICES = "physics"; | ||
51 | public static String CHEMISTRY = "chemistry"; | ||
52 | public static String HISTIRY = "history"; | ||
53 | public static String GEOGRAPHY = "geography"; | ||
54 | public static String POLITICAL = "political"; | ||
55 | public static String BIOLOGY = "biology"; | ||
56 | public static String SCIENCE = "science"; | ||
57 | |||
46 | 58 | ||
47 | 59 | ||
48 | 60 | ||
49 | 61 | ||
50 | 62 | ||
51 | 63 | ||
52 | 64 | ||
53 | 65 | ||
54 | } | 66 | } |
55 | 67 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.app.ProgressDialog; | 4 | import android.app.ProgressDialog; |
5 | import android.content.Context; | 5 | import android.content.Context; |
6 | import android.content.Intent; | 6 | import android.content.Intent; |
7 | import android.os.Handler; | 7 | import android.os.Handler; |
8 | import android.os.Message; | 8 | import android.os.Message; |
9 | import android.util.Log; | 9 | import android.util.Log; |
10 | import android.view.KeyEvent; | ||
10 | import android.widget.Toast; | 11 | import android.widget.Toast; |
11 | 12 | ||
12 | import com.google.gson.Gson; | 13 | import com.google.gson.Gson; |
13 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
14 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 15 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
15 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 16 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
16 | import com.hjx.personalcenter.db.Content; | 17 | import com.hjx.personalcenter.db.Content; |
17 | import com.hjx.personalcenter.db.SaveParam; | 18 | import com.hjx.personalcenter.db.SaveParam; |
18 | import com.hjx.personalcenter.gson.GsonTool; | 19 | import com.hjx.personalcenter.gson.GsonTool; |
19 | import com.hjx.personalcenter.model.AppVersion; | 20 | import com.hjx.personalcenter.model.AppVersion; |
20 | import com.hjx.personalcenter.model.CardInfo; | 21 | import com.hjx.personalcenter.model.CardInfo; |
21 | import com.hjx.personalcenter.model.ChildsInfo; | 22 | import com.hjx.personalcenter.model.ChildsInfo; |
22 | import com.hjx.personalcenter.model.CityInfo; | 23 | import com.hjx.personalcenter.model.CityInfo; |
23 | import com.hjx.personalcenter.model.CountyInfo; | 24 | import com.hjx.personalcenter.model.CountyInfo; |
24 | import com.hjx.personalcenter.model.DefautPublishInfo; | 25 | import com.hjx.personalcenter.model.DefautPublishInfo; |
25 | import com.hjx.personalcenter.model.GradeInfo; | 26 | import com.hjx.personalcenter.model.GradeInfo; |
26 | import com.hjx.personalcenter.model.PesonalInfo; | 27 | import com.hjx.personalcenter.model.PesonalInfo; |
27 | import com.hjx.personalcenter.model.ProvinceInfo; | 28 | import com.hjx.personalcenter.model.ProvinceInfo; |
28 | import com.hjx.personalcenter.model.SchoolInfo; | 29 | import com.hjx.personalcenter.model.SchoolInfo; |
29 | import com.hjx.personalcenter.model.SignInfo; | 30 | import com.hjx.personalcenter.model.SignInfo; |
30 | import com.hjx.personalcenter.model.VersionInfo; | 31 | import com.hjx.personalcenter.model.VersionInfo; |
32 | import com.hjx.personalcenter.model.VideoInfo; | ||
31 | import com.hjx.personalcenter.util.AlertUtils; | 33 | import com.hjx.personalcenter.util.AlertUtils; |
32 | import com.hjx.personalcenter.util.DialogPermission; | 34 | import com.hjx.personalcenter.util.DialogPermission; |
33 | import com.loopj.android.http.AsyncHttpResponseHandler; | 35 | import com.loopj.android.http.AsyncHttpResponseHandler; |
34 | import com.loopj.android.http.JsonHttpResponseHandler; | 36 | import com.loopj.android.http.JsonHttpResponseHandler; |
35 | import com.loopj.android.http.RequestParams; | 37 | import com.loopj.android.http.RequestParams; |
36 | 38 | ||
37 | import org.apache.http.Header; | 39 | import org.apache.http.Header; |
38 | import org.apache.http.entity.ByteArrayEntity; | 40 | import org.apache.http.entity.ByteArrayEntity; |
39 | import org.apache.http.message.BasicHeader; | 41 | import org.apache.http.message.BasicHeader; |
40 | import org.apache.http.protocol.HTTP; | 42 | import org.apache.http.protocol.HTTP; |
41 | import org.json.JSONException; | 43 | import org.json.JSONException; |
42 | import org.json.JSONObject; | 44 | import org.json.JSONObject; |
43 | 45 | ||
44 | import java.io.File; | 46 | import java.io.File; |
45 | import java.io.FileNotFoundException; | 47 | import java.io.FileNotFoundException; |
46 | import java.io.UnsupportedEncodingException; | 48 | import java.io.UnsupportedEncodingException; |
47 | import java.util.ArrayList; | 49 | import java.util.ArrayList; |
48 | import java.util.List; | 50 | import java.util.List; |
49 | 51 | ||
50 | public class HttpManager { | 52 | public class HttpManager { |
51 | private static HttpManager instance; | 53 | private static HttpManager instance; |
52 | private ProgressDialog mProgress = null; | 54 | private ProgressDialog mProgress = null; |
53 | 55 | ||
54 | public static HttpManager getInstance() { | 56 | public static HttpManager getInstance() { |
55 | if (instance == null) { | 57 | if (instance == null) { |
56 | instance = new HttpManager(); | 58 | instance = new HttpManager(); |
57 | } | 59 | } |
58 | return instance; | 60 | return instance; |
59 | } | 61 | } |
60 | 62 | ||
61 | 63 | ||
62 | //登录接口 | 64 | //登录接口 |
63 | 65 | ||
64 | public void login(final String username, final String password, final Context mContext, final Handler handler) { | 66 | public void login(final String username, final String password, final Context mContext, final Handler handler) { |
65 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 67 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
66 | false, true, null); | 68 | false, true, null); |
67 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 69 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
68 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 70 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
69 | @Override | 71 | @Override |
70 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 72 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
71 | closeProgress(); | 73 | closeProgress(); |
72 | Message msg = Message.obtain(); | 74 | Message msg = Message.obtain(); |
73 | msg.what = HttpCode.LOGIN_SUCESS; | 75 | msg.what = HttpCode.LOGIN_SUCESS; |
74 | msg.obj = new String(arg2); | 76 | msg.obj = new String(arg2); |
75 | handler.sendMessage(msg); | 77 | handler.sendMessage(msg); |
76 | 78 | ||
77 | 79 | ||
78 | } | 80 | } |
79 | 81 | ||
80 | @Override | 82 | @Override |
81 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 83 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
82 | closeProgress(); | 84 | closeProgress(); |
83 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 85 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
84 | } | 86 | } |
85 | }); | 87 | }); |
86 | } | 88 | } |
87 | 89 | ||
88 | //注册接口 | 90 | //注册接口 |
89 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 91 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
90 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 92 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
91 | false, true, null); | 93 | false, true, null); |
92 | JSONObject jsonObject = new JSONObject(); | 94 | JSONObject jsonObject = new JSONObject(); |
93 | ByteArrayEntity entity = null; | 95 | ByteArrayEntity entity = null; |
94 | try { | 96 | try { |
95 | jsonObject.put(HttpKey.USERNAME, username); | 97 | jsonObject.put(HttpKey.USERNAME, username); |
96 | jsonObject.put(HttpKey.PASSWORD, password); | 98 | jsonObject.put(HttpKey.PASSWORD, password); |
97 | jsonObject.put(HttpKey.SMSCODE, smscode); | 99 | jsonObject.put(HttpKey.SMSCODE, smscode); |
98 | jsonObject.put(HttpKey.SOURCE, source); | 100 | jsonObject.put(HttpKey.SOURCE, source); |
99 | Log.e("test", "jsonObject" + jsonObject); | 101 | Log.e("test", "jsonObject" + jsonObject); |
100 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 102 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
101 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 103 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
102 | } catch (JSONException e) { | 104 | } catch (JSONException e) { |
103 | e.printStackTrace(); | 105 | e.printStackTrace(); |
104 | } catch (UnsupportedEncodingException e) { | 106 | } catch (UnsupportedEncodingException e) { |
105 | e.printStackTrace(); | 107 | e.printStackTrace(); |
106 | } | 108 | } |
107 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 109 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
108 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 110 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
109 | @Override | 111 | @Override |
110 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 112 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
111 | super.onSuccess(statusCode, headers, response); | 113 | super.onSuccess(statusCode, headers, response); |
112 | closeProgress(); | 114 | closeProgress(); |
113 | Log.e("test", "onSuccess" + response); | 115 | Log.e("test", "onSuccess" + response); |
114 | Message msg = Message.obtain(); | 116 | Message msg = Message.obtain(); |
115 | msg.what = HttpCode.REGISTERED_SUCESS; | 117 | msg.what = HttpCode.REGISTERED_SUCESS; |
116 | msg.obj = response; | 118 | msg.obj = response; |
117 | handler.sendMessage(msg); | 119 | handler.sendMessage(msg); |
118 | 120 | ||
119 | } | 121 | } |
120 | 122 | ||
121 | @Override | 123 | @Override |
122 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 124 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
123 | super.onFailure(statusCode, headers, throwable, errorResponse); | 125 | super.onFailure(statusCode, headers, throwable, errorResponse); |
124 | closeProgress(); | 126 | closeProgress(); |
125 | Log.e("test", "onFailure" + errorResponse); | 127 | Log.e("test", "onFailure" + errorResponse); |
126 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 128 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
127 | } | 129 | } |
128 | 130 | ||
129 | }); | 131 | }); |
130 | } | 132 | } |
131 | 133 | ||
132 | //注册验证码 | 134 | //注册验证码 |
133 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 135 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
134 | RequestParams params = new RequestParams(); | 136 | RequestParams params = new RequestParams(); |
135 | params.put(HttpKey.TYPE, type); | 137 | params.put(HttpKey.TYPE, type); |
136 | params.put(HttpKey.MOBIL, mobile); | 138 | params.put(HttpKey.MOBIL, mobile); |
137 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 139 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
138 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 140 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
139 | 141 | ||
140 | @Override | 142 | @Override |
141 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 143 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
142 | Log.e("test", "onSuccess-----" + response); | 144 | Log.e("test", "onSuccess-----" + response); |
143 | Message msg = Message.obtain(); | 145 | Message msg = Message.obtain(); |
144 | msg.what = HttpCode.AUTHCODE_SUCESS; | 146 | msg.what = HttpCode.AUTHCODE_SUCESS; |
145 | msg.obj = response; | 147 | msg.obj = response; |
146 | handler.sendMessage(msg); | 148 | handler.sendMessage(msg); |
147 | } | 149 | } |
148 | 150 | ||
149 | @Override | 151 | @Override |
150 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 152 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
151 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 153 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
152 | } | 154 | } |
153 | }); | 155 | }); |
154 | } | 156 | } |
155 | 157 | ||
156 | 158 | ||
157 | //手机号是否注册 | 159 | //手机号是否注册 |
158 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 160 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
159 | RequestParams params = new RequestParams(); | 161 | RequestParams params = new RequestParams(); |
160 | params.put(HttpKey.USERNAME, mobile); | 162 | params.put(HttpKey.USERNAME, mobile); |
161 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 163 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
162 | @Override | 164 | @Override |
163 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 165 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
164 | Log.e("test", "isregistered" + response.toString()); | 166 | Log.e("test", "isregistered" + response.toString()); |
165 | Message msg = Message.obtain(); | 167 | Message msg = Message.obtain(); |
166 | msg.what = HttpCode.IS_REFISTER; | 168 | msg.what = HttpCode.IS_REFISTER; |
167 | msg.obj = response; | 169 | msg.obj = response; |
168 | handler.sendMessage(msg); | 170 | handler.sendMessage(msg); |
169 | 171 | ||
170 | } | 172 | } |
171 | 173 | ||
172 | @Override | 174 | @Override |
173 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 175 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
174 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 176 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
175 | 177 | ||
176 | } | 178 | } |
177 | }); | 179 | }); |
178 | } | 180 | } |
179 | 181 | ||
180 | //修改密码 | 182 | //修改密码 |
181 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 183 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
182 | RequestParams params = new RequestParams(); | 184 | RequestParams params = new RequestParams(); |
183 | params.put(HttpKey.USERNAME, username); | 185 | params.put(HttpKey.USERNAME, username); |
184 | params.put(HttpKey.OLDPASS, old_pwd1); | 186 | params.put(HttpKey.OLDPASS, old_pwd1); |
185 | params.put(HttpKey.NEWPASS, newpassword3); | 187 | params.put(HttpKey.NEWPASS, newpassword3); |
186 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 188 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
187 | HttpClient.getInstance().setTimeout(10 * 1000); | 189 | HttpClient.getInstance().setTimeout(10 * 1000); |
188 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 190 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
189 | @Override | 191 | @Override |
190 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 192 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
191 | try { | 193 | try { |
192 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 194 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
193 | String status = jsonObject.optString("status"); | 195 | String status = jsonObject.optString("status"); |
194 | if (status.equals("100")) { | 196 | if (status.equals("100")) { |
195 | Log.e("test", "onSuccess" + new String(bytes)); | 197 | Log.e("test", "onSuccess" + new String(bytes)); |
196 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 198 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
197 | SaveParam.getInstance().clearData((Activity) context); | 199 | SaveParam.getInstance().clearData((Activity) context); |
198 | Intent intent = new Intent(); | 200 | Intent intent = new Intent(); |
199 | intent.setClass(context, LoginAndRegisterActivity.class); | 201 | intent.setClass(context, LoginAndRegisterActivity.class); |
200 | ((Activity) context).startActivity(intent); | 202 | ((Activity) context).startActivity(intent); |
201 | ((Activity) context).finish(); | 203 | ((Activity) context).finish(); |
202 | } else { | 204 | } else { |
203 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 205 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
204 | } | 206 | } |
205 | } catch (JSONException e) { | 207 | } catch (JSONException e) { |
206 | e.printStackTrace(); | 208 | e.printStackTrace(); |
207 | } | 209 | } |
208 | } | 210 | } |
209 | 211 | ||
210 | @Override | 212 | @Override |
211 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 213 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
212 | Log.e("test", "onFailure" + new String(bytes)); | 214 | Log.e("test", "onFailure" + new String(bytes)); |
213 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 215 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
214 | } | 216 | } |
215 | }); | 217 | }); |
216 | 218 | ||
217 | } | 219 | } |
218 | 220 | ||
219 | //忘记密码 | 221 | //忘记密码 |
220 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 222 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
221 | RequestParams params = new RequestParams(); | 223 | RequestParams params = new RequestParams(); |
222 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 224 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
223 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 225 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
224 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 226 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
225 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 227 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
226 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 228 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
227 | @Override | 229 | @Override |
228 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 230 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
229 | try { | 231 | try { |
230 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 232 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
231 | String status = jsonObject.optString("status"); | 233 | String status = jsonObject.optString("status"); |
232 | if (status.equals("100")) { | 234 | if (status.equals("100")) { |
233 | Log.e("test", "onSuccess" + new String(bytes)); | 235 | Log.e("test", "onSuccess" + new String(bytes)); |
234 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 236 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
235 | ((Activity) context).finish(); | 237 | ((Activity) context).finish(); |
236 | } else { | 238 | } else { |
237 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 239 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
238 | } | 240 | } |
239 | } catch (JSONException e) { | 241 | } catch (JSONException e) { |
240 | e.printStackTrace(); | 242 | e.printStackTrace(); |
241 | } | 243 | } |
242 | } | 244 | } |
243 | 245 | ||
244 | @Override | 246 | @Override |
245 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 247 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
246 | Log.e("test", "onFailure" + new String(bytes)); | 248 | Log.e("test", "onFailure" + new String(bytes)); |
247 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 249 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
248 | } | 250 | } |
249 | }); | 251 | }); |
250 | 252 | ||
251 | } | 253 | } |
252 | 254 | ||
253 | //保存用户登录信息 | 255 | //保存用户登录信息 |
254 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { | 256 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { |
255 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 257 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
256 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 258 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
257 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 259 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
258 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 260 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
259 | 261 | ||
260 | 262 | ||
261 | } | 263 | } |
262 | 264 | ||
263 | //提交保卡信息 | 265 | //提交保卡信息 |
264 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 266 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
265 | String buyAddress, String buyTime, String alterSaleCall, | 267 | String buyAddress, String buyTime, String alterSaleCall, |
266 | String productModel, String deviceNumber, String macAddress, | 268 | String productModel, String deviceNumber, String macAddress, |
267 | String mobilePhone) { | 269 | String mobilePhone) { |
268 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 270 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
269 | false, true, null); | 271 | false, true, null); |
270 | RequestParams params = new RequestParams(); | 272 | RequestParams params = new RequestParams(); |
271 | 273 | ||
272 | params.put(HttpKey.USEID, userId); | 274 | params.put(HttpKey.USEID, userId); |
273 | params.put(HttpKey.CUSTOMENAME, customerName); | 275 | params.put(HttpKey.CUSTOMENAME, customerName); |
274 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 276 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
275 | params.put(HttpKey.BUYADREES, buyAddress); | 277 | params.put(HttpKey.BUYADREES, buyAddress); |
276 | params.put(HttpKey.BUYTIME, buyTime); | 278 | params.put(HttpKey.BUYTIME, buyTime); |
277 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 279 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
278 | params.put(HttpKey.PRODUCTMODEL, productModel); | 280 | params.put(HttpKey.PRODUCTMODEL, productModel); |
279 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 281 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
280 | params.put(HttpKey.MACADRESS, macAddress); | 282 | params.put(HttpKey.MACADRESS, macAddress); |
281 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 283 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
282 | 284 | ||
283 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 285 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
284 | 286 | ||
285 | Log.e("test", "params" + params); | 287 | Log.e("test", "params" + params); |
286 | HttpClient.getInstance().setTimeout(5 * 1000); | 288 | HttpClient.getInstance().setTimeout(5 * 1000); |
287 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 289 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
288 | @Override | 290 | @Override |
289 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 291 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
290 | JSONObject jsonObject = null; | 292 | JSONObject jsonObject = null; |
291 | closeProgress(); | 293 | closeProgress(); |
292 | try { | 294 | try { |
293 | jsonObject = new JSONObject(new String(bytes)); | 295 | jsonObject = new JSONObject(new String(bytes)); |
294 | String status = jsonObject.optString("status"); | 296 | String status = jsonObject.optString("status"); |
295 | if (status.equals("1")) { | 297 | if (status.equals("1")) { |
296 | Log.e("test", "onSuccess" + jsonObject); | 298 | Log.e("test", "onSuccess" + jsonObject); |
297 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 299 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
298 | Intent intent = new Intent(); | 300 | Intent intent = new Intent(); |
299 | intent.setClass((Activity) context, TheStartPageActivity.class); | 301 | intent.setClass((Activity) context, TheStartPageActivity.class); |
300 | ((Activity) context).startActivity(intent); | 302 | ((Activity) context).startActivity(intent); |
301 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 303 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
302 | ((Activity) context).finish(); | 304 | ((Activity) context).finish(); |
303 | } else { | 305 | } else { |
304 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 306 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
305 | } | 307 | } |
306 | } catch (JSONException e) { | 308 | } catch (JSONException e) { |
307 | e.printStackTrace(); | 309 | e.printStackTrace(); |
308 | } | 310 | } |
309 | 311 | ||
310 | 312 | ||
311 | } | 313 | } |
312 | 314 | ||
313 | @Override | 315 | @Override |
314 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 316 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
315 | Log.e("test", "onFailure" + (throwable)); | 317 | Log.e("test", "onFailure" + (throwable)); |
316 | closeProgress(); | 318 | closeProgress(); |
317 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 319 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
318 | 320 | ||
319 | } | 321 | } |
320 | }); | 322 | }); |
321 | 323 | ||
322 | } | 324 | } |
323 | 325 | ||
324 | //获取保卡信息 | 326 | //获取保卡信息 |
325 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { | 327 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { |
326 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 328 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
327 | false, true, null); | 329 | false, true, null); |
328 | HttpClient.getInstance().setTimeout(5 * 1000); | 330 | HttpClient.getInstance().setTimeout(5 * 1000); |
329 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 331 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
330 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { | 332 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { |
331 | @Override | 333 | @Override |
332 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 334 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
333 | closeProgress(); | 335 | closeProgress(); |
334 | Log.e("test", "保卡信息" + new String(arg2)); | 336 | Log.e("test", "保卡信息" + new String(arg2)); |
335 | try { | 337 | try { |
336 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 338 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
337 | int status = jsonObject.optInt("status"); | 339 | int status = jsonObject.optInt("status"); |
338 | if (status == 1) { | 340 | if (status == 1) { |
339 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 341 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
340 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 342 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
341 | Message msg = Message.obtain(); | 343 | Message msg = Message.obtain(); |
342 | msg.what = HttpCode.SUCHCARDINFO; | 344 | msg.what = HttpCode.SUCHCARDINFO; |
343 | msg.obj = schoolInfoBeanList; | 345 | msg.obj = schoolInfoBeanList; |
344 | handler.sendMessage(msg); | 346 | handler.sendMessage(msg); |
345 | 347 | ||
346 | 348 | ||
347 | } else { | 349 | } else { |
348 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 350 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
349 | 351 | ||
350 | } | 352 | } |
351 | } catch (JSONException e) { | 353 | } catch (JSONException e) { |
352 | e.printStackTrace(); | 354 | e.printStackTrace(); |
353 | } | 355 | } |
354 | 356 | ||
355 | } | 357 | } |
356 | 358 | ||
357 | @Override | 359 | @Override |
358 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 360 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
359 | closeProgress(); | 361 | closeProgress(); |
360 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 362 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
361 | } | 363 | } |
362 | }); | 364 | }); |
363 | } | 365 | } |
364 | 366 | ||
365 | //修改保卡信息电话 | 367 | //修改保卡信息电话 |
366 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { | 368 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { |
367 | RequestParams params = new RequestParams(); | 369 | RequestParams params = new RequestParams(); |
368 | params.put("userId", userId); | 370 | params.put("userId", userId); |
369 | params.put("customerPhone", customerPhone); | 371 | params.put("customerPhone", customerPhone); |
370 | params.put("authCode", authCode); | 372 | params.put("authCode", authCode); |
371 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 373 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
372 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 374 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
373 | @Override | 375 | @Override |
374 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 376 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
375 | try { | 377 | try { |
376 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 378 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
377 | String status = jsonObject.optString("status"); | 379 | String status = jsonObject.optString("status"); |
378 | if (status.equals("1")) { | 380 | if (status.equals("1")) { |
379 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 381 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
380 | if (Content.authcodeflag==2){ | 382 | if (Content.authcodeflag==2){ |
381 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 383 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
382 | }else if (Content.authcodeflag==1){ | 384 | }else if (Content.authcodeflag==1){ |
383 | SaveParam.getInstance().saveLoginParam(mContext, "username", customerPhone); | 385 | SaveParam.getInstance().saveLoginParam(mContext, "username", customerPhone); |
384 | }else { | 386 | }else { |
385 | AlertUtils.showToast(mContext, "修改未知的手机号"); | 387 | AlertUtils.showToast(mContext, "修改未知的手机号"); |
386 | } | 388 | } |
387 | ((Activity) mContext).finish(); | 389 | ((Activity) mContext).finish(); |
388 | } else if (status.equals("1001")) { | 390 | } else if (status.equals("1001")) { |
389 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 391 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
390 | } else { | 392 | } else { |
391 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 393 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
392 | } | 394 | } |
393 | } catch (JSONException e) { | 395 | } catch (JSONException e) { |
394 | e.printStackTrace(); | 396 | e.printStackTrace(); |
395 | } | 397 | } |
396 | } | 398 | } |
397 | 399 | ||
398 | @Override | 400 | @Override |
399 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 401 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
400 | Log.e("test", "onFailure" + new String(bytes)); | 402 | Log.e("test", "onFailure" + new String(bytes)); |
401 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 403 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
402 | } | 404 | } |
403 | }); | 405 | }); |
404 | } | 406 | } |
405 | 407 | ||
406 | //修改保卡信息地址 | 408 | //修改保卡信息地址 |
407 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { | 409 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { |
408 | RequestParams params = new RequestParams(); | 410 | RequestParams params = new RequestParams(); |
409 | params.put("userId", userId); | 411 | params.put("userId", userId); |
410 | params.put("customerPhone", customerPhone); | 412 | params.put("customerPhone", customerPhone); |
411 | params.put("authCode", authCode); | 413 | params.put("authCode", authCode); |
412 | params.put("customerAddress", customerAddress); | 414 | params.put("customerAddress", customerAddress); |
413 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 415 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
414 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 416 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
415 | @Override | 417 | @Override |
416 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 418 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
417 | try { | 419 | try { |
418 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 420 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
419 | String status = jsonObject.optString("status"); | 421 | String status = jsonObject.optString("status"); |
420 | if (status.equals("1")) { | 422 | if (status.equals("1")) { |
421 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); | 423 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); |
422 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 424 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
423 | ((Activity) mContext).finish(); | 425 | ((Activity) mContext).finish(); |
424 | } else { | 426 | } else { |
425 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 427 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
426 | } | 428 | } |
427 | } catch (JSONException e) { | 429 | } catch (JSONException e) { |
428 | e.printStackTrace(); | 430 | e.printStackTrace(); |
429 | } | 431 | } |
430 | } | 432 | } |
431 | 433 | ||
432 | @Override | 434 | @Override |
433 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 435 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
434 | Log.e("test", "onFailure" + new String(bytes)); | 436 | Log.e("test", "onFailure" + new String(bytes)); |
435 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 437 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
436 | } | 438 | } |
437 | }); | 439 | }); |
438 | } | 440 | } |
439 | 441 | ||
440 | //验证是否保卡信息 | 442 | //验证是否保卡信息 |
441 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { | 443 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { |
442 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 444 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
443 | false, true, null); | 445 | false, true, null); |
444 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 446 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
445 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { | 447 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { |
446 | @Override | 448 | @Override |
447 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 449 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
448 | Log.e("test", "---" + new String(arg2)); | 450 | Log.e("test", "---" + new String(arg2)); |
449 | closeProgress(); | 451 | closeProgress(); |
450 | Message msg = Message.obtain(); | 452 | Message msg = Message.obtain(); |
451 | msg.what = HttpCode.CHECKCARD; | 453 | msg.what = HttpCode.CHECKCARD; |
452 | msg.obj = new String(arg2); | 454 | msg.obj = new String(arg2); |
453 | handler.sendMessage(msg); | 455 | handler.sendMessage(msg); |
454 | 456 | ||
455 | 457 | ||
456 | } | 458 | } |
457 | 459 | ||
458 | @Override | 460 | @Override |
459 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 461 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
460 | closeProgress(); | 462 | closeProgress(); |
461 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 463 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
462 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 464 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
463 | } | 465 | } |
464 | }); | 466 | }); |
465 | } | 467 | } |
466 | 468 | ||
467 | ///获取年级 | 469 | ///获取年级 |
468 | public void getgrade(final Context mContext, final Handler handler) { | 470 | public void getgrade(final Context mContext, final Handler handler) { |
469 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 471 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
470 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 472 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
471 | @Override | 473 | @Override |
472 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 474 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
473 | Log.e("test", "年级" + new String(arg2)); | 475 | Log.e("test", "年级" + new String(arg2)); |
474 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 476 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
475 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 477 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
476 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 478 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
477 | String name = gradeInfo.getData().get(i).getName(); | 479 | String name = gradeInfo.getData().get(i).getName(); |
478 | int id = gradeInfo.getData().get(i).getId(); | 480 | int id = gradeInfo.getData().get(i).getId(); |
479 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 481 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
480 | for (int j = 0; j < gradeinfoList.size(); j++) { | 482 | for (int j = 0; j < gradeinfoList.size(); j++) { |
481 | String secondname = gradeinfoList.get(j).getName(); | 483 | String secondname = gradeinfoList.get(j).getName(); |
482 | int secondid = gradeinfoList.get(j).getId(); | 484 | int secondid = gradeinfoList.get(j).getId(); |
483 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 485 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
484 | dataBean.setName(secondname); | 486 | dataBean.setName(secondname); |
485 | dataBean.setId(secondid); | 487 | dataBean.setId(secondid); |
486 | gradeInfoLists.add(dataBean); | 488 | gradeInfoLists.add(dataBean); |
487 | } | 489 | } |
488 | 490 | ||
489 | } | 491 | } |
490 | 492 | ||
491 | Message message = Message.obtain(); | 493 | Message message = Message.obtain(); |
492 | message.what = HttpCode.GRADER; | 494 | message.what = HttpCode.GRADER; |
493 | message.obj = gradeInfoLists; | 495 | message.obj = gradeInfoLists; |
494 | handler.sendMessage(message); | 496 | handler.sendMessage(message); |
495 | 497 | ||
496 | 498 | ||
497 | } | 499 | } |
498 | 500 | ||
499 | @Override | 501 | @Override |
500 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 502 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
501 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 503 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
502 | } | 504 | } |
503 | }); | 505 | }); |
504 | } | 506 | } |
505 | 507 | ||
506 | /** | 508 | /** |
507 | * 获取学校 | 509 | * 获取学校 |
508 | * | 510 | * |
509 | * @param mContext | 511 | * @param mContext |
510 | * @param regionId | 512 | * @param regionId |
511 | * @param gradeId | 513 | * @param gradeId |
512 | * @param handler | 514 | * @param handler |
513 | */ | 515 | */ |
514 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 516 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
515 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 517 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
516 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 518 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
517 | @Override | 519 | @Override |
518 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 520 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
519 | Log.e("test", "学校" + new String(arg2)); | 521 | Log.e("test", "学校" + new String(arg2)); |
520 | try { | 522 | try { |
521 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 523 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
522 | int status = jsonObject.optInt("status"); | 524 | int status = jsonObject.optInt("status"); |
523 | if (status == 1) { | 525 | if (status == 1) { |
524 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 526 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
525 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 527 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
526 | Message message = Message.obtain(); | 528 | Message message = Message.obtain(); |
527 | message.what = HttpCode.SCHOOL; | 529 | message.what = HttpCode.SCHOOL; |
528 | message.obj = schoolInfoBeanList; | 530 | message.obj = schoolInfoBeanList; |
529 | handler.sendMessage(message); | 531 | handler.sendMessage(message); |
530 | 532 | ||
531 | 533 | ||
532 | } else { | 534 | } else { |
533 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 535 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
534 | 536 | ||
535 | } | 537 | } |
536 | } catch (JSONException e) { | 538 | } catch (JSONException e) { |
537 | e.printStackTrace(); | 539 | e.printStackTrace(); |
538 | } | 540 | } |
539 | 541 | ||
540 | } | 542 | } |
541 | 543 | ||
542 | @Override | 544 | @Override |
543 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 545 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
544 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 546 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
545 | } | 547 | } |
546 | }); | 548 | }); |
547 | } | 549 | } |
548 | 550 | ||
549 | 551 | ||
550 | /** | 552 | /** |
551 | * 获取个人信息 | 553 | * 获取个人信息 |
552 | * | 554 | * |
553 | * @param mContext | 555 | * @param mContext |
554 | * @param userId | 556 | * @param userId |
555 | * @param handler | 557 | * @param handler |
556 | */ | 558 | */ |
557 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { | 559 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
558 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 560 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
559 | false, true, null); | 561 | // false, true, null); |
560 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 562 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
561 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 563 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
562 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 564 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
563 | @Override | 565 | @Override |
564 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 566 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
565 | closeProgress(); | 567 | closeProgress(); |
566 | Log.e("test", "个人信息" + new String(arg2)); | 568 | Log.e("test", "个人信息" + new String(arg2)); |
567 | try { | 569 | try { |
568 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 570 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
569 | int status = jsonObject.optInt("status"); | 571 | int status = jsonObject.optInt("status"); |
570 | if (status == 1) { | 572 | if (status == 1) { |
571 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 573 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
572 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 574 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
573 | Message message = Message.obtain(); | 575 | Message message = Message.obtain(); |
574 | message.what = HttpCode.GETINFO; | 576 | message.what = HttpCode.GETINFO; |
575 | message.obj = pesonalInfoBeanList; | 577 | message.obj = pesonalInfoBeanList; |
576 | handler.sendMessage(message); | 578 | handler.sendMessage(message); |
577 | 579 | ||
578 | 580 | ||
579 | } else { | 581 | } else { |
580 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 582 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
581 | 583 | ||
582 | } | 584 | } |
583 | } catch (JSONException e) { | 585 | } catch (JSONException e) { |
584 | e.printStackTrace(); | 586 | e.printStackTrace(); |
585 | } | 587 | } |
586 | 588 | ||
587 | 589 | ||
588 | } | 590 | } |
589 | 591 | ||
590 | @Override | 592 | @Override |
591 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 593 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
592 | closeProgress(); | 594 | closeProgress(); |
593 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 595 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
594 | } | 596 | } |
595 | }); | 597 | }); |
596 | } | 598 | } |
597 | 599 | ||
598 | //修改个人信息 | 600 | //修改个人信息 |
599 | public void changepresonalinfo(final Context mContext, Long id, int type | 601 | public void changepresonalinfo(final Context mContext, Long id, int type |
600 | , String name, String birthday, int gradeId, long regionId, | 602 | , String name, String birthday, int gradeId, long regionId, |
601 | Object schoolId, String qq, String gender | 603 | Object schoolId, String qq, String gender |
602 | , String regionName, String devicenumber) throws UnsupportedEncodingException { | 604 | , String regionName, String devicenumber) throws UnsupportedEncodingException { |
603 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 605 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
604 | false, true, null); | 606 | false, true, null); |
605 | RequestParams params = new RequestParams(); | 607 | RequestParams params = new RequestParams(); |
606 | 608 | ||
607 | params.put(HttpKey.USEID, id); | 609 | params.put(HttpKey.USEID, id); |
608 | params.put(HttpKey.TYPE, type); | 610 | params.put(HttpKey.TYPE, type); |
609 | params.put(HttpKey.NAME, name); | 611 | params.put(HttpKey.NAME, name); |
610 | params.put(HttpKey.BIRDays, birthday); | 612 | params.put(HttpKey.BIRDays, birthday); |
611 | params.put(HttpKey.GRADE, gradeId); | 613 | params.put(HttpKey.GRADE, gradeId); |
612 | params.put(HttpKey.REGION, regionId); | 614 | params.put(HttpKey.REGION, regionId); |
613 | params.put(HttpKey.SCHOOL, schoolId); | 615 | params.put(HttpKey.SCHOOL, schoolId); |
614 | params.put(HttpKey.QQ, qq); | 616 | params.put(HttpKey.QQ, qq); |
615 | params.put(HttpKey.GENDER, gender); | 617 | params.put(HttpKey.GENDER, gender); |
616 | params.put(HttpKey.REGIONNAME, regionName); | 618 | params.put(HttpKey.REGIONNAME, regionName); |
617 | params.put(HttpKey.DEVINUMBER, devicenumber); | 619 | params.put(HttpKey.DEVINUMBER, devicenumber); |
618 | Log.e("test", "个人信息" + params); | 620 | Log.e("test", "个人信息" + params); |
619 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 621 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
620 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { | 622 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { |
621 | @Override | 623 | @Override |
622 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 624 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
623 | super.onSuccess(statusCode, headers, response); | 625 | super.onSuccess(statusCode, headers, response); |
624 | closeProgress(); | 626 | closeProgress(); |
625 | String status = response.optString("status"); | 627 | String status = response.optString("status"); |
626 | if (status.equals("1")) { | 628 | if (status.equals("1")) { |
627 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 629 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
628 | ((Activity) mContext).finish(); | 630 | ((Activity) mContext).finish(); |
629 | } else { | 631 | } else { |
630 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 632 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
631 | } | 633 | } |
632 | 634 | ||
633 | } | 635 | } |
634 | 636 | ||
635 | @Override | 637 | @Override |
636 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 638 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
637 | super.onFailure(statusCode, headers, throwable, errorResponse); | 639 | super.onFailure(statusCode, headers, throwable, errorResponse); |
638 | closeProgress(); | 640 | closeProgress(); |
639 | Log.e("test", "onFailure" + errorResponse); | 641 | Log.e("test", "onFailure" + errorResponse); |
640 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 642 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
641 | } | 643 | } |
642 | 644 | ||
643 | }); | 645 | }); |
644 | } | 646 | } |
647 | //提交注册信息 | ||
648 | public void subregisterinfo(final Context mContext, Long userId | ||
649 | , String name, int gradeId, long regionId, String regionName, Object schoolId, | ||
650 | String math, String english, String physics, String chinese, String chemistry, | ||
651 | String history, String geography, String political, String biology, String science, final Handler handler){ | ||
652 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | ||
653 | false, true, null); | ||
654 | RequestParams params = new RequestParams(); | ||
655 | |||
656 | params.put(HttpKey.USEID, userId); | ||
657 | params.put(HttpKey.NAME, name); | ||
658 | params.put(HttpKey.GRADE, gradeId); | ||
659 | params.put(HttpKey.REGION, regionId); | ||
660 | params.put(HttpKey.SCHOOL, schoolId); | ||
661 | params.put(HttpKey.REGIONNAME, regionName); | ||
662 | params.put(HttpKey.MATH, math); | ||
663 | params.put(HttpKey.ENGLISH, english); | ||
664 | params.put(HttpKey.PHYSICES, physics); | ||
665 | params.put(HttpKey.CHINESE, chinese); | ||
666 | params.put(HttpKey.CHEMISTRY, chemistry); | ||
667 | params.put(HttpKey.HISTIRY, history); | ||
668 | params.put(HttpKey.GEOGRAPHY, geography); | ||
669 | params.put(HttpKey.POLITICAL, political); | ||
670 | params.put(HttpKey.BIOLOGY, biology); | ||
671 | params.put(HttpKey.SCIENCE, science); | ||
672 | |||
673 | Log.e("test", "注册信息" + params); | ||
674 | HttpClient.getInstance().addHeader("Accept", "*/*"); | ||
675 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { | ||
676 | @Override | ||
677 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | ||
678 | super.onSuccess(statusCode, headers, response); | ||
679 | closeProgress(); | ||
680 | Message message = Message.obtain(); | ||
681 | message.what = HttpCode.REGISTERINFO_SUCESS; | ||
682 | message.obj = new String(String.valueOf(response)); | ||
683 | handler.sendMessage(message); | ||
684 | |||
685 | } | ||
686 | |||
687 | @Override | ||
688 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | ||
689 | super.onFailure(statusCode, headers, throwable, errorResponse); | ||
690 | closeProgress(); | ||
691 | Log.e("test", "onFailure" + errorResponse); | ||
692 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | ||
693 | } | ||
694 | |||
695 | }); | ||
696 | } | ||
697 | //修改版本信息 | ||
698 | public void changepublishinfo(final Context mContext, String userId, | ||
699 | String math, String english, String physics, String chinese, String chemistry, | ||
700 | String history, String geography, String political, String biology, String science){ | ||
701 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | ||
702 | false, true, null); | ||
703 | RequestParams params = new RequestParams(); | ||
704 | params.put(HttpKey.USEID, userId); | ||
705 | params.put(HttpKey.MATH, math); | ||
706 | params.put(HttpKey.ENGLISH, english); | ||
707 | params.put(HttpKey.PHYSICES, physics); | ||
708 | params.put(HttpKey.CHINESE, chinese); | ||
709 | params.put(HttpKey.CHEMISTRY, chemistry); | ||
710 | params.put(HttpKey.HISTIRY, history); | ||
711 | params.put(HttpKey.GEOGRAPHY, geography); | ||
712 | params.put(HttpKey.POLITICAL, political); | ||
713 | params.put(HttpKey.BIOLOGY, biology); | ||
714 | params.put(HttpKey.SCIENCE, science); | ||
715 | |||
716 | Log.e("test", "版本信息信息" + params); | ||
717 | HttpClient.getInstance().addHeader("Accept", "*/*"); | ||
718 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { | ||
719 | @Override | ||
720 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | ||
721 | super.onSuccess(statusCode, headers, response); | ||
722 | closeProgress(); | ||
723 | String status = response.optString("status"); | ||
724 | if (status.equals("1")) { | ||
725 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); | ||
726 | ((Activity) mContext).finish(); | ||
727 | } else { | ||
728 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | ||
729 | } | ||
730 | |||
731 | } | ||
732 | |||
733 | @Override | ||
734 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | ||
735 | super.onFailure(statusCode, headers, throwable, errorResponse); | ||
736 | closeProgress(); | ||
737 | Log.e("test", "onFailure" + errorResponse); | ||
738 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | ||
739 | } | ||
740 | |||
741 | }); | ||
742 | } | ||
645 | 743 | ||
646 | //修改个性签名 | 744 | //修改个性签名 |
647 | public void changsignature(final Context mContext, long userId, int type, final String signature) { | 745 | public void changsignature(final Context mContext, long userId, int type, final String signature) { |
648 | RequestParams params = new RequestParams(); | 746 | RequestParams params = new RequestParams(); |
649 | params.put("userId", userId); | 747 | params.put("userId", userId); |
650 | params.put("type", type); | 748 | params.put("type", type); |
651 | params.put("signature", signature); | 749 | params.put("signature", signature); |
652 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 750 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
653 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 751 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
654 | @Override | 752 | @Override |
655 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 753 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
656 | try { | 754 | try { |
657 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 755 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
658 | String status = jsonObject.optString("status"); | 756 | String status = jsonObject.optString("status"); |
659 | if (status.equals("1")) { | 757 | if (status.equals("1")) { |
660 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 758 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
661 | } else { | 759 | } else { |
662 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 760 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
663 | } | 761 | } |
664 | } catch (JSONException e) { | 762 | } catch (JSONException e) { |
665 | e.printStackTrace(); | 763 | e.printStackTrace(); |
666 | } | 764 | } |
667 | } | 765 | } |
668 | 766 | ||
669 | @Override | 767 | @Override |
670 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 768 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
671 | Log.e("test", "onFailure" + new String(bytes)); | 769 | Log.e("test", "onFailure" + new String(bytes)); |
672 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 770 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
673 | } | 771 | } |
674 | }); | 772 | }); |
675 | } | 773 | } |
676 | 774 | ||
677 | /** | 775 | /** |
678 | * 获取个性签名 | 776 | * 获取个性签名 |
679 | * | 777 | * |
680 | * @param mContext | 778 | * @param mContext |
681 | * @param userId | 779 | * @param userId |
682 | * @param handler | 780 | * @param handler |
683 | */ | 781 | */ |
684 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { | 782 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { |
685 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 783 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
686 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 784 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
687 | @Override | 785 | @Override |
688 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 786 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
689 | Log.e("test", "个性签名" + new String(arg2)); | 787 | Log.e("test", "个性签名" + new String(arg2)); |
690 | try { | 788 | try { |
691 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 789 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
692 | int status = jsonObject.optInt("status"); | 790 | int status = jsonObject.optInt("status"); |
693 | if (status == 1) { | 791 | if (status == 1) { |
694 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 792 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
695 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 793 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
696 | Message message = Message.obtain(); | 794 | Message message = Message.obtain(); |
697 | message.what = HttpCode.SIGN; | 795 | message.what = HttpCode.SIGN; |
698 | message.obj = signInfoBeanList; | 796 | message.obj = signInfoBeanList; |
699 | handler.sendMessage(message); | 797 | handler.sendMessage(message); |
700 | 798 | ||
701 | 799 | ||
702 | } else if (status == 1000) { | 800 | } else if (status == 1000) { |
703 | AlertUtils.showToast(mContext, "您还没有签名哦"); | 801 | //AlertUtils.showToast(mContext, "您还没有签名哦"); |
704 | 802 | ||
705 | } else { | 803 | } else { |
706 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 804 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
707 | } | 805 | } |
708 | } catch (JSONException e) { | 806 | } catch (JSONException e) { |
709 | e.printStackTrace(); | 807 | e.printStackTrace(); |
710 | } | 808 | } |
711 | 809 | ||
712 | 810 | ||
713 | } | 811 | } |
714 | 812 | ||
715 | @Override | 813 | @Override |
716 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 814 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
717 | Log.e("test", "失败原因" + arg3); | 815 | Log.e("test", "失败原因" + arg3); |
718 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 816 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
719 | } | 817 | } |
720 | }); | 818 | }); |
721 | } | 819 | } |
722 | 820 | ||
723 | /** | 821 | /** |
724 | * 用户反馈 | 822 | * 用户反馈 |
725 | * | 823 | * |
726 | * @param mContext | 824 | * @param mContext |
727 | * @param userId | 825 | * @param userId |
728 | * @param content | 826 | * @param content |
729 | * @param contact | 827 | * @param contact |
730 | * @param imgs | 828 | * @param imgs |
731 | * @param feedtype | 829 | * @param feedtype |
732 | * @throws UnsupportedEncodingException | 830 | * @throws UnsupportedEncodingException |
733 | */ | 831 | */ |
734 | public void feedback(final Context mContext, String userId, String content, | 832 | public void feedback(final Context mContext, String userId, String content, |
735 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { | 833 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { |
736 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 834 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
737 | false, true, null); | 835 | false, true, null); |
738 | File file = new File(imgs); | 836 | File file = new File(imgs); |
739 | if (file.exists() && file.length() > 0) { | 837 | if (file.exists() && file.length() > 0) { |
740 | RequestParams params = new RequestParams(); | 838 | RequestParams params = new RequestParams(); |
741 | try { | 839 | try { |
742 | params.put("userId", userId); | 840 | params.put("userId", userId); |
743 | params.put("content", content); | 841 | params.put("content", content); |
744 | params.put("contact", contact); | 842 | params.put("contact", contact); |
745 | params.put("imgs", file); | 843 | params.put("imgs", file); |
746 | params.put("feedtype", feedtype); | 844 | params.put("feedtype", feedtype); |
747 | } catch (FileNotFoundException e) { | 845 | } catch (FileNotFoundException e) { |
748 | e.printStackTrace(); | 846 | e.printStackTrace(); |
749 | } | 847 | } |
750 | Log.e("test", "onSuccess" + params); | 848 | Log.e("test", "onSuccess" + params); |
751 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { | 849 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { |
752 | @Override | 850 | @Override |
753 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 851 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
754 | closeProgress(); | 852 | closeProgress(); |
755 | Log.e("test", "onSuccess" + new String(bytes)); | 853 | Log.e("test", "onSuccess" + new String(bytes)); |
756 | try { | 854 | try { |
757 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 855 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
758 | String status = jsonObject.optString("status"); | 856 | String status = jsonObject.optString("status"); |
759 | if (status.equals("1")) { | 857 | if (status.equals("1")) { |
760 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); | 858 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); |
761 | ((Activity) mContext).finish(); | 859 | ((Activity) mContext).finish(); |
762 | } else { | 860 | } else { |
763 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 861 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
764 | } | 862 | } |
765 | } catch (JSONException e) { | 863 | } catch (JSONException e) { |
766 | e.printStackTrace(); | 864 | e.printStackTrace(); |
767 | } | 865 | } |
768 | } | 866 | } |
769 | 867 | ||
770 | @Override | 868 | @Override |
771 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 869 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
772 | closeProgress(); | 870 | closeProgress(); |
773 | Log.e("test", "错误信息" + new String(bytes)); | 871 | Log.e("test", "错误信息" + new String(bytes)); |
774 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 872 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
775 | 873 | ||
776 | } | 874 | } |
777 | }); | 875 | }); |
778 | } else { | 876 | } else { |
779 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 877 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); |
780 | } | 878 | } |
781 | } | 879 | } |
782 | 880 | ||
783 | /** | 881 | /** |
784 | * 查询子账户信息 | 882 | * 查询子账户信息 |
785 | * | 883 | * |
786 | * @param mContext | 884 | * @param mContext |
787 | * @param userId | 885 | * @param userId |
788 | * @param handler | 886 | * @param handler |
789 | */ | 887 | */ |
790 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { | 888 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { |
791 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", | 889 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", |
792 | false, true, null); | 890 | false, true, null); |
793 | 891 | ||
794 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); | 892 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); |
795 | HttpClient.getInstance().setTimeout(5 * 1000); | 893 | HttpClient.getInstance().setTimeout(5 * 1000); |
796 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 894 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
797 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 895 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
798 | @Override | 896 | @Override |
799 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 897 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
800 | closeProgress(); | 898 | closeProgress(); |
801 | Log.e("test", "子账户信息" + new String(arg2)); | 899 | Log.e("test", "子账户信息" + new String(arg2)); |
802 | try { | 900 | try { |
803 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 901 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
804 | int status = jsonObject.optInt("status"); | 902 | int status = jsonObject.optInt("status"); |
805 | if (status == 1) { | 903 | if (status == 1) { |
806 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 904 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
807 | Log.e("test", "子账户信息" + childsInfo); | 905 | Log.e("test", "子账户信息" + childsInfo); |
808 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 906 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
809 | Log.e("test", "子账户信息" + schoolInfoBeanList); | 907 | Log.e("test", "子账户信息" + schoolInfoBeanList); |
810 | Message msg = Message.obtain(); | 908 | Message msg = Message.obtain(); |
811 | msg.what = HttpCode.CHILDS_SUCESS; | 909 | msg.what = HttpCode.CHILDS_SUCESS; |
812 | msg.obj = schoolInfoBeanList; | 910 | msg.obj = schoolInfoBeanList; |
813 | handler.sendMessage(msg); | 911 | handler.sendMessage(msg); |
814 | 912 | ||
815 | }else { | 913 | }else { |
816 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 914 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
817 | 915 | ||
818 | } | 916 | } |
819 | } catch (JSONException e) { | 917 | } catch (JSONException e) { |
820 | e.printStackTrace(); | 918 | e.printStackTrace(); |
821 | 919 | ||
822 | } | 920 | } |
823 | 921 | ||
824 | } | 922 | } |
825 | 923 | ||
826 | @Override | 924 | @Override |
827 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 925 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
828 | closeProgress(); | 926 | closeProgress(); |
829 | // Log.e("test", "错误信息" + new String(arg2)); | 927 | // Log.e("test", "错误信息" + new String(arg2)); |
830 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 928 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
831 | } | 929 | } |
832 | }); | 930 | }); |
833 | 931 | ||
834 | } | 932 | } |
835 | 933 | ||
836 | /** | 934 | /** |
837 | * 删除子账户信息 | 935 | * 删除子账户信息 |
838 | * | 936 | * |
839 | * @param mContext | 937 | * @param mContext |
840 | * @param subAccountId | 938 | * @param subAccountId |
841 | */ | 939 | */ |
842 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { | 940 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { |
843 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 941 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
844 | false, true, null); | 942 | false, true, null); |
845 | HttpClient.getInstance().setTimeout(5 * 1000); | 943 | HttpClient.getInstance().setTimeout(5 * 1000); |
846 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 944 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
847 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 945 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
848 | @Override | 946 | @Override |
849 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 947 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
850 | closeProgress(); | 948 | closeProgress(); |
851 | Log.e("test", "子账户信息" + new String(arg2)); | 949 | Log.e("test", "子账户信息" + new String(arg2)); |
852 | try { | 950 | try { |
853 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 951 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
854 | int status = jsonObject.optInt("status"); | 952 | int status = jsonObject.optInt("status"); |
855 | if (status == 1) { | 953 | if (status == 1) { |
856 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 954 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
857 | ((Activity) mContext).finish(); | 955 | ((Activity) mContext).finish(); |
858 | } else { | 956 | } else { |
859 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 957 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
860 | 958 | ||
861 | } | 959 | } |
862 | } catch (JSONException e) { | 960 | } catch (JSONException e) { |
863 | e.printStackTrace(); | 961 | e.printStackTrace(); |
864 | } | 962 | } |
865 | 963 | ||
866 | } | 964 | } |
867 | 965 | ||
868 | @Override | 966 | @Override |
869 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 967 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
870 | closeProgress(); | 968 | closeProgress(); |
871 | Log.e("test", "错误信息" + new String(arg2)); | 969 | Log.e("test", "错误信息" + new String(arg2)); |
872 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 970 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
873 | } | 971 | } |
874 | }); | 972 | }); |
875 | 973 | ||
876 | } | 974 | } |
877 | 975 | ||
878 | /** | 976 | /** |
879 | * 添加子账户信息 | 977 | * 添加子账户信息 |
880 | */ | 978 | */ |
881 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 979 | public void addchildAccountinfo(final Context mContext, long parentId, String image, |
882 | String name, Long grade, Object school, Long region | 980 | String name, final Long grade, Object school, Long region |
883 | , String deviceNumber, String regionName) { | 981 | , String deviceNumber, String regionName) { |
884 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 982 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
885 | false, true, null); | 983 | false, true, null); |
886 | RequestParams params = new RequestParams(); | 984 | RequestParams params = new RequestParams(); |
887 | 985 | ||
888 | params.put(HttpKey.PARENTID, parentId); | 986 | params.put(HttpKey.PARENTID, parentId); |
889 | params.put(HttpKey.IMAGE, image); | 987 | params.put(HttpKey.IMAGE, image); |
890 | params.put(HttpKey.NAME, name); | 988 | params.put(HttpKey.NAME, name); |
891 | params.put(HttpKey.GRADE, grade); | 989 | params.put(HttpKey.GRADE, grade); |
892 | params.put(HttpKey.SCHOOL, school); | 990 | params.put(HttpKey.SCHOOL, school); |
893 | params.put(HttpKey.REGION, region); | 991 | params.put(HttpKey.REGION, region); |
894 | params.put(HttpKey.DEVINUMBER, deviceNumber); | 992 | params.put(HttpKey.DEVINUMBER, deviceNumber); |
895 | params.put(HttpKey.REGIONNAME, regionName); | 993 | params.put(HttpKey.REGIONNAME, regionName); |
896 | 994 | ||
897 | Log.e("test", "子账户信息" + params); | 995 | Log.e("test", "子账户信息" + params); |
898 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 996 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
899 | HttpClient.getInstance().setTimeout(5 * 1000); | 997 | HttpClient.getInstance().setTimeout(5 * 1000); |
900 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 998 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
901 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 999 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
902 | @Override | 1000 | @Override |
903 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1001 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
904 | closeProgress(); | 1002 | closeProgress(); |
905 | 1003 | ||
906 | Log.e("test", "子账户信息" + new String(arg2)); | 1004 | Log.e("test", "子账户信息" + new String(arg2)); |
907 | try { | 1005 | try { |
908 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1006 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
909 | int status = jsonObject.optInt("status"); | 1007 | int status = jsonObject.optInt("status"); |
910 | if (status == 1) { | 1008 | if (status == 1) { |
911 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1009 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
912 | ((Activity) mContext).finish(); | 1010 | ((Activity) mContext).finish(); |
913 | } else { | 1011 | } else { |
914 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1012 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
915 | 1013 | ||
916 | } | 1014 | } |
917 | } catch (JSONException e) { | 1015 | } catch (JSONException e) { |
918 | e.printStackTrace(); | 1016 | e.printStackTrace(); |
919 | } | 1017 | } |
920 | 1018 | ||
921 | } | 1019 | } |
922 | 1020 | ||
923 | @Override | 1021 | @Override |
924 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1022 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
925 | closeProgress(); | 1023 | closeProgress(); |
926 | Log.e("test", "错误信息" + new String(arg2)); | 1024 | Log.e("test", "错误信息" + new String(arg2)); |
927 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1025 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
928 | } | 1026 | } |
929 | }); | 1027 | }); |
930 | 1028 | ||
931 | } | 1029 | } |
932 | 1030 | ||
933 | /** | 1031 | /** |
934 | * 切换子账户信息 | 1032 | * 切换子账户信息 |
935 | * | 1033 | * |
936 | * @param mContext | 1034 | * @param mContext |
937 | * @param subAccountId | 1035 | * @param subAccountId |
938 | */ | 1036 | */ |
939 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId | 1037 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId |
940 | , String deviceNumber, int type) { | 1038 | , String deviceNumber, int type) { |
941 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1039 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
942 | false, true, null); | 1040 | false, true, null); |
943 | HttpClient.getInstance().setTimeout(5 * 1000); | 1041 | HttpClient.getInstance().setTimeout(5 * 1000); |
944 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1042 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
945 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId | 1043 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId |
946 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { | 1044 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { |
947 | @Override | 1045 | @Override |
948 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1046 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
949 | closeProgress(); | 1047 | closeProgress(); |
950 | Log.e("test", "子账户信息" + new String(arg2)); | 1048 | Log.e("test", "子账户信息" + new String(arg2)); |
951 | try { | 1049 | try { |
952 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1050 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
953 | int status = jsonObject.optInt("status"); | 1051 | int status = jsonObject.optInt("status"); |
954 | if (status == 1) { | 1052 | if (status == 1) { |
955 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1053 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
956 | ((Activity) mContext).finish(); | 1054 | ((Activity) mContext).finish(); |
957 | 1055 | ||
958 | } else { | 1056 | } else { |
959 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1057 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
960 | 1058 | ||
961 | } | 1059 | } |
962 | } catch (JSONException e) { | 1060 | } catch (JSONException e) { |
963 | e.printStackTrace(); | 1061 | e.printStackTrace(); |
964 | } | 1062 | } |
965 | 1063 | ||
966 | } | 1064 | } |
967 | 1065 | ||
968 | @Override | 1066 | @Override |
969 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1067 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
970 | closeProgress(); | 1068 | closeProgress(); |
971 | Log.e("test", "错误信息" + new String(arg2)); | 1069 | Log.e("test", "错误信息" + new String(arg2)); |
972 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1070 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
973 | } | 1071 | } |
974 | }); | 1072 | }); |
975 | 1073 | ||
976 | } | 1074 | } |
977 | 1075 | ||
978 | /** | 1076 | /** |
979 | * 切换主账户信息 | 1077 | * 切换主账户信息 |
980 | * | 1078 | * |
981 | * @param mContext | 1079 | * @param mContext |
982 | * @param type | 1080 | * @param type |
983 | */ | 1081 | */ |
984 | public void Accountinfo(final Context mContext, long userId | 1082 | public void Accountinfo(final Context mContext, long userId |
985 | , String deviceNumber, int type) { | 1083 | , String deviceNumber, int type) { |
986 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", | 1084 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", |
987 | false, true, null); | 1085 | false, true, null); |
988 | HttpClient.getInstance().setTimeout(5 * 1000); | 1086 | HttpClient.getInstance().setTimeout(5 * 1000); |
989 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1087 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
990 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber | 1088 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber |
991 | + "&type=" + type, new AsyncHttpResponseHandler() { | 1089 | + "&type=" + type, new AsyncHttpResponseHandler() { |
992 | @Override | 1090 | @Override |
993 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1091 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
994 | closeProgress(); | 1092 | closeProgress(); |
995 | Log.e("test", "子账户信息" + new String(arg2)); | 1093 | Log.e("test", "子账户信息" + new String(arg2)); |
996 | try { | 1094 | try { |
997 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1095 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
998 | int status = jsonObject.optInt("status"); | 1096 | int status = jsonObject.optInt("status"); |
999 | if (status == 1) { | 1097 | if (status == 1) { |
1000 | AlertUtils.showToast(mContext, "主账号切换成功!"); | 1098 | AlertUtils.showToast(mContext, "主账号切换成功!"); |
1001 | ((Activity) mContext).finish(); | 1099 | ((Activity) mContext).finish(); |
1002 | 1100 | ||
1003 | } else { | 1101 | } else { |
1004 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); | 1102 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); |
1005 | 1103 | ||
1006 | } | 1104 | } |
1007 | } catch (JSONException e) { | 1105 | } catch (JSONException e) { |
1008 | e.printStackTrace(); | 1106 | e.printStackTrace(); |
1009 | } | 1107 | } |
1010 | 1108 | ||
1011 | } | 1109 | } |
1012 | 1110 | ||
1013 | @Override | 1111 | @Override |
1014 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1112 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1015 | closeProgress(); | 1113 | closeProgress(); |
1016 | Log.e("test", "错误信息" + new String(arg2)); | 1114 | Log.e("test", "错误信息" + new String(arg2)); |
1017 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1115 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1018 | } | 1116 | } |
1019 | }); | 1117 | }); |
1020 | 1118 | ||
1021 | } | 1119 | } |
1022 | 1120 | ||
1023 | /** | 1121 | /** |
1024 | * 头像拍张 | 1122 | * 头像拍张 |
1025 | * | 1123 | * |
1026 | * @param mContext | 1124 | * @param mContext |
1027 | * @param userId | 1125 | * @param userId |
1028 | * @param img | 1126 | * @param img |
1029 | * @throws UnsupportedEncodingException | 1127 | * @throws UnsupportedEncodingException |
1030 | */ | 1128 | */ |
1031 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { | 1129 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { |
1032 | File file = new File(img); | 1130 | File file = new File(img); |
1033 | if (file.exists() && file.length() > 0) { | 1131 | if (file.exists() && file.length() > 0) { |
1034 | RequestParams params = new RequestParams(); | 1132 | RequestParams params = new RequestParams(); |
1035 | try { | 1133 | try { |
1036 | params.put("userId", userId); | 1134 | params.put("userId", userId); |
1037 | params.put("type", type); | 1135 | params.put("type", type); |
1038 | params.put("img", file); | 1136 | params.put("img", file); |
1039 | } catch (FileNotFoundException e) { | 1137 | } catch (FileNotFoundException e) { |
1040 | e.printStackTrace(); | 1138 | e.printStackTrace(); |
1041 | } | 1139 | } |
1042 | Log.e("test", "params" + params); | 1140 | Log.e("test", "params" + params); |
1043 | HttpClient.getInstance().setTimeout(5 * 1000); | 1141 | HttpClient.getInstance().setTimeout(5 * 1000); |
1044 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { | 1142 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { |
1045 | @Override | 1143 | @Override |
1046 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1144 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
1047 | Log.e("test", "onSuccess" + new String(bytes)); | 1145 | Log.e("test", "onSuccess" + new String(bytes)); |
1048 | try { | 1146 | try { |
1049 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1147 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
1050 | String status = jsonObject.optString("status"); | 1148 | String status = jsonObject.optString("status"); |
1051 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); | 1149 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); |
1052 | String imagUrl = jsonObject1.optString("imgUrl"); | 1150 | String imagUrl = jsonObject1.optString("imgUrl"); |
1053 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); | 1151 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); |
1054 | if (status.equals("1")) { | 1152 | if (status.equals("1")) { |
1055 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1153 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
1056 | } else { | 1154 | } else { |
1057 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1155 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
1058 | } | 1156 | } |
1059 | } catch (JSONException e) { | 1157 | } catch (JSONException e) { |
1060 | e.printStackTrace(); | 1158 | e.printStackTrace(); |
1061 | } | 1159 | } |
1062 | } | 1160 | } |
1063 | 1161 | ||
1064 | @Override | 1162 | @Override |
1065 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1163 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
1066 | closeProgress(); | 1164 | closeProgress(); |
1067 | Log.e("test", "错误信息" + new String(bytes)); | 1165 | Log.e("test", "错误信息" + new String(bytes)); |
1068 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1166 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1069 | 1167 | ||
1070 | } | 1168 | } |
1071 | }); | 1169 | }); |
1072 | } else { | 1170 | } else { |
1073 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 1171 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); |
1074 | } | 1172 | } |
1075 | } | 1173 | } |
1076 | /** | 1174 | /** |
1077 | * 头像默认 | 1175 | * 头像默认 |
1078 | * | 1176 | * |
1079 | * @param mContext | 1177 | * @param mContext |
1080 | * @param userId | 1178 | * @param userId |
1081 | * @param | 1179 | * @param |
1082 | * @throws UnsupportedEncodingException | 1180 | * @throws UnsupportedEncodingException |
1083 | */ | 1181 | */ |
1084 | public void headerdeft(final Context mContext, String userId, String type,String defaultImg) throws UnsupportedEncodingException { | 1182 | public void headerdeft(final Context mContext, String userId, String type,String defaultImg) throws UnsupportedEncodingException { |
1085 | RequestParams params = new RequestParams(); | 1183 | RequestParams params = new RequestParams(); |
1086 | params.put("userId", userId); | 1184 | params.put("userId", userId); |
1087 | params.put("type", type); | 1185 | params.put("type", type); |
1088 | params.put("defaultImg", defaultImg); | 1186 | params.put("defaultImg", defaultImg); |
1089 | Log.e("test", "params" + params); | 1187 | Log.e("test", "params" + params); |
1090 | HttpClient.getInstance().setTimeout(5 * 1000); | 1188 | HttpClient.getInstance().setTimeout(5 * 1000); |
1091 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { | 1189 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { |
1092 | @Override | 1190 | @Override |
1093 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1191 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
1094 | Log.e("test", "onSuccess" + new String(bytes)); | 1192 | Log.e("test", "onSuccess" + new String(bytes)); |
1095 | try { | 1193 | try { |
1096 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1194 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
1097 | String status = jsonObject.optString("status"); | 1195 | String status = jsonObject.optString("status"); |
1098 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); | 1196 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); |
1099 | String imagUrl = jsonObject1.optString("imgUrl"); | 1197 | String imagUrl = jsonObject1.optString("imgUrl"); |
1100 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); | 1198 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); |
1101 | if (status.equals("1")) { | 1199 | if (status.equals("1")) { |
1102 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1200 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
1103 | } else { | 1201 | } else { |
1104 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1202 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
1105 | } | 1203 | } |
1106 | } catch (JSONException e) { | 1204 | } catch (JSONException e) { |
1107 | e.printStackTrace(); | 1205 | e.printStackTrace(); |
1108 | } | 1206 | } |
1109 | } | 1207 | } |
1110 | 1208 | ||
1111 | @Override | 1209 | @Override |
1112 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1210 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
1113 | closeProgress(); | 1211 | closeProgress(); |
1114 | Log.e("test", "错误信息" + new String(bytes)); | 1212 | Log.e("test", "错误信息" + new String(bytes)); |
1115 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1213 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1116 | 1214 | ||
1117 | } | 1215 | } |
1118 | }); | 1216 | }); |
1119 | } | 1217 | } |
1120 | 1218 | ||
1121 | /** | 1219 | /** |
1122 | * 检查注册信息是否完整 | 1220 | * 检查注册信息是否完整 |
1123 | * @param mContext | 1221 | * @param mContext |
1124 | * @param userId | 1222 | * @param userId |
1125 | */ | 1223 | */ |
1126 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { | 1224 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { |
1127 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", | 1225 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", |
1128 | false, true, null); | 1226 | false, true, null); |
1129 | HttpClient.getInstance().setTimeout(5 * 1000); | 1227 | HttpClient.getInstance().setTimeout(5 * 1000); |
1130 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1228 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1131 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId , new AsyncHttpResponseHandler() { | 1229 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId , new AsyncHttpResponseHandler() { |
1132 | @Override | 1230 | @Override |
1133 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1231 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1134 | closeProgress(); | 1232 | closeProgress(); |
1135 | Log.e("test", "注册信息" + new String(arg2)); | 1233 | Log.e("test", "注册信息" + new String(arg2)); |
1136 | Message msg = Message.obtain(); | 1234 | Message msg = Message.obtain(); |
1137 | msg.what = HttpCode.REGISTER_SUCESS; | 1235 | msg.what = HttpCode.REGISTER_SUCESS; |
1138 | msg.obj = new String(arg2); | 1236 | msg.obj = new String(arg2); |
1139 | handler.sendMessage(msg); | 1237 | handler.sendMessage(msg); |
1140 | 1238 | ||
1141 | } | 1239 | } |
1142 | 1240 | ||
1143 | @Override | 1241 | @Override |
1144 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1242 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1145 | closeProgress(); | 1243 | closeProgress(); |
1146 | // Log.e("test", "错误信息" + new String(arg2)); | 1244 | // Log.e("test", "错误信息" + new String(arg2)); |
1147 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1245 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1148 | 1246 | ||
1149 | } | 1247 | } |
1150 | }); | 1248 | }); |
1151 | 1249 | ||
1152 | } | 1250 | } |
1251 | /** | ||
1252 | * 获取最近学习视频 | ||
1253 | * @param mContext | ||
1254 | * @param userId | ||
1255 | */ | ||
1256 | public void getstuyvidioinfo(final Context mContext, long userId, final Handler handler) { | ||
1257 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", | ||
1258 | false, true, null); | ||
1259 | HttpClient.getInstance().setTimeout(5 * 1000); | ||
1260 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | ||
1261 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId , new AsyncHttpResponseHandler() { | ||
1262 | @Override | ||
1263 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | ||
1264 | closeProgress(); | ||
1265 | Log.e("test", "近学习视频" + new String(arg2)); | ||
1266 | try { | ||
1267 | JSONObject jsonObject = new JSONObject(new String(arg2)); | ||
1268 | int status = jsonObject.optInt("status"); | ||
1269 | if (status == 1) { | ||
1270 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 | ||
1271 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); | ||
1272 | Message msg = Message.obtain(); | ||
1273 | msg.what = HttpCode.GETVIDIO_SUCESS; | ||
1274 | msg.obj = schoolInfoBeanList; | ||
1275 | handler.sendMessage(msg); | ||
1276 | |||
1277 | }else { | ||
1278 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | ||
1279 | |||
1280 | } | ||
1281 | } catch (JSONException e) { | ||
1282 | e.printStackTrace(); | ||
1283 | |||
1284 | } | ||
1285 | |||
1286 | } | ||
1287 | |||
1288 | @Override | ||
1289 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | ||
1290 | closeProgress(); | ||
1291 | // Log.e("test", "错误信息" + new String(arg2)); | ||
1292 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | ||
1293 | |||
1294 | } | ||
1295 | }); | ||
1296 | |||
1297 | } | ||
1298 | |||
1153 | 1299 | ||
1154 | /** | 1300 | /** |
1155 | * 系统升级 | 1301 | * 系统升级 |
1156 | * | 1302 | * |
1157 | * @param mContext | 1303 | * @param mContext |
1158 | * @param pid appName | 1304 | * @param pid appName |
1159 | */ | 1305 | */ |
1160 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1306 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
1161 | mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", | 1307 | mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", |
1162 | false, true, null); | 1308 | false, true, null); |
1163 | HttpClient.getInstance().setTimeout(5 * 1000); | 1309 | HttpClient.getInstance().setTimeout(5 * 1000); |
1164 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1310 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1165 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1311 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
1166 | @Override | 1312 | @Override |
1167 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1313 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1168 | closeProgress(); | 1314 | closeProgress(); |
1169 | Log.e("test", "版本升级信息" + new String(arg2)); | 1315 | Log.e("test", "版本升级信息" + new String(arg2)); |
1170 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 | 1316 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 |
1171 | Message msg = Message.obtain(); | 1317 | Message msg = Message.obtain(); |
1172 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1318 | msg.what = HttpCode.APPUPDATE_SUCESS; |
1173 | msg.obj = appVersion; | 1319 | msg.obj = appVersion; |
1174 | handler.sendMessage(msg); | 1320 | handler.sendMessage(msg); |
1175 | 1321 | ||
1176 | 1322 | ||
1177 | } | 1323 | } |
1178 | 1324 | ||
1179 | @Override | 1325 | @Override |
1180 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1326 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1181 | closeProgress(); | 1327 | closeProgress(); |
1182 | Log.e("test", "错误信息" + new String(arg2)); | 1328 | Log.e("test", "错误信息" + new String(arg2)); |
1183 | } | 1329 | } |
1184 | }); | 1330 | }); |
1185 | 1331 | ||
1186 | } | 1332 | } |
1187 | //版本信息 | 1333 | //版本信息 |
1188 | public void versioninfo(final Context mContext,String subjectName, final Handler handler) { | 1334 | public void versioninfo(final Context mContext,String subjectName, final Handler handler) { |
1189 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1335 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1190 | HttpClient.getInstance().get(HttpUrl.getversionURL+"?subjectName="+subjectName, new AsyncHttpResponseHandler() { | 1336 | HttpClient.getInstance().get(HttpUrl.getversionURL+"?subjectName="+subjectName, new AsyncHttpResponseHandler() { |
1191 | @Override | 1337 | @Override |
1192 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1338 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1193 | Log.e("test", "版本信息" + new String(arg2)); | 1339 | Log.e("test", "版本信息" + new String(arg2)); |
1194 | try { | 1340 | try { |
1195 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1341 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1196 | int status = jsonObject.optInt("status"); | 1342 | int status = jsonObject.optInt("status"); |
1197 | if (status == 1) { | 1343 | if (status == 1) { |
1198 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 | 1344 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 |
1199 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); | 1345 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); |
1200 | Message message = Message.obtain(); | 1346 | Message message = Message.obtain(); |
1201 | message.what = HttpCode.VERSION_SUCESS; | 1347 | message.what = HttpCode.VERSION_SUCESS; |
1202 | message.obj = versionInfoList; | 1348 | message.obj = versionInfoList; |
1203 | handler.sendMessage(message); | 1349 | handler.sendMessage(message); |
1204 | 1350 | ||
1205 | } else if(status == 1000){ | 1351 | } else if(status == 1000){ |
1206 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); | 1352 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); |
1207 | 1353 | ||
1208 | }else { | 1354 | }else { |
1209 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1355 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1210 | } | 1356 | } |
1211 | } catch (JSONException e) { | 1357 | } catch (JSONException e) { |
1212 | e.printStackTrace(); | 1358 | e.printStackTrace(); |
1213 | } | 1359 | } |
1214 | 1360 | ||
1215 | 1361 | ||
1216 | } | 1362 | } |
1217 | 1363 | ||
1218 | @Override | 1364 | @Override |
1219 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1365 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1220 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1366 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1221 | } | 1367 | } |
1222 | }); | 1368 | }); |
1223 | } | 1369 | } |
1224 | 1370 | ||
1225 | 1371 | ||
1226 | 1372 | ||
1227 | 1373 | ||
1228 | 1374 | ||
1229 | 1375 | ||
1230 | ///省级接口 | 1376 | ///省级接口 |
1231 | public void provices(final Context mContext, final Handler handler) { | 1377 | public void provices(final Context mContext, final Handler handler) { |
1232 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1378 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1233 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1379 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
1234 | @Override | 1380 | @Override |
1235 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1381 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1236 | Log.e("test", "省" + new String(arg2)); | 1382 | Log.e("test", "省" + new String(arg2)); |
1237 | try { | 1383 | try { |
1238 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1384 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1239 | int status = jsonObject.optInt("status"); | 1385 | int status = jsonObject.optInt("status"); |
1240 | if (status == 100) { | 1386 | if (status == 100) { |
1241 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1387 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
1242 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1388 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
1243 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1389 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
1244 | Message message = Message.obtain(); | 1390 | Message message = Message.obtain(); |
1245 | message.what = HttpCode.PROVICES; | 1391 | message.what = HttpCode.PROVICES; |
1246 | message.obj = provincesBeanList; | 1392 | message.obj = provincesBeanList; |
1247 | handler.sendMessage(message); | 1393 | handler.sendMessage(message); |
1248 | 1394 | ||
1249 | 1395 | ||
1250 | } else { | 1396 | } else { |
1251 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1397 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1252 | 1398 | ||
1253 | } | 1399 | } |
1254 | } catch (JSONException e) { | 1400 | } catch (JSONException e) { |
1255 | e.printStackTrace(); | 1401 | e.printStackTrace(); |
1256 | } | 1402 | } |
1257 | 1403 | ||
1258 | 1404 | ||
1259 | } | 1405 | } |
1260 | 1406 | ||
1261 | @Override | 1407 | @Override |
1262 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1408 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1263 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1409 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1264 | } | 1410 | } |
1265 | }); | 1411 | }); |
1266 | } | 1412 | } |
1267 | //获取版本信息接口 | 1413 | //获取版本信息接口 |
1268 | public void getpublishinfo(final Context mContext, long userId,int gradeId, final Handler handler) { | 1414 | public void getpublishinfo(final Context mContext, long userId,int gradeId, final Handler handler) { |
1269 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1415 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1270 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 1416 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
1271 | @Override | 1417 | @Override |
1272 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1418 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1273 | Log.e("test", "获取版本信息接口" + new String(arg2)); | 1419 | Log.e("test", "获取版本信息接口" + new String(arg2)); |
1274 | try { | 1420 | try { |
1275 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1421 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1276 | int status = jsonObject.optInt("status"); | 1422 | int status = jsonObject.optInt("status"); |
1277 | if (status == 1) { | 1423 | if (status == 1) { |
1278 | Gson gson = new Gson(); | 1424 | Gson gson = new Gson(); |
1279 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); | 1425 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); |
1280 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); | 1426 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); |
1281 | Message message = Message.obtain(); | 1427 | Message message = Message.obtain(); |
1282 | message.what = HttpCode.PUBLISH_SUCESS; | 1428 | message.what = HttpCode.PUBLISH_SUCESS; |
1283 | message.obj = defautPublishInfoBeanList; | 1429 | message.obj = defautPublishInfoBeanList; |
1284 | handler.sendMessage(message); | 1430 | handler.sendMessage(message); |
1285 | 1431 | ||
1286 | } else { | 1432 | } else { |
1287 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1433 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1288 | 1434 | ||
1289 | } | 1435 | } |
1290 | } catch (JSONException e) { | 1436 | } catch (JSONException e) { |
1291 | e.printStackTrace(); | 1437 | e.printStackTrace(); |
1292 | } | 1438 | } |
1293 | 1439 | ||
1294 | 1440 | ||
1295 | } | 1441 | } |
1296 | 1442 | ||
1297 | @Override | 1443 | @Override |
1298 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1444 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1299 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1445 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1300 | } | 1446 | } |
1301 | }); | 1447 | }); |
1302 | } | 1448 | } |
1303 | 1449 | ||
1304 | 1450 | ||
1305 | //市级接口 | 1451 | //市级接口 |
1306 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1452 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
1307 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1453 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1308 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1454 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
1309 | @Override | 1455 | @Override |
1310 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1456 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1311 | Log.e("test", "市" + new String(arg2)); | 1457 | Log.e("test", "市" + new String(arg2)); |
1312 | try { | 1458 | try { |
1313 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1459 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1314 | int status = jsonObject.optInt("status"); | 1460 | int status = jsonObject.optInt("status"); |
1315 | if (status == 100) { | 1461 | if (status == 100) { |
1316 | Gson gson = new Gson(); | 1462 | Gson gson = new Gson(); |
1317 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1463 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
1318 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1464 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
1319 | Message message = Message.obtain(); | 1465 | Message message = Message.obtain(); |
1320 | message.what = HttpCode.CITYS; | 1466 | message.what = HttpCode.CITYS; |
1321 | message.obj = cityInfoBeanList; | 1467 | message.obj = cityInfoBeanList; |
1322 | handler.sendMessage(message); | 1468 | handler.sendMessage(message); |
1323 | 1469 | ||
1324 | } else { | 1470 | } else { |
1325 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1471 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1326 | 1472 | ||
1327 | } | 1473 | } |
1328 | } catch (JSONException e) { | 1474 | } catch (JSONException e) { |
1329 | e.printStackTrace(); | 1475 | e.printStackTrace(); |
1330 | } | 1476 | } |
1331 | 1477 | ||
1332 | 1478 | ||
1333 | } | 1479 | } |
1334 | 1480 | ||
1335 | @Override | 1481 | @Override |
1336 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1482 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1337 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1483 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1338 | } | 1484 | } |
1339 | }); | 1485 | }); |
1340 | } | 1486 | } |
1341 | 1487 | ||
1342 | //区县级接口 | 1488 | //区县级接口 |
1343 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1489 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
1344 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1490 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1345 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1491 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
1346 | @Override | 1492 | @Override |
1347 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1493 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1348 | Log.e("test", "区" + new String(arg2)); | 1494 | Log.e("test", "区" + new String(arg2)); |
1349 | try { | 1495 | try { |
1350 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1496 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1351 | int status = jsonObject.optInt("status"); | 1497 | int status = jsonObject.optInt("status"); |
1352 | if (status == 100) { | 1498 | if (status == 100) { |
1353 | Gson gson = new Gson(); | 1499 | Gson gson = new Gson(); |
1354 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1500 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
1355 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1501 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
1356 | Message message = Message.obtain(); | 1502 | Message message = Message.obtain(); |
1357 | message.what = HttpCode.COUNTRY; | 1503 | message.what = HttpCode.COUNTRY; |
1358 | message.obj = countyInfoInfoBeanList; | 1504 | message.obj = countyInfoInfoBeanList; |
1359 | handler.sendMessage(message); | 1505 | handler.sendMessage(message); |
1360 | } else { | 1506 | } else { |
1361 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1507 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1362 | 1508 | ||
1363 | } | 1509 | } |
1364 | } catch (JSONException e) { | 1510 | } catch (JSONException e) { |
1365 | e.printStackTrace(); | 1511 | e.printStackTrace(); |
1366 | } | 1512 | } |
1367 | 1513 | ||
1368 | 1514 | ||
1369 | } | 1515 | } |
1370 | 1516 | ||
1371 | @Override | 1517 | @Override |
1372 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1518 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1373 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1519 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1374 | } | 1520 | } |
1375 | }); | 1521 | }); |
1376 | } | 1522 | } |
1377 | 1523 | ||
1378 | 1524 | ||
1379 | private void closeProgress() { | 1525 | private void closeProgress() { |
1380 | try { | 1526 | try { |
1381 | if (mProgress != null) { | 1527 | if (mProgress != null) { |
1382 | mProgress.dismiss(); | 1528 | mProgress.dismiss(); |
1383 | mProgress = null; | 1529 | mProgress = null; |
1384 | } | 1530 | } |
1385 | } catch (Exception e) { | 1531 | } catch (Exception e) { |
1386 | e.printStackTrace(); | 1532 | e.printStackTrace(); |
1387 | } | 1533 | } |
1388 | } | 1534 | } |
1535 | public boolean onKeyDown(int keyCode, KeyEvent event) | ||
1536 | { | ||
1537 | if (keyCode == KeyEvent.KEYCODE_BACK ) | ||
1538 | { | ||
1539 | |||
1540 | HttpManager.getInstance().closeProgress(); | ||
1541 | } | ||
1542 | |||
1543 | return false; | ||
1544 | |||
1545 | } | ||
1389 | 1546 | ||
1390 | } | 1547 | } |
1391 | 1548 |
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 | public static String getversionURL=GetDomain()+"/press/list";//获取版本信息 |
42 | public static String isRegisterInfoCompleteURL=GetDomain()+"/register/extrainfo/check";//注册信息是否完整 | 42 | public static String isRegisterInfoCompleteURL=GetDomain()+"/register/extrainfo/check";//注册信息是否完整 |
43 | public static String getpublishURL=GetDomain()+"/userPress/info";//获取版本信息 | 43 | public static String getpublishURL=GetDomain()+"/userPress/info";//获取版本信息 |
44 | public static String getvidioURL=GetDomain()+"/personal/video/recent";//获取最近学习视频 | ||
45 | public static String submitregisterURL=GetDomain()+"/register/extrainfo/submit";//提交注册信息 | ||
46 | public static String chagepublishURL=GetDomain()+"/userPress/update";//修改版本信息 | ||
44 | 47 | ||
45 | 48 | ||
46 | 49 | ||
47 | 50 | ||
48 | 51 | ||
49 | 52 | ||
50 | } | 53 | } |
51 | 54 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/ChildsInfo.java
1 | package com.hjx.personalcenter.model; | 1 | package com.hjx.personalcenter.model; |
2 | 2 | ||
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | import java.util.List; | 4 | import java.util.List; |
5 | 5 | ||
6 | /** | 6 | /** |
7 | * Created by h on 2017/8/26. | 7 | * Created by h on 2017/8/26. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | public class ChildsInfo implements Serializable { | 10 | public class ChildsInfo implements Serializable { |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * status : 1 | 13 | * status : 1 |
14 | * pageSize : 1 | 14 | * pageSize : 1 |
15 | * data : [{"region":"河北秦皇岛青龙bgggg","parentId":0,"school":"静海四小","status":"已使用","name":"xfffff","grade":"四年级","image":"http://hjxprodbucket.oss.aliyuncs.com//static/upload/online_api/mobile_portrait/2017-07-24/bd2a3d6a-a131-4cc4-b166-3da14555a96f.jpg","type":1,"deviceNumber":"012345678912345","subAccountId":0},{"region":"天津河东","parentId":7000000054678906,"school":"天津河东区九号路小学","status":"未使用","name":"xiongwei","grade":"二年级","image":"http://hjxprodbucket.oss.aliyuncs.com/http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png","type":2,"deviceNumber":"012345678912345","subAccountId":"f38cf157d0944cf9b279a3abc31cf21f"}] | 15 | * data : [{"region":"河北秦皇岛青龙bgggg","parentId":0,"school":"静海四小","status":"已使用","name":"xfffff","grade":"四年级","image":"http://hjxprodbucket.oss.aliyuncs.com//static/upload/online_api/mobile_portrait/2017-07-24/bd2a3d6a-a131-4cc4-b166-3da14555a96f.jpg","type":1,"deviceNumber":"012345678912345","subAccountId":0},{"region":"天津河东","parentId":7000000054678906,"school":"天津河东区九号路小学","status":"未使用","name":"xiongwei","grade":"二年级","image":"http://hjxprodbucket.oss.aliyuncs.com/http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png","type":2,"deviceNumber":"012345678912345","subAccountId":"f38cf157d0944cf9b279a3abc31cf21f"}] |
16 | * msg : success | 16 | * msg : success |
17 | * pageNum : 2 | 17 | * pageNum : 2 |
18 | */ | 18 | */ |
19 | 19 | ||
20 | private int status; | 20 | private int status; |
21 | private int pageSize; | 21 | private int pageSize; |
22 | private String msg; | 22 | private String msg; |
23 | private int pageNum; | 23 | private int pageNum; |
24 | private List<DataBean> data; | 24 | private List<DataBean> data; |
25 | 25 | ||
26 | public int getStatus() { | 26 | public int getStatus() { |
27 | return status; | 27 | return status; |
28 | } | 28 | } |
29 | 29 | ||
30 | public void setStatus(int status) { | 30 | public void setStatus(int status) { |
31 | this.status = status; | 31 | this.status = status; |
32 | } | 32 | } |
33 | 33 | ||
34 | public int getPageSize() { | 34 | public int getPageSize() { |
35 | return pageSize; | 35 | return pageSize; |
36 | } | 36 | } |
37 | 37 | ||
38 | public void setPageSize(int pageSize) { | 38 | public void setPageSize(int pageSize) { |
39 | this.pageSize = pageSize; | 39 | this.pageSize = pageSize; |
40 | } | 40 | } |
41 | 41 | ||
42 | public String getMsg() { | 42 | public String getMsg() { |
43 | return msg; | 43 | return msg; |
44 | } | 44 | } |
45 | 45 | ||
46 | public void setMsg(String msg) { | 46 | public void setMsg(String msg) { |
47 | this.msg = msg; | 47 | this.msg = msg; |
48 | } | 48 | } |
49 | 49 | ||
50 | public int getPageNum() { | 50 | public int getPageNum() { |
51 | return pageNum; | 51 | return pageNum; |
52 | } | 52 | } |
53 | 53 | ||
54 | public void setPageNum(int pageNum) { | 54 | public void setPageNum(int pageNum) { |
55 | this.pageNum = pageNum; | 55 | this.pageNum = pageNum; |
56 | } | 56 | } |
57 | 57 | ||
58 | public List<DataBean> getData() { | 58 | public List<DataBean> getData() { |
59 | return data; | 59 | return data; |
60 | } | 60 | } |
61 | 61 | ||
62 | public void setData(List<DataBean> data) { | 62 | public void setData(List<DataBean> data) { |
63 | this.data = data; | 63 | this.data = data; |
64 | } | 64 | } |
65 | 65 | ||
66 | public static class DataBean { | 66 | public static class DataBean { |
67 | /** | 67 | /** |
68 | * region : 河北秦皇岛青龙bgggg | 68 | * region : 河北秦皇岛青龙bgggg |
69 | * parentId : 0 | 69 | * parentId : 0 |
70 | * school : 静海四小 | 70 | * school : 静海四小 |
71 | * status : 已使用 | 71 | * status : 已使用 |
72 | * name : xfffff | 72 | * name : xfffff |
73 | * grade : 四年级 | 73 | * grade : 四年级 |
74 | * image : http://hjxprodbucket.oss.aliyuncs.com//static/upload/online_api/mobile_portrait/2017-07-24/bd2a3d6a-a131-4cc4-b166-3da14555a96f.jpg | 74 | * image : http://hjxprodbucket.oss.aliyuncs.com//static/upload/online_api/mobile_portrait/2017-07-24/bd2a3d6a-a131-4cc4-b166-3da14555a96f.jpg |
75 | * type : 1 | 75 | * type : 1 |
76 | * deviceNumber : 012345678912345 | 76 | * deviceNumber : 012345678912345 |
77 | * subAccountId : 0 | 77 | * subAccountId : 0 |
78 | */ | 78 | */ |
79 | 79 | ||
80 | private String region; | 80 | private String region; |
81 | private Long parentId; | 81 | private Long parentId; |
82 | private String school; | 82 | private String school; |
83 | private String status; | 83 | private String status; |
84 | private String name; | 84 | private String name; |
85 | private String grade; | 85 | private String grade; |
86 | private String image; | 86 | private String image; |
87 | |||
88 | public String getGradeId() { | ||
89 | return gradeId; | ||
90 | } | ||
91 | |||
92 | public void setGradeId(String gradeId) { | ||
93 | this.gradeId = gradeId; | ||
94 | } | ||
95 | |||
96 | private String gradeId; | ||
87 | private int type; | 97 | private int type; |
88 | private String deviceNumber; | 98 | private String deviceNumber; |
89 | private String subAccountId; | 99 | private String subAccountId; |
90 | 100 | ||
91 | public String getRegion() { | 101 | public String getRegion() { |
92 | return region; | 102 | return region; |
93 | } | 103 | } |
94 | 104 | ||
95 | public void setRegion(String region) { | 105 | public void setRegion(String region) { |
96 | this.region = region; | 106 | this.region = region; |
97 | } | 107 | } |
98 | 108 | ||
99 | public Long getParentId() { | 109 | public Long getParentId() { |
100 | return parentId; | 110 | return parentId; |
101 | } | 111 | } |
102 | 112 | ||
103 | public void setParentId(Long parentId) { | 113 | public void setParentId(Long parentId) { |
104 | this.parentId = parentId; | 114 | this.parentId = parentId; |
105 | } | 115 | } |
106 | 116 | ||
107 | public String getSchool() { | 117 | public String getSchool() { |
108 | return school; | 118 | return school; |
109 | } | 119 | } |
110 | 120 | ||
111 | public void setSchool(String school) { | 121 | public void setSchool(String school) { |
112 | this.school = school; | 122 | this.school = school; |
113 | } | 123 | } |
114 | 124 | ||
115 | public String getStatus() { | 125 | public String getStatus() { |
116 | return status; | 126 | return status; |
117 | } | 127 | } |
118 | 128 | ||
119 | public void setStatus(String status) { | 129 | public void setStatus(String status) { |
120 | this.status = status; | 130 | this.status = status; |
121 | } | 131 | } |
122 | 132 | ||
123 | public String getName() { | 133 | public String getName() { |
124 | return name; | 134 | return name; |
125 | } | 135 | } |
126 | 136 | ||
127 | public void setName(String name) { | 137 | public void setName(String name) { |
128 | this.name = name; | 138 | this.name = name; |
129 | } | 139 | } |
130 | 140 | ||
131 | public String getGrade() { | 141 | public String getGrade() { |
132 | return grade; | 142 | return grade; |
133 | } | 143 | } |
134 | 144 | ||
135 | public void setGrade(String grade) { | 145 | public void setGrade(String grade) { |
136 | this.grade = grade; | 146 | this.grade = grade; |
137 | } | 147 | } |
138 | 148 | ||
139 | public String getImage() { | 149 | public String getImage() { |
140 | return image; | 150 | return image; |
141 | } | 151 | } |
142 | 152 | ||
143 | public void setImage(String image) { | 153 | public void setImage(String image) { |
144 | this.image = image; | 154 | this.image = image; |
145 | } | 155 | } |
146 | 156 | ||
147 | public int getType() { | 157 | public int getType() { |
148 | return type; | 158 | return type; |
149 | } | 159 | } |
150 | 160 | ||
151 | public void setType(int type) { | 161 | public void setType(int type) { |
152 | this.type = type; | 162 | this.type = type; |
153 | } | 163 | } |
154 | 164 | ||
155 | public String getDeviceNumber() { | 165 | public String getDeviceNumber() { |
156 | return deviceNumber; | 166 | return deviceNumber; |
157 | } | 167 | } |
158 | 168 | ||
159 | public void setDeviceNumber(String deviceNumber) { | 169 | public void setDeviceNumber(String deviceNumber) { |
160 | this.deviceNumber = deviceNumber; | 170 | this.deviceNumber = deviceNumber; |
161 | } | 171 | } |
162 | 172 | ||
163 | public String getSubAccountId() { | 173 | public String getSubAccountId() { |
164 | return subAccountId; | 174 | return subAccountId; |
165 | } | 175 | } |
166 | 176 | ||
167 | public void setSubAccountId(String subAccountId) { | 177 | public void setSubAccountId(String subAccountId) { |
168 | this.subAccountId = subAccountId; | 178 | this.subAccountId = subAccountId; |
169 | } | 179 | } |
170 | } | 180 | } |
171 | } | 181 | } |
172 | 182 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/VideoInfo.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/15. | ||
8 | */ | ||
9 | |||
10 | public class VideoInfo implements Serializable { | ||
11 | |||
12 | /** | ||
13 | * status : 1 | ||
14 | * pageSize : 0 | ||
15 | * data : [{"videoCover":"http://hjxprodbucket.oss.aliyuncs.com/static/upload/online_api/mobile_portrait/2017-09-06/1e03835a-48fd-425e-8ab4-662968ee5377.png","videoUrl":"rtmp://vplay.xuexiao100.com/oflaDemo/M16-FLV/黄冈视频/小学数学/5年级上 北京版(北京出版社)(2014版)/北京数学5上_05 方程一.flv","videoName":"北京数学5上_05 方程一"},{"videoCover":"http://hjxprodbucket.oss.aliyuncs.com/static/upload/online_api/mobile_portrait/2017-09-06/1e03835a-48fd-425e-8ab4-662968ee5377.png","videoUrl":"rtmp://vplay.xuexiao100.com/oflaDemo/M16-FLV/黄冈视频/小学数学/5年级上 北京版(北京出版社)(2014版)/北京数学5上_05 方程一.flv","videoName":"北京数学5上_05 方程一"},{"videoCover":"http://hjxprodbucket.oss.aliyuncs.com/static/upload/online_api/mobile_portrait/2017-09-06/1e03835a-48fd-425e-8ab4-662968ee5377.png","videoUrl":"rtmp://vplay.xuexiao100.com/oflaDemo/M16-FLV/黄冈视频/小学数学/5年级上 北京版(北京出版社)(2014版)/北京数学5上_05 方程一.flv","videoName":"北京数学5上_05 方程一"},{"videoCover":"http://hjxprodbucket.oss.aliyuncs.com/static/upload/online_api/mobile_portrait/2017-09-06/1e03835a-48fd-425e-8ab4-662968ee5377.png","videoUrl":"rtmp://vplay.xuexiao100.com/oflaDemo/M16-FLV/黄冈视频/小学数学/5年级上 北京版(北京出版社)(2014版)/北京数学5上_05 方程一.flv","videoName":"北京数学5上_05 方程一"},{"videoCover":"http://hjxprodbucket.oss.aliyuncs.com/static/upload/online_api/mobile_portrait/2017-09-06/1e03835a-48fd-425e-8ab4-662968ee5377.png","videoUrl":"rtmp://vplay.xuexiao100.com/oflaDemo/M16-FLV/黄冈视频/小学数学/5年级上 北京版(北京出版社)(2014版)/北京数学5上_05 方程一.flv","videoName":"北京数学5上_05 方程一"},{"videoCover":"http://hjxprodbucket.oss.aliyuncs.com/static/upload/online_api/mobile_portrait/2017-09-06/1e03835a-48fd-425e-8ab4-662968ee5377.png","videoUrl":"rtmp://vplay.xuexiao100.com/oflaDemo/M16-FLV/黄冈视频/小学数学/5年级上 北京版(北京出版社)(2014版)/北京数学5上_05 方程一.flv","videoName":"北京数学5上_05 方程一"}] | ||
16 | * msg : success | ||
17 | * pageNum : 0 | ||
18 | */ | ||
19 | |||
20 | private int status; | ||
21 | private int pageSize; | ||
22 | private String msg; | ||
23 | private int pageNum; | ||
24 | private List<DataBean> data; | ||
25 | |||
26 | public void setStatus(int status) { | ||
27 | this.status = status; | ||
28 | } | ||
29 | |||
30 | public void setPageSize(int pageSize) { | ||
31 | this.pageSize = pageSize; | ||
32 | } | ||
33 | |||
34 | public void setMsg(String msg) { | ||
35 | this.msg = msg; | ||
36 | } | ||
37 | |||
38 | public void setPageNum(int pageNum) { | ||
39 | this.pageNum = pageNum; | ||
40 | } | ||
41 | |||
42 | public void setData(List<DataBean> data) { | ||
43 | this.data = data; | ||
44 | } | ||
45 | |||
46 | public int getStatus() { | ||
47 | return status; | ||
48 | } | ||
49 | |||
50 | public int getPageSize() { | ||
51 | return pageSize; | ||
52 | } | ||
53 | |||
54 | public String getMsg() { | ||
55 | return msg; | ||
56 | } | ||
57 | |||
58 | public int getPageNum() { | ||
59 | return pageNum; | ||
60 | } | ||
61 | |||
62 | public List<DataBean> getData() { | ||
63 | return data; | ||
64 | } | ||
65 | |||
66 | public static class DataBean { | ||
67 | /** | ||
68 | * videoCover : http://hjxprodbucket.oss.aliyuncs.com/static/upload/online_api/mobile_portrait/2017-09-06/1e03835a-48fd-425e-8ab4-662968ee5377.png | ||
69 | * videoUrl : rtmp://vplay.xuexiao100.com/oflaDemo/M16-FLV/黄冈视频/小学数学/5年级上 北京版(北京出版社)(2014版)/北京数学5上_05 方程一.flv | ||
70 | * videoName : 北京数学5上_05 方程一 | ||
71 | */ | ||
72 | |||
73 | private String videoCover; | ||
74 | private String videoUrl; | ||
75 | private String videoName; | ||
76 | |||
77 | public void setVideoCover(String videoCover) { | ||
78 | this.videoCover = videoCover; | ||
79 | } | ||
80 | |||
81 | public void setVideoUrl(String videoUrl) { | ||
82 | this.videoUrl = videoUrl; | ||
83 | } | ||
84 | |||
85 | public void setVideoName(String videoName) { | ||
86 | this.videoName = videoName; | ||
87 | } | ||
88 | |||
89 | public String getVideoCover() { | ||
90 | return videoCover; | ||
91 | } | ||
92 | |||
93 | public String getVideoUrl() { | ||
94 | return videoUrl; | ||
95 | } | ||
96 | |||
97 | public String getVideoName() { | ||
98 | return videoName; | ||
99 | } | ||
100 | } | ||
101 | } | ||
102 |
PersonalCenter/app/src/main/res/layout/activity_electroniccard_info.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | 7 | ||
8 | <RelativeLayout | 8 | <RelativeLayout |
9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
12 | android:background="@color/login_text_blue" | 12 | android:background="@color/login_text_blue" |
13 | android:minHeight="50dp"> | 13 | android:minHeight="50dp"> |
14 | 14 | ||
15 | <ImageView | 15 | <ImageView |
16 | android:id="@+id/iv_card_back" | 16 | android:id="@+id/iv_card_back" |
17 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
19 | android:layout_centerVertical="true" | 19 | android:layout_centerVertical="true" |
20 | android:paddingLeft="20dp" | 20 | android:paddingLeft="20dp" |
21 | android:paddingRight="20dp" | 21 | android:paddingRight="20dp" |
22 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
23 | 23 | ||
24 | <TextView | 24 | <TextView |
25 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
29 | android:text="@string/change_electroniccard_info_fill" | 29 | android:text="@string/change_electroniccard_info_fill" |
30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
32 | </RelativeLayout> | 32 | </RelativeLayout> |
33 | 33 | ||
34 | <ImageView | 34 | <ImageView |
35 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
36 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
37 | android:layout_gravity="center" | 37 | android:layout_gravity="center" |
38 | android:layout_marginTop="20dp" | 38 | android:layout_marginTop="20dp" |
39 | android:src="@mipmap/change_info_icon" /> | 39 | android:src="@mipmap/change_info_icon" /> |
40 | 40 | ||
41 | <LinearLayout | 41 | <LinearLayout |
42 | android:layout_width="wrap_content" | 42 | android:layout_width="wrap_content" |
43 | android:layout_height="wrap_content" | 43 | android:layout_height="wrap_content" |
44 | android:layout_marginTop="60dp" | 44 | android:layout_marginTop="60dp" |
45 | android:orientation="horizontal"> | 45 | android:orientation="horizontal"> |
46 | 46 | ||
47 | <View | 47 | <View |
48 | android:layout_width="450dp" | 48 | android:layout_width="450dp" |
49 | android:layout_height="0.7dp" | 49 | android:layout_height="0.7dp" |
50 | android:layout_marginLeft="150dp" | 50 | android:layout_marginLeft="150dp" |
51 | android:background="@color/cutoff_line"> | 51 | android:background="@color/cutoff_line"> |
52 | 52 | ||
53 | </View> | 53 | </View> |
54 | 54 | ||
55 | <View | 55 | <View |
56 | android:layout_width="450dp" | 56 | android:layout_width="450dp" |
57 | android:layout_height="0.7dp" | 57 | android:layout_height="0.7dp" |
58 | android:layout_marginLeft="80dp" | 58 | android:layout_marginLeft="80dp" |
59 | android:background="@color/cutoff_line"> | 59 | android:background="@color/cutoff_line"> |
60 | 60 | ||
61 | </View> | 61 | </View> |
62 | 62 | ||
63 | 63 | ||
64 | </LinearLayout> | 64 | </LinearLayout> |
65 | 65 | ||
66 | <LinearLayout | 66 | <LinearLayout |
67 | android:layout_width="match_parent" | 67 | android:layout_width="match_parent" |
68 | android:layout_height="wrap_content" | 68 | android:layout_height="wrap_content" |
69 | android:layout_marginLeft="200dp" | 69 | android:layout_marginLeft="200dp" |
70 | android:gravity="center_vertical" | 70 | android:gravity="center_vertical" |
71 | android:orientation="horizontal"> | 71 | android:orientation="horizontal"> |
72 | 72 | ||
73 | <LinearLayout | 73 | <LinearLayout |
74 | android:layout_width="0dp" | 74 | android:layout_width="0dp" |
75 | android:layout_height="80dp" | 75 | android:layout_height="80dp" |
76 | android:layout_weight="1" | 76 | android:layout_weight="1" |
77 | android:gravity="center_vertical"> | 77 | android:gravity="center_vertical"> |
78 | 78 | ||
79 | <TextView | 79 | <TextView |
80 | android:layout_width="wrap_content" | 80 | android:layout_width="wrap_content" |
81 | android:layout_height="wrap_content" | 81 | android:layout_height="wrap_content" |
82 | android:text="客户姓名" | 82 | android:text="客户姓名" |
83 | android:textSize="22sp" /> | 83 | android:textSize="22sp" /> |
84 | 84 | ||
85 | <EditText | 85 | <EditText |
86 | android:id="@+id/et_edit_username" | 86 | android:id="@+id/et_edit_username" |
87 | android:layout_width="wrap_content" | 87 | android:layout_width="wrap_content" |
88 | android:layout_height="wrap_content" | 88 | android:layout_height="wrap_content" |
89 | android:layout_marginLeft="50dp" | 89 | android:layout_marginLeft="50dp" |
90 | android:background="@null" | 90 | android:background="@null" |
91 | android:textColor="@color/electronic_text" | 91 | android:textColor="@color/electronic_text" |
92 | android:hint="请输入" | 92 | android:hint="请输入" |
93 | android:textSize="22sp" /> | 93 | android:textSize="22sp" /> |
94 | 94 | ||
95 | </LinearLayout> | 95 | </LinearLayout> |
96 | 96 | ||
97 | <LinearLayout | 97 | <LinearLayout |
98 | android:layout_width="0dp" | 98 | android:layout_width="0dp" |
99 | android:layout_height="80dp" | 99 | android:layout_height="80dp" |
100 | android:layout_weight="1" | 100 | android:layout_weight="1" |
101 | android:gravity="center_vertical"> | 101 | android:gravity="center_vertical"> |
102 | 102 | ||
103 | <TextView | 103 | <TextView |
104 | android:layout_width="150dp" | 104 | android:layout_width="150dp" |
105 | android:layout_height="wrap_content" | 105 | android:layout_height="wrap_content" |
106 | android:text="购买地址" | 106 | android:text="购买地址" |
107 | android:textSize="22sp" /> | 107 | android:textSize="22sp" /> |
108 | 108 | ||
109 | <TextView | 109 | <TextView |
110 | android:id="@+id/tv_edit_adress_shop" | 110 | android:id="@+id/tv_edit_adress_shop" |
111 | android:layout_width="wrap_content" | 111 | android:layout_width="wrap_content" |
112 | android:layout_height="wrap_content" | 112 | android:layout_height="wrap_content" |
113 | android:layout_marginLeft="20dp" | 113 | android:layout_marginLeft="20dp" |
114 | android:textColor="@color/electronic_text" | 114 | android:textColor="@color/electronic_text" |
115 | android:hint="请选择地区" | 115 | android:hint="请选择地区" |
116 | android:textSize="22sp" /> | 116 | android:textSize="22sp" /> |
117 | 117 | ||
118 | <ImageView | 118 | <ImageView |
119 | android:id="@+id/shopdizhi" | ||
119 | android:layout_width="wrap_content" | 120 | android:layout_width="wrap_content" |
120 | android:layout_height="wrap_content" | 121 | android:layout_height="wrap_content" |
121 | android:layout_marginLeft="60dp" | 122 | android:layout_marginLeft="60dp" |
122 | android:src="@mipmap/xiajiantou"> | 123 | android:src="@mipmap/xiajiantou"> |
123 | 124 | ||
124 | </ImageView> | 125 | </ImageView> |
125 | </LinearLayout> | 126 | </LinearLayout> |
126 | 127 | ||
127 | </LinearLayout> | 128 | </LinearLayout> |
128 | 129 | ||
129 | <LinearLayout | 130 | <LinearLayout |
130 | android:layout_width="wrap_content" | 131 | android:layout_width="wrap_content" |
131 | android:layout_height="wrap_content" | 132 | android:layout_height="wrap_content" |
132 | android:orientation="horizontal"> | 133 | android:orientation="horizontal"> |
133 | 134 | ||
134 | <View | 135 | <View |
135 | android:layout_width="450dp" | 136 | android:layout_width="450dp" |
136 | android:layout_height="0.7dp" | 137 | android:layout_height="0.7dp" |
137 | android:layout_marginLeft="150dp" | 138 | android:layout_marginLeft="150dp" |
138 | android:background="@color/cutoff_line"> | 139 | android:background="@color/cutoff_line"> |
139 | 140 | ||
140 | </View> | 141 | </View> |
141 | 142 | ||
142 | <View | 143 | <View |
143 | android:layout_width="450dp" | 144 | android:layout_width="450dp" |
144 | android:layout_height="0.7dp" | 145 | android:layout_height="0.7dp" |
145 | android:layout_marginLeft="80dp" | 146 | android:layout_marginLeft="80dp" |
146 | android:background="@color/cutoff_line"> | 147 | android:background="@color/cutoff_line"> |
147 | 148 | ||
148 | </View> | 149 | </View> |
149 | 150 | ||
150 | 151 | ||
151 | </LinearLayout> | 152 | </LinearLayout> |
152 | 153 | ||
153 | <LinearLayout | 154 | <LinearLayout |
154 | android:layout_width="match_parent" | 155 | android:layout_width="match_parent" |
155 | android:layout_height="wrap_content" | 156 | android:layout_height="wrap_content" |
156 | android:layout_marginLeft="200dp" | 157 | android:layout_marginLeft="200dp" |
157 | android:gravity="center_vertical" | 158 | android:gravity="center_vertical" |
158 | android:orientation="horizontal"> | 159 | android:orientation="horizontal"> |
159 | 160 | ||
160 | <LinearLayout | 161 | <LinearLayout |
161 | android:layout_width="0dp" | 162 | android:layout_width="0dp" |
162 | android:layout_height="80dp" | 163 | android:layout_height="80dp" |
163 | android:layout_weight="1" | 164 | android:layout_weight="1" |
164 | android:gravity="center_vertical"> | 165 | android:gravity="center_vertical"> |
165 | 166 | ||
166 | <TextView | 167 | <TextView |
167 | android:layout_width="wrap_content" | 168 | android:layout_width="wrap_content" |
168 | android:layout_height="wrap_content" | 169 | android:layout_height="wrap_content" |
169 | android:text="客户地址" | 170 | android:text="客户地址" |
170 | android:textSize="22sp" /> | 171 | android:textSize="22sp" /> |
171 | 172 | ||
172 | <TextView | 173 | <TextView |
173 | android:id="@+id/tv_edit_adress_custem" | 174 | android:id="@+id/tv_edit_adress_custem" |
174 | android:layout_width="wrap_content" | 175 | android:layout_width="wrap_content" |
175 | android:layout_height="wrap_content" | 176 | android:layout_height="wrap_content" |
176 | android:layout_marginLeft="50dp" | 177 | android:layout_marginLeft="50dp" |
177 | android:textColor="@color/electronic_text" | 178 | android:textColor="@color/electronic_text" |
178 | android:hint="请选择地区" | 179 | android:hint="请选择地区" |
179 | android:textSize="22sp" /> | 180 | android:textSize="22sp" /> |
180 | 181 | ||
181 | <ImageView | 182 | <ImageView |
183 | android:id="@+id/cunstomdizhi" | ||
182 | android:layout_width="wrap_content" | 184 | android:layout_width="wrap_content" |
183 | android:layout_height="wrap_content" | 185 | android:layout_height="wrap_content" |
184 | android:layout_marginLeft="60dp" | 186 | android:layout_marginLeft="60dp" |
185 | android:src="@mipmap/xiajiantou"> | 187 | android:src="@mipmap/xiajiantou"> |
186 | 188 | ||
187 | </ImageView> | 189 | </ImageView> |
188 | 190 | ||
189 | 191 | ||
190 | </LinearLayout> | 192 | </LinearLayout> |
191 | 193 | ||
192 | <LinearLayout | 194 | <LinearLayout |
193 | android:layout_width="0dp" | 195 | android:layout_width="0dp" |
194 | android:layout_height="80dp" | 196 | android:layout_height="80dp" |
195 | android:layout_weight="1" | 197 | android:layout_weight="1" |
196 | android:gravity="center_vertical"> | 198 | android:gravity="center_vertical"> |
197 | 199 | ||
198 | <TextView | 200 | <TextView |
199 | android:layout_width="150dp" | 201 | android:layout_width="150dp" |
200 | android:layout_height="wrap_content" | 202 | android:layout_height="wrap_content" |
201 | android:text=" " | 203 | android:text=" " |
202 | android:textColor="@color/white" | 204 | android:textColor="@color/white" |
203 | android:textSize="22sp" /> | 205 | android:textSize="22sp" /> |
204 | 206 | ||
205 | <EditText | 207 | <EditText |
206 | android:id="@+id/et_edit_store" | 208 | android:id="@+id/et_edit_store" |
207 | android:layout_width="wrap_content" | 209 | android:layout_width="wrap_content" |
208 | android:layout_height="wrap_content" | 210 | android:layout_height="wrap_content" |
209 | android:layout_marginLeft="20dp" | 211 | android:layout_marginLeft="20dp" |
210 | android:background="@null" | 212 | android:background="@null" |
211 | android:textColor="@color/electronic_text" | 213 | android:textColor="@color/electronic_text" |
212 | android:hint="请输入商店名称" | 214 | android:hint="请输入商店名称" |
213 | android:textSize="22sp" /> | 215 | android:textSize="22sp" /> |
214 | 216 | ||
215 | </LinearLayout> | 217 | </LinearLayout> |
216 | 218 | ||
217 | </LinearLayout> | 219 | </LinearLayout> |
218 | 220 | ||
219 | <LinearLayout | 221 | <LinearLayout |
220 | android:layout_width="wrap_content" | 222 | android:layout_width="wrap_content" |
221 | android:layout_height="wrap_content" | 223 | android:layout_height="wrap_content" |
222 | 224 | ||
223 | android:orientation="horizontal"> | 225 | android:orientation="horizontal"> |
224 | 226 | ||
225 | <View | 227 | <View |
226 | android:layout_width="450dp" | 228 | android:layout_width="450dp" |
227 | android:layout_height="0.7dp" | 229 | android:layout_height="0.7dp" |
228 | android:layout_marginLeft="150dp" | 230 | android:layout_marginLeft="150dp" |
229 | android:background="@color/cutoff_line"> | 231 | android:background="@color/cutoff_line"> |
230 | 232 | ||
231 | </View> | 233 | </View> |
232 | 234 | ||
233 | <View | 235 | <View |
234 | android:layout_width="450dp" | 236 | android:layout_width="450dp" |
235 | android:layout_height="0.7dp" | 237 | android:layout_height="0.7dp" |
236 | android:layout_marginLeft="80dp" | 238 | android:layout_marginLeft="80dp" |
237 | android:background="@color/cutoff_line"> | 239 | android:background="@color/cutoff_line"> |
238 | 240 | ||
239 | </View> | 241 | </View> |
240 | 242 | ||
241 | 243 | ||
242 | </LinearLayout> | 244 | </LinearLayout> |
243 | 245 | ||
244 | <LinearLayout | 246 | <LinearLayout |
245 | android:layout_width="match_parent" | 247 | android:layout_width="match_parent" |
246 | android:layout_height="wrap_content" | 248 | android:layout_height="wrap_content" |
247 | android:layout_marginLeft="200dp" | 249 | android:layout_marginLeft="200dp" |
248 | android:gravity="center_vertical" | 250 | android:gravity="center_vertical" |
249 | android:orientation="horizontal"> | 251 | android:orientation="horizontal"> |
250 | 252 | ||
251 | <LinearLayout | 253 | <LinearLayout |
252 | android:layout_width="0dp" | 254 | android:layout_width="0dp" |
253 | android:layout_height="80dp" | 255 | android:layout_height="80dp" |
254 | android:layout_weight="1" | 256 | android:layout_weight="1" |
255 | android:gravity="center_vertical"> | 257 | android:gravity="center_vertical"> |
256 | 258 | ||
257 | <TextView | 259 | <TextView |
258 | android:layout_width="wrap_content" | 260 | android:layout_width="wrap_content" |
259 | android:layout_height="wrap_content" | 261 | android:layout_height="wrap_content" |
260 | android:text=" " | 262 | android:text=" " |
261 | android:textColor="@color/white" | 263 | android:textColor="@color/white" |
262 | android:textSize="22sp" /> | 264 | android:textSize="22sp" /> |
263 | 265 | ||
264 | <EditText | 266 | <EditText |
265 | android:id="@+id/et_edit_adress_detail" | 267 | android:id="@+id/et_edit_adress_detail" |
266 | android:layout_width="wrap_content" | 268 | android:layout_width="wrap_content" |
267 | android:layout_height="wrap_content" | 269 | android:layout_height="wrap_content" |
268 | android:layout_marginLeft="100dp" | 270 | android:layout_marginLeft="100dp" |
269 | android:background="@null" | 271 | android:background="@null" |
270 | android:textColor="@color/electronic_text" | 272 | android:textColor="@color/electronic_text" |
271 | android:hint="请输入详细地址" | 273 | android:hint="请输入详细地址" |
272 | android:textSize="22sp" /> | 274 | android:textSize="22sp" /> |
273 | 275 | ||
274 | </LinearLayout> | 276 | </LinearLayout> |
275 | 277 | ||
276 | <LinearLayout | 278 | <LinearLayout |
277 | android:layout_width="0dp" | 279 | android:layout_width="0dp" |
278 | android:layout_height="80dp" | 280 | android:layout_height="80dp" |
279 | android:layout_weight="1" | 281 | android:layout_weight="1" |
280 | android:gravity="center_vertical"> | 282 | android:gravity="center_vertical"> |
281 | 283 | ||
282 | <TextView | 284 | <TextView |
283 | android:layout_width="150dp" | 285 | android:layout_width="150dp" |
284 | android:layout_height="wrap_content" | 286 | android:layout_height="wrap_content" |
285 | android:text="本地售后电话" | 287 | android:text="本地售后电话" |
286 | android:textSize="22sp" /> | 288 | android:textSize="22sp" /> |
287 | 289 | ||
288 | <EditText | 290 | <EditText |
289 | android:id="@+id/et_edit_telphone" | 291 | android:id="@+id/et_edit_telphone" |
290 | android:layout_width="wrap_content" | 292 | android:layout_width="wrap_content" |
291 | android:layout_height="wrap_content" | 293 | android:layout_height="wrap_content" |
292 | android:layout_marginLeft="20dp" | 294 | android:layout_marginLeft="20dp" |
293 | android:background="@null" | 295 | android:background="@null" |
294 | android:textColor="@color/electronic_text" | 296 | android:textColor="@color/electronic_text" |
295 | android:hint="请输入" | 297 | android:hint="请输入" |
296 | android:textSize="22sp" /> | 298 | android:textSize="22sp" /> |
297 | </LinearLayout> | 299 | </LinearLayout> |
298 | 300 | ||
299 | </LinearLayout> | 301 | </LinearLayout> |
300 | 302 | ||
301 | <LinearLayout | 303 | <LinearLayout |
302 | android:layout_width="wrap_content" | 304 | android:layout_width="wrap_content" |
303 | android:layout_height="wrap_content" | 305 | android:layout_height="wrap_content" |
304 | 306 | ||
305 | android:orientation="horizontal"> | 307 | android:orientation="horizontal"> |
306 | 308 | ||
307 | <View | 309 | <View |
308 | android:layout_width="450dp" | 310 | android:layout_width="450dp" |
309 | android:layout_height="0.7dp" | 311 | android:layout_height="0.7dp" |
310 | android:layout_marginLeft="150dp" | 312 | android:layout_marginLeft="150dp" |
311 | android:background="@color/cutoff_line"> | 313 | android:background="@color/cutoff_line"> |
312 | 314 | ||
313 | </View> | 315 | </View> |
314 | 316 | ||
315 | <View | 317 | <View |
316 | android:layout_width="450dp" | 318 | android:layout_width="450dp" |
317 | android:layout_height="0.7dp" | 319 | android:layout_height="0.7dp" |
318 | android:layout_marginLeft="80dp" | 320 | android:layout_marginLeft="80dp" |
319 | android:background="@color/cutoff_line"> | 321 | android:background="@color/cutoff_line"> |
320 | 322 | ||
321 | </View> | 323 | </View> |
322 | 324 | ||
323 | 325 | ||
324 | </LinearLayout> | 326 | </LinearLayout> |
325 | 327 | ||
326 | <LinearLayout | 328 | <LinearLayout |
327 | android:layout_width="match_parent" | 329 | android:layout_width="match_parent" |
328 | android:layout_height="wrap_content" | 330 | android:layout_height="wrap_content" |
329 | android:layout_marginLeft="200dp" | 331 | android:layout_marginLeft="200dp" |
330 | android:gravity="center_vertical" | 332 | android:gravity="center_vertical" |
331 | android:orientation="horizontal"> | 333 | android:orientation="horizontal"> |
332 | 334 | ||
333 | <LinearLayout | 335 | <LinearLayout |
334 | android:id="@+id/lineL_buy_time" | 336 | android:id="@+id/lineL_buy_time" |
335 | android:layout_width="0dp" | 337 | android:layout_width="0dp" |
336 | android:layout_height="80dp" | 338 | android:layout_height="80dp" |
337 | android:layout_weight="1" | 339 | android:layout_weight="1" |
338 | android:gravity="center_vertical"> | 340 | android:gravity="center_vertical"> |
339 | 341 | ||
340 | <TextView | 342 | <TextView |
341 | android:layout_width="wrap_content" | 343 | android:layout_width="wrap_content" |
342 | android:layout_height="wrap_content" | 344 | android:layout_height="wrap_content" |
343 | android:text="购买时间" | 345 | android:text="购买时间" |
344 | android:textSize="22sp" /> | 346 | android:textSize="22sp" /> |
345 | 347 | ||
346 | <TextView | 348 | <TextView |
347 | android:id="@+id/tv_buy_time" | 349 | android:id="@+id/tv_buy_time" |
348 | android:layout_width="wrap_content" | 350 | android:layout_width="wrap_content" |
349 | android:layout_height="wrap_content" | 351 | android:layout_height="wrap_content" |
350 | android:layout_marginLeft="50dp" | 352 | android:layout_marginLeft="50dp" |
351 | android:hint="请选择时间" | 353 | android:hint="请选择时间" |
352 | android:textSize="22sp" /> | 354 | android:textSize="22sp" /> |
353 | 355 | ||
354 | </LinearLayout> | 356 | </LinearLayout> |
355 | 357 | ||
356 | </LinearLayout> | 358 | </LinearLayout> |
357 | 359 | ||
358 | <LinearLayout | 360 | <LinearLayout |
359 | android:layout_width="wrap_content" | 361 | android:layout_width="wrap_content" |
360 | android:layout_height="wrap_content" | 362 | android:layout_height="wrap_content" |
361 | android:orientation="horizontal"> | 363 | android:orientation="horizontal"> |
362 | 364 | ||
363 | <View | 365 | <View |
364 | android:layout_width="450dp" | 366 | android:layout_width="450dp" |
365 | android:layout_height="0.7dp" | 367 | android:layout_height="0.7dp" |
366 | android:layout_marginLeft="150dp" | 368 | android:layout_marginLeft="150dp" |
367 | android:background="@color/cutoff_line"> | 369 | android:background="@color/cutoff_line"> |
368 | 370 | ||
369 | </View> | 371 | </View> |
370 | 372 | ||
371 | 373 | ||
372 | </LinearLayout> | 374 | </LinearLayout> |
373 | 375 | ||
374 | <Button | 376 | <Button |
375 | android:id="@+id/btn_change_info" | 377 | android:id="@+id/btn_change_info" |
376 | style="@style/button_login_register_style" | 378 | style="@style/button_login_register_style" |
377 | android:layout_marginLeft="200dp" | 379 | android:layout_marginLeft="200dp" |
378 | android:layout_marginRight="200dp" | 380 | android:layout_marginRight="200dp" |
379 | android:layout_marginTop="80dp" | 381 | android:layout_marginTop="80dp" |
380 | android:text="@string/string_regist_next" /> | 382 | android:text="@string/string_regist_next" /> |
381 | 383 | ||
382 | 384 | ||
383 | </LinearLayout> | 385 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/activity_main.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | 7 | ||
8 | <RelativeLayout | 8 | <RelativeLayout |
9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="50dp" | 11 | android:layout_height="50dp" |
12 | android:background="@color/login_text_blue"> | 12 | android:background="@color/login_text_blue"> |
13 | 13 | ||
14 | <ImageView | 14 | <ImageView |
15 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
16 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
17 | android:layout_height="match_parent" | 17 | android:layout_height="match_parent" |
18 | android:paddingLeft="20dp" | 18 | android:paddingLeft="20dp" |
19 | android:paddingRight="20dp" | 19 | android:paddingRight="20dp" |
20 | android:visibility="gone" | 20 | android:visibility="gone" |
21 | android:src="@mipmap/title_back" /> | 21 | android:src="@mipmap/title_back" /> |
22 | 22 | ||
23 | <TextView | 23 | <TextView |
24 | android:id="@+id/menu_title" | 24 | android:id="@+id/menu_title" |
25 | android:layout_width="wrap_content" | 25 | android:layout_width="wrap_content" |
26 | android:layout_height="match_parent" | 26 | android:layout_height="match_parent" |
27 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
28 | android:gravity="center_vertical" | 28 | android:gravity="center_vertical" |
29 | android:text="@string/titel_preson" | 29 | android:text="@string/titel_preson" |
30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
32 | 32 | ||
33 | <ImageView | 33 | <ImageView |
34 | android:id="@+id/iv_setting" | 34 | android:id="@+id/iv_setting" |
35 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
36 | android:layout_height="match_parent" | 36 | android:layout_height="match_parent" |
37 | android:layout_marginRight="10dp" | 37 | android:layout_marginRight="10dp" |
38 | android:layout_toLeftOf="@+id/iv_skin" | 38 | android:layout_toLeftOf="@+id/iv_skin" |
39 | android:gravity="center_vertical" | 39 | android:gravity="center_vertical" |
40 | android:padding="10dp" | 40 | android:padding="10dp" |
41 | android:src="@mipmap/shezhi" | 41 | android:src="@mipmap/shezhi" |
42 | android:textColor="@android:color/white" | 42 | android:textColor="@android:color/white" |
43 | android:textSize="22sp" /> | 43 | android:textSize="22sp" /> |
44 | 44 | ||
45 | <ImageView | 45 | <ImageView |
46 | android:id="@+id/iv_skin" | 46 | android:id="@+id/iv_skin" |
47 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
48 | android:layout_height="match_parent" | 48 | android:layout_height="match_parent" |
49 | android:layout_marginRight="10dp" | 49 | android:layout_marginRight="10dp" |
50 | android:layout_toLeftOf="@+id/iv_imformatioan" | 50 | android:layout_toLeftOf="@+id/iv_imformatioan" |
51 | android:gravity="center_vertical" | 51 | android:gravity="center_vertical" |
52 | android:padding="10dp" | 52 | android:padding="10dp" |
53 | android:src="@mipmap/pifu" | 53 | android:src="@mipmap/pifu" |
54 | android:textColor="@android:color/white" | 54 | android:textColor="@android:color/white" |
55 | android:textSize="22sp" /> | 55 | android:textSize="22sp" /> |
56 | 56 | ||
57 | <ImageView | 57 | <ImageView |
58 | android:id="@+id/iv_imformatioan" | 58 | android:id="@+id/iv_imformatioan" |
59 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
60 | android:layout_height="match_parent" | 60 | android:layout_height="match_parent" |
61 | android:layout_alignParentRight="true" | 61 | android:layout_alignParentRight="true" |
62 | android:layout_marginRight="10dp" | 62 | android:layout_marginRight="10dp" |
63 | android:gravity="center_vertical" | 63 | android:gravity="center_vertical" |
64 | android:padding="10dp" | 64 | android:padding="10dp" |
65 | android:src="@mipmap/fankui" | 65 | android:src="@mipmap/fankui" |
66 | android:textColor="@android:color/white" | 66 | android:textColor="@android:color/white" |
67 | android:textSize="22sp" /> | 67 | android:textSize="22sp" /> |
68 | 68 | ||
69 | 69 | ||
70 | </RelativeLayout> | 70 | </RelativeLayout> |
71 | 71 | ||
72 | <LinearLayout | 72 | <LinearLayout |
73 | android:layout_width="match_parent" | 73 | android:layout_width="match_parent" |
74 | android:layout_height="match_parent"> | 74 | android:layout_height="match_parent"> |
75 | 75 | ||
76 | <LinearLayout | 76 | <LinearLayout |
77 | android:layout_width="0dp" | 77 | android:layout_width="0dp" |
78 | android:layout_height="match_parent" | 78 | android:layout_height="match_parent" |
79 | android:layout_weight="1" | 79 | android:layout_weight="1" |
80 | android:orientation="vertical"> | 80 | android:orientation="vertical"> |
81 | 81 | ||
82 | <LinearLayout | 82 | <LinearLayout |
83 | android:layout_width="match_parent" | 83 | android:layout_width="match_parent" |
84 | android:layout_height="wrap_content" | 84 | android:layout_height="wrap_content" |
85 | android:layout_marginTop="20dp" | 85 | android:layout_marginTop="20dp" |
86 | android:orientation="horizontal"> | 86 | android:orientation="horizontal"> |
87 | <ImageView | 87 | <ImageView |
88 | android:id="@+id/iv_look_card" | 88 | android:id="@+id/iv_look_card" |
89 | android:layout_width="wrap_content" | 89 | android:layout_width="wrap_content" |
90 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
91 | android:padding="10dp" | 91 | android:padding="10dp" |
92 | android:layout_marginLeft="20dp" | 92 | android:layout_marginLeft="20dp" |
93 | android:src="@mipmap/card_icoc" /> | 93 | android:src="@mipmap/card_icoc" /> |
94 | <com.facebook.drawee.view.SimpleDraweeView | 94 | <com.facebook.drawee.view.SimpleDraweeView |
95 | android:id="@+id/iv_head" | 95 | android:id="@+id/iv_head" |
96 | android:layout_width="60dp" | 96 | android:layout_width="60dp" |
97 | android:layout_height="60dp" | 97 | android:layout_height="60dp" |
98 | android:layout_marginLeft="60dp" | 98 | android:layout_marginLeft="60dp" |
99 | android:layout_gravity="center" | 99 | android:layout_gravity="center" |
100 | fresco:placeholderImage="@mipmap/header_default" | 100 | fresco:placeholderImage="@mipmap/header_default" |
101 | fresco:roundAsCircle="true" | 101 | fresco:roundAsCircle="true" |
102 | fresco:placeholderImageScaleType="fitCenter" /> | 102 | fresco:placeholderImageScaleType="fitCenter" /> |
103 | 103 | ||
104 | <TextView | 104 | <TextView |
105 | android:layout_width="wrap_content" | 105 | android:layout_width="wrap_content" |
106 | android:layout_height="wrap_content" | 106 | android:layout_height="wrap_content" |
107 | android:layout_marginLeft="18dp" | 107 | android:layout_marginLeft="18dp" |
108 | android:layout_marginTop="20dp" | 108 | android:layout_marginTop="20dp" |
109 | android:background="@drawable/corcle_blue_bg" | 109 | android:background="@drawable/corcle_blue_bg" |
110 | android:paddingLeft="5dp" | 110 | android:paddingLeft="5dp" |
111 | android:paddingRight="5dp" | 111 | android:paddingRight="5dp" |
112 | android:gravity="center_vertical" | 112 | android:gravity="center_vertical" |
113 | android:text="签到" | 113 | android:text="签到" |
114 | android:textColor="@color/login_text_blue" | 114 | android:textColor="@color/login_text_blue" |
115 | android:textSize="18sp" /> | 115 | android:textSize="18sp" /> |
116 | 116 | ||
117 | </LinearLayout> | 117 | </LinearLayout> |
118 | 118 | ||
119 | <LinearLayout | 119 | <LinearLayout |
120 | android:layout_width="match_parent" | 120 | android:layout_width="match_parent" |
121 | android:layout_height="wrap_content" | 121 | android:layout_height="wrap_content" |
122 | android:layout_marginLeft="20dp" | 122 | android:layout_marginLeft="20dp" |
123 | android:layout_marginTop="20dp" | 123 | android:layout_marginTop="20dp" |
124 | android:orientation="horizontal"> | 124 | android:orientation="horizontal"> |
125 | 125 | ||
126 | <TextView | 126 | <TextView |
127 | android:id="@+id/tv_username" | 127 | android:id="@+id/tv_username" |
128 | android:layout_width="wrap_content" | 128 | android:layout_width="wrap_content" |
129 | android:layout_height="wrap_content" | 129 | android:layout_height="wrap_content" |
130 | android:text="姓名" | 130 | android:text="姓名" |
131 | android:textSize="20dp" /> | 131 | android:textSize="20dp" /> |
132 | 132 | ||
133 | <ImageView | 133 | <ImageView |
134 | android:id="@+id/iv_sex" | 134 | android:id="@+id/iv_sex" |
135 | android:layout_width="wrap_content" | 135 | android:layout_width="wrap_content" |
136 | android:layout_height="wrap_content" | 136 | android:layout_height="wrap_content" |
137 | android:layout_gravity="center_vertical" | 137 | android:layout_gravity="center_vertical" |
138 | android:layout_marginLeft="50dp" | 138 | android:layout_marginLeft="50dp" |
139 | android:src="@mipmap/men" /> | 139 | android:src="@mipmap/men" /> |
140 | 140 | ||
141 | </LinearLayout> | 141 | </LinearLayout> |
142 | 142 | ||
143 | <LinearLayout | 143 | <LinearLayout |
144 | android:layout_width="match_parent" | 144 | android:layout_width="match_parent" |
145 | android:layout_height="wrap_content" | 145 | android:layout_height="wrap_content" |
146 | android:layout_marginLeft="20dp" | 146 | android:layout_marginLeft="20dp" |
147 | android:layout_marginTop="20dp" | 147 | android:layout_marginTop="20dp" |
148 | android:gravity="center" | 148 | android:gravity="center" |
149 | android:orientation="horizontal"> | 149 | android:orientation="horizontal"> |
150 | 150 | ||
151 | <TextView | 151 | <TextView |
152 | android:id="@+id/tv_sign" | 152 | android:id="@+id/tv_sign" |
153 | android:layout_width="0dp" | 153 | android:layout_width="0dp" |
154 | android:layout_height="wrap_content" | 154 | android:layout_height="wrap_content" |
155 | android:layout_weight="5" | 155 | android:layout_weight="5" |
156 | android:text="请输入个性签名" | 156 | android:text="请输入个性签名" |
157 | android:textSize="18sp" /> | 157 | android:textSize="18sp" /> |
158 | 158 | ||
159 | <ImageView | 159 | <ImageView |
160 | android:id="@+id/iv_sign" | 160 | android:id="@+id/iv_sign" |
161 | android:layout_width="0dp" | 161 | android:layout_width="0dp" |
162 | android:layout_height="wrap_content" | 162 | android:layout_height="wrap_content" |
163 | android:layout_weight="1" | 163 | android:layout_weight="1" |
164 | android:padding="10dp" | 164 | android:padding="10dp" |
165 | android:src="@mipmap/pencil" /> | 165 | android:src="@mipmap/pencil" /> |
166 | 166 | ||
167 | 167 | ||
168 | </LinearLayout> | 168 | </LinearLayout> |
169 | 169 | ||
170 | <View | 170 | <View |
171 | android:layout_width="match_parent" | 171 | android:layout_width="match_parent" |
172 | android:layout_height="0.7dp" | 172 | android:layout_height="0.7dp" |
173 | android:layout_marginTop="20dp" | 173 | android:layout_marginTop="20dp" |
174 | android:background="@color/cutoff_line"> | 174 | android:background="@color/cutoff_line"> |
175 | 175 | ||
176 | </View> | 176 | </View> |
177 | 177 | ||
178 | <LinearLayout | 178 | <LinearLayout |
179 | android:id="@+id/linel_mycuoti" | 179 | android:id="@+id/linel_mycuoti" |
180 | android:layout_width="match_parent" | 180 | android:layout_width="match_parent" |
181 | android:layout_height="wrap_content" | 181 | android:layout_height="wrap_content" |
182 | android:layout_marginTop="30dp" | 182 | android:layout_marginTop="30dp" |
183 | android:orientation="vertical"> | 183 | android:orientation="vertical"> |
184 | 184 | ||
185 | <LinearLayout | 185 | <LinearLayout |
186 | android:layout_width="match_parent" | 186 | android:layout_width="match_parent" |
187 | android:layout_height="wrap_content" | 187 | android:layout_height="wrap_content" |
188 | android:gravity="center_vertical" | 188 | android:gravity="center_vertical" |
189 | android:orientation="horizontal"> | 189 | android:orientation="horizontal"> |
190 | 190 | ||
191 | <ImageView | 191 | <ImageView |
192 | android:layout_width="0dp" | 192 | android:layout_width="0dp" |
193 | android:layout_height="wrap_content" | 193 | android:layout_height="wrap_content" |
194 | android:layout_weight="1" | 194 | android:layout_weight="1" |
195 | android:src="@mipmap/wodecuoti" /> | 195 | android:src="@mipmap/wodecuoti" /> |
196 | 196 | ||
197 | <TextView | 197 | <TextView |
198 | android:layout_width="0dp" | 198 | android:layout_width="0dp" |
199 | android:layout_height="wrap_content" | 199 | android:layout_height="wrap_content" |
200 | android:layout_weight="5" | 200 | android:layout_weight="5" |
201 | android:text="我的错题" | 201 | android:text="我的错题" |
202 | android:textSize="20sp" /> | 202 | android:textSize="20sp" /> |
203 | 203 | ||
204 | <ImageView | 204 | <ImageView |
205 | android:layout_width="0dp" | 205 | android:layout_width="0dp" |
206 | android:layout_height="wrap_content" | 206 | android:layout_height="wrap_content" |
207 | android:layout_weight="1" | 207 | android:layout_weight="1" |
208 | android:src="@mipmap/youjiantou" /> | 208 | android:src="@mipmap/youjiantou" /> |
209 | 209 | ||
210 | </LinearLayout> | 210 | </LinearLayout> |
211 | 211 | ||
212 | <LinearLayout | 212 | <LinearLayout |
213 | android:id="@+id/linel_mynote" | 213 | android:id="@+id/linel_mynote" |
214 | android:layout_width="match_parent" | 214 | android:layout_width="match_parent" |
215 | android:layout_height="wrap_content" | 215 | android:layout_height="wrap_content" |
216 | android:layout_marginTop="35dp" | 216 | android:layout_marginTop="35dp" |
217 | android:gravity="center_vertical" | 217 | android:gravity="center_vertical" |
218 | android:orientation="horizontal"> | 218 | android:orientation="horizontal"> |
219 | 219 | ||
220 | <ImageView | 220 | <ImageView |
221 | android:layout_width="0dp" | 221 | android:layout_width="0dp" |
222 | android:layout_height="wrap_content" | 222 | android:layout_height="wrap_content" |
223 | android:layout_weight="1" | 223 | android:layout_weight="1" |
224 | android:src="@mipmap/wodebiji" /> | 224 | android:src="@mipmap/wodebiji" /> |
225 | 225 | ||
226 | <TextView | 226 | <TextView |
227 | android:layout_width="0dp" | 227 | android:layout_width="0dp" |
228 | android:layout_height="wrap_content" | 228 | android:layout_height="wrap_content" |
229 | android:layout_weight="5" | 229 | android:layout_weight="5" |
230 | android:text="我的笔记" | 230 | android:text="我的笔记" |
231 | android:textSize="20sp" /> | 231 | android:textSize="20sp" /> |
232 | 232 | ||
233 | <ImageView | 233 | <ImageView |
234 | android:layout_width="0dp" | 234 | android:layout_width="0dp" |
235 | android:layout_height="wrap_content" | 235 | android:layout_height="wrap_content" |
236 | android:layout_weight="1" | 236 | android:layout_weight="1" |
237 | android:src="@mipmap/youjiantou" /> | 237 | android:src="@mipmap/youjiantou" /> |
238 | 238 | ||
239 | </LinearLayout> | 239 | </LinearLayout> |
240 | 240 | ||
241 | <LinearLayout | 241 | <LinearLayout |
242 | android:id="@+id/linel_mycollege" | 242 | android:id="@+id/linel_mycollege" |
243 | android:layout_width="match_parent" | 243 | android:layout_width="match_parent" |
244 | android:layout_height="wrap_content" | 244 | android:layout_height="wrap_content" |
245 | android:layout_marginTop="35dp" | 245 | android:layout_marginTop="35dp" |
246 | android:gravity="center_vertical" | 246 | android:gravity="center_vertical" |
247 | android:orientation="horizontal"> | 247 | android:orientation="horizontal"> |
248 | 248 | ||
249 | <ImageView | 249 | <ImageView |
250 | android:layout_width="0dp" | 250 | android:layout_width="0dp" |
251 | android:layout_height="wrap_content" | 251 | android:layout_height="wrap_content" |
252 | android:layout_weight="1" | 252 | android:layout_weight="1" |
253 | android:src="@mipmap/wodeshoucang" /> | 253 | android:src="@mipmap/wodeshoucang" /> |
254 | 254 | ||
255 | <TextView | 255 | <TextView |
256 | android:layout_width="0dp" | 256 | android:layout_width="0dp" |
257 | android:layout_height="wrap_content" | 257 | android:layout_height="wrap_content" |
258 | android:layout_weight="5" | 258 | android:layout_weight="5" |
259 | android:text="我的收藏" | 259 | android:text="我的收藏" |
260 | android:textSize="20sp" /> | 260 | android:textSize="20sp" /> |
261 | 261 | ||
262 | <ImageView | 262 | <ImageView |
263 | android:layout_width="0dp" | 263 | android:layout_width="0dp" |
264 | android:layout_height="wrap_content" | 264 | android:layout_height="wrap_content" |
265 | android:layout_weight="1" | 265 | android:layout_weight="1" |
266 | android:src="@mipmap/youjiantou" /> | 266 | android:src="@mipmap/youjiantou" /> |
267 | 267 | ||
268 | </LinearLayout> | 268 | </LinearLayout> |
269 | 269 | ||
270 | <LinearLayout | 270 | <LinearLayout |
271 | android:id="@+id/linel_myclass" | 271 | android:id="@+id/linel_myclass" |
272 | android:layout_width="match_parent" | 272 | android:layout_width="match_parent" |
273 | android:layout_height="wrap_content" | 273 | android:layout_height="wrap_content" |
274 | android:layout_marginTop="35dp" | 274 | android:layout_marginTop="35dp" |
275 | android:gravity="center_vertical" | 275 | android:gravity="center_vertical" |
276 | android:orientation="horizontal"> | 276 | android:orientation="horizontal"> |
277 | 277 | ||
278 | <ImageView | 278 | <ImageView |
279 | android:layout_width="0dp" | 279 | android:layout_width="0dp" |
280 | android:layout_height="wrap_content" | 280 | android:layout_height="wrap_content" |
281 | android:layout_weight="1" | 281 | android:layout_weight="1" |
282 | android:src="@mipmap/wodebanji" /> | 282 | android:src="@mipmap/wodebanji" /> |
283 | 283 | ||
284 | <TextView | 284 | <TextView |
285 | android:layout_width="0dp" | 285 | android:layout_width="0dp" |
286 | android:layout_height="wrap_content" | 286 | android:layout_height="wrap_content" |
287 | android:layout_weight="5" | 287 | android:layout_weight="5" |
288 | android:text="我的班级" | 288 | android:text="我的班级" |
289 | android:textSize="20sp" /> | 289 | android:textSize="20sp" /> |
290 | 290 | ||
291 | <ImageView | 291 | <ImageView |
292 | android:layout_width="0dp" | 292 | android:layout_width="0dp" |
293 | android:layout_height="wrap_content" | 293 | android:layout_height="wrap_content" |
294 | android:layout_weight="1" | 294 | android:layout_weight="1" |
295 | android:src="@mipmap/youjiantou" /> | 295 | android:src="@mipmap/youjiantou" /> |
296 | 296 | ||
297 | </LinearLayout> | 297 | </LinearLayout> |
298 | 298 | ||
299 | 299 | ||
300 | </LinearLayout> | 300 | </LinearLayout> |
301 | 301 | ||
302 | <LinearLayout | 302 | <LinearLayout |
303 | android:layout_width="match_parent" | 303 | android:layout_width="match_parent" |
304 | android:layout_height="match_parent" | 304 | android:layout_height="match_parent" |
305 | android:layout_marginTop="120dp" | 305 | android:layout_marginTop="120dp" |
306 | android:background="@mipmap/xiaoguanggao"> | 306 | android:background="@mipmap/xiaoguanggao"> |
307 | 307 | ||
308 | </LinearLayout> | 308 | </LinearLayout> |
309 | 309 | ||
310 | 310 | ||
311 | </LinearLayout> | 311 | </LinearLayout> |
312 | 312 | ||
313 | 313 | ||
314 | <View | 314 | <View |
315 | android:layout_width="0.7dp" | 315 | android:layout_width="0.7dp" |
316 | android:layout_height="match_parent" | 316 | android:layout_height="match_parent" |
317 | android:background="@color/cutoff_line"> | 317 | android:background="@color/cutoff_line"> |
318 | 318 | ||
319 | </View> | 319 | </View> |
320 | 320 | ||
321 | <LinearLayout | 321 | <LinearLayout |
322 | android:layout_width="0dp" | 322 | android:layout_width="0dp" |
323 | android:layout_height="match_parent" | 323 | android:layout_height="match_parent" |
324 | android:layout_weight="2.5" | 324 | android:layout_weight="2.5" |
325 | android:orientation="vertical"> | 325 | android:orientation="vertical"> |
326 | 326 | ||
327 | <LinearLayout | 327 | <LinearLayout |
328 | android:layout_width="match_parent" | 328 | android:layout_width="match_parent" |
329 | android:layout_height="wrap_content" | 329 | android:layout_height="wrap_content" |
330 | android:layout_margin="20dp" | 330 | android:layout_margin="20dp" |
331 | android:gravity="center_vertical" | 331 | android:gravity="center_vertical" |
332 | android:orientation="horizontal"> | 332 | android:orientation="horizontal"> |
333 | 333 | ||
334 | <View | 334 | <View |
335 | android:layout_width="5dp" | 335 | android:layout_width="5dp" |
336 | android:layout_height="20dp" | 336 | android:layout_height="20dp" |
337 | android:background="@color/login_text_blue"> | 337 | android:background="@color/login_text_blue"> |
338 | 338 | ||
339 | </View> | 339 | </View> |
340 | 340 | ||
341 | <TextView | 341 | <TextView |
342 | android:layout_width="wrap_content" | 342 | android:layout_width="wrap_content" |
343 | android:layout_height="wrap_content" | 343 | android:layout_height="wrap_content" |
344 | android:layout_marginLeft="5dp" | 344 | android:layout_marginLeft="5dp" |
345 | android:text="最近学习" | 345 | android:text="最近学习" |
346 | android:textSize="22sp" /> | 346 | android:textSize="22sp" /> |
347 | 347 | ||
348 | </LinearLayout> | 348 | </LinearLayout> |
349 | 349 | ||
350 | <LinearLayout | 350 | <LinearLayout |
351 | android:layout_width="match_parent" | 351 | android:layout_width="wrap_content" |
352 | android:layout_height="wrap_content"> | 352 | android:layout_height="wrap_content"> |
353 | 353 | ||
354 | <android.support.v7.widget.RecyclerView | 354 | <android.support.v7.widget.RecyclerView |
355 | android:id="@+id/id_recyclerview_horizontal" | 355 | android:id="@+id/id_recyclerview_horizontal" |
356 | android:layout_width="match_parent" | 356 | android:layout_width="wrap_content" |
357 | android:layout_height="match_parent" | 357 | android:layout_height="wrap_content" |
358 | android:layout_centerVertical="true" | 358 | android:layout_centerVertical="true" |
359 | android:scrollbars="none" /> | 359 | android:scrollbars="none" /> |
360 | </LinearLayout> | 360 | </LinearLayout> |
361 | 361 | ||
362 | <View | 362 | <View |
363 | android:layout_width="match_parent" | 363 | android:layout_width="match_parent" |
364 | android:layout_height="0.7dp" | 364 | android:layout_height="0.7dp" |
365 | android:layout_marginTop="10dp" | ||
365 | android:background="@color/cutoff_line"> | 366 | android:background="@color/cutoff_line"> |
366 | 367 | ||
367 | </View> | 368 | </View> |
368 | 369 | ||
369 | <LinearLayout | 370 | <LinearLayout |
370 | android:layout_width="match_parent" | 371 | android:layout_width="match_parent" |
371 | android:layout_height="wrap_content" | 372 | android:layout_height="wrap_content" |
372 | android:layout_margin="20dp" | 373 | android:layout_margin="10dp" |
373 | android:gravity="center_vertical" | 374 | android:gravity="center_vertical" |
374 | android:orientation="horizontal"> | 375 | android:orientation="horizontal"> |
375 | 376 | ||
376 | <View | 377 | <View |
377 | android:layout_width="5dp" | 378 | android:layout_width="5dp" |
378 | android:layout_height="20dp" | 379 | android:layout_height="20dp" |
379 | android:background="@color/login_text_blue"> | 380 | android:background="@color/login_text_blue"> |
380 | 381 | ||
381 | </View> | 382 | </View> |
382 | 383 | ||
383 | <TextView | 384 | <TextView |
384 | android:layout_width="0dp" | 385 | android:layout_width="0dp" |
385 | android:layout_height="wrap_content" | 386 | android:layout_height="wrap_content" |
386 | android:layout_marginLeft="5dp" | 387 | android:layout_marginLeft="5dp" |
387 | android:layout_weight="5" | 388 | android:layout_weight="5" |
388 | android:text="个人信息" | 389 | android:text="个人信息" |
389 | android:textSize="22sp" /> | 390 | android:textSize="22sp" /> |
390 | 391 | ||
391 | <TextView | 392 | <TextView |
392 | android:id="@+id/tv_edit_presoninfo" | 393 | android:id="@+id/tv_edit_presoninfo" |
393 | android:padding="5dp" | 394 | android:padding="5dp" |
394 | android:layout_width="0dp" | 395 | android:layout_width="0dp" |
395 | android:layout_height="wrap_content" | 396 | android:layout_height="wrap_content" |
396 | android:layout_marginLeft="10dp" | 397 | android:layout_marginLeft="10dp" |
397 | android:layout_weight="0.4" | 398 | android:layout_weight="0.4" |
398 | android:text="编辑" | 399 | android:text="编辑" |
399 | android:textSize="18sp" /> | 400 | android:textSize="18sp" /> |
400 | 401 | ||
401 | <ImageView | 402 | <ImageView |
402 | android:layout_width="0dp" | 403 | android:layout_width="0dp" |
403 | android:layout_height="wrap_content" | 404 | android:layout_height="wrap_content" |
404 | android:layout_weight="0.1" | 405 | android:layout_weight="0.1" |
405 | |||
406 | android:src="@mipmap/youjiantou" /> | 406 | android:src="@mipmap/youjiantou" /> |
407 | 407 | ||
408 | 408 | ||
409 | </LinearLayout> | 409 | </LinearLayout> |
410 | 410 | ||
411 | <LinearLayout | 411 | <LinearLayout |
412 | android:layout_width="match_parent" | 412 | android:layout_width="match_parent" |
413 | android:layout_height="wrap_content" | 413 | android:layout_height="wrap_content" |
414 | android:layout_marginLeft="50dp" | 414 | android:layout_marginLeft="50dp" |
415 | android:layout_marginTop="10dp" | ||
416 | android:orientation="vertical"> | 415 | android:orientation="vertical"> |
417 | 416 | ||
418 | <LinearLayout | 417 | <LinearLayout |
419 | android:layout_width="match_parent" | 418 | android:layout_width="match_parent" |
420 | android:layout_height="wrap_content" | 419 | android:layout_height="wrap_content" |
421 | android:gravity="center_vertical" | 420 | android:gravity="center_vertical" |
422 | android:orientation="horizontal"> | 421 | android:orientation="horizontal"> |
423 | 422 | ||
424 | <TextView | 423 | <TextView |
425 | android:layout_width="0dp" | 424 | android:layout_width="0dp" |
426 | android:layout_height="wrap_content" | 425 | android:layout_height="wrap_content" |
427 | android:layout_weight="1" | 426 | android:layout_weight="1" |
428 | android:text="昵称" | 427 | android:text="昵称" |
429 | android:textSize="20sp" /> | 428 | android:textSize="20sp" /> |
430 | 429 | ||
431 | <TextView | 430 | <TextView |
432 | android:id="@+id/tv_username1" | 431 | android:id="@+id/tv_username1" |
433 | android:layout_width="0dp" | 432 | android:layout_width="0dp" |
434 | android:layout_height="wrap_content" | 433 | android:layout_height="wrap_content" |
435 | android:layout_weight="2" | 434 | android:layout_weight="2" |
436 | android:hint="未填写" | 435 | android:hint="未填写" |
437 | android:textSize="20sp" /> | 436 | android:textSize="20sp" /> |
438 | 437 | ||
439 | <TextView | 438 | <TextView |
440 | android:layout_width="1dp" | 439 | android:layout_width="1dp" |
441 | android:layout_height="wrap_content" | 440 | android:layout_height="wrap_content" |
442 | android:layout_weight="1" | 441 | android:layout_weight="1" |
443 | android:text="星座" | 442 | android:text="星座" |
444 | android:textSize="20sp" /> | 443 | android:textSize="20sp" /> |
445 | 444 | ||
446 | <TextView | 445 | <TextView |
447 | android:id="@+id/tv_mygad" | 446 | android:id="@+id/tv_mygad" |
448 | android:layout_width="0dp" | 447 | android:layout_width="0dp" |
449 | android:layout_height="wrap_content" | 448 | android:layout_height="wrap_content" |
450 | android:layout_weight="2" | 449 | android:layout_weight="2" |
451 | android:hint="未填写" | 450 | android:hint="未填写" |
452 | android:textSize="20sp" /> | 451 | android:textSize="20sp" /> |
453 | </LinearLayout> | 452 | </LinearLayout> |
454 | 453 | ||
455 | <LinearLayout | 454 | <LinearLayout |
456 | android:layout_width="match_parent" | 455 | android:layout_width="match_parent" |
457 | android:layout_height="wrap_content" | 456 | android:layout_height="wrap_content" |
458 | android:layout_marginTop="20dp" | 457 | android:layout_marginTop="15dp" |
459 | android:gravity="center_vertical" | 458 | android:gravity="center_vertical" |
460 | android:orientation="horizontal"> | 459 | android:orientation="horizontal"> |
461 | 460 | ||
462 | <TextView | 461 | <TextView |
463 | android:layout_width="0dp" | 462 | android:layout_width="0dp" |
464 | android:layout_height="wrap_content" | 463 | android:layout_height="wrap_content" |
465 | android:layout_weight="1" | 464 | android:layout_weight="1" |
466 | android:text="性别" | 465 | android:text="性别" |
467 | android:textSize="20sp" /> | 466 | android:textSize="20sp" /> |
468 | 467 | ||
469 | <TextView | 468 | <TextView |
470 | android:id="@+id/tv_sex" | 469 | android:id="@+id/tv_sex" |
471 | android:layout_width="0dp" | 470 | android:layout_width="0dp" |
472 | android:layout_height="wrap_content" | 471 | android:layout_height="wrap_content" |
473 | android:layout_weight="2" | 472 | android:layout_weight="2" |
474 | android:hint="未填写" | 473 | android:hint="未填写" |
475 | android:textSize="20sp" /> | 474 | android:textSize="20sp" /> |
476 | 475 | ||
477 | <TextView | 476 | <TextView |
478 | android:layout_width="1dp" | 477 | android:layout_width="1dp" |
479 | android:layout_height="wrap_content" | 478 | android:layout_height="wrap_content" |
480 | android:layout_weight="1" | 479 | android:layout_weight="1" |
481 | android:text="地区" | 480 | android:text="地区" |
482 | android:textSize="20sp" /> | 481 | android:textSize="20sp" /> |
483 | 482 | ||
484 | <TextView | 483 | <TextView |
485 | android:id="@+id/tv_useinfo_adress" | 484 | android:id="@+id/tv_useinfo_adress" |
486 | android:layout_width="0dp" | 485 | android:layout_width="0dp" |
487 | android:layout_height="wrap_content" | 486 | android:layout_height="wrap_content" |
488 | android:layout_weight="2" | 487 | android:layout_weight="2" |
489 | android:hint="未填写" | 488 | android:hint="未填写" |
490 | android:textSize="20sp" /> | 489 | android:textSize="20sp" /> |
491 | </LinearLayout> | 490 | </LinearLayout> |
492 | 491 | ||
493 | <LinearLayout | 492 | <LinearLayout |
494 | android:layout_width="match_parent" | 493 | android:layout_width="match_parent" |
495 | android:layout_height="wrap_content" | 494 | android:layout_height="wrap_content" |
496 | android:layout_marginTop="20dp" | 495 | android:layout_marginTop="15dp" |
497 | android:gravity="center_vertical" | 496 | android:gravity="center_vertical" |
498 | android:orientation="horizontal"> | 497 | android:orientation="horizontal"> |
499 | 498 | ||
500 | <TextView | 499 | <TextView |
501 | android:layout_width="0dp" | 500 | android:layout_width="0dp" |
502 | android:layout_height="wrap_content" | 501 | android:layout_height="wrap_content" |
503 | android:layout_weight="1" | 502 | android:layout_weight="1" |
504 | android:text="生日" | 503 | android:text="生日" |
505 | android:textSize="20sp" /> | 504 | android:textSize="20sp" /> |
506 | 505 | ||
507 | <TextView | 506 | <TextView |
508 | android:id="@+id/tv_useinfo_birthday" | 507 | android:id="@+id/tv_useinfo_birthday" |
509 | android:layout_width="0dp" | 508 | android:layout_width="0dp" |
510 | android:layout_height="wrap_content" | 509 | android:layout_height="wrap_content" |
511 | android:layout_weight="2" | 510 | android:layout_weight="2" |
512 | android:hint="未填写" | 511 | android:hint="未填写" |
513 | android:textSize="20sp" /> | 512 | android:textSize="20sp" /> |
514 | 513 | ||
515 | <TextView | 514 | <TextView |
516 | android:layout_width="1dp" | 515 | android:layout_width="1dp" |
517 | android:layout_height="wrap_content" | 516 | android:layout_height="wrap_content" |
518 | android:layout_weight="1" | 517 | android:layout_weight="1" |
519 | android:text="学校" | 518 | android:text="学校" |
520 | android:textSize="20sp" /> | 519 | android:textSize="20sp" /> |
521 | 520 | ||
522 | <TextView | 521 | <TextView |
523 | android:id="@+id/tv_useinfo_school" | 522 | android:id="@+id/tv_useinfo_school" |
524 | android:layout_width="0dp" | 523 | android:layout_width="0dp" |
525 | android:layout_height="wrap_content" | 524 | android:layout_height="wrap_content" |
526 | android:layout_weight="2" | 525 | android:layout_weight="2" |
527 | android:hint="未填写" | 526 | android:hint="未填写" |
528 | android:textSize="20sp" /> | 527 | android:textSize="20sp" /> |
529 | </LinearLayout> | 528 | </LinearLayout> |
530 | 529 | ||
531 | <LinearLayout | 530 | <LinearLayout |
532 | android:layout_width="match_parent" | 531 | android:layout_width="match_parent" |
533 | android:layout_height="wrap_content" | 532 | android:layout_height="wrap_content" |
534 | android:layout_marginTop="20dp" | 533 | android:layout_marginTop="15dp" |
535 | android:gravity="center_vertical" | 534 | android:gravity="center_vertical" |
536 | android:orientation="horizontal"> | 535 | android:orientation="horizontal"> |
537 | 536 | ||
538 | <TextView | 537 | <TextView |
539 | android:layout_width="0dp" | 538 | android:layout_width="0dp" |
540 | android:layout_height="wrap_content" | 539 | android:layout_height="wrap_content" |
541 | android:layout_weight="1" | 540 | android:layout_weight="1" |
542 | android:text=" Q Q" | 541 | android:text=" Q Q" |
543 | android:textSize="20sp" /> | 542 | android:textSize="20sp" /> |
544 | 543 | ||
545 | <TextView | 544 | <TextView |
546 | android:id="@+id/tv_useinfo_qq" | 545 | android:id="@+id/tv_useinfo_qq" |
547 | android:layout_width="0dp" | 546 | android:layout_width="0dp" |
548 | android:layout_height="wrap_content" | 547 | android:layout_height="wrap_content" |
549 | android:layout_weight="2" | 548 | android:layout_weight="2" |
550 | android:hint="未填写" | 549 | android:hint="未填写" |
551 | android:textSize="20sp" /> | 550 | android:textSize="20sp" /> |
552 | 551 | ||
553 | <TextView | 552 | <TextView |
554 | android:layout_width="1dp" | 553 | android:layout_width="1dp" |
555 | android:layout_height="wrap_content" | 554 | android:layout_height="wrap_content" |
556 | android:layout_weight="1" | 555 | android:layout_weight="1" |
557 | android:text="年级" | 556 | android:text="年级" |
558 | android:textSize="20sp" /> | 557 | android:textSize="20sp" /> |
559 | 558 | ||
560 | <TextView | 559 | <TextView |
561 | android:id="@+id/tv_useinfo_gender" | 560 | android:id="@+id/tv_useinfo_gender" |
562 | android:layout_width="0dp" | 561 | android:layout_width="0dp" |
563 | android:layout_height="wrap_content" | 562 | android:layout_height="wrap_content" |
564 | android:layout_weight="2" | 563 | android:layout_weight="2" |
565 | android:hint="未填写" | 564 | android:hint="未填写" |
566 | android:textSize="20sp" /> | 565 | android:textSize="20sp" /> |
567 | </LinearLayout> | 566 | </LinearLayout> |
568 | 567 | ||
569 | 568 | ||
570 | </LinearLayout> | 569 | </LinearLayout> |
571 | <View | 570 | <View |
572 | android:layout_width="match_parent" | 571 | android:layout_width="match_parent" |
573 | android:layout_height="0.7dp" | 572 | android:layout_height="0.7dp" |
574 | android:layout_marginTop="20dp" | 573 | android:layout_marginTop="20dp" |
575 | android:background="@color/cutoff_line"> | 574 | android:background="@color/cutoff_line"> |
576 | 575 | ||
577 | </View> | 576 | </View> |
578 | <LinearLayout | 577 | <LinearLayout |
579 | android:layout_width="match_parent" | 578 | android:layout_width="match_parent" |
580 | android:layout_height="wrap_content" | 579 | android:layout_height="wrap_content" |
581 | android:layout_margin="20dp" | 580 | android:layout_margin="10dp" |
582 | android:gravity="center_vertical" | 581 | android:gravity="center_vertical" |
583 | android:orientation="horizontal"> | 582 | android:orientation="horizontal"> |
584 | 583 | ||
585 | <View | 584 | <View |
586 | android:layout_width="5dp" | 585 | android:layout_width="5dp" |
587 | android:layout_height="20dp" | 586 | android:layout_height="20dp" |
588 | android:background="@color/login_text_blue"> | 587 | android:background="@color/login_text_blue"> |
589 | 588 | ||
590 | </View> | 589 | </View> |
591 | 590 | ||
592 | <TextView | 591 | <TextView |
593 | android:layout_width="wrap_content" | 592 | android:layout_width="wrap_content" |
594 | android:layout_height="wrap_content" | 593 | android:layout_height="wrap_content" |
595 | android:layout_marginLeft="5dp" | 594 | android:layout_marginLeft="5dp" |
596 | android:text="版本信息" | 595 | android:text="版本信息" |
597 | android:textSize="22sp" /> | 596 | android:textSize="22sp" /> |
598 | 597 | ||
599 | </LinearLayout> | 598 | </LinearLayout> |
600 | 599 | ||
601 | <LinearLayout | 600 | <LinearLayout |
602 | android:layout_width="match_parent" | 601 | android:layout_width="match_parent" |
603 | android:layout_height="wrap_content" | 602 | android:layout_height="wrap_content" |
604 | android:layout_marginTop="20dp"> | 603 | android:layout_marginTop="10dp"> |
605 | 604 | <android.support.v7.widget.RecyclerView | |
606 | <TextView | 605 | android:id="@+id/id_recyclerview_pubish" |
607 | android:layout_width="match_parent" | 606 | android:layout_width="match_parent" |
608 | android:layout_height="100dp" | 607 | android:layout_height="match_parent" |
609 | android:layout_marginLeft="20dp" | 608 | android:layout_centerVertical="true" |
610 | android:layout_marginTop="10dp" | 609 | android:scrollbars="none" /> |
611 | android:gravity="center" | 610 | |
612 | android:text="这里需要显示水平滑动的" /> | 611 | |
613 | </LinearLayout> | 612 | </LinearLayout> |
614 | 613 | ||
615 | 614 | ||
616 | </LinearLayout> | 615 | </LinearLayout> |
617 | 616 | ||
618 | 617 | ||
619 | </LinearLayout> | 618 | </LinearLayout> |
620 | 619 | ||
621 | 620 | ||
622 | </LinearLayout> | 621 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/custom_adilog_electroniccard.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="600dp"> | 5 | android:layout_height="600dp"> |
6 | <RelativeLayout | 6 | <RelativeLayout |
7 | android:id="@+id/title" | 7 | android:id="@+id/title" |
8 | android:layout_width="match_parent" | 8 | android:layout_width="match_parent" |
9 | android:layout_height="wrap_content" | 9 | android:layout_height="wrap_content" |
10 | android:minHeight="70dp" > | 10 | android:minHeight="70dp" > |
11 | 11 | ||
12 | <ImageView | 12 | <ImageView |
13 | android:id="@+id/cancel" | 13 | android:id="@+id/cancel" |
14 | android:layout_width="wrap_content" | 14 | android:layout_width="wrap_content" |
15 | android:layout_height="wrap_content" | 15 | android:layout_height="wrap_content" |
16 | android:layout_centerVertical="true" | 16 | android:layout_centerVertical="true" |
17 | android:layout_alignParentRight="true" | 17 | android:layout_alignParentRight="true" |
18 | android:padding="20dp" | 18 | android:padding="20dp" |
19 | android:src="@mipmap/cancel_fork" /> | 19 | android:src="@mipmap/cancel_fork" /> |
20 | 20 | ||
21 | </RelativeLayout> | 21 | </RelativeLayout> |
22 | <RelativeLayout | 22 | <RelativeLayout |
23 | android:gravity="center" | 23 | android:gravity="center" |
24 | android:layout_gravity="clip_horizontal" | 24 | android:layout_gravity="clip_horizontal" |
25 | android:layout_width="match_parent" | 25 | android:layout_width="match_parent" |
26 | android:layout_height="wrap_content"> | 26 | android:layout_height="wrap_content"> |
27 | <ImageView | 27 | <ImageView |
28 | android:layout_width="wrap_content" | 28 | android:layout_width="wrap_content" |
29 | android:src="@mipmap/electroniccard" | 29 | android:src="@mipmap/electroniccard" |
30 | android:layout_height="wrap_content" /> | 30 | android:layout_height="wrap_content" /> |
31 | </RelativeLayout> | 31 | </RelativeLayout> |
32 | <LinearLayout | 32 | <LinearLayout |
33 | android:orientation="vertical" | 33 | android:orientation="vertical" |
34 | android:layout_width="match_parent" | 34 | android:layout_width="match_parent" |
35 | android:layout_height="wrap_content"> | 35 | android:layout_height="wrap_content"> |
36 | <TextView | 36 | <TextView |
37 | android:layout_gravity="center" | 37 | android:layout_gravity="center" |
38 | android:layout_marginTop="30dp" | 38 | android:layout_marginTop="30dp" |
39 | android:textSize="15sp" | 39 | android:textSize="15sp" |
40 | android:layout_width="wrap_content" | 40 | android:layout_width="wrap_content" |
41 | android:layout_height="wrap_content" | 41 | android:layout_height="wrap_content" |
42 | android:textColor="@color/electronic_card" | 42 | android:textColor="@color/electronic_card" |
43 | android:text="@string/electronic_card1"/> | 43 | android:text="@string/electronic_card1"/> |
44 | <TextView | 44 | <TextView |
45 | android:layout_gravity="center" | 45 | android:layout_gravity="center" |
46 | android:layout_width="wrap_content" | 46 | android:layout_width="wrap_content" |
47 | android:layout_height="wrap_content" | 47 | android:layout_height="wrap_content" |
48 | android:layout_marginTop="5dp" | 48 | android:layout_marginTop="5dp" |
49 | android:textSize="15sp" | 49 | android:textSize="15sp" |
50 | android:textColor="@color/electronic_card" | 50 | android:textColor="@color/electronic_card" |
51 | android:text="@string/electronic_card2"/> | 51 | android:text="@string/electronic_card2"/> |
52 | <View | 52 | <View |
53 | android:layout_marginTop="20dp" | 53 | android:layout_marginTop="20dp" |
54 | android:layout_width="match_parent" | 54 | android:layout_width="match_parent" |
55 | android:background="@color/login_edittext_hint" | 55 | android:background="@color/login_edittext_hint" |
56 | android:layout_height="0.7dp"> | 56 | android:layout_height="0.7dp"> |
57 | 57 | ||
58 | </View> | 58 | </View> |
59 | 59 | ||
60 | <TextView | 60 | <TextView |
61 | android:id="@+id/fill_card" | 61 | android:id="@+id/fill_card" |
62 | android:padding="20dp" | ||
62 | android:layout_gravity="center" | 63 | android:layout_gravity="center" |
63 | android:layout_marginTop="30dp" | 64 | android:layout_marginTop="30dp" |
64 | android:layout_width="wrap_content" | 65 | android:layout_width="wrap_content" |
65 | android:layout_height="wrap_content" | 66 | android:layout_height="wrap_content" |
66 | android:textSize="15sp" | 67 | android:textSize="15sp" |
67 | android:textColor="@color/login_text_black" | 68 | android:textColor="@color/login_text_black" |
68 | android:text="@string/string_electroniccard_info_fill"/> | 69 | android:text="@string/string_electroniccard_info_fill"/> |
69 | 70 | ||
70 | </LinearLayout> | 71 | </LinearLayout> |
71 | <LinearLayout | 72 | <LinearLayout |
72 | android:orientation="vertical" | 73 | android:orientation="vertical" |
73 | android:layout_width="match_parent" | 74 | android:layout_width="match_parent" |
74 | android:layout_height="30dp"> | 75 | android:layout_height="30dp"> |
75 | </LinearLayout> | 76 | </LinearLayout> |
76 | 77 | ||
77 | 78 | ||
78 | </LinearLayout> | 79 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_presonal_info.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | 7 | ||
8 | 8 | ||
9 | <LinearLayout | 9 | <LinearLayout |
10 | android:layout_width="wrap_content" | 10 | android:layout_width="wrap_content" |
11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
12 | android:layout_marginTop="80dp" | 12 | android:layout_marginTop="80dp" |
13 | android:orientation="horizontal"> | 13 | android:orientation="horizontal"> |
14 | 14 | ||
15 | <View | 15 | <View |
16 | android:layout_width="450dp" | 16 | android:layout_width="450dp" |
17 | android:layout_height="0.7dp" | 17 | android:layout_height="0.7dp" |
18 | android:layout_marginLeft="150dp" | 18 | android:layout_marginLeft="150dp" |
19 | android:background="@color/cutoff_line"> | 19 | android:background="@color/cutoff_line"> |
20 | 20 | ||
21 | </View> | 21 | </View> |
22 | 22 | ||
23 | <View | 23 | <View |
24 | android:layout_width="450dp" | 24 | android:layout_width="450dp" |
25 | android:layout_height="0.7dp" | 25 | android:layout_height="0.7dp" |
26 | android:layout_marginLeft="80dp" | 26 | android:layout_marginLeft="80dp" |
27 | android:background="@color/cutoff_line"> | 27 | android:background="@color/cutoff_line"> |
28 | 28 | ||
29 | </View> | 29 | </View> |
30 | 30 | ||
31 | 31 | ||
32 | </LinearLayout> | 32 | </LinearLayout> |
33 | 33 | ||
34 | <LinearLayout | 34 | <LinearLayout |
35 | android:layout_width="match_parent" | 35 | android:layout_width="match_parent" |
36 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
37 | android:layout_marginLeft="200dp" | 37 | android:layout_marginLeft="200dp" |
38 | android:gravity="center_vertical" | 38 | android:gravity="center_vertical" |
39 | android:orientation="horizontal"> | 39 | android:orientation="horizontal"> |
40 | 40 | ||
41 | <LinearLayout | 41 | <LinearLayout |
42 | android:layout_width="0dp" | 42 | android:layout_width="0dp" |
43 | android:layout_height="80dp" | 43 | android:layout_height="80dp" |
44 | android:layout_weight="1" | 44 | android:layout_weight="1" |
45 | android:gravity="center_vertical"> | 45 | android:gravity="center_vertical"> |
46 | 46 | ||
47 | <TextView | 47 | <TextView |
48 | android:layout_width="wrap_content" | 48 | android:layout_width="wrap_content" |
49 | android:layout_height="wrap_content" | 49 | android:layout_height="wrap_content" |
50 | android:text="昵称" | 50 | android:text="昵称" |
51 | android:textSize="22sp" /> | 51 | android:textSize="22sp" /> |
52 | 52 | ||
53 | <EditText | 53 | <EditText |
54 | android:id="@+id/tv_username1" | 54 | android:id="@+id/tv_username1" |
55 | android:layout_width="wrap_content" | 55 | android:layout_width="wrap_content" |
56 | android:layout_height="wrap_content" | 56 | android:layout_height="wrap_content" |
57 | android:layout_marginLeft="50dp" | 57 | android:layout_marginLeft="50dp" |
58 | android:textColor="@color/electronic_text" | 58 | android:textColor="@color/electronic_text" |
59 | android:background="@null" | 59 | android:background="@null" |
60 | android:hint="请输入12个以内的中文或英文字符" | 60 | android:hint="请输入12个以内的中文或英文字符" |
61 | android:textSize="22sp" /> | 61 | android:textSize="22sp" /> |
62 | 62 | ||
63 | </LinearLayout> | 63 | </LinearLayout> |
64 | 64 | ||
65 | <LinearLayout | 65 | <LinearLayout |
66 | android:layout_width="0dp" | 66 | android:layout_width="0dp" |
67 | android:layout_height="80dp" | 67 | android:layout_height="80dp" |
68 | android:layout_weight="1" | 68 | android:layout_weight="1" |
69 | android:gravity="center_vertical"> | 69 | android:gravity="center_vertical"> |
70 | 70 | ||
71 | <TextView | 71 | <TextView |
72 | android:layout_width="wrap_content" | 72 | android:layout_width="wrap_content" |
73 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
74 | android:text="地区" | 74 | android:text="地区" |
75 | android:textSize="22sp" /> | 75 | android:textSize="22sp" /> |
76 | 76 | ||
77 | <TextView | 77 | <TextView |
78 | android:id="@+id/tv_useinfo_adress" | 78 | android:id="@+id/tv_useinfo_adress" |
79 | android:layout_width="wrap_content" | 79 | android:layout_width="wrap_content" |
80 | android:layout_height="wrap_content" | 80 | android:layout_height="wrap_content" |
81 | android:layout_marginLeft="50dp" | 81 | android:layout_marginLeft="50dp" |
82 | android:hint="请选择" | 82 | android:hint="请选择" |
83 | android:textSize="22sp" /> | 83 | android:textSize="22sp" /> |
84 | 84 | ||
85 | <ImageView | 85 | <ImageView |
86 | android:id="@+id/my_adress" | ||
87 | android:padding="20dp" | ||
86 | android:layout_width="wrap_content" | 88 | android:layout_width="wrap_content" |
87 | android:layout_height="wrap_content" | 89 | android:layout_height="wrap_content" |
88 | android:layout_marginLeft="150dp" | 90 | android:layout_marginLeft="150dp" |
89 | android:src="@mipmap/xiajiantou"> | 91 | android:src="@mipmap/xiajiantou"> |
90 | 92 | ||
91 | </ImageView> | 93 | </ImageView> |
92 | </LinearLayout> | 94 | </LinearLayout> |
93 | 95 | ||
94 | </LinearLayout> | 96 | </LinearLayout> |
95 | 97 | ||
96 | <LinearLayout | 98 | <LinearLayout |
97 | android:layout_width="wrap_content" | 99 | android:layout_width="wrap_content" |
98 | android:layout_height="wrap_content" | 100 | android:layout_height="wrap_content" |
99 | android:orientation="horizontal"> | 101 | android:orientation="horizontal"> |
100 | 102 | ||
101 | <View | 103 | <View |
102 | android:layout_width="450dp" | 104 | android:layout_width="450dp" |
103 | android:layout_height="0.7dp" | 105 | android:layout_height="0.7dp" |
104 | android:layout_marginLeft="150dp" | 106 | android:layout_marginLeft="150dp" |
105 | android:background="@color/cutoff_line"> | 107 | android:background="@color/cutoff_line"> |
106 | 108 | ||
107 | </View> | 109 | </View> |
108 | 110 | ||
109 | <View | 111 | <View |
110 | android:layout_width="450dp" | 112 | android:layout_width="450dp" |
111 | android:layout_height="0.7dp" | 113 | android:layout_height="0.7dp" |
112 | android:layout_marginLeft="80dp" | 114 | android:layout_marginLeft="80dp" |
113 | android:background="@color/cutoff_line"> | 115 | android:background="@color/cutoff_line"> |
114 | 116 | ||
115 | </View> | 117 | </View> |
116 | 118 | ||
117 | 119 | ||
118 | </LinearLayout> | 120 | </LinearLayout> |
119 | 121 | ||
120 | <LinearLayout | 122 | <LinearLayout |
121 | android:layout_width="match_parent" | 123 | android:layout_width="match_parent" |
122 | android:layout_height="wrap_content" | 124 | android:layout_height="wrap_content" |
123 | android:layout_marginLeft="200dp" | 125 | android:layout_marginLeft="200dp" |
124 | android:gravity="center_vertical" | 126 | android:gravity="center_vertical" |
125 | android:orientation="horizontal"> | 127 | android:orientation="horizontal"> |
126 | 128 | ||
127 | <LinearLayout | 129 | <LinearLayout |
128 | android:layout_width="0dp" | 130 | android:layout_width="0dp" |
129 | android:layout_height="80dp" | 131 | android:layout_height="80dp" |
130 | android:layout_weight="1" | 132 | android:layout_weight="1" |
131 | android:gravity="center_vertical"> | 133 | android:gravity="center_vertical"> |
132 | 134 | ||
133 | <TextView | 135 | <TextView |
134 | android:layout_width="wrap_content" | 136 | android:layout_width="wrap_content" |
135 | android:layout_height="wrap_content" | 137 | android:layout_height="wrap_content" |
136 | android:text="性别" | 138 | android:text="性别" |
137 | android:textSize="22sp" /> | 139 | android:textSize="22sp" /> |
138 | 140 | ||
139 | <TextView | 141 | <TextView |
140 | android:id="@+id/tv_sex" | 142 | android:id="@+id/tv_sex" |
141 | android:layout_width="wrap_content" | 143 | android:layout_width="wrap_content" |
142 | android:layout_height="wrap_content" | 144 | android:layout_height="wrap_content" |
143 | android:layout_marginLeft="50dp" | 145 | android:layout_marginLeft="50dp" |
144 | android:hint="请选择" | 146 | android:hint="请选择" |
145 | android:textSize="22sp" /> | 147 | android:textSize="22sp" /> |
146 | 148 | ||
147 | <ImageView | 149 | <ImageView |
150 | android:id="@+id/my_sex" | ||
151 | android:padding="20dp" | ||
148 | android:layout_width="wrap_content" | 152 | android:layout_width="wrap_content" |
149 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
150 | android:layout_marginLeft="150dp" | 154 | android:layout_marginLeft="150dp" |
151 | android:src="@mipmap/xiajiantou"> | 155 | android:src="@mipmap/xiajiantou"> |
152 | 156 | ||
153 | </ImageView> | 157 | </ImageView> |
154 | 158 | ||
155 | 159 | ||
156 | </LinearLayout> | 160 | </LinearLayout> |
157 | 161 | ||
158 | <LinearLayout | 162 | <LinearLayout |
159 | android:layout_width="0dp" | 163 | android:layout_width="0dp" |
160 | android:layout_height="80dp" | 164 | android:layout_height="80dp" |
161 | android:layout_weight="1" | 165 | android:layout_weight="1" |
162 | android:gravity="center_vertical"> | 166 | android:gravity="center_vertical"> |
163 | 167 | ||
164 | <TextView | 168 | <TextView |
165 | android:layout_width="wrap_content" | 169 | android:layout_width="wrap_content" |
166 | android:layout_height="wrap_content" | 170 | android:layout_height="wrap_content" |
167 | android:text=" " | 171 | android:text=" " |
168 | android:textColor="@color/white" | 172 | android:textColor="@color/white" |
169 | android:textSize="22sp" /> | 173 | android:textSize="22sp" /> |
170 | 174 | ||
171 | <EditText | 175 | <EditText |
172 | android:id="@+id/tv_useinfo_adress1" | 176 | android:id="@+id/tv_useinfo_adress1" |
173 | android:layout_width="wrap_content" | 177 | android:layout_width="wrap_content" |
174 | android:layout_height="wrap_content" | 178 | android:layout_height="wrap_content" |
175 | android:layout_marginLeft="50dp" | 179 | android:layout_marginLeft="50dp" |
176 | android:textColor="@color/electronic_text" | 180 | android:textColor="@color/electronic_text" |
177 | android:background="@null" | 181 | android:background="@null" |
178 | android:hint="请输入详细地址" | 182 | android:hint="请输入详细地址" |
179 | android:textSize="22sp" /> | 183 | android:textSize="22sp" /> |
180 | 184 | ||
181 | </LinearLayout> | 185 | </LinearLayout> |
182 | 186 | ||
183 | </LinearLayout> | 187 | </LinearLayout> |
184 | 188 | ||
185 | <LinearLayout | 189 | <LinearLayout |
186 | android:layout_width="wrap_content" | 190 | android:layout_width="wrap_content" |
187 | android:layout_height="wrap_content" | 191 | android:layout_height="wrap_content" |
188 | 192 | ||
189 | android:orientation="horizontal"> | 193 | android:orientation="horizontal"> |
190 | 194 | ||
191 | <View | 195 | <View |
192 | android:layout_width="450dp" | 196 | android:layout_width="450dp" |
193 | android:layout_height="0.7dp" | 197 | android:layout_height="0.7dp" |
194 | android:layout_marginLeft="150dp" | 198 | android:layout_marginLeft="150dp" |
195 | android:background="@color/cutoff_line"> | 199 | android:background="@color/cutoff_line"> |
196 | 200 | ||
197 | </View> | 201 | </View> |
198 | 202 | ||
199 | <View | 203 | <View |
200 | android:layout_width="450dp" | 204 | android:layout_width="450dp" |
201 | android:layout_height="0.7dp" | 205 | android:layout_height="0.7dp" |
202 | android:layout_marginLeft="80dp" | 206 | android:layout_marginLeft="80dp" |
203 | android:background="@color/cutoff_line"> | 207 | android:background="@color/cutoff_line"> |
204 | 208 | ||
205 | </View> | 209 | </View> |
206 | 210 | ||
207 | 211 | ||
208 | </LinearLayout> | 212 | </LinearLayout> |
209 | 213 | ||
210 | <LinearLayout | 214 | <LinearLayout |
211 | android:layout_width="match_parent" | 215 | android:layout_width="match_parent" |
212 | android:layout_height="wrap_content" | 216 | android:layout_height="wrap_content" |
213 | android:layout_marginLeft="200dp" | 217 | android:layout_marginLeft="200dp" |
214 | android:gravity="center_vertical" | 218 | android:gravity="center_vertical" |
215 | android:orientation="horizontal"> | 219 | android:orientation="horizontal"> |
216 | 220 | ||
217 | 221 | ||
218 | <LinearLayout | 222 | <LinearLayout |
219 | android:layout_width="0dp" | 223 | android:layout_width="0dp" |
220 | android:layout_height="80dp" | 224 | android:layout_height="80dp" |
221 | android:layout_weight="1" | 225 | android:layout_weight="1" |
222 | android:gravity="center_vertical"> | 226 | android:gravity="center_vertical"> |
223 | 227 | ||
224 | <TextView | 228 | <TextView |
225 | android:layout_width="wrap_content" | 229 | android:layout_width="wrap_content" |
226 | android:layout_height="wrap_content" | 230 | android:layout_height="wrap_content" |
227 | android:text="生日" | 231 | android:text="生日" |
228 | android:textSize="22sp" /> | 232 | android:textSize="22sp" /> |
229 | 233 | ||
230 | <TextView | 234 | <TextView |
231 | android:id="@+id/tv_useinfo_birthday" | 235 | android:id="@+id/tv_useinfo_birthday" |
232 | android:layout_width="wrap_content" | 236 | android:layout_width="wrap_content" |
233 | android:layout_height="wrap_content" | 237 | android:layout_height="wrap_content" |
234 | android:layout_marginLeft="50dp" | 238 | android:layout_marginLeft="50dp" |
235 | android:hint="请选择" | 239 | android:hint="请选择" |
236 | android:textSize="22sp" /> | 240 | android:textSize="22sp" /> |
237 | 241 | ||
238 | <ImageView | 242 | <ImageView |
243 | android:id="@+id/my_bthday" | ||
244 | android:padding="20dp" | ||
239 | android:layout_width="wrap_content" | 245 | android:layout_width="wrap_content" |
240 | android:layout_height="wrap_content" | 246 | android:layout_height="wrap_content" |
241 | android:layout_marginLeft="150dp" | 247 | android:layout_marginLeft="150dp" |
242 | android:src="@mipmap/xiajiantou"/> | 248 | android:src="@mipmap/xiajiantou"/> |
243 | </LinearLayout> | 249 | </LinearLayout> |
244 | <LinearLayout | 250 | <LinearLayout |
245 | android:layout_width="0dp" | 251 | android:layout_width="0dp" |
246 | android:layout_height="80dp" | 252 | android:layout_height="80dp" |
247 | android:layout_weight="1" | 253 | android:layout_weight="1" |
248 | android:gravity="center_vertical"> | 254 | android:gravity="center_vertical"> |
249 | 255 | ||
250 | <TextView | 256 | <TextView |
251 | android:layout_width="wrap_content" | 257 | android:layout_width="wrap_content" |
252 | android:layout_height="wrap_content" | 258 | android:layout_height="wrap_content" |
253 | android:text="年级" | 259 | android:text="年级" |
254 | android:textSize="22sp" /> | 260 | android:textSize="22sp" /> |
255 | 261 | ||
256 | <TextView | 262 | <TextView |
257 | android:id="@+id/tv_useinfo_gender" | 263 | android:id="@+id/tv_useinfo_gender" |
258 | android:layout_width="wrap_content" | 264 | android:layout_width="wrap_content" |
259 | android:layout_height="wrap_content" | 265 | android:layout_height="wrap_content" |
260 | android:layout_marginLeft="50dp" | 266 | android:layout_marginLeft="50dp" |
261 | android:hint="请选择" | 267 | android:hint="请选择" |
262 | android:textSize="22sp" /> | 268 | android:textSize="22sp" /> |
263 | 269 | ||
264 | <ImageView | 270 | <ImageView |
271 | android:id="@+id/my_grade" | ||
272 | android:padding="20dp" | ||
265 | android:layout_width="wrap_content" | 273 | android:layout_width="wrap_content" |
266 | android:layout_height="wrap_content" | 274 | android:layout_height="wrap_content" |
267 | android:layout_marginLeft="150dp" | 275 | android:layout_marginLeft="150dp" |
268 | android:src="@mipmap/xiajiantou"/> | 276 | android:src="@mipmap/xiajiantou"/> |
269 | </LinearLayout> | 277 | </LinearLayout> |
270 | 278 | ||
271 | </LinearLayout> | 279 | </LinearLayout> |
272 | 280 | ||
273 | <LinearLayout | 281 | <LinearLayout |
274 | android:layout_width="wrap_content" | 282 | android:layout_width="wrap_content" |
275 | android:layout_height="wrap_content" | 283 | android:layout_height="wrap_content" |
276 | 284 | ||
277 | android:orientation="horizontal"> | 285 | android:orientation="horizontal"> |
278 | 286 | ||
279 | <View | 287 | <View |
280 | android:layout_width="450dp" | 288 | android:layout_width="450dp" |
281 | android:layout_height="0.7dp" | 289 | android:layout_height="0.7dp" |
282 | android:layout_marginLeft="150dp" | 290 | android:layout_marginLeft="150dp" |
283 | android:background="@color/cutoff_line"> | 291 | android:background="@color/cutoff_line"> |
284 | 292 | ||
285 | </View> | 293 | </View> |
286 | 294 | ||
287 | <View | 295 | <View |
288 | android:layout_width="450dp" | 296 | android:layout_width="450dp" |
289 | android:layout_height="0.7dp" | 297 | android:layout_height="0.7dp" |
290 | android:layout_marginLeft="80dp" | 298 | android:layout_marginLeft="80dp" |
291 | android:background="@color/cutoff_line"> | 299 | android:background="@color/cutoff_line"> |
292 | 300 | ||
293 | </View> | 301 | </View> |
294 | 302 | ||
295 | 303 | ||
296 | </LinearLayout> | 304 | </LinearLayout> |
297 | 305 | ||
298 | <LinearLayout | 306 | <LinearLayout |
299 | android:layout_width="match_parent" | 307 | android:layout_width="match_parent" |
300 | android:layout_height="wrap_content" | 308 | android:layout_height="wrap_content" |
301 | android:layout_marginLeft="200dp" | 309 | android:layout_marginLeft="200dp" |
302 | android:gravity="center_vertical" | 310 | android:gravity="center_vertical" |
303 | android:orientation="horizontal"> | 311 | android:orientation="horizontal"> |
304 | 312 | ||
305 | <LinearLayout | 313 | <LinearLayout |
306 | android:id="@+id/lineL_buy_time" | 314 | android:id="@+id/lineL_buy_time" |
307 | android:layout_width="0dp" | 315 | android:layout_width="0dp" |
308 | android:layout_height="80dp" | 316 | android:layout_height="80dp" |
309 | android:layout_weight="1" | 317 | android:layout_weight="1" |
310 | android:gravity="center_vertical"> | 318 | android:gravity="center_vertical"> |
311 | 319 | ||
312 | <TextView | 320 | <TextView |
313 | android:layout_width="wrap_content" | 321 | android:layout_width="wrap_content" |
314 | android:layout_height="wrap_content" | 322 | android:layout_height="wrap_content" |
315 | android:text="Q Q" | 323 | android:text="Q Q" |
316 | android:textSize="22sp" /> | 324 | android:textSize="22sp" /> |
317 | 325 | ||
318 | <EditText | 326 | <EditText |
319 | android:id="@+id/tv_useinfo_qq" | 327 | android:id="@+id/tv_useinfo_qq" |
320 | android:layout_width="wrap_content" | 328 | android:layout_width="wrap_content" |
321 | android:layout_height="wrap_content" | 329 | android:layout_height="wrap_content" |
322 | android:layout_marginLeft="50dp" | 330 | android:layout_marginLeft="50dp" |
323 | android:background="@null" | 331 | android:background="@null" |
324 | android:textColor="@color/electronic_text" | 332 | android:textColor="@color/electronic_text" |
325 | android:hint="请输入" | 333 | android:hint="请输入" |
326 | android:textSize="22sp" /> | 334 | android:textSize="22sp" /> |
327 | 335 | ||
328 | </LinearLayout> | 336 | </LinearLayout> |
329 | 337 | ||
330 | <LinearLayout | 338 | <LinearLayout |
331 | android:layout_width="0dp" | 339 | android:layout_width="0dp" |
332 | android:layout_height="80dp" | 340 | android:layout_height="80dp" |
333 | android:layout_weight="1" | 341 | android:layout_weight="1" |
334 | 342 | ||
335 | android:gravity="center_vertical"> | 343 | android:gravity="center_vertical"> |
336 | 344 | ||
337 | <TextView | 345 | <TextView |
338 | android:layout_width="wrap_content" | 346 | android:layout_width="wrap_content" |
339 | android:layout_height="wrap_content" | 347 | android:layout_height="wrap_content" |
340 | android:text="学校" | 348 | android:text="学校" |
341 | android:textSize="22sp" /> | 349 | android:textSize="22sp" /> |
342 | 350 | ||
343 | <TextView | 351 | <TextView |
344 | android:id="@+id/tv_useinfo_school" | 352 | android:id="@+id/tv_useinfo_school" |
345 | android:layout_width="wrap_content" | 353 | android:layout_width="wrap_content" |
346 | android:layout_height="wrap_content" | 354 | android:layout_height="wrap_content" |
347 | android:layout_marginLeft="50dp" | 355 | android:layout_marginLeft="50dp" |
348 | android:hint="请选择" | 356 | android:hint="请选择" |
349 | android:textSize="22sp" /> | 357 | android:textSize="22sp" /> |
350 | 358 | ||
351 | <ImageView | 359 | <ImageView |
360 | android:id="@+id/my_school" | ||
361 | android:padding="20dp" | ||
352 | android:layout_width="wrap_content" | 362 | android:layout_width="wrap_content" |
353 | android:layout_height="wrap_content" | 363 | android:layout_height="wrap_content" |
354 | android:layout_marginLeft="150dp" | 364 | android:layout_marginLeft="150dp" |
355 | android:src="@mipmap/xiajiantou"> | 365 | android:src="@mipmap/xiajiantou"> |
356 | 366 | ||
357 | </ImageView> | 367 | </ImageView> |
358 | </LinearLayout> | 368 | </LinearLayout> |
359 | 369 | ||
360 | </LinearLayout> | 370 | </LinearLayout> |
361 | 371 | ||
362 | <LinearLayout | 372 | <LinearLayout |
363 | android:layout_width="wrap_content" | 373 | android:layout_width="wrap_content" |
364 | android:layout_height="wrap_content" | 374 | android:layout_height="wrap_content" |
365 | android:orientation="horizontal"> | 375 | android:orientation="horizontal"> |
366 | 376 | ||
367 | <View | 377 | <View |
368 | android:layout_width="450dp" | 378 | android:layout_width="450dp" |
369 | android:layout_height="0.7dp" | 379 | android:layout_height="0.7dp" |
370 | android:layout_marginLeft="150dp" | 380 | android:layout_marginLeft="150dp" |
371 | android:background="@color/cutoff_line"> | 381 | android:background="@color/cutoff_line"> |
372 | 382 | ||
373 | </View> | 383 | </View> |
374 | 384 | ||
375 | <View | 385 | <View |
376 | android:layout_width="450dp" | 386 | android:layout_width="450dp" |
377 | android:layout_height="0.7dp" | 387 | android:layout_height="0.7dp" |
378 | android:layout_marginLeft="80dp" | 388 | android:layout_marginLeft="80dp" |
379 | android:background="@color/cutoff_line"> | 389 | android:background="@color/cutoff_line"> |
380 | 390 | ||
381 | </View> | 391 | </View> |
382 | 392 | ||
383 | 393 | ||
384 | </LinearLayout> | 394 | </LinearLayout> |
385 | 395 | ||
386 | </LinearLayout> | 396 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
5 | android:layout_width="match_parent" | 5 | android:layout_marginLeft="10dp" |
6 | android:layout_height="match_parent" | 6 | android:layout_width="wrap_content" |
7 | android:layout_height="wrap_content" | ||
7 | android:gravity="center"> | 8 | android:gravity="center"> |
8 | 9 | ||
9 | 10 | ||
10 | <com.facebook.drawee.view.SimpleDraweeView | 11 | <com.facebook.drawee.view.SimpleDraweeView |
11 | android:id="@+id/image_publish" | 12 | android:id="@+id/image_publish" |
12 | android:layout_width="100dp" | 13 | android:layout_width="120dp" |
13 | android:layout_height="150dp" | 14 | android:layout_height="100dp" |
14 | android:layout_gravity="center" | 15 | android:layout_gravity="center" |
15 | android:background="@drawable/corcle_black_bg" | 16 | android:background="@drawable/corcle_black_bg" |
16 | fresco:placeholderImage="@mipmap/header_default" | 17 | fresco:placeholderImage="@mipmap/header_default" |
17 | fresco:roundAsCircle="true" | 18 | fresco:roundAsCircle="true" |
18 | fresco:placeholderImageScaleType="fitCenter" /> | 19 | fresco:placeholderImageScaleType="fitCenter" /> |
19 | 20 | ||
20 | <TextView | 21 | <TextView |
21 | android:id="@+id/subject" | 22 | android:id="@+id/subject" |
22 | android:layout_marginTop="5dp" | 23 | android:layout_marginTop="5dp" |
23 | android:textSize="22sp" | ||
24 | android:layout_width="wrap_content" | ||
25 | android:layout_height="wrap_content" | ||
26 | android:textColor="@color/login_text_black" | ||
27 | android:text="" | ||
28 | /> | ||
29 | <TextView | ||
30 | android:id="@+id/tv_publish" | ||
31 | android:layout_marginTop="10dp" | ||
32 | android:textSize="18sp" | 24 | android:textSize="18sp" |
33 | android:layout_width="wrap_content" | 25 | android:layout_width="100dp" |
34 | android:layout_height="wrap_content" | 26 | android:layout_height="wrap_content" |
27 | android:width="100dp" | ||
28 | android:singleLine="true" | ||
29 | android:gravity="center" | ||
30 | android:ellipsize="end" |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes2.xml
File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | ||
4 | android:orientation="vertical" | ||
5 | android:layout_width="wrap_content" | ||
6 | android:layout_height="wrap_content" | ||
7 | android:layout_marginLeft="10dp" | ||
8 | android:gravity="center"> | ||
9 | |||
10 | |||
11 | <com.facebook.drawee.view.SimpleDraweeView | ||
12 | android:id="@+id/image_publish" | ||
13 | android:layout_width="80dp" | ||
14 | android:layout_height="100dp" | ||
15 | android:layout_gravity="center" | ||
16 | android:background="@drawable/corcle_black_bg" | ||
17 | fresco:placeholderImage="@mipmap/header_default" | ||
18 | fresco:roundAsCircle="true" | ||
19 | fresco:placeholderImageScaleType="fitCenter" /> | ||
20 | |||
21 | <TextView | ||
22 | android:id="@+id/subject" | ||
23 | android:layout_marginTop="5dp" | ||
24 | android:textSize="18sp" | ||
25 | android:width="80dp" | ||
26 | android:singleLine="true" | ||
27 | android:ellipsize="end" | ||
28 | android:gravity="center" | ||
29 | android:layout_width="wrap_content" | ||
30 | android:layout_height="wrap_content" | ||
31 | android:textColor="@color/login_text_black" | ||
32 | android:text="" | ||
33 | /> | ||
34 | <TextView | ||
35 | android:id="@+id/tv_publish" | ||
36 | android:layout_marginTop="10dp" | ||
37 | android:textSize="16sp" | ||
38 | android:width="80dp" | ||
39 | android:singleLine="true" | ||
40 | android:ellipsize="end" | ||
41 | android:layout_width="80dp" | ||
42 | android:gravity="center" | ||
43 | android:layout_height="wrap_content" | ||
44 | android:textColor="@color/login_text_black" | ||
45 | android:text="" | ||
46 | /> | ||
47 | |||
48 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes3.xml
File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | ||
4 | android:orientation="vertical" | ||
5 | android:layout_width="match_parent" | ||
6 | android:layout_height="match_parent" | ||
7 | android:gravity="center"> | ||
8 | |||
9 | |||
10 | <com.facebook.drawee.view.SimpleDraweeView | ||
11 | android:id="@+id/image_publish" | ||
12 | android:layout_width="100dp" | ||
13 | android:layout_height="150dp" | ||
14 | android:layout_gravity="center" | ||
15 | android:background="@drawable/corcle_black_bg" | ||
16 | fresco:placeholderImage="@mipmap/header_default" | ||
17 | fresco:roundAsCircle="true" | ||
18 | fresco:placeholderImageScaleType="fitCenter" /> | ||
19 | |||
20 | <TextView | ||
21 | android:id="@+id/subject" | ||
22 | android:layout_marginTop="5dp" | ||
23 | android:textSize="22sp" | ||
24 | android:gravity="center" | ||
25 | android:layout_width="match_parent" | ||
26 | android:layout_height="wrap_content" | ||
27 | android:textColor="@color/login_text_black" | ||
28 | android:text="" | ||
29 | /> | ||
30 | <TextView | ||
31 | android:id="@+id/tv_publish" | ||
32 | android:layout_marginTop="10dp" | ||
33 | android:textSize="18sp" | ||
34 | android:layout_width="wrap_content" | ||
35 | android:gravity="center" | ||
36 | android:layout_height="wrap_content" | ||
37 | android:textColor="@color/login_text_black" | ||
38 | android:text="" | ||
39 | /> | ||
40 | |||
41 | </LinearLayout> |