Commit 2338cf4c2201089583845c1e28585c98250c84f1

Authored by xiongwei
1 parent 3cc452267b
Exists in master

子账户管理界面处理和接口编写

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.app.Activity; 3 import android.app.Activity;
4 import android.content.Intent; 4 import android.content.Intent;
5 import android.os.Bundle; 5 import android.os.Bundle;
6 import android.os.Handler;
7 import android.os.Message;
8 import android.support.v7.widget.LinearLayoutManager;
9 import android.support.v7.widget.RecyclerView;
6 import android.view.View; 10 import android.view.View;
7 import android.widget.TextView; 11 import android.widget.TextView;
8 12
9 import com.hjx.personalcenter.R; 13 import com.hjx.personalcenter.R;
14 import com.hjx.personalcenter.adapter.AccountChildsAdapter;
10 import com.hjx.personalcenter.db.Content; 15 import com.hjx.personalcenter.db.Content;
11 import com.hjx.personalcenter.db.SaveParam; 16 import com.hjx.personalcenter.db.SaveParam;
17 import com.hjx.personalcenter.http.HttpCode;
18 import com.hjx.personalcenter.http.HttpManager;
19 import com.hjx.personalcenter.model.ChildsInfo;
20
21 import java.util.ArrayList;
22 import java.util.List;
12 23
13 /**账户管理 熊巍 24 /**账户管理 熊巍
14 * Created by h on 2017/8/12. 25 * Created by h on 2017/8/12.
15 */ 26 */
16 27
17 public class AccountManagementActivity extends Activity implements View.OnClickListener { 28 public class AccountManagementActivity extends Activity implements View.OnClickListener {
18 private TextView changbangding,changpassword,usernames; 29 private TextView changbangding,changpassword,usernames;
30 private RecyclerView listview;
31 private AccountChildsAdapter childsAdapter;
32 private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>();
33 Handler handler = new Handler(){
34 @Override
35 public void handleMessage(Message msg) {
36 super.handleMessage(msg);
37 switch (msg.what){
38 case HttpCode.CHILDS_SUCESS:
39 data.clear();
40 data.addAll( (List<ChildsInfo.DataBean>)msg.obj);
41 childsAdapter.notifyDataSetChanged();
42 break;
43 }
44 }
45 };
19 @Override 46 @Override
20 protected void onCreate(Bundle savedInstanceState) { 47 protected void onCreate(Bundle savedInstanceState) {
21 super.onCreate(savedInstanceState); 48 super.onCreate(savedInstanceState);
22 setContentView(R.layout.activity_account_management); 49 setContentView(R.layout.activity_account_management);
50 HttpManager.getInstance().getchildAccountinfo(this,600,handler);
23 initView(); 51 initView();
24 initData(); 52 initData();
25 initLister(); 53 initLister();
26 } 54 }
27 55
28 private void initView() { 56 private void initView() {
29 changbangding = (TextView) findViewById(R.id.changBangding); 57 changbangding = (TextView) findViewById(R.id.changBangding);
30 changpassword = (TextView) findViewById(R.id.changpassword); 58 changpassword = (TextView) findViewById(R.id.changpassword);
31 usernames = (TextView) findViewById(R.id.cunt_username); 59 usernames = (TextView) findViewById(R.id.cunt_username);
60 listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal);
32 } 61 }
33 62
34 private void initData() { 63 private void initData() {
35 String cunt_username = SaveParam.getInstance().getLoginParam(this,"cunt_username"); 64 String cunt_username = SaveParam.getInstance().getLoginParam(this,"cunt_username");
36 usernames.setText(cunt_username); 65 usernames.setText(cunt_username);
66 LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
67 linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
68 listview.setLayoutManager(linearLayoutManager);
69 childsAdapter = new AccountChildsAdapter(data,this);
70 listview.setAdapter(childsAdapter);
37 71
38 } 72 }
39 73
40 private void initLister() { 74 private void initLister() {
41 changbangding.setOnClickListener(this); 75 changbangding.setOnClickListener(this);
42 changpassword.setOnClickListener(this); 76 changpassword.setOnClickListener(this);
43 77
44 78
45 } 79 }
46 80
47 @Override 81 @Override
48 public void onClick(View v) { 82 public void onClick(View v) {
49 switch (v.getId()){ 83 switch (v.getId()){
50 case R.id.changBangding: 84 case R.id.changBangding:
51 Intent changebangding = new Intent(); 85 Intent changebangding = new Intent();
52 changebangding.setClass(AccountManagementActivity.this,ChangeBangDingActivity.class); 86 changebangding.setClass(AccountManagementActivity.this,ChangeBangDingActivity.class);
53 startActivity(changebangding); 87 startActivity(changebangding);
54 overridePendingTransition(R.anim.rightin, R.anim.rightout); 88 overridePendingTransition(R.anim.rightin, R.anim.rightout);
55 break; 89 break;
56 case R.id.changpassword: 90 case R.id.changpassword:
57 Content.authcodeflag = 1; 91 Content.authcodeflag = 1;
58 Intent changpwd = new Intent(); 92 Intent changpwd = new Intent();
59 changpwd.setClass(AccountManagementActivity.this,ChangePasswordActivity.class); 93 changpwd.setClass(AccountManagementActivity.this,ChangePasswordActivity.class);
60 startActivity(changpwd); 94 startActivity(changpwd);
61 overridePendingTransition(R.anim.rightin, R.anim.rightout); 95 overridePendingTransition(R.anim.rightin, R.anim.rightout);
62 break; 96 break;
63 } 97 }
64 98
65 } 99 }
66 } 100 }
67 101
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/AccountChildsAdapter.java
File was created 1 package com.hjx.personalcenter.adapter;
2
3 import android.content.Context;
4 import android.support.v7.widget.RecyclerView;
5 import android.view.LayoutInflater;
6 import android.view.View;
7 import android.view.ViewGroup;
8 import android.widget.ImageView;
9 import android.widget.TextView;
10
11 import com.hjx.personalcenter.R;
12 import com.hjx.personalcenter.model.ChildsInfo;
13
14 import java.util.ArrayList;
15 import java.util.List;
16
17 /**
18 * Created by h on 2017/8/26.
19 */
20
21 public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> {
22 private List<ChildsInfo.DataBean> specailList;
23 private LayoutInflater mInflater;
24 private Context mContext ;
25
26 public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) {
27 this.mContext = context;
28 this.specailList = specailList;
29 mInflater = LayoutInflater.from(context);
30 }
31
32 public OnItemClickListener mOnItemClickListener;
33
34 public interface OnItemClickListener {
35 void onItemClick(View view, int position);
36 }
37
38 public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) {
39 this.mOnItemClickListener = mOnItemClickLitener;
40 }
41
42 public void setList(List<ChildsInfo.DataBean> list) {
43 this.specailList = list;
44 notifyDataSetChanged();
45 }
46
47 @Override
48 public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) {
49 View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false);
50
51 AccountChildsHolder holder = new AccountChildsHolder(view);
52 return holder;
53 }
54
55 @Override
56 public void onBindViewHolder(AccountChildsHolder holder, int position) {
57 ChildsInfo.DataBean bean = specailList.get(position);
58 if (bean != null) {
59 holder.iv_child_head.setImageResource(R.mipmap.header_default);
60 holder.iv_child_name.setText(bean.getName());
61 holder.iv_child_grade.setText(bean.getGrade());
62 holder.iv_child_school.setText(bean.getSchool());
63 holder.iv_child_adress.setText(bean.getRegion());
64
65 }
66
67
68 }
69
70 @Override
71 public int getItemCount() {
72 return specailList.size();
73 }
74
75 class AccountChildsHolder extends RecyclerView.ViewHolder {
76 ImageView iv_child_head;
77 TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress;
78 public AccountChildsHolder(View itemView) {
79 super(itemView);
80 iv_child_head = (ImageView) itemView.findViewById(R.id.iv_child_head);
81 iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name);
82 iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade);
83 iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school);
84 iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress);
85
86 }
87 }
88 }
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/RecyclerViewAdapter.java
1 package com.hjx.personalcenter.adapter; 1 package com.hjx.personalcenter.adapter;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.support.v7.widget.RecyclerView; 4 import android.support.v7.widget.RecyclerView;
5 import android.view.LayoutInflater; 5 import android.view.LayoutInflater;
6 import android.view.View; 6 import android.view.View;
7 import android.view.ViewGroup; 7 import android.view.ViewGroup;
8 import android.widget.Button; 8 import android.widget.Button;
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 12
13 import java.util.List; 13 import java.util.List;
14 14
15 /** 15 /**
16 * Author: zhangmiao 16 * Author: zhangmiao
17 * Date: 2017/6/14 17 * Date: 2017/6/14
18 */ 18 */
19 public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.RecyclerHolder> { 19 public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.RecyclerHolder> {
20 20
21 private static final String TAG = RecyclerViewAdapter.class.getSimpleName(); 21 private static final String TAG = RecyclerViewAdapter.class.getSimpleName();
22 22
23 private List<String> dataList; 23 private List<String> dataList;
24 private Context mContext; 24 private Context mContext;
25 private RecyclerView recyclerView; 25 private RecyclerView recyclerView;
26 26
27 public static int position = 0; 27 public static int position = 0;
28 28
29 public RecyclerViewAdapter(Context context, List<String> dataList) { 29 public RecyclerViewAdapter(Context context, List<String> dataList) {
30 mContext = context; 30 mContext = context;
31 this.dataList = dataList; 31 this.dataList = dataList;
32 } 32 }
33 33
34 @Override 34 @Override
35 public RecyclerHolder onCreateViewHolder(ViewGroup parent, int viewType) { 35 public RecyclerHolder onCreateViewHolder(ViewGroup parent, int viewType) {
36 View view = LayoutInflater.from(mContext).inflate(R.layout.recycler_item_view, parent, false); 36 View view = LayoutInflater.from(mContext).inflate(R.layout.recycler_study_tem_view, parent, false);
37 RecyclerHolder holder = new RecyclerHolder(view); 37 RecyclerHolder holder = new RecyclerHolder(view);
38 return holder; 38 return holder;
39 } 39 }
40 40
41 @Override 41 @Override
42 public void onBindViewHolder(RecyclerHolder holder, final int position) { 42 public void onBindViewHolder(RecyclerHolder holder, final int position) {
43 holder.textView.setText(dataList.get(position)); 43 holder.textView.setText(dataList.get(position));
44 if (position == dataList.size() - 1) { 44 if (position == dataList.size() - 1) {
45 holder.button.setVisibility(View.GONE); 45 holder.button.setVisibility(View.GONE);
46 } 46 }
47 holder.button.setOnClickListener(new View.OnClickListener() { 47 holder.button.setOnClickListener(new View.OnClickListener() {
48 @Override 48 @Override
49 public void onClick(View v) { 49 public void onClick(View v) {
50 recyclerView.smoothScrollToPosition(position + 1); 50 recyclerView.smoothScrollToPosition(position + 1);
51 RecyclerViewAdapter.position++; 51 RecyclerViewAdapter.position++;
52 } 52 }
53 }); 53 });
54 } 54 }
55 55
56 @Override 56 @Override
57 public void onAttachedToRecyclerView(RecyclerView recyclerView) { 57 public void onAttachedToRecyclerView(RecyclerView recyclerView) {
58 super.onAttachedToRecyclerView(recyclerView); 58 super.onAttachedToRecyclerView(recyclerView);
59 this.recyclerView = recyclerView; 59 this.recyclerView = recyclerView;
60 } 60 }
61 61
62 @Override 62 @Override
63 public int getItemCount() { 63 public int getItemCount() {
64 return dataList.size(); 64 return dataList.size();
65 } 65 }
66 66
67 public class RecyclerHolder extends RecyclerView.ViewHolder { 67 public class RecyclerHolder extends RecyclerView.ViewHolder {
68 TextView textView; 68 TextView textView;
69 Button button; 69 Button button;
70 70
71 public RecyclerHolder(View itemView) { 71 public RecyclerHolder(View itemView) {
72 super(itemView); 72 super(itemView);
73 textView = (TextView) itemView.findViewById(R.id.item_text); 73 textView = (TextView) itemView.findViewById(R.id.item_text);
74 button = (Button) itemView.findViewById(R.id.item_button); 74 button = (Button) itemView.findViewById(R.id.item_button);
75 } 75 }
76 } 76 }
77 77
78 } 78 }
79 79
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
1 package com.hjx.personalcenter.http; 1 package com.hjx.personalcenter.http;
2 2
3 /** 3 /**
4 * Created by wei on 2017/6/21. 4 * Created by wei on 2017/6/21.
5 */ 5 */
6 6
7 public class HttpCode { 7 public class HttpCode {
8 //查询保卡信息 8 //查询保卡信息
9 public static final int SUCHCARDINFO = 0; 9 public static final int SUCHCARDINFO = 0;
10 //是否填写保卡信息 10 //是否填写保卡信息
11 public static final int CHECKCARD = 1; 11 public static final int CHECKCARD = 1;
12 //注册 12 //注册
13 public static final int REGISTERED_SUCESS = 2; 13 public static final int REGISTERED_SUCESS = 2;
14 public static final int REGISTERED_FAIL = 3; 14 public static final int REGISTERED_FAIL = 3;
15 //注册验证码 15 //注册验证码
16 public static final int AUTHCODE_SUCESS = 4; 16 public static final int AUTHCODE_SUCESS = 4;
17 public static final int AUTHCODE_FAIL = 5; 17 public static final int AUTHCODE_FAIL = 5;
18 //忘记密码验证码 18 //忘记密码验证码
19 public static final int AUTHCODE_SUCESS1 = 6; 19 public static final int AUTHCODE_SUCESS1 = 6;
20 public static final int AUTHCODE_FAIL1 = 7; 20 public static final int AUTHCODE_FAIL1 = 7;
21 //是否已经注册 21 //是否已经注册
22 public static final int IS_REFISTER = 8; 22 public static final int IS_REFISTER = 8;
23 //忘记密码 23 //忘记密码
24 public static final int PASSWORD_SUCESS = 9; 24 public static final int PASSWORD_SUCESS = 9;
25 public static final int PASSWORD_FAIL = 10; 25 public static final int PASSWORD_FAIL = 10;
26 //s省 26 //s省
27 public static final int PROVICES = 11; 27 public static final int PROVICES = 11;
28 //市 28 //市
29 public static final int CITYS = 12; 29 public static final int CITYS = 12;
30 //区 30 //区
31 public static final int COUNTRY = 13; 31 public static final int COUNTRY = 13;
32 //学校 32 //学校
33 public static final int SCHOOL = 14; 33 public static final int SCHOOL = 14;
34 //年级 34 //年级
35 public static final int GRADER = 15; 35 public static final int GRADER = 15;
36 //获取个人信息 36 //获取个人信息
37 public static final int GETINFO = 16; 37 public static final int GETINFO = 16;
38 //获取个性签名 38 //获取个性签名
39 public static final int SIGN = 17; 39 public static final int SIGN = 17;
40 //登录 40 //登录
41 public static final int LOGIN_SUCESS = 18; 41 public static final int LOGIN_SUCESS = 18;
42 //获取子账户信息
43 public static final int CHILDS_SUCESS = 19;
42 44
43 45
44 46
45 } 47 }
46 48
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.ComponentName; 5 import android.content.ComponentName;
6 import android.content.Context; 6 import android.content.Context;
7 import android.content.Intent; 7 import android.content.Intent;
8 import android.os.Handler; 8 import android.os.Handler;
9 import android.os.Message; 9 import android.os.Message;
10 import android.provider.Settings; 10 import android.provider.Settings;
11 import android.support.v4.app.FragmentActivity; 11 import android.support.v4.app.FragmentActivity;
12 import android.util.Log; 12 import android.util.Log;
13 import android.view.Gravity; 13 import android.view.Gravity;
14 import android.view.View; 14 import android.view.View;
15 import android.widget.Toast; 15 import android.widget.Toast;
16 16
17 import com.google.gson.Gson; 17 import com.google.gson.Gson;
18 import com.hjx.personalcenter.R; 18 import com.hjx.personalcenter.R;
19 import com.hjx.personalcenter.activity.LoginAndRegisterActivity; 19 import com.hjx.personalcenter.activity.LoginAndRegisterActivity;
20 import com.hjx.personalcenter.activity.TheStartPageActivity; 20 import com.hjx.personalcenter.activity.TheStartPageActivity;
21 import com.hjx.personalcenter.db.SaveParam; 21 import com.hjx.personalcenter.db.SaveParam;
22 import com.hjx.personalcenter.gson.GsonTool; 22 import com.hjx.personalcenter.gson.GsonTool;
23 import com.hjx.personalcenter.model.CardInfo; 23 import com.hjx.personalcenter.model.CardInfo;
24 import com.hjx.personalcenter.model.ChildsInfo;
24 import com.hjx.personalcenter.model.CityInfo; 25 import com.hjx.personalcenter.model.CityInfo;
25 import com.hjx.personalcenter.model.CountyInfo; 26 import com.hjx.personalcenter.model.CountyInfo;
26 import com.hjx.personalcenter.model.GradeInfo; 27 import com.hjx.personalcenter.model.GradeInfo;
27 import com.hjx.personalcenter.model.PesonalInfo; 28 import com.hjx.personalcenter.model.PesonalInfo;
28 import com.hjx.personalcenter.model.ProvinceInfo; 29 import com.hjx.personalcenter.model.ProvinceInfo;
29 import com.hjx.personalcenter.model.SchoolInfo; 30 import com.hjx.personalcenter.model.SchoolInfo;
30 import com.hjx.personalcenter.model.SignInfo; 31 import com.hjx.personalcenter.model.SignInfo;
31 import com.hjx.personalcenter.util.DialogPermission; 32 import com.hjx.personalcenter.util.DialogPermission;
32 import com.loopj.android.http.AsyncHttpResponseHandler; 33 import com.loopj.android.http.AsyncHttpResponseHandler;
33 import com.loopj.android.http.JsonHttpResponseHandler; 34 import com.loopj.android.http.JsonHttpResponseHandler;
34 import com.loopj.android.http.RequestParams; 35 import com.loopj.android.http.RequestParams;
35 import com.mylhyl.circledialog.CircleDialog; 36 import com.mylhyl.circledialog.CircleDialog;
36 import com.mylhyl.circledialog.callback.ConfigText; 37 import com.mylhyl.circledialog.callback.ConfigText;
37 import com.mylhyl.circledialog.params.TextParams; 38 import com.mylhyl.circledialog.params.TextParams;
38 39
39 import org.apache.http.Header; 40 import org.apache.http.Header;
40 import org.apache.http.entity.ByteArrayEntity; 41 import org.apache.http.entity.ByteArrayEntity;
41 import org.apache.http.message.BasicHeader; 42 import org.apache.http.message.BasicHeader;
42 import org.apache.http.protocol.HTTP; 43 import org.apache.http.protocol.HTTP;
43 import org.json.JSONException; 44 import org.json.JSONException;
44 import org.json.JSONObject; 45 import org.json.JSONObject;
45 46
46 import java.io.UnsupportedEncodingException; 47 import java.io.UnsupportedEncodingException;
47 import java.util.ArrayList; 48 import java.util.ArrayList;
48 import java.util.List; 49 import java.util.List;
49 50
50 public class HttpManager { 51 public class HttpManager {
51 private static HttpManager instance; 52 private static HttpManager instance;
52 private ProgressDialog mProgress = null; 53 private ProgressDialog mProgress = null;
53 54
54 public static HttpManager getInstance() { 55 public static HttpManager getInstance() {
55 if (instance == null) { 56 if (instance == null) {
56 instance = new HttpManager(); 57 instance = new HttpManager();
57 } 58 }
58 return instance; 59 return instance;
59 } 60 }
60 61
61 62
62 //登录接口 63 //登录接口
63 64
64 public void login(final String username, final String password, final Context mContext, final Handler handler) { 65 public void login(final String username, final String password, final Context mContext, final Handler handler) {
65 mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", 66 mProgress = DialogPermission.showProgress(mContext, null, "正在登录...",
66 false, true, null); 67 false, true, null);
67 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 68 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
68 HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { 69 HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() {
69 @Override 70 @Override
70 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 71 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
71 closeProgress(); 72 closeProgress();
72 Message msg = Message.obtain(); 73 Message msg = Message.obtain();
73 msg.what = HttpCode.LOGIN_SUCESS; 74 msg.what = HttpCode.LOGIN_SUCESS;
74 msg.obj = new String(arg2); 75 msg.obj = new String(arg2);
75 handler.sendMessage(msg); 76 handler.sendMessage(msg);
76 77
77 78
78 } 79 }
79 80
80 @Override 81 @Override
81 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 82 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
82 closeProgress(); 83 closeProgress();
83 new CircleDialog.Builder((FragmentActivity) mContext) 84 new CircleDialog.Builder((FragmentActivity) mContext)
84 .setCanceledOnTouchOutside(false) 85 .setCanceledOnTouchOutside(false)
85 .setCancelable(false) 86 .setCancelable(false)
86 .setWidth(0.5f) 87 .setWidth(0.5f)
87 .configText(new ConfigText() { 88 .configText(new ConfigText() {
88 @Override 89 @Override
89 public void onConfig(TextParams params) { 90 public void onConfig(TextParams params) {
90 params.gravity = Gravity.CENTER; 91 params.gravity = Gravity.CENTER;
91 params.padding = new int[]{50, 50, 50, 50}; 92 params.padding = new int[]{50, 50, 50, 50};
92 } 93 }
93 }) 94 })
94 .setText("当前无网络,请检查网络设置") 95 .setText("当前无网络,请检查网络设置")
95 .setNegative("继续使用", null) 96 .setNegative("继续使用", null)
96 .setPositive("设置网络", new View.OnClickListener() { 97 .setPositive("设置网络", new View.OnClickListener() {
97 @Override 98 @Override
98 public void onClick(View v) { 99 public void onClick(View v) {
99 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 100 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
100 mContext.startActivity(intent); 101 mContext.startActivity(intent);
101 } 102 }
102 }) 103 })
103 .show(); 104 .show();
104 } 105 }
105 }); 106 });
106 } 107 }
107 108
108 //注册接口 109 //注册接口
109 public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { 110 public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) {
110 mProgress = DialogPermission.showProgress(context, null, "正在注册...", 111 mProgress = DialogPermission.showProgress(context, null, "正在注册...",
111 false, true, null); 112 false, true, null);
112 JSONObject jsonObject = new JSONObject(); 113 JSONObject jsonObject = new JSONObject();
113 ByteArrayEntity entity = null; 114 ByteArrayEntity entity = null;
114 try { 115 try {
115 jsonObject.put(HttpKey.USERNAME, username); 116 jsonObject.put(HttpKey.USERNAME, username);
116 jsonObject.put(HttpKey.PASSWORD, password); 117 jsonObject.put(HttpKey.PASSWORD, password);
117 jsonObject.put(HttpKey.SMSCODE, smscode); 118 jsonObject.put(HttpKey.SMSCODE, smscode);
118 jsonObject.put(HttpKey.SOURCE, source); 119 jsonObject.put(HttpKey.SOURCE, source);
119 Log.e("test", "jsonObject" + jsonObject); 120 Log.e("test", "jsonObject" + jsonObject);
120 entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); 121 entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8"));
121 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); 122 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
122 } catch (JSONException e) { 123 } catch (JSONException e) {
123 e.printStackTrace(); 124 e.printStackTrace();
124 } catch (UnsupportedEncodingException e) { 125 } catch (UnsupportedEncodingException e) {
125 e.printStackTrace(); 126 e.printStackTrace();
126 } 127 }
127 HttpClient.getInstance().addHeader("Accept", "*/*"); 128 HttpClient.getInstance().addHeader("Accept", "*/*");
128 HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { 129 HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() {
129 @Override 130 @Override
130 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 131 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
131 super.onSuccess(statusCode, headers, response); 132 super.onSuccess(statusCode, headers, response);
132 closeProgress(); 133 closeProgress();
133 Log.e("test", "onSuccess" + response); 134 Log.e("test", "onSuccess" + response);
134 Message msg = Message.obtain(); 135 Message msg = Message.obtain();
135 msg.what = HttpCode.REGISTERED_SUCESS; 136 msg.what = HttpCode.REGISTERED_SUCESS;
136 msg.obj = response; 137 msg.obj = response;
137 handler.sendMessage(msg); 138 handler.sendMessage(msg);
138 139
139 } 140 }
140 141
141 @Override 142 @Override
142 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 143 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
143 super.onFailure(statusCode, headers, throwable, errorResponse); 144 super.onFailure(statusCode, headers, throwable, errorResponse);
144 closeProgress(); 145 closeProgress();
145 Log.e("test", "onFailure" + errorResponse); 146 Log.e("test", "onFailure" + errorResponse);
146 new CircleDialog.Builder((FragmentActivity) context) 147 new CircleDialog.Builder((FragmentActivity) context)
147 .setCanceledOnTouchOutside(false) 148 .setCanceledOnTouchOutside(false)
148 .setCancelable(false) 149 .setCancelable(false)
149 .setWidth(0.5f) 150 .setWidth(0.5f)
150 .configText(new ConfigText() { 151 .configText(new ConfigText() {
151 @Override 152 @Override
152 public void onConfig(TextParams params) { 153 public void onConfig(TextParams params) {
153 params.gravity = Gravity.CENTER; 154 params.gravity = Gravity.CENTER;
154 params.padding = new int[]{50, 50, 50, 50}; 155 params.padding = new int[]{50, 50, 50, 50};
155 } 156 }
156 }) 157 })
157 .setText("当前无网络,请检查网络设置") 158 .setText("当前无网络,请检查网络设置")
158 .setNegative("继续使用", null) 159 .setNegative("继续使用", null)
159 .setPositive("设置网络", new View.OnClickListener() { 160 .setPositive("设置网络", new View.OnClickListener() {
160 @Override 161 @Override
161 public void onClick(View v) { 162 public void onClick(View v) {
162 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 163 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
163 context.startActivity(intent); 164 context.startActivity(intent);
164 } 165 }
165 }) 166 })
166 .show(); 167 .show();
167 } 168 }
168 169
169 }); 170 });
170 } 171 }
171 172
172 //注册验证码 173 //注册验证码
173 public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { 174 public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) {
174 RequestParams params = new RequestParams(); 175 RequestParams params = new RequestParams();
175 params.put(HttpKey.TYPE, type); 176 params.put(HttpKey.TYPE, type);
176 params.put(HttpKey.MOBIL, mobile); 177 params.put(HttpKey.MOBIL, mobile);
177 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 178 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
178 HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { 179 HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() {
179 180
180 @Override 181 @Override
181 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 182 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
182 Log.e("test", "onSuccess-----" + response); 183 Log.e("test", "onSuccess-----" + response);
183 Message msg = Message.obtain(); 184 Message msg = Message.obtain();
184 msg.what = HttpCode.AUTHCODE_SUCESS; 185 msg.what = HttpCode.AUTHCODE_SUCESS;
185 msg.obj = response; 186 msg.obj = response;
186 handler.sendMessage(msg); 187 handler.sendMessage(msg);
187 } 188 }
188 189
189 @Override 190 @Override
190 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 191 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
191 new CircleDialog.Builder((FragmentActivity) mContext) 192 new CircleDialog.Builder((FragmentActivity) mContext)
192 .setCanceledOnTouchOutside(false) 193 .setCanceledOnTouchOutside(false)
193 .setCancelable(false) 194 .setCancelable(false)
194 .setWidth(0.5f) 195 .setWidth(0.5f)
195 .configText(new ConfigText() { 196 .configText(new ConfigText() {
196 @Override 197 @Override
197 public void onConfig(TextParams params) { 198 public void onConfig(TextParams params) {
198 params.gravity = Gravity.CENTER; 199 params.gravity = Gravity.CENTER;
199 params.padding = new int[]{50, 50, 50, 50}; 200 params.padding = new int[]{50, 50, 50, 50};
200 } 201 }
201 }) 202 })
202 .setText("当前无网络,请检查网络设置") 203 .setText("当前无网络,请检查网络设置")
203 .setNegative("继续使用", null) 204 .setNegative("继续使用", null)
204 .setPositive("设置网络", new View.OnClickListener() { 205 .setPositive("设置网络", new View.OnClickListener() {
205 @Override 206 @Override
206 public void onClick(View v) { 207 public void onClick(View v) {
207 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 208 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
208 mContext.startActivity(intent); 209 mContext.startActivity(intent);
209 } 210 }
210 }) 211 })
211 .show(); 212 .show();
212 } 213 }
213 }); 214 });
214 } 215 }
215 216
216 217
217 //手机号是否注册 218 //手机号是否注册
218 public void isregistered(final String mobile, final Handler handler, final Context mContext) { 219 public void isregistered(final String mobile, final Handler handler, final Context mContext) {
219 RequestParams params = new RequestParams(); 220 RequestParams params = new RequestParams();
220 params.put(HttpKey.USERNAME, mobile); 221 params.put(HttpKey.USERNAME, mobile);
221 HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { 222 HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() {
222 @Override 223 @Override
223 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 224 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
224 Log.e("test", "isregistered" + response.toString()); 225 Log.e("test", "isregistered" + response.toString());
225 Message msg = Message.obtain(); 226 Message msg = Message.obtain();
226 msg.what = HttpCode.IS_REFISTER; 227 msg.what = HttpCode.IS_REFISTER;
227 msg.obj = response; 228 msg.obj = response;
228 handler.sendMessage(msg); 229 handler.sendMessage(msg);
229 230
230 } 231 }
231 232
232 @Override 233 @Override
233 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 234 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
234 new CircleDialog.Builder((FragmentActivity) mContext) 235 new CircleDialog.Builder((FragmentActivity) mContext)
235 .setCanceledOnTouchOutside(false) 236 .setCanceledOnTouchOutside(false)
236 .setCancelable(false) 237 .setCancelable(false)
237 .setWidth(0.5f) 238 .setWidth(0.5f)
238 .configText(new ConfigText() { 239 .configText(new ConfigText() {
239 @Override 240 @Override
240 public void onConfig(TextParams params) { 241 public void onConfig(TextParams params) {
241 params.gravity = Gravity.CENTER; 242 params.gravity = Gravity.CENTER;
242 params.padding = new int[]{50, 50, 50, 50}; 243 params.padding = new int[]{50, 50, 50, 50};
243 } 244 }
244 }) 245 })
245 .setText("当前无网络,请检查网络设置") 246 .setText("当前无网络,请检查网络设置")
246 .setNegative("继续使用", null) 247 .setNegative("继续使用", null)
247 .setPositive("设置网络", new View.OnClickListener() { 248 .setPositive("设置网络", new View.OnClickListener() {
248 @Override 249 @Override
249 public void onClick(View v) { 250 public void onClick(View v) {
250 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 251 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
251 mContext.startActivity(intent); 252 mContext.startActivity(intent);
252 } 253 }
253 }) 254 })
254 .show(); 255 .show();
255 256
256 } 257 }
257 }); 258 });
258 } 259 }
259 260
260 //修改密码 261 //修改密码
261 public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { 262 public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) {
262 RequestParams params = new RequestParams(); 263 RequestParams params = new RequestParams();
263 params.put(HttpKey.USERNAME, username); 264 params.put(HttpKey.USERNAME, username);
264 params.put(HttpKey.OLDPASS, old_pwd1); 265 params.put(HttpKey.OLDPASS, old_pwd1);
265 params.put(HttpKey.NEWPASS, newpassword3); 266 params.put(HttpKey.NEWPASS, newpassword3);
266 HttpClient.getInstance().addHeader("Accept", "*/*"); 267 HttpClient.getInstance().addHeader("Accept", "*/*");
267 HttpClient.getInstance().setTimeout(10 * 1000); 268 HttpClient.getInstance().setTimeout(10 * 1000);
268 HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { 269 HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() {
269 @Override 270 @Override
270 public void onSuccess(int i, Header[] headers, byte[] bytes) { 271 public void onSuccess(int i, Header[] headers, byte[] bytes) {
271 try { 272 try {
272 JSONObject jsonObject = new JSONObject(new String(bytes)); 273 JSONObject jsonObject = new JSONObject(new String(bytes));
273 String status = jsonObject.optString("status"); 274 String status = jsonObject.optString("status");
274 if (status.equals("100")) { 275 if (status.equals("100")) {
275 Log.e("test", "onSuccess" + new String(bytes)); 276 Log.e("test", "onSuccess" + new String(bytes));
276 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); 277 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show();
277 SaveParam.getInstance().clearData((Activity) context); 278 SaveParam.getInstance().clearData((Activity) context);
278 Intent intent = new Intent(); 279 Intent intent = new Intent();
279 intent.setClass(context, LoginAndRegisterActivity.class); 280 intent.setClass(context, LoginAndRegisterActivity.class);
280 ((Activity) context).startActivity(intent); 281 ((Activity) context).startActivity(intent);
281 ((Activity) context).finish(); 282 ((Activity) context).finish();
282 } 283 }
283 } catch (JSONException e) { 284 } catch (JSONException e) {
284 e.printStackTrace(); 285 e.printStackTrace();
285 } 286 }
286 } 287 }
287 288
288 @Override 289 @Override
289 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 290 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
290 Log.e("test", "onFailure" + new String(bytes)); 291 Log.e("test", "onFailure" + new String(bytes));
291 new CircleDialog.Builder((FragmentActivity) context) 292 new CircleDialog.Builder((FragmentActivity) context)
292 .setCanceledOnTouchOutside(false) 293 .setCanceledOnTouchOutside(false)
293 .setCancelable(false) 294 .setCancelable(false)
294 .setWidth(0.5f) 295 .setWidth(0.5f)
295 .configText(new ConfigText() { 296 .configText(new ConfigText() {
296 @Override 297 @Override
297 public void onConfig(TextParams params) { 298 public void onConfig(TextParams params) {
298 params.gravity = Gravity.CENTER; 299 params.gravity = Gravity.CENTER;
299 params.padding = new int[]{50, 50, 50, 50}; 300 params.padding = new int[]{50, 50, 50, 50};
300 } 301 }
301 }) 302 })
302 .setText("当前无网络,请检查网络设置") 303 .setText("当前无网络,请检查网络设置")
303 .setNegative("继续使用", null) 304 .setNegative("继续使用", null)
304 .setPositive("设置网络", new View.OnClickListener() { 305 .setPositive("设置网络", new View.OnClickListener() {
305 @Override 306 @Override
306 public void onClick(View v) { 307 public void onClick(View v) {
307 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 308 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
308 context.startActivity(intent); 309 context.startActivity(intent);
309 } 310 }
310 }) 311 })
311 .show(); 312 .show();
312 } 313 }
313 }); 314 });
314 315
315 } 316 }
316 317
317 //忘记密码 318 //忘记密码
318 public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { 319 public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) {
319 RequestParams params = new RequestParams(); 320 RequestParams params = new RequestParams();
320 params.put(HttpKey.USERNAME, forot_pwd_phone1); 321 params.put(HttpKey.USERNAME, forot_pwd_phone1);
321 params.put(HttpKey.PASSWORD, forot_pwd_pwd3); 322 params.put(HttpKey.PASSWORD, forot_pwd_pwd3);
322 params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); 323 params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1);
323 HttpClient.getInstance().addHeader("Accept", "*/*"); 324 HttpClient.getInstance().addHeader("Accept", "*/*");
324 HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { 325 HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() {
325 @Override 326 @Override
326 public void onSuccess(int i, Header[] headers, byte[] bytes) { 327 public void onSuccess(int i, Header[] headers, byte[] bytes) {
327 try { 328 try {
328 JSONObject jsonObject = new JSONObject(new String(bytes)); 329 JSONObject jsonObject = new JSONObject(new String(bytes));
329 String status = jsonObject.optString("status"); 330 String status = jsonObject.optString("status");
330 if (status.equals("100")) { 331 if (status.equals("100")) {
331 Log.e("test", "onSuccess" + new String(bytes)); 332 Log.e("test", "onSuccess" + new String(bytes));
332 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); 333 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show();
333 ((Activity) context).finish(); 334 ((Activity) context).finish();
334 } 335 }
335 } catch (JSONException e) { 336 } catch (JSONException e) {
336 e.printStackTrace(); 337 e.printStackTrace();
337 } 338 }
338 } 339 }
339 340
340 @Override 341 @Override
341 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 342 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
342 Log.e("test", "onFailure" + new String(bytes)); 343 Log.e("test", "onFailure" + new String(bytes));
343 new CircleDialog.Builder((FragmentActivity) context) 344 new CircleDialog.Builder((FragmentActivity) context)
344 .setCanceledOnTouchOutside(false) 345 .setCanceledOnTouchOutside(false)
345 .setCancelable(false) 346 .setCancelable(false)
346 .setWidth(0.5f) 347 .setWidth(0.5f)
347 .configText(new ConfigText() { 348 .configText(new ConfigText() {
348 @Override 349 @Override
349 public void onConfig(TextParams params) { 350 public void onConfig(TextParams params) {
350 params.gravity = Gravity.CENTER; 351 params.gravity = Gravity.CENTER;
351 params.padding = new int[]{50, 50, 50, 50}; 352 params.padding = new int[]{50, 50, 50, 50};
352 } 353 }
353 }) 354 })
354 .setText("当前无网络,请检查网络设置") 355 .setText("当前无网络,请检查网络设置")
355 .setNegative("继续使用", null) 356 .setNegative("继续使用", null)
356 .setPositive("设置网络", new View.OnClickListener() { 357 .setPositive("设置网络", new View.OnClickListener() {
357 @Override 358 @Override
358 public void onClick(View v) { 359 public void onClick(View v) {
359 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 360 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
360 context.startActivity(intent); 361 context.startActivity(intent);
361 } 362 }
362 }) 363 })
363 .show(); 364 .show();
364 } 365 }
365 }); 366 });
366 367
367 } 368 }
368 369
369 //保存用户登录信息 370 //保存用户登录信息
370 public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { 371 public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) {
371 SaveParam.getInstance().saveLoginParam(context, "username", username); 372 SaveParam.getInstance().saveLoginParam(context, "username", username);
372 SaveParam.getInstance().saveLoginParam(context, "password", password); 373 SaveParam.getInstance().saveLoginParam(context, "password", password);
373 SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); 374 SaveParam.getInstance().saveLoginParam(context, "access_token", access_token);
374 SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); 375 SaveParam.getInstance().saveLoginParam(context, "login", loginStatus);
375 SaveParam.getInstance().saveLoginParam(context, "userId", userId); 376 SaveParam.getInstance().saveLoginParam(context, "userId", userId);
376 377
377 378
378 } 379 }
379 380
380 //保存用户登录信息 381 //保存用户登录信息
381 public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) { 382 public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) {
382 SaveParam.getInstance().saveLoginParam(context, "lastname", lastname); 383 SaveParam.getInstance().saveLoginParam(context, "lastname", lastname);
383 SaveParam.getInstance().saveLoginParam(context, "gender", gender); 384 SaveParam.getInstance().saveLoginParam(context, "gender", gender);
384 SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait); 385 SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait);
385 } 386 }
386 387
387 //提交保卡信息 388 //提交保卡信息
388 public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, 389 public void subcardinfo(final Context context, long userId, String customerName, String customerAddress,
389 String buyAddress, String buyTime, String alterSaleCall, 390 String buyAddress, String buyTime, String alterSaleCall,
390 String productModel, String deviceNumber, String macAddress, 391 String productModel, String deviceNumber, String macAddress,
391 String mobilePhone) { 392 String mobilePhone) {
392 mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", 393 mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...",
393 false, true, null); 394 false, true, null);
394 RequestParams params = new RequestParams(); 395 RequestParams params = new RequestParams();
395 396
396 params.put(HttpKey.USEID, userId); 397 params.put(HttpKey.USEID, userId);
397 params.put(HttpKey.CUSTOMENAME, customerName); 398 params.put(HttpKey.CUSTOMENAME, customerName);
398 params.put(HttpKey.CUSTOMADRESS, customerAddress); 399 params.put(HttpKey.CUSTOMADRESS, customerAddress);
399 params.put(HttpKey.BUYADREES, buyAddress); 400 params.put(HttpKey.BUYADREES, buyAddress);
400 params.put(HttpKey.BUYTIME, buyTime); 401 params.put(HttpKey.BUYTIME, buyTime);
401 params.put(HttpKey.ALTERSALECALL, alterSaleCall); 402 params.put(HttpKey.ALTERSALECALL, alterSaleCall);
402 params.put(HttpKey.PRODUCTMODEL, productModel); 403 params.put(HttpKey.PRODUCTMODEL, productModel);
403 params.put(HttpKey.DEVICENUMBER, deviceNumber); 404 params.put(HttpKey.DEVICENUMBER, deviceNumber);
404 params.put(HttpKey.MACADRESS, macAddress); 405 params.put(HttpKey.MACADRESS, macAddress);
405 params.put(HttpKey.MOBILPHONE, mobilePhone); 406 params.put(HttpKey.MOBILPHONE, mobilePhone);
406 407
407 HttpClient.getInstance().addHeader("Accept", "*/*"); 408 HttpClient.getInstance().addHeader("Accept", "*/*");
408 409
409 Log.e("test", "params" + params); 410 Log.e("test", "params" + params);
410 HttpClient.getInstance().setTimeout(5 * 1000); 411 HttpClient.getInstance().setTimeout(5 * 1000);
411 HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { 412 HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() {
412 @Override 413 @Override
413 public void onSuccess(int i, Header[] headers, byte[] bytes) { 414 public void onSuccess(int i, Header[] headers, byte[] bytes) {
414 JSONObject jsonObject = null; 415 JSONObject jsonObject = null;
415 closeProgress(); 416 closeProgress();
416 try { 417 try {
417 jsonObject = new JSONObject(new String(bytes)); 418 jsonObject = new JSONObject(new String(bytes));
418 String status = jsonObject.optString("status"); 419 String status = jsonObject.optString("status");
419 if (status.equals("1")) { 420 if (status.equals("1")) {
420 Log.e("test", "onSuccess" + jsonObject); 421 Log.e("test", "onSuccess" + jsonObject);
421 Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); 422 Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show();
422 Intent intent = new Intent(); 423 Intent intent = new Intent();
423 intent.setClass((Activity) context, TheStartPageActivity.class); 424 intent.setClass((Activity) context, TheStartPageActivity.class);
424 ((Activity) context).startActivity(intent); 425 ((Activity) context).startActivity(intent);
425 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); 426 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout);
426 ((Activity) context).finish(); 427 ((Activity) context).finish();
427 } 428 }
428 } catch (JSONException e) { 429 } catch (JSONException e) {
429 e.printStackTrace(); 430 e.printStackTrace();
430 } 431 }
431 432
432 433
433 } 434 }
434 435
435 @Override 436 @Override
436 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 437 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
437 Log.e("test", "onFailure" + (throwable)); 438 Log.e("test", "onFailure" + (throwable));
438 closeProgress(); 439 closeProgress();
439 new CircleDialog.Builder((FragmentActivity) context) 440 new CircleDialog.Builder((FragmentActivity) context)
440 .setCanceledOnTouchOutside(false) 441 .setCanceledOnTouchOutside(false)
441 .setCancelable(false) 442 .setCancelable(false)
442 .setWidth(0.5f) 443 .setWidth(0.5f)
443 .configText(new ConfigText() { 444 .configText(new ConfigText() {
444 @Override 445 @Override
445 public void onConfig(TextParams params) { 446 public void onConfig(TextParams params) {
446 params.gravity = Gravity.CENTER; 447 params.gravity = Gravity.CENTER;
447 params.padding = new int[]{50, 50, 50, 50}; 448 params.padding = new int[]{50, 50, 50, 50};
448 } 449 }
449 }) 450 })
450 .setText("当前无网络,请检查网络设置") 451 .setText("当前无网络,请检查网络设置")
451 .setNegative("继续使用", null) 452 .setNegative("继续使用", null)
452 .setPositive("设置网络", new View.OnClickListener() { 453 .setPositive("设置网络", new View.OnClickListener() {
453 @Override 454 @Override
454 public void onClick(View v) { 455 public void onClick(View v) {
455 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 456 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
456 context.startActivity(intent); 457 context.startActivity(intent);
457 } 458 }
458 }) 459 })
459 .show(); 460 .show();
460 461
461 } 462 }
462 }); 463 });
463 464
464 } 465 }
465 //获取保卡信息 466 //获取保卡信息
466 public void getcardinfo(final Context mContext, long userId , final Handler handler) { 467 public void getcardinfo(final Context mContext, long userId , final Handler handler) {
467 mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", 468 mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...",
468 false, true, null); 469 false, true, null);
469 HttpClient.getInstance().setTimeout(5 * 1000); 470 HttpClient.getInstance().setTimeout(5 * 1000);
470 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 471 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
471 HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() { 472 HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() {
472 @Override 473 @Override
473 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 474 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
474 closeProgress(); 475 closeProgress();
475 Log.e("test", "保卡信息" + new String(arg2)); 476 Log.e("test", "保卡信息" + new String(arg2));
476 CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 477 CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据
477 CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); 478 CardInfo.DataBean schoolInfoBeanList = cardInfo.getData();
478 Message msg = Message.obtain(); 479 Message msg = Message.obtain();
479 msg.what = HttpCode.SUCHCARDINFO; 480 msg.what = HttpCode.SUCHCARDINFO;
480 msg.obj = schoolInfoBeanList; 481 msg.obj = schoolInfoBeanList;
481 handler.sendMessage(msg); 482 handler.sendMessage(msg);
482 } 483 }
483 484
484 @Override 485 @Override
485 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 486 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
486 closeProgress(); 487 closeProgress();
487 new CircleDialog.Builder((FragmentActivity) mContext) 488 new CircleDialog.Builder((FragmentActivity) mContext)
488 .setCanceledOnTouchOutside(false) 489 .setCanceledOnTouchOutside(false)
489 .setCancelable(false) 490 .setCancelable(false)
490 .setWidth(0.5f) 491 .setWidth(0.5f)
491 .configText(new ConfigText() { 492 .configText(new ConfigText() {
492 @Override 493 @Override
493 public void onConfig(TextParams params) { 494 public void onConfig(TextParams params) {
494 params.gravity = Gravity.CENTER; 495 params.gravity = Gravity.CENTER;
495 params.padding = new int[]{50, 50, 50, 50}; 496 params.padding = new int[]{50, 50, 50, 50};
496 } 497 }
497 }) 498 })
498 .setText("当前无网络,请检查网络设置") 499 .setText("当前无网络,请检查网络设置")
499 .setNegative("继续使用", null) 500 .setNegative("继续使用", null)
500 .setPositive("设置网络", new View.OnClickListener() { 501 .setPositive("设置网络", new View.OnClickListener() {
501 @Override 502 @Override
502 public void onClick(View v) { 503 public void onClick(View v) {
503 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 504 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
504 mContext.startActivity(intent); 505 mContext.startActivity(intent);
505 } 506 }
506 }) 507 })
507 .show(); 508 .show();
508 } 509 }
509 }); 510 });
510 } 511 }
511 //修改保卡信息电话 512 //修改保卡信息电话
512 public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { 513 public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) {
513 RequestParams params = new RequestParams(); 514 RequestParams params = new RequestParams();
514 params.put("userId", userId); 515 params.put("userId", userId);
515 params.put("customerPhone", customerPhone); 516 params.put("customerPhone", customerPhone);
516 params.put("authCode", authCode); 517 params.put("authCode", authCode);
517 HttpClient.getInstance().addHeader("Accept", "*/*"); 518 HttpClient.getInstance().addHeader("Accept", "*/*");
518 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { 519 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() {
519 @Override 520 @Override
520 public void onSuccess(int i, Header[] headers, byte[] bytes) { 521 public void onSuccess(int i, Header[] headers, byte[] bytes) {
521 try { 522 try {
522 JSONObject jsonObject = new JSONObject(new String(bytes)); 523 JSONObject jsonObject = new JSONObject(new String(bytes));
523 String status = jsonObject.optString("status"); 524 String status = jsonObject.optString("status");
524 if (status.equals("1")) { 525 if (status.equals("1")) {
525 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); 526 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show();
526 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone); 527 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone);
527 ((Activity) mContext).finish(); 528 ((Activity) mContext).finish();
528 }else if (status.equals("1001")){ 529 }else if (status.equals("1001")){
529 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); 530 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show();
530 } 531 }
531 } catch (JSONException e) { 532 } catch (JSONException e) {
532 e.printStackTrace(); 533 e.printStackTrace();
533 } 534 }
534 } 535 }
535 536
536 @Override 537 @Override
537 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 538 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
538 Log.e("test", "onFailure" + new String(bytes)); 539 Log.e("test", "onFailure" + new String(bytes));
539 new CircleDialog.Builder((FragmentActivity) mContext) 540 new CircleDialog.Builder((FragmentActivity) mContext)
540 .setCanceledOnTouchOutside(false) 541 .setCanceledOnTouchOutside(false)
541 .setCancelable(false) 542 .setCancelable(false)
542 .setWidth(0.5f) 543 .setWidth(0.5f)
543 .configText(new ConfigText() { 544 .configText(new ConfigText() {
544 @Override 545 @Override
545 public void onConfig(TextParams params) { 546 public void onConfig(TextParams params) {
546 params.gravity = Gravity.CENTER; 547 params.gravity = Gravity.CENTER;
547 params.padding = new int[]{50, 50, 50, 50}; 548 params.padding = new int[]{50, 50, 50, 50};
548 } 549 }
549 }) 550 })
550 .setText("当前无网络,请检查网络设置") 551 .setText("当前无网络,请检查网络设置")
551 .setNegative("继续使用", null) 552 .setNegative("继续使用", null)
552 .setPositive("设置网络", new View.OnClickListener() { 553 .setPositive("设置网络", new View.OnClickListener() {
553 @Override 554 @Override
554 public void onClick(View v) { 555 public void onClick(View v) {
555 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 556 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
556 mContext.startActivity(intent); 557 mContext.startActivity(intent);
557 } 558 }
558 }) 559 })
559 .show(); 560 .show();
560 } 561 }
561 }); 562 });
562 } 563 }
563 //修改保卡信息地址 564 //修改保卡信息地址
564 public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { 565 public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) {
565 RequestParams params = new RequestParams(); 566 RequestParams params = new RequestParams();
566 params.put("userId", userId); 567 params.put("userId", userId);
567 params.put("customerPhone", customerPhone); 568 params.put("customerPhone", customerPhone);
568 params.put("authCode", authCode); 569 params.put("authCode", authCode);
569 params.put("customerAddress", customerAddress); 570 params.put("customerAddress", customerAddress);
570 HttpClient.getInstance().addHeader("Accept", "*/*"); 571 HttpClient.getInstance().addHeader("Accept", "*/*");
571 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { 572 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() {
572 @Override 573 @Override
573 public void onSuccess(int i, Header[] headers, byte[] bytes) { 574 public void onSuccess(int i, Header[] headers, byte[] bytes) {
574 try { 575 try {
575 JSONObject jsonObject = new JSONObject(new String(bytes)); 576 JSONObject jsonObject = new JSONObject(new String(bytes));
576 String status = jsonObject.optString("status"); 577 String status = jsonObject.optString("status");
577 if (status.equals("1")) { 578 if (status.equals("1")) {
578 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); 579 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show();
579 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress); 580 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress);
580 ((Activity) mContext).finish(); 581 ((Activity) mContext).finish();
581 } 582 }
582 } catch (JSONException e) { 583 } catch (JSONException e) {
583 e.printStackTrace(); 584 e.printStackTrace();
584 } 585 }
585 } 586 }
586 587
587 @Override 588 @Override
588 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 589 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
589 Log.e("test", "onFailure" + new String(bytes)); 590 Log.e("test", "onFailure" + new String(bytes));
590 new CircleDialog.Builder((FragmentActivity) mContext) 591 new CircleDialog.Builder((FragmentActivity) mContext)
591 .setCanceledOnTouchOutside(false) 592 .setCanceledOnTouchOutside(false)
592 .setCancelable(false) 593 .setCancelable(false)
593 .setWidth(0.5f) 594 .setWidth(0.5f)
594 .configText(new ConfigText() { 595 .configText(new ConfigText() {
595 @Override 596 @Override
596 public void onConfig(TextParams params) { 597 public void onConfig(TextParams params) {
597 params.gravity = Gravity.CENTER; 598 params.gravity = Gravity.CENTER;
598 params.padding = new int[]{50, 50, 50, 50}; 599 params.padding = new int[]{50, 50, 50, 50};
599 } 600 }
600 }) 601 })
601 .setText("当前无网络,请检查网络设置") 602 .setText("当前无网络,请检查网络设置")
602 .setNegative("继续使用", null) 603 .setNegative("继续使用", null)
603 .setPositive("设置网络", new View.OnClickListener() { 604 .setPositive("设置网络", new View.OnClickListener() {
604 @Override 605 @Override
605 public void onClick(View v) { 606 public void onClick(View v) {
606 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 607 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
607 mContext.startActivity(intent); 608 mContext.startActivity(intent);
608 } 609 }
609 }) 610 })
610 .show(); 611 .show();
611 } 612 }
612 }); 613 });
613 } 614 }
614 //验证是否保卡信息 615 //验证是否保卡信息
615 public void cardinfocheck(final Context mContext, long userId, final Handler handler) { 616 public void cardinfocheck(final Context mContext, long userId, final Handler handler) {
616 mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", 617 mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...",
617 false, true, null); 618 false, true, null);
618 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 619 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
619 HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() { 620 HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() {
620 @Override 621 @Override
621 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 622 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
622 Log.e("test", "---" + new String(arg2)); 623 Log.e("test", "---" + new String(arg2));
623 closeProgress(); 624 closeProgress();
624 Message msg = Message.obtain(); 625 Message msg = Message.obtain();
625 msg.what = HttpCode.CHECKCARD; 626 msg.what = HttpCode.CHECKCARD;
626 msg.obj = new String(arg2); 627 msg.obj = new String(arg2);
627 handler.sendMessage(msg); 628 handler.sendMessage(msg);
628 } 629 }
629 630
630 @Override 631 @Override
631 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 632 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
632 closeProgress(); 633 closeProgress();
633 new CircleDialog.Builder((FragmentActivity) mContext) 634 new CircleDialog.Builder((FragmentActivity) mContext)
634 .setCanceledOnTouchOutside(false) 635 .setCanceledOnTouchOutside(false)
635 .setCancelable(false) 636 .setCancelable(false)
636 .configText(new ConfigText() { 637 .configText(new ConfigText() {
637 @Override 638 @Override
638 public void onConfig(TextParams params) { 639 public void onConfig(TextParams params) {
639 params.gravity = Gravity.CENTER; 640 params.gravity = Gravity.CENTER;
640 params.padding = new int[]{250, 50, 250, 50}; 641 params.padding = new int[]{250, 50, 250, 50};
641 } 642 }
642 }) 643 })
643 .setText("当前无网络,请检查网络设置") 644 .setText("当前无网络,请检查网络设置")
644 .setNegative("取消", null) 645 .setNegative("取消", null)
645 .setPositive("确定", new View.OnClickListener() { 646 .setPositive("确定", new View.OnClickListener() {
646 @Override 647 @Override
647 public void onClick(View v) { 648 public void onClick(View v) {
648 Intent intent = new Intent("/"); 649 Intent intent = new Intent("/");
649 ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings"); 650 ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings");
650 intent.setComponent(cm); 651 intent.setComponent(cm);
651 intent.setAction("android.intent.action.VIEW"); 652 intent.setAction("android.intent.action.VIEW");
652 ((Activity) mContext).startActivityForResult( intent , 0); 653 ((Activity) mContext).startActivityForResult( intent , 0);
653 } 654 }
654 }) 655 })
655 .show(); 656 .show();
656 //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); 657 //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show();
657 } 658 }
658 }); 659 });
659 } 660 }
660 661
661 ///获取年级 662 ///获取年级
662 public void getgrade(final Context mContext, final Handler handler) { 663 public void getgrade(final Context mContext, final Handler handler) {
663 HttpClient.getInstance().addHeader("Accept", "application/json"); 664 HttpClient.getInstance().addHeader("Accept", "application/json");
664 HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { 665 HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() {
665 @Override 666 @Override
666 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 667 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
667 Log.e("test", "年级" + new String(arg2)); 668 Log.e("test", "年级" + new String(arg2));
668 GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 669 GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据
669 List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); 670 List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>();
670 for (int i = 0 ;i<gradeInfo.getData().size()-2;i++) { 671 for (int i = 0 ;i<gradeInfo.getData().size()-2;i++) {
671 String name = gradeInfo.getData().get(i).getName(); 672 String name = gradeInfo.getData().get(i).getName();
672 int id = gradeInfo.getData().get(i).getId(); 673 int id = gradeInfo.getData().get(i).getId();
673 List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); 674 List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren();
674 for (int j = 0; j < gradeinfoList.size(); j++) { 675 for (int j = 0; j < gradeinfoList.size(); j++) {
675 String secondname = gradeinfoList.get(j).getName(); 676 String secondname = gradeinfoList.get(j).getName();
676 int secondid = gradeinfoList.get(j).getId(); 677 int secondid = gradeinfoList.get(j).getId();
677 GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); 678 GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean();
678 dataBean.setName(secondname); 679 dataBean.setName(secondname);
679 dataBean.setId(secondid); 680 dataBean.setId(secondid);
680 gradeInfoLists.add(dataBean); 681 gradeInfoLists.add(dataBean);
681 } 682 }
682 683
683 } 684 }
684 685
685 Message message = Message.obtain(); 686 Message message = Message.obtain();
686 message.what = HttpCode.GRADER; 687 message.what = HttpCode.GRADER;
687 message.obj = gradeInfoLists; 688 message.obj = gradeInfoLists;
688 handler.sendMessage(message); 689 handler.sendMessage(message);
689 690
690 691
691 } 692 }
692 693
693 @Override 694 @Override
694 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 695 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
695 new CircleDialog.Builder((FragmentActivity) mContext) 696 new CircleDialog.Builder((FragmentActivity) mContext)
696 .setCanceledOnTouchOutside(false) 697 .setCanceledOnTouchOutside(false)
697 .setCancelable(false) 698 .setCancelable(false)
698 .setWidth(0.5f) 699 .setWidth(0.5f)
699 .configText(new ConfigText() { 700 .configText(new ConfigText() {
700 @Override 701 @Override
701 public void onConfig(TextParams params) { 702 public void onConfig(TextParams params) {
702 params.gravity = Gravity.CENTER; 703 params.gravity = Gravity.CENTER;
703 params.padding = new int[]{50, 50, 50, 50}; 704 params.padding = new int[]{50, 50, 50, 50};
704 } 705 }
705 }) 706 })
706 .setText("当前无网络,请检查网络设置") 707 .setText("当前无网络,请检查网络设置")
707 .setNegative("继续使用", null) 708 .setNegative("继续使用", null)
708 .setPositive("设置网络", new View.OnClickListener() { 709 .setPositive("设置网络", new View.OnClickListener() {
709 @Override 710 @Override
710 public void onClick(View v) { 711 public void onClick(View v) {
711 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 712 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
712 mContext.startActivity(intent); 713 mContext.startActivity(intent);
713 } 714 }
714 }) 715 })
715 .show(); 716 .show();
716 } 717 }
717 }); 718 });
718 } 719 }
719 720
720 /** 721 /**
721 * 获取学校 722 * 获取学校
722 * @param mContext 723 * @param mContext
723 * @param regionId 724 * @param regionId
724 * @param gradeId 725 * @param gradeId
725 * @param handler 726 * @param handler
726 */ 727 */
727 public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { 728 public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) {
728 HttpClient.getInstance().addHeader("Accept", "application/json"); 729 HttpClient.getInstance().addHeader("Accept", "application/json");
729 HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { 730 HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() {
730 @Override 731 @Override
731 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 732 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
732 Log.e("test", "学校" + new String(arg2)); 733 Log.e("test", "学校" + new String(arg2));
733 SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 734 SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据
734 List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); 735 List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData();
735 Message message = Message.obtain(); 736 Message message = Message.obtain();
736 message.what = HttpCode.SCHOOL; 737 message.what = HttpCode.SCHOOL;
737 message.obj = schoolInfoBeanList; 738 message.obj = schoolInfoBeanList;
738 handler.sendMessage(message); 739 handler.sendMessage(message);
739 740
740 } 741 }
741 742
742 @Override 743 @Override
743 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 744 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
744 new CircleDialog.Builder((FragmentActivity) mContext) 745 new CircleDialog.Builder((FragmentActivity) mContext)
745 .setCanceledOnTouchOutside(false) 746 .setCanceledOnTouchOutside(false)
746 .setCancelable(false) 747 .setCancelable(false)
747 .setWidth(0.5f) 748 .setWidth(0.5f)
748 .configText(new ConfigText() { 749 .configText(new ConfigText() {
749 @Override 750 @Override
750 public void onConfig(TextParams params) { 751 public void onConfig(TextParams params) {
751 params.gravity = Gravity.CENTER; 752 params.gravity = Gravity.CENTER;
752 params.padding = new int[]{50, 50, 50, 50}; 753 params.padding = new int[]{50, 50, 50, 50};
753 } 754 }
754 }) 755 })
755 .setText("当前无网络,请检查网络设置") 756 .setText("当前无网络,请检查网络设置")
756 .setNegative("继续使用", null) 757 .setNegative("继续使用", null)
757 .setPositive("设置网络", new View.OnClickListener() { 758 .setPositive("设置网络", new View.OnClickListener() {
758 @Override 759 @Override
759 public void onClick(View v) { 760 public void onClick(View v) {
760 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 761 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
761 mContext.startActivity(intent); 762 mContext.startActivity(intent);
762 } 763 }
763 }) 764 })
764 .show(); 765 .show();
765 } 766 }
766 }); 767 });
767 } 768 }
768 769
769 770
770 771
771 /** 772 /**
772 * 获取个人信息 773 * 获取个人信息
773 * @param mContext 774 * @param mContext
774 * @param userId 775 * @param userId
775 * @param handler 776 * @param handler
776 */ 777 */
777 public void getpresonalinfo(final Context mContext, long userId, final Handler handler) { 778 public void getpresonalinfo(final Context mContext, long userId, final Handler handler) {
778 mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", 779 mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...",
779 false, true, null); 780 false, true, null);
780 HttpClient.getInstance().addHeader("Accept", "application/json"); 781 HttpClient.getInstance().addHeader("Accept", "application/json");
781 HttpClient.getInstance().setConnectTimeout(5*1000); 782 HttpClient.getInstance().setConnectTimeout(5*1000);
782 HttpClient.getInstance().get(HttpUrl.getpresonalinfo+ "?userId=" + userId, new AsyncHttpResponseHandler() { 783 HttpClient.getInstance().get(HttpUrl.getpresonalinfo+ "?userId=" + userId, new AsyncHttpResponseHandler() {
783 @Override 784 @Override
784 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 785 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
785 closeProgress(); 786 closeProgress();
786 Log.e("test", "个人信息" + new String(arg2)); 787 Log.e("test", "个人信息" + new String(arg2));
787 PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 788 PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据
788 PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); 789 PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData();
789 Message message = Message.obtain(); 790 Message message = Message.obtain();
790 message.what = HttpCode.GETINFO; 791 message.what = HttpCode.GETINFO;
791 message.obj = pesonalInfoBeanList; 792 message.obj = pesonalInfoBeanList;
792 handler.sendMessage(message); 793 handler.sendMessage(message);
793 794
794 } 795 }
795 796
796 @Override 797 @Override
797 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 798 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
798 closeProgress(); 799 closeProgress();
799 new CircleDialog.Builder((FragmentActivity) mContext) 800 new CircleDialog.Builder((FragmentActivity) mContext)
800 .setCanceledOnTouchOutside(false) 801 .setCanceledOnTouchOutside(false)
801 .setCancelable(false) 802 .setCancelable(false)
802 .setWidth(0.5f) 803 .setWidth(0.5f)
803 .configText(new ConfigText() { 804 .configText(new ConfigText() {
804 @Override 805 @Override
805 public void onConfig(TextParams params) { 806 public void onConfig(TextParams params) {
806 params.gravity = Gravity.CENTER; 807 params.gravity = Gravity.CENTER;
807 params.padding = new int[]{50, 50, 50, 50}; 808 params.padding = new int[]{50, 50, 50, 50};
808 } 809 }
809 }) 810 })
810 .setText("当前无网络,请检查网络设置") 811 .setText("当前无网络,请检查网络设置")
811 .setNegative("继续使用", null) 812 .setNegative("继续使用", null)
812 .setPositive("设置网络", new View.OnClickListener() { 813 .setPositive("设置网络", new View.OnClickListener() {
813 @Override 814 @Override
814 public void onClick(View v) { 815 public void onClick(View v) {
815 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 816 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
816 mContext.startActivity(intent); 817 mContext.startActivity(intent);
817 } 818 }
818 }) 819 })
819 .show(); 820 .show();
820 } 821 }
821 }); 822 });
822 } 823 }
823 //修改个人信息 824 //修改个人信息
824 public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException { 825 public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException {
825 Gson gson = new Gson(); 826 Gson gson = new Gson();
826 String jsonObject = gson.toJson(object); 827 String jsonObject = gson.toJson(object);
827 Log.e("test", "onSuccess" + jsonObject); 828 Log.e("test", "onSuccess" + jsonObject);
828 mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", 829 mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...",
829 false, true, null); 830 false, true, null);
830 ByteArrayEntity entity = null; 831 ByteArrayEntity entity = null;
831 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); 832 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8"));
832 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); 833 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
833 834
834 HttpClient.getInstance().addHeader("Accept", "*/*"); 835 HttpClient.getInstance().addHeader("Accept", "*/*");
835 HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() { 836 HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() {
836 @Override 837 @Override
837 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 838 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
838 super.onSuccess(statusCode, headers, response); 839 super.onSuccess(statusCode, headers, response);
839 closeProgress(); 840 closeProgress();
840 String status = response.optString("status"); 841 String status = response.optString("status");
841 if (status.equals("1")) { 842 if (status.equals("1")) {
842 Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); 843 Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show();
843 ((Activity) mContext).finish(); 844 ((Activity) mContext).finish();
844 } 845 }
845 Log.e("test", "onSuccess" + response); 846 Log.e("test", "onSuccess" + response);
846 847
847 } 848 }
848 849
849 @Override 850 @Override
850 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 851 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
851 super.onFailure(statusCode, headers, throwable, errorResponse); 852 super.onFailure(statusCode, headers, throwable, errorResponse);
852 closeProgress(); 853 closeProgress();
853 Log.e("test", "onFailure" + errorResponse); 854 Log.e("test", "onFailure" + errorResponse);
854 new CircleDialog.Builder((FragmentActivity) mContext) 855 new CircleDialog.Builder((FragmentActivity) mContext)
855 .setCanceledOnTouchOutside(false) 856 .setCanceledOnTouchOutside(false)
856 .setCancelable(false) 857 .setCancelable(false)
857 .setWidth(0.5f) 858 .setWidth(0.5f)
858 .configText(new ConfigText() { 859 .configText(new ConfigText() {
859 @Override 860 @Override
860 public void onConfig(TextParams params) { 861 public void onConfig(TextParams params) {
861 params.gravity = Gravity.CENTER; 862 params.gravity = Gravity.CENTER;
862 params.padding = new int[]{50, 50, 50, 50}; 863 params.padding = new int[]{50, 50, 50, 50};
863 } 864 }
864 }) 865 })
865 .setText("当前无网络,请检查网络设置") 866 .setText("当前无网络,请检查网络设置")
866 .setNegative("继续使用", null) 867 .setNegative("继续使用", null)
867 .setPositive("设置网络", new View.OnClickListener() { 868 .setPositive("设置网络", new View.OnClickListener() {
868 @Override 869 @Override
869 public void onClick(View v) { 870 public void onClick(View v) {
870 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 871 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
871 mContext.startActivity(intent); 872 mContext.startActivity(intent);
872 } 873 }
873 }) 874 })
874 .show(); 875 .show();
875 } 876 }
876 877
877 }); 878 });
878 } 879 }
879 //修改个性签名 880 //修改个性签名
880 public void changsignature(final Context mContext, long userId, final String signature) { 881 public void changsignature(final Context mContext, long userId, final String signature) {
881 RequestParams params = new RequestParams(); 882 RequestParams params = new RequestParams();
882 params.put("userId", userId); 883 params.put("userId", userId);
883 params.put("signature", signature); 884 params.put("signature", signature);
884 HttpClient.getInstance().addHeader("Accept", "*/*"); 885 HttpClient.getInstance().addHeader("Accept", "*/*");
885 HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { 886 HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() {
886 @Override 887 @Override
887 public void onSuccess(int i, Header[] headers, byte[] bytes) { 888 public void onSuccess(int i, Header[] headers, byte[] bytes) {
888 try { 889 try {
889 JSONObject jsonObject = new JSONObject(new String(bytes)); 890 JSONObject jsonObject = new JSONObject(new String(bytes));
890 String status = jsonObject.optString("status"); 891 String status = jsonObject.optString("status");
891 if (status.equals("1")) { 892 if (status.equals("1")) {
892 Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); 893 Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show();
893 } 894 }
894 } catch (JSONException e) { 895 } catch (JSONException e) {
895 e.printStackTrace(); 896 e.printStackTrace();
896 } 897 }
897 } 898 }
898 899
899 @Override 900 @Override
900 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 901 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
901 Log.e("test", "onFailure" + new String(bytes)); 902 Log.e("test", "onFailure" + new String(bytes));
902 new CircleDialog.Builder((FragmentActivity) mContext) 903 new CircleDialog.Builder((FragmentActivity) mContext)
903 .setCanceledOnTouchOutside(false) 904 .setCanceledOnTouchOutside(false)
904 .setCancelable(false) 905 .setCancelable(false)
905 .setWidth(0.5f) 906 .setWidth(0.5f)
906 .configText(new ConfigText() { 907 .configText(new ConfigText() {
907 @Override 908 @Override
908 public void onConfig(TextParams params) { 909 public void onConfig(TextParams params) {
909 params.gravity = Gravity.CENTER; 910 params.gravity = Gravity.CENTER;
910 params.padding = new int[]{50, 50, 50, 50}; 911 params.padding = new int[]{50, 50, 50, 50};
911 } 912 }
912 }) 913 })
913 .setText("当前无网络,请检查网络设置") 914 .setText("当前无网络,请检查网络设置")
914 .setNegative("继续使用", null) 915 .setNegative("继续使用", null)
915 .setPositive("设置网络", new View.OnClickListener() { 916 .setPositive("设置网络", new View.OnClickListener() {
916 @Override 917 @Override
917 public void onClick(View v) { 918 public void onClick(View v) {
918 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 919 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
919 mContext.startActivity(intent); 920 mContext.startActivity(intent);
920 } 921 }
921 }) 922 })
922 .show(); 923 .show();
923 } 924 }
924 }); 925 });
925 } 926 }
926 927
927 /** 928 /**
928 * 获取个性签名 929 * 获取个性签名
929 * @param mContext 930 * @param mContext
930 * @param userId 931 * @param userId
931 * @param handler 932 * @param handler
932 */ 933 */
933 public void getsignatures(final Context mContext,long userId , final Handler handler) { 934 public void getsignatures(final Context mContext,long userId , final Handler handler) {
934 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 935 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
935 HttpClient.getInstance().get(HttpUrl.getsignature+"?userId="+userId, new AsyncHttpResponseHandler() { 936 HttpClient.getInstance().get(HttpUrl.getsignature+"?userId="+userId, new AsyncHttpResponseHandler() {
936 @Override 937 @Override
937 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 938 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
938 Log.e("test", "个性签名" + new String(arg2)); 939 Log.e("test", "个性签名" + new String(arg2));
939 SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 940 SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据
940 SignInfo.DataBean signInfoBeanList = signInfo.getData(); 941 SignInfo.DataBean signInfoBeanList = signInfo.getData();
941 Message message = Message.obtain(); 942 Message message = Message.obtain();
942 message.what = HttpCode.SIGN; 943 message.what = HttpCode.SIGN;
943 message.obj = signInfoBeanList; 944 message.obj = signInfoBeanList;
944 handler.sendMessage(message); 945 handler.sendMessage(message);
945 946
946 } 947 }
947 948
948 @Override 949 @Override
949 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 950 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
950 Log.e("test", "失败原因" + arg3); 951 Log.e("test", "失败原因" + arg3);
951 new CircleDialog.Builder((FragmentActivity) mContext) 952 new CircleDialog.Builder((FragmentActivity) mContext)
952 .setCanceledOnTouchOutside(false) 953 .setCanceledOnTouchOutside(false)
953 .setCancelable(false) 954 .setCancelable(false)
954 .setWidth(0.5f) 955 .setWidth(0.5f)
955 .configText(new ConfigText() { 956 .configText(new ConfigText() {
956 @Override 957 @Override
957 public void onConfig(TextParams params) { 958 public void onConfig(TextParams params) {
958 params.gravity = Gravity.CENTER; 959 params.gravity = Gravity.CENTER;
959 params.padding = new int[]{50, 50, 50, 50}; 960 params.padding = new int[]{50, 50, 50, 50};
960 } 961 }
961 }) 962 })
962 .setText("当前无网络,请检查网络设置") 963 .setText("当前无网络,请检查网络设置")
963 .setNegative("继续使用", null) 964 .setNegative("继续使用", null)
964 .setPositive("设置网络", new View.OnClickListener() { 965 .setPositive("设置网络", new View.OnClickListener() {
965 @Override 966 @Override
966 public void onClick(View v) { 967 public void onClick(View v) {
967 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 968 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
968 mContext.startActivity(intent); 969 mContext.startActivity(intent);
969 } 970 }
970 }) 971 })
971 .show(); 972 .show();
972 } 973 }
973 }); 974 });
974 } 975 }
975 976
976 /** 977 /**
977 * 用户反馈 978 * 用户反馈
978 * @param mContext 979 * @param mContext
979 * @param object 980 * @param object
980 * @throws UnsupportedEncodingException 981 * @throws UnsupportedEncodingException
981 */ 982 */
982 public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException { 983 public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException {
983 Gson gson = new Gson(); 984 Gson gson = new Gson();
984 String jsonObject = gson.toJson(object); 985 String jsonObject = gson.toJson(object);
985 Log.e("test", "onSuccess" + jsonObject); 986 Log.e("test", "onSuccess" + jsonObject);
986 mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", 987 mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...",
987 false, true, null); 988 false, true, null);
988 ByteArrayEntity entity = null; 989 ByteArrayEntity entity = null;
989 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); 990 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8"));
990 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); 991 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
991 992
992 HttpClient.getInstance().addHeader("Accept", "*/*"); 993 HttpClient.getInstance().addHeader("Accept", "*/*");
993 HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() { 994 HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() {
994 @Override 995 @Override
995 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 996 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
996 super.onSuccess(statusCode, headers, response); 997 super.onSuccess(statusCode, headers, response);
997 closeProgress(); 998 closeProgress();
998 String status = response.optString("status"); 999 String status = response.optString("status");
999 if (status.equals("1")) { 1000 if (status.equals("1")) {
1000 Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show(); 1001 Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show();
1001 ((Activity) mContext).finish(); 1002 ((Activity) mContext).finish();
1002 } 1003 }
1003 Log.e("test", "onSuccess" + response); 1004 Log.e("test", "onSuccess" + response);
1004 1005
1005 } 1006 }
1006 1007
1007 @Override 1008 @Override
1008 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 1009 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
1009 super.onFailure(statusCode, headers, throwable, errorResponse); 1010 super.onFailure(statusCode, headers, throwable, errorResponse);
1010 closeProgress(); 1011 closeProgress();
1011 Log.e("test", "onFailure" + errorResponse); 1012 Log.e("test", "onFailure" + errorResponse);
1012 new CircleDialog.Builder((FragmentActivity) mContext) 1013 new CircleDialog.Builder((FragmentActivity) mContext)
1013 .setCanceledOnTouchOutside(false) 1014 .setCanceledOnTouchOutside(false)
1014 .setCancelable(false) 1015 .setCancelable(false)
1015 .setWidth(0.5f) 1016 .setWidth(0.5f)
1016 .configText(new ConfigText() { 1017 .configText(new ConfigText() {
1017 @Override 1018 @Override
1018 public void onConfig(TextParams params) { 1019 public void onConfig(TextParams params) {
1019 params.gravity = Gravity.CENTER; 1020 params.gravity = Gravity.CENTER;
1020 params.padding = new int[]{50, 50, 50, 50}; 1021 params.padding = new int[]{50, 50, 50, 50};
1021 } 1022 }
1022 }) 1023 })
1023 .setText("当前无网络,请检查网络设置") 1024 .setText("当前无网络,请检查网络设置")
1024 .setNegative("继续使用", null) 1025 .setNegative("继续使用", null)
1025 .setPositive("设置网络", new View.OnClickListener() { 1026 .setPositive("设置网络", new View.OnClickListener() {
1026 @Override 1027 @Override
1027 public void onClick(View v) { 1028 public void onClick(View v) {
1028 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1029 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1029 mContext.startActivity(intent); 1030 mContext.startActivity(intent);
1030 } 1031 }
1031 }) 1032 })
1032 .show(); 1033 .show();
1033 } 1034 }
1034 1035
1035 }); 1036 });
1036 } 1037 }
1037 1038
1039 /**
1040 * 查询子账户信息
1041 * @param mContext
1042 * @param userId
1043 * @param handler
1044 */
1045 public void getchildAccountinfo(final Context mContext, long userId , final Handler handler) {
1046 mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...",
1047 false, true, null);
1048 HttpClient.getInstance().setTimeout(5 * 1000);
1049 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1050 HttpClient.getInstance().get(HttpUrl.childUserURL+ "?userId=" + userId , new AsyncHttpResponseHandler() {
1051 @Override
1052 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1053 closeProgress();
1054 Log.e("test", "子账户信息" + new String(arg2));
1055 ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据
1056 List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData();
1057 Message msg = Message.obtain();
1058 msg.what = HttpCode.CHILDS_SUCESS;
1059 msg.obj = schoolInfoBeanList;
1060 handler.sendMessage(msg);
1061 }
1062
1063 @Override
1064 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1065 closeProgress();
1066 Log.e("test", "错误信息" + new String(arg2));
1067 new CircleDialog.Builder((FragmentActivity) mContext)
1068 .setCanceledOnTouchOutside(false)
1069 .setCancelable(false)
1070 .setWidth(0.5f)
1071 .configText(new ConfigText() {
1072 @Override
1073 public void onConfig(TextParams params) {
1074 params.gravity = Gravity.CENTER;
1075 params.padding = new int[]{50, 50, 50, 50};
1076 }
1077 })
1078 .setText("当前无网络,请检查网络设置")
1079 .setNegative("继续使用", null)
1080 .setPositive("设置网络", new View.OnClickListener() {
1081 @Override
1082 public void onClick(View v) {
1083 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1084 mContext.startActivity(intent);
1085 }
1086 })
1087 .show();
1088 }
1089 });
1090
1091 }
1092
1038 1093
1039 1094
1040 1095
1041 ///省级接口 1096 ///省级接口
1042 public void provices(final Context mContext, final Handler handler) { 1097 public void provices(final Context mContext, final Handler handler) {
1043 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1098 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1044 HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { 1099 HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() {
1045 @Override 1100 @Override
1046 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1101 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1047 Log.e("test", "省" + new String(arg2)); 1102 Log.e("test", "省" + new String(arg2));
1048 ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 1103 ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据
1049 Log.e("test", "状态码" + provinceInfo.getStatus()); 1104 Log.e("test", "状态码" + provinceInfo.getStatus());
1050 List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); 1105 List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces();
1051 Message message = Message.obtain(); 1106 Message message = Message.obtain();
1052 message.what = HttpCode.PROVICES; 1107 message.what = HttpCode.PROVICES;
1053 message.obj = provincesBeanList; 1108 message.obj = provincesBeanList;
1054 handler.sendMessage(message); 1109 handler.sendMessage(message);
1055 1110
1056 } 1111 }
1057 1112
1058 @Override 1113 @Override
1059 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1114 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1060 new CircleDialog.Builder((FragmentActivity) mContext) 1115 new CircleDialog.Builder((FragmentActivity) mContext)
1061 .setCanceledOnTouchOutside(false) 1116 .setCanceledOnTouchOutside(false)
1062 .setCancelable(false) 1117 .setCancelable(false)
1063 .setWidth(0.5f) 1118 .setWidth(0.5f)
1064 .configText(new ConfigText() { 1119 .configText(new ConfigText() {
1065 @Override 1120 @Override
1066 public void onConfig(TextParams params) { 1121 public void onConfig(TextParams params) {
1067 params.gravity = Gravity.CENTER; 1122 params.gravity = Gravity.CENTER;
1068 params.padding = new int[]{50, 50, 50, 50}; 1123 params.padding = new int[]{50, 50, 50, 50};
1069 } 1124 }
1070 }) 1125 })
1071 .setText("当前无网络,请检查网络设置") 1126 .setText("当前无网络,请检查网络设置")
1072 .setNegative("继续使用", null) 1127 .setNegative("继续使用", null)
1073 .setPositive("设置网络", new View.OnClickListener() { 1128 .setPositive("设置网络", new View.OnClickListener() {
1074 @Override 1129 @Override
1075 public void onClick(View v) { 1130 public void onClick(View v) {
1076 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1131 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1077 mContext.startActivity(intent); 1132 mContext.startActivity(intent);
1078 } 1133 }
1079 }) 1134 })
1080 .show(); 1135 .show();
1081 } 1136 }
1082 }); 1137 });
1083 } 1138 }
1084 1139
1085 //市级接口 1140 //市级接口
1086 public void cityinfo(final Context mContext, long regionId , final Handler handler) { 1141 public void cityinfo(final Context mContext, long regionId , final Handler handler) {
1087 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1142 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1088 HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { 1143 HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() {
1089 @Override 1144 @Override
1090 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1145 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1091 Log.e("test", "市" + new String(arg2)); 1146 Log.e("test", "市" + new String(arg2));
1092 Gson gson = new Gson(); 1147 Gson gson = new Gson();
1093 CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); 1148 CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class);
1094 List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); 1149 List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities();
1095 Message message = Message.obtain(); 1150 Message message = Message.obtain();
1096 message.what = HttpCode.CITYS; 1151 message.what = HttpCode.CITYS;
1097 message.obj = cityInfoBeanList; 1152 message.obj = cityInfoBeanList;
1098 handler.sendMessage(message); 1153 handler.sendMessage(message);
1099 1154
1100 1155
1101 } 1156 }
1102 1157
1103 @Override 1158 @Override
1104 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1159 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1105 new CircleDialog.Builder((FragmentActivity) mContext) 1160 new CircleDialog.Builder((FragmentActivity) mContext)
1106 .setCanceledOnTouchOutside(false) 1161 .setCanceledOnTouchOutside(false)
1107 .setCancelable(false) 1162 .setCancelable(false)
1108 .setWidth(0.5f) 1163 .setWidth(0.5f)
1109 .configText(new ConfigText() { 1164 .configText(new ConfigText() {
1110 @Override 1165 @Override
1111 public void onConfig(TextParams params) { 1166 public void onConfig(TextParams params) {
1112 params.gravity = Gravity.CENTER; 1167 params.gravity = Gravity.CENTER;
1113 params.padding = new int[]{50, 50, 50, 50}; 1168 params.padding = new int[]{50, 50, 50, 50};
1114 } 1169 }
1115 }) 1170 })
1116 .setText("当前无网络,请检查网络设置") 1171 .setText("当前无网络,请检查网络设置")
1117 .setNegative("继续使用", null) 1172 .setNegative("继续使用", null)
1118 .setPositive("设置网络", new View.OnClickListener() { 1173 .setPositive("设置网络", new View.OnClickListener() {
1119 @Override 1174 @Override
1120 public void onClick(View v) { 1175 public void onClick(View v) {
1121 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1176 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1122 mContext.startActivity(intent); 1177 mContext.startActivity(intent);
1123 } 1178 }
1124 }) 1179 })
1125 .show(); 1180 .show();
1126 } 1181 }
1127 }); 1182 });
1128 } 1183 }
1129 1184
1130 //区县级接口 1185 //区县级接口
1131 public void countyinfo(final Context mContext, int parentId, final Handler handler) { 1186 public void countyinfo(final Context mContext, int parentId, final Handler handler) {
1132 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1187 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1133 HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { 1188 HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() {
1134 @Override 1189 @Override
1135 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1190 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1136 Log.e("test", "区" + new String(arg2)); 1191 Log.e("test", "区" + new String(arg2));
1137 Gson gson = new Gson(); 1192 Gson gson = new Gson();
1138 CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); 1193 CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class);
1139 List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); 1194 List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties();
1140 Message message = Message.obtain(); 1195 Message message = Message.obtain();
1141 message.what = HttpCode.COUNTRY; 1196 message.what = HttpCode.COUNTRY;
1142 message.obj = countyInfoInfoBeanList; 1197 message.obj = countyInfoInfoBeanList;
1143 handler.sendMessage(message); 1198 handler.sendMessage(message);
1144 1199
1145 1200
1146 } 1201 }
1147 1202
1148 @Override 1203 @Override
1149 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1204 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1150 new CircleDialog.Builder((FragmentActivity) mContext) 1205 new CircleDialog.Builder((FragmentActivity) mContext)
1151 .setCanceledOnTouchOutside(false) 1206 .setCanceledOnTouchOutside(false)
1152 .setCancelable(false) 1207 .setCancelable(false)
1153 .setWidth(0.5f) 1208 .setWidth(0.5f)
1154 .configText(new ConfigText() { 1209 .configText(new ConfigText() {
1155 @Override 1210 @Override
1156 public void onConfig(TextParams params) { 1211 public void onConfig(TextParams params) {
1157 params.gravity = Gravity.CENTER; 1212 params.gravity = Gravity.CENTER;
1158 params.padding = new int[]{50, 50, 50, 50}; 1213 params.padding = new int[]{50, 50, 50, 50};
1159 } 1214 }
1160 }) 1215 })
1161 .setText("当前无网络,请检查网络设置") 1216 .setText("当前无网络,请检查网络设置")
1162 .setNegative("继续使用", null) 1217 .setNegative("继续使用", null)
1163 .setPositive("设置网络", new View.OnClickListener() { 1218 .setPositive("设置网络", new View.OnClickListener() {
1164 @Override 1219 @Override
1165 public void onClick(View v) { 1220 public void onClick(View v) {
1166 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1221 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1167 mContext.startActivity(intent); 1222 mContext.startActivity(intent);
1168 } 1223 }
1169 }) 1224 })
1170 .show(); 1225 .show();
1171 } 1226 }
1172 }); 1227 });
1173 } 1228 }
1174 1229
1175 1230
1176 private void closeProgress() { 1231 private void closeProgress() {
1177 try { 1232 try {
1178 if (mProgress != null) { 1233 if (mProgress != null) {
1179 mProgress.dismiss(); 1234 mProgress.dismiss();
1180 mProgress = null; 1235 mProgress = null;
1181 } 1236 }
1182 } catch (Exception e) { 1237 } catch (Exception e) {
1183 e.printStackTrace(); 1238 e.printStackTrace();
1184 } 1239 }
1185 } 1240 }
1186 1241
1187 } 1242 }
1188 1243
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
1 package com.hjx.personalcenter.http; 1 package com.hjx.personalcenter.http;
2 2
3 /** 3 /**
4 * Created by h on 2017/8/15. 4 * Created by h on 2017/8/15.
5 */ 5 */
6 6
7 public class HttpUrl { 7 public class HttpUrl {
8 private final static String Enviroment = "DEVELOPMENT"; 8 private final static String Enviroment = "DEVELOPMENT";
9 9
10 public static String GetDomain(){ 10 public static String GetDomain(){
11 return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; 11 return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com";
12 } 12 }
13 13
14 public static String loginUrl = GetDomain()+"/user/access_token";//登录 14 public static String loginUrl = GetDomain()+"/user/access_token";//登录
15 public static String schoolUrl = GetDomain()+"/school/get";//学校 15 public static String schoolUrl = GetDomain()+"/school/get";//学校
16 public static String gradesUrl = GetDomain()+"/grades";//年级 16 public static String gradesUrl = GetDomain()+"/grades";//年级
17 public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 17 public static String provinceUrl = GetDomain()+"/ozing/provinces";//省
18 public static String cityUrl = GetDomain()+"/ozing/cities";//市 18 public static String cityUrl = GetDomain()+"/ozing/cities";//市
19 public static String countyUrl = GetDomain()+"/ozing/counties";//区县 19 public static String countyUrl = GetDomain()+"/ozing/counties";//区县
20 public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ 20 public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/
21 public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 21 public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册
22 public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 22 public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码
23 public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 23 public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册
24 public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 24 public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码
25 public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 25 public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息
26 public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 26 public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息
27 public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 27 public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息
28 public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 28 public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写
29 public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 29 public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息
30 public static String getpresonalinfo=GetDomain()+"/personal/get";//修改个人信息 30 public static String getpresonalinfo=GetDomain()+"/personal/get";//修改个人信息
31 public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 31 public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名
32 public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 32 public static String getsignature=GetDomain()+"/signature/info";//获取个性签名
33 public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 33 public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈
34 public static String childUserURL=GetDomain()+"/childUser/info";//用户反馈
35
34 36
35 37
36 38
37 } 39 }
38 40
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/ChildsInfo.java
File was created 1 package com.hjx.personalcenter.model;
2
3 import java.io.Serializable;
4 import java.util.List;
5
6 /**
7 * Created by h on 2017/8/26.
8 */
9
10 public class ChildsInfo implements Serializable {
11
12 /**
13 * status : 1
14 * pageSize : 1
15 * data : [{"region":"郑州","parentId":600,"school":"郑州小学","status":"未使用","name":"李四","grade":"初一","image":"http://hjxprodbucket.oss.aliyuncs.com/aaaaa.jpg","subAccountId":2}]
16 * msg : success
17 * pageNum : 1
18 */
19
20 private int status;
21 private int pageSize;
22 private String msg;
23 private int pageNum;
24 private List<DataBean> data;
25
26 public int getStatus() {
27 return status;
28 }
29
30 public void setStatus(int status) {
31 this.status = status;
32 }
33
34 public int getPageSize() {
35 return pageSize;
36 }
37
38 public void setPageSize(int pageSize) {
39 this.pageSize = pageSize;
40 }
41
42 public String getMsg() {
43 return msg;
44 }
45
46 public void setMsg(String msg) {
47 this.msg = msg;
48 }
49
50 public int getPageNum() {
51 return pageNum;
52 }
53
54 public void setPageNum(int pageNum) {
55 this.pageNum = pageNum;
56 }
57
58 public List<DataBean> getData() {
59 return data;
60 }
61
62 public void setData(List<DataBean> data) {
63 this.data = data;
64 }
65
66 public static class DataBean {
67 /**
68 * region : 郑州
69 * parentId : 600
70 * school : 郑州小学
71 * status : 未使用
72 * name : 李四
73 * grade : 初一
74 * image : http://hjxprodbucket.oss.aliyuncs.com/aaaaa.jpg
75 * subAccountId : 2
76 */
77
78 private String region;
79 private int parentId;
80 private String school;
81 private String status;
82 private String name;
83 private String grade;
84 private String image;
85 private int subAccountId;
86
87 public String getRegion() {
88 return region;
89 }
90
91 public void setRegion(String region) {
92 this.region = region;
93 }
94
95 public int getParentId() {
96 return parentId;
97 }
98
99 public void setParentId(int parentId) {
100 this.parentId = parentId;
101 }
102
103 public String getSchool() {
104 return school;
105 }
106
107 public void setSchool(String school) {
108 this.school = school;
109 }
110
111 public String getStatus() {
112 return status;
113 }
114
115 public void setStatus(String status) {
116 this.status = status;
117 }
118
119 public String getName() {
120 return name;
121 }
122
123 public void setName(String name) {
124 this.name = name;
125 }
126
127 public String getGrade() {
128 return grade;
129 }
130
131 public void setGrade(String grade) {
132 this.grade = grade;
133 }
134
135 public String getImage() {
136 return image;
137 }
138
139 public void setImage(String image) {
140 this.image = image;
141 }
142
143 public int getSubAccountId() {
144 return subAccountId;
145 }
146
147 public void setSubAccountId(int subAccountId) {
148 this.subAccountId = subAccountId;
149 }
150 }
151 }
152
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:orientation="vertical"
4 android:layout_width="match_parent" 3 android:layout_width="match_parent"
5 android:layout_height="match_parent"> 4 android:layout_height="match_parent"
5 android:orientation="vertical">
6
6 <RelativeLayout 7 <RelativeLayout
7 android:id="@+id/title" 8 android:id="@+id/title"
8 android:layout_width="match_parent" 9 android:layout_width="match_parent"
9 android:layout_height="wrap_content" 10 android:layout_height="wrap_content"
10 android:background="@color/login_text_blue" 11 android:background="@color/login_text_blue"
11 android:minHeight="50dp" > 12 android:minHeight="50dp">
12 13
13 <ImageView 14 <ImageView
14 android:id="@+id/cancel" 15 android:id="@+id/cancel"
15 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
16 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
17 android:layout_centerVertical="true" 18 android:layout_centerVertical="true"
18 android:paddingLeft="20dp" 19 android:paddingLeft="20dp"
19 android:paddingRight="20dp" 20 android:paddingRight="20dp"
20 android:src="@mipmap/title_back" /> 21 android:src="@mipmap/title_back" />
21 22
22 <TextView 23 <TextView
23 android:id="@+id/menu_title" 24 android:id="@+id/menu_title"
24 android:layout_width="wrap_content" 25 android:layout_width="wrap_content"
25 android:layout_height="wrap_content" 26 android:layout_height="wrap_content"
26 android:layout_centerInParent="true" 27 android:layout_centerInParent="true"
27 android:text="@string/account_management" 28 android:text="@string/account_management"
28 android:textColor="@android:color/white" 29 android:textColor="@android:color/white"
29 android:textSize="22sp" /> 30 android:textSize="22sp" />
30 </RelativeLayout> 31 </RelativeLayout>
32
31 <LinearLayout 33 <LinearLayout
32 android:layout_width="wrap_content" 34 android:layout_width="wrap_content"
33 android:layout_height="wrap_content" 35 android:layout_height="wrap_content"
34 android:orientation="horizontal"
35 android:layout_margin="20dp" 36 android:layout_margin="20dp"
36 android:gravity="center_vertical"> 37 android:gravity="center_vertical"
38 android:orientation="horizontal">
39
37 <View 40 <View
38 android:layout_width="5dp" 41 android:layout_width="5dp"
39 android:layout_height="20dp" 42 android:layout_height="20dp"
40 android:background="@color/login_text_blue"> 43 android:background="@color/login_text_blue">
41 44
42 </View> 45 </View>
46
43 <TextView 47 <TextView
44 android:layout_width="wrap_content" 48 android:layout_width="wrap_content"
45 android:layout_height="wrap_content" 49 android:layout_height="wrap_content"
46 android:text="账户安全"
47 android:layout_marginLeft="5dp" 50 android:layout_marginLeft="5dp"
48 android:textSize="22sp" 51 android:text="账户安全"
49 /> 52 android:textSize="22sp" />
50 53
51 </LinearLayout> 54 </LinearLayout>
55
52 <LinearLayout 56 <LinearLayout
53 android:layout_width="match_parent" 57 android:layout_width="match_parent"
54 android:layout_height="wrap_content" 58 android:layout_height="wrap_content"
55 android:layout_marginLeft="60dp" 59 android:layout_marginLeft="60dp"
56 android:orientation="vertical"> 60 android:orientation="vertical">
61
57 <LinearLayout 62 <LinearLayout
58 android:layout_width="match_parent" 63 android:layout_width="match_parent"
59 android:layout_height="wrap_content"> 64 android:layout_height="wrap_content">
60 65
61 66
62 <TextView 67 <TextView
63 android:layout_width="0dp" 68 android:layout_width="0dp"
64 android:layout_height="wrap_content" 69 android:layout_height="wrap_content"
65 android:layout_weight="1.5" 70 android:layout_weight="1.5"
66 android:textSize="22sp" 71 android:text="当前绑定手机号"
67 android:text="当前绑定手机号"/> 72 android:textSize="22sp" />
73
68 <TextView 74 <TextView
69 android:id="@+id/cunt_username" 75 android:id="@+id/cunt_username"
70 android:layout_width="0dp" 76 android:layout_width="0dp"
71 android:layout_height="wrap_content" 77 android:layout_height="wrap_content"
72 android:layout_marginLeft="50dp" 78 android:layout_marginLeft="50dp"
73 android:layout_weight="6" 79 android:layout_weight="6"
74 android:textSize="22sp" 80 android:text=""
75 android:text=""/> 81 android:textSize="22sp" />
82
76 <TextView 83 <TextView
77 android:id="@+id/changBangding" 84 android:id="@+id/changBangding"
78 android:layout_width="0dp" 85 android:layout_width="0dp"
79 android:layout_height="wrap_content" 86 android:layout_height="wrap_content"
80 android:layout_weight="1" 87 android:layout_weight="1"
81 android:textSize="22sp" 88 android:text="更换绑定"
82 android:text="更换绑定"/> 89 android:textSize="22sp" />
90
83 <ImageView 91 <ImageView
84 android:layout_width="wrap_content" 92 android:layout_width="wrap_content"
85 android:layout_height="wrap_content" 93 android:layout_height="wrap_content"
86 android:layout_weight="0.1" 94 android:layout_weight="0.1"
87 android:padding="10dp" 95 android:padding="10dp"
88 android:src="@mipmap/youjiantou"/> 96 android:src="@mipmap/youjiantou" />
89 </LinearLayout> 97 </LinearLayout>
98
90 <LinearLayout 99 <LinearLayout
91 android:layout_width="match_parent" 100 android:layout_width="match_parent"
92 android:layout_marginTop="30dp" 101 android:layout_height="wrap_content"
93 android:layout_height="wrap_content"> 102 android:layout_marginTop="30dp">
94 103
95 104
96 <TextView 105 <TextView
97 android:layout_width="0dp" 106 android:layout_width="0dp"
98 android:layout_height="wrap_content" 107 android:layout_height="wrap_content"
99 android:layout_weight="1.5" 108 android:layout_weight="1.5"
100 android:textSize="22sp" 109 android:text="登录密码"
101 android:text="登录密码"/> 110 android:textSize="22sp" />
111
102 <TextView 112 <TextView
103 android:layout_width="0dp" 113 android:layout_width="0dp"
104 android:layout_height="wrap_content" 114 android:layout_height="wrap_content"
105 android:layout_marginLeft="50dp" 115 android:layout_marginLeft="50dp"
106 android:layout_weight="6" 116 android:layout_weight="6"
107 android:textSize="22sp" 117 android:text="已设置"
108 android:text="已设置"/> 118 android:textSize="22sp" />
119
109 <TextView 120 <TextView
110 android:id="@+id/changpassword" 121 android:id="@+id/changpassword"
111 android:layout_width="0dp" 122 android:layout_width="0dp"
112 android:layout_height="wrap_content" 123 android:layout_height="wrap_content"
113 android:layout_weight="1" 124 android:layout_weight="1"
114 android:textSize="22sp" 125 android:text="修改密码"
115 android:text="修改密码"/> 126 android:textSize="22sp" />
127
116 <ImageView 128 <ImageView
117 android:layout_width="wrap_content" 129 android:layout_width="wrap_content"
118 android:layout_height="wrap_content" 130 android:layout_height="wrap_content"
119 android:layout_weight="0.1" 131 android:layout_weight="0.1"
120 android:padding="10dp" 132 android:padding="10dp"
121 android:src="@mipmap/youjiantou"/> 133 android:src="@mipmap/youjiantou" />
122 </LinearLayout> 134 </LinearLayout>
123 135
124 </LinearLayout> 136 </LinearLayout>
125 137
126 <View 138 <View
127 android:layout_width="match_parent" 139 android:layout_width="match_parent"
128 android:layout_margin="20dp"
129 android:layout_height="0.7dp" 140 android:layout_height="0.7dp"
141 android:layout_margin="20dp"
130 android:background="#FF909090" /> 142 android:background="#FF909090" />
143
131 <LinearLayout 144 <LinearLayout
132 android:layout_width="wrap_content" 145 android:layout_width="wrap_content"
133 android:layout_height="wrap_content" 146 android:layout_height="wrap_content"
134 android:orientation="horizontal"
135 android:layout_margin="20dp" 147 android:layout_margin="20dp"
136 android:gravity="center_vertical"> 148 android:gravity="center_vertical"
149 android:orientation="horizontal">
150
137 <View 151 <View
138 android:layout_width="5dp" 152 android:layout_width="5dp"
139 android:layout_height="20dp" 153 android:layout_height="20dp"
140 android:background="@color/login_text_blue"> 154 android:background="@color/login_text_blue">
141 155
142 </View> 156 </View>
157
143 <TextView 158 <TextView
144 android:layout_width="wrap_content" 159 android:layout_width="wrap_content"
145 android:layout_height="wrap_content" 160 android:layout_height="wrap_content"
146 android:text="子账户管理"
147 android:layout_marginLeft="5dp" 161 android:layout_marginLeft="5dp"
148 android:textSize="22sp" 162 android:text="子账户管理"
149 /> 163 android:textSize="22sp" />
150 164
151 </LinearLayout> 165 </LinearLayout>
152 <GridView 166
153 android:id="@+id/gv_accunt" 167 <LinearLayout
154 android:layout_width="match_parent" 168 android:layout_width="match_parent"
155 android:layout_height="wrap_content" 169 android:layout_height="match_parent"
156 android:numColumns="3"> 170 android:layout_marginLeft="30dp"
171 android:orientation="vertical">
172
173 <LinearLayout
174 android:layout_width="match_parent"
175 android:layout_height="wrap_content">
176
177 <LinearLayout
178 android:layout_width="0dp"
179 android:layout_height="wrap_content"
180 android:layout_weight="1">
181
182 <LinearLayout
183 android:layout_width="wrap_content"
184 android:layout_height="wrap_content"
185 android:background="@drawable/corcle_blue_bg"
186 android:orientation="vertical">
187
188 <LinearLayout
189 android:layout_width="match_parent"
190 android:layout_height="wrap_content"
191 android:orientation="horizontal">
192
193 <ImageView
194 android:layout_width="wrap_content"
195 android:layout_height="wrap_content"
196 android:layout_margin="10dp"
197 android:src="@mipmap/header_default" />
157 198
158 </GridView> 199 <LinearLayout
200 android:layout_width="0dp"
201 android:layout_height="wrap_content"
202 android:layout_marginLeft="10dp"
203 android:layout_marginTop="10dp"
204 android:layout_weight="1"
205 android:orientation="vertical">
159 206
207 <TextView
208 android:layout_width="wrap_content"
209 android:layout_height="wrap_content"
210 android:text="删除用户"
211 android:textSize="18sp" />
160 212
213 <TextView
214 android:layout_width="wrap_content"
215 android:layout_height="wrap_content"
216 android:text="使用中"
217 android:textSize="18sp" />
218
219 <TextView
220 android:layout_width="wrap_content"
221 android:layout_height="wrap_content"
222 android:text="删除用户"
223 android:textSize="18sp" />
224
225 <TextView
226 android:layout_width="wrap_content"
227 android:layout_height="wrap_content"
228 android:text="使用中"
229 android:textSize="18sp" />
230
231
232 </LinearLayout>
233
234 <ImageView
235 android:layout_width="wrap_content"
236 android:layout_height="wrap_content"
237 android:layout_gravity="right"
238 android:layout_marginLeft="60dp"
239 android:src="@mipmap/shiyongzhong" />
240
241 </LinearLayout>
242
243 <View
244 android:layout_width="match_parent"
245 android:layout_height="0.7dp"
246 android:layout_margin="10dp"
247 android:background="@color/cutoff_line">
248
249 </View>
250
251 <LinearLayout
252 android:layout_width="match_parent"
253 android:layout_height="wrap_content"
254 android:layout_marginBottom="10dp"
255 android:orientation="horizontal">
256
257 <TextView
258 android:layout_width="0dp"
259 android:layout_height="wrap_content"
260 android:layout_weight="1"
261 android:gravity="center"
262 android:text="删除用户"
263 android:textSize="18sp" />
264
265 <TextView
266 android:layout_width="0dp"
267 android:layout_height="wrap_content"
268 android:layout_weight="1"
269 android:gravity="center"
270 android:text="使用中"
271 android:textSize="18sp" />
272
273
274 </LinearLayout>
275
276 </LinearLayout>
277
278
279 </LinearLayout>
280
281 <LinearLayout
282 android:layout_width="0dp"
283 android:layout_height="wrap_content"
284 android:layout_weight="1">
285
286 </LinearLayout>
287
288 <LinearLayout
289 android:layout_width="0dp"
290 android:layout_height="wrap_content"
291 android:layout_weight="1">
292
293 </LinearLayout>
294 </LinearLayout>
295
296 <LinearLayout
297 android:layout_width="match_parent"
298 android:layout_height="wrap_content"
299 android:orientation="horizontal">
300 <android.support.v7.widget.RecyclerView
301 android:id="@+id/id_recyclerview_horizontal"
302 android:layout_width="wrap_content"
303 android:layout_height="wrap_content"
304 android:layout_centerVertical="true"
305 android:scrollbars="none"
306 >
307 </android.support.v7.widget.RecyclerView>
308 <LinearLayout
309 android:layout_width="wrap_content"
310 android:layout_height="wrap_content"
311 android:background="@drawable/corcle_blue_bg"
312 android:gravity="center">
313 <ImageView
314 android:layout_width="wrap_content"
315 android:layout_height="wrap_content"
316 android:src="@mipmap/jia"/>
317
318 </LinearLayout>
319
320
321
322
PersonalCenter/app/src/main/res/layout/recycler_childaccunt_item_view.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical" android:layout_width="match_parent"
4 android:layout_height="match_parent">
5 <LinearLayout
6 android:layout_width="wrap_content"
7 android:layout_height="wrap_content"
8 android:background="@drawable/corcle_black_bg"
9 android:orientation="vertical">
10
11 <LinearLayout
12 android:layout_width="match_parent"
13 android:layout_height="wrap_content"
14 android:orientation="horizontal">
15
16 <ImageView
17 android:id="@+id/iv_child_head"
18 android:layout_width="wrap_content"
19 android:layout_height="wrap_content"
20 android:layout_margin="10dp"
21 android:src="@mipmap/header_default" />
22
23 <LinearLayout
24 android:layout_width="0dp"
25 android:layout_height="wrap_content"
26 android:layout_marginLeft="10dp"
27 android:layout_marginTop="10dp"
28 android:layout_weight="1"
29 android:orientation="vertical">
30
31 <TextView
32 android:id="@+id/iv_child_name"
33 android:layout_width="wrap_content"
34 android:layout_height="wrap_content"
35 android:text="删除用户"
36 android:textSize="18sp" />
37
38 <TextView
39 android:id="@+id/iv_child_grade"
40 android:layout_width="wrap_content"
41 android:layout_height="wrap_content"
42 android:text="使用中"
43 android:textSize="18sp" />
44
45 <TextView
46 android:id="@+id/iv_child_school"
47 android:layout_width="wrap_content"
48 android:layout_height="wrap_content"
49 android:text="删除用户"
50 android:textSize="18sp" />
51
52 <TextView
53 android:id="@+id/iv_child_adress"
54 android:layout_width="wrap_content"
55 android:layout_height="wrap_content"
56 android:text="使用中"
57 android:textSize="18sp" />
58
59
60 </LinearLayout>
61
62
63 </LinearLayout>
64
65 <View
66 android:layout_width="match_parent"
67 android:layout_height="0.7dp"
68 android:layout_margin="10dp"
69 android:background="@color/cutoff_line">
70
71 </View>
72
73 <LinearLayout
74 android:layout_width="match_parent"
75 android:layout_height="wrap_content"
76 android:layout_marginBottom="10dp"
77 android:orientation="horizontal">
78
79 <TextView
80 android:layout_width="0dp"
81 android:layout_height="wrap_content"
82 android:layout_weight="1"
83 android:gravity="center"
84 android:text="删除用户"
85 android:textSize="18sp" />
86
87 <TextView
88 android:layout_width="0dp"
89 android:layout_height="wrap_content"
90 android:layout_weight="1"
91 android:gravity="center"
92 android:text="切换使用"
93 android:textSize="18sp" />
94
95
96 </LinearLayout>
97
98 </LinearLayout>
99
100 </LinearLayout>
PersonalCenter/app/src/main/res/layout/recycler_item_view.xml
1 <?xml version="1.0" encoding="utf-8"?> File was deleted
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 android:orientation="vertical">
6
7 <LinearLayout
8 android:layout_width="wrap_content"
9 android:layout_height="wrap_content"
10 android:layout_gravity="center"
11 android:gravity="center"
12 android:orientation="vertical">
13
14 <TextView
15 android:id="@+id/item_text"
16 android:layout_width="wrap_content"
17 android:layout_height="wrap_content"
18 android:text="test"
19 android:textColor="@android:color/black"
20 android:textSize="36sp" />
21
22 <Button
23 android:id="@+id/item_button"
24 android:layout_width="wrap_content"
25 android:layout_height="wrap_content"
26 android:layout_marginTop="36dp"
27 android:text="下一页"
28 android:textSize="24sp" />
29 </LinearLayout>
30 </LinearLayout>
PersonalCenter/app/src/main/res/layout/recycler_study_tem_view.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 android:orientation="vertical">
6
7 <LinearLayout
8 android:layout_width="wrap_content"
9 android:layout_height="wrap_content"
10 android:layout_gravity="center"
11 android:gravity="center"
12 android:orientation="vertical">
13
14 <TextView
15 android:id="@+id/item_text"
16 android:layout_width="wrap_content"
17 android:layout_height="wrap_content"
18 android:text="test"
19 android:textColor="@android:color/black"
20 android:textSize="36sp" />
21
22 <Button
23 android:id="@+id/item_button"
24 android:layout_width="wrap_content"
25 android:layout_height="wrap_content"
26 android:layout_marginTop="36dp"
27 android:text="下一页"
28 android:textSize="24sp" />
29 </LinearLayout>
30 </LinearLayout>
PersonalCenter/app/src/main/res/mipmap-xhdpi/jia.png

505 Bytes

PersonalCenter/app/src/main/res/mipmap-xhdpi/shiyongzhong.png

2.22 KB