Commit cc35aeb72ab301340d331ee90c38d24d4e47000f
1 parent
29ad76f4f2
Exists in
master
子账户和账户管理接口调试
Showing
25 changed files
with
427 additions
and
244 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_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 40 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
41 | <output url="file://$PROJECT_DIR$/build/classes" /> | 41 | <output url="file://$PROJECT_DIR$/build/classes" /> |
42 | </component> | 42 | </component> |
43 | <component name="ProjectType"> | 43 | <component name="ProjectType"> |
44 | <option name="id" value="Android" /> | 44 | <option name="id" value="Android" /> |
45 | </component> | 45 | </component> |
46 | </project> | 46 | </project> |
PersonalCenter/app/src/androidTest/java/com/hjx/personalcenter/ExampleInstrumentedTest.java
1 | package com.hjx.personalcenter; | 1 | package com.hjx.personalcenter; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.os.Handler; |
4 | import android.support.test.InstrumentationRegistry; | 4 | import android.os.Message; |
5 | import android.support.test.runner.AndroidJUnit4; | ||
6 | |||
7 | import org.junit.Test; | ||
8 | import org.junit.runner.RunWith; | ||
9 | |||
10 | import static org.junit.Assert.*; | ||
11 | 5 | ||
12 | /** | 6 | /** |
13 | * Instrumentation test, which will execute on an Android device. | 7 | * Instrumentation test, which will execute on an Android device. |
14 | * | 8 | * |
15 | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | 9 | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
16 | */ | 10 | */ |
17 | @RunWith(AndroidJUnit4.class) | ||
18 | public class ExampleInstrumentedTest { | 11 | public class ExampleInstrumentedTest { |
19 | @Test | ||
20 | public void useAppContext() throws Exception { | ||
21 | // Context of the app under test. | ||
22 | Context appContext = InstrumentationRegistry.getTargetContext(); | ||
23 | 12 | ||
24 | assertEquals("com.hjx.personalcenter", appContext.getPackageName()); | 13 | // handler类接收数据 |
14 | Handler handler = new Handler() { | ||
15 | public void handleMessage(Message msg) { | ||
16 | if (msg.what == 1) { | ||
17 | System.out.println("receive...."); | ||
18 | } | ||
19 | }; | ||
20 | }; | ||
21 | |||
22 | // 线程类 | ||
23 | class ThreadShow implements Runnable { | ||
24 | |||
25 | @Override | ||
26 | public void run() { | ||
27 | // TODO Auto-generated method stub | ||
28 | while (true) { | ||
29 | try { | ||
30 | Thread.sleep(1000); | ||
31 | Message msg = new Message(); | ||
32 | msg.what = 1; | ||
33 | handler.sendMessage(msg); |
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.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; | 17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; |
17 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
18 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
19 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
20 | import com.hjx.personalcenter.http.HttpCode; | 21 | import com.hjx.personalcenter.http.HttpCode; |
21 | import com.hjx.personalcenter.http.HttpManager; | 22 | import com.hjx.personalcenter.http.HttpManager; |
22 | import com.hjx.personalcenter.model.ChildsInfo; | 23 | import com.hjx.personalcenter.model.ChildsInfo; |
24 | import com.hjx.personalcenter.util.AlertUtils; | ||
25 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
23 | 26 | ||
24 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
25 | import java.util.List; | 28 | import java.util.List; |
26 | 29 | ||
27 | /**账户管理 熊巍 | 30 | /**账户管理 熊巍 |
28 | * Created by h on 2017/8/12. | 31 | * Created by h on 2017/8/12. |
29 | */ | 32 | */ |
30 | 33 | ||
31 | public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener { | 34 | public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener { |
32 | private TextView changbangding,changpassword,usernames, | 35 | private TextView changbangding,changpassword,usernames, |
33 | tv_username,tv_grade,tv_school,tv_adress, tv_delete; | 36 | tv_username,tv_grade,tv_school,tv_adress,tv_changzhu; |
34 | private ImageView iv_account_head,cancel; | 37 | private ImageView iv_useing,cancel; |
38 | private SimpleDraweeView mSimpleDraweeView; | ||
35 | private RecyclerView listview; | 39 | private RecyclerView listview; |
36 | private LinearLayout add_accunt; | 40 | private LinearLayout add_accunt,ll_zhu_backgrangd; |
37 | private AccountChildsAdapter childsAdapter; | 41 | private AccountChildsAdapter childsAdapter; |
38 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); | 42 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); |
39 | Handler handler = new Handler(){ | 43 | Handler handler = new Handler(){ |
40 | @Override | 44 | @Override |
41 | public void handleMessage(Message msg) { | 45 | public void handleMessage(Message msg) { |
42 | super.handleMessage(msg); | 46 | super.handleMessage(msg); |
43 | switch (msg.what){ | 47 | switch (msg.what){ |
44 | case HttpCode.CHILDS_SUCESS: | 48 | case HttpCode.CHILDS_SUCESS: |
45 | data.clear(); | 49 | data.clear(); |
46 | data.addAll( (List<ChildsInfo.DataBean>)msg.obj); | 50 | data.addAll( (List<ChildsInfo.DataBean>)msg.obj); |
47 | childsAdapter.notifyDataSetChanged(); | 51 | childsAdapter.notifyDataSetChanged(); |
48 | break; | 52 | break; |
49 | } | 53 | } |
50 | } | 54 | } |
51 | }; | 55 | }; |
52 | @Override | 56 | @Override |
53 | protected void onCreate(Bundle savedInstanceState) { | 57 | protected void onCreate(Bundle savedInstanceState) { |
54 | super.onCreate(savedInstanceState); | 58 | super.onCreate(savedInstanceState); |
55 | setContentView(R.layout.activity_account_management); | 59 | setContentView(R.layout.activity_account_management); |
56 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | ||
57 | try { | ||
58 | long auserID = Long.parseLong(userID); | ||
59 | HttpManager.getInstance().getchildAccountinfo(this,auserID,handler); | ||
60 | |||
61 | } catch (NumberFormatException e) { | ||
62 | e.printStackTrace(); | ||
63 | } | ||
64 | 60 | ||
65 | initView(); | 61 | initView(); |
66 | initData(); | 62 | initData(); |
67 | initLister(); | 63 | initLister(); |
68 | } | 64 | } |
69 | 65 | ||
70 | private void initView() { | 66 | private void initView() { |
71 | changbangding = (TextView) findViewById(R.id.changBangding); | 67 | changbangding = (TextView) findViewById(R.id.changBangding); |
72 | changpassword = (TextView) findViewById(R.id.changpassword); | 68 | changpassword = (TextView) findViewById(R.id.changpassword); |
73 | usernames = (TextView) findViewById(R.id.cunt_username); | 69 | usernames = (TextView) findViewById(R.id.cunt_username); |
74 | tv_username = (TextView) findViewById(R.id.tv_account_name); | 70 | tv_username = (TextView) findViewById(R.id.tv_account_name); |
75 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); | 71 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); |
76 | tv_school = (TextView) findViewById(R.id.tv_account_school); | 72 | tv_school = (TextView) findViewById(R.id.tv_account_school); |
77 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); | 73 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); |
78 | tv_delete = (TextView) findViewById(R.id.tv_account_delete); | 74 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.tv_account_head); |
79 | iv_account_head = (ImageView) findViewById(R.id.tv_account_head); | 75 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); |
80 | cancel = (ImageView) findViewById(R.id.cancel); | 76 | cancel = (ImageView) findViewById(R.id.cancel); |
81 | add_accunt = (LinearLayout) findViewById(R.id.add_account); | 77 | add_accunt = (LinearLayout) findViewById(R.id.add_account); |
78 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); | ||
79 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); | ||
82 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 80 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
83 | } | 81 | } |
84 | 82 | ||
85 | private void initData() { | 83 | private void initData() { |
86 | if (Content.changgeaccountflag ==1){ | ||
87 | tv_delete.setText("使用中"); | ||
88 | tv_delete.setEnabled(true); | ||
89 | } | ||
90 | String cunt_username = SaveParam.getInstance().getLoginParam(this,"username"); | 84 | String cunt_username = SaveParam.getInstance().getLoginParam(this,"username"); |
91 | String tv_usernames = SaveParam.getInstance().getLoginParam(this,SaveParam.USERNAME); | 85 | String tv_usernames = SaveParam.getInstance().getLoginParam(this,SaveParam.USERNAME); |
92 | String tv_grades = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADES); | 86 | String tv_grades = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADES); |
93 | String tv_schools = SaveParam.getInstance().getLoginParam(this,SaveParam.SCHOOL); | 87 | String tv_schools = SaveParam.getInstance().getLoginParam(this,SaveParam.SCHOOL); |
94 | String tv_adresss = SaveParam.getInstance().getLoginParam(this,SaveParam.ADRESS); | 88 | String tv_adresss = SaveParam.getInstance().getLoginParam(this,SaveParam.ADRESS); |
89 | String account = SaveParam.getInstance().getLoginParam(this,SaveParam.ACCOUNT); | ||
95 | usernames.setText(cunt_username); | 90 | usernames.setText(cunt_username); |
96 | tv_username.setText(tv_usernames); | 91 | tv_username.setText(tv_usernames); |
97 | tv_grade.setText(tv_grades); | 92 | tv_grade.setText(tv_grades); |
98 | tv_school.setText(tv_schools); | 93 | tv_school.setText(tv_schools); |
99 | tv_adress.setText(tv_adresss); | 94 | tv_adress.setText(tv_adresss); |
95 | if (account.equals("1")){ | ||
96 | tv_changzhu.setText("使用中"); | ||
97 | tv_changzhu.setEnabled(false); | ||
98 | iv_useing.setVisibility(View.VISIBLE); | ||
99 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | ||
100 | }else { | ||
101 | |||
102 | tv_changzhu.setText("切换主账户"); | ||
103 | tv_changzhu.setEnabled(true); | ||
104 | iv_useing.setVisibility(View.GONE); | ||
105 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | ||
106 | } | ||
107 | |||
100 | 108 | ||
101 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 109 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
102 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 110 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
103 | listview.setLayoutManager(linearLayoutManager); | 111 | listview.setLayoutManager(linearLayoutManager); |
104 | childsAdapter = new AccountChildsAdapter(data,this); | 112 | childsAdapter = new AccountChildsAdapter(data,this); |
105 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); | 113 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); |
106 | listview.setAdapter(childsAdapter); | 114 | listview.setAdapter(childsAdapter); |
115 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { | ||
116 | @Override | ||
117 | public void onItemClick(View view, int position) { | ||
118 | |||
119 | AlertUtils.showToast(AccountManagementActivity.this,"你点击了"+data.get(position)); | ||
120 | } | ||
121 | }); | ||
107 | 122 | ||
108 | } | 123 | } |
109 | 124 | ||
125 | |||
110 | private void initLister() { | 126 | private void initLister() { |
111 | changbangding.setOnClickListener(this); | 127 | changbangding.setOnClickListener(this); |
112 | changpassword.setOnClickListener(this); | 128 | changpassword.setOnClickListener(this); |
113 | tv_delete.setOnClickListener(this); | ||
114 | cancel.setOnClickListener(this); | 129 | cancel.setOnClickListener(this); |
115 | add_accunt.setOnClickListener(this); | 130 | add_accunt.setOnClickListener(this); |
131 | tv_changzhu.setOnClickListener(this); | ||
132 | |||
116 | 133 | ||
117 | 134 | ||
118 | } | 135 | } |
119 | 136 | ||
120 | @Override | 137 | @Override |
121 | public void onClick(View v) { | 138 | public void onClick(View v) { |
122 | switch (v.getId()){ | 139 | switch (v.getId()){ |
123 | case R.id.changBangding: | 140 | case R.id.changBangding: |
124 | Intent changebangding = new Intent(); | 141 | Intent changebangding = new Intent(); |
125 | changebangding.setClass(AccountManagementActivity.this,ChangeBangDingActivity.class); | 142 | changebangding.setClass(AccountManagementActivity.this,ChangeBangDingActivity.class); |
126 | startActivity(changebangding); | 143 | startActivity(changebangding); |
127 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 144 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
128 | break; | 145 | break; |
129 | case R.id.changpassword: | 146 | case R.id.changpassword: |
130 | Content.authcodeflag = 1; | 147 | Content.authcodeflag = 1; |
131 | Intent changpwd = new Intent(); | 148 | Intent changpwd = new Intent(); |
132 | changpwd.setClass(AccountManagementActivity.this,ChangePasswordActivity.class); | 149 | changpwd.setClass(AccountManagementActivity.this,ChangePasswordActivity.class); |
133 | startActivity(changpwd); | 150 | startActivity(changpwd); |
134 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 151 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
135 | break; | 152 | break; |
136 | case R.id.add_account: | 153 | case R.id.add_account: |
137 | Content.accountflag = 2; | 154 | Content.accountflag = 2; |
138 | Intent account = new Intent(); | 155 | Intent account = new Intent(); |
139 | account.setClass(AccountManagementActivity.this,RegisterInfoActivity.class); | 156 | account.setClass(AccountManagementActivity.this,RegisterInfoActivity.class); |
140 | startActivity(account); | 157 | startActivity(account); |
141 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 158 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
142 | 159 | ||
143 | break; | 160 | break; |
144 | case R.id.tv_account_delete: | 161 | case R.id.change_zhu_account: |
145 | Content.changgeaccountflag =1; | 162 | Content.changgeaccountflag =1; |
163 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | ||
146 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ACCOUNT,"1"); | 164 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ACCOUNT,"1"); |
165 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | ||
166 | try { | ||
167 | long auserID = Long.parseLong(userID); | ||
168 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this,auserID, | ||
169 | devicenumber,1); | ||
170 | |||
171 | } catch (NumberFormatException e) { | ||
172 | e.printStackTrace(); | ||
173 | } | ||
174 | |||
147 | 175 | ||
148 | break; | 176 | break; |
149 | case R.id.cancel: | 177 | case R.id.cancel: |
150 | finish(); | 178 | finish(); |
151 | break; | 179 | break; |
152 | 180 | ||
153 | } | 181 | } |
154 | 182 | ||
155 | } | 183 | } |
184 | |||
185 | @Override | ||
186 | protected void onResume() { |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/BangDingCode.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | ||
4 | import android.graphics.Bitmap; | 3 | import android.graphics.Bitmap; |
5 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v7.app.AppCompatActivity; | ||
6 | import android.util.DisplayMetrics; | 6 | import android.util.DisplayMetrics; |
7 | import android.widget.ImageView; | 7 | import android.widget.ImageView; |
8 | import android.widget.LinearLayout; | 8 | import android.widget.LinearLayout; |
9 | 9 | ||
10 | import com.hjx.personalcenter.R; | 10 | import com.hjx.personalcenter.R; |
11 | import com.hjx.personalcenter.util.FileUtil; | 11 | import com.hjx.personalcenter.util.FileUtil; |
12 | import com.hjx.personalcenter.util.QRCodeUtil; | 12 | import com.hjx.personalcenter.util.QRCodeUtil; |
13 | 13 | ||
14 | import java.io.File; | 14 | import java.io.File; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Created by h on 2017/8/31. | 17 | * Created by h on 2017/8/31. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | public class BangDingCode extends Activity{ | 20 | public class BangDingCode extends AppCompatActivity { |
21 | private ImageView EQpicture; | 21 | private ImageView EQpicture; |
22 | File file; | 22 | File file; |
23 | @Override | 23 | @Override |
24 | protected void onCreate(Bundle savedInstanceState) { | 24 | protected void onCreate(Bundle savedInstanceState) { |
25 | super.onCreate(savedInstanceState); | 25 | super.onCreate(savedInstanceState); |
26 | setContentView(R.layout.activity_binding_code); | 26 | setContentView(R.layout.activity_binding_code); |
27 | EQpicture = (ImageView) findViewById(R.id.EQpicture); | 27 | EQpicture = (ImageView) findViewById(R.id.EQpicture); |
28 | EQPicture(); | 28 | EQPicture(); |
29 | 29 | ||
30 | 30 | ||
31 | } | 31 | } |
32 | public void EQPicture() { | 32 | public void EQPicture() { |
33 | DisplayMetrics dm = new DisplayMetrics(); | 33 | DisplayMetrics dm = new DisplayMetrics(); |
34 | getWindowManager().getDefaultDisplay().getMetrics(dm); | 34 | getWindowManager().getDefaultDisplay().getMetrics(dm); |
35 | int screenHeight = dm.heightPixels;//屏幕高度 | 35 | int screenHeight = dm.heightPixels;//屏幕高度 |
36 | //设置二维码外布局占屏幕高宽 | 36 | //设置二维码外布局占屏幕高宽 |
37 | LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) EQpicture.getLayoutParams(); | 37 | LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) EQpicture.getLayoutParams(); |
38 | layoutParams.width = screenHeight * 17 / 30; | 38 | layoutParams.width = screenHeight * 17 / 30; |
39 | layoutParams.height = screenHeight * 19 / 30; | 39 | layoutParams.height = screenHeight * 19 / 30; |
40 | EQpicture.setLayoutParams(layoutParams); | 40 | EQpicture.setLayoutParams(layoutParams); |
41 | //生成占屏幕一定比例 的二维码存储在本地并显示 | 41 | //生成占屏幕一定比例 的二维码存储在本地并显示 |
42 | file = new File(FileUtil.getCachePath(this), "user-code.jpg"); | 42 | file = new File(FileUtil.getCachePath(this), "user-code.jpg"); |
43 | Bitmap bitmap = QRCodeUtil.createQRImage("www.baidu.com", screenHeight * 15 / 30, screenHeight * 15 / 30, null, file.getPath()); | 43 | Bitmap bitmap = QRCodeUtil.createQRImage("www.baidu.com", screenHeight * 15 / 30, screenHeight * 15 / 30, null, file.getPath()); |
44 | if (bitmap != null) { | 44 | if (bitmap != null) { |
45 | EQpicture.setImageBitmap(bitmap); | 45 | EQpicture.setImageBitmap(bitmap); |
46 | } | 46 | } |
47 | } | 47 | } |
48 | } | 48 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeEletronicCardPhoneActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | ||
4 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.v7.app.AppCompatActivity; | ||
5 | 5 | ||
6 | import com.hjx.personalcenter.R; | 6 | import com.hjx.personalcenter.R; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Created by h on 2017/8/9. | 9 | * Created by h on 2017/8/9. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | public class ChangeEletronicCardPhoneActivity extends Activity { | 12 | public class ChangeEletronicCardPhoneActivity extends AppCompatActivity { |
13 | 13 | ||
14 | 14 | ||
15 | @Override | 15 | @Override |
16 | protected void onCreate(Bundle savedInstanceState) { | 16 | protected void onCreate(Bundle savedInstanceState) { |
17 | super.onCreate(savedInstanceState); | 17 | super.onCreate(savedInstanceState); |
18 | setContentView(R.layout.activity_electronicard_phone); | 18 | setContentView(R.layout.activity_electronicard_phone); |
19 | } | 19 | } |
20 | } | 20 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangePasswordActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | ||
4 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.v7.app.AppCompatActivity; | ||
5 | import android.text.TextUtils; | 5 | import android.text.TextUtils; |
6 | import android.text.method.HideReturnsTransformationMethod; | 6 | import android.text.method.HideReturnsTransformationMethod; |
7 | import android.text.method.PasswordTransformationMethod; | 7 | import android.text.method.PasswordTransformationMethod; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.Button; | 9 | import android.widget.Button; |
10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
12 | 12 | ||
13 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
14 | import com.hjx.personalcenter.db.SaveParam; | ||
14 | import com.hjx.personalcenter.http.HttpManager; | 15 | import com.hjx.personalcenter.http.HttpManager; |
15 | import com.hjx.personalcenter.util.AlertUtils; | 16 | import com.hjx.personalcenter.util.AlertUtils; |
16 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 17 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
17 | import com.hjx.personalcenter.db.SaveParam; | ||
18 | 18 | ||
19 | /**修改密码 | 19 | /**修改密码 |
20 | * Created by h on 2017/6/27. | 20 | * Created by h on 2017/6/27. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | public class ChangePasswordActivity extends Activity implements View.OnClickListener { | 23 | public class ChangePasswordActivity extends AppCompatActivity implements View.OnClickListener { |
24 | private EditText old_pwd,newpassword,newpassword1; | 24 | private EditText old_pwd,newpassword,newpassword1; |
25 | private Button sub_change_pwd; | 25 | private Button sub_change_pwd; |
26 | private ImageView back_change_pwd,eyes_iv_change1; | 26 | private ImageView back_change_pwd,eyes_iv_change1; |
27 | public static Boolean showPassword = false; | 27 | public static Boolean showPassword = false; |
28 | @Override | 28 | @Override |
29 | protected void onCreate(Bundle savedInstanceState) { | 29 | protected void onCreate(Bundle savedInstanceState) { |
30 | super.onCreate(savedInstanceState); | 30 | super.onCreate(savedInstanceState); |
31 | setContentView(R.layout.activity_changepsword); | 31 | setContentView(R.layout.activity_changepsword); |
32 | initView(); | 32 | initView(); |
33 | setLister(); | 33 | setLister(); |
34 | } | 34 | } |
35 | 35 | ||
36 | private void initView() { | 36 | private void initView() { |
37 | old_pwd = (EditText) findViewById(R.id.et_oldpassword); | 37 | old_pwd = (EditText) findViewById(R.id.et_oldpassword); |
38 | newpassword = (EditText) findViewById(R.id.et_newpassword); | 38 | newpassword = (EditText) findViewById(R.id.et_newpassword); |
39 | newpassword1 = (EditText) findViewById(R.id.et_again_newpassword); | 39 | newpassword1 = (EditText) findViewById(R.id.et_again_newpassword); |
40 | sub_change_pwd = (Button) findViewById(R.id.btn_ok); | 40 | sub_change_pwd = (Button) findViewById(R.id.btn_ok); |
41 | back_change_pwd = (ImageView) findViewById(R.id.cancel); | 41 | back_change_pwd = (ImageView) findViewById(R.id.cancel); |
42 | eyes_iv_change1 = (ImageView) findViewById(R.id.iv_pwd_change); | 42 | eyes_iv_change1 = (ImageView) findViewById(R.id.iv_pwd_change); |
43 | 43 | ||
44 | 44 | ||
45 | } | 45 | } |
46 | 46 | ||
47 | private void setLister() { | 47 | private void setLister() { |
48 | sub_change_pwd.setOnClickListener(this); | 48 | sub_change_pwd.setOnClickListener(this); |
49 | back_change_pwd.setOnClickListener(this); | 49 | back_change_pwd.setOnClickListener(this); |
50 | eyes_iv_change1.setOnClickListener(this); | 50 | eyes_iv_change1.setOnClickListener(this); |
51 | } | 51 | } |
52 | 52 | ||
53 | @Override | 53 | @Override |
54 | public void onClick(View v) { | 54 | public void onClick(View v) { |
55 | String old_pwd1 = old_pwd.getText().toString().trim(); | 55 | String old_pwd1 = old_pwd.getText().toString().trim(); |
56 | String newpassword3 = newpassword.getText().toString().trim(); | 56 | String newpassword3 = newpassword.getText().toString().trim(); |
57 | String newpassword4 = newpassword1.getText().toString().trim(); | 57 | String newpassword4 = newpassword1.getText().toString().trim(); |
58 | switch (v.getId()){ | 58 | switch (v.getId()){ |
59 | //确认修改 | 59 | //确认修改 |
60 | case R.id.btn_ok: | 60 | case R.id.btn_ok: |
61 | 61 | ||
62 | //Log.e("test","sp保存的密码是"+sp.getLoginParam(ChangePwd.this, "password")); | 62 | //Log.e("test","sp保存的密码是"+sp.getLoginParam(ChangePwd.this, "password")); |
63 | if (TextUtils.isEmpty(old_pwd1)|| | 63 | if (TextUtils.isEmpty(old_pwd1)|| |
64 | TextUtils.isEmpty(newpassword3) || TextUtils.isEmpty(newpassword4)){ | 64 | TextUtils.isEmpty(newpassword3) || TextUtils.isEmpty(newpassword4)){ |
65 | AlertUtils.showToast(ChangePasswordActivity.this, "请将必填项填写完整"); | 65 | AlertUtils.showToast(ChangePasswordActivity.this, "请将必填项填写完整"); |
66 | return; | 66 | return; |
67 | }else if(newpassword3.length()<8||newpassword4.length()<8){ | 67 | }else if(newpassword3.length()<8||newpassword4.length()<8){ |
68 | AlertUtils.showToast(ChangePasswordActivity.this,"密码不能少于8位"); | 68 | AlertUtils.showToast(ChangePasswordActivity.this,"密码不能少于8位"); |
69 | }else if(!newpassword3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)||!newpassword4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ | 69 | }else if(!newpassword3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)||!newpassword4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ |
70 | AlertUtils.showToast(ChangePasswordActivity.this, "密码必须由数字和字母组成"); | 70 | AlertUtils.showToast(ChangePasswordActivity.this, "密码必须由数字和字母组成"); |
71 | } | 71 | } |
72 | //得到原密码并且判断是否输入的一样 | 72 | //得到原密码并且判断是否输入的一样 |
73 | else if(!SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"password").equals(old_pwd1)){ | 73 | else if(!SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"password").equals(old_pwd1)){ |
74 | 74 | ||
75 | AlertUtils.showToast(ChangePasswordActivity.this, "原密码输入错误"); | 75 | AlertUtils.showToast(ChangePasswordActivity.this, "原密码输入错误"); |
76 | 76 | ||
77 | }else if (!newpassword3.equals(newpassword4)){ | 77 | }else if (!newpassword3.equals(newpassword4)){ |
78 | AlertUtils.showToast(ChangePasswordActivity.this, "两次密码输入不一致"); | 78 | AlertUtils.showToast(ChangePasswordActivity.this, "两次密码输入不一致"); |
79 | return; | 79 | return; |
80 | }else{ | 80 | }else{ |
81 | //修改密码接口 | 81 | //修改密码接口 |
82 | String name = SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"username"); | 82 | String name = SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"username"); |
83 | HttpManager.getInstance().changepwd(this,name,old_pwd1,newpassword3); | 83 | HttpManager.getInstance().changepwd(this,name,old_pwd1,newpassword3); |
84 | } | 84 | } |
85 | 85 | ||
86 | break; | 86 | break; |
87 | case R.id.iv_pwd_change: | 87 | case R.id.iv_pwd_change: |
88 | if(showPassword){//显示密码 | 88 | if(showPassword){//显示密码 |
89 | showPassword = !showPassword; | 89 | showPassword = !showPassword; |
90 | eyes_iv_change1.setImageResource(R.mipmap.pwd_open); | 90 | eyes_iv_change1.setImageResource(R.mipmap.pwd_open); |
91 | newpassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 91 | newpassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
92 | newpassword.setSelection(newpassword.getText().toString().length()); | 92 | newpassword.setSelection(newpassword.getText().toString().length()); |
93 | }else{//隐藏密码 | 93 | }else{//隐藏密码 |
94 | showPassword = !showPassword; | 94 | showPassword = !showPassword; |
95 | eyes_iv_change1.setImageResource(R.mipmap.pwd_hide); | 95 | eyes_iv_change1.setImageResource(R.mipmap.pwd_hide); |
96 | newpassword.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 96 | newpassword.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
97 | newpassword.setSelection(newpassword.getText().toString().length()); | 97 | newpassword.setSelection(newpassword.getText().toString().length()); |
98 | } | 98 | } |
99 | break; | 99 | break; |
100 | 100 | ||
101 | case R.id.cancel: | 101 | case R.id.cancel: |
102 | finish(); | 102 | finish(); |
103 | break; | 103 | break; |
104 | } | 104 | } |
105 | 105 | ||
106 | } | 106 | } |
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.graphics.Color; | 4 | import android.graphics.Color; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v7.app.AppCompatActivity; |
7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.Button; | 9 | import android.widget.Button; |
10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
12 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
14 | 14 | ||
15 | import com.bigkoo.pickerview.TimePickerView; | 15 | import com.bigkoo.pickerview.TimePickerView; |
16 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
17 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 17 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
18 | import com.hjx.personalcenter.customdialog.CountryDialog; | 18 | import com.hjx.personalcenter.customdialog.CountryDialog; |
19 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 19 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
20 | import com.hjx.personalcenter.db.Content; | 20 | import com.hjx.personalcenter.db.Content; |
21 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
22 | import com.hjx.personalcenter.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.ProvinceInfo; | 25 | import com.hjx.personalcenter.model.ProvinceInfo; |
26 | import com.hjx.personalcenter.util.AlertUtils; | 26 | import com.hjx.personalcenter.util.AlertUtils; |
27 | import com.hjx.personalcenter.util.GetDate; | ||
27 | 28 | ||
28 | import java.text.SimpleDateFormat; | 29 | import java.text.SimpleDateFormat; |
29 | import java.util.ArrayList; | 30 | import java.util.ArrayList; |
30 | import java.util.Date; | 31 | import java.util.Date; |
31 | 32 | ||
32 | /**填写保卡信息 熊巍 | 33 | /**填写保卡信息 熊巍 |
33 | * Created by h on 2017/8/11. | 34 | * Created by h on 2017/8/11. |
34 | */ | 35 | */ |
35 | 36 | ||
36 | public class ElectronicCardEditInfoActivity extends AppCompatActivity implements View.OnClickListener | 37 | public class ElectronicCardEditInfoActivity extends AppCompatActivity implements View.OnClickListener |
37 | ,DialogCallBack.ProvincesCallBack | 38 | ,DialogCallBack.ProvincesCallBack |
38 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ | 39 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ |
39 | private LinearLayout lineL_buy_time; | 40 | private LinearLayout lineL_buy_time; |
40 | private TextView tv_buy_time,adress_shop,adress_custem; | 41 | private TextView tv_buy_time,adress_shop,adress_custem; |
41 | private EditText username,store,detalAdress,telphone; | 42 | private EditText username,store,detalAdress,telphone; |
42 | private TimePickerView pvTime; | 43 | private TimePickerView pvTime; |
43 | private Button btn_change_info; | 44 | private Button btn_change_info; |
44 | private ImageView iv_card_back; | 45 | private ImageView iv_card_back; |
45 | 46 | ||
46 | @Override | 47 | @Override |
47 | protected void onCreate(Bundle savedInstanceState) { | 48 | protected void onCreate(Bundle savedInstanceState) { |
48 | super.onCreate(savedInstanceState); | 49 | super.onCreate(savedInstanceState); |
49 | setContentView(R.layout.activity_electroniccard_info); | 50 | setContentView(R.layout.activity_electroniccard_info); |
50 | initView(); | 51 | initView(); |
51 | initData(); | 52 | initData(); |
52 | initLister(); | 53 | initLister(); |
53 | initTimePicker(); | 54 | initTimePicker(); |
54 | } | 55 | } |
55 | 56 | ||
56 | private void initView() { | 57 | private void initView() { |
57 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); | 58 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); |
58 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); | 59 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); |
59 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); | 60 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); |
60 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); | 61 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); |
61 | username = (EditText) findViewById(R.id.et_edit_username); | 62 | username = (EditText) findViewById(R.id.et_edit_username); |
62 | store = (EditText) findViewById(R.id.et_edit_store); | 63 | store = (EditText) findViewById(R.id.et_edit_store); |
63 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); | 64 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); |
64 | telphone = (EditText) findViewById(R.id.et_edit_telphone); | 65 | telphone = (EditText) findViewById(R.id.et_edit_telphone); |
65 | btn_change_info = (Button) findViewById(R.id.btn_change_info); | 66 | btn_change_info = (Button) findViewById(R.id.btn_change_info); |
66 | iv_card_back = (ImageView) findViewById(R.id.iv_card_back); | 67 | iv_card_back = (ImageView) findViewById(R.id.iv_card_back); |
67 | } | 68 | } |
68 | 69 | ||
69 | private void initData() { | 70 | private void initData() { |
71 | GetDate date = new GetDate(); | ||
72 | tv_buy_time.setText(date.getYMD().toString()); | ||
70 | 73 | ||
71 | } | 74 | } |
72 | 75 | ||
73 | private void initLister() { | 76 | private void initLister() { |
74 | lineL_buy_time.setOnClickListener(this); | 77 | lineL_buy_time.setOnClickListener(this); |
75 | adress_shop.setOnClickListener(this); | 78 | adress_shop.setOnClickListener(this); |
76 | adress_custem.setOnClickListener(this); | 79 | adress_custem.setOnClickListener(this); |
77 | btn_change_info.setOnClickListener(this); | 80 | btn_change_info.setOnClickListener(this); |
78 | 81 | ||
79 | } | 82 | } |
80 | //自定义时间选择器 | 83 | //自定义时间选择器 |
81 | private void initTimePicker() { | 84 | private void initTimePicker() { |
82 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 85 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
83 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 86 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
84 | // Calendar selectedDate = Calendar.getInstance(); | 87 | // Calendar selectedDate = Calendar.getInstance(); |
85 | // Calendar startDate = Calendar.getInstance(); | 88 | // Calendar startDate = Calendar.getInstance(); |
86 | // startDate.set(1900, 1, 1); | 89 | // startDate.set(1900, 1, 1); |
87 | // Calendar endDate = Calendar.getInstance(); | 90 | // Calendar endDate = Calendar.getInstance(); |
88 | // endDate.set(2100, 1, 1); | 91 | // endDate.set(2100, 1, 1); |
89 | //时间选择器 | 92 | //时间选择器 |
90 | pvTime = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() { | 93 | pvTime = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() { |
91 | @Override | 94 | @Override |
92 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 95 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
93 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 96 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
94 | /*btn_Time.setText(getTime(date));*/ | 97 | /*btn_Time.setText(getTime(date));*/ |
95 | TextView btn = (TextView) v; | 98 | TextView btn = (TextView) v; |
96 | btn.setText(getTime(date)); | 99 | btn.setText(getTime(date)); |
97 | } | 100 | } |
98 | }) | 101 | }) |
99 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 102 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
100 | .setType(new boolean[]{true, true, true, false, false, false}) | 103 | .setType(new boolean[]{true, true, true, false, false, false}) |
101 | .setLabel("", "", "", "", "", "") | 104 | .setLabel("", "", "", "", "", "") |
102 | .isCenterLabel(false) | 105 | .isCenterLabel(false) |
103 | .setDividerColor(Color.DKGRAY) | 106 | .setDividerColor(Color.DKGRAY) |
104 | .setContentSize(21) | 107 | .setContentSize(21) |
105 | // .setDate(selectedDate) | 108 | // .setDate(selectedDate) |
106 | // .setRangDate(startDate, endDate) | 109 | // .setRangDate(startDate, endDate) |
107 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 110 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
108 | .setDecorView(null) | 111 | .setDecorView(null) |
109 | .setTitleText("购买日期") | 112 | .setTitleText("购买日期") |
110 | .setTitleSize(22) | 113 | .setTitleSize(22) |
111 | .setCancelColor(Color.GRAY) | 114 | .setCancelColor(Color.GRAY) |
112 | .setSubCalSize(22) | 115 | .setSubCalSize(22) |
113 | .setDividerColor(Color.GRAY) | 116 | .setDividerColor(Color.GRAY) |
114 | .setSubmitColor(Color.GRAY) | 117 | .setSubmitColor(Color.GRAY) |
115 | .build(); | 118 | .build(); |
116 | } | 119 | } |
117 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 120 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
118 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 121 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
119 | return format.format(date); | 122 | return format.format(date); |
120 | } | 123 | } |
121 | 124 | ||
122 | @Override | 125 | @Override |
123 | public void onClick(View v) { | 126 | public void onClick(View v) { |
124 | switch (v.getId()){ | 127 | switch (v.getId()){ |
125 | case R.id.lineL_buy_time: | 128 | case R.id.lineL_buy_time: |
126 | pvTime.show(tv_buy_time);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 129 | |
130 | //pvTime.show(tv_buy_time);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | ||
127 | break; | 131 | break; |
128 | case R.id.btn_change_info: | 132 | case R.id.btn_change_info: |
129 | String info1 =username.getText().toString().trim(); | 133 | String info1 =username.getText().toString().trim(); |
130 | String info2 =adress_custem.getText().toString().trim(); | 134 | String info2 =adress_custem.getText().toString().trim(); |
131 | String info3 =detalAdress.getText().toString().trim(); | 135 | String info3 =detalAdress.getText().toString().trim(); |
132 | String info4 =tv_buy_time.getText().toString().trim(); | 136 | String info4 =tv_buy_time.getText().toString().trim(); |
133 | String info5 =adress_shop.getText().toString().trim(); | 137 | String info5 =adress_shop.getText().toString().trim(); |
134 | String info6 =store.getText().toString().trim(); | 138 | String info6 =store.getText().toString().trim(); |
135 | String info7 =telphone.getText().toString().trim(); | 139 | String info7 =telphone.getText().toString().trim(); |
136 | 140 | ||
137 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2)||TextUtils.isEmpty(info3) | 141 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2)||TextUtils.isEmpty(info3) |
138 | ||TextUtils.isEmpty(info4)||TextUtils.isEmpty(info5)||TextUtils.isEmpty(info6) | 142 | ||TextUtils.isEmpty(info4)||TextUtils.isEmpty(info5)||TextUtils.isEmpty(info6) |
139 | ||TextUtils.isEmpty(info7)) { | 143 | ||TextUtils.isEmpty(info7)) { |
140 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); | 144 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); |
141 | return; | 145 | return; |
142 | }else { | 146 | }else { |
143 | savedata(); | 147 | savedata(); |
144 | Intent intent = new Intent(); | 148 | Intent intent = new Intent(); |
145 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); | 149 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); |
146 | startActivity(intent); | 150 | startActivity(intent); |
147 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 151 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
148 | } | 152 | } |
149 | 153 | ||
150 | break; | 154 | break; |
151 | case R.id.tv_edit_adress_shop: | 155 | case R.id.tv_edit_adress_shop: |
152 | Content.adressflag =1; | 156 | Content.adressflag =1; |
153 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 157 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
154 | 158 | ||
155 | break; | 159 | break; |
156 | case R.id.tv_edit_adress_custem: | 160 | case R.id.tv_edit_adress_custem: |
157 | Content.adressflag =2; | 161 | Content.adressflag =2; |
158 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 162 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
159 | 163 | ||
160 | break; | 164 | break; |
161 | case R.id.iv_card_back: | 165 | case R.id.iv_card_back: |
162 | finish(); | 166 | finish(); |
163 | break; | 167 | break; |
164 | 168 | ||
165 | } | 169 | } |
166 | 170 | ||
167 | 171 | ||
168 | } | 172 | } |
169 | //保存数据 | 173 | //保存数据 |
170 | private void savedata() { | 174 | private void savedata() { |
171 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CUNSTEMNAME, username.getText().toString().trim()); | 175 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CUNSTEMNAME, username.getText().toString().trim()); |
172 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim()+detalAdress.getText().toString().trim()); | 176 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim()+detalAdress.getText().toString().trim()); |
173 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); | 177 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); |
174 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPADRESS, adress_shop.getText().toString().trim()+store.getText().toString().trim()); | 178 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPADRESS, adress_shop.getText().toString().trim()+store.getText().toString().trim()); |
175 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); | 179 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); |
176 | 180 | ||
177 | } | 181 | } |
178 | 182 | ||
179 | @Override | 183 | @Override |
180 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 184 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
181 | String regionName = data.get(position).getRegionName(); | 185 | String regionName = data.get(position).getRegionName(); |
182 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 186 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
183 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 187 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
184 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 188 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
185 | if (Content.adressflag ==1){ | 189 | if (Content.adressflag ==1){ |
186 | adress_shop.setText(""); | 190 | adress_shop.setText(""); |
187 | adress_shop.setText(provice+regionName); | 191 | adress_shop.setText(provice+regionName); |
188 | }else { | 192 | }else { |
189 | adress_custem.setText(""); | 193 | adress_custem.setText(""); |
190 | adress_custem.setText(provice+regionName); | 194 | adress_custem.setText(provice+regionName); |
191 | } | 195 | } |
192 | 196 | ||
193 | } | 197 | } |
194 | 198 | ||
195 | @Override | 199 | @Override |
196 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 200 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
197 | String regionName = data.get(position).getRegionName(); | 201 | String regionName = data.get(position).getRegionName(); |
198 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 202 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
199 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 203 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
200 | if (Content.adressflag ==1){ | 204 | if (Content.adressflag ==1){ |
201 | adress_shop.setText(""); | 205 | adress_shop.setText(""); |
202 | adress_shop.setText(provices+citys+regionName); | 206 | adress_shop.setText(provices+citys+regionName); |
203 | }else { | 207 | }else { |
204 | adress_custem.setText(""); | 208 | adress_custem.setText(""); |
205 | adress_custem.setText(provices+citys+regionName); | 209 | adress_custem.setText(provices+citys+regionName); |
206 | } | 210 | } |
207 | 211 | ||
208 | 212 | ||
209 | 213 | ||
210 | } | 214 | } |
211 | 215 | ||
212 | @Override | 216 | @Override |
213 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 217 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
214 | String regionName = data.get(position).getRegionName(); | 218 | String regionName = data.get(position).getRegionName(); |
215 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 219 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
216 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 220 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
217 | 221 | ||
218 | 222 | ||
219 | } | 223 | } |
220 | } | 224 | } |
221 | 225 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardInfoOKActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | ||
4 | import android.content.Intent; | 3 | import android.content.Intent; |
5 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v7.app.AppCompatActivity; | ||
6 | import android.view.View; | 6 | import android.view.View; |
7 | import android.widget.Button; | 7 | import android.widget.Button; |
8 | import android.widget.ImageView; | 8 | import android.widget.ImageView; |
9 | import android.widget.TextView; | 9 | import android.widget.TextView; |
10 | 10 | ||
11 | import com.hjx.personalcenter.R; | 11 | import com.hjx.personalcenter.R; |
12 | import com.hjx.personalcenter.db.SaveParam; | 12 | import com.hjx.personalcenter.db.SaveParam; |
13 | import com.hjx.personalcenter.http.HttpManager; | 13 | import com.hjx.personalcenter.http.HttpManager; |
14 | import com.hjx.personalcenter.util.GetDevicesUtil; | 14 | import com.hjx.personalcenter.util.GetDevicesUtil; |
15 | 15 | ||
16 | /**确认保卡信息 | 16 | /**确认保卡信息 |
17 | * Created by h on 2017/8/11. | 17 | * Created by h on 2017/8/11. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | public class ElectronicCardInfoOKActivity extends Activity implements View.OnClickListener { | 20 | public class ElectronicCardInfoOKActivity extends AppCompatActivity implements View.OnClickListener { |
21 | private Button btn_finish,btn_bangding; | 21 | private Button btn_finish,btn_bangding; |
22 | private ImageView iv_last_step; | 22 | private ImageView iv_last_step; |
23 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; | 23 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; |
24 | @Override | 24 | @Override |
25 | protected void onCreate(Bundle savedInstanceState) { | 25 | protected void onCreate(Bundle savedInstanceState) { |
26 | super.onCreate(savedInstanceState); | 26 | super.onCreate(savedInstanceState); |
27 | setContentView(R.layout.activity_ok_cardinfo); | 27 | setContentView(R.layout.activity_ok_cardinfo); |
28 | initView(); | 28 | initView(); |
29 | initData(); | 29 | initData(); |
30 | initLister(); | 30 | initLister(); |
31 | } | 31 | } |
32 | private void initView() { | 32 | private void initView() { |
33 | btn_finish = (Button) findViewById(R.id.btn_finish); | 33 | btn_finish = (Button) findViewById(R.id.btn_finish); |
34 | iv_last_step = (ImageView) findViewById(R.id.cancel); | 34 | iv_last_step = (ImageView) findViewById(R.id.cancel); |
35 | usename = (TextView) findViewById(R.id.iv_card_username); | 35 | usename = (TextView) findViewById(R.id.iv_card_username); |
36 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 36 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
37 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 37 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
38 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 38 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
39 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 39 | shoptime = (TextView) findViewById(R.id.tv_card_time); |
40 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 40 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
41 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 41 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
42 | phone = (TextView) findViewById(R.id.tv_card_phone); | 42 | phone = (TextView) findViewById(R.id.tv_card_phone); |
43 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 43 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
44 | btn_bangding = (Button) findViewById(R.id.btn_bangding); | 44 | btn_bangding = (Button) findViewById(R.id.btn_bangding); |
45 | } | 45 | } |
46 | 46 | ||
47 | private void initData() { | 47 | private void initData() { |
48 | //获取设备信息 | 48 | //获取设备信息 |
49 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 49 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
50 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 50 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
51 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 51 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
52 | //获取保卡信息 | 52 | //获取保卡信息 |
53 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | 53 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); |
54 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | 54 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); |
55 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | 55 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); |
56 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | 56 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); |
57 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | 57 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); |
58 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | 58 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); |
59 | 59 | ||
60 | 60 | ||
61 | } | 61 | } |
62 | 62 | ||
63 | private void initLister() { | 63 | private void initLister() { |
64 | iv_last_step.setOnClickListener(this); | 64 | iv_last_step.setOnClickListener(this); |
65 | btn_finish.setOnClickListener(this); | 65 | btn_finish.setOnClickListener(this); |
66 | btn_bangding.setOnClickListener(this); | 66 | btn_bangding.setOnClickListener(this); |
67 | } | 67 | } |
68 | 68 | ||
69 | @Override | 69 | @Override |
70 | public void onClick(View v) { | 70 | public void onClick(View v) { |
71 | switch (v.getId()){ | 71 | switch (v.getId()){ |
72 | case R.id.btn_finish: | 72 | case R.id.btn_finish: |
73 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 73 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
74 | long auserID = 0; | 74 | long auserID = 0; |
75 | try { | 75 | try { |
76 | auserID = Long.parseLong(userID); | 76 | auserID = Long.parseLong(userID); |
77 | } catch (NumberFormatException e) { | 77 | } catch (NumberFormatException e) { |
78 | e.printStackTrace(); | 78 | e.printStackTrace(); |
79 | } | 79 | } |
80 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), | 80 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), |
81 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), | 81 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), |
82 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), | 82 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), |
83 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), | 83 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), |
84 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | 84 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); |
85 | break; | 85 | break; |
86 | case R.id.btn_bangding: | 86 | case R.id.btn_bangding: |
87 | Intent intent = new Intent(); | 87 | Intent intent = new Intent(); |
88 | intent.setClass(ElectronicCardInfoOKActivity.this, BangDingCode.class); | 88 | intent.setClass(ElectronicCardInfoOKActivity.this, BangDingCode.class); |
89 | startActivity(intent); | 89 | startActivity(intent); |
90 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 90 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
91 | 91 | ||
92 | break; | 92 | break; |
93 | case R.id.cancel: | 93 | case R.id.cancel: |
94 | finish(); | 94 | finish(); |
95 | break; | 95 | break; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | } | 100 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardValidationActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | ||
4 | import android.content.Intent; | 3 | import android.content.Intent; |
5 | import android.os.Bundle; | 4 | import android.os.Bundle; |
6 | import android.os.Handler; | 5 | import android.os.Handler; |
7 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | ||
8 | import android.text.TextUtils; | 8 | import android.text.TextUtils; |
9 | import android.view.View; | 9 | import android.view.View; |
10 | import android.widget.Button; | 10 | import android.widget.Button; |
11 | import android.widget.EditText; | 11 | import android.widget.EditText; |
12 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
14 | 14 | ||
15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.db.Content; | 16 | import com.hjx.personalcenter.db.Content; |
17 | import com.hjx.personalcenter.db.SaveParam; | 17 | import com.hjx.personalcenter.db.SaveParam; |
18 | import com.hjx.personalcenter.http.HttpCode; | 18 | import com.hjx.personalcenter.http.HttpCode; |
19 | import com.hjx.personalcenter.http.HttpManager; | 19 | import com.hjx.personalcenter.http.HttpManager; |
20 | import com.hjx.personalcenter.util.AlertUtils; | 20 | import com.hjx.personalcenter.util.AlertUtils; |
21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
22 | 22 | ||
23 | import org.json.JSONObject; | 23 | import org.json.JSONObject; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Created by h on 2017/8/9. | 26 | * Created by h on 2017/8/9. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | public class ElectronicCardValidationActivity extends Activity implements View.OnClickListener { | 29 | public class ElectronicCardValidationActivity extends AppCompatActivity implements View.OnClickListener { |
30 | private Button btn_card_valiyanzhen,get_authcode; | 30 | private Button btn_card_valiyanzhen,get_authcode; |
31 | private EditText phonenumber,anth_6num;//;//密码 | 31 | private EditText phonenumber,anth_6num;//;//密码 |
32 | private TextView menu_title; | 32 | private TextView menu_title; |
33 | private ImageView cancel; | 33 | private ImageView cancel; |
34 | private int i = 0; | 34 | private int i = 0; |
35 | private Thread thread; | 35 | private Thread thread; |
36 | private String sourceStr ="android"; | 36 | private String sourceStr ="android"; |
37 | private String typeStr = "register"; | 37 | private String typeStr = "register"; |
38 | String authcode = ""; | 38 | String authcode = ""; |
39 | Handler handler = new Handler() { | 39 | Handler handler = new Handler() { |
40 | @Override | 40 | @Override |
41 | public void handleMessage(Message msg) { | 41 | public void handleMessage(Message msg) { |
42 | super.handleMessage(msg); | 42 | super.handleMessage(msg); |
43 | JSONObject jsonObject; | 43 | JSONObject jsonObject; |
44 | String status; | 44 | String status; |
45 | switch (msg.what) { | 45 | switch (msg.what) { |
46 | case HttpCode.AUTHCODE_SUCESS: | 46 | case HttpCode.AUTHCODE_SUCESS: |
47 | jsonObject = (JSONObject) msg.obj; | 47 | jsonObject = (JSONObject) msg.obj; |
48 | status = jsonObject.optString("status"); | 48 | status = jsonObject.optString("status"); |
49 | authcode = jsonObject.optString("jsessionid"); | 49 | authcode = jsonObject.optString("jsessionid"); |
50 | if (status.equals("100")) { | 50 | if (status.equals("100")) { |
51 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); | 51 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); |
52 | } | 52 | } |
53 | 53 | ||
54 | break; | 54 | break; |
55 | case HttpCode.AUTHCODE_FAIL: | 55 | case HttpCode.AUTHCODE_FAIL: |
56 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); | 56 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); |
57 | break; | 57 | break; |
58 | case 1: | 58 | case 1: |
59 | get_authcode.setEnabled(false); | 59 | get_authcode.setEnabled(false); |
60 | get_authcode.setClickable(false); | 60 | get_authcode.setClickable(false); |
61 | get_authcode.setText(Integer.toString(i--)+" s"); | 61 | get_authcode.setText(Integer.toString(i--)+" s"); |
62 | if (i<=0){ | 62 | if (i<=0){ |
63 | get_authcode.setEnabled(true); | 63 | get_authcode.setEnabled(true); |
64 | get_authcode.setClickable(true); | 64 | get_authcode.setClickable(true); |
65 | get_authcode.setText("获取验证码"); | 65 | get_authcode.setText("获取验证码"); |
66 | } | 66 | } |
67 | break; | 67 | break; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | }; | 70 | }; |
71 | @Override | 71 | @Override |
72 | protected void onCreate(Bundle savedInstanceState) { | 72 | protected void onCreate(Bundle savedInstanceState) { |
73 | super.onCreate(savedInstanceState); | 73 | super.onCreate(savedInstanceState); |
74 | setContentView(R.layout.activity_electroniccard_validation); | 74 | setContentView(R.layout.activity_electroniccard_validation); |
75 | initView(); | 75 | initView(); |
76 | initData(); | 76 | initData(); |
77 | initLister(); | 77 | initLister(); |
78 | } | 78 | } |
79 | 79 | ||
80 | private void initView() { | 80 | private void initView() { |
81 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); | 81 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); |
82 | get_authcode = (Button) findViewById(R.id.btn_authcode); | 82 | get_authcode = (Button) findViewById(R.id.btn_authcode); |
83 | anth_6num = (EditText) findViewById(R.id.et_authcode); | 83 | anth_6num = (EditText) findViewById(R.id.et_authcode); |
84 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); | 84 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); |
85 | menu_title = (TextView) findViewById(R.id.menu_title); | 85 | menu_title = (TextView) findViewById(R.id.menu_title); |
86 | cancel = (ImageView) findViewById(R.id.cancel); | 86 | cancel = (ImageView) findViewById(R.id.cancel); |
87 | } | 87 | } |
88 | 88 | ||
89 | private void initData() { | 89 | private void initData() { |
90 | if (Content.authcodeflag==1){ | 90 | if (Content.authcodeflag==1){ |
91 | menu_title.setText("更换绑定"); | 91 | menu_title.setText("更换绑定"); |
92 | btn_card_valiyanzhen.setText("确定"); | 92 | btn_card_valiyanzhen.setText("确定"); |
93 | 93 | ||
94 | }else if (Content.authcodeflag==2){ | 94 | }else if (Content.authcodeflag==2){ |
95 | menu_title.setText("修改保卡信息"); | 95 | menu_title.setText("修改保卡信息"); |
96 | btn_card_valiyanzhen.setText("确定"); | 96 | btn_card_valiyanzhen.setText("确定"); |
97 | 97 | ||
98 | }else { | 98 | }else { |
99 | menu_title.setText("填写保卡信息"); | 99 | menu_title.setText("填写保卡信息"); |
100 | btn_card_valiyanzhen.setText("下一步"); | 100 | btn_card_valiyanzhen.setText("下一步"); |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | } | 105 | } |
106 | 106 | ||
107 | private void initLister() { | 107 | private void initLister() { |
108 | get_authcode.setOnClickListener(this); | 108 | get_authcode.setOnClickListener(this); |
109 | btn_card_valiyanzhen.setOnClickListener(this); | 109 | btn_card_valiyanzhen.setOnClickListener(this); |
110 | cancel.setOnClickListener(this); | 110 | cancel.setOnClickListener(this); |
111 | 111 | ||
112 | } | 112 | } |
113 | 113 | ||
114 | @Override | 114 | @Override |
115 | public void onClick(View v) { | 115 | public void onClick(View v) { |
116 | switch (v.getId()){ | 116 | switch (v.getId()){ |
117 | case R.id.btn_card_valiyanzhen: | 117 | case R.id.btn_card_valiyanzhen: |
118 | 118 | ||
119 | String usernameStr = phonenumber.getText().toString().trim(); | 119 | String usernameStr = phonenumber.getText().toString().trim(); |
120 | String authcodeStr = anth_6num.getText().toString().trim(); | 120 | String authcodeStr = anth_6num.getText().toString().trim(); |
121 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { | 121 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { |
122 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); | 122 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); |
123 | return; | 123 | return; |
124 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 124 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ |
125 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); | 125 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); |
126 | 126 | ||
127 | }else if (!authcode.equals(authcodeStr)){ | 127 | }else if (!authcode.equals(authcodeStr)){ |
128 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); | 128 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); |
129 | }else { | 129 | }else { |
130 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 130 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
131 | int auserID = 0; | 131 | int auserID = 0; |
132 | try { | 132 | try { |
133 | auserID = Integer.parseInt(userID); | 133 | auserID = Integer.parseInt(userID); |
134 | } catch (NumberFormatException e) { | 134 | } catch (NumberFormatException e) { |
135 | e.printStackTrace(); | 135 | e.printStackTrace(); |
136 | } | 136 | } |
137 | if (Content.authcodeflag==1){ | 137 | if (Content.authcodeflag==1){ |
138 | //修改账户手机号 | 138 | //修改账户手机号 |
139 | HttpManager.getInstance().changecardinfophone(this, | 139 | HttpManager.getInstance().changecardinfophone(this, |
140 | auserID,usernameStr,authcodeStr); | 140 | auserID,usernameStr,authcodeStr); |
141 | 141 | ||
142 | 142 | ||
143 | }else if (Content.authcodeflag==2){ | 143 | }else if (Content.authcodeflag==2){ |
144 | //修改保卡手机号 | 144 | //修改保卡手机号 |
145 | HttpManager.getInstance().changecardinfophone(this, | 145 | HttpManager.getInstance().changecardinfophone(this, |
146 | auserID,usernameStr,authcodeStr); | 146 | auserID,usernameStr,authcodeStr); |
147 | }else { | 147 | }else { |
148 | String phone =phonenumber.getText().toString().trim(); | 148 | String phone =phonenumber.getText().toString().trim(); |
149 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone ); | 149 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone ); |
150 | Intent intent = new Intent(); | 150 | Intent intent = new Intent(); |
151 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | 151 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); |
152 | startActivity(intent); | 152 | startActivity(intent); |
153 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 153 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
154 | } | 154 | } |
155 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); | 155 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); |
156 | // Intent intent = new Intent(); | 156 | // Intent intent = new Intent(); |
157 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | 157 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); |
158 | // startActivity(intent); | 158 | // startActivity(intent); |
159 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); | 159 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); |
160 | } | 160 | } |
161 | break; | 161 | break; |
162 | case R.id.btn_authcode: | 162 | case R.id.btn_authcode: |
163 | String usernameStr1 = phonenumber.getText().toString().trim(); | 163 | String usernameStr1 = phonenumber.getText().toString().trim(); |
164 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ | 164 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ |
165 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); | 165 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); |
166 | }else { | 166 | }else { |
167 | anth_6num.requestFocus(); | 167 | anth_6num.requestFocus(); |
168 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); | 168 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); |
169 | i = 60; | 169 | i = 60; |
170 | if(thread == null){ | 170 | if(thread == null){ |
171 | thread = new Thread( new ThreadShow()); | 171 | thread = new Thread( new ThreadShow()); |
172 | thread.start(); | 172 | thread.start(); |
173 | } | 173 | } |
174 | 174 | ||
175 | } | 175 | } |
176 | 176 | ||
177 | break; | 177 | break; |
178 | case R.id.cancel: | 178 | case R.id.cancel: |
179 | finish(); | 179 | finish(); |
180 | break; | 180 | break; |
181 | } | 181 | } |
182 | } | 182 | } |
183 | // 线程类 定时器 | 183 | // 线程类 定时器 |
184 | class ThreadShow implements Runnable { | 184 | class ThreadShow implements Runnable { |
185 | 185 | ||
186 | @Override | 186 | @Override |
187 | public void run() { | 187 | public void run() { |
188 | // TODO Auto-generated method stub | 188 | // TODO Auto-generated method stub |
189 | while (true) { | 189 | while (true) { |
190 | try { | 190 | try { |
191 | Thread.sleep(1000); | 191 | Thread.sleep(1000); |
192 | Message msg = new Message(); | 192 | Message msg = new Message(); |
193 | msg.what = 1; | 193 | msg.what = 1; |
194 | handler.sendMessage(msg); | 194 | handler.sendMessage(msg); |
195 | System.out.println("send..."); | 195 | System.out.println("send..."); |
196 | } catch (Exception e) { | 196 | } catch (Exception e) { |
197 | // TODO Auto-generated catch block | 197 | // TODO Auto-generated catch block |
198 | e.printStackTrace(); | 198 | e.printStackTrace(); |
199 | System.out.println("thread error..."); | 199 | System.out.println("thread error..."); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | } | 202 | } |
203 | } | 203 | } |
204 | } | 204 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ForgotPasswordActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | ||
4 | import android.os.Bundle; | 3 | import android.os.Bundle; |
5 | import android.os.Handler; | 4 | import android.os.Handler; |
6 | import android.os.Message; | 5 | import android.os.Message; |
6 | import android.support.v7.app.AppCompatActivity; | ||
7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
8 | import android.text.method.HideReturnsTransformationMethod; | 8 | import android.text.method.HideReturnsTransformationMethod; |
9 | import android.text.method.PasswordTransformationMethod; | 9 | import android.text.method.PasswordTransformationMethod; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.widget.Button; | 11 | import android.widget.Button; |
12 | import android.widget.EditText; | 12 | import android.widget.EditText; |
13 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
14 | 14 | ||
15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.http.HttpCode; | 16 | import com.hjx.personalcenter.http.HttpCode; |
17 | import com.hjx.personalcenter.http.HttpManager; | 17 | import com.hjx.personalcenter.http.HttpManager; |
18 | import com.hjx.personalcenter.util.AlertUtils; | 18 | import com.hjx.personalcenter.util.AlertUtils; |
19 | import com.hjx.personalcenter.util.Judgment; | 19 | import com.hjx.personalcenter.util.Judgment; |
20 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 20 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
22 | 22 | ||
23 | import org.json.JSONException; | 23 | import org.json.JSONException; |
24 | import org.json.JSONObject; | 24 | import org.json.JSONObject; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * 忘记密码 | 27 | * 忘记密码 |
28 | * Created by h on 2017/6/17. | 28 | * Created by h on 2017/6/17. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | public class ForgotPasswordActivity extends Activity implements View.OnClickListener { | 31 | public class ForgotPasswordActivity extends AppCompatActivity implements View.OnClickListener { |
32 | private ImageView back_forgit, iv_pwd_change; | 32 | private ImageView back_forgit, iv_pwd_change; |
33 | private EditText forot_pwd_phone, forot_pwd_anthcode, forot_pwd_pwd, forot_pwd_pwd2; | 33 | private EditText forot_pwd_phone, forot_pwd_anthcode, forot_pwd_pwd, forot_pwd_pwd2; |
34 | private Button forot_pwd_sub, forot_pwd_getanthcode; | 34 | private Button forot_pwd_sub, forot_pwd_getanthcode; |
35 | private String forot_pwd_phone1; | 35 | private String forot_pwd_phone1; |
36 | private String forot_pwd_anthcode1; | 36 | private String forot_pwd_anthcode1; |
37 | private String forot_pwd_pwd3; | 37 | private String forot_pwd_pwd3; |
38 | private String forot_pwd_pwd4; | 38 | private String forot_pwd_pwd4; |
39 | private String typeStr = "login"; | 39 | private String typeStr = "login"; |
40 | private int i = 0; | 40 | private int i = 0; |
41 | private Thread thread; | 41 | private Thread thread; |
42 | public static Boolean showPassword = false; | 42 | public static Boolean showPassword = false; |
43 | 43 | ||
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 | try { | 48 | try { |
49 | JSONObject jsonObject; | 49 | JSONObject jsonObject; |
50 | String status; | 50 | String status; |
51 | switch (msg.what) { | 51 | switch (msg.what) { |
52 | case HttpCode.PASSWORD_SUCESS: | 52 | case HttpCode.PASSWORD_SUCESS: |
53 | jsonObject = (JSONObject) msg.obj; | 53 | jsonObject = (JSONObject) msg.obj; |
54 | status = jsonObject.getString("status"); | 54 | status = jsonObject.getString("status"); |
55 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 55 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
56 | if (status.equals("100")) { | 56 | if (status.equals("100")) { |
57 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改成功"); | 57 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改成功"); |
58 | } | 58 | } |
59 | 59 | ||
60 | break; | 60 | break; |
61 | case HttpCode.PASSWORD_FAIL: | 61 | case HttpCode.PASSWORD_FAIL: |
62 | jsonObject = (JSONObject) msg.obj; | 62 | jsonObject = (JSONObject) msg.obj; |
63 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); | 63 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); |
64 | break; | 64 | break; |
65 | case HttpCode.AUTHCODE_SUCESS1: | 65 | case HttpCode.AUTHCODE_SUCESS1: |
66 | jsonObject = (JSONObject) msg.obj; | 66 | jsonObject = (JSONObject) msg.obj; |
67 | status = jsonObject.optString("status"); | 67 | status = jsonObject.optString("status"); |
68 | if (status.equals("100")) { | 68 | if (status.equals("100")) { |
69 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); | 69 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); |
70 | } | 70 | } |
71 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 71 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
72 | break; | 72 | break; |
73 | case HttpCode.AUTHCODE_FAIL1: | 73 | case HttpCode.AUTHCODE_FAIL1: |
74 | jsonObject = (JSONObject) msg.obj; | 74 | jsonObject = (JSONObject) msg.obj; |
75 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); | 75 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); |
76 | break; | 76 | break; |
77 | case HttpCode.IS_REFISTER: | 77 | case HttpCode.IS_REFISTER: |
78 | jsonObject = (JSONObject) msg.obj; | 78 | jsonObject = (JSONObject) msg.obj; |
79 | status = jsonObject.getString("status"); | 79 | status = jsonObject.getString("status"); |
80 | if (status.equals("true")) { | 80 | if (status.equals("true")) { |
81 | getauthcode(); | 81 | getauthcode(); |
82 | 82 | ||
83 | } else { | 83 | } else { |
84 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); | 84 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); |
85 | } | 85 | } |
86 | break; | 86 | break; |
87 | case 1: | 87 | case 21: |
88 | forot_pwd_getanthcode.setEnabled(false); | 88 | forot_pwd_getanthcode.setEnabled(false); |
89 | forot_pwd_getanthcode.setClickable(false); | 89 | forot_pwd_getanthcode.setClickable(false); |
90 | forot_pwd_getanthcode.setText(Integer.toString(i--) + " s"); | 90 | forot_pwd_getanthcode.setText(Integer.toString(i--) + " s"); |
91 | if (i <= 0) { | 91 | if (i <= 0) { |
92 | forot_pwd_getanthcode.setEnabled(true); | 92 | forot_pwd_getanthcode.setEnabled(true); |
93 | forot_pwd_getanthcode.setClickable(true); | 93 | forot_pwd_getanthcode.setClickable(true); |
94 | forot_pwd_getanthcode.setText("获取验证码"); | 94 | forot_pwd_getanthcode.setText("获取验证码"); |
95 | 95 | ||
96 | } | 96 | } |
97 | break; | 97 | break; |
98 | } | 98 | } |
99 | } catch (JSONException e) { | 99 | } catch (JSONException e) { |
100 | e.printStackTrace(); | 100 | e.printStackTrace(); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | }; | 103 | }; |
104 | 104 | ||
105 | @Override | 105 | @Override |
106 | protected void onCreate(Bundle savedInstanceState) { | 106 | protected void onCreate(Bundle savedInstanceState) { |
107 | super.onCreate(savedInstanceState); | 107 | super.onCreate(savedInstanceState); |
108 | setContentView(R.layout.activity_forgetpsword); | 108 | setContentView(R.layout.activity_forgetpsword); |
109 | initView(); | 109 | initView(); |
110 | setLister(); | 110 | setLister(); |
111 | } | 111 | } |
112 | 112 | ||
113 | //获取验证码 | 113 | //获取验证码 |
114 | private void getauthcode() { | 114 | private void getauthcode() { |
115 | forot_pwd_anthcode.requestFocus(); | 115 | forot_pwd_anthcode.requestFocus(); |
116 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); | 116 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); |
117 | i = 60; | 117 | i = 60; |
118 | if (thread == null) { | 118 | if (thread == null) { |
119 | thread = new Thread(new ThreadShow()); | 119 | thread = new Thread(new ThreadShow()); |
120 | thread.start(); | 120 | thread.start(); |
121 | 121 | ||
122 | } | 122 | } |
123 | 123 | ||
124 | } | 124 | } |
125 | 125 | ||
126 | private void initView() { | 126 | private void initView() { |
127 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); | 127 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); |
128 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); | 128 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); |
129 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); | 129 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); |
130 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); | 130 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); |
131 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); | 131 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); |
132 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); | 132 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); |
133 | iv_pwd_change = (ImageView) findViewById(R.id.iv_pwd_change); | 133 | iv_pwd_change = (ImageView) findViewById(R.id.iv_pwd_change); |
134 | back_forgit = (ImageView) findViewById(R.id.cancel); | 134 | back_forgit = (ImageView) findViewById(R.id.cancel); |
135 | } | 135 | } |
136 | 136 | ||
137 | private void setLister() { | 137 | private void setLister() { |
138 | iv_pwd_change.setOnClickListener(this); | 138 | iv_pwd_change.setOnClickListener(this); |
139 | back_forgit.setOnClickListener(this); | 139 | back_forgit.setOnClickListener(this); |
140 | forot_pwd_sub.setOnClickListener(this); | 140 | forot_pwd_sub.setOnClickListener(this); |
141 | forot_pwd_getanthcode.setOnClickListener(this); | 141 | forot_pwd_getanthcode.setOnClickListener(this); |
142 | 142 | ||
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | @Override | 146 | @Override |
147 | public void onClick(View view) { | 147 | public void onClick(View view) { |
148 | switch (view.getId()) { | 148 | switch (view.getId()) { |
149 | case R.id.btn_ok: | 149 | case R.id.btn_ok: |
150 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 150 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
151 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); | 151 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); |
152 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); | 152 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); |
153 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); | 153 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); |
154 | if (TextUtils.isEmpty(forot_pwd_phone1) || | 154 | if (TextUtils.isEmpty(forot_pwd_phone1) || |
155 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)) { | 155 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)) { |
156 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); | 156 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); |
157 | return; | 157 | return; |
158 | } else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)) { | 158 | } else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)) { |
159 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); | 159 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); |
160 | 160 | ||
161 | } else if (forot_pwd_pwd3.length() < 8 || forot_pwd_pwd4.length() < 8) { | 161 | } else if (forot_pwd_pwd3.length() < 8 || forot_pwd_pwd4.length() < 8) { |
162 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); | 162 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); |
163 | } else if (!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER) || !forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)) { | 163 | } else if (!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER) || !forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)) { |
164 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); | 164 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); |
165 | } else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)) { | 165 | } else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)) { |
166 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); | 166 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); |
167 | return; | 167 | return; |
168 | } else { | 168 | } else { |
169 | //忘记密码接口 | 169 | //忘记密码接口 |
170 | HttpManager.getInstance().forgetpassword(this, forot_pwd_phone1, forot_pwd_pwd3, forot_pwd_anthcode1, handler); | 170 | HttpManager.getInstance().forgetpassword(this, forot_pwd_phone1, forot_pwd_pwd3, forot_pwd_anthcode1, handler); |
171 | } | 171 | } |
172 | break; | 172 | break; |
173 | case R.id.btn_authcode: | 173 | case R.id.btn_authcode: |
174 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 174 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
175 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)) { | 175 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)) { |
176 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); | 176 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); |
177 | } else { | 177 | } else { |
178 | forot_pwd_anthcode.requestFocus(); | 178 | forot_pwd_anthcode.requestFocus(); |
179 | ifregister(); | 179 | ifregister(); |
180 | 180 | ||
181 | } | 181 | } |
182 | 182 | ||
183 | break; | 183 | break; |
184 | case R.id.iv_pwd_change: | 184 | case R.id.iv_pwd_change: |
185 | if (showPassword) {//显示密码 | 185 | if (showPassword) {//显示密码 |
186 | showPassword = !showPassword; | 186 | showPassword = !showPassword; |
187 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); | 187 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); |
188 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 188 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
189 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 189 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
190 | } else {//隐藏密码 | 190 | } else {//隐藏密码 |
191 | showPassword = !showPassword; | 191 | showPassword = !showPassword; |
192 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); | 192 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); |
193 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 193 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
194 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 194 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
195 | } | 195 | } |
196 | break; | 196 | break; |
197 | 197 | ||
198 | case R.id.cancel: | 198 | case R.id.cancel: |
199 | finish(); | 199 | finish(); |
200 | break; | 200 | break; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | //是否注册 | 204 | //是否注册 |
205 | private void ifregister() { | 205 | private void ifregister() { |
206 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 206 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
207 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); | 207 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); |
208 | } | 208 | } |
209 | 209 | ||
210 | // 线程类 定时器 | 210 | // 线程类 定时器 |
211 | class ThreadShow implements Runnable { | 211 | class ThreadShow implements Runnable { |
212 | 212 | ||
213 | @Override | 213 | @Override |
214 | public void run() { | 214 | public void run() { |
215 | // TODO Auto-generated method stub | 215 | // TODO Auto-generated method stub |
216 | while (true) { | 216 | while (true) { |
217 | try { | 217 | try { |
218 | Thread.sleep(1000); | 218 | Thread.sleep(1000); |
219 | // thread.interrupt(); | 219 | // thread.interrupt(); |
220 | Message msg = new Message(); | 220 | Message msg = new Message(); |
221 | msg.what = 1; | 221 | msg.what = 21; |
222 | handler.sendMessage(msg); | 222 | handler.sendMessage(msg); |
223 | System.out.println("内存泄露..."); | 223 | System.out.println("内存泄露..."); |
224 | } catch (Exception e) { | 224 | } catch (Exception e) { |
225 | // TODO Auto-generated catch block | 225 | // TODO Auto-generated catch block |
226 | e.printStackTrace(); | 226 | e.printStackTrace(); |
227 | System.out.println("thread error..."); | 227 | System.out.println("thread error..."); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | } | 230 | } |
231 | } | 231 | } |
232 | } | 232 | } |
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 | * Created by h on 2017/8/9. | 35 | * Created by h on 2017/8/9. |
35 | */ | 36 | */ |
36 | 37 | ||
37 | 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 |
38 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack,DialogCallBack.SchoolCallBack{ | 39 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
39 | private EditText et_username; | 40 | private EditText et_username; |
40 | private TextView et_region,et_grade,et_school; | 41 | private TextView et_region, et_grade, et_school; |
41 | private Button btn_ok; | 42 | private Button btn_ok; |
42 | 43 | ||
43 | @Override | 44 | @Override |
44 | protected void onCreate(Bundle savedInstanceState) { | 45 | protected void onCreate(Bundle savedInstanceState) { |
45 | super.onCreate(savedInstanceState); | 46 | super.onCreate(savedInstanceState); |
46 | setContentView(R.layout.activity_registerinfo); | 47 | setContentView(R.layout.activity_registerinfo); |
47 | initView(); | 48 | initView(); |
48 | initData(); | 49 | initData(); |
49 | initLister(); | 50 | initLister(); |
50 | } | 51 | } |
51 | 52 | ||
52 | private void initView() { | 53 | private void initView() { |
53 | et_username = (EditText) findViewById(R.id.et_username); | 54 | et_username = (EditText) findViewById(R.id.et_username); |
54 | et_region = (TextView) findViewById(R.id.et_region); | 55 | et_region = (TextView) findViewById(R.id.et_region); |
55 | et_grade = (TextView) findViewById(R.id.et_grade); | 56 | et_grade = (TextView) findViewById(R.id.et_grade); |
56 | et_school = (TextView) findViewById(R.id.et_school); | 57 | et_school = (TextView) findViewById(R.id.et_school); |
57 | btn_ok = (Button) findViewById(R.id.btn_ok); | 58 | btn_ok = (Button) findViewById(R.id.btn_ok); |
58 | 59 | ||
59 | 60 | ||
60 | } | 61 | } |
61 | 62 | ||
62 | private void initData() { | 63 | private void initData() { |
63 | if (Content.accountflag ==2){ | 64 | if (Content.accountflag == 2) { |
64 | btn_ok.setText("提交"); | 65 | btn_ok.setText("提交"); |
65 | 66 | ||
66 | } | 67 | } |
67 | 68 | ||
68 | } | 69 | } |
69 | 70 | ||
70 | private void initLister() { | 71 | private void initLister() { |
71 | et_region.setOnClickListener(this); | 72 | et_region.setOnClickListener(this); |
72 | et_grade.setOnClickListener(this); | 73 | et_grade.setOnClickListener(this); |
73 | et_school.setOnClickListener(this); | 74 | et_school.setOnClickListener(this); |
74 | btn_ok.setOnClickListener(this); | 75 | btn_ok.setOnClickListener(this); |
75 | 76 | ||
76 | 77 | ||
77 | } | 78 | } |
78 | 79 | ||
79 | @Override | 80 | @Override |
80 | public void onClick(View v) { | 81 | public void onClick(View v) { |
81 | String register1 = et_username.getText().toString().trim(); | 82 | String register1 = et_username.getText().toString().trim(); |
82 | String register2 = et_region.getText().toString().trim(); | 83 | String register2 = et_region.getText().toString().trim(); |
83 | String register3 = et_grade.getText().toString().trim(); | 84 | String register3 = et_grade.getText().toString().trim(); |
84 | String register4 = et_school.getText().toString().trim(); | 85 | String register4 = et_school.getText().toString().trim(); |
85 | switch (v.getId()){ | 86 | switch (v.getId()) { |
86 | case R.id.et_region: | 87 | case R.id.et_region: |
87 | choiseregion(); | 88 | choiseregion(); |
88 | break; | 89 | break; |
89 | case R.id.et_grade: | 90 | case R.id.et_grade: |
90 | choisegrade(); | 91 | choisegrade(); |
91 | break; | 92 | break; |
92 | case R.id.et_school: | 93 | case R.id.et_school: |
93 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ | 94 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
94 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); | 95 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); |
95 | return; | 96 | return; |
96 | }else { | 97 | } else { |
97 | choiseschool(); | 98 | choiseschool(); |
98 | } | 99 | } |
99 | 100 | ||
100 | break; | 101 | break; |
101 | case R.id.btn_ok: | 102 | case R.id.btn_ok: |
102 | if (TextUtils.isEmpty(register1) || | 103 | if (TextUtils.isEmpty(register1) || |
103 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ | 104 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
104 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | 105 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
105 | return; | 106 | return; |
106 | }else{ | 107 | } else { |
107 | String register5 = et_username.getText().toString().trim(); | 108 | String register5 = et_username.getText().toString().trim(); |
108 | String register6 = et_region.getText().toString().trim(); | 109 | String register6 = et_region.getText().toString().trim(); |
109 | String register7 = et_grade.getText().toString().trim(); | 110 | String register7 = et_grade.getText().toString().trim(); |
110 | String register8 = et_school.getText().toString().trim(); | 111 | String register8 = et_school.getText().toString().trim(); |
111 | if (Content.accountflag ==2){ | 112 | if (Content.accountflag == 2) { |
112 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 113 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
113 | String grade = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADENS); | 114 | String grade = SaveParam.getInstance().getLoginParam(this, SaveParam.GRADENS); |
114 | String School = SaveParam.getInstance().getLoginParam(this,SaveParam.SCHOOOlID); | 115 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); |
115 | if (TextUtils.isEmpty(register8)){ | ||
116 | School = "0"; | ||
117 | } | ||
118 | String regionId = SaveParam.getInstance().getLoginParam(this, SaveParam.COUNTRY); | 116 | String regionId = SaveParam.getInstance().getLoginParam(this, SaveParam.COUNTRY); |
119 | String regionId1 = SaveParam.getInstance().getLoginParam(this, SaveParam.CITYS); | 117 | String regionId1 = SaveParam.getInstance().getLoginParam(this, SaveParam.CITYS); |
120 | String devicenumber =GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 118 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
121 | if (regionId == null) { | 119 | if (regionId == null) { |
122 | regionId = regionId1; | 120 | regionId = regionId1; |
123 | } | 121 | } |
124 | 122 | ||
125 | try { | 123 | try { |
124 | Object schoolss; | ||
126 | long auserID = Long.parseLong(userID); | 125 | long auserID = Long.parseLong(userID); |
127 | long grades = Long.parseLong(grade); | 126 | long grades = Long.parseLong(grade); |
128 | long Schools = Long.parseLong(School); | 127 | if (TextUtils.isEmpty(register8)) { |
128 | schoolss = null; | ||
129 | } else { | ||
130 | schoolss = Long.parseLong(School); | ||
131 | } | ||
129 | long regionIds = Long.parseLong(regionId); | 132 | long regionIds = Long.parseLong(regionId); |
130 | 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", |
131 | register5,grades,Schools,regionIds,devicenumber,register6); | 134 | register5, grades, schoolss, regionIds, devicenumber, register6); |
132 | 135 | ||
133 | } catch (NumberFormatException e) { | 136 | } catch (NumberFormatException e) { |
134 | e.printStackTrace(); | 137 | e.printStackTrace(); |
135 | } | 138 | } |
136 | 139 | ||
137 | }else { | 140 | } else { |
138 | saveinfo(); | 141 | saveinfo(); |
139 | Intent intent = new Intent(); | 142 | Intent intent = new Intent(); |
140 | intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class); | 143 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); |
141 | startActivity(intent); | 144 | startActivity(intent); |
142 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 145 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
143 | } | 146 | } |
144 | 147 | ||
145 | } | 148 | } |
146 | 149 | ||
147 | break; | 150 | break; |
148 | } | 151 | } |
149 | 152 | ||
150 | } | 153 | } |
154 | |||
155 | @Override | ||
156 | protected void onResume() { | ||
157 | super.onResume(); | ||
158 | } | ||
159 | |||
151 | //保存个人信息 | 160 | //保存个人信息 |
152 | private void saveinfo() { | 161 | private void saveinfo() { |
153 | String register1 = et_username.getText().toString().trim(); | 162 | String register1 = et_username.getText().toString().trim(); |
154 | String register2 = et_region.getText().toString().trim(); | 163 | String register2 = et_region.getText().toString().trim(); |
155 | String register3 = et_grade.getText().toString().trim(); | 164 | String register3 = et_grade.getText().toString().trim(); |
156 | String register4 = et_school.getText().toString().trim(); | 165 | String register4 = et_school.getText().toString().trim(); |
157 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register1); | 166 | SaveParam.getInstance().saveLoginParam(this, SaveParam.USERNAME, register1); |
158 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register2); | 167 | SaveParam.getInstance().saveLoginParam(this, SaveParam.ADRESS, register2); |
159 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register3); | 168 | SaveParam.getInstance().saveLoginParam(this, SaveParam.GRADES, register3); |
160 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register4); | 169 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SCHOOL, register4); |
161 | 170 | ||
162 | } | 171 | } |
163 | 172 | ||
164 | //选择地区 | 173 | //选择地区 |
165 | private void choiseregion() { | 174 | private void choiseregion() { |
166 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 175 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
167 | 176 | ||
168 | } | 177 | } |
178 | |||
169 | //选择年级 | 179 | //选择年级 |
170 | private void choisegrade() { | 180 | private void choisegrade() { |
171 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); | 181 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); |
172 | 182 | ||
173 | } | 183 | } |
184 | |||
174 | //选择学校 | 185 | //选择学校 |
175 | private void choiseschool() { | 186 | private void choiseschool() { |
176 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); | 187 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); |
177 | 188 | ||
178 | } | 189 | } |
179 | 190 | ||
180 | 191 | ||
181 | @Override | 192 | @Override |
182 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 193 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
183 | String regionName = data.get(position).getRegionName(); | 194 | String regionName = data.get(position).getRegionName(); |
184 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 195 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); |
185 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 196 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
186 | 197 | ||
187 | 198 | ||
188 | } | 199 | } |
200 | |||
189 | @Override | 201 | @Override |
190 | public boolean onKeyUp(int keyCode, KeyEvent event) { | 202 | public boolean onKeyUp(int keyCode, KeyEvent event) { |
191 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 203 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
192 | finish(); | 204 | finish(); |
193 | 205 | ||
194 | } | 206 | } |
195 | return super.onKeyUp(keyCode, event); | 207 | return super.onKeyUp(keyCode, event); |
196 | } | 208 | } |
197 | 209 | ||
198 | @Override | 210 | @Override |
199 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 211 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
200 | String regionName = data.get(position).getName(); | 212 | String regionName = data.get(position).getName(); |
201 | et_grade.setText(regionName); | 213 | et_grade.setText(regionName); |
202 | 214 | ||
203 | } | 215 | } |
204 | 216 | ||
205 | @Override | 217 | @Override |
206 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 218 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
207 | String regionName = data.get(position).getRegionName(); | 219 | String regionName = data.get(position).getRegionName(); |
208 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 220 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); |
209 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 221 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); |
210 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 222 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
211 | et_region.setText(""); | 223 | et_region.setText(""); |
212 | et_region.setText(provice+regionName); | 224 | et_region.setText(provice + regionName); |
213 | 225 | ||
214 | } | 226 | } |
215 | 227 | ||
216 | @Override | 228 | @Override |
217 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 229 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
218 | String regionName = data.get(position).getRegionName(); | 230 | String regionName = data.get(position).getRegionName(); |
219 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 231 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); |
220 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 232 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); |
221 | et_region.setText(""); | 233 | et_region.setText(""); |
222 | et_region.setText(provices+citys+regionName); | 234 | et_region.setText(provices + citys + regionName); |
223 | 235 | ||
224 | } | 236 | } |
225 | 237 | ||
226 | @Override | 238 | @Override |
227 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 239 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
228 | String regionName = data.get(position).getSchoolName(); | 240 | String regionName = data.get(position).getSchoolName(); |
229 | et_school.setText(regionName); | 241 | et_school.setText(regionName); |
230 | 242 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/TheStartPageActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | ||
4 | import android.content.Intent; | 3 | import android.content.Intent; |
5 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v7.app.AppCompatActivity; | ||
6 | import android.view.View; | 6 | import android.view.View; |
7 | import android.widget.Button; | 7 | import android.widget.Button; |
8 | 8 | ||
9 | import com.hjx.personalcenter.R; | 9 | import com.hjx.personalcenter.R; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Created by h on 2017/8/10. | 12 | * Created by h on 2017/8/10. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | public class TheStartPageActivity extends Activity implements View.OnClickListener { | 15 | public class TheStartPageActivity extends AppCompatActivity implements View.OnClickListener { |
16 | private Button btn_start; | 16 | private Button btn_start; |
17 | @Override | 17 | @Override |
18 | protected void onCreate(Bundle savedInstanceState) { | 18 | protected void onCreate(Bundle savedInstanceState) { |
19 | super.onCreate(savedInstanceState); | 19 | super.onCreate(savedInstanceState); |
20 | setContentView(R.layout.activity_start_page); | 20 | setContentView(R.layout.activity_start_page); |
21 | initView(); | 21 | initView(); |
22 | initData(); | 22 | initData(); |
23 | initLister(); | 23 | initLister(); |
24 | } | 24 | } |
25 | private void initView() { | 25 | private void initView() { |
26 | btn_start = (Button) findViewById(R.id.btn_start); | 26 | btn_start = (Button) findViewById(R.id.btn_start); |
27 | } | 27 | } |
28 | 28 | ||
29 | private void initData() { | 29 | private void initData() { |
30 | 30 | ||
31 | } | 31 | } |
32 | 32 | ||
33 | private void initLister() { | 33 | private void initLister() { |
34 | btn_start.setOnClickListener(this); | 34 | btn_start.setOnClickListener(this); |
35 | } | 35 | } |
36 | 36 | ||
37 | @Override | 37 | @Override |
38 | public void onClick(View v) { | 38 | public void onClick(View v) { |
39 | switch (v.getId()){ | 39 | switch (v.getId()){ |
40 | case R.id.btn_start: | 40 | case R.id.btn_start: |
41 | Intent intent = new Intent(); | 41 | Intent intent = new Intent(); |
42 | intent.setClass(TheStartPageActivity.this,MainActivity.class); | 42 | intent.setClass(TheStartPageActivity.this,MainActivity.class); |
43 | startActivity(intent); | 43 | startActivity(intent); |
44 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 44 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
45 | finish(); | 45 | finish(); |
46 | break; | 46 | break; |
47 | } | 47 | } |
48 | } | 48 | } |
49 | } | 49 | } |
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; | ||
10 | import android.widget.LinearLayout; | ||
9 | import android.widget.TextView; | 11 | import android.widget.TextView; |
10 | 12 | ||
11 | import com.facebook.drawee.view.SimpleDraweeView; | 13 | import com.facebook.drawee.view.SimpleDraweeView; |
12 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
13 | import com.hjx.personalcenter.db.Content; | 15 | import com.hjx.personalcenter.db.Content; |
14 | import com.hjx.personalcenter.db.SaveParam; | 16 | import com.hjx.personalcenter.db.SaveParam; |
15 | import com.hjx.personalcenter.http.HttpManager; | 17 | import com.hjx.personalcenter.http.HttpManager; |
16 | import com.hjx.personalcenter.model.ChildsInfo; | 18 | import com.hjx.personalcenter.model.ChildsInfo; |
19 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
17 | import com.mylhyl.circledialog.CircleDialog; | 20 | import com.mylhyl.circledialog.CircleDialog; |
18 | 21 | ||
19 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
20 | import java.util.List; | 23 | import java.util.List; |
21 | 24 | ||
22 | /** | 25 | /** |
23 | * Created by h on 2017/8/26. | 26 | * Created by h on 2017/8/26. |
24 | */ | 27 | */ |
25 | 28 | ||
26 | public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> { | 29 | public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> implements View.OnClickListener { |
27 | private List<ChildsInfo.DataBean> specailList; | 30 | private List<ChildsInfo.DataBean> specailList; |
28 | private LayoutInflater mInflater; | 31 | private LayoutInflater mInflater; |
29 | private Context mContext ; | 32 | private Context mContext ; |
30 | 33 | ||
31 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) { | 34 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) { |
32 | this.mContext = context; | 35 | this.mContext = context; |
33 | this.specailList = specailList; | 36 | this.specailList = specailList; |
34 | mInflater = LayoutInflater.from(context); | 37 | mInflater = LayoutInflater.from(context); |
35 | } | 38 | } |
36 | 39 | ||
37 | public OnItemClickListener mOnItemClickListener; | 40 | public OnItemClickListener mOnItemClickListener; |
38 | 41 | ||
42 | @Override | ||
43 | public void onClick(View v) { | ||
44 | if (mOnItemClickListener ==null){ | ||
45 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); | ||
46 | } | ||
47 | |||
48 | } | ||
49 | |||
39 | public interface OnItemClickListener { | 50 | public interface OnItemClickListener { |
40 | void onItemClick(View view, int position); | 51 | void onItemClick(View view, int position); |
41 | } | 52 | } |
42 | 53 | ||
43 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { | 54 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { |
44 | this.mOnItemClickListener = mOnItemClickLitener; | 55 | this.mOnItemClickListener = mOnItemClickLitener; |
45 | } | 56 | } |
46 | 57 | ||
47 | public void setList(List<ChildsInfo.DataBean> list) { | 58 | public void setList(List<ChildsInfo.DataBean> list) { |
48 | this.specailList = list; | 59 | this.specailList = list; |
49 | notifyDataSetChanged(); | 60 | notifyDataSetChanged(); |
50 | } | 61 | } |
51 | 62 | ||
52 | @Override | 63 | @Override |
53 | public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 64 | public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
54 | 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); | ||
55 | AccountChildsHolder holder = new AccountChildsHolder(view); | 67 | AccountChildsHolder holder = new AccountChildsHolder(view); |
56 | return holder; | 68 | return holder; |
57 | } | 69 | } |
58 | 70 | ||
59 | @Override | 71 | @Override |
60 | public void onBindViewHolder(AccountChildsHolder holder, int position) { | 72 | public void onBindViewHolder(AccountChildsHolder holder, int position) { |
61 | final ChildsInfo.DataBean bean = specailList.get(position); | 73 | final ChildsInfo.DataBean bean = specailList.get(position); |
62 | if (bean != null) { | 74 | if (bean != null) { |
63 | holder.mSimpleDraweeView.setImageURI(bean.getImage()); | 75 | holder.mSimpleDraweeView.setImageURI(bean.getImage()); |
64 | holder.iv_child_name.setText(bean.getName()); | 76 | holder.iv_child_name.setText(bean.getName()); |
65 | holder.iv_child_grade.setText(bean.getGrade()); | 77 | holder.iv_child_grade.setText(bean.getGrade()); |
66 | holder.iv_child_school.setText(bean.getSchool()); | 78 | holder.iv_child_school.setText(bean.getSchool()); |
67 | holder.iv_child_adress.setText(bean.getRegion()); | 79 | holder.iv_child_adress.setText(bean.getRegion()); |
80 | if ("已使用".equals(bean.getStatus())){ | ||
81 | holder.chang_account.setText("使用中"); | ||
82 | holder.chang_account.setEnabled(false); | ||
83 | holder.delete_account.setEnabled(false); | ||
84 | holder.iv_using_pic.setVisibility(View.VISIBLE); | ||
85 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | ||
86 | }else { | ||
87 | holder.chang_account.setText("切换用户"); | ||
88 | holder.chang_account.setEnabled(true); | ||
89 | holder.delete_account.setEnabled(true); | ||
90 | holder.iv_using_pic.setVisibility(View.GONE); | ||
91 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | ||
92 | } | ||
68 | holder.delete_account.setOnClickListener(new View.OnClickListener() { | 93 | holder.delete_account.setOnClickListener(new View.OnClickListener() { |
69 | @Override | 94 | @Override |
70 | public void onClick(View v) { | 95 | public void onClick(View v) { |
71 | new CircleDialog.Builder((FragmentActivity)mContext) | 96 | new CircleDialog.Builder((FragmentActivity)mContext) |
72 | .setCanceledOnTouchOutside(false) | 97 | .setCanceledOnTouchOutside(false) |
73 | .setWidth(0.4f) | 98 | .setWidth(0.4f) |
74 | .setCancelable(false) | 99 | .setCancelable(false) |
75 | .setText("您确定删除该子账户?") | 100 | .setText("您确定删除该子账户?") |
76 | .setNegative("取消", null) | 101 | .setNegative("取消", null) |
77 | .setPositive("确定", new View.OnClickListener() { | 102 | .setPositive("确定", new View.OnClickListener() { |
78 | @Override | 103 | @Override |
79 | public void onClick(View v) { | 104 | public void onClick(View v) { |
80 | HttpManager.getInstance().deletechildAccountinfo(mContext,bean.getSubAccountId()); | 105 | HttpManager.getInstance().deletechildAccountinfo(mContext,bean.getSubAccountId()); |
81 | } | 106 | } |
82 | }) | 107 | }) |
83 | .show(); | 108 | .show(); |
84 | 109 | ||
85 | 110 | ||
86 | 111 | ||
87 | } | 112 | } |
88 | }); | 113 | }); |
89 | holder.chang_account.setOnClickListener(new View.OnClickListener() { | 114 | holder.chang_account.setOnClickListener(new View.OnClickListener() { |
90 | @Override | 115 | @Override |
91 | public void onClick(View v) { | 116 | public void onClick(View v) { |
92 | new CircleDialog.Builder((FragmentActivity)mContext) | 117 | new CircleDialog.Builder((FragmentActivity)mContext) |
93 | .setCanceledOnTouchOutside(false) | 118 | .setCanceledOnTouchOutside(false) |
94 | .setWidth(0.4f) | 119 | .setWidth(0.4f) |
95 | .setCancelable(false) | 120 | .setCancelable(false) |
96 | .setText("您确定切换为该子账户?") | 121 | .setText("您确定切换为该子账户?") |
97 | .setNegative("取消", null) | 122 | .setNegative("取消", null) |
98 | .setPositive("确定", new View.OnClickListener() { | 123 | .setPositive("确定", new View.OnClickListener() { |
99 | @Override | 124 | @Override |
100 | public void onClick(View v) { | 125 | public void onClick(View v) { |
101 | Content.changgeaccountflag =2; | 126 | Content.changgeaccountflag =2; |
102 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.ACCOUNT,"2"); | 127 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.ACCOUNT,"2"); |
103 | HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId()); | 128 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); |
129 | HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId(), | ||
130 | devicenumber,2); | ||
104 | } | 131 | } |
105 | }) | 132 | }) |
106 | .show(); | 133 | .show(); |
107 | 134 | ||
108 | } | 135 | } |
109 | }); | 136 | }); |
110 | 137 | ||
111 | } | 138 | } |
112 | 139 | ||
113 | 140 | ||
114 | } | 141 | } |
115 | 142 | ||
116 | @Override | 143 | @Override |
117 | public int getItemCount() { | 144 | public int getItemCount() { |
145 | |||
118 | return specailList.size(); | 146 | return specailList.size(); |
119 | } | 147 | } |
120 | 148 | ||
121 | class AccountChildsHolder extends RecyclerView.ViewHolder { | 149 | class AccountChildsHolder extends RecyclerView.ViewHolder { |
150 | ImageView iv_using_pic; | ||
151 | LinearLayout ll_backgrangd; | ||
122 | SimpleDraweeView mSimpleDraweeView; | 152 | SimpleDraweeView mSimpleDraweeView; |
123 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, | 153 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, |
124 | delete_account,chang_account; | 154 | delete_account,chang_account; |
125 | public AccountChildsHolder(View itemView) { | 155 | public AccountChildsHolder(View itemView) { |
126 | super(itemView); | 156 | super(itemView); |
127 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); | 157 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); |
128 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); | 158 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); |
129 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); | 159 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); |
130 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); | 160 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); |
131 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); | 161 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); |
132 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); | 162 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); |
133 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); | 163 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); |
134 | if (Content.changgeaccountflag==2){ | 164 | iv_using_pic = (ImageView) itemView.findViewById(R.id.iv_using_pic); |
135 | chang_account.setText("使用中"); | 165 | ll_backgrangd = (LinearLayout) itemView.findViewById(R.id.ll_backgrangd); |
136 | chang_account.setEnabled(true); | ||
137 | } | ||
138 | 166 | ||
139 | } | 167 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/CitysAdapter.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.hjx.personalcenter.R; | 9 | import com.hjx.personalcenter.R; |
10 | import com.hjx.personalcenter.model.CityInfo; | 10 | import com.hjx.personalcenter.model.CityInfo; |
11 | 11 | ||
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Created by h on 2017/8/18. | 15 | * Created by h on 2017/8/18. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | public class CitysAdapter extends BaseAdapter { | 18 | public class CitysAdapter extends BaseAdapter { |
19 | ArrayList<CityInfo.CitiesBean> objects; | 19 | ArrayList<CityInfo.CitiesBean> objects; |
20 | private Context context; | 20 | private Context context; |
21 | 21 | ||
22 | public CitysAdapter(ArrayList<CityInfo.CitiesBean> objects, Context context) { | 22 | public CitysAdapter(ArrayList<CityInfo.CitiesBean> objects, Context context) { |
23 | this.objects = objects; | 23 | this.objects = objects; |
24 | this.context = context; | 24 | this.context = context; |
25 | } | 25 | } |
26 | 26 | ||
27 | @Override | 27 | @Override |
28 | public int getCount() { | 28 | public int getCount() { |
29 | return objects.size(); | 29 | return objects.size(); |
30 | } | 30 | } |
31 | 31 | ||
32 | @Override | 32 | @Override |
33 | public Object getItem(int position) { | 33 | public Object getItem(int position) { |
34 | return position; | 34 | return position; |
35 | } | 35 | } |
36 | 36 | ||
37 | @Override | 37 | @Override |
38 | public long getItemId(int position) { | 38 | public long getItemId(int position) { |
39 | return position; | 39 | return position; |
40 | } | 40 | } |
41 | 41 | ||
42 | @Override | 42 | @Override |
43 | public View getView(final int position, View convertView, ViewGroup parent) { | 43 | public View getView(final int position, View convertView, ViewGroup parent) { |
44 | 44 | ||
45 | ProvincesAdapter.ViewHolder holder = null; | 45 | ProvincesAdapter.ViewHolder holder = null; |
46 | 46 | ||
47 | if (convertView == null) { | 47 | if (convertView == null) { |
48 | convertView = View.inflate(context, R.layout.custom_adilog_list_item, null); | 48 | convertView = View.inflate(context, R.layout.custom_adilog_list_item, null); |
49 | holder = new ProvincesAdapter.ViewHolder(); | 49 | holder = new ProvincesAdapter.ViewHolder(); |
50 | holder.nameText = (TextView) convertView.findViewById(R.id.list_items); | 50 | holder.nameText = (TextView) convertView.findViewById(R.id.list_items); |
51 | convertView.setTag(holder); | 51 | convertView.setTag(holder); |
52 | } else { | 52 | } else { |
53 | holder = (ProvincesAdapter.ViewHolder) convertView.getTag(); | 53 | holder = (ProvincesAdapter.ViewHolder) convertView.getTag(); |
54 | } | 54 | } |
55 | 55 | ||
56 | holder.nameText.setText(objects.get(position).getRegionName()+"市"); | 56 | holder.nameText.setText(objects.get(position).getRegionName()); |
57 | 57 | ||
58 | return convertView; | 58 | return convertView; |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | static class ViewHolder { | 62 | static class ViewHolder { |
63 | TextView nameText; | 63 | TextView nameText; |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/CountryAdapter.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.hjx.personalcenter.R; | 9 | import com.hjx.personalcenter.R; |
10 | import com.hjx.personalcenter.model.CityInfo; | ||
11 | import com.hjx.personalcenter.model.CountyInfo; | 10 | import com.hjx.personalcenter.model.CountyInfo; |
12 | 11 | ||
13 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
14 | 13 | ||
15 | /** | 14 | /** |
16 | * Created by wei on 2017/8/21. | 15 | * Created by wei on 2017/8/21. |
17 | */ | 16 | */ |
18 | 17 | ||
19 | public class CountryAdapter extends BaseAdapter{ | 18 | public class CountryAdapter extends BaseAdapter{ |
20 | ArrayList<CountyInfo.CountiesBean> objects; | 19 | ArrayList<CountyInfo.CountiesBean> objects; |
21 | private Context context; | 20 | private Context context; |
22 | 21 | ||
23 | public CountryAdapter(ArrayList<CountyInfo.CountiesBean> objects, Context context) { | 22 | public CountryAdapter(ArrayList<CountyInfo.CountiesBean> objects, Context context) { |
24 | this.objects = objects; | 23 | this.objects = objects; |
25 | this.context = context; | 24 | this.context = context; |
26 | } | 25 | } |
27 | 26 | ||
28 | @Override | 27 | @Override |
29 | public int getCount() { | 28 | public int getCount() { |
30 | return objects.size(); | 29 | return objects.size(); |
31 | } | 30 | } |
32 | 31 | ||
33 | @Override | 32 | @Override |
34 | public Object getItem(int position) { | 33 | public Object getItem(int position) { |
35 | return position; | 34 | return position; |
36 | } | 35 | } |
37 | 36 | ||
38 | @Override | 37 | @Override |
39 | public long getItemId(int position) { | 38 | public long getItemId(int position) { |
40 | return position; | 39 | return position; |
41 | } | 40 | } |
42 | 41 | ||
43 | @Override | 42 | @Override |
44 | public View getView(final int position, View convertView, ViewGroup parent) { | 43 | public View getView(final int position, View convertView, ViewGroup parent) { |
45 | 44 | ||
46 | ProvincesAdapter.ViewHolder holder = null; | 45 | ProvincesAdapter.ViewHolder holder = null; |
47 | 46 | ||
48 | if (convertView == null) { | 47 | if (convertView == null) { |
49 | convertView = View.inflate(context, R.layout.custom_adilog_list_item, null); | 48 | convertView = View.inflate(context, R.layout.custom_adilog_list_item, null); |
50 | holder = new ProvincesAdapter.ViewHolder(); | 49 | holder = new ProvincesAdapter.ViewHolder(); |
51 | holder.nameText = (TextView) convertView.findViewById(R.id.list_items); | 50 | holder.nameText = (TextView) convertView.findViewById(R.id.list_items); |
52 | convertView.setTag(holder); | 51 | convertView.setTag(holder); |
53 | } else { | 52 | } else { |
54 | holder = (ProvincesAdapter.ViewHolder) convertView.getTag(); | 53 | holder = (ProvincesAdapter.ViewHolder) convertView.getTag(); |
55 | } | 54 | } |
56 | 55 | ||
57 | holder.nameText.setText(objects.get(position).getRegionName()+"区"); | 56 | holder.nameText.setText(objects.get(position).getRegionName()); |
58 | 57 | ||
59 | return convertView; | 58 | return convertView; |
60 | } | 59 | } |
61 | 60 | ||
62 | 61 | ||
63 | static class ViewHolder { | 62 | static class ViewHolder { |
64 | TextView nameText; | 63 | TextView nameText; |
65 | } | 64 | } |
66 | } | 65 | } |
67 | 66 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/ProvincesAdapter.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.hjx.personalcenter.R; | 9 | import com.hjx.personalcenter.R; |
10 | import com.hjx.personalcenter.model.ProvinceInfo; | 10 | import com.hjx.personalcenter.model.ProvinceInfo; |
11 | 11 | ||
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Created by l on 2017/7/18. | 15 | * Created by l on 2017/7/18. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | public class ProvincesAdapter extends BaseAdapter { | 18 | public class ProvincesAdapter extends BaseAdapter { |
19 | ArrayList<ProvinceInfo.ProvincesBean> objects; | 19 | ArrayList<ProvinceInfo.ProvincesBean> objects; |
20 | private Context context; | 20 | private Context context; |
21 | 21 | ||
22 | public ProvincesAdapter(ArrayList<ProvinceInfo.ProvincesBean> objects, Context context) { | 22 | public ProvincesAdapter(ArrayList<ProvinceInfo.ProvincesBean> objects, Context context) { |
23 | this.objects = objects; | 23 | this.objects = objects; |
24 | this.context = context; | 24 | this.context = context; |
25 | } | 25 | } |
26 | 26 | ||
27 | @Override | 27 | @Override |
28 | public int getCount() { | 28 | public int getCount() { |
29 | return objects.size(); | 29 | return objects.size(); |
30 | } | 30 | } |
31 | 31 | ||
32 | @Override | 32 | @Override |
33 | public Object getItem(int position) { | 33 | public Object getItem(int position) { |
34 | return position; | 34 | return position; |
35 | } | 35 | } |
36 | 36 | ||
37 | @Override | 37 | @Override |
38 | public long getItemId(int position) { | 38 | public long getItemId(int position) { |
39 | return position; | 39 | return position; |
40 | } | 40 | } |
41 | 41 | ||
42 | @Override | 42 | @Override |
43 | public View getView(final int position, View convertView, ViewGroup parent) { | 43 | public View getView(final int position, View convertView, ViewGroup parent) { |
44 | 44 | ||
45 | ViewHolder holder = null; | 45 | ViewHolder holder = null; |
46 | 46 | ||
47 | if (convertView == null) { | 47 | if (convertView == null) { |
48 | convertView = View.inflate(context, R.layout.custom_adilog_list_item, null); | 48 | convertView = View.inflate(context, R.layout.custom_adilog_list_item, null); |
49 | holder = new ViewHolder(); | 49 | holder = new ViewHolder(); |
50 | holder.nameText = (TextView) convertView.findViewById(R.id.list_items); | 50 | holder.nameText = (TextView) convertView.findViewById(R.id.list_items); |
51 | convertView.setTag(holder); | 51 | convertView.setTag(holder); |
52 | } else { | 52 | } else { |
53 | holder = (ProvincesAdapter.ViewHolder) convertView.getTag(); | 53 | holder = (ProvincesAdapter.ViewHolder) convertView.getTag(); |
54 | } | 54 | } |
55 | 55 | ||
56 | holder.nameText.setText(objects.get(position).getRegionName()+"省"); | 56 | holder.nameText.setText(objects.get(position).getRegionName()); |
57 | 57 | ||
58 | return convertView; | 58 | return convertView; |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | static class ViewHolder { | 62 | static class ViewHolder { |
63 | TextView nameText; | 63 | TextView nameText; |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 |
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.view.Gravity; | 8 | import android.view.Gravity; |
9 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
12 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
13 | import android.widget.EditText; | 13 | import android.widget.EditText; |
14 | import android.widget.TextView; | 14 | import android.widget.TextView; |
15 | 15 | ||
16 | import com.bigkoo.pickerview.TimePickerView; | 16 | import com.bigkoo.pickerview.TimePickerView; |
17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 18 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
19 | import com.hjx.personalcenter.customdialog.CountryDialog; | 19 | import com.hjx.personalcenter.customdialog.CountryDialog; |
20 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 20 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
21 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 21 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
22 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 22 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
23 | import com.hjx.personalcenter.db.SaveParam; | 23 | import com.hjx.personalcenter.db.SaveParam; |
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.ChangeInfo; | ||
27 | import com.hjx.personalcenter.model.CityInfo; | 26 | import com.hjx.personalcenter.model.CityInfo; |
28 | import com.hjx.personalcenter.model.CountyInfo; | 27 | import com.hjx.personalcenter.model.CountyInfo; |
29 | import com.hjx.personalcenter.model.GradeInfo; | 28 | import com.hjx.personalcenter.model.GradeInfo; |
30 | import com.hjx.personalcenter.model.ProvinceInfo; | 29 | import com.hjx.personalcenter.model.ProvinceInfo; |
31 | import com.hjx.personalcenter.model.SchoolInfo; | 30 | import com.hjx.personalcenter.model.SchoolInfo; |
32 | import com.hjx.personalcenter.util.AlertUtils; | 31 | import com.hjx.personalcenter.util.AlertUtils; |
33 | import com.hjx.personalcenter.util.BrithdayStar; | 32 | import com.hjx.personalcenter.util.BrithdayStar; |
33 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
34 | import com.mylhyl.circledialog.CircleDialog; | 34 | import com.mylhyl.circledialog.CircleDialog; |
35 | import com.mylhyl.circledialog.callback.ConfigDialog; | 35 | import com.mylhyl.circledialog.callback.ConfigDialog; |
36 | import com.mylhyl.circledialog.params.DialogParams; | 36 | import com.mylhyl.circledialog.params.DialogParams; |
37 | 37 | ||
38 | import org.apache.http.util.TextUtils; | 38 | import org.apache.http.util.TextUtils; |
39 | 39 | ||
40 | import java.io.UnsupportedEncodingException; | ||
41 | import java.text.SimpleDateFormat; | 40 | import java.text.SimpleDateFormat; |
42 | import java.util.ArrayList; | 41 | import java.util.ArrayList; |
43 | import java.util.Date; | 42 | import java.util.Date; |
44 | 43 | ||
45 | /** | 44 | /** |
46 | * Created by h on 2017/8/12. | 45 | * Created by h on 2017/8/12. |
47 | */ | 46 | */ |
48 | 47 | ||
49 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 48 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
50 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 49 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
51 | private View mView; | 50 | private View mView; |
52 | private int type; | 51 | private int type; |
53 | private TimePickerView pvTime; | 52 | private TimePickerView pvTime; |
54 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; | 53 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
55 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; | 54 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; |
56 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 55 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
57 | 56 | ||
58 | public static PresonInfoFragment newInstance(int type) { | 57 | public static PresonInfoFragment newInstance(int type) { |
59 | PresonInfoFragment fragment = new PresonInfoFragment(); | 58 | PresonInfoFragment fragment = new PresonInfoFragment(); |
60 | Bundle bundle = new Bundle(); | 59 | Bundle bundle = new Bundle(); |
61 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 60 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
62 | fragment.setArguments(bundle); | 61 | fragment.setArguments(bundle); |
63 | return fragment; | 62 | return fragment; |
64 | 63 | ||
65 | } | 64 | } |
66 | 65 | ||
67 | @Override | 66 | @Override |
68 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 67 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
69 | if (mView == null) { | 68 | if (mView == null) { |
70 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 69 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
71 | initView(mView); | 70 | initView(mView); |
72 | initData(); | 71 | initData(); |
73 | setLister(); | 72 | setLister(); |
74 | initTimePicker(); | 73 | initTimePicker(); |
75 | 74 | ||
76 | 75 | ||
77 | } | 76 | } |
78 | return mView; | 77 | return mView; |
79 | } | 78 | } |
80 | 79 | ||
81 | //初始化 | 80 | //初始化 |
82 | private void initView(View mView) { | 81 | private void initView(View mView) { |
83 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 82 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
84 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 83 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
85 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 84 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
86 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 85 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
87 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 86 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
88 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 87 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
89 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 88 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
90 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 89 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
91 | 90 | ||
92 | 91 | ||
93 | } | 92 | } |
94 | 93 | ||
95 | private void initData() { | 94 | private void initData() { |
96 | } | 95 | } |
97 | 96 | ||
98 | private void setLister() { | 97 | private void setLister() { |
99 | tv_sex.setOnClickListener(this); | 98 | tv_sex.setOnClickListener(this); |
100 | tv_useinfo_adress.setOnClickListener(this); | 99 | tv_useinfo_adress.setOnClickListener(this); |
101 | tv_useinfo_birthday.setOnClickListener(this); | 100 | tv_useinfo_birthday.setOnClickListener(this); |
102 | tv_useinfo_school.setOnClickListener(this); | 101 | tv_useinfo_school.setOnClickListener(this); |
103 | tv_useinfo_gender.setOnClickListener(this); | 102 | tv_useinfo_gender.setOnClickListener(this); |
104 | } | 103 | } |
105 | 104 | ||
106 | @Override | 105 | @Override |
107 | public void onClick(View v) { | 106 | public void onClick(View v) { |
108 | String presonal1 = tv_username1.getText().toString().trim(); | 107 | String presonal1 = tv_username1.getText().toString().trim(); |
109 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | 108 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); |
110 | String presonal3 = tv_sex.getText().toString().trim(); | 109 | String presonal3 = tv_sex.getText().toString().trim(); |
111 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | 110 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); |
112 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | 111 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); |
113 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | 112 | String presonal6 = tv_useinfo_school.getText().toString().trim(); |
114 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | 113 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); |
115 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | 114 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); |
116 | switch (v.getId()) { | 115 | switch (v.getId()) { |
117 | case R.id.tv_sex: | 116 | case R.id.tv_sex: |
118 | final String[] items = {"男", "女"}; | 117 | final String[] items = {"男", "女"}; |
119 | new CircleDialog.Builder(getActivity()) | 118 | new CircleDialog.Builder(getActivity()) |
120 | .configDialog(new ConfigDialog() { | 119 | .configDialog(new ConfigDialog() { |
121 | @Override | 120 | @Override |
122 | public void onConfig(DialogParams params) { | 121 | public void onConfig(DialogParams params) { |
123 | //增加弹出动画 | 122 | //增加弹出动画 |
124 | params.gravity = Gravity.CENTER; | 123 | params.gravity = Gravity.CENTER; |
125 | } | 124 | } |
126 | }) | 125 | }) |
127 | .setTitle("请选择性别") | 126 | .setTitle("请选择性别") |
128 | .setWidth(0.5f) | 127 | .setWidth(0.5f) |
129 | .setItems(items, new AdapterView.OnItemClickListener() { | 128 | .setItems(items, new AdapterView.OnItemClickListener() { |
130 | @Override | 129 | @Override |
131 | public void onItemClick(AdapterView<?> parent, View view, int | 130 | public void onItemClick(AdapterView<?> parent, View view, int |
132 | position, long id) { | 131 | position, long id) { |
133 | switch (position) { | 132 | switch (position) { |
134 | case 0: | 133 | case 0: |
135 | tv_sex.setText("男"); | 134 | tv_sex.setText("男"); |
136 | break; | 135 | break; |
137 | case 1: | 136 | case 1: |
138 | tv_sex.setText("女"); | 137 | tv_sex.setText("女"); |
139 | break; | 138 | break; |
140 | } | 139 | } |
141 | 140 | ||
142 | } | 141 | } |
143 | }) | 142 | }) |
144 | .show(); | 143 | .show(); |
145 | break; | 144 | break; |
146 | case R.id.tv_useinfo_adress: | 145 | case R.id.tv_useinfo_adress: |
147 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); | 146 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
148 | break; | 147 | break; |
149 | case R.id.tv_useinfo_birthday: | 148 | case R.id.tv_useinfo_birthday: |
150 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 149 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
151 | break; | 150 | break; |
152 | case R.id.tv_useinfo_school: | 151 | case R.id.tv_useinfo_school: |
153 | if (TextUtils.isEmpty(presonal4) || | 152 | if (TextUtils.isEmpty(presonal4) || |
154 | TextUtils.isEmpty(presonal7)) { | 153 | TextUtils.isEmpty(presonal7)) { |
155 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | 154 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); |
156 | return; | 155 | return; |
157 | } else { | 156 | } else { |
158 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | 157 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); |
159 | } | 158 | } |
160 | 159 | ||
161 | 160 | ||
162 | break; | 161 | break; |
163 | case R.id.tv_useinfo_gender: | 162 | case R.id.tv_useinfo_gender: |
164 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); | 163 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
165 | break; | 164 | break; |
166 | case R.id.presonal_sub: | 165 | case R.id.presonal_sub: |
167 | if (TextUtils.isEmpty(presonal1) || | 166 | if (TextUtils.isEmpty(presonal1) || |
168 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || | 167 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || |
169 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || | 168 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || |
170 | TextUtils.isEmpty(presonal8)) { | 169 | TextUtils.isEmpty(presonal8)) { |
171 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); | 170 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
172 | return; | 171 | return; |
173 | } else { | 172 | } else { |
174 | 173 | ||
175 | int a = 0, b = 0; | 174 | int a = 0, b = 0; |
176 | long c = 0; | 175 | int d =1; |
176 | Long f = null; | ||
177 | //保存星座 | 177 | //保存星座 |
178 | BrithdayStar brithdayStar = new BrithdayStar(); | 178 | BrithdayStar brithdayStar = new BrithdayStar(); |
179 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | 179 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); |
180 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); | 180 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); |
181 | 181 | ||
182 | ChangeInfo changeinfo = new ChangeInfo(); | ||
183 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); | 182 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); |
184 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 183 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
185 | if (regionId == null) { | 184 | if (regionId == null) { |
186 | regionId = regionId1; | 185 | regionId = regionId1; |
187 | } | 186 | } |
188 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 187 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
189 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | 188 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); |
190 | if (TextUtils.isEmpty(presonal6)){ | 189 | String type = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.ACCOUNT); |
191 | schoolid = "0"; | ||
192 | } | ||
193 | ChangeInfo.SchoolBean changeinfo2 = new ChangeInfo.SchoolBean(); | ||
194 | try { | ||
195 | a = Integer.parseInt(regionId); | ||
196 | b = Integer.parseInt(grade); | ||
197 | c = Long.parseLong(schoolid); | ||
198 | } catch (NumberFormatException e) { | ||
199 | e.printStackTrace(); | ||
200 | } | ||
201 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 190 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
202 | 191 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | |
203 | changeinfo.setId(userID); | 192 | String changeinfo = null; |
204 | changeinfo.setNickname(presonal1); | ||
205 | changeinfo.setRegionId(a); | ||
206 | changeinfo.setGradeId(b); | ||
207 | changeinfo2.setSchoolId(c); | ||
208 | if ("男".equals(presonal3)) { | 193 | if ("男".equals(presonal3)) { |
209 | changeinfo.setGender("0"); | 194 | changeinfo="male"; |
210 | } else { | 195 | } else { |
211 | changeinfo.setGender("1"); | 196 | changeinfo=("female"); |
212 | } | 197 | } |
213 | changeinfo.setBirthday(presonal5); | ||
214 | ChangeInfo.ContactBean changeinfo1 = new ChangeInfo.ContactBean(); | ||
215 | changeinfo1.setQq(presonal8); | ||
216 | changeinfo.setRegionName(presonal4 + presonal2); | ||
217 | changeinfo.setSchool(changeinfo2); | ||
218 | changeinfo.setContact(changeinfo1); | ||
219 | |||
220 | try { | 198 | try { |
199 | Object c ; | ||
200 | a = Integer.parseInt(regionId); | ||
201 | b = Integer.parseInt(grade); | ||
202 | |||
203 | if (TextUtils.isEmpty(presonal6)){ | ||
204 | c = null; | ||
205 | }else { | ||
206 | c = Long.parseLong(schoolid); | ||
207 | } | ||
208 | d = Integer.parseInt(type); | ||
209 | f = Long.parseLong(userID); | ||
221 | //提交个人信息 | 210 | //提交个人信息 |
222 | HttpManager.getInstance().changepresonalinfo(getActivity(), changeinfo); | 211 | HttpManager.getInstance().changepresonalinfo(getActivity(), |
223 | } catch (UnsupportedEncodingException e) { | 212 | f,d,presonal1,presonal5,b, a,c,presonal8,changeinfo,presonal4 + presonal2,devicenumber); |
213 | |||
214 | } catch (Exception e) { | ||
224 | e.printStackTrace(); | 215 | e.printStackTrace(); |
225 | } | 216 | } |
226 | 217 | ||
227 | |||
228 | break; | 218 | break; |
229 | } | 219 | } |
230 | } | 220 | } |
231 | } | 221 | } |
232 | 222 | ||
233 | //自定义时间选择器 | 223 | //自定义时间选择器 |
234 | private void initTimePicker() { | 224 | private void initTimePicker() { |
235 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 225 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
236 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 226 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
237 | // Calendar selectedDate = Calendar.getInstance(); | 227 | // Calendar selectedDate = Calendar.getInstance(); |
238 | // Calendar startDate = Calendar.getInstance(); | 228 | // Calendar startDate = Calendar.getInstance(); |
239 | // startDate.set(1900, 1, 1); | 229 | // startDate.set(1900, 1, 1); |
240 | // Calendar endDate = Calendar.getInstance(); | 230 | // Calendar endDate = Calendar.getInstance(); |
241 | // endDate.set(2100, 1, 1); | 231 | // endDate.set(2100, 1, 1); |
242 | //时间选择器 | 232 | //时间选择器 |
243 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 233 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
244 | @Override | 234 | @Override |
245 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 235 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
246 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 236 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
247 | /*btn_Time.setText(getTime(date));*/ | 237 | /*btn_Time.setText(getTime(date));*/ |
248 | TextView btn = (TextView) v; | 238 | TextView btn = (TextView) v; |
249 | btn.setText(getTime(date)); | 239 | btn.setText(getTime(date)); |
250 | } | 240 | } |
251 | }) | 241 | }) |
252 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 242 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
253 | .setType(new boolean[]{true, true, true, false, false, false}) | 243 | .setType(new boolean[]{true, true, true, false, false, false}) |
254 | .setLabel("", "", "", "", "", "") | 244 | .setLabel("", "", "", "", "", "") |
255 | .isCenterLabel(false) | 245 | .isCenterLabel(false) |
256 | .setDividerColor(Color.DKGRAY) | 246 | .setDividerColor(Color.DKGRAY) |
257 | .setContentSize(21) | 247 | .setContentSize(21) |
258 | // .setDate(selectedDate) | 248 | // .setDate(selectedDate) |
259 | // .setRangDate(startDate, endDate) | 249 | // .setRangDate(startDate, endDate) |
260 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 250 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
261 | .setDecorView(null) | 251 | .setDecorView(null) |
262 | .setTitleText("购买日期") | 252 | .setTitleText("出生日期") |
263 | .setTitleSize(22) | 253 | .setTitleSize(22) |
264 | .setCancelColor(Color.GRAY) | 254 | .setCancelColor(Color.GRAY) |
265 | .setSubCalSize(22) | 255 | .setSubCalSize(22) |
266 | .setDividerColor(Color.GRAY) | 256 | .setDividerColor(Color.GRAY) |
267 | .setSubmitColor(Color.GRAY) | 257 | .setSubmitColor(Color.GRAY) |
268 | .build(); | 258 | .build(); |
269 | } | 259 | } |
270 | 260 | ||
271 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 261 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
272 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 262 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
273 | return format.format(date); | 263 | return format.format(date); |
274 | } | 264 | } |
275 | 265 | ||
276 | @Override | 266 | @Override |
277 | public void onAttach(Activity activity) { | 267 | public void onAttach(Activity activity) { |
278 | super.onAttach(activity); | 268 | super.onAttach(activity); |
279 | View rootView = activity.getWindow().getDecorView(); | 269 | View rootView = activity.getWindow().getDecorView(); |
280 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | 270 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); |
281 | sub.setOnClickListener(this); | 271 | sub.setOnClickListener(this); |
282 | } | 272 | } |
283 | 273 | ||
284 | @Override | 274 | @Override |
285 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 275 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
286 | String regionName = data.get(position).getRegionName(); | 276 | String regionName = data.get(position).getRegionName(); |
287 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 277 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
288 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | 278 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); |
289 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | 279 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); |
290 | tv_useinfo_adress.setText(""); | 280 | tv_useinfo_adress.setText(""); |
291 | tv_useinfo_adress.setText(provice + regionName); | 281 | tv_useinfo_adress.setText(provice + regionName); |
292 | 282 | ||
293 | 283 | ||
294 | } | 284 | } |
295 | 285 | ||
296 | @Override | 286 | @Override |
297 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 287 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
298 | String regionName = data.get(position).getRegionName(); | 288 | String regionName = data.get(position).getRegionName(); |
299 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 289 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
300 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); | 290 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); |
301 | tv_useinfo_adress.setText(""); | 291 | tv_useinfo_adress.setText(""); |
302 | tv_useinfo_adress.setText(provices + citys + regionName); | 292 | tv_useinfo_adress.setText(provices + citys + regionName); |
303 | 293 | ||
304 | } | 294 | } |
305 | 295 | ||
306 | @Override | 296 | @Override |
307 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 297 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
308 | String regionName = data.get(position).getName(); | 298 | String regionName = data.get(position).getName(); |
309 | tv_useinfo_gender.setText(regionName); | 299 | tv_useinfo_gender.setText(regionName); |
310 | } | 300 | } |
311 | 301 | ||
312 | @Override | 302 | @Override |
313 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 303 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
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 | //提交个人信息 | ||
42 | public static String ID = "id"; | ||
43 | public static String BIRDays = "birthday"; | ||
44 | public static String QQ = "qq"; | ||
45 | public static String GENDER = "gender"; | ||
46 | |||
41 | 47 | ||
42 | 48 | ||
43 | 49 | ||
44 | 50 | ||
45 | 51 | ||
46 | 52 | ||
47 | 53 | ||
48 | } | 54 | } |
49 | 55 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.app.ProgressDialog; | 4 | import android.app.ProgressDialog; |
5 | import android.content.Context; | 5 | import android.content.Context; |
6 | import android.content.Intent; | 6 | import android.content.Intent; |
7 | import android.os.Handler; | 7 | import android.os.Handler; |
8 | import android.os.Message; | 8 | import android.os.Message; |
9 | import android.provider.Settings; | 9 | import android.provider.Settings; |
10 | import android.support.v4.app.FragmentActivity; | 10 | import android.support.v4.app.FragmentActivity; |
11 | import android.util.Log; | 11 | import android.util.Log; |
12 | import android.view.Gravity; | 12 | import android.view.Gravity; |
13 | import android.view.View; | 13 | import android.view.View; |
14 | import android.widget.Toast; | 14 | import android.widget.Toast; |
15 | 15 | ||
16 | import com.google.gson.Gson; | 16 | import com.google.gson.Gson; |
17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 18 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
19 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 19 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.gson.GsonTool; | 21 | import com.hjx.personalcenter.gson.GsonTool; |
22 | import com.hjx.personalcenter.model.AppVersion; | 22 | import com.hjx.personalcenter.model.AppVersion; |
23 | import com.hjx.personalcenter.model.CardInfo; | 23 | import com.hjx.personalcenter.model.CardInfo; |
24 | import com.hjx.personalcenter.model.ChildsInfo; | 24 | import com.hjx.personalcenter.model.ChildsInfo; |
25 | import com.hjx.personalcenter.model.CityInfo; | 25 | import com.hjx.personalcenter.model.CityInfo; |
26 | import com.hjx.personalcenter.model.CountyInfo; | 26 | import com.hjx.personalcenter.model.CountyInfo; |
27 | import com.hjx.personalcenter.model.GradeInfo; | 27 | import com.hjx.personalcenter.model.GradeInfo; |
28 | import com.hjx.personalcenter.model.PesonalInfo; | 28 | import com.hjx.personalcenter.model.PesonalInfo; |
29 | import com.hjx.personalcenter.model.ProvinceInfo; | 29 | import com.hjx.personalcenter.model.ProvinceInfo; |
30 | import com.hjx.personalcenter.model.SchoolInfo; | 30 | import com.hjx.personalcenter.model.SchoolInfo; |
31 | import com.hjx.personalcenter.model.SignInfo; | 31 | import com.hjx.personalcenter.model.SignInfo; |
32 | import com.hjx.personalcenter.util.AlertUtils; | 32 | import com.hjx.personalcenter.util.AlertUtils; |
33 | import com.hjx.personalcenter.util.DialogPermission; | 33 | import com.hjx.personalcenter.util.DialogPermission; |
34 | import com.loopj.android.http.AsyncHttpResponseHandler; | 34 | import com.loopj.android.http.AsyncHttpResponseHandler; |
35 | import com.loopj.android.http.JsonHttpResponseHandler; | 35 | import com.loopj.android.http.JsonHttpResponseHandler; |
36 | import com.loopj.android.http.RequestParams; | 36 | import com.loopj.android.http.RequestParams; |
37 | import com.mylhyl.circledialog.CircleDialog; | 37 | import com.mylhyl.circledialog.CircleDialog; |
38 | import com.mylhyl.circledialog.callback.ConfigText; | 38 | import com.mylhyl.circledialog.callback.ConfigText; |
39 | import com.mylhyl.circledialog.params.TextParams; | 39 | import com.mylhyl.circledialog.params.TextParams; |
40 | 40 | ||
41 | import org.apache.http.Header; | 41 | import org.apache.http.Header; |
42 | import org.apache.http.entity.ByteArrayEntity; | 42 | import org.apache.http.entity.ByteArrayEntity; |
43 | import org.apache.http.message.BasicHeader; | 43 | import org.apache.http.message.BasicHeader; |
44 | import org.apache.http.protocol.HTTP; | 44 | import org.apache.http.protocol.HTTP; |
45 | import org.json.JSONException; | 45 | import org.json.JSONException; |
46 | import org.json.JSONObject; | 46 | import org.json.JSONObject; |
47 | 47 | ||
48 | import java.io.UnsupportedEncodingException; | 48 | import java.io.UnsupportedEncodingException; |
49 | import java.util.ArrayList; | 49 | import java.util.ArrayList; |
50 | import java.util.List; | 50 | import java.util.List; |
51 | 51 | ||
52 | public class HttpManager { | 52 | public class HttpManager { |
53 | private static HttpManager instance; | 53 | private static HttpManager instance; |
54 | private ProgressDialog mProgress = null; | 54 | private ProgressDialog mProgress = null; |
55 | 55 | ||
56 | public static HttpManager getInstance() { | 56 | public static HttpManager getInstance() { |
57 | if (instance == null) { | 57 | if (instance == null) { |
58 | instance = new HttpManager(); | 58 | instance = new HttpManager(); |
59 | } | 59 | } |
60 | return instance; | 60 | return instance; |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | //登录接口 | 64 | //登录接口 |
65 | 65 | ||
66 | 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) { |
67 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 67 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
68 | false, true, null); | 68 | false, true, null); |
69 | 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"); |
70 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 70 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
71 | @Override | 71 | @Override |
72 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 72 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
73 | closeProgress(); | 73 | closeProgress(); |
74 | Message msg = Message.obtain(); | 74 | Message msg = Message.obtain(); |
75 | msg.what = HttpCode.LOGIN_SUCESS; | 75 | msg.what = HttpCode.LOGIN_SUCESS; |
76 | msg.obj = new String(arg2); | 76 | msg.obj = new String(arg2); |
77 | handler.sendMessage(msg); | 77 | handler.sendMessage(msg); |
78 | 78 | ||
79 | 79 | ||
80 | } | 80 | } |
81 | 81 | ||
82 | @Override | 82 | @Override |
83 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 83 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
84 | closeProgress(); | 84 | closeProgress(); |
85 | new CircleDialog.Builder((FragmentActivity) mContext) | 85 | new CircleDialog.Builder((FragmentActivity) mContext) |
86 | .setCanceledOnTouchOutside(false) | 86 | .setCanceledOnTouchOutside(false) |
87 | .setCancelable(false) | 87 | .setCancelable(false) |
88 | .setWidth(0.5f) | 88 | .setWidth(0.5f) |
89 | .configText(new ConfigText() { | 89 | .configText(new ConfigText() { |
90 | @Override | 90 | @Override |
91 | public void onConfig(TextParams params) { | 91 | public void onConfig(TextParams params) { |
92 | params.gravity = Gravity.CENTER; | 92 | params.gravity = Gravity.CENTER; |
93 | params.padding = new int[]{50, 50, 50, 50}; | 93 | params.padding = new int[]{50, 50, 50, 50}; |
94 | } | 94 | } |
95 | }) | 95 | }) |
96 | .setText("当前无网络,请检查网络设置") | 96 | .setText("当前无网络,请检查网络设置") |
97 | .setNegative("继续使用", null) | 97 | .setNegative("继续使用", null) |
98 | .setPositive("设置网络", new View.OnClickListener() { | 98 | .setPositive("设置网络", new View.OnClickListener() { |
99 | @Override | 99 | @Override |
100 | public void onClick(View v) { | 100 | public void onClick(View v) { |
101 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 101 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
102 | mContext.startActivity(intent); | 102 | mContext.startActivity(intent); |
103 | } | 103 | } |
104 | }) | 104 | }) |
105 | .show(); | 105 | .show(); |
106 | } | 106 | } |
107 | }); | 107 | }); |
108 | } | 108 | } |
109 | 109 | ||
110 | //注册接口 | 110 | //注册接口 |
111 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 111 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
112 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 112 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
113 | false, true, null); | 113 | false, true, null); |
114 | JSONObject jsonObject = new JSONObject(); | 114 | JSONObject jsonObject = new JSONObject(); |
115 | ByteArrayEntity entity = null; | 115 | ByteArrayEntity entity = null; |
116 | try { | 116 | try { |
117 | jsonObject.put(HttpKey.USERNAME, username); | 117 | jsonObject.put(HttpKey.USERNAME, username); |
118 | jsonObject.put(HttpKey.PASSWORD, password); | 118 | jsonObject.put(HttpKey.PASSWORD, password); |
119 | jsonObject.put(HttpKey.SMSCODE, smscode); | 119 | jsonObject.put(HttpKey.SMSCODE, smscode); |
120 | jsonObject.put(HttpKey.SOURCE, source); | 120 | jsonObject.put(HttpKey.SOURCE, source); |
121 | Log.e("test", "jsonObject" + jsonObject); | 121 | Log.e("test", "jsonObject" + jsonObject); |
122 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 122 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
123 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 123 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
124 | } catch (JSONException e) { | 124 | } catch (JSONException e) { |
125 | e.printStackTrace(); | 125 | e.printStackTrace(); |
126 | } catch (UnsupportedEncodingException e) { | 126 | } catch (UnsupportedEncodingException e) { |
127 | e.printStackTrace(); | 127 | e.printStackTrace(); |
128 | } | 128 | } |
129 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 129 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
130 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 130 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
131 | @Override | 131 | @Override |
132 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 132 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
133 | super.onSuccess(statusCode, headers, response); | 133 | super.onSuccess(statusCode, headers, response); |
134 | closeProgress(); | 134 | closeProgress(); |
135 | Log.e("test", "onSuccess" + response); | 135 | Log.e("test", "onSuccess" + response); |
136 | Message msg = Message.obtain(); | 136 | Message msg = Message.obtain(); |
137 | msg.what = HttpCode.REGISTERED_SUCESS; | 137 | msg.what = HttpCode.REGISTERED_SUCESS; |
138 | msg.obj = response; | 138 | msg.obj = response; |
139 | handler.sendMessage(msg); | 139 | handler.sendMessage(msg); |
140 | 140 | ||
141 | } | 141 | } |
142 | 142 | ||
143 | @Override | 143 | @Override |
144 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 144 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
145 | super.onFailure(statusCode, headers, throwable, errorResponse); | 145 | super.onFailure(statusCode, headers, throwable, errorResponse); |
146 | closeProgress(); | 146 | closeProgress(); |
147 | Log.e("test", "onFailure" + errorResponse); | 147 | Log.e("test", "onFailure" + errorResponse); |
148 | new CircleDialog.Builder((FragmentActivity) context) | 148 | new CircleDialog.Builder((FragmentActivity) context) |
149 | .setCanceledOnTouchOutside(false) | 149 | .setCanceledOnTouchOutside(false) |
150 | .setCancelable(false) | 150 | .setCancelable(false) |
151 | .setWidth(0.5f) | 151 | .setWidth(0.5f) |
152 | .configText(new ConfigText() { | 152 | .configText(new ConfigText() { |
153 | @Override | 153 | @Override |
154 | public void onConfig(TextParams params) { | 154 | public void onConfig(TextParams params) { |
155 | params.gravity = Gravity.CENTER; | 155 | params.gravity = Gravity.CENTER; |
156 | params.padding = new int[]{50, 50, 50, 50}; | 156 | params.padding = new int[]{50, 50, 50, 50}; |
157 | } | 157 | } |
158 | }) | 158 | }) |
159 | .setText("当前无网络,请检查网络设置") | 159 | .setText("当前无网络,请检查网络设置") |
160 | .setNegative("继续使用", null) | 160 | .setNegative("继续使用", null) |
161 | .setPositive("设置网络", new View.OnClickListener() { | 161 | .setPositive("设置网络", new View.OnClickListener() { |
162 | @Override | 162 | @Override |
163 | public void onClick(View v) { | 163 | public void onClick(View v) { |
164 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 164 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
165 | context.startActivity(intent); | 165 | context.startActivity(intent); |
166 | } | 166 | } |
167 | }) | 167 | }) |
168 | .show(); | 168 | .show(); |
169 | } | 169 | } |
170 | 170 | ||
171 | }); | 171 | }); |
172 | } | 172 | } |
173 | 173 | ||
174 | //注册验证码 | 174 | //注册验证码 |
175 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 175 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
176 | RequestParams params = new RequestParams(); | 176 | RequestParams params = new RequestParams(); |
177 | params.put(HttpKey.TYPE, type); | 177 | params.put(HttpKey.TYPE, type); |
178 | params.put(HttpKey.MOBIL, mobile); | 178 | params.put(HttpKey.MOBIL, mobile); |
179 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 179 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
180 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 180 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
181 | 181 | ||
182 | @Override | 182 | @Override |
183 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 183 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
184 | Log.e("test", "onSuccess-----" + response); | 184 | Log.e("test", "onSuccess-----" + response); |
185 | Message msg = Message.obtain(); | 185 | Message msg = Message.obtain(); |
186 | msg.what = HttpCode.AUTHCODE_SUCESS; | 186 | msg.what = HttpCode.AUTHCODE_SUCESS; |
187 | msg.obj = response; | 187 | msg.obj = response; |
188 | handler.sendMessage(msg); | 188 | handler.sendMessage(msg); |
189 | } | 189 | } |
190 | 190 | ||
191 | @Override | 191 | @Override |
192 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 192 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
193 | new CircleDialog.Builder((FragmentActivity) mContext) | 193 | new CircleDialog.Builder((FragmentActivity) mContext) |
194 | .setCanceledOnTouchOutside(false) | 194 | .setCanceledOnTouchOutside(false) |
195 | .setCancelable(false) | 195 | .setCancelable(false) |
196 | .setWidth(0.5f) | 196 | .setWidth(0.5f) |
197 | .configText(new ConfigText() { | 197 | .configText(new ConfigText() { |
198 | @Override | 198 | @Override |
199 | public void onConfig(TextParams params) { | 199 | public void onConfig(TextParams params) { |
200 | params.gravity = Gravity.CENTER; | 200 | params.gravity = Gravity.CENTER; |
201 | params.padding = new int[]{50, 50, 50, 50}; | 201 | params.padding = new int[]{50, 50, 50, 50}; |
202 | } | 202 | } |
203 | }) | 203 | }) |
204 | .setText("当前无网络,请检查网络设置") | 204 | .setText("当前无网络,请检查网络设置") |
205 | .setNegative("继续使用", null) | 205 | .setNegative("继续使用", null) |
206 | .setPositive("设置网络", new View.OnClickListener() { | 206 | .setPositive("设置网络", new View.OnClickListener() { |
207 | @Override | 207 | @Override |
208 | public void onClick(View v) { | 208 | public void onClick(View v) { |
209 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 209 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
210 | mContext.startActivity(intent); | 210 | mContext.startActivity(intent); |
211 | } | 211 | } |
212 | }) | 212 | }) |
213 | .show(); | 213 | .show(); |
214 | } | 214 | } |
215 | }); | 215 | }); |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | //手机号是否注册 | 219 | //手机号是否注册 |
220 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 220 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
221 | RequestParams params = new RequestParams(); | 221 | RequestParams params = new RequestParams(); |
222 | params.put(HttpKey.USERNAME, mobile); | 222 | params.put(HttpKey.USERNAME, mobile); |
223 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 223 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
224 | @Override | 224 | @Override |
225 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 225 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
226 | Log.e("test", "isregistered" + response.toString()); | 226 | Log.e("test", "isregistered" + response.toString()); |
227 | Message msg = Message.obtain(); | 227 | Message msg = Message.obtain(); |
228 | msg.what = HttpCode.IS_REFISTER; | 228 | msg.what = HttpCode.IS_REFISTER; |
229 | msg.obj = response; | 229 | msg.obj = response; |
230 | handler.sendMessage(msg); | 230 | handler.sendMessage(msg); |
231 | 231 | ||
232 | } | 232 | } |
233 | 233 | ||
234 | @Override | 234 | @Override |
235 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 235 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
236 | new CircleDialog.Builder((FragmentActivity) mContext) | 236 | new CircleDialog.Builder((FragmentActivity) mContext) |
237 | .setCanceledOnTouchOutside(false) | 237 | .setCanceledOnTouchOutside(false) |
238 | .setCancelable(false) | 238 | .setCancelable(false) |
239 | .setWidth(0.5f) | 239 | .setWidth(0.5f) |
240 | .configText(new ConfigText() { | 240 | .configText(new ConfigText() { |
241 | @Override | 241 | @Override |
242 | public void onConfig(TextParams params) { | 242 | public void onConfig(TextParams params) { |
243 | params.gravity = Gravity.CENTER; | 243 | params.gravity = Gravity.CENTER; |
244 | params.padding = new int[]{50, 50, 50, 50}; | 244 | params.padding = new int[]{50, 50, 50, 50}; |
245 | } | 245 | } |
246 | }) | 246 | }) |
247 | .setText("当前无网络,请检查网络设置") | 247 | .setText("当前无网络,请检查网络设置") |
248 | .setNegative("继续使用", null) | 248 | .setNegative("继续使用", null) |
249 | .setPositive("设置网络", new View.OnClickListener() { | 249 | .setPositive("设置网络", new View.OnClickListener() { |
250 | @Override | 250 | @Override |
251 | public void onClick(View v) { | 251 | public void onClick(View v) { |
252 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 252 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
253 | mContext.startActivity(intent); | 253 | mContext.startActivity(intent); |
254 | } | 254 | } |
255 | }) | 255 | }) |
256 | .show(); | 256 | .show(); |
257 | 257 | ||
258 | } | 258 | } |
259 | }); | 259 | }); |
260 | } | 260 | } |
261 | 261 | ||
262 | //修改密码 | 262 | //修改密码 |
263 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 263 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
264 | RequestParams params = new RequestParams(); | 264 | RequestParams params = new RequestParams(); |
265 | params.put(HttpKey.USERNAME, username); | 265 | params.put(HttpKey.USERNAME, username); |
266 | params.put(HttpKey.OLDPASS, old_pwd1); | 266 | params.put(HttpKey.OLDPASS, old_pwd1); |
267 | params.put(HttpKey.NEWPASS, newpassword3); | 267 | params.put(HttpKey.NEWPASS, newpassword3); |
268 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 268 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
269 | HttpClient.getInstance().setTimeout(10 * 1000); | 269 | HttpClient.getInstance().setTimeout(10 * 1000); |
270 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 270 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
271 | @Override | 271 | @Override |
272 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 272 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
273 | try { | 273 | try { |
274 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 274 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
275 | String status = jsonObject.optString("status"); | 275 | String status = jsonObject.optString("status"); |
276 | if (status.equals("100")) { | 276 | if (status.equals("100")) { |
277 | Log.e("test", "onSuccess" + new String(bytes)); | 277 | Log.e("test", "onSuccess" + new String(bytes)); |
278 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 278 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
279 | SaveParam.getInstance().clearData((Activity) context); | 279 | SaveParam.getInstance().clearData((Activity) context); |
280 | Intent intent = new Intent(); | 280 | Intent intent = new Intent(); |
281 | intent.setClass(context, LoginAndRegisterActivity.class); | 281 | intent.setClass(context, LoginAndRegisterActivity.class); |
282 | ((Activity) context).startActivity(intent); | 282 | ((Activity) context).startActivity(intent); |
283 | ((Activity) context).finish(); | 283 | ((Activity) context).finish(); |
284 | } else { | 284 | } else { |
285 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 285 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
286 | } | 286 | } |
287 | } catch (JSONException e) { | 287 | } catch (JSONException e) { |
288 | e.printStackTrace(); | 288 | e.printStackTrace(); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
292 | @Override | 292 | @Override |
293 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 293 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
294 | Log.e("test", "onFailure" + new String(bytes)); | 294 | Log.e("test", "onFailure" + new String(bytes)); |
295 | new CircleDialog.Builder((FragmentActivity) context) | 295 | new CircleDialog.Builder((FragmentActivity) context) |
296 | .setCanceledOnTouchOutside(false) | 296 | .setCanceledOnTouchOutside(false) |
297 | .setCancelable(false) | 297 | .setCancelable(false) |
298 | .setWidth(0.5f) | 298 | .setWidth(0.5f) |
299 | .configText(new ConfigText() { | 299 | .configText(new ConfigText() { |
300 | @Override | 300 | @Override |
301 | public void onConfig(TextParams params) { | 301 | public void onConfig(TextParams params) { |
302 | params.gravity = Gravity.CENTER; | 302 | params.gravity = Gravity.CENTER; |
303 | params.padding = new int[]{50, 50, 50, 50}; | 303 | params.padding = new int[]{50, 50, 50, 50}; |
304 | } | 304 | } |
305 | }) | 305 | }) |
306 | .setText("当前无网络,请检查网络设置") | 306 | .setText("当前无网络,请检查网络设置") |
307 | .setNegative("继续使用", null) | 307 | .setNegative("继续使用", null) |
308 | .setPositive("设置网络", new View.OnClickListener() { | 308 | .setPositive("设置网络", new View.OnClickListener() { |
309 | @Override | 309 | @Override |
310 | public void onClick(View v) { | 310 | public void onClick(View v) { |
311 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 311 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
312 | context.startActivity(intent); | 312 | context.startActivity(intent); |
313 | } | 313 | } |
314 | }) | 314 | }) |
315 | .show(); | 315 | .show(); |
316 | } | 316 | } |
317 | }); | 317 | }); |
318 | 318 | ||
319 | } | 319 | } |
320 | 320 | ||
321 | //忘记密码 | 321 | //忘记密码 |
322 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 322 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
323 | RequestParams params = new RequestParams(); | 323 | RequestParams params = new RequestParams(); |
324 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 324 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
325 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 325 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
326 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 326 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
327 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 327 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
328 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 328 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
329 | @Override | 329 | @Override |
330 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 330 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
331 | try { | 331 | try { |
332 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 332 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
333 | String status = jsonObject.optString("status"); | 333 | String status = jsonObject.optString("status"); |
334 | if (status.equals("100")) { | 334 | if (status.equals("100")) { |
335 | Log.e("test", "onSuccess" + new String(bytes)); | 335 | Log.e("test", "onSuccess" + new String(bytes)); |
336 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 336 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
337 | ((Activity) context).finish(); | 337 | ((Activity) context).finish(); |
338 | } else { | 338 | } else { |
339 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 339 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
340 | } | 340 | } |
341 | } catch (JSONException e) { | 341 | } catch (JSONException e) { |
342 | e.printStackTrace(); | 342 | e.printStackTrace(); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
346 | @Override | 346 | @Override |
347 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 347 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
348 | Log.e("test", "onFailure" + new String(bytes)); | 348 | Log.e("test", "onFailure" + new String(bytes)); |
349 | new CircleDialog.Builder((FragmentActivity) context) | 349 | new CircleDialog.Builder((FragmentActivity) context) |
350 | .setCanceledOnTouchOutside(false) | 350 | .setCanceledOnTouchOutside(false) |
351 | .setCancelable(false) | 351 | .setCancelable(false) |
352 | .setWidth(0.5f) | 352 | .setWidth(0.5f) |
353 | .configText(new ConfigText() { | 353 | .configText(new ConfigText() { |
354 | @Override | 354 | @Override |
355 | public void onConfig(TextParams params) { | 355 | public void onConfig(TextParams params) { |
356 | params.gravity = Gravity.CENTER; | 356 | params.gravity = Gravity.CENTER; |
357 | params.padding = new int[]{50, 50, 50, 50}; | 357 | params.padding = new int[]{50, 50, 50, 50}; |
358 | } | 358 | } |
359 | }) | 359 | }) |
360 | .setText("当前无网络,请检查网络设置") | 360 | .setText("当前无网络,请检查网络设置") |
361 | .setNegative("继续使用", null) | 361 | .setNegative("继续使用", null) |
362 | .setPositive("设置网络", new View.OnClickListener() { | 362 | .setPositive("设置网络", new View.OnClickListener() { |
363 | @Override | 363 | @Override |
364 | public void onClick(View v) { | 364 | public void onClick(View v) { |
365 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 365 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
366 | context.startActivity(intent); | 366 | context.startActivity(intent); |
367 | } | 367 | } |
368 | }) | 368 | }) |
369 | .show(); | 369 | .show(); |
370 | } | 370 | } |
371 | }); | 371 | }); |
372 | 372 | ||
373 | } | 373 | } |
374 | 374 | ||
375 | //保存用户登录信息 | 375 | //保存用户登录信息 |
376 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { | 376 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { |
377 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 377 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
378 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 378 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
379 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 379 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
380 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); | 380 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); |
381 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 381 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
382 | 382 | ||
383 | 383 | ||
384 | } | 384 | } |
385 | 385 | ||
386 | //提交保卡信息 | 386 | //提交保卡信息 |
387 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 387 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
388 | String buyAddress, String buyTime, String alterSaleCall, | 388 | String buyAddress, String buyTime, String alterSaleCall, |
389 | String productModel, String deviceNumber, String macAddress, | 389 | String productModel, String deviceNumber, String macAddress, |
390 | String mobilePhone) { | 390 | String mobilePhone) { |
391 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 391 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
392 | false, true, null); | 392 | false, true, null); |
393 | RequestParams params = new RequestParams(); | 393 | RequestParams params = new RequestParams(); |
394 | 394 | ||
395 | params.put(HttpKey.USEID, userId); | 395 | params.put(HttpKey.USEID, userId); |
396 | params.put(HttpKey.CUSTOMENAME, customerName); | 396 | params.put(HttpKey.CUSTOMENAME, customerName); |
397 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 397 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
398 | params.put(HttpKey.BUYADREES, buyAddress); | 398 | params.put(HttpKey.BUYADREES, buyAddress); |
399 | params.put(HttpKey.BUYTIME, buyTime); | 399 | params.put(HttpKey.BUYTIME, buyTime); |
400 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 400 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
401 | params.put(HttpKey.PRODUCTMODEL, productModel); | 401 | params.put(HttpKey.PRODUCTMODEL, productModel); |
402 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 402 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
403 | params.put(HttpKey.MACADRESS, macAddress); | 403 | params.put(HttpKey.MACADRESS, macAddress); |
404 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 404 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
405 | 405 | ||
406 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 406 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
407 | 407 | ||
408 | Log.e("test", "params" + params); | 408 | Log.e("test", "params" + params); |
409 | HttpClient.getInstance().setTimeout(5 * 1000); | 409 | HttpClient.getInstance().setTimeout(5 * 1000); |
410 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 410 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
411 | @Override | 411 | @Override |
412 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 412 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
413 | JSONObject jsonObject = null; | 413 | JSONObject jsonObject = null; |
414 | closeProgress(); | 414 | closeProgress(); |
415 | try { | 415 | try { |
416 | jsonObject = new JSONObject(new String(bytes)); | 416 | jsonObject = new JSONObject(new String(bytes)); |
417 | String status = jsonObject.optString("status"); | 417 | String status = jsonObject.optString("status"); |
418 | if (status.equals("1")) { | 418 | if (status.equals("1")) { |
419 | Log.e("test", "onSuccess" + jsonObject); | 419 | Log.e("test", "onSuccess" + jsonObject); |
420 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 420 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
421 | Intent intent = new Intent(); | 421 | Intent intent = new Intent(); |
422 | intent.setClass((Activity) context, TheStartPageActivity.class); | 422 | intent.setClass((Activity) context, TheStartPageActivity.class); |
423 | ((Activity) context).startActivity(intent); | 423 | ((Activity) context).startActivity(intent); |
424 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 424 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
425 | ((Activity) context).finish(); | 425 | ((Activity) context).finish(); |
426 | } else { | 426 | } else { |
427 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 427 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
428 | } | 428 | } |
429 | } catch (JSONException e) { | 429 | } catch (JSONException e) { |
430 | e.printStackTrace(); | 430 | e.printStackTrace(); |
431 | } | 431 | } |
432 | 432 | ||
433 | 433 | ||
434 | } | 434 | } |
435 | 435 | ||
436 | @Override | 436 | @Override |
437 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 437 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
438 | Log.e("test", "onFailure" + (throwable)); | 438 | Log.e("test", "onFailure" + (throwable)); |
439 | closeProgress(); | 439 | closeProgress(); |
440 | new CircleDialog.Builder((FragmentActivity) context) | 440 | new CircleDialog.Builder((FragmentActivity) context) |
441 | .setCanceledOnTouchOutside(false) | 441 | .setCanceledOnTouchOutside(false) |
442 | .setCancelable(false) | 442 | .setCancelable(false) |
443 | .setWidth(0.5f) | 443 | .setWidth(0.5f) |
444 | .configText(new ConfigText() { | 444 | .configText(new ConfigText() { |
445 | @Override | 445 | @Override |
446 | public void onConfig(TextParams params) { | 446 | public void onConfig(TextParams params) { |
447 | params.gravity = Gravity.CENTER; | 447 | params.gravity = Gravity.CENTER; |
448 | params.padding = new int[]{50, 50, 50, 50}; | 448 | params.padding = new int[]{50, 50, 50, 50}; |
449 | } | 449 | } |
450 | }) | 450 | }) |
451 | .setText("当前无网络,请检查网络设置") | 451 | .setText("当前无网络,请检查网络设置") |
452 | .setNegative("继续使用", null) | 452 | .setNegative("继续使用", null) |
453 | .setPositive("设置网络", new View.OnClickListener() { | 453 | .setPositive("设置网络", new View.OnClickListener() { |
454 | @Override | 454 | @Override |
455 | public void onClick(View v) { | 455 | public void onClick(View v) { |
456 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 456 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
457 | context.startActivity(intent); | 457 | context.startActivity(intent); |
458 | } | 458 | } |
459 | }) | 459 | }) |
460 | .show(); | 460 | .show(); |
461 | 461 | ||
462 | } | 462 | } |
463 | }); | 463 | }); |
464 | 464 | ||
465 | } | 465 | } |
466 | 466 | ||
467 | //获取保卡信息 | 467 | //获取保卡信息 |
468 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { | 468 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { |
469 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 469 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
470 | false, true, null); | 470 | false, true, null); |
471 | HttpClient.getInstance().setTimeout(5 * 1000); | 471 | HttpClient.getInstance().setTimeout(5 * 1000); |
472 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 472 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
473 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { | 473 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { |
474 | @Override | 474 | @Override |
475 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 475 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
476 | closeProgress(); | 476 | closeProgress(); |
477 | Log.e("test", "保卡信息" + new String(arg2)); | 477 | Log.e("test", "保卡信息" + new String(arg2)); |
478 | try { | 478 | try { |
479 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 479 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
480 | int status = jsonObject.optInt("status"); | 480 | int status = jsonObject.optInt("status"); |
481 | if (status == 1) { | 481 | if (status == 1) { |
482 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 482 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
483 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 483 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
484 | Message msg = Message.obtain(); | 484 | Message msg = Message.obtain(); |
485 | msg.what = HttpCode.SUCHCARDINFO; | 485 | msg.what = HttpCode.SUCHCARDINFO; |
486 | msg.obj = schoolInfoBeanList; | 486 | msg.obj = schoolInfoBeanList; |
487 | handler.sendMessage(msg); | 487 | handler.sendMessage(msg); |
488 | 488 | ||
489 | 489 | ||
490 | } else { | 490 | } else { |
491 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 491 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
492 | 492 | ||
493 | } | 493 | } |
494 | } catch (JSONException e) { | 494 | } catch (JSONException e) { |
495 | e.printStackTrace(); | 495 | e.printStackTrace(); |
496 | } | 496 | } |
497 | 497 | ||
498 | } | 498 | } |
499 | 499 | ||
500 | @Override | 500 | @Override |
501 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 501 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
502 | closeProgress(); | 502 | closeProgress(); |
503 | new CircleDialog.Builder((FragmentActivity) mContext) | 503 | new CircleDialog.Builder((FragmentActivity) mContext) |
504 | .setCanceledOnTouchOutside(false) | 504 | .setCanceledOnTouchOutside(false) |
505 | .setCancelable(false) | 505 | .setCancelable(false) |
506 | .setWidth(0.5f) | 506 | .setWidth(0.5f) |
507 | .configText(new ConfigText() { | 507 | .configText(new ConfigText() { |
508 | @Override | 508 | @Override |
509 | public void onConfig(TextParams params) { | 509 | public void onConfig(TextParams params) { |
510 | params.gravity = Gravity.CENTER; | 510 | params.gravity = Gravity.CENTER; |
511 | params.padding = new int[]{50, 50, 50, 50}; | 511 | params.padding = new int[]{50, 50, 50, 50}; |
512 | } | 512 | } |
513 | }) | 513 | }) |
514 | .setText("当前无网络,请检查网络设置") | 514 | .setText("当前无网络,请检查网络设置") |
515 | .setNegative("继续使用", null) | 515 | .setNegative("继续使用", null) |
516 | .setPositive("设置网络", new View.OnClickListener() { | 516 | .setPositive("设置网络", new View.OnClickListener() { |
517 | @Override | 517 | @Override |
518 | public void onClick(View v) { | 518 | public void onClick(View v) { |
519 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 519 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
520 | mContext.startActivity(intent); | 520 | mContext.startActivity(intent); |
521 | } | 521 | } |
522 | }) | 522 | }) |
523 | .show(); | 523 | .show(); |
524 | } | 524 | } |
525 | }); | 525 | }); |
526 | } | 526 | } |
527 | 527 | ||
528 | //修改保卡信息电话 | 528 | //修改保卡信息电话 |
529 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { | 529 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { |
530 | RequestParams params = new RequestParams(); | 530 | RequestParams params = new RequestParams(); |
531 | params.put("userId", userId); | 531 | params.put("userId", userId); |
532 | params.put("customerPhone", customerPhone); | 532 | params.put("customerPhone", customerPhone); |
533 | params.put("authCode", authCode); | 533 | params.put("authCode", authCode); |
534 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 534 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
535 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 535 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
536 | @Override | 536 | @Override |
537 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 537 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
538 | try { | 538 | try { |
539 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 539 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
540 | String status = jsonObject.optString("status"); | 540 | String status = jsonObject.optString("status"); |
541 | if (status.equals("1")) { | 541 | if (status.equals("1")) { |
542 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 542 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
543 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 543 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
544 | ((Activity) mContext).finish(); | 544 | ((Activity) mContext).finish(); |
545 | } else if (status.equals("1001")) { | 545 | } else if (status.equals("1001")) { |
546 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 546 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
547 | } else { | 547 | } else { |
548 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 548 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
549 | } | 549 | } |
550 | } catch (JSONException e) { | 550 | } catch (JSONException e) { |
551 | e.printStackTrace(); | 551 | e.printStackTrace(); |
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | @Override | 555 | @Override |
556 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 556 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
557 | Log.e("test", "onFailure" + new String(bytes)); | 557 | Log.e("test", "onFailure" + new String(bytes)); |
558 | new CircleDialog.Builder((FragmentActivity) mContext) | 558 | new CircleDialog.Builder((FragmentActivity) mContext) |
559 | .setCanceledOnTouchOutside(false) | 559 | .setCanceledOnTouchOutside(false) |
560 | .setCancelable(false) | 560 | .setCancelable(false) |
561 | .setWidth(0.5f) | 561 | .setWidth(0.5f) |
562 | .configText(new ConfigText() { | 562 | .configText(new ConfigText() { |
563 | @Override | 563 | @Override |
564 | public void onConfig(TextParams params) { | 564 | public void onConfig(TextParams params) { |
565 | params.gravity = Gravity.CENTER; | 565 | params.gravity = Gravity.CENTER; |
566 | params.padding = new int[]{50, 50, 50, 50}; | 566 | params.padding = new int[]{50, 50, 50, 50}; |
567 | } | 567 | } |
568 | }) | 568 | }) |
569 | .setText("当前无网络,请检查网络设置") | 569 | .setText("当前无网络,请检查网络设置") |
570 | .setNegative("继续使用", null) | 570 | .setNegative("继续使用", null) |
571 | .setPositive("设置网络", new View.OnClickListener() { | 571 | .setPositive("设置网络", new View.OnClickListener() { |
572 | @Override | 572 | @Override |
573 | public void onClick(View v) { | 573 | public void onClick(View v) { |
574 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 574 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
575 | mContext.startActivity(intent); | 575 | mContext.startActivity(intent); |
576 | } | 576 | } |
577 | }) | 577 | }) |
578 | .show(); | 578 | .show(); |
579 | } | 579 | } |
580 | }); | 580 | }); |
581 | } | 581 | } |
582 | 582 | ||
583 | //修改保卡信息地址 | 583 | //修改保卡信息地址 |
584 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { | 584 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { |
585 | RequestParams params = new RequestParams(); | 585 | RequestParams params = new RequestParams(); |
586 | params.put("userId", userId); | 586 | params.put("userId", userId); |
587 | params.put("customerPhone", customerPhone); | 587 | params.put("customerPhone", customerPhone); |
588 | params.put("authCode", authCode); | 588 | params.put("authCode", authCode); |
589 | params.put("customerAddress", customerAddress); | 589 | params.put("customerAddress", customerAddress); |
590 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 590 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
591 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 591 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
592 | @Override | 592 | @Override |
593 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 593 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
594 | try { | 594 | try { |
595 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 595 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
596 | String status = jsonObject.optString("status"); | 596 | String status = jsonObject.optString("status"); |
597 | if (status.equals("1")) { | 597 | if (status.equals("1")) { |
598 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 598 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
599 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 599 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
600 | ((Activity) mContext).finish(); | 600 | ((Activity) mContext).finish(); |
601 | } else { | 601 | } else { |
602 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 602 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
603 | } | 603 | } |
604 | } catch (JSONException e) { | 604 | } catch (JSONException e) { |
605 | e.printStackTrace(); | 605 | e.printStackTrace(); |
606 | } | 606 | } |
607 | } | 607 | } |
608 | 608 | ||
609 | @Override | 609 | @Override |
610 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 610 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
611 | Log.e("test", "onFailure" + new String(bytes)); | 611 | Log.e("test", "onFailure" + new String(bytes)); |
612 | new CircleDialog.Builder((FragmentActivity) mContext) | 612 | new CircleDialog.Builder((FragmentActivity) mContext) |
613 | .setCanceledOnTouchOutside(false) | 613 | .setCanceledOnTouchOutside(false) |
614 | .setCancelable(false) | 614 | .setCancelable(false) |
615 | .setWidth(0.5f) | 615 | .setWidth(0.5f) |
616 | .configText(new ConfigText() { | 616 | .configText(new ConfigText() { |
617 | @Override | 617 | @Override |
618 | public void onConfig(TextParams params) { | 618 | public void onConfig(TextParams params) { |
619 | params.gravity = Gravity.CENTER; | 619 | params.gravity = Gravity.CENTER; |
620 | params.padding = new int[]{50, 50, 50, 50}; | 620 | params.padding = new int[]{50, 50, 50, 50}; |
621 | } | 621 | } |
622 | }) | 622 | }) |
623 | .setText("当前无网络,请检查网络设置") | 623 | .setText("当前无网络,请检查网络设置") |
624 | .setNegative("继续使用", null) | 624 | .setNegative("继续使用", null) |
625 | .setPositive("设置网络", new View.OnClickListener() { | 625 | .setPositive("设置网络", new View.OnClickListener() { |
626 | @Override | 626 | @Override |
627 | public void onClick(View v) { | 627 | public void onClick(View v) { |
628 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 628 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
629 | mContext.startActivity(intent); | 629 | mContext.startActivity(intent); |
630 | } | 630 | } |
631 | }) | 631 | }) |
632 | .show(); | 632 | .show(); |
633 | } | 633 | } |
634 | }); | 634 | }); |
635 | } | 635 | } |
636 | 636 | ||
637 | //验证是否保卡信息 | 637 | //验证是否保卡信息 |
638 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { | 638 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { |
639 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 639 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
640 | false, true, null); | 640 | false, true, null); |
641 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 641 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
642 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { | 642 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { |
643 | @Override | 643 | @Override |
644 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 644 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
645 | Log.e("test", "---" + new String(arg2)); | 645 | Log.e("test", "---" + new String(arg2)); |
646 | closeProgress(); | 646 | closeProgress(); |
647 | Message msg = Message.obtain(); | 647 | Message msg = Message.obtain(); |
648 | msg.what = HttpCode.CHECKCARD; | 648 | msg.what = HttpCode.CHECKCARD; |
649 | msg.obj = new String(arg2); | 649 | msg.obj = new String(arg2); |
650 | handler.sendMessage(msg); | 650 | handler.sendMessage(msg); |
651 | 651 | ||
652 | 652 | ||
653 | } | 653 | } |
654 | 654 | ||
655 | @Override | 655 | @Override |
656 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 656 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
657 | closeProgress(); | 657 | closeProgress(); |
658 | new CircleDialog.Builder((FragmentActivity) mContext) | 658 | new CircleDialog.Builder((FragmentActivity) mContext) |
659 | .setCanceledOnTouchOutside(false) | 659 | .setCanceledOnTouchOutside(false) |
660 | .setCancelable(false) | 660 | .setCancelable(false) |
661 | .setWidth(0.5f) | 661 | .setWidth(0.5f) |
662 | .configText(new ConfigText() { | 662 | .configText(new ConfigText() { |
663 | @Override | 663 | @Override |
664 | public void onConfig(TextParams params) { | 664 | public void onConfig(TextParams params) { |
665 | params.gravity = Gravity.CENTER; | 665 | params.gravity = Gravity.CENTER; |
666 | params.padding = new int[]{50, 50, 50, 50}; | 666 | params.padding = new int[]{50, 50, 50, 50}; |
667 | } | 667 | } |
668 | }) | 668 | }) |
669 | .setText("当前无网络,请检查网络设置") | 669 | .setText("当前无网络,请检查网络设置") |
670 | .setNegative("继续使用", null) | 670 | .setNegative("继续使用", null) |
671 | .setPositive("设置网络", new View.OnClickListener() { | 671 | .setPositive("设置网络", new View.OnClickListener() { |
672 | @Override | 672 | @Override |
673 | public void onClick(View v) { | 673 | public void onClick(View v) { |
674 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 674 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
675 | mContext.startActivity(intent); | 675 | mContext.startActivity(intent); |
676 | } | 676 | } |
677 | }) | 677 | }) |
678 | .show(); | 678 | .show(); |
679 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 679 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
680 | } | 680 | } |
681 | }); | 681 | }); |
682 | } | 682 | } |
683 | 683 | ||
684 | ///获取年级 | 684 | ///获取年级 |
685 | public void getgrade(final Context mContext, final Handler handler) { | 685 | public void getgrade(final Context mContext, final Handler handler) { |
686 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 686 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
687 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 687 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
688 | @Override | 688 | @Override |
689 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 689 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
690 | Log.e("test", "年级" + new String(arg2)); | 690 | Log.e("test", "年级" + new String(arg2)); |
691 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 691 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
692 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 692 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
693 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 693 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
694 | String name = gradeInfo.getData().get(i).getName(); | 694 | String name = gradeInfo.getData().get(i).getName(); |
695 | int id = gradeInfo.getData().get(i).getId(); | 695 | int id = gradeInfo.getData().get(i).getId(); |
696 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 696 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
697 | for (int j = 0; j < gradeinfoList.size(); j++) { | 697 | for (int j = 0; j < gradeinfoList.size(); j++) { |
698 | String secondname = gradeinfoList.get(j).getName(); | 698 | String secondname = gradeinfoList.get(j).getName(); |
699 | int secondid = gradeinfoList.get(j).getId(); | 699 | int secondid = gradeinfoList.get(j).getId(); |
700 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 700 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
701 | dataBean.setName(secondname); | 701 | dataBean.setName(secondname); |
702 | dataBean.setId(secondid); | 702 | dataBean.setId(secondid); |
703 | gradeInfoLists.add(dataBean); | 703 | gradeInfoLists.add(dataBean); |
704 | } | 704 | } |
705 | 705 | ||
706 | } | 706 | } |
707 | 707 | ||
708 | Message message = Message.obtain(); | 708 | Message message = Message.obtain(); |
709 | message.what = HttpCode.GRADER; | 709 | message.what = HttpCode.GRADER; |
710 | message.obj = gradeInfoLists; | 710 | message.obj = gradeInfoLists; |
711 | handler.sendMessage(message); | 711 | handler.sendMessage(message); |
712 | 712 | ||
713 | 713 | ||
714 | } | 714 | } |
715 | 715 | ||
716 | @Override | 716 | @Override |
717 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 717 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
718 | new CircleDialog.Builder((FragmentActivity) mContext) | 718 | new CircleDialog.Builder((FragmentActivity) mContext) |
719 | .setCanceledOnTouchOutside(false) | 719 | .setCanceledOnTouchOutside(false) |
720 | .setCancelable(false) | 720 | .setCancelable(false) |
721 | .setWidth(0.5f) | 721 | .setWidth(0.5f) |
722 | .configText(new ConfigText() { | 722 | .configText(new ConfigText() { |
723 | @Override | 723 | @Override |
724 | public void onConfig(TextParams params) { | 724 | public void onConfig(TextParams params) { |
725 | params.gravity = Gravity.CENTER; | 725 | params.gravity = Gravity.CENTER; |
726 | params.padding = new int[]{50, 50, 50, 50}; | 726 | params.padding = new int[]{50, 50, 50, 50}; |
727 | } | 727 | } |
728 | }) | 728 | }) |
729 | .setText("当前无网络,请检查网络设置") | 729 | .setText("当前无网络,请检查网络设置") |
730 | .setNegative("继续使用", null) | 730 | .setNegative("继续使用", null) |
731 | .setPositive("设置网络", new View.OnClickListener() { | 731 | .setPositive("设置网络", new View.OnClickListener() { |
732 | @Override | 732 | @Override |
733 | public void onClick(View v) { | 733 | public void onClick(View v) { |
734 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 734 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
735 | mContext.startActivity(intent); | 735 | mContext.startActivity(intent); |
736 | } | 736 | } |
737 | }) | 737 | }) |
738 | .show(); | 738 | .show(); |
739 | } | 739 | } |
740 | }); | 740 | }); |
741 | } | 741 | } |
742 | 742 | ||
743 | /** | 743 | /** |
744 | * 获取学校 | 744 | * 获取学校 |
745 | * | 745 | * |
746 | * @param mContext | 746 | * @param mContext |
747 | * @param regionId | 747 | * @param regionId |
748 | * @param gradeId | 748 | * @param gradeId |
749 | * @param handler | 749 | * @param handler |
750 | */ | 750 | */ |
751 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 751 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
752 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 752 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
753 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 753 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
754 | @Override | 754 | @Override |
755 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 755 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
756 | Log.e("test", "学校" + new String(arg2)); | 756 | Log.e("test", "学校" + new String(arg2)); |
757 | try { | 757 | try { |
758 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 758 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
759 | int status = jsonObject.optInt("status"); | 759 | int status = jsonObject.optInt("status"); |
760 | if (status == 1) { | 760 | if (status == 1) { |
761 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 761 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
762 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 762 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
763 | Message message = Message.obtain(); | 763 | Message message = Message.obtain(); |
764 | message.what = HttpCode.SCHOOL; | 764 | message.what = HttpCode.SCHOOL; |
765 | message.obj = schoolInfoBeanList; | 765 | message.obj = schoolInfoBeanList; |
766 | handler.sendMessage(message); | 766 | handler.sendMessage(message); |
767 | 767 | ||
768 | 768 | ||
769 | } else { | 769 | } else { |
770 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 770 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
771 | 771 | ||
772 | } | 772 | } |
773 | } catch (JSONException e) { | 773 | } catch (JSONException e) { |
774 | e.printStackTrace(); | 774 | e.printStackTrace(); |
775 | } | 775 | } |
776 | 776 | ||
777 | } | 777 | } |
778 | 778 | ||
779 | @Override | 779 | @Override |
780 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 780 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
781 | new CircleDialog.Builder((FragmentActivity) mContext) | 781 | new CircleDialog.Builder((FragmentActivity) mContext) |
782 | .setCanceledOnTouchOutside(false) | 782 | .setCanceledOnTouchOutside(false) |
783 | .setCancelable(false) | 783 | .setCancelable(false) |
784 | .setWidth(0.5f) | 784 | .setWidth(0.5f) |
785 | .configText(new ConfigText() { | 785 | .configText(new ConfigText() { |
786 | @Override | 786 | @Override |
787 | public void onConfig(TextParams params) { | 787 | public void onConfig(TextParams params) { |
788 | params.gravity = Gravity.CENTER; | 788 | params.gravity = Gravity.CENTER; |
789 | params.padding = new int[]{50, 50, 50, 50}; | 789 | params.padding = new int[]{50, 50, 50, 50}; |
790 | } | 790 | } |
791 | }) | 791 | }) |
792 | .setText("当前无网络,请检查网络设置") | 792 | .setText("当前无网络,请检查网络设置") |
793 | .setNegative("继续使用", null) | 793 | .setNegative("继续使用", null) |
794 | .setPositive("设置网络", new View.OnClickListener() { | 794 | .setPositive("设置网络", new View.OnClickListener() { |
795 | @Override | 795 | @Override |
796 | public void onClick(View v) { | 796 | public void onClick(View v) { |
797 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 797 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
798 | mContext.startActivity(intent); | 798 | mContext.startActivity(intent); |
799 | } | 799 | } |
800 | }) | 800 | }) |
801 | .show(); | 801 | .show(); |
802 | } | 802 | } |
803 | }); | 803 | }); |
804 | } | 804 | } |
805 | 805 | ||
806 | 806 | ||
807 | /** | 807 | /** |
808 | * 获取个人信息 | 808 | * 获取个人信息 |
809 | * | 809 | * |
810 | * @param mContext | 810 | * @param mContext |
811 | * @param userId | 811 | * @param userId |
812 | * @param handler | 812 | * @param handler |
813 | */ | 813 | */ |
814 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { | 814 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
815 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 815 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
816 | false, true, null); | 816 | false, true, null); |
817 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 817 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
818 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 818 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
819 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 819 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
820 | @Override | 820 | @Override |
821 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 821 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
822 | closeProgress(); | 822 | closeProgress(); |
823 | Log.e("test", "个人信息" + new String(arg2)); | 823 | Log.e("test", "个人信息" + new String(arg2)); |
824 | try { | 824 | try { |
825 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 825 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
826 | int status = jsonObject.optInt("status"); | 826 | int status = jsonObject.optInt("status"); |
827 | if (status == 1) { | 827 | if (status == 1) { |
828 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 828 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
829 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 829 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
830 | Message message = Message.obtain(); | 830 | Message message = Message.obtain(); |
831 | message.what = HttpCode.GETINFO; | 831 | message.what = HttpCode.GETINFO; |
832 | message.obj = pesonalInfoBeanList; | 832 | message.obj = pesonalInfoBeanList; |
833 | handler.sendMessage(message); | 833 | handler.sendMessage(message); |
834 | 834 | ||
835 | 835 | ||
836 | } else { | 836 | } else { |
837 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 837 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
838 | 838 | ||
839 | } | 839 | } |
840 | } catch (JSONException e) { | 840 | } catch (JSONException e) { |
841 | e.printStackTrace(); | 841 | e.printStackTrace(); |
842 | } | 842 | } |
843 | 843 | ||
844 | 844 | ||
845 | } | 845 | } |
846 | 846 | ||
847 | @Override | 847 | @Override |
848 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 848 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
849 | closeProgress(); | 849 | closeProgress(); |
850 | new CircleDialog.Builder((FragmentActivity) mContext) | 850 | new CircleDialog.Builder((FragmentActivity) mContext) |
851 | .setCanceledOnTouchOutside(false) | 851 | .setCanceledOnTouchOutside(false) |
852 | .setCancelable(false) | 852 | .setCancelable(false) |
853 | .setWidth(0.5f) | 853 | .setWidth(0.5f) |
854 | .configText(new ConfigText() { | 854 | .configText(new ConfigText() { |
855 | @Override | 855 | @Override |
856 | public void onConfig(TextParams params) { | 856 | public void onConfig(TextParams params) { |
857 | params.gravity = Gravity.CENTER; | 857 | params.gravity = Gravity.CENTER; |
858 | params.padding = new int[]{50, 50, 50, 50}; | 858 | params.padding = new int[]{50, 50, 50, 50}; |
859 | } | 859 | } |
860 | }) | 860 | }) |
861 | .setText("当前无网络,请检查网络设置") | 861 | .setText("当前无网络,请检查网络设置") |
862 | .setNegative("继续使用", null) | 862 | .setNegative("继续使用", null) |
863 | .setPositive("设置网络", new View.OnClickListener() { | 863 | .setPositive("设置网络", new View.OnClickListener() { |
864 | @Override | 864 | @Override |
865 | public void onClick(View v) { | 865 | public void onClick(View v) { |
866 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 866 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
867 | mContext.startActivity(intent); | 867 | mContext.startActivity(intent); |
868 | } | 868 | } |
869 | }) | 869 | }) |
870 | .show(); | 870 | .show(); |
871 | } | 871 | } |
872 | }); | 872 | }); |
873 | } | 873 | } |
874 | 874 | ||
875 | //修改个人信息 | 875 | //修改个人信息 |
876 | public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException { | 876 | public void changepresonalinfo(final Context mContext, Long id, int type |
877 | Gson gson = new Gson(); | 877 | ,String name,String birthday,int gradeId,long regionId, |
878 | String jsonObject = gson.toJson(object); | 878 | Object schoolId,String qq,String gender |
879 | Log.e("test", "onSuccess" + jsonObject); | 879 | ,String regionName,String devicenumber) throws UnsupportedEncodingException { |
880 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 880 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
881 | false, true, null); | 881 | false, true, null); |
882 | ByteArrayEntity entity = null; | 882 | RequestParams params = new RequestParams(); |
883 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); | ||
884 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | ||
885 | 883 | ||
884 | params.put(HttpKey.USEID, id); | ||
885 | params.put(HttpKey.TYPE, type); | ||
886 | params.put(HttpKey.NAME, name); | ||
887 | params.put(HttpKey.BIRDays, birthday); | ||
888 | params.put(HttpKey.GRADE, gradeId); | ||
889 | params.put(HttpKey.REGION, regionId); | ||
890 | params.put(HttpKey.SCHOOL, schoolId); | ||
891 | params.put(HttpKey.QQ, qq); | ||
892 | params.put(HttpKey.GENDER, gender); | ||
893 | params.put(HttpKey.REGIONNAME, regionName); | ||
894 | params.put(HttpKey.DEVINUMBER, devicenumber); | ||
895 | Log.e("test", "个人信息" + params); | ||
886 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 896 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
887 | HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() { | 897 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { |
888 | @Override | 898 | @Override |
889 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 899 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
890 | super.onSuccess(statusCode, headers, response); | 900 | super.onSuccess(statusCode, headers, response); |
891 | closeProgress(); | 901 | closeProgress(); |
892 | String status = response.optString("status"); | 902 | String status = response.optString("status"); |
893 | if (status.equals("1")) { | 903 | if (status.equals("1")) { |
894 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 904 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
895 | ((Activity) mContext).finish(); | 905 | ((Activity) mContext).finish(); |
896 | } else { | 906 | } else { |
897 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 907 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
898 | } | 908 | } |
899 | Log.e("test", "onSuccess" + response); | ||
900 | 909 | ||
901 | } | 910 | } |
902 | 911 | ||
903 | @Override | 912 | @Override |
904 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 913 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
905 | super.onFailure(statusCode, headers, throwable, errorResponse); | 914 | super.onFailure(statusCode, headers, throwable, errorResponse); |
906 | closeProgress(); | 915 | closeProgress(); |
907 | Log.e("test", "onFailure" + errorResponse); | 916 | Log.e("test", "onFailure" + errorResponse); |
908 | new CircleDialog.Builder((FragmentActivity) mContext) | 917 | new CircleDialog.Builder((FragmentActivity) mContext) |
909 | .setCanceledOnTouchOutside(false) | 918 | .setCanceledOnTouchOutside(false) |
910 | .setCancelable(false) | 919 | .setCancelable(false) |
911 | .setWidth(0.5f) | 920 | .setWidth(0.5f) |
912 | .configText(new ConfigText() { | 921 | .configText(new ConfigText() { |
913 | @Override | 922 | @Override |
914 | public void onConfig(TextParams params) { | 923 | public void onConfig(TextParams params) { |
915 | params.gravity = Gravity.CENTER; | 924 | params.gravity = Gravity.CENTER; |
916 | params.padding = new int[]{50, 50, 50, 50}; | 925 | params.padding = new int[]{50, 50, 50, 50}; |
917 | } | 926 | } |
918 | }) | 927 | }) |
919 | .setText("当前无网络,请检查网络设置") | 928 | .setText("当前无网络,请检查网络设置") |
920 | .setNegative("继续使用", null) | 929 | .setNegative("继续使用", null) |
921 | .setPositive("设置网络", new View.OnClickListener() { | 930 | .setPositive("设置网络", new View.OnClickListener() { |
922 | @Override | 931 | @Override |
923 | public void onClick(View v) { | 932 | public void onClick(View v) { |
924 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 933 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
925 | mContext.startActivity(intent); | 934 | mContext.startActivity(intent); |
926 | } | 935 | } |
927 | }) | 936 | }) |
928 | .show(); | 937 | .show(); |
929 | } | 938 | } |
930 | 939 | ||
931 | }); | 940 | }); |
932 | } | 941 | } |
933 | 942 | ||
934 | //修改个性签名 | 943 | //修改个性签名 |
935 | public void changsignature(final Context mContext, long userId, int type, final String signature) { | 944 | public void changsignature(final Context mContext, long userId, int type, final String signature) { |
936 | RequestParams params = new RequestParams(); | 945 | RequestParams params = new RequestParams(); |
937 | params.put("userId", userId); | 946 | params.put("userId", userId); |
938 | params.put("type", type); | 947 | params.put("type", type); |
939 | params.put("signature", signature); | 948 | params.put("signature", signature); |
940 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 949 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
941 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 950 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
942 | @Override | 951 | @Override |
943 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 952 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
944 | try { | 953 | try { |
945 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 954 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
946 | String status = jsonObject.optString("status"); | 955 | String status = jsonObject.optString("status"); |
947 | if (status.equals("1")) { | 956 | if (status.equals("1")) { |
948 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 957 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
949 | } else { | 958 | } else { |
950 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 959 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
951 | } | 960 | } |
952 | } catch (JSONException e) { | 961 | } catch (JSONException e) { |
953 | e.printStackTrace(); | 962 | e.printStackTrace(); |
954 | } | 963 | } |
955 | } | 964 | } |
956 | 965 | ||
957 | @Override | 966 | @Override |
958 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 967 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
959 | Log.e("test", "onFailure" + new String(bytes)); | 968 | Log.e("test", "onFailure" + new String(bytes)); |
960 | new CircleDialog.Builder((FragmentActivity) mContext) | 969 | new CircleDialog.Builder((FragmentActivity) mContext) |
961 | .setCanceledOnTouchOutside(false) | 970 | .setCanceledOnTouchOutside(false) |
962 | .setCancelable(false) | 971 | .setCancelable(false) |
963 | .setWidth(0.5f) | 972 | .setWidth(0.5f) |
964 | .configText(new ConfigText() { | 973 | .configText(new ConfigText() { |
965 | @Override | 974 | @Override |
966 | public void onConfig(TextParams params) { | 975 | public void onConfig(TextParams params) { |
967 | params.gravity = Gravity.CENTER; | 976 | params.gravity = Gravity.CENTER; |
968 | params.padding = new int[]{50, 50, 50, 50}; | 977 | params.padding = new int[]{50, 50, 50, 50}; |
969 | } | 978 | } |
970 | }) | 979 | }) |
971 | .setText("当前无网络,请检查网络设置") | 980 | .setText("当前无网络,请检查网络设置") |
972 | .setNegative("继续使用", null) | 981 | .setNegative("继续使用", null) |
973 | .setPositive("设置网络", new View.OnClickListener() { | 982 | .setPositive("设置网络", new View.OnClickListener() { |
974 | @Override | 983 | @Override |
975 | public void onClick(View v) { | 984 | public void onClick(View v) { |
976 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 985 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
977 | mContext.startActivity(intent); | 986 | mContext.startActivity(intent); |
978 | } | 987 | } |
979 | }) | 988 | }) |
980 | .show(); | 989 | .show(); |
981 | } | 990 | } |
982 | }); | 991 | }); |
983 | } | 992 | } |
984 | 993 | ||
985 | /** | 994 | /** |
986 | * 获取个性签名 | 995 | * 获取个性签名 |
987 | * | 996 | * |
988 | * @param mContext | 997 | * @param mContext |
989 | * @param userId | 998 | * @param userId |
990 | * @param handler | 999 | * @param handler |
991 | */ | 1000 | */ |
992 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { | 1001 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { |
993 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1002 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
994 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 1003 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
995 | @Override | 1004 | @Override |
996 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1005 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
997 | Log.e("test", "个性签名" + new String(arg2)); | 1006 | Log.e("test", "个性签名" + new String(arg2)); |
998 | try { | 1007 | try { |
999 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1008 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1000 | int status = jsonObject.optInt("status"); | 1009 | int status = jsonObject.optInt("status"); |
1001 | if (status == 1) { | 1010 | if (status == 1) { |
1002 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 1011 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
1003 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 1012 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
1004 | Message message = Message.obtain(); | 1013 | Message message = Message.obtain(); |
1005 | message.what = HttpCode.SIGN; | 1014 | message.what = HttpCode.SIGN; |
1006 | message.obj = signInfoBeanList; | 1015 | message.obj = signInfoBeanList; |
1007 | handler.sendMessage(message); | 1016 | handler.sendMessage(message); |
1008 | 1017 | ||
1009 | 1018 | ||
1010 | } else { | 1019 | } else { |
1011 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1020 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1012 | 1021 | ||
1013 | } | 1022 | } |
1014 | } catch (JSONException e) { | 1023 | } catch (JSONException e) { |
1015 | e.printStackTrace(); | 1024 | e.printStackTrace(); |
1016 | } | 1025 | } |
1017 | 1026 | ||
1018 | 1027 | ||
1019 | } | 1028 | } |
1020 | 1029 | ||
1021 | @Override | 1030 | @Override |
1022 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1031 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1023 | Log.e("test", "失败原因" + arg3); | 1032 | Log.e("test", "失败原因" + arg3); |
1024 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1033 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1025 | } | 1034 | } |
1026 | }); | 1035 | }); |
1027 | } | 1036 | } |
1028 | 1037 | ||
1029 | /** | 1038 | /** |
1030 | * 用户反馈 | 1039 | * 用户反馈 |
1031 | * | 1040 | * |
1032 | * @param mContext | 1041 | * @param mContext |
1033 | * @param object | 1042 | * @param object |
1034 | * @throws UnsupportedEncodingException | 1043 | * @throws UnsupportedEncodingException |
1035 | */ | 1044 | */ |
1036 | public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException { | 1045 | public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException { |
1037 | Gson gson = new Gson(); | 1046 | Gson gson = new Gson(); |
1038 | String jsonObject = gson.toJson(object); | 1047 | String jsonObject = gson.toJson(object); |
1039 | Log.e("test", "onSuccess" + jsonObject); | 1048 | Log.e("test", "onSuccess" + jsonObject); |
1040 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 1049 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
1041 | false, true, null); | 1050 | false, true, null); |
1042 | ByteArrayEntity entity = null; | 1051 | ByteArrayEntity entity = null; |
1043 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); | 1052 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); |
1044 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 1053 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
1045 | 1054 | ||
1046 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1055 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
1047 | HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() { | 1056 | HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() { |
1048 | @Override | 1057 | @Override |
1049 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 1058 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
1050 | super.onSuccess(statusCode, headers, response); | 1059 | super.onSuccess(statusCode, headers, response); |
1051 | closeProgress(); | 1060 | closeProgress(); |
1052 | String status = response.optString("status"); | 1061 | String status = response.optString("status"); |
1053 | if (status.equals("1")) { | 1062 | if (status.equals("1")) { |
1054 | Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show(); | 1063 | Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show(); |
1055 | ((Activity) mContext).finish(); | 1064 | ((Activity) mContext).finish(); |
1056 | } else { | 1065 | } else { |
1057 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1066 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
1058 | } | 1067 | } |
1059 | Log.e("test", "onSuccess" + response); | 1068 | Log.e("test", "onSuccess" + response); |
1060 | 1069 | ||
1061 | } | 1070 | } |
1062 | 1071 | ||
1063 | @Override | 1072 | @Override |
1064 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 1073 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
1065 | super.onFailure(statusCode, headers, throwable, errorResponse); | 1074 | super.onFailure(statusCode, headers, throwable, errorResponse); |
1066 | closeProgress(); | 1075 | closeProgress(); |
1067 | Log.e("test", "onFailure" + errorResponse); | 1076 | Log.e("test", "onFailure" + errorResponse); |
1068 | new CircleDialog.Builder((FragmentActivity) mContext) | 1077 | new CircleDialog.Builder((FragmentActivity) mContext) |
1069 | .setCanceledOnTouchOutside(false) | 1078 | .setCanceledOnTouchOutside(false) |
1070 | .setCancelable(false) | 1079 | .setCancelable(false) |
1071 | .setWidth(0.5f) | 1080 | .setWidth(0.5f) |
1072 | .configText(new ConfigText() { | 1081 | .configText(new ConfigText() { |
1073 | @Override | 1082 | @Override |
1074 | public void onConfig(TextParams params) { | 1083 | public void onConfig(TextParams params) { |
1075 | params.gravity = Gravity.CENTER; | 1084 | params.gravity = Gravity.CENTER; |
1076 | params.padding = new int[]{50, 50, 50, 50}; | 1085 | params.padding = new int[]{50, 50, 50, 50}; |
1077 | } | 1086 | } |
1078 | }) | 1087 | }) |
1079 | .setText("当前无网络,请检查网络设置") | 1088 | .setText("当前无网络,请检查网络设置") |
1080 | .setNegative("继续使用", null) | 1089 | .setNegative("继续使用", null) |
1081 | .setPositive("设置网络", new View.OnClickListener() { | 1090 | .setPositive("设置网络", new View.OnClickListener() { |
1082 | @Override | 1091 | @Override |
1083 | public void onClick(View v) { | 1092 | public void onClick(View v) { |
1084 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1093 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1085 | mContext.startActivity(intent); | 1094 | mContext.startActivity(intent); |
1086 | } | 1095 | } |
1087 | }) | 1096 | }) |
1088 | .show(); | 1097 | .show(); |
1089 | } | 1098 | } |
1090 | 1099 | ||
1091 | }); | 1100 | }); |
1092 | } | 1101 | } |
1093 | 1102 | ||
1094 | /** | 1103 | /** |
1095 | * 查询子账户信息 | 1104 | * 查询子账户信息 |
1096 | * | 1105 | * |
1097 | * @param mContext | 1106 | * @param mContext |
1098 | * @param userId | 1107 | * @param userId |
1099 | * @param handler | 1108 | * @param handler |
1100 | */ | 1109 | */ |
1101 | public void getchildAccountinfo(final Context mContext, long userId, final Handler handler) { | 1110 | public void getchildAccountinfo(final Context mContext, long userId,String deviceNumber ,final Handler handler) { |
1102 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", | 1111 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", |
1103 | false, true, null); | 1112 | false, true, null); |
1113 | |||
1114 | Log.e("test", "ID" + userId); | ||
1104 | HttpClient.getInstance().setTimeout(5 * 1000); | 1115 | HttpClient.getInstance().setTimeout(5 * 1000); |
1105 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1116 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1106 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1117 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId+"&deviceNumber="+deviceNumber, new AsyncHttpResponseHandler() { |
1107 | @Override | 1118 | @Override |
1108 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1119 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1109 | closeProgress(); | 1120 | closeProgress(); |
1110 | Log.e("test", "子账户信息" + new String(arg2)); | 1121 | Log.e("test", "子账户信息" + new String(arg2)); |
1111 | try { | 1122 | try { |
1112 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1123 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1113 | int status = jsonObject.optInt("status"); | 1124 | int status = jsonObject.optInt("status"); |
1114 | if (status == 0) { | 1125 | if (status == 0) { |
1115 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 1126 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
1116 | } else if (status == 1000) { | 1127 | } else if (status == 1000) { |
1117 | AlertUtils.showToast(mContext, "你好,你还未添加子账号,子账号为空!"); | 1128 | AlertUtils.showToast(mContext, "你好,你还未添加子账号,子账号为空!"); |
1118 | } else { | 1129 | } else { |
1119 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 1130 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
1131 | Log.e("test", "子账户信息" + childsInfo); | ||
1120 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 1132 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
1133 | Log.e("test", "子账户信息" + schoolInfoBeanList); | ||
1121 | Message msg = Message.obtain(); | 1134 | Message msg = Message.obtain(); |
1122 | msg.what = HttpCode.CHILDS_SUCESS; | 1135 | msg.what = HttpCode.CHILDS_SUCESS; |
1123 | msg.obj = schoolInfoBeanList; | 1136 | msg.obj = schoolInfoBeanList; |
1124 | handler.sendMessage(msg); | 1137 | handler.sendMessage(msg); |
1125 | 1138 | ||
1126 | } | 1139 | } |
1127 | } catch (JSONException e) { | 1140 | } catch (JSONException e) { |
1128 | e.printStackTrace(); | 1141 | e.printStackTrace(); |
1129 | } | 1142 | } |
1130 | 1143 | ||
1131 | } | 1144 | } |
1132 | 1145 | ||
1133 | @Override | 1146 | @Override |
1134 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1147 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1135 | closeProgress(); | 1148 | closeProgress(); |
1136 | Log.e("test", "错误信息" + new String(arg2)); | 1149 | Log.e("test", "错误信息" + new String(arg2)); |
1137 | new CircleDialog.Builder((FragmentActivity) mContext) | 1150 | new CircleDialog.Builder((FragmentActivity) mContext) |
1138 | .setCanceledOnTouchOutside(false) | 1151 | .setCanceledOnTouchOutside(false) |
1139 | .setCancelable(false) | 1152 | .setCancelable(false) |
1140 | .setWidth(0.5f) | 1153 | .setWidth(0.5f) |
1141 | .configText(new ConfigText() { | 1154 | .configText(new ConfigText() { |
1142 | @Override | 1155 | @Override |
1143 | public void onConfig(TextParams params) { | 1156 | public void onConfig(TextParams params) { |
1144 | params.gravity = Gravity.CENTER; | 1157 | params.gravity = Gravity.CENTER; |
1145 | params.padding = new int[]{50, 50, 50, 50}; | 1158 | params.padding = new int[]{50, 50, 50, 50}; |
1146 | } | 1159 | } |
1147 | }) | 1160 | }) |
1148 | .setText("当前无网络,请检查网络设置") | 1161 | .setText("当前无网络,请检查网络设置") |
1149 | .setNegative("继续使用", null) | 1162 | .setNegative("继续使用", null) |
1150 | .setPositive("设置网络", new View.OnClickListener() { | 1163 | .setPositive("设置网络", new View.OnClickListener() { |
1151 | @Override | 1164 | @Override |
1152 | public void onClick(View v) { | 1165 | public void onClick(View v) { |
1153 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1166 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1154 | mContext.startActivity(intent); | 1167 | mContext.startActivity(intent); |
1155 | } | 1168 | } |
1156 | }) | 1169 | }) |
1157 | .show(); | 1170 | .show(); |
1158 | } | 1171 | } |
1159 | }); | 1172 | }); |
1160 | 1173 | ||
1161 | } | 1174 | } |
1162 | 1175 | ||
1163 | /** | 1176 | /** |
1164 | * 删除子账户信息 | 1177 | * 删除子账户信息 |
1165 | * | 1178 | * |
1166 | * @param mContext | 1179 | * @param mContext |
1167 | * @param subAccountId | 1180 | * @param subAccountId |
1168 | */ | 1181 | */ |
1169 | public void deletechildAccountinfo(final Context mContext, long subAccountId) { | 1182 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { |
1170 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 1183 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
1171 | false, true, null); | 1184 | false, true, null); |
1172 | HttpClient.getInstance().setTimeout(5 * 1000); | 1185 | HttpClient.getInstance().setTimeout(5 * 1000); |
1173 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1186 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1174 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 1187 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
1175 | @Override | 1188 | @Override |
1176 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1189 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1177 | closeProgress(); | 1190 | closeProgress(); |
1178 | Log.e("test", "子账户信息" + new String(arg2)); | 1191 | Log.e("test", "子账户信息" + new String(arg2)); |
1179 | try { | 1192 | try { |
1180 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1193 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1181 | int status = jsonObject.optInt("status"); | 1194 | int status = jsonObject.optInt("status"); |
1182 | if (status == 1) { | 1195 | if (status == 1) { |
1183 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 1196 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
1197 | ((Activity) mContext).finish(); | ||
1184 | } else { | 1198 | } else { |
1185 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 1199 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
1186 | 1200 | ||
1187 | } | 1201 | } |
1188 | } catch (JSONException e) { | 1202 | } catch (JSONException e) { |
1189 | e.printStackTrace(); | 1203 | e.printStackTrace(); |
1190 | } | 1204 | } |
1191 | 1205 | ||
1192 | } | 1206 | } |
1193 | 1207 | ||
1194 | @Override | 1208 | @Override |
1195 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1209 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1196 | closeProgress(); | 1210 | closeProgress(); |
1197 | Log.e("test", "错误信息" + new String(arg2)); | 1211 | Log.e("test", "错误信息" + new String(arg2)); |
1198 | new CircleDialog.Builder((FragmentActivity) mContext) | 1212 | new CircleDialog.Builder((FragmentActivity) mContext) |
1199 | .setCanceledOnTouchOutside(false) | 1213 | .setCanceledOnTouchOutside(false) |
1200 | .setCancelable(false) | 1214 | .setCancelable(false) |
1201 | .setWidth(0.5f) | 1215 | .setWidth(0.5f) |
1202 | .configText(new ConfigText() { | 1216 | .configText(new ConfigText() { |
1203 | @Override | 1217 | @Override |
1204 | public void onConfig(TextParams params) { | 1218 | public void onConfig(TextParams params) { |
1205 | params.gravity = Gravity.CENTER; | 1219 | params.gravity = Gravity.CENTER; |
1206 | params.padding = new int[]{50, 50, 50, 50}; | 1220 | params.padding = new int[]{50, 50, 50, 50}; |
1207 | } | 1221 | } |
1208 | }) | 1222 | }) |
1209 | .setText("当前无网络,请检查网络设置") | 1223 | .setText("当前无网络,请检查网络设置") |
1210 | .setNegative("继续使用", null) | 1224 | .setNegative("继续使用", null) |
1211 | .setPositive("设置网络", new View.OnClickListener() { | 1225 | .setPositive("设置网络", new View.OnClickListener() { |
1212 | @Override | 1226 | @Override |
1213 | public void onClick(View v) { | 1227 | public void onClick(View v) { |
1214 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1228 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1215 | mContext.startActivity(intent); | 1229 | mContext.startActivity(intent); |
1216 | } | 1230 | } |
1217 | }) | 1231 | }) |
1218 | .show(); | 1232 | .show(); |
1219 | } | 1233 | } |
1220 | }); | 1234 | }); |
1221 | 1235 | ||
1222 | } | 1236 | } |
1223 | 1237 | ||
1224 | /** | 1238 | /** |
1225 | * 添加子账户信息 | 1239 | * 添加子账户信息 |
1226 | */ | 1240 | */ |
1227 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 1241 | public void addchildAccountinfo(final Context mContext, long parentId, String image, |
1228 | String name, Long grade, Long school, Long region | 1242 | String name, Long grade, Object school, Long region |
1229 | , String deviceNumber, String regionName) { | 1243 | , String deviceNumber, String regionName) { |
1230 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 1244 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
1231 | false, true, null); | 1245 | false, true, null); |
1232 | RequestParams params = new RequestParams(); | 1246 | RequestParams params = new RequestParams(); |
1233 | 1247 | ||
1234 | params.put(HttpKey.PARENTID, parentId); | 1248 | params.put(HttpKey.PARENTID, parentId); |
1235 | params.put(HttpKey.IMAGE, image); | 1249 | params.put(HttpKey.IMAGE, image); |
1236 | params.put(HttpKey.NAME, name); | 1250 | params.put(HttpKey.NAME, name); |
1237 | params.put(HttpKey.GRADE, grade); | 1251 | params.put(HttpKey.GRADE, grade); |
1238 | params.put(HttpKey.SCHOOL, school); | 1252 | params.put(HttpKey.SCHOOL, school); |
1239 | params.put(HttpKey.REGION, region); | 1253 | params.put(HttpKey.REGION, region); |
1240 | params.put(HttpKey.DEVINUMBER, deviceNumber); | 1254 | params.put(HttpKey.DEVINUMBER, deviceNumber); |
1241 | params.put(HttpKey.REGIONNAME, regionName); | 1255 | params.put(HttpKey.REGIONNAME, regionName); |
1242 | 1256 | ||
1243 | Log.e("test", "子账户信息" + params); | 1257 | Log.e("test", "子账户信息" + params); |
1244 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1258 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
1245 | HttpClient.getInstance().setTimeout(5 * 1000); | 1259 | HttpClient.getInstance().setTimeout(5 * 1000); |
1246 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1260 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1247 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 1261 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
1248 | @Override | 1262 | @Override |
1249 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1263 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1250 | closeProgress(); | 1264 | closeProgress(); |
1251 | 1265 | ||
1252 | Log.e("test", "子账户信息" + new String(arg2)); | 1266 | Log.e("test", "子账户信息" + new String(arg2)); |
1253 | try { | 1267 | try { |
1254 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1268 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1255 | int status = jsonObject.optInt("status"); | 1269 | int status = jsonObject.optInt("status"); |
1256 | if (status == 1) { | 1270 | if (status == 1) { |
1257 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1271 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
1258 | ((Activity) mContext).finish(); | 1272 | ((Activity) mContext).finish(); |
1259 | } else { | 1273 | } else { |
1260 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1274 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
1261 | 1275 | ||
1262 | } | 1276 | } |
1263 | } catch (JSONException e) { | 1277 | } catch (JSONException e) { |
1264 | e.printStackTrace(); | 1278 | e.printStackTrace(); |
1265 | } | 1279 | } |
1266 | 1280 | ||
1267 | } | 1281 | } |
1268 | 1282 | ||
1269 | @Override | 1283 | @Override |
1270 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1284 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1271 | closeProgress(); | 1285 | closeProgress(); |
1272 | Log.e("test", "错误信息" + new String(arg2)); | 1286 | Log.e("test", "错误信息" + new String(arg2)); |
1273 | new CircleDialog.Builder((FragmentActivity) mContext) | 1287 | new CircleDialog.Builder((FragmentActivity) mContext) |
1274 | .setCanceledOnTouchOutside(false) | 1288 | .setCanceledOnTouchOutside(false) |
1275 | .setCancelable(false) | 1289 | .setCancelable(false) |
1276 | .setWidth(0.5f) | 1290 | .setWidth(0.5f) |
1277 | .configText(new ConfigText() { | 1291 | .configText(new ConfigText() { |
1278 | @Override | 1292 | @Override |
1279 | public void onConfig(TextParams params) { | 1293 | public void onConfig(TextParams params) { |
1280 | params.gravity = Gravity.CENTER; | 1294 | params.gravity = Gravity.CENTER; |
1281 | params.padding = new int[]{50, 50, 50, 50}; | 1295 | params.padding = new int[]{50, 50, 50, 50}; |
1282 | } | 1296 | } |
1283 | }) | 1297 | }) |
1284 | .setText("当前无网络,请检查网络设置") | 1298 | .setText("当前无网络,请检查网络设置") |
1285 | .setNegative("继续使用", null) | 1299 | .setNegative("继续使用", null) |
1286 | .setPositive("设置网络", new View.OnClickListener() { | 1300 | .setPositive("设置网络", new View.OnClickListener() { |
1287 | @Override | 1301 | @Override |
1288 | public void onClick(View v) { | 1302 | public void onClick(View v) { |
1289 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1303 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1290 | mContext.startActivity(intent); | 1304 | mContext.startActivity(intent); |
1291 | } | 1305 | } |
1292 | }) | 1306 | }) |
1293 | .show(); | 1307 | .show(); |
1294 | } | 1308 | } |
1295 | }); | 1309 | }); |
1296 | 1310 | ||
1297 | } | 1311 | } |
1298 | 1312 | ||
1299 | /** | 1313 | /** |
1300 | * 切换子账户信息 | 1314 | * 切换子账户信息 |
1301 | * | 1315 | * |
1302 | * @param mContext | 1316 | * @param mContext |
1303 | * @param subAccountId | 1317 | * @param subAccountId |
1304 | */ | 1318 | */ |
1305 | public void changechildAccountinfo(final Context mContext, long subAccountId, long userId) { | 1319 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId |
1320 | ,String deviceNumber,int type) { | ||
1306 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1321 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
1307 | false, true, null); | 1322 | false, true, null); |
1308 | HttpClient.getInstance().setTimeout(5 * 1000); | 1323 | HttpClient.getInstance().setTimeout(5 * 1000); |
1309 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1324 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1310 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId, new AsyncHttpResponseHandler() { | 1325 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId |
1326 | + "&deviceNumber=" + deviceNumber+ "&type=" + type, new AsyncHttpResponseHandler() { | ||
1311 | @Override | 1327 | @Override |
1312 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1328 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1313 | closeProgress(); | 1329 | closeProgress(); |
1314 | Log.e("test", "子账户信息" + new String(arg2)); | 1330 | Log.e("test", "子账户信息" + new String(arg2)); |
1315 | try { | 1331 | try { |
1316 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1332 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1317 | int status = jsonObject.optInt("status"); | 1333 | int status = jsonObject.optInt("status"); |
1318 | if (status == 1) { | 1334 | if (status == 1) { |
1319 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1335 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
1336 | ((Activity) mContext).finish(); | ||
1320 | 1337 | ||
1321 | } else { | 1338 | } else { |
1322 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1339 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
1323 | 1340 | ||
1324 | } | 1341 | } |
1325 | } catch (JSONException e) { | 1342 | } catch (JSONException e) { |
1326 | e.printStackTrace(); | 1343 | e.printStackTrace(); |
1327 | } | 1344 | } |
1328 | 1345 | ||
1329 | } | 1346 | } |
1330 | 1347 | ||
1331 | @Override | 1348 | @Override |
1332 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1349 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1333 | closeProgress(); | 1350 | closeProgress(); |
1334 | Log.e("test", "错误信息" + new String(arg2)); | 1351 | Log.e("test", "错误信息" + new String(arg2)); |
1335 | new CircleDialog.Builder((FragmentActivity) mContext) | 1352 | new CircleDialog.Builder((FragmentActivity) mContext) |
1336 | .setCanceledOnTouchOutside(false) | 1353 | .setCanceledOnTouchOutside(false) |
1337 | .setCancelable(false) | 1354 | .setCancelable(false) |
1338 | .setWidth(0.5f) | 1355 | .setWidth(0.5f) |
1339 | .configText(new ConfigText() { | 1356 | .configText(new ConfigText() { |
1340 | @Override | 1357 | @Override |
1341 | public void onConfig(TextParams params) { | 1358 | public void onConfig(TextParams params) { |
1342 | params.gravity = Gravity.CENTER; | 1359 | params.gravity = Gravity.CENTER; |
1343 | params.padding = new int[]{50, 50, 50, 50}; | 1360 | params.padding = new int[]{50, 50, 50, 50}; |
1344 | } | 1361 | } |
1345 | }) | 1362 | }) |
1346 | .setText("当前无网络,请检查网络设置") | 1363 | .setText("当前无网络,请检查网络设置") |
1347 | .setNegative("继续使用", null) | 1364 | .setNegative("继续使用", null) |
1348 | .setPositive("设置网络", new View.OnClickListener() { | 1365 | .setPositive("设置网络", new View.OnClickListener() { |
1349 | @Override | 1366 | @Override |
1350 | public void onClick(View v) { | 1367 | public void onClick(View v) { |
1351 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1368 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1352 | mContext.startActivity(intent); | 1369 | mContext.startActivity(intent); |
1353 | } | 1370 | } |
1354 | }) | 1371 | }) |
1355 | .show(); | 1372 | .show(); |
1356 | } | 1373 | } |
1357 | }); | 1374 | }); |
1358 | 1375 | ||
1359 | } | 1376 | } |
1377 | /** | ||
1378 | * 切换主账户信息 | ||
1379 | * | ||
1380 | * @param mContext | ||
1381 | * @param type | ||
1382 | */ | ||
1383 | public void Accountinfo(final Context mContext, long userId | ||
1384 | ,String deviceNumber,int type) { | ||
1385 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", | ||
1386 | false, true, null); | ||
1387 | HttpClient.getInstance().setTimeout(5 * 1000); | ||
1388 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | ||
1389 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber | ||
1390 | + "&type=" + type, new AsyncHttpResponseHandler() { | ||
1391 | @Override | ||
1392 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | ||
1393 | closeProgress(); | ||
1394 | Log.e("test", "子账户信息" + new String(arg2)); | ||
1395 | try { | ||
1396 | JSONObject jsonObject = new JSONObject(new String(arg2)); | ||
1397 | int status = jsonObject.optInt("status"); | ||
1398 | if (status == 1) { | ||
1399 | AlertUtils.showToast(mContext, "主账号切换成功!"); | ||
1400 | ((Activity) mContext).finish(); | ||
1401 | |||
1402 | } else { | ||
1403 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); | ||
1404 | |||
1405 | } | ||
1406 | } catch (JSONException e) { | ||
1407 | e.printStackTrace(); | ||
1408 | } | ||
1409 | |||
1410 | } | ||
1411 | |||
1412 | @Override | ||
1413 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | ||
1414 | closeProgress(); | ||
1415 | Log.e("test", "错误信息" + new String(arg2)); | ||
1416 | new CircleDialog.Builder((FragmentActivity) mContext) | ||
1417 | .setCanceledOnTouchOutside(false) | ||
1418 | .setCancelable(false) | ||
1419 | .setWidth(0.5f) | ||
1420 | .configText(new ConfigText() { | ||
1421 | @Override | ||
1422 | public void onConfig(TextParams params) { | ||
1423 | params.gravity = Gravity.CENTER; | ||
1424 | params.padding = new int[]{50, 50, 50, 50}; | ||
1425 | } | ||
1426 | }) | ||
1427 | .setText("当前无网络,请检查网络设置") | ||
1428 | .setNegative("继续使用", null) | ||
1429 | .setPositive("设置网络", new View.OnClickListener() { | ||
1430 | @Override | ||
1431 | public void onClick(View v) { | ||
1432 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | ||
1433 | mContext.startActivity(intent); | ||
1434 | } | ||
1435 | }) | ||
1436 | .show(); | ||
1437 | } | ||
1438 | }); | ||
1439 | |||
1440 | } | ||
1360 | 1441 | ||
1361 | /** | 1442 | /** |
1362 | * 系统升级 | 1443 | * 系统升级 |
1363 | * | 1444 | * |
1364 | * @param mContext | 1445 | * @param mContext |
1365 | * @param pid appName | 1446 | * @param pid appName |
1366 | */ | 1447 | */ |
1367 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1448 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
1368 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1449 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
1369 | false, true, null); | 1450 | false, true, null); |
1370 | HttpClient.getInstance().setTimeout(5 * 1000); | 1451 | HttpClient.getInstance().setTimeout(5 * 1000); |
1371 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1452 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1372 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1453 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
1373 | @Override | 1454 | @Override |
1374 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1455 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1375 | closeProgress(); | 1456 | closeProgress(); |
1376 | Log.e("test", "版本升级信息" + new String(arg2)); | 1457 | Log.e("test", "版本升级信息" + new String(arg2)); |
1377 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 | 1458 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 |
1378 | Message msg = Message.obtain(); | 1459 | Message msg = Message.obtain(); |
1379 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1460 | msg.what = HttpCode.APPUPDATE_SUCESS; |
1380 | msg.obj = appVersion; | 1461 | msg.obj = appVersion; |
1381 | handler.sendMessage(msg); | 1462 | handler.sendMessage(msg); |
1382 | 1463 | ||
1383 | 1464 | ||
1384 | } | 1465 | } |
1385 | 1466 | ||
1386 | @Override | 1467 | @Override |
1387 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1468 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1388 | closeProgress(); | 1469 | closeProgress(); |
1389 | Log.e("test", "错误信息" + new String(arg2)); | 1470 | Log.e("test", "错误信息" + new String(arg2)); |
1390 | new CircleDialog.Builder((FragmentActivity) mContext) | 1471 | new CircleDialog.Builder((FragmentActivity) mContext) |
1391 | .setCanceledOnTouchOutside(false) | 1472 | .setCanceledOnTouchOutside(false) |
1392 | .setCancelable(false) | 1473 | .setCancelable(false) |
1393 | .setWidth(0.5f) | 1474 | .setWidth(0.5f) |
1394 | .configText(new ConfigText() { | 1475 | .configText(new ConfigText() { |
1395 | @Override | 1476 | @Override |
1396 | public void onConfig(TextParams params) { | 1477 | public void onConfig(TextParams params) { |
1397 | params.gravity = Gravity.CENTER; | 1478 | params.gravity = Gravity.CENTER; |
1398 | params.padding = new int[]{50, 50, 50, 50}; | 1479 | params.padding = new int[]{50, 50, 50, 50}; |
1399 | } | 1480 | } |
1400 | }) | 1481 | }) |
1401 | .setText("当前无网络,请检查网络设置") | 1482 | .setText("当前无网络,请检查网络设置") |
1402 | .setNegative("继续使用", null) | 1483 | .setNegative("继续使用", null) |
1403 | .setPositive("设置网络", new View.OnClickListener() { | 1484 | .setPositive("设置网络", new View.OnClickListener() { |
1404 | @Override | 1485 | @Override |
1405 | public void onClick(View v) { | 1486 | public void onClick(View v) { |
1406 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1487 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1407 | mContext.startActivity(intent); | 1488 | mContext.startActivity(intent); |
1408 | } | 1489 | } |
1409 | }) | 1490 | }) |
1410 | .show(); | 1491 | .show(); |
1411 | } | 1492 | } |
1412 | }); | 1493 | }); |
1413 | 1494 | ||
1414 | } | 1495 | } |
1415 | 1496 | ||
1416 | 1497 | ||
1417 | ///省级接口 | 1498 | ///省级接口 |
1418 | public void provices(final Context mContext, final Handler handler) { | 1499 | public void provices(final Context mContext, final Handler handler) { |
1419 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1500 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1420 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1501 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
1421 | @Override | 1502 | @Override |
1422 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1503 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1423 | Log.e("test", "省" + new String(arg2)); | 1504 | Log.e("test", "省" + new String(arg2)); |
1424 | try { | 1505 | try { |
1425 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1506 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1426 | int status = jsonObject.optInt("status"); | 1507 | int status = jsonObject.optInt("status"); |
1427 | if (status == 100) { | 1508 | if (status == 100) { |
1428 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1509 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
1429 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1510 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
1430 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1511 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
1431 | Message message = Message.obtain(); | 1512 | Message message = Message.obtain(); |
1432 | message.what = HttpCode.PROVICES; | 1513 | message.what = HttpCode.PROVICES; |
1433 | message.obj = provincesBeanList; | 1514 | message.obj = provincesBeanList; |
1434 | handler.sendMessage(message); | 1515 | handler.sendMessage(message); |
1435 | 1516 | ||
1436 | 1517 | ||
1437 | } else { | 1518 | } else { |
1438 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1519 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1439 | 1520 | ||
1440 | } | 1521 | } |
1441 | } catch (JSONException e) { | 1522 | } catch (JSONException e) { |
1442 | e.printStackTrace(); | 1523 | e.printStackTrace(); |
1443 | } | 1524 | } |
1444 | 1525 | ||
1445 | 1526 | ||
1446 | } | 1527 | } |
1447 | 1528 | ||
1448 | @Override | 1529 | @Override |
1449 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1530 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1450 | new CircleDialog.Builder((FragmentActivity) mContext) | 1531 | new CircleDialog.Builder((FragmentActivity) mContext) |
1451 | .setCanceledOnTouchOutside(false) | 1532 | .setCanceledOnTouchOutside(false) |
1452 | .setCancelable(false) | 1533 | .setCancelable(false) |
1453 | .setWidth(0.5f) | 1534 | .setWidth(0.5f) |
1454 | .configText(new ConfigText() { | 1535 | .configText(new ConfigText() { |
1455 | @Override | 1536 | @Override |
1456 | public void onConfig(TextParams params) { | 1537 | public void onConfig(TextParams params) { |
1457 | params.gravity = Gravity.CENTER; | 1538 | params.gravity = Gravity.CENTER; |
1458 | params.padding = new int[]{50, 50, 50, 50}; | 1539 | params.padding = new int[]{50, 50, 50, 50}; |
1459 | } | 1540 | } |
1460 | }) | 1541 | }) |
1461 | .setText("当前无网络,请检查网络设置") | 1542 | .setText("当前无网络,请检查网络设置") |
1462 | .setNegative("继续使用", null) | 1543 | .setNegative("继续使用", null) |
1463 | .setPositive("设置网络", new View.OnClickListener() { | 1544 | .setPositive("设置网络", new View.OnClickListener() { |
1464 | @Override | 1545 | @Override |
1465 | public void onClick(View v) { | 1546 | public void onClick(View v) { |
1466 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1547 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1467 | mContext.startActivity(intent); | 1548 | mContext.startActivity(intent); |
1468 | } | 1549 | } |
1469 | }) | 1550 | }) |
1470 | .show(); | 1551 | .show(); |
1471 | } | 1552 | } |
1472 | }); | 1553 | }); |
1473 | } | 1554 | } |
1474 | 1555 | ||
1475 | //市级接口 | 1556 | //市级接口 |
1476 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1557 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
1477 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1558 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1478 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1559 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
1479 | @Override | 1560 | @Override |
1480 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1561 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1481 | Log.e("test", "市" + new String(arg2)); | 1562 | Log.e("test", "市" + new String(arg2)); |
1482 | try { | 1563 | try { |
1483 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1564 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1484 | int status = jsonObject.optInt("status"); | 1565 | int status = jsonObject.optInt("status"); |
1485 | if (status == 100) { | 1566 | if (status == 100) { |
1486 | Gson gson = new Gson(); | 1567 | Gson gson = new Gson(); |
1487 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1568 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
1488 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1569 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
1489 | Message message = Message.obtain(); | 1570 | Message message = Message.obtain(); |
1490 | message.what = HttpCode.CITYS; | 1571 | message.what = HttpCode.CITYS; |
1491 | message.obj = cityInfoBeanList; | 1572 | message.obj = cityInfoBeanList; |
1492 | handler.sendMessage(message); | 1573 | handler.sendMessage(message); |
1493 | 1574 | ||
1494 | } else { | 1575 | } else { |
1495 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1576 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1496 | 1577 | ||
1497 | } | 1578 | } |
1498 | } catch (JSONException e) { | 1579 | } catch (JSONException e) { |
1499 | e.printStackTrace(); | 1580 | e.printStackTrace(); |
1500 | } | 1581 | } |
1501 | 1582 | ||
1502 | 1583 | ||
1503 | } | 1584 | } |
1504 | 1585 | ||
1505 | @Override | 1586 | @Override |
1506 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1587 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1507 | new CircleDialog.Builder((FragmentActivity) mContext) | 1588 | new CircleDialog.Builder((FragmentActivity) mContext) |
1508 | .setCanceledOnTouchOutside(false) | 1589 | .setCanceledOnTouchOutside(false) |
1509 | .setCancelable(false) | 1590 | .setCancelable(false) |
1510 | .setWidth(0.5f) | 1591 | .setWidth(0.5f) |
1511 | .configText(new ConfigText() { | 1592 | .configText(new ConfigText() { |
1512 | @Override | 1593 | @Override |
1513 | public void onConfig(TextParams params) { | 1594 | public void onConfig(TextParams params) { |
1514 | params.gravity = Gravity.CENTER; | 1595 | params.gravity = Gravity.CENTER; |
1515 | params.padding = new int[]{50, 50, 50, 50}; | 1596 | params.padding = new int[]{50, 50, 50, 50}; |
1516 | } | 1597 | } |
1517 | }) | 1598 | }) |
1518 | .setText("当前无网络,请检查网络设置") | 1599 | .setText("当前无网络,请检查网络设置") |
1519 | .setNegative("继续使用", null) | 1600 | .setNegative("继续使用", null) |
1520 | .setPositive("设置网络", new View.OnClickListener() { | 1601 | .setPositive("设置网络", new View.OnClickListener() { |
1521 | @Override | 1602 | @Override |
1522 | public void onClick(View v) { | 1603 | public void onClick(View v) { |
1523 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1604 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1524 | mContext.startActivity(intent); | 1605 | mContext.startActivity(intent); |
1525 | } | 1606 | } |
1526 | }) | 1607 | }) |
1527 | .show(); | 1608 | .show(); |
1528 | } | 1609 | } |
1529 | }); | 1610 | }); |
1530 | } | 1611 | } |
1531 | 1612 | ||
1532 | //区县级接口 | 1613 | //区县级接口 |
1533 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1614 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
1534 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1615 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1535 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1616 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
1536 | @Override | 1617 | @Override |
1537 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1618 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1538 | Log.e("test", "区" + new String(arg2)); | 1619 | Log.e("test", "区" + new String(arg2)); |
1539 | try { | 1620 | try { |
1540 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1621 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1541 | int status = jsonObject.optInt("status"); | 1622 | int status = jsonObject.optInt("status"); |
1542 | if (status == 100) { | 1623 | if (status == 100) { |
1543 | Gson gson = new Gson(); | 1624 | Gson gson = new Gson(); |
1544 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1625 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
1545 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1626 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
1546 | Message message = Message.obtain(); | 1627 | Message message = Message.obtain(); |
1547 | message.what = HttpCode.COUNTRY; | 1628 | message.what = HttpCode.COUNTRY; |
1548 | message.obj = countyInfoInfoBeanList; | 1629 | message.obj = countyInfoInfoBeanList; |
1549 | handler.sendMessage(message); | 1630 | handler.sendMessage(message); |
1550 | } else { | 1631 | } else { |
1551 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1632 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1552 | 1633 | ||
1553 | } | 1634 | } |
1554 | } catch (JSONException e) { | 1635 | } catch (JSONException e) { |
1555 | e.printStackTrace(); | 1636 | e.printStackTrace(); |
1556 | } | 1637 | } |
1557 | 1638 | ||
1558 | 1639 | ||
1559 | } | 1640 | } |
1560 | 1641 | ||
1561 | @Override | 1642 | @Override |
1562 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1643 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1563 | new CircleDialog.Builder((FragmentActivity) mContext) | 1644 | new CircleDialog.Builder((FragmentActivity) mContext) |
1564 | .setCanceledOnTouchOutside(false) | 1645 | .setCanceledOnTouchOutside(false) |
1565 | .setCancelable(false) | 1646 | .setCancelable(false) |
1566 | .setWidth(0.5f) | 1647 | .setWidth(0.5f) |
1567 | .configText(new ConfigText() { | 1648 | .configText(new ConfigText() { |
1568 | @Override | 1649 | @Override |
1569 | public void onConfig(TextParams params) { | 1650 | public void onConfig(TextParams params) { |
1570 | params.gravity = Gravity.CENTER; | 1651 | params.gravity = Gravity.CENTER; |
1571 | params.padding = new int[]{50, 50, 50, 50}; | 1652 | params.padding = new int[]{50, 50, 50, 50}; |
1572 | } | 1653 | } |
1573 | }) | 1654 | }) |
1574 | .setText("当前无网络,请检查网络设置") | 1655 | .setText("当前无网络,请检查网络设置") |
1575 | .setNegative("继续使用", null) | 1656 | .setNegative("继续使用", null) |
1576 | .setPositive("设置网络", new View.OnClickListener() { | 1657 | .setPositive("设置网络", new View.OnClickListener() { |
1577 | @Override | 1658 | @Override |
1578 | public void onClick(View v) { | 1659 | public void onClick(View v) { |
1579 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1660 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
1580 | mContext.startActivity(intent); | 1661 | mContext.startActivity(intent); |
1581 | } | 1662 | } |
1582 | }) | 1663 | }) |
1583 | .show(); | 1664 | .show(); |
1584 | } | 1665 | } |
1585 | }); | 1666 | }); |
1586 | } | 1667 | } |
1587 | 1668 | ||
1588 | 1669 | ||
1589 | private void closeProgress() { | 1670 | private void closeProgress() { |
1590 | try { | 1671 | try { |
1591 | if (mProgress != null) { | 1672 | if (mProgress != null) { |
1592 | mProgress.dismiss(); | 1673 | mProgress.dismiss(); |
1593 | mProgress = null; | 1674 | mProgress = null; |
1594 | } | 1675 | } |
1595 | } catch (Exception e) { | 1676 | } catch (Exception e) { |
1596 | e.printStackTrace(); | 1677 | e.printStackTrace(); |
1597 | } | 1678 | } |
1598 | } | 1679 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/ChangeInfo.java
1 | package com.hjx.personalcenter.model; | 1 | package com.hjx.personalcenter.model; |
2 | 2 | ||
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Created by h on 2017/8/23. | 6 | * Created by h on 2017/8/23. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | public class ChangeInfo implements Serializable{ | 9 | public class ChangeInfo implements Serializable{ |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * id : 688 | 12 | * id : 688 |
13 | * nickname : 1688kkkkkkkkk | 13 | * nickname : 1688kkkkkkkkk |
14 | * gender : 1 | 14 | * gender : 1 |
15 | * birthday : 1505209000000 | 15 | * birthday : 1505209000000 |
16 | * contact : {"qq":"1666600"} | 16 | * contact : {"qq":"1666600"} |
17 | * regionName : 闵行区 | 17 | * regionName : 闵行区 |
18 | * regionId : 310112 | 18 | * regionId : 310112 |
19 | * gradeId : 9 | 19 | * gradeId : 9 |
20 | * school : {"schoolId":499705} | 20 | * school : {"schoolId":499705} |
21 | */ | 21 | */ |
22 | 22 | ||
23 | private String id; | 23 | private String id; |
24 | private String nickname; | 24 | private int type; |
25 | |||
26 | public String getName() { | ||
27 | return name; | ||
28 | } | ||
29 | |||
30 | public void setName(String name) { | ||
31 | this.name = name; | ||
32 | } | ||
33 | |||
34 | private String name; | ||
25 | private String gender; | 35 | private String gender; |
36 | |||
37 | private String qq; | ||
26 | private String birthday; | 38 | private String birthday; |
27 | private ContactBean contact; | ||
28 | private String regionName; | 39 | private String regionName; |
29 | private int regionId; | 40 | private int regionId; |
30 | private int gradeId; | 41 | private int gradeId; |
31 | private SchoolBean school; | ||
32 | 42 | ||
33 | public String getId() { | 43 | |
34 | return id; | 44 | public String getQq() { |
45 | return qq; | ||
35 | } | 46 | } |
36 | 47 | ||
37 | public void setId(String id) { | 48 | public void setQq(String qq) { |
38 | this.id = id; | 49 | this.qq = qq; |
50 | } | ||
51 | public int getType() { | ||
52 | return type; | ||
39 | } | 53 | } |
40 | 54 | ||
41 | public String getNickname() { | 55 | public void setType(int type) { |
42 | return nickname; | 56 | this.type = type; |
43 | } | 57 | } |
44 | 58 | ||
45 | public void setNickname(String nickname) { | 59 | |
46 | this.nickname = nickname; | 60 | public String getId() { |
61 | return id; | ||
47 | } | 62 | } |
48 | 63 | ||
64 | public void setId(String id) { | ||
65 | this.id = id; | ||
66 | } | ||
49 | public String getGender() { | 67 | public String getGender() { |
50 | return gender; | 68 | return gender; |
51 | } | 69 | } |
52 | 70 | ||
53 | public void setGender(String gender) { | 71 | public void setGender(String gender) { |
54 | this.gender = gender; | 72 | this.gender = gender; |
55 | } | 73 | } |
56 | 74 | ||
57 | public String getBirthday() { | 75 | public String getBirthday() { |
58 | return birthday; | 76 | return birthday; |
59 | } | 77 | } |
60 | 78 | ||
61 | public void setBirthday(String birthday) { | 79 | public void setBirthday(String birthday) { |
62 | this.birthday = birthday; | 80 | this.birthday = birthday; |
63 | } | 81 | } |
64 | 82 | ||
65 | public ContactBean getContact() { | ||
66 | return contact; | ||
67 | } | ||
68 | |||
69 | public void setContact(ContactBean contact) { | ||
70 | this.contact = contact; | ||
71 | } | ||
72 | |||
73 | public String getRegionName() { | 83 | public String getRegionName() { |
74 | return regionName; | 84 | return regionName; |
75 | } | 85 | } |
76 | 86 | ||
77 | public void setRegionName(String regionName) { | 87 | public void setRegionName(String regionName) { |
78 | this.regionName = regionName; | 88 | this.regionName = regionName; |
79 | } | 89 | } |
80 | 90 | ||
81 | public int getRegionId() { | 91 | public int getRegionId() { |
82 | return regionId; | 92 | return regionId; |
83 | } | 93 | } |
84 | 94 | ||
85 | public void setRegionId(int regionId) { | 95 | public void setRegionId(int regionId) { |
86 | this.regionId = regionId; | 96 | this.regionId = regionId; |
87 | } | 97 | } |
88 | 98 | ||
89 | public int getGradeId() { | 99 | public int getGradeId() { |
90 | return gradeId; | 100 | return gradeId; |
91 | } | 101 | } |
92 | 102 | ||
93 | public void setGradeId(int gradeId) { | 103 | public void setGradeId(int gradeId) { |
94 | this.gradeId = gradeId; | 104 | this.gradeId = gradeId; |
95 | } | 105 | } |
96 | 106 | ||
97 | public SchoolBean getSchool() { | ||
98 | return school; | ||
99 | } | ||
100 | |||
101 | public void setSchool(SchoolBean school) { | ||
102 | this.school = school; | ||
103 | } | ||
104 | |||
105 | public static class ContactBean { | ||
106 | /** | ||
107 | * qq : 1666600 | ||
108 | */ | ||
109 | |||
110 | private String qq; | ||
111 | |||
112 | public String getQq() { | ||
113 | return qq; | ||
114 | } | ||
115 | |||
116 | public void setQq(String qq) { | ||
117 | this.qq = qq; |
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":"郑州","parentId":600,"school":"郑州小学","status":"未使用","name":"李四","grade":"初一","image":"http://hjxprodbucket.oss.aliyuncs.com/aaaaa.jpg","subAccountId":2}] | 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 : 1 | 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 : 郑州 | 68 | * region : 河北秦皇岛青龙bgggg |
69 | * parentId : 600 | 69 | * parentId : 0 |
70 | * school : 郑州小学 | 70 | * school : 静海四小 |
71 | * status : 未使用 | 71 | * status : 已使用 |
72 | * name : 李四 | 72 | * name : xfffff |
73 | * grade : 初一 | 73 | * grade : 四年级 |
74 | * image : http://hjxprodbucket.oss.aliyuncs.com/aaaaa.jpg | 74 | * image : http://hjxprodbucket.oss.aliyuncs.com//static/upload/online_api/mobile_portrait/2017-07-24/bd2a3d6a-a131-4cc4-b166-3da14555a96f.jpg |
75 | * subAccountId : 2 | 75 | * type : 1 |
76 | * deviceNumber : 012345678912345 | ||
77 | * subAccountId : 0 | ||
76 | */ | 78 | */ |
77 | 79 | ||
78 | private String region; | 80 | private String region; |
79 | private long parentId; | 81 | private Long parentId; |
80 | private String school; | 82 | private String school; |
81 | private String status; | 83 | private String status; |
82 | private String name; | 84 | private String name; |
83 | private String grade; | 85 | private String grade; |
84 | private String image; | 86 | private String image; |
85 | private int subAccountId; | 87 | private int type; |
88 | private String deviceNumber; | ||
89 | private String subAccountId; | ||
86 | 90 | ||
87 | public String getRegion() { | 91 | public String getRegion() { |
88 | return region; | 92 | return region; |
89 | } | 93 | } |
90 | 94 | ||
91 | public void setRegion(String region) { | 95 | public void setRegion(String region) { |
92 | this.region = region; | 96 | this.region = region; |
93 | } | 97 | } |
94 | 98 | ||
95 | public long getParentId() { | 99 | public Long getParentId() { |
96 | return parentId; | 100 | return parentId; |
97 | } | 101 | } |
98 | 102 | ||
99 | public void setParentId(int parentId) { | 103 | public void setParentId(Long parentId) { |
100 | this.parentId = parentId; | 104 | this.parentId = parentId; |
101 | } | 105 | } |
102 | 106 | ||
103 | public String getSchool() { | 107 | public String getSchool() { |
104 | return school; | 108 | return school; |
105 | } | 109 | } |
106 | 110 | ||
107 | public void setSchool(String school) { | 111 | public void setSchool(String school) { |
108 | this.school = school; | 112 | this.school = school; |
109 | } | 113 | } |
110 | 114 | ||
111 | public String getStatus() { | 115 | public String getStatus() { |
112 | return status; | 116 | return status; |
113 | } | 117 | } |
114 | 118 | ||
115 | public void setStatus(String status) { | 119 | public void setStatus(String status) { |
116 | this.status = status; | 120 | this.status = status; |
117 | } | 121 | } |
118 | 122 | ||
119 | public String getName() { | 123 | public String getName() { |
120 | return name; | 124 | return name; |
121 | } | 125 | } |
122 | 126 | ||
123 | public void setName(String name) { | 127 | public void setName(String name) { |
124 | this.name = name; | 128 | this.name = name; |
125 | } | 129 | } |
126 | 130 | ||
127 | public String getGrade() { | 131 | public String getGrade() { |
128 | return grade; | 132 | return grade; |
129 | } | 133 | } |
130 | 134 | ||
131 | public void setGrade(String grade) { | 135 | public void setGrade(String grade) { |
132 | this.grade = grade; | 136 | this.grade = grade; |
133 | } | 137 | } |
134 | 138 | ||
135 | public String getImage() { | 139 | public String getImage() { |
136 | return image; | 140 | return image; |
137 | } | 141 | } |
138 | 142 | ||
139 | public void setImage(String image) { | 143 | public void setImage(String image) { |
140 | this.image = image; | 144 | this.image = image; |
141 | } | 145 | } |
142 | 146 | ||
143 | public int getSubAccountId() { | 147 | public int getType() { |
148 | return type; | ||
149 | } | ||
150 | |||
151 | public void setType(int type) { | ||
152 | this.type = type; | ||
153 | } | ||
154 | |||
155 | public String getDeviceNumber() { | ||
156 | return deviceNumber; | ||
157 | } | ||
158 | |||
159 | public void setDeviceNumber(String deviceNumber) { | ||
160 | this.deviceNumber = deviceNumber; | ||
161 | } | ||
162 | |||
163 | public String getSubAccountId() { | ||
144 | return subAccountId; | 164 | return subAccountId; |
145 | } | 165 | } |
146 | 166 | ||
147 | public void setSubAccountId(int subAccountId) { | 167 | public void setSubAccountId(String subAccountId) { |
148 | this.subAccountId = subAccountId; | 168 | this.subAccountId = subAccountId; |
149 | } | 169 | } |
150 | } | 170 | } |
151 | } | 171 | } |
152 | 172 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/GetDate.java
1 | package com.hjx.personalcenter.util; | 1 | package com.hjx.personalcenter.util; |
2 | 2 | ||
3 | 3 | ||
4 | 4 | ||
5 | import java.util.Calendar; | 5 | import java.util.Calendar; |
6 | import java.util.Date; | 6 | import java.util.Date; |
7 | /* | 7 | /* |
8 | * s时间生成累 | 8 | * s时间生成累 |
9 | */ | 9 | */ |
10 | public class GetDate { | 10 | public class GetDate { |
11 | public StringBuilder getDate() | 11 | public StringBuilder getDate() |
12 | { | 12 | { |
13 | Calendar c = Calendar.getInstance(); | 13 | Calendar c = Calendar.getInstance(); |
14 | int year = c.get(Calendar.YEAR); | 14 | int year = c.get(Calendar.YEAR); |
15 | int month = c.get(Calendar.MONTH)+1; | 15 | int month = c.get(Calendar.MONTH)+1; |
16 | int day = c.get(Calendar.DAY_OF_MONTH); | 16 | int day = c.get(Calendar.DAY_OF_MONTH); |
17 | int hour=c.get(Calendar.HOUR_OF_DAY); | 17 | int hour=c.get(Calendar.HOUR_OF_DAY); |
18 | int minute=c.get(Calendar.MINUTE); | 18 | int minute=c.get(Calendar.MINUTE); |
19 | int second=c.get(Calendar.SECOND); | 19 | int second=c.get(Calendar.SECOND); |
20 | StringBuilder strDate=new StringBuilder(); | 20 | StringBuilder strDate=new StringBuilder(); |
21 | strDate.append(String.valueOf(year)); | 21 | strDate.append(String.valueOf(year)); |
22 | if(month<10) | 22 | if(month<10) |
23 | { | 23 | { |
24 | strDate.append("-0"+String.valueOf(month)); | 24 | strDate.append("-0"+String.valueOf(month)); |
25 | } | 25 | } |
26 | else | 26 | else |
27 | { | 27 | { |
28 | strDate.append("-"+String.valueOf(month)); | 28 | strDate.append("-"+String.valueOf(month)); |
29 | } | 29 | } |
30 | if(day<10) | 30 | if(day<10) |
31 | { | 31 | { |
32 | strDate.append("-0"+String.valueOf(day)); | 32 | strDate.append("-0"+String.valueOf(day)); |
33 | } | 33 | } |
34 | else | 34 | else |
35 | { | 35 | { |
36 | strDate.append("-"+String.valueOf(day)); | 36 | strDate.append("-"+String.valueOf(day)); |
37 | } | 37 | } |
38 | if(hour<10) | 38 | if(hour<10) |
39 | { | 39 | { |
40 | strDate.append("-0"+String.valueOf(hour)); | 40 | strDate.append("-0"+String.valueOf(hour)); |
41 | } | 41 | } |
42 | else | 42 | else |
43 | { | 43 | { |
44 | strDate.append("-"+String.valueOf(hour)); | 44 | strDate.append("-"+String.valueOf(hour)); |
45 | } | 45 | } |
46 | if(minute<10) | 46 | if(minute<10) |
47 | { | 47 | { |
48 | strDate.append("-0"+String.valueOf(minute)); | 48 | strDate.append("-0"+String.valueOf(minute)); |
49 | } | 49 | } |
50 | else | 50 | else |
51 | { | 51 | { |
52 | strDate.append("-"+String.valueOf(minute)); | 52 | strDate.append("-"+String.valueOf(minute)); |
53 | } | 53 | } |
54 | if(second<10) | 54 | if(second<10) |
55 | { | 55 | { |
56 | strDate.append("-0"+String.valueOf(second)); | 56 | strDate.append("-0"+String.valueOf(second)); |
57 | } | 57 | } |
58 | else | 58 | else |
59 | { | 59 | { |
60 | strDate.append("-"+String.valueOf(second)); | 60 | strDate.append("-"+String.valueOf(second)); |
61 | } | 61 | } |
62 | return strDate; | 62 | return strDate; |
63 | } | 63 | } |
64 | public StringBuilder getYMD() | 64 | public StringBuilder getYMD() |
65 | { | 65 | { |
66 | Calendar c = Calendar.getInstance(); | 66 | Calendar c = Calendar.getInstance(); |
67 | int year = c.get(Calendar.YEAR); | 67 | int year = c.get(Calendar.YEAR); |
68 | int month = c.get(Calendar.MONTH)+1; | 68 | int month = c.get(Calendar.MONTH)+1; |
69 | int day = c.get(Calendar.DAY_OF_MONTH); | 69 | int day = c.get(Calendar.DAY_OF_MONTH); |
70 | StringBuilder strDate=new StringBuilder(); | 70 | StringBuilder strDate=new StringBuilder(); |
71 | strDate.append(String.valueOf(year)); | 71 | strDate.append(String.valueOf(year)); |
72 | if(month<10) | 72 | if(month<10) |
73 | { | 73 | { |
74 | strDate.append("0"+String.valueOf(month)); | 74 | strDate.append("-0"+String.valueOf(month)); |
75 | } | 75 | } |
76 | else | 76 | else |
77 | { | 77 | { |
78 | strDate.append(""+String.valueOf(month)); | 78 | strDate.append("-"+String.valueOf(month)); |
79 | } | 79 | } |
80 | if(day<10) | 80 | if(day<10) |
81 | { | 81 | { |
82 | strDate.append("0"+String.valueOf(day)); | 82 | strDate.append("-0"+String.valueOf(day)); |
83 | } | 83 | } |
84 | else | 84 | else |
85 | { | 85 | { |
86 | strDate.append(""+String.valueOf(day)); | 86 | strDate.append("-"+String.valueOf(day)); |
87 | } | 87 | } |
88 | return strDate; | 88 | return strDate; |
89 | } | 89 | } |
90 | public StringBuilder getYM() | 90 | public StringBuilder getYM() |
91 | { | 91 | { |
92 | Calendar c = Calendar.getInstance(); | 92 | Calendar c = Calendar.getInstance(); |
93 | int year = c.get(Calendar.YEAR); | 93 | int year = c.get(Calendar.YEAR); |
94 | int month = c.get(Calendar.MONTH)+1; | 94 | int month = c.get(Calendar.MONTH)+1; |
95 | StringBuilder strDate=new StringBuilder(); | 95 | StringBuilder strDate=new StringBuilder(); |
96 | strDate.append(String.valueOf(year)); | 96 | strDate.append(String.valueOf(year)); |
97 | if(month<10) | 97 | if(month<10) |
98 | { | 98 | { |
99 | strDate.append("-0"+String.valueOf(month)); | 99 | strDate.append("-0"+String.valueOf(month)); |
100 | } | 100 | } |
101 | else | 101 | else |
102 | { | 102 | { |
103 | strDate.append("-"+String.valueOf(month)); | 103 | strDate.append("-"+String.valueOf(month)); |
104 | } | 104 | } |
105 | return strDate; | 105 | return strDate; |
106 | } | 106 | } |
107 | 107 | ||
108 | public String getMonths(String date,String nowdate)//��-�� | 108 | public String getMonths(String date,String nowdate)//��-�� |
109 | { | 109 | { |
110 | String[]str1=date.trim().split("-"); | 110 | String[]str1=date.trim().split("-"); |
111 | String[]str2=nowdate.trim().split("-"); | 111 | String[]str2=nowdate.trim().split("-"); |
112 | int s=(Integer.parseInt(str1[0])-Integer.parseInt(str2[0]))*12+Integer.parseInt(str1[1])-Integer.parseInt(str2[1]); | 112 | int s=(Integer.parseInt(str1[0])-Integer.parseInt(str2[0]))*12+Integer.parseInt(str1[1])-Integer.parseInt(str2[1]); |
113 | String months=String.valueOf(s); | 113 | String months=String.valueOf(s); |
114 | return months; | 114 | return months; |
115 | } | 115 | } |
116 | 116 | ||
117 | public String dateChange(String date) | 117 | public String dateChange(String date) |
118 | { | 118 | { |
119 | StringBuilder sb=new StringBuilder(); | 119 | StringBuilder sb=new StringBuilder(); |
120 | String[]dateStr=date.split("-"); | 120 | String[]dateStr=date.split("-"); |
121 | for(int i=0;i<dateStr.length;i++) | 121 | for(int i=0;i<dateStr.length;i++) |
122 | { | 122 | { |
123 | sb.append(dateStr[i]); | 123 | sb.append(dateStr[i]); |
124 | } | 124 | } |
125 | return sb.toString(); | 125 | return sb.toString(); |
126 | } | 126 | } |
127 | //"-" | 127 | //"-" |
128 | public String addressChange(String addresss) | 128 | public String addressChange(String addresss) |
129 | { | 129 | { |
130 | char spl = (char)0x1c; | 130 | char spl = (char)0x1c; |
131 | // StringBuilder sb=new StringBuilder(); | 131 | // StringBuilder sb=new StringBuilder(); |
132 | // String[]addressStr=addresss.split(String.valueOf(spl)); | 132 | // String[]addressStr=addresss.split(String.valueOf(spl)); |
133 | String newAddr=addresss.replace(String.valueOf(spl), ""); | 133 | String newAddr=addresss.replace(String.valueOf(spl), ""); |
134 | return newAddr; | 134 | return newAddr; |
135 | // for(int i=0;i<addressStr.length;i++) | 135 | // for(int i=0;i<addressStr.length;i++) |
136 | // { | 136 | // { |
137 | //// sb.append(addressStr[i].replace("-","")); | 137 | //// sb.append(addressStr[i].replace("-","")); |
138 | // sb.append(addressStr[i].replace("*","")); | 138 | // sb.append(addressStr[i].replace("*","")); |
139 | // } | 139 | // } |
140 | // return sb.toString(); | 140 | // return sb.toString(); |
141 | } | 141 | } |
142 | public static String getYMDHMS(){ | 142 | public static String getYMDHMS(){ |
143 | String timeStr = null; | 143 | String timeStr = null; |
144 | Calendar c = Calendar.getInstance(); | 144 | Calendar c = Calendar.getInstance(); |
145 | int y = c.get(Calendar.YEAR); | 145 | int y = c.get(Calendar.YEAR); |
146 | int m = c.get(Calendar.MONTH)+1; | 146 | int m = c.get(Calendar.MONTH)+1; |
147 | int d = c.get(Calendar.DAY_OF_MONTH); | 147 | int d = c.get(Calendar.DAY_OF_MONTH); |
148 | int h = c.get(Calendar.HOUR_OF_DAY); | 148 | int h = c.get(Calendar.HOUR_OF_DAY); |
149 | int min = c.get(Calendar.MINUTE); | 149 | int min = c.get(Calendar.MINUTE); |
150 | int s = c.get(Calendar.SECOND); | 150 | int s = c.get(Calendar.SECOND); |
151 | 151 | ||
152 | String year = null, month = null, day = null, hour = null, minute = null, second = null; | 152 | String year = null, month = null, day = null, hour = null, minute = null, second = null; |
153 | 153 | ||
154 | year = String.valueOf(y); | 154 | year = String.valueOf(y); |
155 | if(m<10){ | 155 | if(m<10){ |
156 | month = "0"+m; | 156 | month = "0"+m; |
157 | } | 157 | } |
158 | else{ | 158 | else{ |
159 | month = ""+m; | 159 | month = ""+m; |
160 | } | 160 | } |
161 | if(d<10){ | 161 | if(d<10){ |
162 | day = "0"+d; | 162 | day = "0"+d; |
163 | } | 163 | } |
164 | else{ | 164 | else{ |
165 | day = ""+d; | 165 | day = ""+d; |
166 | } | 166 | } |
167 | if(h<10){ | 167 | if(h<10){ |
168 | hour = "0"+h; | 168 | hour = "0"+h; |
169 | } | 169 | } |
170 | else{ | 170 | else{ |
171 | hour = ""+h; | 171 | hour = ""+h; |
172 | } | 172 | } |
173 | if(min<10){ | 173 | if(min<10){ |
174 | minute = "0"+min; | 174 | minute = "0"+min; |
175 | } | 175 | } |
176 | else{ | 176 | else{ |
177 | minute = ""+min; | 177 | minute = ""+min; |
178 | } | 178 | } |
179 | if(s<10){ | 179 | if(s<10){ |
180 | second = "0"+s; | 180 | second = "0"+s; |
181 | } | 181 | } |
182 | else{ | 182 | else{ |
183 | second = ""+s; | 183 | second = ""+s; |
184 | } | 184 | } |
185 | timeStr = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second; | 185 | timeStr = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second; |
186 | 186 | ||
187 | return timeStr; | 187 | return timeStr; |
188 | } | 188 | } |
189 | public static String getYMDHMS1(){ | 189 | public static String getYMDHMS1(){ |
190 | String timeStr = null; | 190 | String timeStr = null; |
191 | Calendar c = Calendar.getInstance(); | 191 | Calendar c = Calendar.getInstance(); |
192 | int y = c.get(Calendar.YEAR); | 192 | int y = c.get(Calendar.YEAR); |
193 | int m = c.get(Calendar.MONTH)+1; | 193 | int m = c.get(Calendar.MONTH)+1; |
194 | int d = c.get(Calendar.DAY_OF_MONTH); | 194 | int d = c.get(Calendar.DAY_OF_MONTH); |
195 | int h = c.get(Calendar.HOUR_OF_DAY); | 195 | int h = c.get(Calendar.HOUR_OF_DAY); |
196 | int min = c.get(Calendar.MINUTE); | 196 | int min = c.get(Calendar.MINUTE); |
197 | int s = c.get(Calendar.SECOND); | 197 | int s = c.get(Calendar.SECOND); |
198 | 198 | ||
199 | String year = null, month = null, day = null, hour = null, minute = null, second = null; | 199 | String year = null, month = null, day = null, hour = null, minute = null, second = null; |
200 | 200 | ||
201 | year = String.valueOf(y); | 201 | year = String.valueOf(y); |
202 | if(m<10){ | 202 | if(m<10){ |
203 | month = "0"+m; | 203 | month = "0"+m; |
204 | } | 204 | } |
205 | else{ | 205 | else{ |
206 | month = ""+m; | 206 | month = ""+m; |
207 | } | 207 | } |
208 | if(d<10){ | 208 | if(d<10){ |
209 | day = "0"+d; | 209 | day = "0"+d; |
210 | } | 210 | } |
211 | else{ | 211 | else{ |
212 | day = ""+d; | 212 | day = ""+d; |
213 | } | 213 | } |
214 | if(h<10){ | 214 | if(h<10){ |
215 | hour = "0"+h; | 215 | hour = "0"+h; |
216 | } | 216 | } |
217 | else{ | 217 | else{ |
218 | hour = ""+h; | 218 | hour = ""+h; |
219 | } | 219 | } |
220 | if(min<10){ | 220 | if(min<10){ |
221 | minute = "0"+min; | 221 | minute = "0"+min; |
222 | } | 222 | } |
223 | else{ | 223 | else{ |
224 | minute = ""+min; | 224 | minute = ""+min; |
225 | } | 225 | } |
226 | if(s<10){ | 226 | if(s<10){ |
227 | second = "0"+s; | 227 | second = "0"+s; |
228 | } | 228 | } |
229 | else{ | 229 | else{ |
230 | second = ""+s; | 230 | second = ""+s; |
231 | } | 231 | } |
232 | timeStr = year+"-"+month+"-"+day+"-"+hour+"-"+minute+"-"+second; | 232 | timeStr = year+"-"+month+"-"+day+"-"+hour+"-"+minute+"-"+second; |
233 | 233 | ||
234 | return timeStr; | 234 | return timeStr; |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | public String getCurrentTime(){ | 238 | public String getCurrentTime(){ |
239 | String timeStr = null; | 239 | String timeStr = null; |
240 | Calendar c = Calendar.getInstance(); | 240 | Calendar c = Calendar.getInstance(); |
241 | int y = c.get(Calendar.YEAR); | 241 | int y = c.get(Calendar.YEAR); |
242 | int m = c.get(Calendar.MONTH)+1; | 242 | int m = c.get(Calendar.MONTH)+1; |
243 | int d = c.get(Calendar.DAY_OF_MONTH); | 243 | int d = c.get(Calendar.DAY_OF_MONTH); |
244 | int h = c.get(Calendar.HOUR_OF_DAY); | 244 | int h = c.get(Calendar.HOUR_OF_DAY); |
245 | int min = c.get(Calendar.MINUTE); | 245 | int min = c.get(Calendar.MINUTE); |
246 | int s = c.get(Calendar.SECOND); | 246 | int s = c.get(Calendar.SECOND); |
247 | 247 | ||
248 | String year = null, month = null, day = null, hour = null, minute = null, second = null; | 248 | String year = null, month = null, day = null, hour = null, minute = null, second = null; |
249 | 249 | ||
250 | year = String.valueOf(y); | 250 | year = String.valueOf(y); |
251 | if(m<10){ | 251 | if(m<10){ |
252 | month = "0"+m; | 252 | month = "0"+m; |
253 | } | 253 | } |
254 | else{ | 254 | else{ |
255 | month = ""+m; | 255 | month = ""+m; |
256 | } | 256 | } |
257 | if(d<10){ | 257 | if(d<10){ |
258 | day = "0"+d; | 258 | day = "0"+d; |
259 | } | 259 | } |
260 | else{ | 260 | else{ |
261 | day = ""+d; | 261 | day = ""+d; |
262 | } | 262 | } |
263 | if(h<10){ | 263 | if(h<10){ |
264 | hour = "0"+h; | 264 | hour = "0"+h; |
265 | } | 265 | } |
266 | else{ | 266 | else{ |
267 | hour = ""+h; | 267 | hour = ""+h; |
268 | } | 268 | } |
269 | if(min<10){ | 269 | if(min<10){ |
270 | minute = "0"+min; | 270 | minute = "0"+min; |
271 | } | 271 | } |
272 | else{ | 272 | else{ |
273 | minute = ""+min; | 273 | minute = ""+min; |
274 | } | 274 | } |
275 | if(s<10){ | 275 | if(s<10){ |
276 | second = "0"+s; | 276 | second = "0"+s; |
277 | } | 277 | } |
278 | else{ | 278 | else{ |
279 | second = ""+s; | 279 | second = ""+s; |
280 | } | 280 | } |
281 | timeStr = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second+".0"; | 281 | timeStr = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second+".0"; |
282 | 282 | ||
283 | return timeStr; | 283 | return timeStr; |
284 | } | 284 | } |
285 | 285 | ||
286 | 286 | ||
287 | public Long getDaysBetween(Date startDate, Date endDate) { | 287 | public Long getDaysBetween(Date startDate, Date endDate) { |
288 | Calendar fromCalendar = Calendar.getInstance(); | 288 | Calendar fromCalendar = Calendar.getInstance(); |
289 | fromCalendar.setTime(startDate); | 289 | fromCalendar.setTime(startDate); |
290 | fromCalendar.set(Calendar.HOUR_OF_DAY, 0); | 290 | fromCalendar.set(Calendar.HOUR_OF_DAY, 0); |
291 | fromCalendar.set(Calendar.MINUTE, 0); | 291 | fromCalendar.set(Calendar.MINUTE, 0); |
292 | fromCalendar.set(Calendar.SECOND, 0); | 292 | fromCalendar.set(Calendar.SECOND, 0); |
293 | fromCalendar.set(Calendar.MILLISECOND, 0); | 293 | fromCalendar.set(Calendar.MILLISECOND, 0); |
294 | 294 | ||
295 | Calendar toCalendar = Calendar.getInstance(); | 295 | Calendar toCalendar = Calendar.getInstance(); |
296 | toCalendar.setTime(endDate); | 296 | toCalendar.setTime(endDate); |
297 | toCalendar.set(Calendar.HOUR_OF_DAY, 0); | 297 | toCalendar.set(Calendar.HOUR_OF_DAY, 0); |
298 | toCalendar.set(Calendar.MINUTE, 0); | 298 | toCalendar.set(Calendar.MINUTE, 0); |
299 | toCalendar.set(Calendar.SECOND, 0); | 299 | toCalendar.set(Calendar.SECOND, 0); |
300 | toCalendar.set(Calendar.MILLISECOND, 0); | 300 | toCalendar.set(Calendar.MILLISECOND, 0); |
301 | 301 | ||
302 | return 1+(toCalendar.getTime().getTime() - fromCalendar.getTime().getTime()) / (1000 * 60 * 60 * 24); | 302 | return 1+(toCalendar.getTime().getTime() - fromCalendar.getTime().getTime()) / (1000 * 60 * 60 * 24); |
303 | } | 303 | } |
304 | 304 | ||
305 | 305 | ||
306 | } | 306 | } |
307 | 307 |
PersonalCenter/app/src/main/res/layout/activity_account_management.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | 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 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
6 | 7 | ||
7 | <RelativeLayout | 8 | <RelativeLayout |
8 | android:id="@+id/title" | 9 | android:id="@+id/title" |
9 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
10 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
11 | android:background="@color/login_text_blue" | 12 | android:background="@color/login_text_blue" |
12 | android:minHeight="50dp"> | 13 | android:minHeight="50dp"> |
13 | 14 | ||
14 | <ImageView | 15 | <ImageView |
15 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
16 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
17 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
18 | android:layout_centerVertical="true" | 19 | android:layout_centerVertical="true" |
19 | android:paddingLeft="20dp" | 20 | android:paddingLeft="20dp" |
20 | android:paddingRight="20dp" | 21 | android:paddingRight="20dp" |
21 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
22 | 23 | ||
23 | <TextView | 24 | <TextView |
24 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
25 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
26 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
27 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
28 | android:text="@string/account_management" | 29 | android:text="@string/account_management" |
29 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
30 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
31 | </RelativeLayout> | 32 | </RelativeLayout> |
32 | 33 | ||
33 | <LinearLayout | 34 | <LinearLayout |
34 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
35 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
36 | android:layout_margin="20dp" | 37 | android:layout_margin="20dp" |
37 | android:gravity="center_vertical" | 38 | android:gravity="center_vertical" |
38 | android:orientation="horizontal"> | 39 | android:orientation="horizontal"> |
39 | 40 | ||
40 | <View | 41 | <View |
41 | android:layout_width="5dp" | 42 | android:layout_width="5dp" |
42 | android:layout_height="20dp" | 43 | android:layout_height="20dp" |
43 | android:background="@color/login_text_blue"> | 44 | android:background="@color/login_text_blue"> |
44 | 45 | ||
45 | </View> | 46 | </View> |
46 | 47 | ||
47 | <TextView | 48 | <TextView |
48 | android:layout_width="wrap_content" | 49 | android:layout_width="wrap_content" |
49 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
50 | android:layout_marginLeft="5dp" | 51 | android:layout_marginLeft="5dp" |
51 | android:text="账户安全" | 52 | android:text="账户安全" |
52 | android:textSize="22sp" /> | 53 | android:textSize="22sp" /> |
53 | 54 | ||
54 | </LinearLayout> | 55 | </LinearLayout> |
55 | 56 | ||
56 | <LinearLayout | 57 | <LinearLayout |
57 | android:layout_width="match_parent" | 58 | android:layout_width="match_parent" |
58 | android:layout_height="wrap_content" | 59 | android:layout_height="wrap_content" |
59 | android:layout_marginLeft="60dp" | 60 | android:layout_marginLeft="60dp" |
60 | android:orientation="vertical"> | 61 | android:orientation="vertical"> |
61 | 62 | ||
62 | <LinearLayout | 63 | <LinearLayout |
63 | android:layout_width="match_parent" | 64 | android:layout_width="match_parent" |
64 | android:layout_height="wrap_content"> | 65 | android:layout_height="wrap_content"> |
65 | 66 | ||
66 | 67 | ||
67 | <TextView | 68 | <TextView |
68 | android:layout_width="0dp" | 69 | android:layout_width="0dp" |
69 | android:layout_height="wrap_content" | 70 | android:layout_height="wrap_content" |
70 | android:layout_weight="1.5" | 71 | android:layout_weight="1.5" |
71 | android:text="当前绑定手机号" | 72 | android:text="当前绑定手机号" |
72 | android:textSize="22sp" /> | 73 | android:textSize="22sp" /> |
73 | 74 | ||
74 | <TextView | 75 | <TextView |
75 | android:id="@+id/cunt_username" | 76 | android:id="@+id/cunt_username" |
76 | android:layout_width="0dp" | 77 | android:layout_width="0dp" |
77 | android:layout_height="wrap_content" | 78 | android:layout_height="wrap_content" |
78 | android:layout_marginLeft="50dp" | 79 | android:layout_marginLeft="50dp" |
79 | android:layout_weight="6" | 80 | android:layout_weight="6" |
80 | android:text="" | 81 | android:text="" |
81 | android:textSize="22sp" /> | 82 | android:textSize="22sp" /> |
82 | 83 | ||
83 | <TextView | 84 | <TextView |
84 | android:id="@+id/changBangding" | 85 | android:id="@+id/changBangding" |
85 | android:layout_width="0dp" | 86 | android:layout_width="0dp" |
86 | android:layout_height="wrap_content" | 87 | android:layout_height="wrap_content" |
87 | android:layout_weight="1" | 88 | android:layout_weight="1" |
88 | android:text="更换绑定" | 89 | android:text="更换绑定" |
89 | android:textSize="22sp" /> | 90 | android:textSize="22sp" /> |
90 | 91 | ||
91 | <ImageView | 92 | <ImageView |
92 | android:layout_width="wrap_content" | 93 | android:layout_width="wrap_content" |
93 | android:layout_height="wrap_content" | 94 | android:layout_height="wrap_content" |
94 | android:layout_weight="0.1" | 95 | android:layout_weight="0.1" |
95 | android:padding="10dp" | 96 | android:padding="10dp" |
96 | android:src="@mipmap/youjiantou" /> | 97 | android:src="@mipmap/youjiantou" /> |
97 | </LinearLayout> | 98 | </LinearLayout> |
98 | 99 | ||
99 | <LinearLayout | 100 | <LinearLayout |
100 | android:layout_width="match_parent" | 101 | android:layout_width="match_parent" |
101 | android:layout_height="wrap_content" | 102 | android:layout_height="wrap_content" |
102 | android:layout_marginTop="30dp"> | 103 | android:layout_marginTop="30dp"> |
103 | 104 | ||
104 | 105 | ||
105 | <TextView | 106 | <TextView |
106 | android:layout_width="0dp" | 107 | android:layout_width="0dp" |
107 | android:layout_height="wrap_content" | 108 | android:layout_height="wrap_content" |
108 | android:layout_weight="1.5" | 109 | android:layout_weight="1.5" |
109 | android:text="登录密码" | 110 | android:text="登录密码" |
110 | android:textSize="22sp" /> | 111 | android:textSize="22sp" /> |
111 | 112 | ||
112 | <TextView | 113 | <TextView |
113 | android:layout_width="0dp" | 114 | android:layout_width="0dp" |
114 | android:layout_height="wrap_content" | 115 | android:layout_height="wrap_content" |
115 | android:layout_marginLeft="50dp" | 116 | android:layout_marginLeft="50dp" |
116 | android:layout_weight="6" | 117 | android:layout_weight="6" |
117 | android:text="已设置" | 118 | android:text="已设置" |
118 | android:textSize="22sp" /> | 119 | android:textSize="22sp" /> |
119 | 120 | ||
120 | <TextView | 121 | <TextView |
121 | android:id="@+id/changpassword" | 122 | android:id="@+id/changpassword" |
122 | android:layout_width="0dp" | 123 | android:layout_width="0dp" |
123 | android:layout_height="wrap_content" | 124 | android:layout_height="wrap_content" |
124 | android:layout_weight="1" | 125 | android:layout_weight="1" |
125 | android:text="修改密码" | 126 | android:text="修改密码" |
126 | android:textSize="22sp" /> | 127 | android:textSize="22sp" /> |
127 | 128 | ||
128 | <ImageView | 129 | <ImageView |
129 | android:layout_width="wrap_content" | 130 | android:layout_width="wrap_content" |
130 | android:layout_height="wrap_content" | 131 | android:layout_height="wrap_content" |
131 | android:layout_weight="0.1" | 132 | android:layout_weight="0.1" |
132 | android:padding="10dp" | 133 | android:padding="10dp" |
133 | android:src="@mipmap/youjiantou" /> | 134 | android:src="@mipmap/youjiantou" /> |
134 | </LinearLayout> | 135 | </LinearLayout> |
135 | 136 | ||
136 | </LinearLayout> | 137 | </LinearLayout> |
137 | 138 | ||
138 | <View | 139 | <View |
139 | android:layout_width="match_parent" | 140 | android:layout_width="match_parent" |
140 | android:layout_height="0.7dp" | 141 | android:layout_height="0.7dp" |
141 | android:layout_margin="20dp" | 142 | android:layout_margin="20dp" |
142 | android:background="#FF909090" /> | 143 | android:background="#FF909090" /> |
143 | 144 | ||
144 | <LinearLayout | 145 | <LinearLayout |
145 | android:layout_width="wrap_content" | 146 | android:layout_width="wrap_content" |
146 | android:layout_height="wrap_content" | 147 | android:layout_height="wrap_content" |
147 | android:layout_margin="20dp" | 148 | android:layout_margin="20dp" |
148 | android:gravity="center_vertical" | 149 | android:gravity="center_vertical" |
149 | android:orientation="horizontal"> | 150 | android:orientation="horizontal"> |
150 | 151 | ||
151 | <View | 152 | <View |
152 | android:layout_width="5dp" | 153 | android:layout_width="5dp" |
153 | android:layout_height="20dp" | 154 | android:layout_height="20dp" |
154 | android:background="@color/login_text_blue"> | 155 | android:background="@color/login_text_blue"> |
155 | 156 | ||
156 | </View> | 157 | </View> |
157 | 158 | ||
158 | <TextView | 159 | <TextView |
159 | android:layout_width="wrap_content" | 160 | android:layout_width="wrap_content" |
160 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
161 | android:layout_marginLeft="5dp" | 162 | android:layout_marginLeft="5dp" |
162 | android:text="子账户管理" | 163 | android:text="子账户管理" |
163 | android:textSize="22sp" /> | 164 | android:textSize="22sp" /> |
164 | 165 | ||
165 | </LinearLayout> | 166 | </LinearLayout> |
166 | 167 | ||
167 | <LinearLayout | 168 | <LinearLayout |
168 | android:layout_width="match_parent" | 169 | android:layout_width="match_parent" |
169 | android:layout_height="match_parent" | 170 | android:layout_height="match_parent" |
170 | android:layout_marginLeft="30dp" | 171 | android:layout_marginLeft="30dp" |
171 | android:orientation="vertical"> | 172 | android:orientation="vertical"> |
172 | 173 | ||
173 | <LinearLayout | 174 | <LinearLayout |
174 | android:layout_width="match_parent" | 175 | android:layout_width="match_parent" |
175 | android:layout_height="wrap_content"> | 176 | android:layout_height="wrap_content"> |
176 | 177 | ||
177 | <LinearLayout | 178 | <LinearLayout |
178 | android:layout_width="0dp" | 179 | android:layout_width="0dp" |
179 | android:layout_height="wrap_content" | 180 | android:layout_height="wrap_content" |
180 | android:layout_weight="1"> | 181 | android:layout_weight="1"> |
181 | 182 | ||
182 | <LinearLayout | 183 | <LinearLayout |
184 | android:id="@+id/ll_zhu_backgrangd" | ||
183 | android:layout_width="wrap_content" | 185 | android:layout_width="wrap_content" |
184 | android:layout_height="wrap_content" | 186 | android:layout_height="wrap_content" |
185 | android:background="@drawable/corcle_blue_bg" | 187 | android:background="@drawable/corcle_blue_bg" |
186 | android:orientation="vertical"> | 188 | android:orientation="vertical"> |
187 | 189 | ||
188 | <LinearLayout | 190 | <LinearLayout |
189 | android:layout_width="match_parent" | 191 | android:layout_width="match_parent" |
190 | android:layout_height="wrap_content" | 192 | android:layout_height="wrap_content" |
191 | android:orientation="horizontal"> | 193 | android:orientation="horizontal"> |
192 | 194 | <com.facebook.drawee.view.SimpleDraweeView | |
193 | <ImageView | ||
194 | android:id="@+id/tv_account_head" | 195 | android:id="@+id/tv_account_head" |
195 | android:layout_width="wrap_content" | 196 | android:layout_width="60dp" |
196 | android:layout_height="wrap_content" | 197 | android:layout_height="60dp" |
197 | android:layout_margin="10dp" | 198 | android:layout_margin="10dp" |
198 | android:src="@mipmap/header_default" /> | 199 | fresco:placeholderImage="@mipmap/header_default" |
200 | fresco:roundAsCircle="true" | ||
201 | fresco:placeholderImageScaleType="fitCenter" /> | ||
199 | 202 | ||
200 | <LinearLayout | 203 | <LinearLayout |
201 | android:layout_width="0dp" | 204 | android:layout_width="0dp" |
202 | android:layout_height="wrap_content" | 205 | android:layout_height="wrap_content" |
203 | android:layout_marginLeft="10dp" | 206 | android:layout_marginLeft="10dp" |
204 | android:layout_marginTop="10dp" | 207 | android:layout_marginTop="10dp" |
205 | android:layout_weight="1" | 208 | android:layout_weight="1" |
206 | android:orientation="vertical"> | 209 | android:orientation="vertical"> |
207 | 210 | ||
208 | <TextView | 211 | <TextView |
209 | android:id="@+id/tv_account_name" | 212 | android:id="@+id/tv_account_name" |
210 | android:layout_width="wrap_content" | 213 | android:layout_width="wrap_content" |
211 | android:layout_height="wrap_content" | 214 | android:layout_height="wrap_content" |
212 | android:text="" | 215 | android:text="" |
213 | android:textSize="18sp" /> | 216 | android:textSize="18sp" /> |
214 | 217 | ||
215 | <TextView | 218 | <TextView |
216 | android:id="@+id/tv_account_grade" | 219 | android:id="@+id/tv_account_grade" |
217 | android:layout_width="wrap_content" | 220 | android:layout_width="wrap_content" |
218 | android:layout_height="wrap_content" | 221 | android:layout_height="wrap_content" |
219 | android:text="" | 222 | android:text="" |
220 | android:textSize="18sp" /> | 223 | android:textSize="18sp" /> |
221 | 224 | ||
222 | <TextView | 225 | <TextView |
223 | android:id="@+id/tv_account_school" | 226 | android:id="@+id/tv_account_school" |
224 | android:layout_width="wrap_content" | 227 | android:layout_width="wrap_content" |
225 | android:layout_height="wrap_content" | 228 | android:layout_height="wrap_content" |
226 | android:text="" | 229 | android:text="" |
227 | android:textSize="18sp" /> | 230 | android:textSize="18sp" /> |
228 | 231 | ||
229 | <TextView | 232 | <TextView |
230 | android:id="@+id/tv_account_adress" | 233 | android:id="@+id/tv_account_adress" |
231 | android:layout_width="wrap_content" | 234 | android:layout_width="wrap_content" |
232 | android:layout_height="wrap_content" | 235 | android:layout_height="wrap_content" |
233 | android:text="" | 236 | android:text="" |
234 | android:textSize="18sp" /> | 237 | android:textSize="18sp" /> |
235 | 238 | ||
236 | 239 | ||
237 | </LinearLayout> | 240 | </LinearLayout> |
238 | 241 | ||
239 | <ImageView | 242 | <ImageView |
243 | android:id="@+id/iv_shiyongzhong" | ||
240 | android:layout_width="wrap_content" | 244 | android:layout_width="wrap_content" |
241 | android:layout_height="wrap_content" | 245 | android:layout_height="wrap_content" |
242 | android:layout_gravity="right" | 246 | android:layout_gravity="right" |
243 | android:layout_marginLeft="60dp" | 247 | android:layout_marginLeft="60dp" |
248 | android:visibility="gone" | ||
244 | android:src="@mipmap/shiyongzhong" /> | 249 | android:src="@mipmap/shiyongzhong" /> |
245 | 250 | ||
246 | </LinearLayout> | 251 | </LinearLayout> |
247 | 252 | ||
248 | <View | 253 | <View |
249 | android:layout_width="match_parent" | 254 | android:layout_width="match_parent" |
250 | android:layout_height="0.7dp" | 255 | android:layout_height="0.7dp" |
251 | android:layout_margin="10dp" | 256 | android:layout_margin="10dp" |
252 | android:background="@color/cutoff_line"> | 257 | android:background="@color/cutoff_line"> |
253 | 258 | ||
254 | </View> | 259 | </View> |
255 | 260 | ||
256 | <LinearLayout | 261 | <LinearLayout |
257 | android:layout_width="match_parent" | 262 | android:layout_width="match_parent" |
258 | android:layout_height="wrap_content" | 263 | android:layout_height="wrap_content" |
259 | android:layout_marginBottom="10dp" | 264 | android:layout_marginBottom="10dp" |
260 | android:orientation="horizontal"> | 265 | android:orientation="horizontal"> |
261 | 266 | ||
262 | <TextView | 267 | <TextView |
268 | android:id="@+id/change_zhu_account" | ||
263 | android:layout_width="0dp" | 269 | android:layout_width="0dp" |
264 | android:layout_height="wrap_content" | 270 | android:layout_height="wrap_content" |
265 | android:layout_weight="1" | 271 | android:layout_weight="1" |
266 | android:gravity="center" | 272 | android:gravity="center" |
267 | android:textSize="18sp" /> | 273 | android:text="切换主账户" |
268 | |||
269 | <TextView | ||
270 | android:id="@+id/tv_account_delete" | ||
271 | android:layout_width="0dp" | ||
272 | android:layout_height="wrap_content" | ||
273 | android:layout_weight="1" | ||
274 | android:gravity="center" | ||
275 | android:text="使用中" | ||
276 | android:textSize="18sp" /> | 274 | android:textSize="18sp" /> |
277 | 275 | ||
278 | 276 | ||
279 | </LinearLayout> | 277 | </LinearLayout> |
280 | 278 | ||
281 | </LinearLayout> | 279 | </LinearLayout> |
282 | 280 | ||
283 | 281 | ||
284 | </LinearLayout> | 282 | </LinearLayout> |
285 | 283 | ||
286 | <LinearLayout | 284 | <LinearLayout |
287 | android:layout_width="0dp" | 285 | android:layout_width="0dp" |
288 | android:layout_height="wrap_content" | 286 | android:layout_height="wrap_content" |
289 | android:layout_weight="1"> | 287 | android:layout_weight="1"> |
290 | 288 | ||
291 | </LinearLayout> | 289 | </LinearLayout> |
292 | 290 | ||
293 | <LinearLayout | 291 | <LinearLayout |
294 | android:layout_width="0dp" | 292 | android:layout_width="0dp" |
295 | android:layout_height="wrap_content" | 293 | android:layout_height="wrap_content" |
296 | android:layout_weight="1"> | 294 | android:layout_weight="1"> |
297 | 295 | ||
298 | </LinearLayout> | 296 | </LinearLayout> |
299 | </LinearLayout> | 297 | </LinearLayout> |
300 | 298 | ||
301 | <RelativeLayout | 299 | <RelativeLayout |
302 | android:layout_width="match_parent" | 300 | android:layout_width="match_parent" |
303 | android:layout_height="wrap_content" | 301 | android:layout_height="wrap_content" |
304 | android:layout_marginTop="20dp" | 302 | android:layout_marginTop="20dp" |
305 | android:orientation="horizontal"> | 303 | android:orientation="horizontal"> |
306 | <android.support.v7.widget.RecyclerView | 304 | <android.support.v7.widget.RecyclerView |
307 | android:id="@+id/id_recyclerview_horizontal" | 305 | android:id="@+id/id_recyclerview_horizontal" |
308 | android:layout_width="wrap_content" | 306 | android:layout_width="wrap_content" |
309 | android:layout_toLeftOf="@+id/add_account" | 307 | android:layout_toLeftOf="@+id/add_account" |
310 | android:layout_height="wrap_content" | 308 | android:layout_height="wrap_content" |
311 | android:layout_centerVertical="true" | 309 | android:layout_centerVertical="true" |
312 | android:scrollbars="none" | 310 | android:scrollbars="none" |
313 | > | 311 | > |
314 | </android.support.v7.widget.RecyclerView> | 312 | </android.support.v7.widget.RecyclerView> |
315 | <LinearLayout | 313 | <LinearLayout |
316 | android:id="@+id/add_account" | 314 | android:id="@+id/add_account" |
317 | android:layout_width="415dp" | 315 | android:layout_width="415dp" |
318 | android:layout_height="165dp" | 316 | android:layout_height="165dp" |
319 | android:layout_marginLeft="10dp" | 317 | android:layout_marginLeft="10dp" |
320 | android:layout_alignParentRight="true" | 318 | android:layout_alignParentRight="true" |
321 | android:background="@drawable/corcle_black_bg" | 319 | android:background="@drawable/corcle_black_bg" |
322 | android:gravity="center"> | 320 | android:gravity="center"> |
323 | <ImageView | 321 | <ImageView |
324 | android:layout_width="wrap_content" | 322 | android:layout_width="wrap_content" |
325 | android:layout_height="wrap_content" | 323 | android:layout_height="wrap_content" |
326 | android:src="@mipmap/jia"/> | 324 | android:src="@mipmap/jia"/> |
327 | 325 | ||
328 | </LinearLayout> | 326 | </LinearLayout> |
329 | 327 | ||
330 | 328 | ||
331 | 329 |
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/electronic_text"> | 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/electronic_text"> | 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:hint="请输入" | 91 | android:hint="请输入" |
92 | android:textColor="@color/electronic_text" | ||
93 | android:textSize="22sp" /> | 92 | android:textSize="22sp" /> |
94 | 93 | ||
95 | </LinearLayout> | 94 | </LinearLayout> |
96 | 95 | ||
97 | <LinearLayout | 96 | <LinearLayout |
98 | android:layout_width="0dp" | 97 | android:layout_width="0dp" |
99 | android:layout_height="80dp" | 98 | android:layout_height="80dp" |
100 | android:layout_weight="1" | 99 | android:layout_weight="1" |
101 | android:gravity="center_vertical"> | 100 | android:gravity="center_vertical"> |
102 | 101 | ||
103 | <TextView | 102 | <TextView |
104 | android:layout_width="150dp" | 103 | android:layout_width="150dp" |
105 | android:layout_height="wrap_content" | 104 | android:layout_height="wrap_content" |
106 | android:text="购买地址" | 105 | android:text="购买地址" |
107 | android:textSize="22sp" /> | 106 | android:textSize="22sp" /> |
108 | 107 | ||
109 | <TextView | 108 | <TextView |
110 | android:id="@+id/tv_edit_adress_shop" | 109 | android:id="@+id/tv_edit_adress_shop" |
111 | android:layout_width="wrap_content" | 110 | android:layout_width="wrap_content" |
112 | android:layout_height="wrap_content" | 111 | android:layout_height="wrap_content" |
113 | android:layout_marginLeft="20dp" | 112 | android:layout_marginLeft="20dp" |
114 | android:hint="请选择地区" | 113 | android:hint="请选择地区" |
115 | android:textColor="@color/btn_text_color" | ||
116 | android:textSize="22sp" /> | 114 | android:textSize="22sp" /> |
117 | 115 | ||
118 | <ImageView | 116 | <ImageView |
119 | android:layout_width="wrap_content" | 117 | android:layout_width="wrap_content" |
120 | android:layout_height="wrap_content" | 118 | android:layout_height="wrap_content" |
121 | android:layout_marginLeft="60dp" | 119 | android:layout_marginLeft="60dp" |
122 | android:src="@mipmap/xiajiantou"> | 120 | android:src="@mipmap/xiajiantou"> |
123 | 121 | ||
124 | </ImageView> | 122 | </ImageView> |
125 | </LinearLayout> | 123 | </LinearLayout> |
126 | 124 | ||
127 | </LinearLayout> | 125 | </LinearLayout> |
128 | 126 | ||
129 | <LinearLayout | 127 | <LinearLayout |
130 | android:layout_width="wrap_content" | 128 | android:layout_width="wrap_content" |
131 | android:layout_height="wrap_content" | 129 | android:layout_height="wrap_content" |
132 | android:orientation="horizontal"> | 130 | android:orientation="horizontal"> |
133 | 131 | ||
134 | <View | 132 | <View |
135 | android:layout_width="450dp" | 133 | android:layout_width="450dp" |
136 | android:layout_height="0.7dp" | 134 | android:layout_height="0.7dp" |
137 | android:layout_marginLeft="150dp" | 135 | android:layout_marginLeft="150dp" |
138 | android:background="@color/electronic_text"> | 136 | android:background="@color/cutoff_line"> |
139 | 137 | ||
140 | </View> | 138 | </View> |
141 | 139 | ||
142 | <View | 140 | <View |
143 | android:layout_width="450dp" | 141 | android:layout_width="450dp" |
144 | android:layout_height="0.7dp" | 142 | android:layout_height="0.7dp" |
145 | android:layout_marginLeft="80dp" | 143 | android:layout_marginLeft="80dp" |
146 | android:background="@color/electronic_text"> | 144 | android:background="@color/cutoff_line"> |
147 | 145 | ||
148 | </View> | 146 | </View> |
149 | 147 | ||
150 | 148 | ||
151 | </LinearLayout> | 149 | </LinearLayout> |
152 | 150 | ||
153 | <LinearLayout | 151 | <LinearLayout |
154 | android:layout_width="match_parent" | 152 | android:layout_width="match_parent" |
155 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
156 | android:layout_marginLeft="200dp" | 154 | android:layout_marginLeft="200dp" |
157 | android:gravity="center_vertical" | 155 | android:gravity="center_vertical" |
158 | android:orientation="horizontal"> | 156 | android:orientation="horizontal"> |
159 | 157 | ||
160 | <LinearLayout | 158 | <LinearLayout |
161 | android:layout_width="0dp" | 159 | android:layout_width="0dp" |
162 | android:layout_height="80dp" | 160 | android:layout_height="80dp" |
163 | android:layout_weight="1" | 161 | android:layout_weight="1" |
164 | android:gravity="center_vertical"> | 162 | android:gravity="center_vertical"> |
165 | 163 | ||
166 | <TextView | 164 | <TextView |
167 | android:layout_width="wrap_content" | 165 | android:layout_width="wrap_content" |
168 | android:layout_height="wrap_content" | 166 | android:layout_height="wrap_content" |
169 | android:text="客户地址" | 167 | android:text="客户地址" |
170 | android:textSize="22sp" /> | 168 | android:textSize="22sp" /> |
171 | 169 | ||
172 | <TextView | 170 | <TextView |
173 | android:id="@+id/tv_edit_adress_custem" | 171 | android:id="@+id/tv_edit_adress_custem" |
174 | android:layout_width="wrap_content" | 172 | android:layout_width="wrap_content" |
175 | android:layout_height="wrap_content" | 173 | android:layout_height="wrap_content" |
176 | android:layout_marginLeft="50dp" | 174 | android:layout_marginLeft="50dp" |
177 | android:hint="请选择地区" | 175 | android:hint="请选择地区" |
178 | android:textSize="22sp" /> | 176 | android:textSize="22sp" /> |
179 | 177 | ||
180 | <ImageView | 178 | <ImageView |
181 | android:layout_width="wrap_content" | 179 | android:layout_width="wrap_content" |
182 | android:layout_height="wrap_content" | 180 | android:layout_height="wrap_content" |
183 | android:layout_marginLeft="60dp" | 181 | android:layout_marginLeft="60dp" |
184 | android:src="@mipmap/xiajiantou"> | 182 | android:src="@mipmap/xiajiantou"> |
185 | 183 | ||
186 | </ImageView> | 184 | </ImageView> |
187 | 185 | ||
188 | 186 | ||
189 | </LinearLayout> | 187 | </LinearLayout> |
190 | 188 | ||
191 | <LinearLayout | 189 | <LinearLayout |
192 | android:layout_width="0dp" | 190 | android:layout_width="0dp" |
193 | android:layout_height="80dp" | 191 | android:layout_height="80dp" |
194 | android:layout_weight="1" | 192 | android:layout_weight="1" |
195 | android:gravity="center_vertical"> | 193 | android:gravity="center_vertical"> |
196 | 194 | ||
197 | <TextView | 195 | <TextView |
198 | android:layout_width="150dp" | 196 | android:layout_width="150dp" |
199 | android:layout_height="wrap_content" | 197 | android:layout_height="wrap_content" |
200 | android:text=" " | 198 | android:text=" " |
201 | android:textColor="@color/white" | 199 | android:textColor="@color/white" |
202 | android:textSize="22sp" /> | 200 | android:textSize="22sp" /> |
203 | 201 | ||
204 | <EditText | 202 | <EditText |
205 | android:id="@+id/et_edit_store" | 203 | android:id="@+id/et_edit_store" |
206 | android:layout_width="wrap_content" | 204 | android:layout_width="wrap_content" |
207 | android:layout_height="wrap_content" | 205 | android:layout_height="wrap_content" |
208 | android:layout_marginLeft="20dp" | 206 | android:layout_marginLeft="20dp" |
209 | android:background="@null" | 207 | android:background="@null" |
210 | android:hint="请输入商店名称" | 208 | android:hint="请输入商店名称" |
211 | android:textSize="22sp" /> | 209 | android:textSize="22sp" /> |
212 | 210 | ||
213 | </LinearLayout> | 211 | </LinearLayout> |
214 | 212 | ||
215 | </LinearLayout> | 213 | </LinearLayout> |
216 | 214 | ||
217 | <LinearLayout | 215 | <LinearLayout |
218 | android:layout_width="wrap_content" | 216 | android:layout_width="wrap_content" |
219 | android:layout_height="wrap_content" | 217 | android:layout_height="wrap_content" |
220 | 218 | ||
221 | android:orientation="horizontal"> | 219 | android:orientation="horizontal"> |
222 | 220 | ||
223 | <View | 221 | <View |
224 | android:layout_width="450dp" | 222 | android:layout_width="450dp" |
225 | android:layout_height="0.7dp" | 223 | android:layout_height="0.7dp" |
226 | android:layout_marginLeft="150dp" | 224 | android:layout_marginLeft="150dp" |
227 | android:background="@color/electronic_text"> | 225 | android:background="@color/cutoff_line"> |
228 | 226 | ||
229 | </View> | 227 | </View> |
230 | 228 | ||
231 | <View | 229 | <View |
232 | android:layout_width="450dp" | 230 | android:layout_width="450dp" |
233 | android:layout_height="0.7dp" | 231 | android:layout_height="0.7dp" |
234 | android:layout_marginLeft="80dp" | 232 | android:layout_marginLeft="80dp" |
235 | android:background="@color/electronic_text"> | 233 | android:background="@color/cutoff_line"> |
236 | 234 | ||
237 | </View> | 235 | </View> |
238 | 236 | ||
239 | 237 | ||
240 | </LinearLayout> | 238 | </LinearLayout> |
241 | 239 | ||
242 | <LinearLayout | 240 | <LinearLayout |
243 | android:layout_width="match_parent" | 241 | android:layout_width="match_parent" |
244 | android:layout_height="wrap_content" | 242 | android:layout_height="wrap_content" |
245 | android:layout_marginLeft="200dp" | 243 | android:layout_marginLeft="200dp" |
246 | android:gravity="center_vertical" | 244 | android:gravity="center_vertical" |
247 | android:orientation="horizontal"> | 245 | android:orientation="horizontal"> |
248 | 246 | ||
249 | <LinearLayout | 247 | <LinearLayout |
250 | android:layout_width="0dp" | 248 | android:layout_width="0dp" |
251 | android:layout_height="80dp" | 249 | android:layout_height="80dp" |
252 | android:layout_weight="1" | 250 | android:layout_weight="1" |
253 | android:gravity="center_vertical"> | 251 | android:gravity="center_vertical"> |
254 | 252 | ||
255 | <TextView | 253 | <TextView |
256 | android:layout_width="wrap_content" | 254 | android:layout_width="wrap_content" |
257 | android:layout_height="wrap_content" | 255 | android:layout_height="wrap_content" |
258 | android:text=" " | 256 | android:text=" " |
259 | android:textColor="@color/white" | 257 | android:textColor="@color/white" |
260 | android:textSize="22sp" /> | 258 | android:textSize="22sp" /> |
261 | 259 | ||
262 | <EditText | 260 | <EditText |
263 | android:id="@+id/et_edit_adress_detail" | 261 | android:id="@+id/et_edit_adress_detail" |
264 | android:layout_width="wrap_content" | 262 | android:layout_width="wrap_content" |
265 | android:layout_height="wrap_content" | 263 | android:layout_height="wrap_content" |
266 | android:layout_marginLeft="100dp" | 264 | android:layout_marginLeft="100dp" |
267 | android:background="@null" | 265 | android:background="@null" |
268 | android:hint="请输入详细地址" | 266 | android:hint="请输入详细地址" |
269 | android:textSize="22sp" /> | 267 | android:textSize="22sp" /> |
270 | 268 | ||
271 | </LinearLayout> | 269 | </LinearLayout> |
272 | 270 | ||
273 | <LinearLayout | 271 | <LinearLayout |
274 | android:layout_width="0dp" | 272 | android:layout_width="0dp" |
275 | android:layout_height="80dp" | 273 | android:layout_height="80dp" |
276 | android:layout_weight="1" | 274 | android:layout_weight="1" |
277 | android:gravity="center_vertical"> | 275 | android:gravity="center_vertical"> |
278 | 276 | ||
279 | <TextView | 277 | <TextView |
280 | android:layout_width="150dp" | 278 | android:layout_width="150dp" |
281 | android:layout_height="wrap_content" | 279 | android:layout_height="wrap_content" |
282 | android:text="本地售后电话" | 280 | android:text="本地售后电话" |
283 | android:textSize="22sp" /> | 281 | android:textSize="22sp" /> |
284 | 282 | ||
285 | <EditText | 283 | <EditText |
286 | android:id="@+id/et_edit_telphone" | 284 | android:id="@+id/et_edit_telphone" |
287 | android:layout_width="wrap_content" | 285 | android:layout_width="wrap_content" |
288 | android:layout_height="wrap_content" | 286 | android:layout_height="wrap_content" |
289 | android:layout_marginLeft="20dp" | 287 | android:layout_marginLeft="20dp" |
290 | android:background="@null" | 288 | android:background="@null" |
291 | android:hint="请输入" | 289 | android:hint="请输入" |
292 | android:textColor="@color/electronic_text" | ||
293 | android:textSize="22sp" /> | 290 | android:textSize="22sp" /> |
294 | </LinearLayout> | 291 | </LinearLayout> |
295 | 292 | ||
296 | </LinearLayout> | 293 | </LinearLayout> |
297 | 294 | ||
298 | <LinearLayout | 295 | <LinearLayout |
299 | android:layout_width="wrap_content" | 296 | android:layout_width="wrap_content" |
300 | android:layout_height="wrap_content" | 297 | android:layout_height="wrap_content" |
301 | 298 | ||
302 | android:orientation="horizontal"> | 299 | android:orientation="horizontal"> |
303 | 300 | ||
304 | <View | 301 | <View |
305 | android:layout_width="450dp" | 302 | android:layout_width="450dp" |
306 | android:layout_height="0.7dp" | 303 | android:layout_height="0.7dp" |
307 | android:layout_marginLeft="150dp" | 304 | android:layout_marginLeft="150dp" |
308 | android:background="@color/electronic_text"> | 305 | android:background="@color/cutoff_line"> |
309 | 306 | ||
310 | </View> | 307 | </View> |
311 | 308 | ||
312 | <View | 309 | <View |
313 | android:layout_width="450dp" | 310 | android:layout_width="450dp" |
314 | android:layout_height="0.7dp" | 311 | android:layout_height="0.7dp" |
315 | android:layout_marginLeft="80dp" | 312 | android:layout_marginLeft="80dp" |
316 | android:background="@color/electronic_text"> | 313 | android:background="@color/cutoff_line"> |
317 | 314 | ||
318 | </View> | 315 | </View> |
319 | 316 | ||
320 | 317 | ||
321 | </LinearLayout> | 318 | </LinearLayout> |
322 | 319 | ||
323 | <LinearLayout | 320 | <LinearLayout |
324 | android:layout_width="match_parent" | 321 | android:layout_width="match_parent" |
325 | android:layout_height="wrap_content" | 322 | android:layout_height="wrap_content" |
326 | android:layout_marginLeft="200dp" | 323 | android:layout_marginLeft="200dp" |
327 | android:gravity="center_vertical" | 324 | android:gravity="center_vertical" |
328 | android:orientation="horizontal"> | 325 | android:orientation="horizontal"> |
329 | 326 | ||
330 | <LinearLayout | 327 | <LinearLayout |
331 | android:id="@+id/lineL_buy_time" | 328 | android:id="@+id/lineL_buy_time" |
332 | android:layout_width="0dp" | 329 | android:layout_width="0dp" |
333 | android:layout_height="80dp" | 330 | android:layout_height="80dp" |
334 | android:layout_weight="1" | 331 | android:layout_weight="1" |
335 | android:gravity="center_vertical"> | 332 | android:gravity="center_vertical"> |
336 | 333 | ||
337 | <TextView | 334 | <TextView |
338 | android:layout_width="wrap_content" | 335 | android:layout_width="wrap_content" |
339 | android:layout_height="wrap_content" | 336 | android:layout_height="wrap_content" |
340 | android:text="购买时间" | 337 | android:text="购买时间" |
341 | android:textSize="22sp" /> | 338 | android:textSize="22sp" /> |
342 | 339 | ||
343 | <TextView | 340 | <TextView |
344 | android:id="@+id/tv_buy_time" | 341 | android:id="@+id/tv_buy_time" |
345 | android:layout_width="wrap_content" | 342 | android:layout_width="wrap_content" |
346 | android:layout_height="wrap_content" | 343 | android:layout_height="wrap_content" |
347 | android:layout_marginLeft="50dp" | 344 | android:layout_marginLeft="50dp" |
348 | android:hint="请选择时间" | 345 | android:hint="请选择时间" |
349 | android:textSize="22sp" /> | 346 | android:textSize="22sp" /> |
350 | 347 | ||
351 | <ImageView | 348 | <ImageView |
352 | android:layout_width="wrap_content" | 349 | android:layout_width="wrap_content" |
353 | android:layout_height="wrap_content" | 350 | android:layout_height="wrap_content" |
354 | android:layout_marginLeft="60dp" | 351 | android:layout_marginLeft="60dp" |
355 | android:src="@mipmap/xiajiantou"> | 352 | android:src="@mipmap/xiajiantou"> |
356 | 353 | ||
357 | </ImageView> | 354 | </ImageView> |
358 | 355 | ||
359 | </LinearLayout> | 356 | </LinearLayout> |
360 | 357 | ||
361 | </LinearLayout> | 358 | </LinearLayout> |
362 | 359 | ||
363 | <LinearLayout | 360 | <LinearLayout |
364 | android:layout_width="wrap_content" | 361 | android:layout_width="wrap_content" |
365 | android:layout_height="wrap_content" | 362 | android:layout_height="wrap_content" |
366 | android:orientation="horizontal"> | 363 | android:orientation="horizontal"> |
367 | 364 | ||
368 | <View | 365 | <View |
369 | android:layout_width="450dp" | 366 | android:layout_width="450dp" |
370 | android:layout_height="0.7dp" | 367 | android:layout_height="0.7dp" |
371 | android:layout_marginLeft="150dp" | 368 | android:layout_marginLeft="150dp" |
372 | android:background="@color/electronic_text"> | 369 | android:background="@color/cutoff_line"> |
373 | 370 | ||
374 | </View> | 371 | </View> |
375 | 372 | ||
376 | 373 | ||
377 | </LinearLayout> | 374 | </LinearLayout> |
378 | 375 | ||
379 | <Button | 376 | <Button |
380 | android:id="@+id/btn_change_info" | 377 | android:id="@+id/btn_change_info" |
381 | style="@style/button_login_register_style" | 378 | style="@style/button_login_register_style" |
382 | android:layout_marginLeft="200dp" | 379 | android:layout_marginLeft="200dp" |
383 | android:layout_marginRight="200dp" | 380 | android:layout_marginRight="200dp" |
384 | android:layout_marginTop="80dp" | 381 | android:layout_marginTop="80dp" |
385 | android:text="@string/string_regist_next" /> | 382 | android:text="@string/string_regist_next" /> |
386 | 383 | ||
387 | 384 | ||
388 | </LinearLayout> | 385 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/recycler_childaccunt_item_view.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
5 | android:layout_width="415dp" | 5 | android:layout_width="415dp" |
6 | android:layout_height="match_parent"> | 6 | android:layout_height="match_parent"> |
7 | <LinearLayout | 7 | <LinearLayout |
8 | android:id="@+id/ll_backgrangd" | ||
8 | android:layout_width="wrap_content" | 9 | android:layout_width="wrap_content" |
9 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
10 | android:background="@drawable/corcle_black_bg" | 11 | android:background="@drawable/corcle_black_bg" |
11 | android:orientation="vertical"> | 12 | android:orientation="vertical"> |
12 | 13 | ||
13 | <LinearLayout | 14 | <LinearLayout |
14 | android:layout_width="wrap_content" | 15 | android:layout_width="match_parent" |
15 | android:layout_height="wrap_content" | 16 | android:layout_height="wrap_content" |
16 | android:orientation="horizontal"> | 17 | android:orientation="horizontal"> |
17 | <com.facebook.drawee.view.SimpleDraweeView | 18 | <com.facebook.drawee.view.SimpleDraweeView |
18 | android:id="@+id/iv_child_head" | 19 | android:id="@+id/iv_child_head" |
19 | android:layout_width="60dp" | 20 | android:layout_width="60dp" |
20 | android:layout_height="60dp" | 21 | android:layout_height="60dp" |
21 | android:layout_margin="10dp" | 22 | android:layout_margin="10dp" |
22 | fresco:placeholderImage="@mipmap/header_default" | 23 | fresco:placeholderImage="@mipmap/header_default" |
23 | fresco:roundAsCircle="true" | 24 | fresco:roundAsCircle="true" |
24 | fresco:placeholderImageScaleType="fitCenter" /> | 25 | fresco:placeholderImageScaleType="fitCenter" /> |
25 | 26 | ||
26 | 27 | ||
27 | <LinearLayout | 28 | <LinearLayout |
28 | android:layout_width="0dp" | 29 | android:layout_width="0dp" |
29 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
30 | android:layout_marginLeft="10dp" | 31 | android:layout_marginLeft="10dp" |
31 | android:layout_marginTop="10dp" | 32 | android:layout_marginTop="10dp" |
32 | android:layout_weight="1" | 33 | android:layout_weight="1" |
33 | android:orientation="vertical"> | 34 | android:orientation="vertical"> |
34 | 35 | ||
35 | <TextView | 36 | <TextView |
36 | android:id="@+id/iv_child_name" | 37 | android:id="@+id/iv_child_name" |
37 | android:layout_width="wrap_content" | 38 | android:layout_width="wrap_content" |
38 | android:layout_height="wrap_content" | 39 | android:layout_height="wrap_content" |
39 | android:text="" | 40 | android:text="" |
40 | android:textSize="18sp" /> | 41 | android:textSize="18sp" /> |
41 | 42 | ||
42 | <TextView | 43 | <TextView |
43 | android:id="@+id/iv_child_grade" | 44 | android:id="@+id/iv_child_grade" |
44 | android:layout_width="wrap_content" | 45 | android:layout_width="wrap_content" |
45 | android:layout_height="wrap_content" | 46 | android:layout_height="wrap_content" |
46 | android:text="" | 47 | android:text="" |
47 | android:textSize="18sp" /> | 48 | android:textSize="18sp" /> |
48 | 49 | ||
49 | <TextView | 50 | <TextView |
50 | android:id="@+id/iv_child_school" | 51 | android:id="@+id/iv_child_school" |
51 | android:layout_width="wrap_content" | 52 | android:layout_width="wrap_content" |
52 | android:layout_height="wrap_content" | 53 | android:layout_height="wrap_content" |
53 | android:text="" | 54 | android:text="" |
54 | android:textSize="18sp" /> | 55 | android:textSize="18sp" /> |
55 | 56 | ||
56 | <TextView | 57 | <TextView |
57 | android:id="@+id/iv_child_adress" | 58 | android:id="@+id/iv_child_adress" |
58 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
59 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
60 | android:text="" | 61 | android:text="" |
61 | android:textSize="18sp" /> | 62 | android:textSize="18sp" /> |
62 | 63 | ||
63 | |||
64 | |||
65 | </LinearLayout> | 64 | </LinearLayout> |
65 | <ImageView | ||
66 | android:id="@+id/iv_using_pic" | ||
67 | android:layout_width="wrap_content" | ||
68 | android:layout_height="wrap_content" | ||
69 | android:layout_gravity="right" | ||
70 | android:layout_marginLeft="60dp" | ||
71 | android:visibility="gone" | ||
72 | android:src="@mipmap/shiyongzhong" /> | ||
73 | |||
66 | 74 | ||
67 | 75 | ||
68 | </LinearLayout> | 76 | </LinearLayout> |
69 | 77 | ||
70 | <View | 78 | <View |
71 | android:layout_width="wrap_content" | 79 | android:layout_width="wrap_content" |
72 | android:layout_height="0.7dp" | 80 | android:layout_height="0.7dp" |
73 | android:layout_margin="10dp" | 81 | android:layout_margin="10dp" |
74 | android:background="@color/cutoff_line"> | 82 | android:background="@color/cutoff_line"> |
75 | 83 | ||
76 | </View> | 84 | </View> |
77 | 85 | ||
78 | <LinearLayout | 86 | <LinearLayout |
79 | android:layout_width="match_parent" | 87 | android:layout_width="match_parent" |
80 | android:layout_height="wrap_content" | 88 | android:layout_height="wrap_content" |
81 | android:layout_marginBottom="10dp" | 89 | android:layout_marginBottom="10dp" |
82 | android:orientation="horizontal"> | 90 | android:orientation="horizontal"> |
83 | 91 | ||
84 | <TextView | 92 | <TextView |
85 | android:id="@+id/delete_child_account" | 93 | android:id="@+id/delete_child_account" |
86 | android:layout_width="0dp" | 94 | android:layout_width="0dp" |
87 | android:layout_height="wrap_content" | 95 | android:layout_height="wrap_content" |
88 | android:layout_weight="1" | 96 | android:layout_weight="1" |
89 | android:gravity="center" | 97 | android:gravity="center" |
90 | android:text="删除用户" | 98 | android:text="删除用户" |
91 | android:textSize="18sp" /> | 99 | android:textSize="18sp" /> |
92 | 100 | ||
93 | <TextView | 101 | <TextView |
94 | android:id="@+id/chang_account" | 102 | android:id="@+id/chang_account" |
95 | android:layout_width="0dp" | 103 | android:layout_width="0dp" |
96 | android:layout_height="wrap_content" | 104 | android:layout_height="wrap_content" |
97 | android:layout_weight="1" | 105 | android:layout_weight="1" |
98 | android:gravity="center" | 106 | android:gravity="center" |
99 | android:text="切换使用" | 107 | android:text="切换使用" |
100 | android:textSize="18sp" /> | 108 | android:textSize="18sp" /> |
101 | 109 | ||
102 | 110 | ||
103 | </LinearLayout> | 111 | </LinearLayout> |
104 | 112 | ||
105 | </LinearLayout> | 113 | </LinearLayout> |