Commit 9cbee19cbb8fc093db454cc30043994824839f7d

Authored by xiongwei
1 parent 2338cf4c22
Exists in master

子账户的添加,修改,删除,查询等接口调试

Showing 18 changed files with 541 additions and 150 deletions   Show diff stats
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;
4 import android.content.Intent; 3 import android.content.Intent;
5 import android.os.Bundle; 4 import android.os.Bundle;
6 import android.os.Handler; 5 import android.os.Handler;
7 import android.os.Message; 6 import android.os.Message;
7 import android.support.v7.app.AppCompatActivity;
8 import android.support.v7.widget.LinearLayoutManager; 8 import android.support.v7.widget.LinearLayoutManager;
9 import android.support.v7.widget.RecyclerView; 9 import android.support.v7.widget.RecyclerView;
10 import android.view.View; 10 import android.view.View;
11 import android.widget.ImageView;
12 import android.widget.LinearLayout;
11 import android.widget.TextView; 13 import android.widget.TextView;
12 14
13 import com.hjx.personalcenter.R; 15 import com.hjx.personalcenter.R;
14 import com.hjx.personalcenter.adapter.AccountChildsAdapter; 16 import com.hjx.personalcenter.adapter.AccountChildsAdapter;
17 import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem;
15 import com.hjx.personalcenter.db.Content; 18 import com.hjx.personalcenter.db.Content;
16 import com.hjx.personalcenter.db.SaveParam; 19 import com.hjx.personalcenter.db.SaveParam;
17 import com.hjx.personalcenter.http.HttpCode; 20 import com.hjx.personalcenter.http.HttpCode;
18 import com.hjx.personalcenter.http.HttpManager; 21 import com.hjx.personalcenter.http.HttpManager;
19 import com.hjx.personalcenter.model.ChildsInfo; 22 import com.hjx.personalcenter.model.ChildsInfo;
20 23
21 import java.util.ArrayList; 24 import java.util.ArrayList;
22 import java.util.List; 25 import java.util.List;
23 26
24 /**账户管理 熊巍 27 /**账户管理 熊巍
25 * Created by h on 2017/8/12. 28 * Created by h on 2017/8/12.
26 */ 29 */
27 30
28 public class AccountManagementActivity extends Activity implements View.OnClickListener { 31 public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener {
29 private TextView changbangding,changpassword,usernames; 32 private TextView changbangding,changpassword,usernames,
33 tv_username,tv_grade,tv_school,tv_adress, tv_delete;
34 private ImageView iv_account_head,cancel;
30 private RecyclerView listview; 35 private RecyclerView listview;
36 private LinearLayout add_accunt;
31 private AccountChildsAdapter childsAdapter; 37 private AccountChildsAdapter childsAdapter;
32 private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); 38 private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>();
33 Handler handler = new Handler(){ 39 Handler handler = new Handler(){
34 @Override 40 @Override
35 public void handleMessage(Message msg) { 41 public void handleMessage(Message msg) {
36 super.handleMessage(msg); 42 super.handleMessage(msg);
37 switch (msg.what){ 43 switch (msg.what){
38 case HttpCode.CHILDS_SUCESS: 44 case HttpCode.CHILDS_SUCESS:
39 data.clear(); 45 data.clear();
40 data.addAll( (List<ChildsInfo.DataBean>)msg.obj); 46 data.addAll( (List<ChildsInfo.DataBean>)msg.obj);
41 childsAdapter.notifyDataSetChanged(); 47 childsAdapter.notifyDataSetChanged();
42 break; 48 break;
43 } 49 }
44 } 50 }
45 }; 51 };
46 @Override 52 @Override
47 protected void onCreate(Bundle savedInstanceState) { 53 protected void onCreate(Bundle savedInstanceState) {
48 super.onCreate(savedInstanceState); 54 super.onCreate(savedInstanceState);
49 setContentView(R.layout.activity_account_management); 55 setContentView(R.layout.activity_account_management);
50 HttpManager.getInstance().getchildAccountinfo(this,600,handler); 56 String userID = SaveParam.getInstance().getLoginParam(this,"userId");
57 try {
58 long auserID = Long.parseLong(userID);
59 HttpManager.getInstance().getchildAccountinfo(this,auserID,handler);
60
61 } catch (NumberFormatException e) {
62 e.printStackTrace();
63 }
64
51 initView(); 65 initView();
52 initData(); 66 initData();
53 initLister(); 67 initLister();
54 } 68 }
55 69
56 private void initView() { 70 private void initView() {
57 changbangding = (TextView) findViewById(R.id.changBangding); 71 changbangding = (TextView) findViewById(R.id.changBangding);
58 changpassword = (TextView) findViewById(R.id.changpassword); 72 changpassword = (TextView) findViewById(R.id.changpassword);
59 usernames = (TextView) findViewById(R.id.cunt_username); 73 usernames = (TextView) findViewById(R.id.cunt_username);
74 tv_username = (TextView) findViewById(R.id.tv_account_name);
75 tv_grade = (TextView) findViewById(R.id.tv_account_grade);
76 tv_school = (TextView) findViewById(R.id.tv_account_school);
77 tv_adress = (TextView) findViewById(R.id.tv_account_adress);
78 tv_delete = (TextView) findViewById(R.id.tv_account_delete);
79 iv_account_head = (ImageView) findViewById(R.id.tv_account_head);
80 cancel = (ImageView) findViewById(R.id.cancel);
81 add_accunt = (LinearLayout) findViewById(R.id.add_account);
82
83
60 listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); 84 listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal);
61 } 85 }
62 86
63 private void initData() { 87 private void initData() {
64 String cunt_username = SaveParam.getInstance().getLoginParam(this,"cunt_username"); 88 String cunt_username = SaveParam.getInstance().getLoginParam(this,"username");
89 String tv_usernames = SaveParam.getInstance().getLoginParam(this,SaveParam.USERNAME);
90 String tv_grades = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADES);
91 String tv_schools = SaveParam.getInstance().getLoginParam(this,SaveParam.SCHOOL);
92 String tv_adresss = SaveParam.getInstance().getLoginParam(this,SaveParam.ADRESS);
65 usernames.setText(cunt_username); 93 usernames.setText(cunt_username);
94 tv_username.setText(tv_usernames);
95 tv_grade.setText(tv_grades);
96 tv_school.setText(tv_schools);
97 tv_adress.setText(tv_adresss);
98
66 LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); 99 LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
67 linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); 100 linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
68 listview.setLayoutManager(linearLayoutManager); 101 listview.setLayoutManager(linearLayoutManager);
69 childsAdapter = new AccountChildsAdapter(data,this); 102 childsAdapter = new AccountChildsAdapter(data,this);
103 listview.addItemDecoration(new RecyclerViewSpaceItem(10));
70 listview.setAdapter(childsAdapter); 104 listview.setAdapter(childsAdapter);
71 105
72 } 106 }
73 107
74 private void initLister() { 108 private void initLister() {
75 changbangding.setOnClickListener(this); 109 changbangding.setOnClickListener(this);
76 changpassword.setOnClickListener(this); 110 changpassword.setOnClickListener(this);
111 tv_delete.setOnClickListener(this);
112 cancel.setOnClickListener(this);
113 add_accunt.setOnClickListener(this);
77 114
78 115
79 } 116 }
80 117
81 @Override 118 @Override
82 public void onClick(View v) { 119 public void onClick(View v) {
83 switch (v.getId()){ 120 switch (v.getId()){
84 case R.id.changBangding: 121 case R.id.changBangding:
85 Intent changebangding = new Intent(); 122 Intent changebangding = new Intent();
86 changebangding.setClass(AccountManagementActivity.this,ChangeBangDingActivity.class); 123 changebangding.setClass(AccountManagementActivity.this,ChangeBangDingActivity.class);
87 startActivity(changebangding); 124 startActivity(changebangding);
88 overridePendingTransition(R.anim.rightin, R.anim.rightout); 125 overridePendingTransition(R.anim.rightin, R.anim.rightout);
89 break; 126 break;
90 case R.id.changpassword: 127 case R.id.changpassword:
91 Content.authcodeflag = 1; 128 Content.authcodeflag = 1;
92 Intent changpwd = new Intent(); 129 Intent changpwd = new Intent();
93 changpwd.setClass(AccountManagementActivity.this,ChangePasswordActivity.class); 130 changpwd.setClass(AccountManagementActivity.this,ChangePasswordActivity.class);
94 startActivity(changpwd); 131 startActivity(changpwd);
95 overridePendingTransition(R.anim.rightin, R.anim.rightout); 132 overridePendingTransition(R.anim.rightin, R.anim.rightout);
96 break; 133 break;
134 case R.id.add_account:
135
136 Content.accountflag = 2;
137 Intent account = new Intent();
138 account.setClass(AccountManagementActivity.this,RegisterInfoActivity.class);
139 startActivity(account);
140 overridePendingTransition(R.anim.rightin, R.anim.rightout);
141
142 break;
143 case R.id.cancel:
144 finish();
145 break;
97 } 146 }
98 147
99 } 148 }
100 } 149 }
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.content.Intent; 4 import android.content.Intent;
5 import android.content.pm.PackageManager; 5 import android.content.pm.PackageManager;
6 import android.net.Uri; 6 import android.net.Uri;
7 import android.os.Build; 7 import android.os.Build;
8 import android.os.Bundle; 8 import android.os.Bundle;
9 import android.os.Handler; 9 import android.os.Handler;
10 import android.os.Message; 10 import android.os.Message;
11 import android.provider.MediaStore; 11 import android.provider.MediaStore;
12 import android.support.annotation.NonNull; 12 import android.support.annotation.NonNull;
13 import android.support.v4.content.FileProvider; 13 import android.support.v4.content.FileProvider;
14 import android.support.v7.app.AppCompatActivity; 14 import android.support.v7.app.AppCompatActivity;
15 import android.support.v7.widget.LinearLayoutManager; 15 import android.support.v7.widget.LinearLayoutManager;
16 import android.support.v7.widget.RecyclerView; 16 import android.support.v7.widget.RecyclerView;
17 import android.view.KeyEvent;
17 import android.view.View; 18 import android.view.View;
18 import android.widget.ImageView; 19 import android.widget.ImageView;
19 import android.widget.LinearLayout; 20 import android.widget.LinearLayout;
20 import android.widget.TextView; 21 import android.widget.TextView;
21 import android.widget.Toast; 22 import android.widget.Toast;
22 23
23 import com.facebook.drawee.backends.pipeline.Fresco; 24 import com.facebook.drawee.backends.pipeline.Fresco;
24 import com.facebook.drawee.generic.GenericDraweeHierarchy; 25 import com.facebook.drawee.generic.GenericDraweeHierarchy;
25 import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; 26 import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
26 import com.facebook.drawee.generic.RoundingParams; 27 import com.facebook.drawee.generic.RoundingParams;
27 import com.facebook.drawee.interfaces.DraweeController; 28 import com.facebook.drawee.interfaces.DraweeController;
28 import com.facebook.drawee.view.SimpleDraweeView; 29 import com.facebook.drawee.view.SimpleDraweeView;
29 import com.hjx.personalcenter.R; 30 import com.hjx.personalcenter.R;
30 import com.hjx.personalcenter.adapter.RecyclerViewAdapter; 31 import com.hjx.personalcenter.adapter.GalleryAdapter;
31 import com.hjx.personalcenter.customdialog.HeadDialog; 32 import com.hjx.personalcenter.customdialog.HeadDialog;
32 import com.hjx.personalcenter.db.SaveParam; 33 import com.hjx.personalcenter.db.SaveParam;
33 import com.hjx.personalcenter.http.HttpCode; 34 import com.hjx.personalcenter.http.HttpCode;
34 import com.hjx.personalcenter.http.HttpManager; 35 import com.hjx.personalcenter.http.HttpManager;
35 import com.hjx.personalcenter.interfaces.DialogCallBack; 36 import com.hjx.personalcenter.interfaces.DialogCallBack;
36 import com.hjx.personalcenter.model.PesonalInfo; 37 import com.hjx.personalcenter.model.PesonalInfo;
37 import com.hjx.personalcenter.model.SignInfo; 38 import com.hjx.personalcenter.model.SignInfo;
38 import com.hjx.personalcenter.util.AlertUtils; 39 import com.hjx.personalcenter.util.AlertUtils;
39 import com.hjx.personalcenter.util.CropUtils; 40 import com.hjx.personalcenter.util.CropUtils;
40 import com.hjx.personalcenter.util.DialogPermission; 41 import com.hjx.personalcenter.util.DialogPermission;
41 import com.hjx.personalcenter.util.FileUtil; 42 import com.hjx.personalcenter.util.FileUtil;
42 import com.hjx.personalcenter.util.PermissionUtil; 43 import com.hjx.personalcenter.util.PermissionUtil;
43 import com.hjx.personalcenter.util.SharedPreferenceMark; 44 import com.hjx.personalcenter.util.SharedPreferenceMark;
44 import com.mylhyl.circledialog.CircleDialog; 45 import com.mylhyl.circledialog.CircleDialog;
45 import com.mylhyl.circledialog.callback.ConfigInput; 46 import com.mylhyl.circledialog.callback.ConfigInput;
46 import com.mylhyl.circledialog.params.InputParams; 47 import com.mylhyl.circledialog.params.InputParams;
47 import com.mylhyl.circledialog.view.listener.OnInputClickListener; 48 import com.mylhyl.circledialog.view.listener.OnInputClickListener;
48 import com.zaaach.toprightmenu.MenuItem; 49 import com.zaaach.toprightmenu.MenuItem;
49 import com.zaaach.toprightmenu.TopRightMenu; 50 import com.zaaach.toprightmenu.TopRightMenu;
50 51
51 import java.io.File; 52 import java.io.File;
52 import java.util.ArrayList; 53 import java.util.ArrayList;
54 import java.util.Arrays;
53 import java.util.List; 55 import java.util.List;
54 56
55 public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { 57 public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView {
56 private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; 58 private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex;
57 private TextView tv_edit_presoninfo, tv_sign, 59 private TextView tv_edit_presoninfo, tv_sign,
58 tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, 60 tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday,
59 tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; 61 tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender;
60 private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; 62 private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass;
61 private TopRightMenu mTopRightMenu; 63 private TopRightMenu mTopRightMenu;
62 //水平滑动 64 //水平滑动
63 private RecyclerView mRecyclerView; 65 private RecyclerView mRecyclerView;
64 private RecyclerViewAdapter RecyclerViewadapter; 66 private GalleryAdapter RecyclerViewadapter;
67 private List<Integer> mDatas = new ArrayList<Integer>(Arrays.asList(R.mipmap.default_avatar2,
68 R.mipmap.default_avatar2, R.mipmap.default_avatar2, R.mipmap.default_avatar2));
65 private boolean showIcon = true; 69 private boolean showIcon = true;
66 private boolean dimBg = true; 70 private boolean dimBg = true;
67 private boolean needAnim = true; 71 private boolean needAnim = true;
68 private static final int REQUEST_CODE_TAKE_PHOTO = 1; 72 private static final int REQUEST_CODE_TAKE_PHOTO = 1;
69 private static final int REQUEST_CODE_ALBUM = 2; 73 private static final int REQUEST_CODE_ALBUM = 2;
70 private static final int REQUEST_CODE_CROUP_PHOTO = 3; 74 private static final int REQUEST_CODE_CROUP_PHOTO = 3;
71 SimpleDraweeView mSimpleDraweeView; 75 SimpleDraweeView mSimpleDraweeView;
72 private File file; 76 private File file;
73 private Uri uri; 77 private Uri uri;
74 Handler handler = new Handler(){ 78 Handler handler = new Handler(){
75 @Override 79 @Override
76 public void handleMessage(Message msg) { 80 public void handleMessage(Message msg) {
77 super.handleMessage(msg); 81 super.handleMessage(msg);
78 switch (msg.what){ 82 switch (msg.what){
79 case HttpCode.GETINFO: 83 case HttpCode.GETINFO:
80 PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; 84 PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj;
81 tv_username.setText(cardinfoBean.getNickName()); 85 tv_username.setText(cardinfoBean.getNickName());
82 tv_username1.setText(cardinfoBean.getNickName()); 86 tv_username1.setText(cardinfoBean.getNickName());
83 tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); 87 tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName());
84 tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); 88 tv_useinfo_birthday.setText(cardinfoBean.getBirthday());
85 tv_useinfo_qq.setText(cardinfoBean.getQq()); 89 tv_useinfo_qq.setText(cardinfoBean.getQq());
86 tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); 90 tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName());
87 tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); 91 tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName());
88 String sex = cardinfoBean.getGender(); 92 String sex = cardinfoBean.getGender();
89 if ("0".equals(sex)){ 93 if ("0".equals(sex)){
90 tv_sex.setText("男"); 94 tv_sex.setText("男");
91 iv_sex.setImageResource(R.mipmap.men); 95 iv_sex.setImageResource(R.mipmap.men);
92 }else { 96 }else {
93 tv_sex.setText("女"); 97 tv_sex.setText("女");
94 iv_sex.setImageResource(R.mipmap.women); 98 iv_sex.setImageResource(R.mipmap.women);
95 } 99 }
96 break; 100 break;
97 case HttpCode.SIGN: 101 case HttpCode.SIGN:
98 SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; 102 SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj;
99 if (dataBean.getSignature()==null){ 103 if (dataBean.getSignature()==null){
100 tv_sign.setText("你还未设置个性签名"); 104 tv_sign.setText("你还未设置个性签名");
101 }else { 105 }else {
102 tv_sign.setText(dataBean.getSignature()); 106 tv_sign.setText(dataBean.getSignature());
103 } 107 }
104 108
105 break; 109 break;
106 } 110 }
107 } 111 }
108 }; 112 };
109 113
110 @Override 114 @Override
111 protected void onCreate(Bundle savedInstanceState) { 115 protected void onCreate(Bundle savedInstanceState) {
112 super.onCreate(savedInstanceState); 116 super.onCreate(savedInstanceState);
113 Fresco.initialize(this); 117 Fresco.initialize(this);
114 setContentView(R.layout.activity_main); 118 setContentView(R.layout.activity_main);
115 initView(); 119 initView();
116 initData(); 120 initData();
117 initLister(); 121 initLister();
118 } 122 }
119 123
120 private void initView() { 124 private void initView() {
121 iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); 125 iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan);
122 iv_look_card = (ImageView) findViewById(R.id.iv_look_card); 126 iv_look_card = (ImageView) findViewById(R.id.iv_look_card);
123 tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); 127 tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo);
124 iv_setting = (ImageView) findViewById(R.id.iv_setting); 128 iv_setting = (ImageView) findViewById(R.id.iv_setting);
125 iv_sign = (ImageView) findViewById(R.id.iv_sign); 129 iv_sign = (ImageView) findViewById(R.id.iv_sign);
126 tv_sign = (TextView) findViewById(R.id.tv_sign); 130 tv_sign = (TextView) findViewById(R.id.tv_sign);
127 //头像 131 //头像
128 mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); 132 mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head);
129 //初始化个人信息 133 //初始化个人信息
130 iv_sex = (ImageView) findViewById(R.id.iv_sex); 134 iv_sex = (ImageView) findViewById(R.id.iv_sex);
131 tv_username = (TextView) findViewById(R.id.tv_username); 135 tv_username = (TextView) findViewById(R.id.tv_username);
132 tv_username1 = (TextView) findViewById(R.id.tv_username1); 136 tv_username1 = (TextView) findViewById(R.id.tv_username1);
133 tv_mygad = (TextView) findViewById(R.id.tv_mygad); 137 tv_mygad = (TextView) findViewById(R.id.tv_mygad);
134 tv_sex = (TextView) findViewById(R.id.tv_sex); 138 tv_sex = (TextView) findViewById(R.id.tv_sex);
135 tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); 139 tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress);
136 tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); 140 tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday);
137 tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); 141 tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq);
138 tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); 142 tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school);
139 tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); 143 tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender);
140 //跳转其他应用 144 //跳转其他应用
141 linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); 145 linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti);
142 linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); 146 linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote);
143 linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); 147 linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege);
144 linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); 148 linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass);
145 // 149 //
146 mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); 150 mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal);
147 151
148 } 152 }
149 153
154
150 private void initData() { 155 private void initData() {
151 //加载最近学习视频 156 //加载最近学习视频
152 List<String> datas = new ArrayList<>(); 157
153 datas.add("LiMing"); 158
154 datas.add("XiaoMing"); 159 //设置布局管理器
155 datas.add("HanMeiMei");
156 LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); 160 LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
157 linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); 161 linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
158 mRecyclerView.setLayoutManager(linearLayoutManager); 162 mRecyclerView.setLayoutManager(linearLayoutManager);
159 RecyclerViewadapter = new RecyclerViewAdapter(this, datas); 163 //设置适配器
164 RecyclerViewadapter = new GalleryAdapter(this, mDatas);
160 mRecyclerView.setAdapter(RecyclerViewadapter); 165 mRecyclerView.setAdapter(RecyclerViewadapter);
166
161 //加载个人信息 167 //加载个人信息
162 String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); 168 String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION);
163 if (xiongzuo==null){ 169 if (xiongzuo==null){
164 tv_mygad.setText(""); 170 tv_mygad.setText("");
165 }else { 171 }else {
166 tv_mygad.setText(xiongzuo); 172 tv_mygad.setText(xiongzuo);
167 } 173 }
168 //加载版本信息 174 //加载版本信息
169 175
170 176
171 //获取个性签名 177 //获取个性签名
172 String userID = SaveParam.getInstance().getLoginParam(this,"userId"); 178 String userID = SaveParam.getInstance().getLoginParam(this,"userId");
173 try { 179 try {
174 long auserID = Long.parseLong(userID); 180 long auserID = Long.parseLong(userID);
175 HttpManager.getInstance().getsignatures(MainActivity.this,auserID,handler); 181 HttpManager.getInstance().getsignatures(MainActivity.this,auserID,handler);
176 182
177 } catch (NumberFormatException e) { 183 } catch (NumberFormatException e) {
178 e.printStackTrace(); 184 e.printStackTrace();
179 } 185 }
180 186
181 187
182 188
183 //初始化图片 189 //初始化图片
184 file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); 190 file = new File(FileUtil.getCachePath(this), "user-avatar.jpg");
185 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { 191 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
186 uri = Uri.fromFile(file); 192 uri = Uri.fromFile(file);
187 } else { 193 } else {
188 //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) 194 //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问)
189 uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); 195 uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file);
190 } 196 }
191 197
192 } 198 }
193 199
194 private void initLister() { 200 private void initLister() {
195 iv_imformatioan.setOnClickListener(this); 201 iv_imformatioan.setOnClickListener(this);
196 iv_look_card.setOnClickListener(this); 202 iv_look_card.setOnClickListener(this);
197 tv_edit_presoninfo.setOnClickListener(this); 203 tv_edit_presoninfo.setOnClickListener(this);
198 iv_setting.setOnClickListener(this); 204 iv_setting.setOnClickListener(this);
199 iv_sign.setOnClickListener(this); 205 iv_sign.setOnClickListener(this);
200 mSimpleDraweeView.setOnClickListener(this); 206 mSimpleDraweeView.setOnClickListener(this);
201 linel_mycuoti.setOnClickListener(this); 207 linel_mycuoti.setOnClickListener(this);
202 linel_mynote.setOnClickListener(this); 208 linel_mynote.setOnClickListener(this);
203 linel_mycollege.setOnClickListener(this); 209 linel_mycollege.setOnClickListener(this);
204 linel_myclass.setOnClickListener(this); 210 linel_myclass.setOnClickListener(this);
205 211
206 } 212 }
207 213
208 @Override 214 @Override
209 public void onClick(View v) { 215 public void onClick(View v) {
210 switch (v.getId()) { 216 switch (v.getId()) {
211 case R.id.iv_imformatioan: 217 case R.id.iv_imformatioan:
212 Intent intent = new Intent(); 218 Intent intent = new Intent();
213 intent.setClass(MainActivity.this, FeedBackActivity.class); 219 intent.setClass(MainActivity.this, FeedBackActivity.class);
214 startActivity(intent); 220 startActivity(intent);
215 overridePendingTransition(R.anim.rightin, R.anim.rightout); 221 overridePendingTransition(R.anim.rightin, R.anim.rightout);
216 break; 222 break;
217 case R.id.iv_look_card: 223 case R.id.iv_look_card:
218 Intent lookintent = new Intent(); 224 Intent lookintent = new Intent();
219 lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); 225 lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class);
220 startActivity(lookintent); 226 startActivity(lookintent);
221 overridePendingTransition(R.anim.rightin, R.anim.rightout); 227 overridePendingTransition(R.anim.rightin, R.anim.rightout);
222 break; 228 break;
223 case R.id.tv_edit_presoninfo: 229 case R.id.tv_edit_presoninfo:
224 Intent editintent = new Intent(); 230 Intent editintent = new Intent();
225 editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); 231 editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class);
226 startActivity(editintent); 232 startActivity(editintent);
227 overridePendingTransition(R.anim.rightin, R.anim.rightout); 233 overridePendingTransition(R.anim.rightin, R.anim.rightout);
228 break; 234 break;
229 case R.id.iv_head: 235 case R.id.iv_head:
230 HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); 236 HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog");
231 break; 237 break;
232 case R.id.iv_setting: 238 case R.id.iv_setting:
233 mTopRightMenu = new TopRightMenu(MainActivity.this); 239 mTopRightMenu = new TopRightMenu(MainActivity.this);
234 List<MenuItem> menuItems = new ArrayList<>(); 240 List<MenuItem> menuItems = new ArrayList<>();
235 menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); 241 menuItems.add(new MenuItem(R.mipmap.blank, "切换账户"));
236 menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); 242 menuItems.add(new MenuItem(R.mipmap.blank, "账户管理"));
237 mTopRightMenu 243 mTopRightMenu
238 .setHeight(150) //默认高度480 244 .setHeight(150) //默认高度480
239 .setWidth(320) //默认宽度wrap_content 245 .setWidth(320) //默认宽度wrap_content
240 .showIcon(showIcon) //显示菜单图标,默认为true 246 .showIcon(showIcon) //显示菜单图标,默认为true
241 .dimBackground(dimBg) //背景变暗,默认为true 247 .dimBackground(dimBg) //背景变暗,默认为true
242 .needAnimationStyle(needAnim) //显示动画,默认为true 248 .needAnimationStyle(needAnim) //显示动画,默认为true
243 .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE 249 .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE
244 .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { 250 .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() {
245 @Override 251 @Override
246 public void onMenuItemClick(int position) { 252 public void onMenuItemClick(int position) {
247 switch (position) { 253 switch (position) {
248 case 0: 254 case 0:
249 //清除数据 255 //清除数据
250 SaveParam.getInstance().clearData(MainActivity.this); 256 SaveParam.getInstance().clearData(MainActivity.this);
251 Intent settingintent = new Intent(); 257 Intent settingintent = new Intent();
252 settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); 258 settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class);
253 startActivity(settingintent); 259 startActivity(settingintent);
254 overridePendingTransition(R.anim.rightin, R.anim.rightout); 260 overridePendingTransition(R.anim.rightin, R.anim.rightout);
255 break; 261 break;
256 case 1: 262 case 1:
257 Intent accontMintent = new Intent(); 263 Intent accontMintent = new Intent();
258 accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); 264 accontMintent.setClass(MainActivity.this, AccountManagementActivity.class);
259 startActivity(accontMintent); 265 startActivity(accontMintent);
260 overridePendingTransition(R.anim.rightin, R.anim.rightout); 266 overridePendingTransition(R.anim.rightin, R.anim.rightout);
261 break; 267 break;
262 } 268 }
263 } 269 }
264 }) 270 })
265 .addMenuList(menuItems) 271 .addMenuList(menuItems)
266 .showAsDropDown(iv_setting, -250, 0); 272 .showAsDropDown(iv_setting, -250, 0);
267 break; 273 break;
268 case R.id.iv_sign: 274 case R.id.iv_sign:
269 new CircleDialog.Builder(this) 275 new CircleDialog.Builder(this)
270 .setCanceledOnTouchOutside(false) 276 .setCanceledOnTouchOutside(false)
271 .setCancelable(true) 277 .setCancelable(true)
272 .setTitle("个性签名") 278 .setTitle("个性签名")
273 .setInputHint("请输入个性签名") 279 .setInputHint("请输入个性签名")
274 .setWidth(0.5f) 280 .setWidth(0.5f)
275 .configInput(new ConfigInput() { 281 .configInput(new ConfigInput() {
276 @Override 282 @Override
277 public void onConfig(InputParams params) { 283 public void onConfig(InputParams params) {
278 // params.inputBackgroundResourceId = R.drawable.bg_input; 284 // params.inputBackgroundResourceId = R.drawable.bg_input;
279 } 285 }
280 }) 286 })
281 .setNegative("取消", null) 287 .setNegative("取消", null)
282 .setPositiveInput("确定", new OnInputClickListener() { 288 .setPositiveInput("确定", new OnInputClickListener() {
283 @Override 289 @Override
284 public void onClick(String text, View v) { 290 public void onClick(String text, View v) {
285 if (text.equals("")) { 291 if (text.equals("")) {
286 AlertUtils.showToast(MainActivity.this, "请输入个性签名"); 292 AlertUtils.showToast(MainActivity.this, "请输入个性签名");
287 } else { 293 } else {
288 try { 294 try {
289 String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); 295 String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId");
290 long auserID = Long.parseLong(userID); 296 long auserID = Long.parseLong(userID);
291 HttpManager.getInstance().changsignature(MainActivity.this,auserID,text); 297 HttpManager.getInstance().changsignature(MainActivity.this,auserID,text);
292 } catch (NumberFormatException e) { 298 } catch (NumberFormatException e) {
293 e.printStackTrace(); 299 e.printStackTrace();
294 } 300 }
295 301
296 tv_sign.setText(text); 302 tv_sign.setText(text);
297 } 303 }
298 304
299 } 305 }
300 }) 306 })
301 .show(); 307 .show();
302 break; 308 break;
303 case R.id.linel_mycuoti: 309 case R.id.linel_mycuoti:
304 AlertUtils.showToast(this, "hhahahah "); 310 AlertUtils.showToast(this, "hhahahah ");
305 break; 311 break;
306 case R.id.linel_mynote: 312 case R.id.linel_mynote:
307 AlertUtils.showToast(this, "hhahahah "); 313 AlertUtils.showToast(this, "hhahahah ");
308 break; 314 break;
309 case R.id.linel_mycollege: 315 case R.id.linel_mycollege:
310 AlertUtils.showToast(this, "hhahahah "); 316 AlertUtils.showToast(this, "hhahahah ");
311 break; 317 break;
312 case R.id.linel_myclass: 318 case R.id.linel_myclass:
313 AlertUtils.showToast(this, "hhahahah "); 319 AlertUtils.showToast(this, "hhahahah ");
314 break; 320 break;
315 } 321 }
316 322
317 } 323 }
318 324
319 @Override 325 @Override
320 protected void onResume() { 326 protected void onResume() {
321 super.onResume(); 327 super.onResume();
322 String userID = SaveParam.getInstance().getLoginParam(this,"userId"); 328 String userID = SaveParam.getInstance().getLoginParam(this,"userId");
323 try { 329 try {
324 long auserID = Long.parseLong(userID); 330 long auserID = Long.parseLong(userID);
325 //获取个人信息 331 //获取个人信息
326 HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,handler); 332 HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,handler);
327 333
328 } catch (NumberFormatException e) { 334 } catch (NumberFormatException e) {
329 e.printStackTrace(); 335 e.printStackTrace();
330 } 336 }
331 337
332 } 338 }
333 339
334 //回调头像监听 340 //回调头像监听
335 @Override 341 @Override
336 public void heard(Context context, View v,int headpitiaon) { 342 public void heard(Context context, View v,int headpitiaon) {
337 switch (v.getId()){ 343 switch (v.getId()){
338 //选择默认图片 344 //选择默认图片
339 case R.id.oktakephone: 345 case R.id.oktakephone:
340 if (headpitiaon==1){ 346 if (headpitiaon==1){
341 mSimpleDraweeView.setImageDrawable(null); 347 mSimpleDraweeView.setImageDrawable(null);
342 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); 348 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1);
343 }else if (headpitiaon==2){ 349 }else if (headpitiaon==2){
344 mSimpleDraweeView.setImageDrawable(null); 350 mSimpleDraweeView.setImageDrawable(null);
345 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); 351 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2);
346 }else if (headpitiaon==3){ 352 }else if (headpitiaon==3){
347 mSimpleDraweeView.setImageDrawable(null); 353 mSimpleDraweeView.setImageDrawable(null);
348 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); 354 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3);
349 }else if (headpitiaon==4){ 355 }else if (headpitiaon==4){
350 mSimpleDraweeView.setImageDrawable(null); 356 mSimpleDraweeView.setImageDrawable(null);
351 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); 357 mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4);
352 }else if (headpitiaon==0){ 358 }else if (headpitiaon==0){
353 AlertUtils.showToast(this, "你还没有设置头像 "); 359 AlertUtils.showToast(this, "你还没有设置头像 ");
354 } 360 }
355 break; 361 break;
356 case R.id.canceltakephone: 362 case R.id.canceltakephone:
357 363
358 break; 364 break;
359 //拍摄和相册 365 //拍摄和相册
360 case R.id.take_pic: 366 case R.id.take_pic:
361 if (PermissionUtil.hasCameraPermission(MainActivity.this)) { 367 if (PermissionUtil.hasCameraPermission(MainActivity.this)) {
362 uploadAvatarFromPhotoRequest(); 368 uploadAvatarFromPhotoRequest();
363 } 369 }
364 370
365 break; 371 break;
366 case R.id.xiangce: 372 case R.id.xiangce:
367 uploadAvatarFromAlbumRequest(); 373 uploadAvatarFromAlbumRequest();
368 break; 374 break;
369 375
370 } 376 }
371 377
372 } 378 }
373 379
374 //照相 380 //照相
375 private void uploadAvatarFromPhotoRequest() { 381 private void uploadAvatarFromPhotoRequest() {
376 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 382 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
377 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 383 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
378 intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); 384 intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0);
379 intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); 385 intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
380 startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); 386 startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO);
381 } 387 }
382 388
383 //选择图库 389 //选择图库
384 private void uploadAvatarFromAlbumRequest() { 390 private void uploadAvatarFromAlbumRequest() {
385 Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); 391 Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
386 photoPickerIntent.setType("image/*"); 392 photoPickerIntent.setType("image/*");
387 startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); 393 startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM);
388 } 394 }
389 //回掉 395 //回掉
390 @Override 396 @Override
391 protected void onActivityResult(int requestCode, int resultCode, Intent data) { 397 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
392 super.onActivityResult(requestCode, resultCode, data); 398 super.onActivityResult(requestCode, resultCode, data);
393 if (resultCode != -1) { 399 if (resultCode != -1) {
394 return; 400 return;
395 } 401 }
396 if (requestCode == REQUEST_CODE_ALBUM && data != null) { 402 if (requestCode == REQUEST_CODE_ALBUM && data != null) {
397 Uri newUri; 403 Uri newUri;
398 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { 404 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
399 newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); 405 newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData()));
400 } else { 406 } else {
401 newUri = data.getData(); 407 newUri = data.getData();
402 } 408 }
403 if (newUri != null) { 409 if (newUri != null) {
404 startPhotoZoom(newUri); 410 startPhotoZoom(newUri);
405 } else { 411 } else {
406 Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); 412 Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show();
407 } 413 }
408 } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { 414 } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) {
409 startPhotoZoom(uri); 415 startPhotoZoom(uri);
410 } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { 416 } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) {
411 uploadAvatarFromPhoto(); 417 uploadAvatarFromPhoto();
412 } 418 }
413 } 419 }
414 420
415 private void uploadAvatarFromPhoto() { 421 private void uploadAvatarFromPhoto() {
416 compressAndUploadAvatar(file.getPath()); 422 compressAndUploadAvatar(file.getPath());
417 423
418 } 424 }
419 private void compressAndUploadAvatar(String fileSrc) { 425 private void compressAndUploadAvatar(String fileSrc) {
420 426
421 427
422 //上传到服务器 428 //上传到服务器
423 429
424 final File cover = FileUtil.getSmallBitmap(this, fileSrc); 430 final File cover = FileUtil.getSmallBitmap(this, fileSrc);
425 String mimeType = "image/*"; 431 String mimeType = "image/*";
426 //requestBody = RequestBody.create(MediaType.parse(mimeType), file); 432 //requestBody = RequestBody.create(MediaType.parse(mimeType), file);
427 //String fileName = cover.getName(); 433 //String fileName = cover.getName();
428 //HttpManager.getInstance().header(this, fileSrc); 434 //HttpManager.getInstance().header(this, fileSrc);
429 //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); 435 //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody);
430 //Fresco设置圆形头像 436 //Fresco设置圆形头像
431 GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); 437 GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());
432 GenericDraweeHierarchy hierarchy = builder 438 GenericDraweeHierarchy hierarchy = builder
433 .setDesiredAspectRatio(1f) 439 .setDesiredAspectRatio(1f)
434 .setFailureImage(R.mipmap.blank) 440 .setFailureImage(R.mipmap.blank)
435 //圆形头像 441 //圆形头像
436 .setRoundingParams(RoundingParams.asCircle()) 442 .setRoundingParams(RoundingParams.asCircle())
437 .build(); 443 .build();
438 444
439 //加载本地图片 445 //加载本地图片
440 Uri uri = Uri.fromFile(cover); 446 Uri uri = Uri.fromFile(cover);
441 DraweeController controller = Fresco.newDraweeControllerBuilder() 447 DraweeController controller = Fresco.newDraweeControllerBuilder()
442 .setOldController(mSimpleDraweeView.getController()) 448 .setOldController(mSimpleDraweeView.getController())
443 .setUri(uri) 449 .setUri(uri)
444 .build(); 450 .build();
445 mSimpleDraweeView.setHierarchy(hierarchy); 451 mSimpleDraweeView.setHierarchy(hierarchy);
446 mSimpleDraweeView.setController(controller); 452 mSimpleDraweeView.setController(controller);
447 453
448 } 454 }
449 455
450 public void startPhotoZoom(Uri uri) { 456 public void startPhotoZoom(Uri uri) {
451 Intent intent = new Intent("com.android.camera.action.CROP"); 457 Intent intent = new Intent("com.android.camera.action.CROP");
452 intent.setDataAndType(uri, "image/*"); 458 intent.setDataAndType(uri, "image/*");
453 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 459 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
454 intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. 460 intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面.
455 intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. 461 intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例.
456 intent.putExtra("aspectY", 1);// x:y=1:1 462 intent.putExtra("aspectY", 1);// x:y=1:1
457 // intent.putExtra("outputX", 400);//图片输出大小 463 // intent.putExtra("outputX", 400);//图片输出大小
458 // intent.putExtra("outputY", 400); 464 // intent.putExtra("outputY", 400);
459 intent.putExtra("output", Uri.fromFile(file)); 465 intent.putExtra("output", Uri.fromFile(file));
460 intent.putExtra("outputFormat", "JPEG");// 返回格式 466 intent.putExtra("outputFormat", "JPEG");// 返回格式
461 startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); 467 startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO);
462 } 468 }
463 469
464 @Override 470 @Override
465 public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { 471 public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
466 switch (requestCode) { 472 switch (requestCode) {
467 473
468 case PermissionUtil.REQUEST_SHOWCAMERA: 474 case PermissionUtil.REQUEST_SHOWCAMERA:
469 if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { 475 if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
470 // Permission Granted 476 // Permission Granted
471 uploadAvatarFromPhotoRequest(); 477 uploadAvatarFromPhotoRequest();
472 478
473 } else { 479 } else {
474 if (!SharedPreferenceMark.getHasShowCamera()) { 480 if (!SharedPreferenceMark.getHasShowCamera()) {
475 SharedPreferenceMark.setHasShowCamera(true); 481 SharedPreferenceMark.setHasShowCamera(true);
476 new DialogPermission(this, "关闭摄像头权限影响扫描功能"); 482 new DialogPermission(this, "关闭摄像头权限影响扫描功能");
477 483
478 } else { 484 } else {
479 Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) 485 Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT)
480 .show(); 486 .show();
481 } 487 }
482 } 488 }
483 break; 489 break;
484 default: 490 default:
485 super.onRequestPermissionsResult(requestCode, permissions, grantResults); 491 super.onRequestPermissionsResult(requestCode, permissions, grantResults);
486 } 492 }
487 } 493 }
494 private long exitTime = 0;
495 @Override
496 public boolean onKeyDown(int keyCode, KeyEvent event) {
497 if (keyCode == KeyEvent.KEYCODE_BACK) {
498 if ((System.currentTimeMillis() - exitTime) > 2000) {
499 Toast.makeText(getApplicationContext(), "再按一次退出程序",
500 Toast.LENGTH_SHORT).show();
501 exitTime = System.currentTimeMillis();
502 } else {
503 finish();
504 System.exit(0);
505 }
506 return false;
507 }
508 return super.onKeyDown(keyCode, event);
509 }
488 } 510 }
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.support.v7.app.AppCompatActivity; 5 import android.support.v7.app.AppCompatActivity;
6 import android.text.TextUtils; 6 import android.text.TextUtils;
7 import android.view.KeyEvent; 7 import android.view.KeyEvent;
8 import android.view.View; 8 import android.view.View;
9 import android.widget.Button; 9 import android.widget.Button;
10 import android.widget.EditText; 10 import android.widget.EditText;
11 import android.widget.TextView; 11 import android.widget.TextView;
12 12
13 import com.hjx.personalcenter.R; 13 import com.hjx.personalcenter.R;
14 import com.hjx.personalcenter.customdialog.CitysListDialog; 14 import com.hjx.personalcenter.customdialog.CitysListDialog;
15 import com.hjx.personalcenter.customdialog.CountryDialog; 15 import com.hjx.personalcenter.customdialog.CountryDialog;
16 import com.hjx.personalcenter.customdialog.GradeListDialog; 16 import com.hjx.personalcenter.customdialog.GradeListDialog;
17 import com.hjx.personalcenter.customdialog.ProvinceListDialog; 17 import com.hjx.personalcenter.customdialog.ProvinceListDialog;
18 import com.hjx.personalcenter.customdialog.SchoolListDialog; 18 import com.hjx.personalcenter.customdialog.SchoolListDialog;
19 import com.hjx.personalcenter.db.Content;
19 import com.hjx.personalcenter.db.SaveParam; 20 import com.hjx.personalcenter.db.SaveParam;
21 import com.hjx.personalcenter.http.HttpManager;
20 import com.hjx.personalcenter.interfaces.DialogCallBack; 22 import com.hjx.personalcenter.interfaces.DialogCallBack;
21 import com.hjx.personalcenter.model.CityInfo; 23 import com.hjx.personalcenter.model.CityInfo;
22 import com.hjx.personalcenter.model.CountyInfo; 24 import com.hjx.personalcenter.model.CountyInfo;
23 import com.hjx.personalcenter.model.GradeInfo; 25 import com.hjx.personalcenter.model.GradeInfo;
24 import com.hjx.personalcenter.model.ProvinceInfo; 26 import com.hjx.personalcenter.model.ProvinceInfo;
25 import com.hjx.personalcenter.model.SchoolInfo; 27 import com.hjx.personalcenter.model.SchoolInfo;
26 import com.hjx.personalcenter.util.AlertUtils; 28 import com.hjx.personalcenter.util.AlertUtils;
27 29
28 import java.util.ArrayList; 30 import java.util.ArrayList;
29 31
30 /**填写注册信息 熊巍 32 /**填写注册信息 熊巍
31 * Created by h on 2017/8/9. 33 * Created by h on 2017/8/9.
32 */ 34 */
33 35
34 public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener,DialogCallBack.GradeCallBack,DialogCallBack.ProvincesCallBack 36 public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener,DialogCallBack.GradeCallBack,DialogCallBack.ProvincesCallBack
35 ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack,DialogCallBack.SchoolCallBack{ 37 ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack,DialogCallBack.SchoolCallBack{
36 private EditText et_username; 38 private EditText et_username;
37 private TextView et_region,et_grade,et_school; 39 private TextView et_region,et_grade,et_school;
38 private Button btn_ok; 40 private Button btn_ok;
39 41
40 @Override 42 @Override
41 protected void onCreate(Bundle savedInstanceState) { 43 protected void onCreate(Bundle savedInstanceState) {
42 super.onCreate(savedInstanceState); 44 super.onCreate(savedInstanceState);
43 setContentView(R.layout.activity_registerinfo); 45 setContentView(R.layout.activity_registerinfo);
44 initView(); 46 initView();
45 initData(); 47 initData();
46 initLister(); 48 initLister();
47 } 49 }
48 50
49 private void initView() { 51 private void initView() {
50 et_username = (EditText) findViewById(R.id.et_username); 52 et_username = (EditText) findViewById(R.id.et_username);
51 et_region = (TextView) findViewById(R.id.et_region); 53 et_region = (TextView) findViewById(R.id.et_region);
52 et_grade = (TextView) findViewById(R.id.et_grade); 54 et_grade = (TextView) findViewById(R.id.et_grade);
53 et_school = (TextView) findViewById(R.id.et_school); 55 et_school = (TextView) findViewById(R.id.et_school);
54 btn_ok = (Button) findViewById(R.id.btn_ok); 56 btn_ok = (Button) findViewById(R.id.btn_ok);
55 57
56 58
57 } 59 }
58 60
59 private void initData() { 61 private void initData() {
62 if (Content.accountflag ==2){
63 btn_ok.setText("提交");
64
65 }
60 66
61 } 67 }
62 68
63 private void initLister() { 69 private void initLister() {
64 et_region.setOnClickListener(this); 70 et_region.setOnClickListener(this);
65 et_grade.setOnClickListener(this); 71 et_grade.setOnClickListener(this);
66 et_school.setOnClickListener(this); 72 et_school.setOnClickListener(this);
67 btn_ok.setOnClickListener(this); 73 btn_ok.setOnClickListener(this);
68 74
69 75
70 } 76 }
71 77
72 @Override 78 @Override
73 public void onClick(View v) { 79 public void onClick(View v) {
74 String register1 = et_username.getText().toString().trim(); 80 String register1 = et_username.getText().toString().trim();
75 String register2 = et_region.getText().toString().trim(); 81 String register2 = et_region.getText().toString().trim();
76 String register3 = et_grade.getText().toString().trim(); 82 String register3 = et_grade.getText().toString().trim();
77 String register4 = et_school.getText().toString().trim(); 83 String register4 = et_school.getText().toString().trim();
78 switch (v.getId()){ 84 switch (v.getId()){
79 case R.id.et_region: 85 case R.id.et_region:
80 choiseregion(); 86 choiseregion();
81 break; 87 break;
82 case R.id.et_grade: 88 case R.id.et_grade:
83 choisegrade(); 89 choisegrade();
84 break; 90 break;
85 case R.id.et_school: 91 case R.id.et_school:
86 if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ 92 if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){
87 AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); 93 AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址");
88 return; 94 return;
89 }else { 95 }else {
90 choiseschool(); 96 choiseschool();
91 } 97 }
92 98
93 break; 99 break;
94 case R.id.btn_ok: 100 case R.id.btn_ok:
95 if (TextUtils.isEmpty(register1) || 101 if (TextUtils.isEmpty(register1) ||
96 TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ 102 TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){
97 AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); 103 AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整");
98 return; 104 return;
99 }else{ 105 }else{
100 saveinfo(); 106 if (Content.accountflag ==2){
101 Intent intent = new Intent(); 107 String userID = SaveParam.getInstance().getLoginParam(this,"userId");
102 intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class); 108 String register5 = et_username.getText().toString().trim();
103 startActivity(intent); 109 String register6 = et_region.getText().toString().trim();
104 overridePendingTransition(R.anim.rightin, R.anim.rightout); 110 String register7 = et_grade.getText().toString().trim();
111 String register8 = et_school.getText().toString().trim();
112 try {
113 long auserID = Long.parseLong(userID);
114 HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this,auserID,"",
115 register5,register7,register8,register6);
116
117 } catch (NumberFormatException e) {
118 e.printStackTrace();
119 }
120
121 }else {
122 saveinfo();
123 Intent intent = new Intent();
124 intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class);
125 startActivity(intent);
126 overridePendingTransition(R.anim.rightin, R.anim.rightout);
127 }
128
105 } 129 }
106 130
107 break; 131 break;
108 } 132 }
109 133
110 } 134 }
111 //保存个人信息 135 //保存个人信息
112 private void saveinfo() { 136 private void saveinfo() {
113 String register1 = et_username.getText().toString().trim(); 137 String register1 = et_username.getText().toString().trim();
114 String register2 = et_region.getText().toString().trim(); 138 String register2 = et_region.getText().toString().trim();
115 String register3 = et_grade.getText().toString().trim(); 139 String register3 = et_grade.getText().toString().trim();
116 String register4 = et_school.getText().toString().trim(); 140 String register4 = et_school.getText().toString().trim();
117 SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register1); 141 SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register1);
118 SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register2); 142 SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register2);
119 SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register3); 143 SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register3);
120 SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register4); 144 SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register4);
121 145
122 } 146 }
123 147
124 //选择地区 148 //选择地区
125 private void choiseregion() { 149 private void choiseregion() {
126 ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); 150 ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog");
127 151
128 } 152 }
129 //选择年级 153 //选择年级
130 private void choisegrade() { 154 private void choisegrade() {
131 GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); 155 GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog");
132 156
133 } 157 }
134 //选择学校 158 //选择学校
135 private void choiseschool() { 159 private void choiseschool() {
136 SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); 160 SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog");
137 161
138 } 162 }
139 163
140 164
141 @Override 165 @Override
142 public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { 166 public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) {
143 String regionName = data.get(position).getRegionName(); 167 String regionName = data.get(position).getRegionName();
144 SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); 168 SaveParam.getInstance().saveLoginParam(this,"sheng",regionName);
145 CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); 169 CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog");
146 170
147 171
148 } 172 }
149 @Override 173 @Override
150 public boolean onKeyUp(int keyCode, KeyEvent event) { 174 public boolean onKeyUp(int keyCode, KeyEvent event) {
151 if (keyCode == KeyEvent.KEYCODE_BACK) { 175 if (keyCode == KeyEvent.KEYCODE_BACK) {
152 finish(); 176 finish();
153 177
154 } 178 }
155 return super.onKeyUp(keyCode, event); 179 return super.onKeyUp(keyCode, event);
156 } 180 }
157 181
158 @Override 182 @Override
159 public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { 183 public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) {
160 String regionName = data.get(position).getName(); 184 String regionName = data.get(position).getName();
161 et_grade.setText(regionName); 185 et_grade.setText(regionName);
162 186
163 } 187 }
164 188
165 @Override 189 @Override
166 public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { 190 public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) {
167 String regionName = data.get(position).getRegionName(); 191 String regionName = data.get(position).getRegionName();
168 String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); 192 String provice = SaveParam.getInstance().getLoginParam(this,"sheng");
169 SaveParam.getInstance().saveLoginParam(this,"shi",regionName); 193 SaveParam.getInstance().saveLoginParam(this,"shi",regionName);
170 CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); 194 CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog");
171 et_region.setText(""); 195 et_region.setText("");
172 et_region.setText(provice+regionName); 196 et_region.setText(provice+regionName);
173 197
174 } 198 }
175 199
176 @Override 200 @Override
177 public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { 201 public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) {
178 String regionName = data.get(position).getRegionName(); 202 String regionName = data.get(position).getRegionName();
179 String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); 203 String provices = SaveParam.getInstance().getLoginParam(this,"sheng");
180 String citys = SaveParam.getInstance().getLoginParam(this,"shi"); 204 String citys = SaveParam.getInstance().getLoginParam(this,"shi");
181 et_region.setText(""); 205 et_region.setText("");
182 et_region.setText(provices+citys+regionName); 206 et_region.setText(provices+citys+regionName);
183 207
184 } 208 }
185 209
186 @Override 210 @Override
187 public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { 211 public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) {
188 String regionName = data.get(position).getSchoolName(); 212 String regionName = data.get(position).getSchoolName();
189 et_school.setText(regionName); 213 et_school.setText(regionName);
190 214
191 } 215 }
192 } 216 }
193 217
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/AccountChildsAdapter.java
1 package com.hjx.personalcenter.adapter; 1 package com.hjx.personalcenter.adapter;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.support.v4.app.FragmentActivity;
4 import android.support.v7.widget.RecyclerView; 5 import android.support.v7.widget.RecyclerView;
5 import android.view.LayoutInflater; 6 import android.view.LayoutInflater;
6 import android.view.View; 7 import android.view.View;
7 import android.view.ViewGroup; 8 import android.view.ViewGroup;
8 import android.widget.ImageView; 9 import android.widget.ImageView;
9 import android.widget.TextView; 10 import android.widget.TextView;
10 11
11 import com.hjx.personalcenter.R; 12 import com.hjx.personalcenter.R;
13 import com.hjx.personalcenter.http.HttpManager;
12 import com.hjx.personalcenter.model.ChildsInfo; 14 import com.hjx.personalcenter.model.ChildsInfo;
15 import com.mylhyl.circledialog.CircleDialog;
13 16
14 import java.util.ArrayList; 17 import java.util.ArrayList;
15 import java.util.List; 18 import java.util.List;
16 19
17 /** 20 /**
18 * Created by h on 2017/8/26. 21 * Created by h on 2017/8/26.
19 */ 22 */
20 23
21 public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> { 24 public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> {
22 private List<ChildsInfo.DataBean> specailList; 25 private List<ChildsInfo.DataBean> specailList;
23 private LayoutInflater mInflater; 26 private LayoutInflater mInflater;
24 private Context mContext ; 27 private Context mContext ;
25 28
26 public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) { 29 public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) {
27 this.mContext = context; 30 this.mContext = context;
28 this.specailList = specailList; 31 this.specailList = specailList;
29 mInflater = LayoutInflater.from(context); 32 mInflater = LayoutInflater.from(context);
30 } 33 }
31 34
32 public OnItemClickListener mOnItemClickListener; 35 public OnItemClickListener mOnItemClickListener;
33 36
34 public interface OnItemClickListener { 37 public interface OnItemClickListener {
35 void onItemClick(View view, int position); 38 void onItemClick(View view, int position);
36 } 39 }
37 40
38 public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { 41 public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) {
39 this.mOnItemClickListener = mOnItemClickLitener; 42 this.mOnItemClickListener = mOnItemClickLitener;
40 } 43 }
41 44
42 public void setList(List<ChildsInfo.DataBean> list) { 45 public void setList(List<ChildsInfo.DataBean> list) {
43 this.specailList = list; 46 this.specailList = list;
44 notifyDataSetChanged(); 47 notifyDataSetChanged();
45 } 48 }
46 49
47 @Override 50 @Override
48 public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) { 51 public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) {
49 View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false); 52 View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false);
50 53
51 AccountChildsHolder holder = new AccountChildsHolder(view); 54 AccountChildsHolder holder = new AccountChildsHolder(view);
52 return holder; 55 return holder;
53 } 56 }
54 57
55 @Override 58 @Override
56 public void onBindViewHolder(AccountChildsHolder holder, int position) { 59 public void onBindViewHolder(AccountChildsHolder holder, int position) {
57 ChildsInfo.DataBean bean = specailList.get(position); 60 final ChildsInfo.DataBean bean = specailList.get(position);
58 if (bean != null) { 61 if (bean != null) {
59 holder.iv_child_head.setImageResource(R.mipmap.header_default); 62 holder.iv_child_head.setImageResource(R.mipmap.header_default);
60 holder.iv_child_name.setText(bean.getName()); 63 holder.iv_child_name.setText(bean.getName());
61 holder.iv_child_grade.setText(bean.getGrade()); 64 holder.iv_child_grade.setText(bean.getGrade());
62 holder.iv_child_school.setText(bean.getSchool()); 65 holder.iv_child_school.setText(bean.getSchool());
63 holder.iv_child_adress.setText(bean.getRegion()); 66 holder.iv_child_adress.setText(bean.getRegion());
67 holder.delete_account.setOnClickListener(new View.OnClickListener() {
68 @Override
69 public void onClick(View v) {
70 new CircleDialog.Builder((FragmentActivity)mContext)
71 .setCanceledOnTouchOutside(false)
72 .setWidth(0.4f)
73 .setCancelable(false)
74 .setText("您确定删除该子账户?")
75 .setNegative("取消", null)
76 .setPositive("确定", new View.OnClickListener() {
77 @Override
78 public void onClick(View v) {
79 HttpManager.getInstance().deletechildAccountinfo(mContext,bean.getSubAccountId());
80 }
81 })
82 .show();
83
84
85
86 }
87 });
88 holder.chang_account.setOnClickListener(new View.OnClickListener() {
89 @Override
90 public void onClick(View v) {
91 new CircleDialog.Builder((FragmentActivity)mContext)
92 .setCanceledOnTouchOutside(false)
93 .setWidth(0.4f)
94 .setCancelable(false)
95 .setText("您确定切换为该子账户?")
96 .setNegative("取消", null)
97 .setPositive("确定", new View.OnClickListener() {
98 @Override
99 public void onClick(View v) {
100 HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId());
101 }
102 })
103 .show();
104
105 }
106 });
64 107
65 } 108 }
66 109
67 110
68 } 111 }
69 112
70 @Override 113 @Override
71 public int getItemCount() { 114 public int getItemCount() {
72 return specailList.size(); 115 return specailList.size();
73 } 116 }
74 117
75 class AccountChildsHolder extends RecyclerView.ViewHolder { 118 class AccountChildsHolder extends RecyclerView.ViewHolder {
76 ImageView iv_child_head; 119 ImageView iv_child_head;
77 TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress; 120 TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress,
121 delete_account,chang_account;
78 public AccountChildsHolder(View itemView) { 122 public AccountChildsHolder(View itemView) {
79 super(itemView); 123 super(itemView);
80 iv_child_head = (ImageView) itemView.findViewById(R.id.iv_child_head); 124 iv_child_head = (ImageView) itemView.findViewById(R.id.iv_child_head);
81 iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); 125 iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name);
82 iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); 126 iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade);
83 iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); 127 iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school);
84 iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); 128 iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress);
129 delete_account = (TextView) itemView.findViewById(R.id.delete_child_account);
130 chang_account = (TextView) itemView.findViewById(R.id.chang_account);
85 131
86 } 132 }
87 } 133 }
88 } 134 }
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/GalleryAdapter.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
13 import java.util.List;
14
15 public class GalleryAdapter extends
16 RecyclerView.Adapter<GalleryAdapter.ViewHolder>
17 {
18
19 private LayoutInflater mInflater;
20 private List<Integer> mDatas;
21
22 public GalleryAdapter(Context context, List<Integer> datats)
23 {
24 mInflater = LayoutInflater.from(context);
25 mDatas = datats;
26 }
27
28 public static class ViewHolder extends RecyclerView.ViewHolder
29 {
30 public ViewHolder(View arg0)
31 {
32 super(arg0);
33 }
34
35 ImageView mImg;
36 TextView mTxt;
37 }
38
39 @Override
40 public int getItemCount()
41 {
42 return mDatas.size();
43 }
44
45 /**
46 * 创建ViewHolder
47 */
48 @Override
49 public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i)
50 {
51 View view = mInflater.inflate(R.layout.recycler_study_tem_view,
52 viewGroup, false);
53 ViewHolder viewHolder = new ViewHolder(view);
54
55 viewHolder.mImg = (ImageView) view
56 .findViewById(R.id.id_index_gallery_item_image);
57 return viewHolder;
58 }
59
60 /**
61 * 设置值
62 */
63 @Override
64 public void onBindViewHolder(final ViewHolder viewHolder, final int i)
65 {
66 viewHolder.mImg.setImageResource(mDatas.get(i));
67 }
68
69 }
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/RecyclerViewAdapter.java
1 package com.hjx.personalcenter.adapter; File was deleted
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.Button;
9 import android.widget.TextView;
10
11 import com.hjx.personalcenter.R;
12
13 import java.util.List;
14
15 /**
16 * Author: zhangmiao
17 * Date: 2017/6/14
18 */
19 public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.RecyclerHolder> {
20
21 private static final String TAG = RecyclerViewAdapter.class.getSimpleName();
22
23 private List<String> dataList;
24 private Context mContext;
25 private RecyclerView recyclerView;
26
27 public static int position = 0;
28
29 public RecyclerViewAdapter(Context context, List<String> dataList) {
30 mContext = context;
31 this.dataList = dataList;
32 }
33
34 @Override
35 public RecyclerHolder onCreateViewHolder(ViewGroup parent, int viewType) {
36 View view = LayoutInflater.from(mContext).inflate(R.layout.recycler_study_tem_view, parent, false);
37 RecyclerHolder holder = new RecyclerHolder(view);
38 return holder;
39 }
40
41 @Override
42 public void onBindViewHolder(RecyclerHolder holder, final int position) {
43 holder.textView.setText(dataList.get(position));
44 if (position == dataList.size() - 1) {
45 holder.button.setVisibility(View.GONE);
46 }
47 holder.button.setOnClickListener(new View.OnClickListener() {
48 @Override
49 public void onClick(View v) {
50 recyclerView.smoothScrollToPosition(position + 1);
51 RecyclerViewAdapter.position++;
52 }
53 });
54 }
55
56 @Override
57 public void onAttachedToRecyclerView(RecyclerView recyclerView) {
58 super.onAttachedToRecyclerView(recyclerView);
59 this.recyclerView = recyclerView;
60 }
61
62 @Override
63 public int getItemCount() {
64 return dataList.size();
65 }
66
67 public class RecyclerHolder extends RecyclerView.ViewHolder {
68 TextView textView;
69 Button button;
70
71 public RecyclerHolder(View itemView) {
72 super(itemView);
73 textView = (TextView) itemView.findViewById(R.id.item_text);
74 button = (Button) itemView.findViewById(R.id.item_button);
75 }
76 }
77
78 }
79 1 package com.hjx.personalcenter.adapter;
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/RecyclerViewSpaceItem.java
File was created 1 package com.hjx.personalcenter.customdialog;
2
3 import android.graphics.Rect;
4 import android.support.v7.widget.RecyclerView;
5 import android.view.View;
6
7 /**
8 * Created by h on 2017/8/28.
9 */
10
11 public class RecyclerViewSpaceItem extends RecyclerView.ItemDecoration{
12 int mSpace;
13
14 @Override
15 public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
16 super.getItemOffsets(outRect, view, parent, state);
17 outRect.left = mSpace;
18 outRect.right = mSpace;
19 outRect.bottom = mSpace;
20 if (parent.getChildAdapterPosition(view) == 0) {
21 outRect.left = mSpace;
22 }
23
24 }
25
26 public RecyclerViewSpaceItem(int space) {
27 this.mSpace = space;
28 }
29 }
30
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/Content.java
1 package com.hjx.personalcenter.db; 1 package com.hjx.personalcenter.db;
2 2
3 /** 3 /**
4 * Created by h on 2017/8/17. 4 * Created by h on 2017/8/17.
5 */ 5 */
6 6
7 public class Content { 7 public class Content {
8 public static int authcodeflag;//1是进入填写保卡信息验证,2是修改保卡手机号验证,3是更改绑定验证 8 public static int authcodeflag;//1是进入填写保卡信息验证,2是修改保卡手机号验证,3是更改绑定验证
9 public static int adressflag;//1购买地址,2客户地址 9 public static int adressflag;//1购买地址,2客户地址
10 public static int accountflag;//1主账户注册信息,2子账户注册信息
10 } 11 }
11 12
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
1 package com.hjx.personalcenter.db; 1 package com.hjx.personalcenter.db;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Context; 4 import android.content.Context;
5 import android.content.SharedPreferences; 5 import android.content.SharedPreferences;
6 6
7 public class SaveParam { 7 public class SaveParam {
8 8
9 private static SaveParam instance; 9 private static SaveParam instance;
10 public static SaveParam getInstance(){ 10 public static SaveParam getInstance(){
11 if (instance==null){ 11 if (instance==null){
12 instance = new SaveParam(); 12 instance = new SaveParam();
13 } 13 }
14 return instance; 14 return instance;
15 } 15 }
16 16
17 public static String GRADENS = "gradens";//年级id 17 public static String GRADENS = "gradens";//年级id
18 public static String SCHOOOlID = "schoolid";//年级id 18 public static String SCHOOOlID = "schoolid";//年级id
19 //个人信息 19 //个人信息
20 public static String USERNAME = "username";//昵称 20 public static String USERNAME = "usernames";//昵称
21 public static String ADRESS = "adress";//地址 21 public static String ADRESS = "adress";//地址
22 public static String GRADES = "gadens";//年级 22 public static String GRADES = "gadens";//年级
23 public static String SCHOOL = "school";//学校 23 public static String SCHOOL = "school";//学校
24 public static String CONSTELLATION = "constellations";//星座 24 public static String CONSTELLATION = "constellations";//星座
25 25
26 //电子保卡信息 26 //电子保卡信息
27 public static String CARDPHONE = "cardphone";//保卡手机号 27 public static String CARDPHONE = "cardphone";//保卡手机号
28 public static String CUNSTEMNAME = "cunstemname";//客户姓名 28 public static String CUNSTEMNAME = "cunstemname";//客户姓名
29 public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 29 public static String ADRESSCUNSTEM = "adresscunstem";//客户地址
30 public static String SHOPTIME = "shoptime";//购买时间 30 public static String SHOPTIME = "shoptime";//购买时间
31 public static String SHOPADRESS = "shopadress";//购买地址 31 public static String SHOPADRESS = "shopadress";//购买地址
32 public static String SHOPTLEPHONE = "shoptlephone";//售后电话 32 public static String SHOPTLEPHONE = "shoptlephone";//售后电话
33 33
34 //省市区参数、 34 //省市区参数、
35 public static String PROVINCES = "provinces";//省 35 public static String PROVINCES = "provinces";//省
36 public static String CITYS = "citys";//市 36 public static String CITYS = "citys";//市
37 public static String COUNTRY = "country";//区 37 public static String COUNTRY = "country";//区
38 38
39 39
40 public void saveLoginParam(Context context,String spname, String spstr) { 40 public void saveLoginParam(Context context,String spname, String spstr) {
41 SharedPreferences sp = context.getSharedPreferences("loginparam", 41 SharedPreferences sp = context.getSharedPreferences("loginparam",
42 Activity.MODE_PRIVATE); 42 Activity.MODE_PRIVATE);
43 43
44 sp.edit().putString(spname, spstr).commit(); 44 sp.edit().putString(spname, spstr).commit();
45 } 45 }
46 46
47 47
48 public String getLoginParam(Context context,String spname) { 48 public String getLoginParam(Context context,String spname) {
49 SharedPreferences sp = context.getSharedPreferences("loginparam", 49 SharedPreferences sp = context.getSharedPreferences("loginparam",
50 Activity.MODE_PRIVATE); 50 Activity.MODE_PRIVATE);
51 String param = sp.getString(spname, null); 51 String param = sp.getString(spname, null);
52 return param; 52 return param;
53 } 53 }
54 public void clearData(Context context) { 54 public void clearData(Context context) {
55 SharedPreferences sp = context.getSharedPreferences("loginparam", 55 SharedPreferences sp = context.getSharedPreferences("loginparam",
56 Activity.MODE_PRIVATE); 56 Activity.MODE_PRIVATE);
57 sp.edit().clear().commit(); 57 sp.edit().clear().commit();
58 } 58 }
59 59
60 public void saveCustomizeParam(Context context,String spname, String spstr) { 60 public void saveCustomizeParam(Context context,String spname, String spstr) {
61 SharedPreferences sp = context.getSharedPreferences("presoninfo", 61 SharedPreferences sp = context.getSharedPreferences("presoninfo",
62 Activity.MODE_PRIVATE); 62 Activity.MODE_PRIVATE);
63 63
64 sp.edit().putString(spname, spstr).commit(); 64 sp.edit().putString(spname, spstr).commit();
65 65
66 } 66 }
67 67
68 public String getCustomizeParam(Context context,String spname) { 68 public String getCustomizeParam(Context context,String spname) {
69 SharedPreferences sp = context.getSharedPreferences("presoninfo", 69 SharedPreferences sp = context.getSharedPreferences("presoninfo",
70 Activity.MODE_PRIVATE); 70 Activity.MODE_PRIVATE);
71 String param = sp.getString(spname, null); 71 String param = sp.getString(spname, null);
72 return param; 72 return param;
73 } 73 }
74 74
75 public void clearCustomizeParam(Context context ){ 75 public void clearCustomizeParam(Context context ){
76 SharedPreferences sp = context.getSharedPreferences("presoninfo", 76 SharedPreferences sp = context.getSharedPreferences("presoninfo",
77 Activity.MODE_PRIVATE); 77 Activity.MODE_PRIVATE);
78 sp.edit().clear().commit(); 78 sp.edit().clear().commit();
79 } 79 }
80 } 80 }
81 81
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpKey.java
1 package com.hjx.personalcenter.http; 1 package com.hjx.personalcenter.http;
2 2
3 /**请求参数 3 /**请求参数
4 * Created by wei on 2017/6/20. 4 * Created by wei on 2017/6/20.
5 */ 5 */
6 6
7 public class HttpKey { 7 public class HttpKey {
8 //注册key 8 //注册key
9 public static String USERNAME = "username"; 9 public static String USERNAME = "username";
10 public static String PASSWORD = "password"; 10 public static String PASSWORD = "password";
11 public static String SMSCODE = "smscode"; 11 public static String SMSCODE = "smscode";
12 public static String SOURCE = "source"; 12 public static String SOURCE = "source";
13 //忘记密码 13 //忘记密码
14 public static String AUTHCODE = "authCode"; 14 public static String AUTHCODE = "authCode";
15 //注册验证码和忘记密码验证码 15 //注册验证码和忘记密码验证码
16 public static String TYPE = "type"; 16 public static String TYPE = "type";
17 public static String MOBIL = "mobile"; 17 public static String MOBIL = "mobile";
18 //修改密码 18 //修改密码
19 public static String OLDPASS = "oldPass"; 19 public static String OLDPASS = "oldPass";
20 public static String NEWPASS = "newPass"; 20 public static String NEWPASS = "newPass";
21 //提交保卡 21 //提交保卡
22 public static String USEID = "userId"; 22 public static String USEID = "userId";
23 public static String CUSTOMENAME = "customerName"; 23 public static String CUSTOMENAME = "customerName";
24 public static String CUSTOMADRESS = "customerAddress"; 24 public static String CUSTOMADRESS = "customerAddress";
25 public static String BUYADREES = "buyAddress"; 25 public static String BUYADREES = "buyAddress";
26 public static String BUYTIME = "buyTime"; 26 public static String BUYTIME = "buyTime";
27 public static String ALTERSALECALL = "alterSaleCall"; 27 public static String ALTERSALECALL = "alterSaleCall";
28 public static String PRODUCTMODEL = "productModel"; 28 public static String PRODUCTMODEL = "productModel";
29 public static String DEVICENUMBER = "deviceNumber"; 29 public static String DEVICENUMBER = "deviceNumber";
30 public static String MACADRESS = "macAddress"; 30 public static String MACADRESS = "macAddress";
31 public static String MOBILPHONE = "customerPhone"; 31 public static String MOBILPHONE = "customerPhone";
32 //提交子账户信息
33 public static String PARENTID = "parentId";
34 public static String IMAGE = "image";
35 public static String NAME = "name";
36 public static String GRADE = "grade";
37 public static String SCHOOL = "school";
38 public static String REGION = "region";
39
32 40
33 41
34 42
35 43
36 44
37 45
38 } 46 }
39 47
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.ChildsInfo;
25 import com.hjx.personalcenter.model.CityInfo; 25 import com.hjx.personalcenter.model.CityInfo;
26 import com.hjx.personalcenter.model.CountyInfo; 26 import com.hjx.personalcenter.model.CountyInfo;
27 import com.hjx.personalcenter.model.GradeInfo; 27 import com.hjx.personalcenter.model.GradeInfo;
28 import com.hjx.personalcenter.model.PesonalInfo; 28 import com.hjx.personalcenter.model.PesonalInfo;
29 import com.hjx.personalcenter.model.ProvinceInfo; 29 import com.hjx.personalcenter.model.ProvinceInfo;
30 import com.hjx.personalcenter.model.SchoolInfo; 30 import com.hjx.personalcenter.model.SchoolInfo;
31 import com.hjx.personalcenter.model.SignInfo; 31 import com.hjx.personalcenter.model.SignInfo;
32 import com.hjx.personalcenter.util.AlertUtils;
32 import com.hjx.personalcenter.util.DialogPermission; 33 import com.hjx.personalcenter.util.DialogPermission;
33 import com.loopj.android.http.AsyncHttpResponseHandler; 34 import com.loopj.android.http.AsyncHttpResponseHandler;
34 import com.loopj.android.http.JsonHttpResponseHandler; 35 import com.loopj.android.http.JsonHttpResponseHandler;
35 import com.loopj.android.http.RequestParams; 36 import com.loopj.android.http.RequestParams;
36 import com.mylhyl.circledialog.CircleDialog; 37 import com.mylhyl.circledialog.CircleDialog;
37 import com.mylhyl.circledialog.callback.ConfigText; 38 import com.mylhyl.circledialog.callback.ConfigText;
38 import com.mylhyl.circledialog.params.TextParams; 39 import com.mylhyl.circledialog.params.TextParams;
39 40
40 import org.apache.http.Header; 41 import org.apache.http.Header;
41 import org.apache.http.entity.ByteArrayEntity; 42 import org.apache.http.entity.ByteArrayEntity;
42 import org.apache.http.message.BasicHeader; 43 import org.apache.http.message.BasicHeader;
43 import org.apache.http.protocol.HTTP; 44 import org.apache.http.protocol.HTTP;
44 import org.json.JSONException; 45 import org.json.JSONException;
45 import org.json.JSONObject; 46 import org.json.JSONObject;
46 47
47 import java.io.UnsupportedEncodingException; 48 import java.io.UnsupportedEncodingException;
48 import java.util.ArrayList; 49 import java.util.ArrayList;
49 import java.util.List; 50 import java.util.List;
50 51
51 public class HttpManager { 52 public class HttpManager {
52 private static HttpManager instance; 53 private static HttpManager instance;
53 private ProgressDialog mProgress = null; 54 private ProgressDialog mProgress = null;
54 55
55 public static HttpManager getInstance() { 56 public static HttpManager getInstance() {
56 if (instance == null) { 57 if (instance == null) {
57 instance = new HttpManager(); 58 instance = new HttpManager();
58 } 59 }
59 return instance; 60 return instance;
60 } 61 }
61 62
62 63
63 //登录接口 64 //登录接口
64 65
65 public void login(final String username, final String password, final Context mContext, final Handler handler) { 66 public void login(final String username, final String password, final Context mContext, final Handler handler) {
66 mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", 67 mProgress = DialogPermission.showProgress(mContext, null, "正在登录...",
67 false, true, null); 68 false, true, null);
68 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 69 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
69 HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { 70 HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() {
70 @Override 71 @Override
71 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 72 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
72 closeProgress(); 73 closeProgress();
73 Message msg = Message.obtain(); 74 Message msg = Message.obtain();
74 msg.what = HttpCode.LOGIN_SUCESS; 75 msg.what = HttpCode.LOGIN_SUCESS;
75 msg.obj = new String(arg2); 76 msg.obj = new String(arg2);
76 handler.sendMessage(msg); 77 handler.sendMessage(msg);
77 78
78 79
79 } 80 }
80 81
81 @Override 82 @Override
82 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 83 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
83 closeProgress(); 84 closeProgress();
84 new CircleDialog.Builder((FragmentActivity) mContext) 85 new CircleDialog.Builder((FragmentActivity) mContext)
85 .setCanceledOnTouchOutside(false) 86 .setCanceledOnTouchOutside(false)
86 .setCancelable(false) 87 .setCancelable(false)
87 .setWidth(0.5f) 88 .setWidth(0.5f)
88 .configText(new ConfigText() { 89 .configText(new ConfigText() {
89 @Override 90 @Override
90 public void onConfig(TextParams params) { 91 public void onConfig(TextParams params) {
91 params.gravity = Gravity.CENTER; 92 params.gravity = Gravity.CENTER;
92 params.padding = new int[]{50, 50, 50, 50}; 93 params.padding = new int[]{50, 50, 50, 50};
93 } 94 }
94 }) 95 })
95 .setText("当前无网络,请检查网络设置") 96 .setText("当前无网络,请检查网络设置")
96 .setNegative("继续使用", null) 97 .setNegative("继续使用", null)
97 .setPositive("设置网络", new View.OnClickListener() { 98 .setPositive("设置网络", new View.OnClickListener() {
98 @Override 99 @Override
99 public void onClick(View v) { 100 public void onClick(View v) {
100 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 101 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
101 mContext.startActivity(intent); 102 mContext.startActivity(intent);
102 } 103 }
103 }) 104 })
104 .show(); 105 .show();
105 } 106 }
106 }); 107 });
107 } 108 }
108 109
109 //注册接口 110 //注册接口
110 public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { 111 public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) {
111 mProgress = DialogPermission.showProgress(context, null, "正在注册...", 112 mProgress = DialogPermission.showProgress(context, null, "正在注册...",
112 false, true, null); 113 false, true, null);
113 JSONObject jsonObject = new JSONObject(); 114 JSONObject jsonObject = new JSONObject();
114 ByteArrayEntity entity = null; 115 ByteArrayEntity entity = null;
115 try { 116 try {
116 jsonObject.put(HttpKey.USERNAME, username); 117 jsonObject.put(HttpKey.USERNAME, username);
117 jsonObject.put(HttpKey.PASSWORD, password); 118 jsonObject.put(HttpKey.PASSWORD, password);
118 jsonObject.put(HttpKey.SMSCODE, smscode); 119 jsonObject.put(HttpKey.SMSCODE, smscode);
119 jsonObject.put(HttpKey.SOURCE, source); 120 jsonObject.put(HttpKey.SOURCE, source);
120 Log.e("test", "jsonObject" + jsonObject); 121 Log.e("test", "jsonObject" + jsonObject);
121 entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); 122 entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8"));
122 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); 123 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
123 } catch (JSONException e) { 124 } catch (JSONException e) {
124 e.printStackTrace(); 125 e.printStackTrace();
125 } catch (UnsupportedEncodingException e) { 126 } catch (UnsupportedEncodingException e) {
126 e.printStackTrace(); 127 e.printStackTrace();
127 } 128 }
128 HttpClient.getInstance().addHeader("Accept", "*/*"); 129 HttpClient.getInstance().addHeader("Accept", "*/*");
129 HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { 130 HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() {
130 @Override 131 @Override
131 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 132 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
132 super.onSuccess(statusCode, headers, response); 133 super.onSuccess(statusCode, headers, response);
133 closeProgress(); 134 closeProgress();
134 Log.e("test", "onSuccess" + response); 135 Log.e("test", "onSuccess" + response);
135 Message msg = Message.obtain(); 136 Message msg = Message.obtain();
136 msg.what = HttpCode.REGISTERED_SUCESS; 137 msg.what = HttpCode.REGISTERED_SUCESS;
137 msg.obj = response; 138 msg.obj = response;
138 handler.sendMessage(msg); 139 handler.sendMessage(msg);
139 140
140 } 141 }
141 142
142 @Override 143 @Override
143 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 144 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
144 super.onFailure(statusCode, headers, throwable, errorResponse); 145 super.onFailure(statusCode, headers, throwable, errorResponse);
145 closeProgress(); 146 closeProgress();
146 Log.e("test", "onFailure" + errorResponse); 147 Log.e("test", "onFailure" + errorResponse);
147 new CircleDialog.Builder((FragmentActivity) context) 148 new CircleDialog.Builder((FragmentActivity) context)
148 .setCanceledOnTouchOutside(false) 149 .setCanceledOnTouchOutside(false)
149 .setCancelable(false) 150 .setCancelable(false)
150 .setWidth(0.5f) 151 .setWidth(0.5f)
151 .configText(new ConfigText() { 152 .configText(new ConfigText() {
152 @Override 153 @Override
153 public void onConfig(TextParams params) { 154 public void onConfig(TextParams params) {
154 params.gravity = Gravity.CENTER; 155 params.gravity = Gravity.CENTER;
155 params.padding = new int[]{50, 50, 50, 50}; 156 params.padding = new int[]{50, 50, 50, 50};
156 } 157 }
157 }) 158 })
158 .setText("当前无网络,请检查网络设置") 159 .setText("当前无网络,请检查网络设置")
159 .setNegative("继续使用", null) 160 .setNegative("继续使用", null)
160 .setPositive("设置网络", new View.OnClickListener() { 161 .setPositive("设置网络", new View.OnClickListener() {
161 @Override 162 @Override
162 public void onClick(View v) { 163 public void onClick(View v) {
163 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 164 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
164 context.startActivity(intent); 165 context.startActivity(intent);
165 } 166 }
166 }) 167 })
167 .show(); 168 .show();
168 } 169 }
169 170
170 }); 171 });
171 } 172 }
172 173
173 //注册验证码 174 //注册验证码
174 public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { 175 public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) {
175 RequestParams params = new RequestParams(); 176 RequestParams params = new RequestParams();
176 params.put(HttpKey.TYPE, type); 177 params.put(HttpKey.TYPE, type);
177 params.put(HttpKey.MOBIL, mobile); 178 params.put(HttpKey.MOBIL, mobile);
178 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 179 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
179 HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { 180 HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() {
180 181
181 @Override 182 @Override
182 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 183 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
183 Log.e("test", "onSuccess-----" + response); 184 Log.e("test", "onSuccess-----" + response);
184 Message msg = Message.obtain(); 185 Message msg = Message.obtain();
185 msg.what = HttpCode.AUTHCODE_SUCESS; 186 msg.what = HttpCode.AUTHCODE_SUCESS;
186 msg.obj = response; 187 msg.obj = response;
187 handler.sendMessage(msg); 188 handler.sendMessage(msg);
188 } 189 }
189 190
190 @Override 191 @Override
191 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 192 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
192 new CircleDialog.Builder((FragmentActivity) mContext) 193 new CircleDialog.Builder((FragmentActivity) mContext)
193 .setCanceledOnTouchOutside(false) 194 .setCanceledOnTouchOutside(false)
194 .setCancelable(false) 195 .setCancelable(false)
195 .setWidth(0.5f) 196 .setWidth(0.5f)
196 .configText(new ConfigText() { 197 .configText(new ConfigText() {
197 @Override 198 @Override
198 public void onConfig(TextParams params) { 199 public void onConfig(TextParams params) {
199 params.gravity = Gravity.CENTER; 200 params.gravity = Gravity.CENTER;
200 params.padding = new int[]{50, 50, 50, 50}; 201 params.padding = new int[]{50, 50, 50, 50};
201 } 202 }
202 }) 203 })
203 .setText("当前无网络,请检查网络设置") 204 .setText("当前无网络,请检查网络设置")
204 .setNegative("继续使用", null) 205 .setNegative("继续使用", null)
205 .setPositive("设置网络", new View.OnClickListener() { 206 .setPositive("设置网络", new View.OnClickListener() {
206 @Override 207 @Override
207 public void onClick(View v) { 208 public void onClick(View v) {
208 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 209 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
209 mContext.startActivity(intent); 210 mContext.startActivity(intent);
210 } 211 }
211 }) 212 })
212 .show(); 213 .show();
213 } 214 }
214 }); 215 });
215 } 216 }
216 217
217 218
218 //手机号是否注册 219 //手机号是否注册
219 public void isregistered(final String mobile, final Handler handler, final Context mContext) { 220 public void isregistered(final String mobile, final Handler handler, final Context mContext) {
220 RequestParams params = new RequestParams(); 221 RequestParams params = new RequestParams();
221 params.put(HttpKey.USERNAME, mobile); 222 params.put(HttpKey.USERNAME, mobile);
222 HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { 223 HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() {
223 @Override 224 @Override
224 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 225 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
225 Log.e("test", "isregistered" + response.toString()); 226 Log.e("test", "isregistered" + response.toString());
226 Message msg = Message.obtain(); 227 Message msg = Message.obtain();
227 msg.what = HttpCode.IS_REFISTER; 228 msg.what = HttpCode.IS_REFISTER;
228 msg.obj = response; 229 msg.obj = response;
229 handler.sendMessage(msg); 230 handler.sendMessage(msg);
230 231
231 } 232 }
232 233
233 @Override 234 @Override
234 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 235 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
235 new CircleDialog.Builder((FragmentActivity) mContext) 236 new CircleDialog.Builder((FragmentActivity) mContext)
236 .setCanceledOnTouchOutside(false) 237 .setCanceledOnTouchOutside(false)
237 .setCancelable(false) 238 .setCancelable(false)
238 .setWidth(0.5f) 239 .setWidth(0.5f)
239 .configText(new ConfigText() { 240 .configText(new ConfigText() {
240 @Override 241 @Override
241 public void onConfig(TextParams params) { 242 public void onConfig(TextParams params) {
242 params.gravity = Gravity.CENTER; 243 params.gravity = Gravity.CENTER;
243 params.padding = new int[]{50, 50, 50, 50}; 244 params.padding = new int[]{50, 50, 50, 50};
244 } 245 }
245 }) 246 })
246 .setText("当前无网络,请检查网络设置") 247 .setText("当前无网络,请检查网络设置")
247 .setNegative("继续使用", null) 248 .setNegative("继续使用", null)
248 .setPositive("设置网络", new View.OnClickListener() { 249 .setPositive("设置网络", new View.OnClickListener() {
249 @Override 250 @Override
250 public void onClick(View v) { 251 public void onClick(View v) {
251 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 252 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
252 mContext.startActivity(intent); 253 mContext.startActivity(intent);
253 } 254 }
254 }) 255 })
255 .show(); 256 .show();
256 257
257 } 258 }
258 }); 259 });
259 } 260 }
260 261
261 //修改密码 262 //修改密码
262 public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { 263 public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) {
263 RequestParams params = new RequestParams(); 264 RequestParams params = new RequestParams();
264 params.put(HttpKey.USERNAME, username); 265 params.put(HttpKey.USERNAME, username);
265 params.put(HttpKey.OLDPASS, old_pwd1); 266 params.put(HttpKey.OLDPASS, old_pwd1);
266 params.put(HttpKey.NEWPASS, newpassword3); 267 params.put(HttpKey.NEWPASS, newpassword3);
267 HttpClient.getInstance().addHeader("Accept", "*/*"); 268 HttpClient.getInstance().addHeader("Accept", "*/*");
268 HttpClient.getInstance().setTimeout(10 * 1000); 269 HttpClient.getInstance().setTimeout(10 * 1000);
269 HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { 270 HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() {
270 @Override 271 @Override
271 public void onSuccess(int i, Header[] headers, byte[] bytes) { 272 public void onSuccess(int i, Header[] headers, byte[] bytes) {
272 try { 273 try {
273 JSONObject jsonObject = new JSONObject(new String(bytes)); 274 JSONObject jsonObject = new JSONObject(new String(bytes));
274 String status = jsonObject.optString("status"); 275 String status = jsonObject.optString("status");
275 if (status.equals("100")) { 276 if (status.equals("100")) {
276 Log.e("test", "onSuccess" + new String(bytes)); 277 Log.e("test", "onSuccess" + new String(bytes));
277 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); 278 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show();
278 SaveParam.getInstance().clearData((Activity) context); 279 SaveParam.getInstance().clearData((Activity) context);
279 Intent intent = new Intent(); 280 Intent intent = new Intent();
280 intent.setClass(context, LoginAndRegisterActivity.class); 281 intent.setClass(context, LoginAndRegisterActivity.class);
281 ((Activity) context).startActivity(intent); 282 ((Activity) context).startActivity(intent);
282 ((Activity) context).finish(); 283 ((Activity) context).finish();
283 } 284 }
284 } catch (JSONException e) { 285 } catch (JSONException e) {
285 e.printStackTrace(); 286 e.printStackTrace();
286 } 287 }
287 } 288 }
288 289
289 @Override 290 @Override
290 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 291 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
291 Log.e("test", "onFailure" + new String(bytes)); 292 Log.e("test", "onFailure" + new String(bytes));
292 new CircleDialog.Builder((FragmentActivity) context) 293 new CircleDialog.Builder((FragmentActivity) context)
293 .setCanceledOnTouchOutside(false) 294 .setCanceledOnTouchOutside(false)
294 .setCancelable(false) 295 .setCancelable(false)
295 .setWidth(0.5f) 296 .setWidth(0.5f)
296 .configText(new ConfigText() { 297 .configText(new ConfigText() {
297 @Override 298 @Override
298 public void onConfig(TextParams params) { 299 public void onConfig(TextParams params) {
299 params.gravity = Gravity.CENTER; 300 params.gravity = Gravity.CENTER;
300 params.padding = new int[]{50, 50, 50, 50}; 301 params.padding = new int[]{50, 50, 50, 50};
301 } 302 }
302 }) 303 })
303 .setText("当前无网络,请检查网络设置") 304 .setText("当前无网络,请检查网络设置")
304 .setNegative("继续使用", null) 305 .setNegative("继续使用", null)
305 .setPositive("设置网络", new View.OnClickListener() { 306 .setPositive("设置网络", new View.OnClickListener() {
306 @Override 307 @Override
307 public void onClick(View v) { 308 public void onClick(View v) {
308 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 309 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
309 context.startActivity(intent); 310 context.startActivity(intent);
310 } 311 }
311 }) 312 })
312 .show(); 313 .show();
313 } 314 }
314 }); 315 });
315 316
316 } 317 }
317 318
318 //忘记密码 319 //忘记密码
319 public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { 320 public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) {
320 RequestParams params = new RequestParams(); 321 RequestParams params = new RequestParams();
321 params.put(HttpKey.USERNAME, forot_pwd_phone1); 322 params.put(HttpKey.USERNAME, forot_pwd_phone1);
322 params.put(HttpKey.PASSWORD, forot_pwd_pwd3); 323 params.put(HttpKey.PASSWORD, forot_pwd_pwd3);
323 params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); 324 params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1);
324 HttpClient.getInstance().addHeader("Accept", "*/*"); 325 HttpClient.getInstance().addHeader("Accept", "*/*");
325 HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { 326 HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() {
326 @Override 327 @Override
327 public void onSuccess(int i, Header[] headers, byte[] bytes) { 328 public void onSuccess(int i, Header[] headers, byte[] bytes) {
328 try { 329 try {
329 JSONObject jsonObject = new JSONObject(new String(bytes)); 330 JSONObject jsonObject = new JSONObject(new String(bytes));
330 String status = jsonObject.optString("status"); 331 String status = jsonObject.optString("status");
331 if (status.equals("100")) { 332 if (status.equals("100")) {
332 Log.e("test", "onSuccess" + new String(bytes)); 333 Log.e("test", "onSuccess" + new String(bytes));
333 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); 334 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show();
334 ((Activity) context).finish(); 335 ((Activity) context).finish();
335 } 336 }
336 } catch (JSONException e) { 337 } catch (JSONException e) {
337 e.printStackTrace(); 338 e.printStackTrace();
338 } 339 }
339 } 340 }
340 341
341 @Override 342 @Override
342 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 343 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
343 Log.e("test", "onFailure" + new String(bytes)); 344 Log.e("test", "onFailure" + new String(bytes));
344 new CircleDialog.Builder((FragmentActivity) context) 345 new CircleDialog.Builder((FragmentActivity) context)
345 .setCanceledOnTouchOutside(false) 346 .setCanceledOnTouchOutside(false)
346 .setCancelable(false) 347 .setCancelable(false)
347 .setWidth(0.5f) 348 .setWidth(0.5f)
348 .configText(new ConfigText() { 349 .configText(new ConfigText() {
349 @Override 350 @Override
350 public void onConfig(TextParams params) { 351 public void onConfig(TextParams params) {
351 params.gravity = Gravity.CENTER; 352 params.gravity = Gravity.CENTER;
352 params.padding = new int[]{50, 50, 50, 50}; 353 params.padding = new int[]{50, 50, 50, 50};
353 } 354 }
354 }) 355 })
355 .setText("当前无网络,请检查网络设置") 356 .setText("当前无网络,请检查网络设置")
356 .setNegative("继续使用", null) 357 .setNegative("继续使用", null)
357 .setPositive("设置网络", new View.OnClickListener() { 358 .setPositive("设置网络", new View.OnClickListener() {
358 @Override 359 @Override
359 public void onClick(View v) { 360 public void onClick(View v) {
360 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 361 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
361 context.startActivity(intent); 362 context.startActivity(intent);
362 } 363 }
363 }) 364 })
364 .show(); 365 .show();
365 } 366 }
366 }); 367 });
367 368
368 } 369 }
369 370
370 //保存用户登录信息 371 //保存用户登录信息
371 public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { 372 public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) {
372 SaveParam.getInstance().saveLoginParam(context, "username", username); 373 SaveParam.getInstance().saveLoginParam(context, "username", username);
373 SaveParam.getInstance().saveLoginParam(context, "password", password); 374 SaveParam.getInstance().saveLoginParam(context, "password", password);
374 SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); 375 SaveParam.getInstance().saveLoginParam(context, "access_token", access_token);
375 SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); 376 SaveParam.getInstance().saveLoginParam(context, "login", loginStatus);
376 SaveParam.getInstance().saveLoginParam(context, "userId", userId); 377 SaveParam.getInstance().saveLoginParam(context, "userId", userId);
377 378
378 379
379 } 380 }
380 381
381 //保存用户登录信息 382 //保存用户登录信息
382 public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) { 383 public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) {
383 SaveParam.getInstance().saveLoginParam(context, "lastname", lastname); 384 SaveParam.getInstance().saveLoginParam(context, "lastname", lastname);
384 SaveParam.getInstance().saveLoginParam(context, "gender", gender); 385 SaveParam.getInstance().saveLoginParam(context, "gender", gender);
385 SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait); 386 SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait);
386 } 387 }
387 388
388 //提交保卡信息 389 //提交保卡信息
389 public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, 390 public void subcardinfo(final Context context, long userId, String customerName, String customerAddress,
390 String buyAddress, String buyTime, String alterSaleCall, 391 String buyAddress, String buyTime, String alterSaleCall,
391 String productModel, String deviceNumber, String macAddress, 392 String productModel, String deviceNumber, String macAddress,
392 String mobilePhone) { 393 String mobilePhone) {
393 mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", 394 mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...",
394 false, true, null); 395 false, true, null);
395 RequestParams params = new RequestParams(); 396 RequestParams params = new RequestParams();
396 397
397 params.put(HttpKey.USEID, userId); 398 params.put(HttpKey.USEID, userId);
398 params.put(HttpKey.CUSTOMENAME, customerName); 399 params.put(HttpKey.CUSTOMENAME, customerName);
399 params.put(HttpKey.CUSTOMADRESS, customerAddress); 400 params.put(HttpKey.CUSTOMADRESS, customerAddress);
400 params.put(HttpKey.BUYADREES, buyAddress); 401 params.put(HttpKey.BUYADREES, buyAddress);
401 params.put(HttpKey.BUYTIME, buyTime); 402 params.put(HttpKey.BUYTIME, buyTime);
402 params.put(HttpKey.ALTERSALECALL, alterSaleCall); 403 params.put(HttpKey.ALTERSALECALL, alterSaleCall);
403 params.put(HttpKey.PRODUCTMODEL, productModel); 404 params.put(HttpKey.PRODUCTMODEL, productModel);
404 params.put(HttpKey.DEVICENUMBER, deviceNumber); 405 params.put(HttpKey.DEVICENUMBER, deviceNumber);
405 params.put(HttpKey.MACADRESS, macAddress); 406 params.put(HttpKey.MACADRESS, macAddress);
406 params.put(HttpKey.MOBILPHONE, mobilePhone); 407 params.put(HttpKey.MOBILPHONE, mobilePhone);
407 408
408 HttpClient.getInstance().addHeader("Accept", "*/*"); 409 HttpClient.getInstance().addHeader("Accept", "*/*");
409 410
410 Log.e("test", "params" + params); 411 Log.e("test", "params" + params);
411 HttpClient.getInstance().setTimeout(5 * 1000); 412 HttpClient.getInstance().setTimeout(5 * 1000);
412 HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { 413 HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() {
413 @Override 414 @Override
414 public void onSuccess(int i, Header[] headers, byte[] bytes) { 415 public void onSuccess(int i, Header[] headers, byte[] bytes) {
415 JSONObject jsonObject = null; 416 JSONObject jsonObject = null;
416 closeProgress(); 417 closeProgress();
417 try { 418 try {
418 jsonObject = new JSONObject(new String(bytes)); 419 jsonObject = new JSONObject(new String(bytes));
419 String status = jsonObject.optString("status"); 420 String status = jsonObject.optString("status");
420 if (status.equals("1")) { 421 if (status.equals("1")) {
421 Log.e("test", "onSuccess" + jsonObject); 422 Log.e("test", "onSuccess" + jsonObject);
422 Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); 423 Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show();
423 Intent intent = new Intent(); 424 Intent intent = new Intent();
424 intent.setClass((Activity) context, TheStartPageActivity.class); 425 intent.setClass((Activity) context, TheStartPageActivity.class);
425 ((Activity) context).startActivity(intent); 426 ((Activity) context).startActivity(intent);
426 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); 427 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout);
427 ((Activity) context).finish(); 428 ((Activity) context).finish();
428 } 429 }
429 } catch (JSONException e) { 430 } catch (JSONException e) {
430 e.printStackTrace(); 431 e.printStackTrace();
431 } 432 }
432 433
433 434
434 } 435 }
435 436
436 @Override 437 @Override
437 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 438 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
438 Log.e("test", "onFailure" + (throwable)); 439 Log.e("test", "onFailure" + (throwable));
439 closeProgress(); 440 closeProgress();
440 new CircleDialog.Builder((FragmentActivity) context) 441 new CircleDialog.Builder((FragmentActivity) context)
441 .setCanceledOnTouchOutside(false) 442 .setCanceledOnTouchOutside(false)
442 .setCancelable(false) 443 .setCancelable(false)
443 .setWidth(0.5f) 444 .setWidth(0.5f)
444 .configText(new ConfigText() { 445 .configText(new ConfigText() {
445 @Override 446 @Override
446 public void onConfig(TextParams params) { 447 public void onConfig(TextParams params) {
447 params.gravity = Gravity.CENTER; 448 params.gravity = Gravity.CENTER;
448 params.padding = new int[]{50, 50, 50, 50}; 449 params.padding = new int[]{50, 50, 50, 50};
449 } 450 }
450 }) 451 })
451 .setText("当前无网络,请检查网络设置") 452 .setText("当前无网络,请检查网络设置")
452 .setNegative("继续使用", null) 453 .setNegative("继续使用", null)
453 .setPositive("设置网络", new View.OnClickListener() { 454 .setPositive("设置网络", new View.OnClickListener() {
454 @Override 455 @Override
455 public void onClick(View v) { 456 public void onClick(View v) {
456 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 457 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
457 context.startActivity(intent); 458 context.startActivity(intent);
458 } 459 }
459 }) 460 })
460 .show(); 461 .show();
461 462
462 } 463 }
463 }); 464 });
464 465
465 } 466 }
466 //获取保卡信息 467 //获取保卡信息
467 public void getcardinfo(final Context mContext, long userId , final Handler handler) { 468 public void getcardinfo(final Context mContext, long userId , final Handler handler) {
468 mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", 469 mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...",
469 false, true, null); 470 false, true, null);
470 HttpClient.getInstance().setTimeout(5 * 1000); 471 HttpClient.getInstance().setTimeout(5 * 1000);
471 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 472 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
472 HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() { 473 HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() {
473 @Override 474 @Override
474 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 475 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
475 closeProgress(); 476 closeProgress();
476 Log.e("test", "保卡信息" + new String(arg2)); 477 Log.e("test", "保卡信息" + new String(arg2));
477 CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 478 CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据
478 CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); 479 CardInfo.DataBean schoolInfoBeanList = cardInfo.getData();
479 Message msg = Message.obtain(); 480 Message msg = Message.obtain();
480 msg.what = HttpCode.SUCHCARDINFO; 481 msg.what = HttpCode.SUCHCARDINFO;
481 msg.obj = schoolInfoBeanList; 482 msg.obj = schoolInfoBeanList;
482 handler.sendMessage(msg); 483 handler.sendMessage(msg);
483 } 484 }
484 485
485 @Override 486 @Override
486 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 487 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
487 closeProgress(); 488 closeProgress();
488 new CircleDialog.Builder((FragmentActivity) mContext) 489 new CircleDialog.Builder((FragmentActivity) mContext)
489 .setCanceledOnTouchOutside(false) 490 .setCanceledOnTouchOutside(false)
490 .setCancelable(false) 491 .setCancelable(false)
491 .setWidth(0.5f) 492 .setWidth(0.5f)
492 .configText(new ConfigText() { 493 .configText(new ConfigText() {
493 @Override 494 @Override
494 public void onConfig(TextParams params) { 495 public void onConfig(TextParams params) {
495 params.gravity = Gravity.CENTER; 496 params.gravity = Gravity.CENTER;
496 params.padding = new int[]{50, 50, 50, 50}; 497 params.padding = new int[]{50, 50, 50, 50};
497 } 498 }
498 }) 499 })
499 .setText("当前无网络,请检查网络设置") 500 .setText("当前无网络,请检查网络设置")
500 .setNegative("继续使用", null) 501 .setNegative("继续使用", null)
501 .setPositive("设置网络", new View.OnClickListener() { 502 .setPositive("设置网络", new View.OnClickListener() {
502 @Override 503 @Override
503 public void onClick(View v) { 504 public void onClick(View v) {
504 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 505 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
505 mContext.startActivity(intent); 506 mContext.startActivity(intent);
506 } 507 }
507 }) 508 })
508 .show(); 509 .show();
509 } 510 }
510 }); 511 });
511 } 512 }
512 //修改保卡信息电话 513 //修改保卡信息电话
513 public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { 514 public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) {
514 RequestParams params = new RequestParams(); 515 RequestParams params = new RequestParams();
515 params.put("userId", userId); 516 params.put("userId", userId);
516 params.put("customerPhone", customerPhone); 517 params.put("customerPhone", customerPhone);
517 params.put("authCode", authCode); 518 params.put("authCode", authCode);
518 HttpClient.getInstance().addHeader("Accept", "*/*"); 519 HttpClient.getInstance().addHeader("Accept", "*/*");
519 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { 520 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() {
520 @Override 521 @Override
521 public void onSuccess(int i, Header[] headers, byte[] bytes) { 522 public void onSuccess(int i, Header[] headers, byte[] bytes) {
522 try { 523 try {
523 JSONObject jsonObject = new JSONObject(new String(bytes)); 524 JSONObject jsonObject = new JSONObject(new String(bytes));
524 String status = jsonObject.optString("status"); 525 String status = jsonObject.optString("status");
525 if (status.equals("1")) { 526 if (status.equals("1")) {
526 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); 527 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show();
527 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone); 528 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone);
528 ((Activity) mContext).finish(); 529 ((Activity) mContext).finish();
529 }else if (status.equals("1001")){ 530 }else if (status.equals("1001")){
530 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); 531 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show();
531 } 532 }
532 } catch (JSONException e) { 533 } catch (JSONException e) {
533 e.printStackTrace(); 534 e.printStackTrace();
534 } 535 }
535 } 536 }
536 537
537 @Override 538 @Override
538 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 539 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
539 Log.e("test", "onFailure" + new String(bytes)); 540 Log.e("test", "onFailure" + new String(bytes));
540 new CircleDialog.Builder((FragmentActivity) mContext) 541 new CircleDialog.Builder((FragmentActivity) mContext)
541 .setCanceledOnTouchOutside(false) 542 .setCanceledOnTouchOutside(false)
542 .setCancelable(false) 543 .setCancelable(false)
543 .setWidth(0.5f) 544 .setWidth(0.5f)
544 .configText(new ConfigText() { 545 .configText(new ConfigText() {
545 @Override 546 @Override
546 public void onConfig(TextParams params) { 547 public void onConfig(TextParams params) {
547 params.gravity = Gravity.CENTER; 548 params.gravity = Gravity.CENTER;
548 params.padding = new int[]{50, 50, 50, 50}; 549 params.padding = new int[]{50, 50, 50, 50};
549 } 550 }
550 }) 551 })
551 .setText("当前无网络,请检查网络设置") 552 .setText("当前无网络,请检查网络设置")
552 .setNegative("继续使用", null) 553 .setNegative("继续使用", null)
553 .setPositive("设置网络", new View.OnClickListener() { 554 .setPositive("设置网络", new View.OnClickListener() {
554 @Override 555 @Override
555 public void onClick(View v) { 556 public void onClick(View v) {
556 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 557 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
557 mContext.startActivity(intent); 558 mContext.startActivity(intent);
558 } 559 }
559 }) 560 })
560 .show(); 561 .show();
561 } 562 }
562 }); 563 });
563 } 564 }
564 //修改保卡信息地址 565 //修改保卡信息地址
565 public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { 566 public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) {
566 RequestParams params = new RequestParams(); 567 RequestParams params = new RequestParams();
567 params.put("userId", userId); 568 params.put("userId", userId);
568 params.put("customerPhone", customerPhone); 569 params.put("customerPhone", customerPhone);
569 params.put("authCode", authCode); 570 params.put("authCode", authCode);
570 params.put("customerAddress", customerAddress); 571 params.put("customerAddress", customerAddress);
571 HttpClient.getInstance().addHeader("Accept", "*/*"); 572 HttpClient.getInstance().addHeader("Accept", "*/*");
572 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { 573 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() {
573 @Override 574 @Override
574 public void onSuccess(int i, Header[] headers, byte[] bytes) { 575 public void onSuccess(int i, Header[] headers, byte[] bytes) {
575 try { 576 try {
576 JSONObject jsonObject = new JSONObject(new String(bytes)); 577 JSONObject jsonObject = new JSONObject(new String(bytes));
577 String status = jsonObject.optString("status"); 578 String status = jsonObject.optString("status");
578 if (status.equals("1")) { 579 if (status.equals("1")) {
579 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); 580 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show();
580 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress); 581 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress);
581 ((Activity) mContext).finish(); 582 ((Activity) mContext).finish();
582 } 583 }
583 } catch (JSONException e) { 584 } catch (JSONException e) {
584 e.printStackTrace(); 585 e.printStackTrace();
585 } 586 }
586 } 587 }
587 588
588 @Override 589 @Override
589 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 590 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
590 Log.e("test", "onFailure" + new String(bytes)); 591 Log.e("test", "onFailure" + new String(bytes));
591 new CircleDialog.Builder((FragmentActivity) mContext) 592 new CircleDialog.Builder((FragmentActivity) mContext)
592 .setCanceledOnTouchOutside(false) 593 .setCanceledOnTouchOutside(false)
593 .setCancelable(false) 594 .setCancelable(false)
594 .setWidth(0.5f) 595 .setWidth(0.5f)
595 .configText(new ConfigText() { 596 .configText(new ConfigText() {
596 @Override 597 @Override
597 public void onConfig(TextParams params) { 598 public void onConfig(TextParams params) {
598 params.gravity = Gravity.CENTER; 599 params.gravity = Gravity.CENTER;
599 params.padding = new int[]{50, 50, 50, 50}; 600 params.padding = new int[]{50, 50, 50, 50};
600 } 601 }
601 }) 602 })
602 .setText("当前无网络,请检查网络设置") 603 .setText("当前无网络,请检查网络设置")
603 .setNegative("继续使用", null) 604 .setNegative("继续使用", null)
604 .setPositive("设置网络", new View.OnClickListener() { 605 .setPositive("设置网络", new View.OnClickListener() {
605 @Override 606 @Override
606 public void onClick(View v) { 607 public void onClick(View v) {
607 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 608 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
608 mContext.startActivity(intent); 609 mContext.startActivity(intent);
609 } 610 }
610 }) 611 })
611 .show(); 612 .show();
612 } 613 }
613 }); 614 });
614 } 615 }
615 //验证是否保卡信息 616 //验证是否保卡信息
616 public void cardinfocheck(final Context mContext, long userId, final Handler handler) { 617 public void cardinfocheck(final Context mContext, long userId, final Handler handler) {
617 mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", 618 mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...",
618 false, true, null); 619 false, true, null);
619 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 620 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
620 HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() { 621 HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() {
621 @Override 622 @Override
622 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 623 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
623 Log.e("test", "---" + new String(arg2)); 624 Log.e("test", "---" + new String(arg2));
624 closeProgress(); 625 closeProgress();
625 Message msg = Message.obtain(); 626 Message msg = Message.obtain();
626 msg.what = HttpCode.CHECKCARD; 627 msg.what = HttpCode.CHECKCARD;
627 msg.obj = new String(arg2); 628 msg.obj = new String(arg2);
628 handler.sendMessage(msg); 629 handler.sendMessage(msg);
629 } 630 }
630 631
631 @Override 632 @Override
632 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 633 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
633 closeProgress(); 634 closeProgress();
634 new CircleDialog.Builder((FragmentActivity) mContext) 635 new CircleDialog.Builder((FragmentActivity) mContext)
635 .setCanceledOnTouchOutside(false) 636 .setCanceledOnTouchOutside(false)
636 .setCancelable(false) 637 .setCancelable(false)
637 .configText(new ConfigText() { 638 .configText(new ConfigText() {
638 @Override 639 @Override
639 public void onConfig(TextParams params) { 640 public void onConfig(TextParams params) {
640 params.gravity = Gravity.CENTER; 641 params.gravity = Gravity.CENTER;
641 params.padding = new int[]{250, 50, 250, 50}; 642 params.padding = new int[]{250, 50, 250, 50};
642 } 643 }
643 }) 644 })
644 .setText("当前无网络,请检查网络设置") 645 .setText("当前无网络,请检查网络设置")
645 .setNegative("取消", null) 646 .setNegative("取消", null)
646 .setPositive("确定", new View.OnClickListener() { 647 .setPositive("确定", new View.OnClickListener() {
647 @Override 648 @Override
648 public void onClick(View v) { 649 public void onClick(View v) {
649 Intent intent = new Intent("/"); 650 Intent intent = new Intent("/");
650 ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings"); 651 ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings");
651 intent.setComponent(cm); 652 intent.setComponent(cm);
652 intent.setAction("android.intent.action.VIEW"); 653 intent.setAction("android.intent.action.VIEW");
653 ((Activity) mContext).startActivityForResult( intent , 0); 654 ((Activity) mContext).startActivityForResult( intent , 0);
654 } 655 }
655 }) 656 })
656 .show(); 657 .show();
657 //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); 658 //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show();
658 } 659 }
659 }); 660 });
660 } 661 }
661 662
662 ///获取年级 663 ///获取年级
663 public void getgrade(final Context mContext, final Handler handler) { 664 public void getgrade(final Context mContext, final Handler handler) {
664 HttpClient.getInstance().addHeader("Accept", "application/json"); 665 HttpClient.getInstance().addHeader("Accept", "application/json");
665 HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { 666 HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() {
666 @Override 667 @Override
667 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 668 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
668 Log.e("test", "年级" + new String(arg2)); 669 Log.e("test", "年级" + new String(arg2));
669 GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 670 GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据
670 List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); 671 List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>();
671 for (int i = 0 ;i<gradeInfo.getData().size()-2;i++) { 672 for (int i = 0 ;i<gradeInfo.getData().size()-2;i++) {
672 String name = gradeInfo.getData().get(i).getName(); 673 String name = gradeInfo.getData().get(i).getName();
673 int id = gradeInfo.getData().get(i).getId(); 674 int id = gradeInfo.getData().get(i).getId();
674 List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); 675 List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren();
675 for (int j = 0; j < gradeinfoList.size(); j++) { 676 for (int j = 0; j < gradeinfoList.size(); j++) {
676 String secondname = gradeinfoList.get(j).getName(); 677 String secondname = gradeinfoList.get(j).getName();
677 int secondid = gradeinfoList.get(j).getId(); 678 int secondid = gradeinfoList.get(j).getId();
678 GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); 679 GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean();
679 dataBean.setName(secondname); 680 dataBean.setName(secondname);
680 dataBean.setId(secondid); 681 dataBean.setId(secondid);
681 gradeInfoLists.add(dataBean); 682 gradeInfoLists.add(dataBean);
682 } 683 }
683 684
684 } 685 }
685 686
686 Message message = Message.obtain(); 687 Message message = Message.obtain();
687 message.what = HttpCode.GRADER; 688 message.what = HttpCode.GRADER;
688 message.obj = gradeInfoLists; 689 message.obj = gradeInfoLists;
689 handler.sendMessage(message); 690 handler.sendMessage(message);
690 691
691 692
692 } 693 }
693 694
694 @Override 695 @Override
695 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 696 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
696 new CircleDialog.Builder((FragmentActivity) mContext) 697 new CircleDialog.Builder((FragmentActivity) mContext)
697 .setCanceledOnTouchOutside(false) 698 .setCanceledOnTouchOutside(false)
698 .setCancelable(false) 699 .setCancelable(false)
699 .setWidth(0.5f) 700 .setWidth(0.5f)
700 .configText(new ConfigText() { 701 .configText(new ConfigText() {
701 @Override 702 @Override
702 public void onConfig(TextParams params) { 703 public void onConfig(TextParams params) {
703 params.gravity = Gravity.CENTER; 704 params.gravity = Gravity.CENTER;
704 params.padding = new int[]{50, 50, 50, 50}; 705 params.padding = new int[]{50, 50, 50, 50};
705 } 706 }
706 }) 707 })
707 .setText("当前无网络,请检查网络设置") 708 .setText("当前无网络,请检查网络设置")
708 .setNegative("继续使用", null) 709 .setNegative("继续使用", null)
709 .setPositive("设置网络", new View.OnClickListener() { 710 .setPositive("设置网络", new View.OnClickListener() {
710 @Override 711 @Override
711 public void onClick(View v) { 712 public void onClick(View v) {
712 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 713 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
713 mContext.startActivity(intent); 714 mContext.startActivity(intent);
714 } 715 }
715 }) 716 })
716 .show(); 717 .show();
717 } 718 }
718 }); 719 });
719 } 720 }
720 721
721 /** 722 /**
722 * 获取学校 723 * 获取学校
723 * @param mContext 724 * @param mContext
724 * @param regionId 725 * @param regionId
725 * @param gradeId 726 * @param gradeId
726 * @param handler 727 * @param handler
727 */ 728 */
728 public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { 729 public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) {
729 HttpClient.getInstance().addHeader("Accept", "application/json"); 730 HttpClient.getInstance().addHeader("Accept", "application/json");
730 HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { 731 HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() {
731 @Override 732 @Override
732 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 733 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
733 Log.e("test", "学校" + new String(arg2)); 734 Log.e("test", "学校" + new String(arg2));
734 SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 735 SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据
735 List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); 736 List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData();
736 Message message = Message.obtain(); 737 Message message = Message.obtain();
737 message.what = HttpCode.SCHOOL; 738 message.what = HttpCode.SCHOOL;
738 message.obj = schoolInfoBeanList; 739 message.obj = schoolInfoBeanList;
739 handler.sendMessage(message); 740 handler.sendMessage(message);
740 741
741 } 742 }
742 743
743 @Override 744 @Override
744 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 745 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
745 new CircleDialog.Builder((FragmentActivity) mContext) 746 new CircleDialog.Builder((FragmentActivity) mContext)
746 .setCanceledOnTouchOutside(false) 747 .setCanceledOnTouchOutside(false)
747 .setCancelable(false) 748 .setCancelable(false)
748 .setWidth(0.5f) 749 .setWidth(0.5f)
749 .configText(new ConfigText() { 750 .configText(new ConfigText() {
750 @Override 751 @Override
751 public void onConfig(TextParams params) { 752 public void onConfig(TextParams params) {
752 params.gravity = Gravity.CENTER; 753 params.gravity = Gravity.CENTER;
753 params.padding = new int[]{50, 50, 50, 50}; 754 params.padding = new int[]{50, 50, 50, 50};
754 } 755 }
755 }) 756 })
756 .setText("当前无网络,请检查网络设置") 757 .setText("当前无网络,请检查网络设置")
757 .setNegative("继续使用", null) 758 .setNegative("继续使用", null)
758 .setPositive("设置网络", new View.OnClickListener() { 759 .setPositive("设置网络", new View.OnClickListener() {
759 @Override 760 @Override
760 public void onClick(View v) { 761 public void onClick(View v) {
761 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 762 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
762 mContext.startActivity(intent); 763 mContext.startActivity(intent);
763 } 764 }
764 }) 765 })
765 .show(); 766 .show();
766 } 767 }
767 }); 768 });
768 } 769 }
769 770
770 771
771 772
772 /** 773 /**
773 * 获取个人信息 774 * 获取个人信息
774 * @param mContext 775 * @param mContext
775 * @param userId 776 * @param userId
776 * @param handler 777 * @param handler
777 */ 778 */
778 public void getpresonalinfo(final Context mContext, long userId, final Handler handler) { 779 public void getpresonalinfo(final Context mContext, long userId, final Handler handler) {
779 mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", 780 mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...",
780 false, true, null); 781 false, true, null);
781 HttpClient.getInstance().addHeader("Accept", "application/json"); 782 HttpClient.getInstance().addHeader("Accept", "application/json");
782 HttpClient.getInstance().setConnectTimeout(5*1000); 783 HttpClient.getInstance().setConnectTimeout(5*1000);
783 HttpClient.getInstance().get(HttpUrl.getpresonalinfo+ "?userId=" + userId, new AsyncHttpResponseHandler() { 784 HttpClient.getInstance().get(HttpUrl.getpresonalinfo+ "?userId=" + userId, new AsyncHttpResponseHandler() {
784 @Override 785 @Override
785 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 786 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
786 closeProgress(); 787 closeProgress();
787 Log.e("test", "个人信息" + new String(arg2)); 788 Log.e("test", "个人信息" + new String(arg2));
788 PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 789 PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据
789 PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); 790 PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData();
790 Message message = Message.obtain(); 791 Message message = Message.obtain();
791 message.what = HttpCode.GETINFO; 792 message.what = HttpCode.GETINFO;
792 message.obj = pesonalInfoBeanList; 793 message.obj = pesonalInfoBeanList;
793 handler.sendMessage(message); 794 handler.sendMessage(message);
794 795
795 } 796 }
796 797
797 @Override 798 @Override
798 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 799 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
799 closeProgress(); 800 closeProgress();
800 new CircleDialog.Builder((FragmentActivity) mContext) 801 new CircleDialog.Builder((FragmentActivity) mContext)
801 .setCanceledOnTouchOutside(false) 802 .setCanceledOnTouchOutside(false)
802 .setCancelable(false) 803 .setCancelable(false)
803 .setWidth(0.5f) 804 .setWidth(0.5f)
804 .configText(new ConfigText() { 805 .configText(new ConfigText() {
805 @Override 806 @Override
806 public void onConfig(TextParams params) { 807 public void onConfig(TextParams params) {
807 params.gravity = Gravity.CENTER; 808 params.gravity = Gravity.CENTER;
808 params.padding = new int[]{50, 50, 50, 50}; 809 params.padding = new int[]{50, 50, 50, 50};
809 } 810 }
810 }) 811 })
811 .setText("当前无网络,请检查网络设置") 812 .setText("当前无网络,请检查网络设置")
812 .setNegative("继续使用", null) 813 .setNegative("继续使用", null)
813 .setPositive("设置网络", new View.OnClickListener() { 814 .setPositive("设置网络", new View.OnClickListener() {
814 @Override 815 @Override
815 public void onClick(View v) { 816 public void onClick(View v) {
816 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 817 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
817 mContext.startActivity(intent); 818 mContext.startActivity(intent);
818 } 819 }
819 }) 820 })
820 .show(); 821 .show();
821 } 822 }
822 }); 823 });
823 } 824 }
824 //修改个人信息 825 //修改个人信息
825 public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException { 826 public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException {
826 Gson gson = new Gson(); 827 Gson gson = new Gson();
827 String jsonObject = gson.toJson(object); 828 String jsonObject = gson.toJson(object);
828 Log.e("test", "onSuccess" + jsonObject); 829 Log.e("test", "onSuccess" + jsonObject);
829 mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", 830 mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...",
830 false, true, null); 831 false, true, null);
831 ByteArrayEntity entity = null; 832 ByteArrayEntity entity = null;
832 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); 833 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8"));
833 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); 834 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
834 835
835 HttpClient.getInstance().addHeader("Accept", "*/*"); 836 HttpClient.getInstance().addHeader("Accept", "*/*");
836 HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() { 837 HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() {
837 @Override 838 @Override
838 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 839 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
839 super.onSuccess(statusCode, headers, response); 840 super.onSuccess(statusCode, headers, response);
840 closeProgress(); 841 closeProgress();
841 String status = response.optString("status"); 842 String status = response.optString("status");
842 if (status.equals("1")) { 843 if (status.equals("1")) {
843 Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); 844 Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show();
844 ((Activity) mContext).finish(); 845 ((Activity) mContext).finish();
845 } 846 }
846 Log.e("test", "onSuccess" + response); 847 Log.e("test", "onSuccess" + response);
847 848
848 } 849 }
849 850
850 @Override 851 @Override
851 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 852 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
852 super.onFailure(statusCode, headers, throwable, errorResponse); 853 super.onFailure(statusCode, headers, throwable, errorResponse);
853 closeProgress(); 854 closeProgress();
854 Log.e("test", "onFailure" + errorResponse); 855 Log.e("test", "onFailure" + errorResponse);
855 new CircleDialog.Builder((FragmentActivity) mContext) 856 new CircleDialog.Builder((FragmentActivity) mContext)
856 .setCanceledOnTouchOutside(false) 857 .setCanceledOnTouchOutside(false)
857 .setCancelable(false) 858 .setCancelable(false)
858 .setWidth(0.5f) 859 .setWidth(0.5f)
859 .configText(new ConfigText() { 860 .configText(new ConfigText() {
860 @Override 861 @Override
861 public void onConfig(TextParams params) { 862 public void onConfig(TextParams params) {
862 params.gravity = Gravity.CENTER; 863 params.gravity = Gravity.CENTER;
863 params.padding = new int[]{50, 50, 50, 50}; 864 params.padding = new int[]{50, 50, 50, 50};
864 } 865 }
865 }) 866 })
866 .setText("当前无网络,请检查网络设置") 867 .setText("当前无网络,请检查网络设置")
867 .setNegative("继续使用", null) 868 .setNegative("继续使用", null)
868 .setPositive("设置网络", new View.OnClickListener() { 869 .setPositive("设置网络", new View.OnClickListener() {
869 @Override 870 @Override
870 public void onClick(View v) { 871 public void onClick(View v) {
871 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 872 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
872 mContext.startActivity(intent); 873 mContext.startActivity(intent);
873 } 874 }
874 }) 875 })
875 .show(); 876 .show();
876 } 877 }
877 878
878 }); 879 });
879 } 880 }
880 //修改个性签名 881 //修改个性签名
881 public void changsignature(final Context mContext, long userId, final String signature) { 882 public void changsignature(final Context mContext, long userId, final String signature) {
882 RequestParams params = new RequestParams(); 883 RequestParams params = new RequestParams();
883 params.put("userId", userId); 884 params.put("userId", userId);
884 params.put("signature", signature); 885 params.put("signature", signature);
885 HttpClient.getInstance().addHeader("Accept", "*/*"); 886 HttpClient.getInstance().addHeader("Accept", "*/*");
886 HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { 887 HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() {
887 @Override 888 @Override
888 public void onSuccess(int i, Header[] headers, byte[] bytes) { 889 public void onSuccess(int i, Header[] headers, byte[] bytes) {
889 try { 890 try {
890 JSONObject jsonObject = new JSONObject(new String(bytes)); 891 JSONObject jsonObject = new JSONObject(new String(bytes));
891 String status = jsonObject.optString("status"); 892 String status = jsonObject.optString("status");
892 if (status.equals("1")) { 893 if (status.equals("1")) {
893 Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); 894 Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show();
894 } 895 }
895 } catch (JSONException e) { 896 } catch (JSONException e) {
896 e.printStackTrace(); 897 e.printStackTrace();
897 } 898 }
898 } 899 }
899 900
900 @Override 901 @Override
901 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 902 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
902 Log.e("test", "onFailure" + new String(bytes)); 903 Log.e("test", "onFailure" + new String(bytes));
903 new CircleDialog.Builder((FragmentActivity) mContext) 904 new CircleDialog.Builder((FragmentActivity) mContext)
904 .setCanceledOnTouchOutside(false) 905 .setCanceledOnTouchOutside(false)
905 .setCancelable(false) 906 .setCancelable(false)
906 .setWidth(0.5f) 907 .setWidth(0.5f)
907 .configText(new ConfigText() { 908 .configText(new ConfigText() {
908 @Override 909 @Override
909 public void onConfig(TextParams params) { 910 public void onConfig(TextParams params) {
910 params.gravity = Gravity.CENTER; 911 params.gravity = Gravity.CENTER;
911 params.padding = new int[]{50, 50, 50, 50}; 912 params.padding = new int[]{50, 50, 50, 50};
912 } 913 }
913 }) 914 })
914 .setText("当前无网络,请检查网络设置") 915 .setText("当前无网络,请检查网络设置")
915 .setNegative("继续使用", null) 916 .setNegative("继续使用", null)
916 .setPositive("设置网络", new View.OnClickListener() { 917 .setPositive("设置网络", new View.OnClickListener() {
917 @Override 918 @Override
918 public void onClick(View v) { 919 public void onClick(View v) {
919 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 920 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
920 mContext.startActivity(intent); 921 mContext.startActivity(intent);
921 } 922 }
922 }) 923 })
923 .show(); 924 .show();
924 } 925 }
925 }); 926 });
926 } 927 }
927 928
928 /** 929 /**
929 * 获取个性签名 930 * 获取个性签名
930 * @param mContext 931 * @param mContext
931 * @param userId 932 * @param userId
932 * @param handler 933 * @param handler
933 */ 934 */
934 public void getsignatures(final Context mContext,long userId , final Handler handler) { 935 public void getsignatures(final Context mContext,long userId , final Handler handler) {
935 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 936 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
936 HttpClient.getInstance().get(HttpUrl.getsignature+"?userId="+userId, new AsyncHttpResponseHandler() { 937 HttpClient.getInstance().get(HttpUrl.getsignature+"?userId="+userId, new AsyncHttpResponseHandler() {
937 @Override 938 @Override
938 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 939 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
939 Log.e("test", "个性签名" + new String(arg2)); 940 Log.e("test", "个性签名" + new String(arg2));
940 SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 941 SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据
941 SignInfo.DataBean signInfoBeanList = signInfo.getData(); 942 SignInfo.DataBean signInfoBeanList = signInfo.getData();
942 Message message = Message.obtain(); 943 Message message = Message.obtain();
943 message.what = HttpCode.SIGN; 944 message.what = HttpCode.SIGN;
944 message.obj = signInfoBeanList; 945 message.obj = signInfoBeanList;
945 handler.sendMessage(message); 946 handler.sendMessage(message);
946 947
947 } 948 }
948 949
949 @Override 950 @Override
950 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 951 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
951 Log.e("test", "失败原因" + arg3); 952 Log.e("test", "失败原因" + arg3);
952 new CircleDialog.Builder((FragmentActivity) mContext) 953 new CircleDialog.Builder((FragmentActivity) mContext)
953 .setCanceledOnTouchOutside(false) 954 .setCanceledOnTouchOutside(false)
954 .setCancelable(false) 955 .setCancelable(false)
955 .setWidth(0.5f) 956 .setWidth(0.5f)
956 .configText(new ConfigText() { 957 .configText(new ConfigText() {
957 @Override 958 @Override
958 public void onConfig(TextParams params) { 959 public void onConfig(TextParams params) {
959 params.gravity = Gravity.CENTER; 960 params.gravity = Gravity.CENTER;
960 params.padding = new int[]{50, 50, 50, 50}; 961 params.padding = new int[]{50, 50, 50, 50};
961 } 962 }
962 }) 963 })
963 .setText("当前无网络,请检查网络设置") 964 .setText("当前无网络,请检查网络设置")
964 .setNegative("继续使用", null) 965 .setNegative("继续使用", null)
965 .setPositive("设置网络", new View.OnClickListener() { 966 .setPositive("设置网络", new View.OnClickListener() {
966 @Override 967 @Override
967 public void onClick(View v) { 968 public void onClick(View v) {
968 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 969 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
969 mContext.startActivity(intent); 970 mContext.startActivity(intent);
970 } 971 }
971 }) 972 })
972 .show(); 973 .show();
973 } 974 }
974 }); 975 });
975 } 976 }
976 977
977 /** 978 /**
978 * 用户反馈 979 * 用户反馈
979 * @param mContext 980 * @param mContext
980 * @param object 981 * @param object
981 * @throws UnsupportedEncodingException 982 * @throws UnsupportedEncodingException
982 */ 983 */
983 public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException { 984 public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException {
984 Gson gson = new Gson(); 985 Gson gson = new Gson();
985 String jsonObject = gson.toJson(object); 986 String jsonObject = gson.toJson(object);
986 Log.e("test", "onSuccess" + jsonObject); 987 Log.e("test", "onSuccess" + jsonObject);
987 mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", 988 mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...",
988 false, true, null); 989 false, true, null);
989 ByteArrayEntity entity = null; 990 ByteArrayEntity entity = null;
990 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); 991 entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8"));
991 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); 992 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
992 993
993 HttpClient.getInstance().addHeader("Accept", "*/*"); 994 HttpClient.getInstance().addHeader("Accept", "*/*");
994 HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() { 995 HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() {
995 @Override 996 @Override
996 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 997 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
997 super.onSuccess(statusCode, headers, response); 998 super.onSuccess(statusCode, headers, response);
998 closeProgress(); 999 closeProgress();
999 String status = response.optString("status"); 1000 String status = response.optString("status");
1000 if (status.equals("1")) { 1001 if (status.equals("1")) {
1001 Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show(); 1002 Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show();
1002 ((Activity) mContext).finish(); 1003 ((Activity) mContext).finish();
1003 } 1004 }
1004 Log.e("test", "onSuccess" + response); 1005 Log.e("test", "onSuccess" + response);
1005 1006
1006 } 1007 }
1007 1008
1008 @Override 1009 @Override
1009 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 1010 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
1010 super.onFailure(statusCode, headers, throwable, errorResponse); 1011 super.onFailure(statusCode, headers, throwable, errorResponse);
1011 closeProgress(); 1012 closeProgress();
1012 Log.e("test", "onFailure" + errorResponse); 1013 Log.e("test", "onFailure" + errorResponse);
1013 new CircleDialog.Builder((FragmentActivity) mContext) 1014 new CircleDialog.Builder((FragmentActivity) mContext)
1014 .setCanceledOnTouchOutside(false) 1015 .setCanceledOnTouchOutside(false)
1015 .setCancelable(false) 1016 .setCancelable(false)
1016 .setWidth(0.5f) 1017 .setWidth(0.5f)
1017 .configText(new ConfigText() { 1018 .configText(new ConfigText() {
1018 @Override 1019 @Override
1019 public void onConfig(TextParams params) { 1020 public void onConfig(TextParams params) {
1020 params.gravity = Gravity.CENTER; 1021 params.gravity = Gravity.CENTER;
1021 params.padding = new int[]{50, 50, 50, 50}; 1022 params.padding = new int[]{50, 50, 50, 50};
1022 } 1023 }
1023 }) 1024 })
1024 .setText("当前无网络,请检查网络设置") 1025 .setText("当前无网络,请检查网络设置")
1025 .setNegative("继续使用", null) 1026 .setNegative("继续使用", null)
1026 .setPositive("设置网络", new View.OnClickListener() { 1027 .setPositive("设置网络", new View.OnClickListener() {
1027 @Override 1028 @Override
1028 public void onClick(View v) { 1029 public void onClick(View v) {
1029 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1030 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1030 mContext.startActivity(intent); 1031 mContext.startActivity(intent);
1031 } 1032 }
1032 }) 1033 })
1033 .show(); 1034 .show();
1034 } 1035 }
1035 1036
1036 }); 1037 });
1037 } 1038 }
1038 1039
1039 /** 1040 /**
1040 * 查询子账户信息 1041 * 查询子账户信息
1041 * @param mContext 1042 * @param mContext
1042 * @param userId 1043 * @param userId
1043 * @param handler 1044 * @param handler
1044 */ 1045 */
1045 public void getchildAccountinfo(final Context mContext, long userId , final Handler handler) { 1046 public void getchildAccountinfo(final Context mContext, long userId , final Handler handler) {
1046 mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", 1047 mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...",
1047 false, true, null); 1048 false, true, null);
1048 HttpClient.getInstance().setTimeout(5 * 1000); 1049 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().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 HttpClient.getInstance().get(HttpUrl.childUserURL+ "?userId=" + userId , new AsyncHttpResponseHandler() {
1051 @Override 1052 @Override
1052 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1053 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1053 closeProgress(); 1054 closeProgress();
1054 Log.e("test", "子账户信息" + new String(arg2)); 1055 Log.e("test", "子账户信息" + new String(arg2));
1055 ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 1056 try {
1056 List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); 1057 JSONObject jsonObject = new JSONObject(new String(arg2));
1057 Message msg = Message.obtain(); 1058 int status = jsonObject.optInt("status");
1058 msg.what = HttpCode.CHILDS_SUCESS; 1059 if (status ==1000){
1059 msg.obj = schoolInfoBeanList; 1060 AlertUtils.showToast(mContext,"你好,你还未添加子账号,子账号为空!");
1060 handler.sendMessage(msg); 1061 }else {
1062 ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据
1063 List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData();
1064 Message msg = Message.obtain();
1065 msg.what = HttpCode.CHILDS_SUCESS;
1066 msg.obj = schoolInfoBeanList;
1067 handler.sendMessage(msg);
1068
1069 }
1070 } catch (JSONException e) {
1071 e.printStackTrace();
1072 }
1073
1061 } 1074 }
1062 1075
1063 @Override 1076 @Override
1064 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1077 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1065 closeProgress(); 1078 closeProgress();
1066 Log.e("test", "错误信息" + new String(arg2)); 1079 Log.e("test", "错误信息" + new String(arg2));
1067 new CircleDialog.Builder((FragmentActivity) mContext) 1080 new CircleDialog.Builder((FragmentActivity) mContext)
1068 .setCanceledOnTouchOutside(false) 1081 .setCanceledOnTouchOutside(false)
1069 .setCancelable(false) 1082 .setCancelable(false)
1070 .setWidth(0.5f) 1083 .setWidth(0.5f)
1071 .configText(new ConfigText() { 1084 .configText(new ConfigText() {
1072 @Override 1085 @Override
1073 public void onConfig(TextParams params) { 1086 public void onConfig(TextParams params) {
1074 params.gravity = Gravity.CENTER; 1087 params.gravity = Gravity.CENTER;
1075 params.padding = new int[]{50, 50, 50, 50}; 1088 params.padding = new int[]{50, 50, 50, 50};
1076 } 1089 }
1077 }) 1090 })
1078 .setText("当前无网络,请检查网络设置") 1091 .setText("当前无网络,请检查网络设置")
1079 .setNegative("继续使用", null) 1092 .setNegative("继续使用", null)
1080 .setPositive("设置网络", new View.OnClickListener() { 1093 .setPositive("设置网络", new View.OnClickListener() {
1081 @Override 1094 @Override
1082 public void onClick(View v) { 1095 public void onClick(View v) {
1083 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1096 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1084 mContext.startActivity(intent); 1097 mContext.startActivity(intent);
1085 } 1098 }
1086 }) 1099 })
1087 .show(); 1100 .show();
1088 } 1101 }
1089 }); 1102 });
1090 1103
1091 } 1104 }
1105 /**
1106 * 删除子账户信息
1107 * @param mContext
1108 * @param subAccountId
1109 *
1110 */
1111 public void deletechildAccountinfo(final Context mContext, long subAccountId ) {
1112 mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...",
1113 false, true, null);
1114 HttpClient.getInstance().setTimeout(5 * 1000);
1115 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1116 HttpClient.getInstance().get(HttpUrl.deletechildUserURL+ "?subAccountId=" + subAccountId , new AsyncHttpResponseHandler() {
1117 @Override
1118 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1119 closeProgress();
1120 Log.e("test", "子账户信息" + new String(arg2));
1121 try {
1122 JSONObject jsonObject = new JSONObject(new String(arg2));
1123 int status = jsonObject.optInt("status");
1124 if (status ==1){
1125 AlertUtils.showToast(mContext,"子账号删除成功!");
1126 }else {
1127 AlertUtils.showToast(mContext,"你好,子账号删除失败!");
1128
1129 }
1130 } catch (JSONException e) {
1131 e.printStackTrace();
1132 }
1133
1134 }
1135
1136 @Override
1137 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1138 closeProgress();
1139 Log.e("test", "错误信息" + new String(arg2));
1140 new CircleDialog.Builder((FragmentActivity) mContext)
1141 .setCanceledOnTouchOutside(false)
1142 .setCancelable(false)
1143 .setWidth(0.5f)
1144 .configText(new ConfigText() {
1145 @Override
1146 public void onConfig(TextParams params) {
1147 params.gravity = Gravity.CENTER;
1148 params.padding = new int[]{50, 50, 50, 50};
1149 }
1150 })
1151 .setText("当前无网络,请检查网络设置")
1152 .setNegative("继续使用", null)
1153 .setPositive("设置网络", new View.OnClickListener() {
1154 @Override
1155 public void onClick(View v) {
1156 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1157 mContext.startActivity(intent);
1158 }
1159 })
1160 .show();
1161 }
1162 });
1163
1164 }
1165 /**
1166 * 添加子账户信息
1167 *
1168 */
1169 public void addchildAccountinfo(final Context mContext, long parentId,String image,
1170 String name,String grade,String school,String region) {
1171 mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...",
1172 false, true, null);
1173 RequestParams params = new RequestParams();
1174
1175 params.put(HttpKey.PARENTID, parentId);
1176 params.put(HttpKey.IMAGE, image);
1177 params.put(HttpKey.NAME, name);
1178 params.put(HttpKey.GRADE, grade);
1179 params.put(HttpKey.SCHOOL, school);
1180 params.put(HttpKey.REGION, region);
1181
1182
1183 HttpClient.getInstance().addHeader("Accept", "*/*");
1184 HttpClient.getInstance().setTimeout(5 * 1000);
1185 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1186 HttpClient.getInstance().post(HttpUrl.addchildUserURL ,params, new AsyncHttpResponseHandler() {
1187 @Override
1188 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1189 closeProgress();
1190
1191 Log.e("test", "子账户信息" + new String(arg2));
1192 try {
1193 JSONObject jsonObject = new JSONObject(new String(arg2));
1194 int status = jsonObject.optInt("status");
1195 if (status ==1){
1196 AlertUtils.showToast(mContext,"子账号添加成功!");
1197 ((Activity) mContext).finish();
1198 }else {
1199 AlertUtils.showToast(mContext,"你好,子账号添加失败!");
1200
1201 }
1202 } catch (JSONException e) {
1203 e.printStackTrace();
1204 }
1205
1206 }
1207
1208 @Override
1209 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1210 closeProgress();
1211 Log.e("test", "错误信息" + new String(arg2));
1212 new CircleDialog.Builder((FragmentActivity) mContext)
1213 .setCanceledOnTouchOutside(false)
1214 .setCancelable(false)
1215 .setWidth(0.5f)
1216 .configText(new ConfigText() {
1217 @Override
1218 public void onConfig(TextParams params) {
1219 params.gravity = Gravity.CENTER;
1220 params.padding = new int[]{50, 50, 50, 50};
1221 }
1222 })
1223 .setText("当前无网络,请检查网络设置")
1224 .setNegative("继续使用", null)
1225 .setPositive("设置网络", new View.OnClickListener() {
1226 @Override
1227 public void onClick(View v) {
1228 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1229 mContext.startActivity(intent);
1230 }
1231 })
1232 .show();
1233 }
1234 });
1235
1236 }
1237
1238 /**
1239 * 切换子账户信息
1240 * @param mContext
1241 * @param subAccountId
1242 *
1243 */
1244 public void changechildAccountinfo(final Context mContext, long subAccountId ,long userId) {
1245 mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...",
1246 false, true, null);
1247 HttpClient.getInstance().setTimeout(5 * 1000);
1248 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1249 HttpClient.getInstance().get(HttpUrl.changechildUserURL+ "?subAccountId=" + subAccountId+"&userId="+ userId, new AsyncHttpResponseHandler() {
1250 @Override
1251 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1252 closeProgress();
1253 Log.e("test", "子账户信息" + new String(arg2));
1254 try {
1255 JSONObject jsonObject = new JSONObject(new String(arg2));
1256 int status = jsonObject.optInt("status");
1257 if (status ==1){
1258 AlertUtils.showToast(mContext,"子账号切换成功!");
1259
1260 }else {
1261 AlertUtils.showToast(mContext,"你好,子账号切换失败!");
1262
1263 }
1264 } catch (JSONException e) {
1265 e.printStackTrace();
1266 }
1267
1268 }
1269
1270 @Override
1271 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1272 closeProgress();
1273 Log.e("test", "错误信息" + new String(arg2));
1274 new CircleDialog.Builder((FragmentActivity) mContext)
1275 .setCanceledOnTouchOutside(false)
1276 .setCancelable(false)
1277 .setWidth(0.5f)
1278 .configText(new ConfigText() {
1279 @Override
1280 public void onConfig(TextParams params) {
1281 params.gravity = Gravity.CENTER;
1282 params.padding = new int[]{50, 50, 50, 50};
1283 }
1284 })
1285 .setText("当前无网络,请检查网络设置")
1286 .setNegative("继续使用", null)
1287 .setPositive("设置网络", new View.OnClickListener() {
1288 @Override
1289 public void onClick(View v) {
1290 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1291 mContext.startActivity(intent);
1292 }
1293 })
1294 .show();
1295 }
1296 });
1297
1298 }
1299
1092 1300
1093 1301
1094 1302
1095 1303
1096 ///省级接口 1304 ///省级接口
1097 public void provices(final Context mContext, final Handler handler) { 1305 public void provices(final Context mContext, final Handler handler) {
1098 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1306 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1099 HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { 1307 HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() {
1100 @Override 1308 @Override
1101 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1309 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1102 Log.e("test", "省" + new String(arg2)); 1310 Log.e("test", "省" + new String(arg2));
1103 ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 1311 ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据
1104 Log.e("test", "状态码" + provinceInfo.getStatus()); 1312 Log.e("test", "状态码" + provinceInfo.getStatus());
1105 List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); 1313 List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces();
1106 Message message = Message.obtain(); 1314 Message message = Message.obtain();
1107 message.what = HttpCode.PROVICES; 1315 message.what = HttpCode.PROVICES;
1108 message.obj = provincesBeanList; 1316 message.obj = provincesBeanList;
1109 handler.sendMessage(message); 1317 handler.sendMessage(message);
1110 1318
1111 } 1319 }
1112 1320
1113 @Override 1321 @Override
1114 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1322 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1115 new CircleDialog.Builder((FragmentActivity) mContext) 1323 new CircleDialog.Builder((FragmentActivity) mContext)
1116 .setCanceledOnTouchOutside(false) 1324 .setCanceledOnTouchOutside(false)
1117 .setCancelable(false) 1325 .setCancelable(false)
1118 .setWidth(0.5f) 1326 .setWidth(0.5f)
1119 .configText(new ConfigText() { 1327 .configText(new ConfigText() {
1120 @Override 1328 @Override
1121 public void onConfig(TextParams params) { 1329 public void onConfig(TextParams params) {
1122 params.gravity = Gravity.CENTER; 1330 params.gravity = Gravity.CENTER;
1123 params.padding = new int[]{50, 50, 50, 50}; 1331 params.padding = new int[]{50, 50, 50, 50};
1124 } 1332 }
1125 }) 1333 })
1126 .setText("当前无网络,请检查网络设置") 1334 .setText("当前无网络,请检查网络设置")
1127 .setNegative("继续使用", null) 1335 .setNegative("继续使用", null)
1128 .setPositive("设置网络", new View.OnClickListener() { 1336 .setPositive("设置网络", new View.OnClickListener() {
1129 @Override 1337 @Override
1130 public void onClick(View v) { 1338 public void onClick(View v) {
1131 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1339 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1132 mContext.startActivity(intent); 1340 mContext.startActivity(intent);
1133 } 1341 }
1134 }) 1342 })
1135 .show(); 1343 .show();
1136 } 1344 }
1137 }); 1345 });
1138 } 1346 }
1139 1347
1140 //市级接口 1348 //市级接口
1141 public void cityinfo(final Context mContext, long regionId , final Handler handler) { 1349 public void cityinfo(final Context mContext, long regionId , final Handler handler) {
1142 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1350 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1143 HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { 1351 HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() {
1144 @Override 1352 @Override
1145 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1353 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1146 Log.e("test", "市" + new String(arg2)); 1354 Log.e("test", "市" + new String(arg2));
1147 Gson gson = new Gson(); 1355 Gson gson = new Gson();
1148 CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); 1356 CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class);
1149 List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); 1357 List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities();
1150 Message message = Message.obtain(); 1358 Message message = Message.obtain();
1151 message.what = HttpCode.CITYS; 1359 message.what = HttpCode.CITYS;
1152 message.obj = cityInfoBeanList; 1360 message.obj = cityInfoBeanList;
1153 handler.sendMessage(message); 1361 handler.sendMessage(message);
1154 1362
1155 1363
1156 } 1364 }
1157 1365
1158 @Override 1366 @Override
1159 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1367 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1160 new CircleDialog.Builder((FragmentActivity) mContext) 1368 new CircleDialog.Builder((FragmentActivity) mContext)
1161 .setCanceledOnTouchOutside(false) 1369 .setCanceledOnTouchOutside(false)
1162 .setCancelable(false) 1370 .setCancelable(false)
1163 .setWidth(0.5f) 1371 .setWidth(0.5f)
1164 .configText(new ConfigText() { 1372 .configText(new ConfigText() {
1165 @Override 1373 @Override
1166 public void onConfig(TextParams params) { 1374 public void onConfig(TextParams params) {
1167 params.gravity = Gravity.CENTER; 1375 params.gravity = Gravity.CENTER;
1168 params.padding = new int[]{50, 50, 50, 50}; 1376 params.padding = new int[]{50, 50, 50, 50};
1169 } 1377 }
1170 }) 1378 })
1171 .setText("当前无网络,请检查网络设置") 1379 .setText("当前无网络,请检查网络设置")
1172 .setNegative("继续使用", null) 1380 .setNegative("继续使用", null)
1173 .setPositive("设置网络", new View.OnClickListener() { 1381 .setPositive("设置网络", new View.OnClickListener() {
1174 @Override 1382 @Override
1175 public void onClick(View v) { 1383 public void onClick(View v) {
1176 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1384 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1177 mContext.startActivity(intent); 1385 mContext.startActivity(intent);
1178 } 1386 }
1179 }) 1387 })
1180 .show(); 1388 .show();
1181 } 1389 }
1182 }); 1390 });
1183 } 1391 }
1184 1392
1185 //区县级接口 1393 //区县级接口
1186 public void countyinfo(final Context mContext, int parentId, final Handler handler) { 1394 public void countyinfo(final Context mContext, int parentId, final Handler handler) {
1187 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 1395 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
1188 HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { 1396 HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() {
1189 @Override 1397 @Override
1190 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 1398 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
1191 Log.e("test", "区" + new String(arg2)); 1399 Log.e("test", "区" + new String(arg2));
1192 Gson gson = new Gson(); 1400 Gson gson = new Gson();
1193 CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); 1401 CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class);
1194 List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); 1402 List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties();
1195 Message message = Message.obtain(); 1403 Message message = Message.obtain();
1196 message.what = HttpCode.COUNTRY; 1404 message.what = HttpCode.COUNTRY;
1197 message.obj = countyInfoInfoBeanList; 1405 message.obj = countyInfoInfoBeanList;
1198 handler.sendMessage(message); 1406 handler.sendMessage(message);
1199 1407
1200 1408
1201 } 1409 }
1202 1410
1203 @Override 1411 @Override
1204 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 1412 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
1205 new CircleDialog.Builder((FragmentActivity) mContext) 1413 new CircleDialog.Builder((FragmentActivity) mContext)
1206 .setCanceledOnTouchOutside(false) 1414 .setCanceledOnTouchOutside(false)
1207 .setCancelable(false) 1415 .setCancelable(false)
1208 .setWidth(0.5f) 1416 .setWidth(0.5f)
1209 .configText(new ConfigText() { 1417 .configText(new ConfigText() {
1210 @Override 1418 @Override
1211 public void onConfig(TextParams params) { 1419 public void onConfig(TextParams params) {
1212 params.gravity = Gravity.CENTER; 1420 params.gravity = Gravity.CENTER;
1213 params.padding = new int[]{50, 50, 50, 50}; 1421 params.padding = new int[]{50, 50, 50, 50};
1214 } 1422 }
1215 }) 1423 })
1216 .setText("当前无网络,请检查网络设置") 1424 .setText("当前无网络,请检查网络设置")
1217 .setNegative("继续使用", null) 1425 .setNegative("继续使用", null)
1218 .setPositive("设置网络", new View.OnClickListener() { 1426 .setPositive("设置网络", new View.OnClickListener() {
1219 @Override 1427 @Override
1220 public void onClick(View v) { 1428 public void onClick(View v) {
1221 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 1429 Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
1222 mContext.startActivity(intent); 1430 mContext.startActivity(intent);
1223 } 1431 }
1224 }) 1432 })
1225 .show(); 1433 .show();
1226 } 1434 }
1227 }); 1435 });
1228 } 1436 }
1229 1437
1230 1438
1231 private void closeProgress() { 1439 private void closeProgress() {
1232 try { 1440 try {
1233 if (mProgress != null) { 1441 if (mProgress != null) {
1234 mProgress.dismiss(); 1442 mProgress.dismiss();
1235 mProgress = null; 1443 mProgress = null;
1236 } 1444 }
1237 } catch (Exception e) { 1445 } catch (Exception e) {
1238 e.printStackTrace(); 1446 e.printStackTrace();
1239 } 1447 }
1240 } 1448 }
1241 1449
1242 } 1450 }
1243 1451
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
1 package com.hjx.personalcenter.http; 1 package com.hjx.personalcenter.http;
2 2
3 /** 3 /**
4 * Created by h on 2017/8/15. 4 * Created by h on 2017/8/15.
5 */ 5 */
6 6
7 public class HttpUrl { 7 public class HttpUrl {
8 private final static String Enviroment = "DEVELOPMENT"; 8 private final static String Enviroment = "DEVELOPMENT";
9 9
10 public static String GetDomain(){ 10 public static String GetDomain(){
11 return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; 11 return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com";
12 } 12 }
13 13
14 public static String loginUrl = GetDomain()+"/user/access_token";//登录 14 public static String loginUrl = GetDomain()+"/user/access_token";//登录
15 public static String schoolUrl = GetDomain()+"/school/get";//学校 15 public static String schoolUrl = GetDomain()+"/school/get";//学校
16 public static String gradesUrl = GetDomain()+"/grades";//年级 16 public static String gradesUrl = GetDomain()+"/grades";//年级
17 public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 17 public static String provinceUrl = GetDomain()+"/ozing/provinces";//省
18 public static String cityUrl = GetDomain()+"/ozing/cities";//市 18 public static String cityUrl = GetDomain()+"/ozing/cities";//市
19 public static String countyUrl = GetDomain()+"/ozing/counties";//区县 19 public static String countyUrl = GetDomain()+"/ozing/counties";//区县
20 public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ 20 public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/
21 public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 21 public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册
22 public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 22 public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码
23 public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 23 public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册
24 public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 24 public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码
25 public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 25 public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息
26 public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 26 public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息
27 public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 27 public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息
28 public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 28 public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写
29 public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 29 public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息
30 public static String getpresonalinfo=GetDomain()+"/personal/get";//修改个人信息 30 public static String getpresonalinfo=GetDomain()+"/personal/get";//获取个人信息
31 public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 31 public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名
32 public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 32 public static String getsignature=GetDomain()+"/signature/info";//获取个性签名
33 public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 33 public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈
34 public static String childUserURL=GetDomain()+"/childUser/info";//用户反馈 34 public static String childUserURL=GetDomain()+"/childUser/info";//获取子账户信息
35 public static String deletechildUserURL=GetDomain()+"/childUser/delete";//删除子账户
36 public static String addchildUserURL=GetDomain()+"/childUser/addChildUser";//添加子账户
37 public static String changechildUserURL=GetDomain()+"/childUser/update";//切换子账户
38
35 39
36 40
37 41
38 42
39 } 43 }
40 44
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/ChildsInfo.java
1 package com.hjx.personalcenter.model; 1 package com.hjx.personalcenter.model;
2 2
3 import java.io.Serializable; 3 import java.io.Serializable;
4 import java.util.List; 4 import java.util.List;
5 5
6 /** 6 /**
7 * Created by h on 2017/8/26. 7 * Created by h on 2017/8/26.
8 */ 8 */
9 9
10 public class ChildsInfo implements Serializable { 10 public class ChildsInfo implements Serializable {
11 11
12 /** 12 /**
13 * status : 1 13 * status : 1
14 * pageSize : 1 14 * pageSize : 1
15 * data : [{"region":"郑州","parentId":600,"school":"郑州小学","status":"未使用","name":"李四","grade":"初一","image":"http://hjxprodbucket.oss.aliyuncs.com/aaaaa.jpg","subAccountId":2}] 15 * data : [{"region":"郑州","parentId":600,"school":"郑州小学","status":"未使用","name":"李四","grade":"初一","image":"http://hjxprodbucket.oss.aliyuncs.com/aaaaa.jpg","subAccountId":2}]
16 * msg : success 16 * msg : success
17 * pageNum : 1 17 * pageNum : 1
18 */ 18 */
19 19
20 private int status; 20 private int status;
21 private int pageSize; 21 private int pageSize;
22 private String msg; 22 private String msg;
23 private int pageNum; 23 private int pageNum;
24 private List<DataBean> data; 24 private List<DataBean> data;
25 25
26 public int getStatus() { 26 public int getStatus() {
27 return status; 27 return status;
28 } 28 }
29 29
30 public void setStatus(int status) { 30 public void setStatus(int status) {
31 this.status = status; 31 this.status = status;
32 } 32 }
33 33
34 public int getPageSize() { 34 public int getPageSize() {
35 return pageSize; 35 return pageSize;
36 } 36 }
37 37
38 public void setPageSize(int pageSize) { 38 public void setPageSize(int pageSize) {
39 this.pageSize = pageSize; 39 this.pageSize = pageSize;
40 } 40 }
41 41
42 public String getMsg() { 42 public String getMsg() {
43 return msg; 43 return msg;
44 } 44 }
45 45
46 public void setMsg(String msg) { 46 public void setMsg(String msg) {
47 this.msg = msg; 47 this.msg = msg;
48 } 48 }
49 49
50 public int getPageNum() { 50 public int getPageNum() {
51 return pageNum; 51 return pageNum;
52 } 52 }
53 53
54 public void setPageNum(int pageNum) { 54 public void setPageNum(int pageNum) {
55 this.pageNum = pageNum; 55 this.pageNum = pageNum;
56 } 56 }
57 57
58 public List<DataBean> getData() { 58 public List<DataBean> getData() {
59 return data; 59 return data;
60 } 60 }
61 61
62 public void setData(List<DataBean> data) { 62 public void setData(List<DataBean> data) {
63 this.data = data; 63 this.data = data;
64 } 64 }
65 65
66 public static class DataBean { 66 public static class DataBean {
67 /** 67 /**
68 * region : 郑州 68 * region : 郑州
69 * parentId : 600 69 * parentId : 600
70 * school : 郑州小学 70 * school : 郑州小学
71 * status : 未使用 71 * status : 未使用
72 * name : 李四 72 * name : 李四
73 * grade : 初一 73 * grade : 初一
74 * image : http://hjxprodbucket.oss.aliyuncs.com/aaaaa.jpg 74 * image : http://hjxprodbucket.oss.aliyuncs.com/aaaaa.jpg
75 * subAccountId : 2 75 * subAccountId : 2
76 */ 76 */
77 77
78 private String region; 78 private String region;
79 private int parentId; 79 private long parentId;
80 private String school; 80 private String school;
81 private String status; 81 private String status;
82 private String name; 82 private String name;
83 private String grade; 83 private String grade;
84 private String image; 84 private String image;
85 private int subAccountId; 85 private int subAccountId;
86 86
87 public String getRegion() { 87 public String getRegion() {
88 return region; 88 return region;
89 } 89 }
90 90
91 public void setRegion(String region) { 91 public void setRegion(String region) {
92 this.region = region; 92 this.region = region;
93 } 93 }
94 94
95 public int getParentId() { 95 public long getParentId() {
96 return parentId; 96 return parentId;
97 } 97 }
98 98
99 public void setParentId(int parentId) { 99 public void setParentId(int parentId) {
100 this.parentId = parentId; 100 this.parentId = parentId;
101 } 101 }
102 102
103 public String getSchool() { 103 public String getSchool() {
104 return school; 104 return school;
105 } 105 }
106 106
107 public void setSchool(String school) { 107 public void setSchool(String school) {
108 this.school = school; 108 this.school = school;
109 } 109 }
110 110
111 public String getStatus() { 111 public String getStatus() {
112 return status; 112 return status;
113 } 113 }
114 114
115 public void setStatus(String status) { 115 public void setStatus(String status) {
116 this.status = status; 116 this.status = status;
117 } 117 }
118 118
119 public String getName() { 119 public String getName() {
120 return name; 120 return name;
121 } 121 }
122 122
123 public void setName(String name) { 123 public void setName(String name) {
124 this.name = name; 124 this.name = name;
125 } 125 }
126 126
127 public String getGrade() { 127 public String getGrade() {
128 return grade; 128 return grade;
129 } 129 }
130 130
131 public void setGrade(String grade) { 131 public void setGrade(String grade) {
132 this.grade = grade; 132 this.grade = grade;
133 } 133 }
134 134
135 public String getImage() { 135 public String getImage() {
136 return image; 136 return image;
137 } 137 }
138 138
139 public void setImage(String image) { 139 public void setImage(String image) {
140 this.image = image; 140 this.image = image;
141 } 141 }
142 142
143 public int getSubAccountId() { 143 public int getSubAccountId() {
144 return subAccountId; 144 return subAccountId;
145 } 145 }
146 146
147 public void setSubAccountId(int subAccountId) { 147 public void setSubAccountId(int subAccountId) {
148 this.subAccountId = subAccountId; 148 this.subAccountId = subAccountId;
149 } 149 }
150 } 150 }
151 } 151 }
152 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:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:orientation="vertical"> 5 android:orientation="vertical">
6 6
7 <RelativeLayout 7 <RelativeLayout
8 android:id="@+id/title" 8 android:id="@+id/title"
9 android:layout_width="match_parent" 9 android:layout_width="match_parent"
10 android:layout_height="wrap_content" 10 android:layout_height="wrap_content"
11 android:background="@color/login_text_blue" 11 android:background="@color/login_text_blue"
12 android:minHeight="50dp"> 12 android:minHeight="50dp">
13 13
14 <ImageView 14 <ImageView
15 android:id="@+id/cancel" 15 android:id="@+id/cancel"
16 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
17 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
18 android:layout_centerVertical="true" 18 android:layout_centerVertical="true"
19 android:paddingLeft="20dp" 19 android:paddingLeft="20dp"
20 android:paddingRight="20dp" 20 android:paddingRight="20dp"
21 android:src="@mipmap/title_back" /> 21 android:src="@mipmap/title_back" />
22 22
23 <TextView 23 <TextView
24 android:id="@+id/menu_title" 24 android:id="@+id/menu_title"
25 android:layout_width="wrap_content" 25 android:layout_width="wrap_content"
26 android:layout_height="wrap_content" 26 android:layout_height="wrap_content"
27 android:layout_centerInParent="true" 27 android:layout_centerInParent="true"
28 android:text="@string/account_management" 28 android:text="@string/account_management"
29 android:textColor="@android:color/white" 29 android:textColor="@android:color/white"
30 android:textSize="22sp" /> 30 android:textSize="22sp" />
31 </RelativeLayout> 31 </RelativeLayout>
32 32
33 <LinearLayout 33 <LinearLayout
34 android:layout_width="wrap_content" 34 android:layout_width="wrap_content"
35 android:layout_height="wrap_content" 35 android:layout_height="wrap_content"
36 android:layout_margin="20dp" 36 android:layout_margin="20dp"
37 android:gravity="center_vertical" 37 android:gravity="center_vertical"
38 android:orientation="horizontal"> 38 android:orientation="horizontal">
39 39
40 <View 40 <View
41 android:layout_width="5dp" 41 android:layout_width="5dp"
42 android:layout_height="20dp" 42 android:layout_height="20dp"
43 android:background="@color/login_text_blue"> 43 android:background="@color/login_text_blue">
44 44
45 </View> 45 </View>
46 46
47 <TextView 47 <TextView
48 android:layout_width="wrap_content" 48 android:layout_width="wrap_content"
49 android:layout_height="wrap_content" 49 android:layout_height="wrap_content"
50 android:layout_marginLeft="5dp" 50 android:layout_marginLeft="5dp"
51 android:text="账户安全" 51 android:text="账户安全"
52 android:textSize="22sp" /> 52 android:textSize="22sp" />
53 53
54 </LinearLayout> 54 </LinearLayout>
55 55
56 <LinearLayout 56 <LinearLayout
57 android:layout_width="match_parent" 57 android:layout_width="match_parent"
58 android:layout_height="wrap_content" 58 android:layout_height="wrap_content"
59 android:layout_marginLeft="60dp" 59 android:layout_marginLeft="60dp"
60 android:orientation="vertical"> 60 android:orientation="vertical">
61 61
62 <LinearLayout 62 <LinearLayout
63 android:layout_width="match_parent" 63 android:layout_width="match_parent"
64 android:layout_height="wrap_content"> 64 android:layout_height="wrap_content">
65 65
66 66
67 <TextView 67 <TextView
68 android:layout_width="0dp" 68 android:layout_width="0dp"
69 android:layout_height="wrap_content" 69 android:layout_height="wrap_content"
70 android:layout_weight="1.5" 70 android:layout_weight="1.5"
71 android:text="当前绑定手机号" 71 android:text="当前绑定手机号"
72 android:textSize="22sp" /> 72 android:textSize="22sp" />
73 73
74 <TextView 74 <TextView
75 android:id="@+id/cunt_username" 75 android:id="@+id/cunt_username"
76 android:layout_width="0dp" 76 android:layout_width="0dp"
77 android:layout_height="wrap_content" 77 android:layout_height="wrap_content"
78 android:layout_marginLeft="50dp" 78 android:layout_marginLeft="50dp"
79 android:layout_weight="6" 79 android:layout_weight="6"
80 android:text="" 80 android:text=""
81 android:textSize="22sp" /> 81 android:textSize="22sp" />
82 82
83 <TextView 83 <TextView
84 android:id="@+id/changBangding" 84 android:id="@+id/changBangding"
85 android:layout_width="0dp" 85 android:layout_width="0dp"
86 android:layout_height="wrap_content" 86 android:layout_height="wrap_content"
87 android:layout_weight="1" 87 android:layout_weight="1"
88 android:text="更换绑定" 88 android:text="更换绑定"
89 android:textSize="22sp" /> 89 android:textSize="22sp" />
90 90
91 <ImageView 91 <ImageView
92 android:layout_width="wrap_content" 92 android:layout_width="wrap_content"
93 android:layout_height="wrap_content" 93 android:layout_height="wrap_content"
94 android:layout_weight="0.1" 94 android:layout_weight="0.1"
95 android:padding="10dp" 95 android:padding="10dp"
96 android:src="@mipmap/youjiantou" /> 96 android:src="@mipmap/youjiantou" />
97 </LinearLayout> 97 </LinearLayout>
98 98
99 <LinearLayout 99 <LinearLayout
100 android:layout_width="match_parent" 100 android:layout_width="match_parent"
101 android:layout_height="wrap_content" 101 android:layout_height="wrap_content"
102 android:layout_marginTop="30dp"> 102 android:layout_marginTop="30dp">
103 103
104 104
105 <TextView 105 <TextView
106 android:layout_width="0dp" 106 android:layout_width="0dp"
107 android:layout_height="wrap_content" 107 android:layout_height="wrap_content"
108 android:layout_weight="1.5" 108 android:layout_weight="1.5"
109 android:text="登录密码" 109 android:text="登录密码"
110 android:textSize="22sp" /> 110 android:textSize="22sp" />
111 111
112 <TextView 112 <TextView
113 android:layout_width="0dp" 113 android:layout_width="0dp"
114 android:layout_height="wrap_content" 114 android:layout_height="wrap_content"
115 android:layout_marginLeft="50dp" 115 android:layout_marginLeft="50dp"
116 android:layout_weight="6" 116 android:layout_weight="6"
117 android:text="已设置" 117 android:text="已设置"
118 android:textSize="22sp" /> 118 android:textSize="22sp" />
119 119
120 <TextView 120 <TextView
121 android:id="@+id/changpassword" 121 android:id="@+id/changpassword"
122 android:layout_width="0dp" 122 android:layout_width="0dp"
123 android:layout_height="wrap_content" 123 android:layout_height="wrap_content"
124 android:layout_weight="1" 124 android:layout_weight="1"
125 android:text="修改密码" 125 android:text="修改密码"
126 android:textSize="22sp" /> 126 android:textSize="22sp" />
127 127
128 <ImageView 128 <ImageView
129 android:layout_width="wrap_content" 129 android:layout_width="wrap_content"
130 android:layout_height="wrap_content" 130 android:layout_height="wrap_content"
131 android:layout_weight="0.1" 131 android:layout_weight="0.1"
132 android:padding="10dp" 132 android:padding="10dp"
133 android:src="@mipmap/youjiantou" /> 133 android:src="@mipmap/youjiantou" />
134 </LinearLayout> 134 </LinearLayout>
135 135
136 </LinearLayout> 136 </LinearLayout>
137 137
138 <View 138 <View
139 android:layout_width="match_parent" 139 android:layout_width="match_parent"
140 android:layout_height="0.7dp" 140 android:layout_height="0.7dp"
141 android:layout_margin="20dp" 141 android:layout_margin="20dp"
142 android:background="#FF909090" /> 142 android:background="#FF909090" />
143 143
144 <LinearLayout 144 <LinearLayout
145 android:layout_width="wrap_content" 145 android:layout_width="wrap_content"
146 android:layout_height="wrap_content" 146 android:layout_height="wrap_content"
147 android:layout_margin="20dp" 147 android:layout_margin="20dp"
148 android:gravity="center_vertical" 148 android:gravity="center_vertical"
149 android:orientation="horizontal"> 149 android:orientation="horizontal">
150 150
151 <View 151 <View
152 android:layout_width="5dp" 152 android:layout_width="5dp"
153 android:layout_height="20dp" 153 android:layout_height="20dp"
154 android:background="@color/login_text_blue"> 154 android:background="@color/login_text_blue">
155 155
156 </View> 156 </View>
157 157
158 <TextView 158 <TextView
159 android:layout_width="wrap_content" 159 android:layout_width="wrap_content"
160 android:layout_height="wrap_content" 160 android:layout_height="wrap_content"
161 android:layout_marginLeft="5dp" 161 android:layout_marginLeft="5dp"
162 android:text="子账户管理" 162 android:text="子账户管理"
163 android:textSize="22sp" /> 163 android:textSize="22sp" />
164 164
165 </LinearLayout> 165 </LinearLayout>
166 166
167 <LinearLayout 167 <LinearLayout
168 android:layout_width="match_parent" 168 android:layout_width="match_parent"
169 android:layout_height="match_parent" 169 android:layout_height="match_parent"
170 android:layout_marginLeft="30dp" 170 android:layout_marginLeft="30dp"
171 android:orientation="vertical"> 171 android:orientation="vertical">
172 172
173 <LinearLayout 173 <LinearLayout
174 android:layout_width="match_parent" 174 android:layout_width="match_parent"
175 android:layout_height="wrap_content"> 175 android:layout_height="wrap_content">
176 176
177 <LinearLayout 177 <LinearLayout
178 android:layout_width="0dp" 178 android:layout_width="0dp"
179 android:layout_height="wrap_content" 179 android:layout_height="wrap_content"
180 android:layout_weight="1"> 180 android:layout_weight="1">
181 181
182 <LinearLayout 182 <LinearLayout
183 android:layout_width="wrap_content" 183 android:layout_width="wrap_content"
184 android:layout_height="wrap_content" 184 android:layout_height="wrap_content"
185 android:background="@drawable/corcle_blue_bg" 185 android:background="@drawable/corcle_blue_bg"
186 android:orientation="vertical"> 186 android:orientation="vertical">
187 187
188 <LinearLayout 188 <LinearLayout
189 android:layout_width="match_parent" 189 android:layout_width="match_parent"
190 android:layout_height="wrap_content" 190 android:layout_height="wrap_content"
191 android:orientation="horizontal"> 191 android:orientation="horizontal">
192 192
193 <ImageView 193 <ImageView
194 android:id="@+id/tv_account_head"
194 android:layout_width="wrap_content" 195 android:layout_width="wrap_content"
195 android:layout_height="wrap_content" 196 android:layout_height="wrap_content"
196 android:layout_margin="10dp" 197 android:layout_margin="10dp"
197 android:src="@mipmap/header_default" /> 198 android:src="@mipmap/header_default" />
198 199
199 <LinearLayout 200 <LinearLayout
200 android:layout_width="0dp" 201 android:layout_width="0dp"
201 android:layout_height="wrap_content" 202 android:layout_height="wrap_content"
202 android:layout_marginLeft="10dp" 203 android:layout_marginLeft="10dp"
203 android:layout_marginTop="10dp" 204 android:layout_marginTop="10dp"
204 android:layout_weight="1" 205 android:layout_weight="1"
205 android:orientation="vertical"> 206 android:orientation="vertical">
206 207
207 <TextView 208 <TextView
209 android:id="@+id/tv_account_name"
208 android:layout_width="wrap_content" 210 android:layout_width="wrap_content"
209 android:layout_height="wrap_content" 211 android:layout_height="wrap_content"
210 android:text="删除用户" 212 android:text=""
211 android:textSize="18sp" /> 213 android:textSize="18sp" />
212 214
213 <TextView 215 <TextView
216 android:id="@+id/tv_account_grade"
214 android:layout_width="wrap_content" 217 android:layout_width="wrap_content"
215 android:layout_height="wrap_content" 218 android:layout_height="wrap_content"
216 android:text="使用中" 219 android:text=""
217 android:textSize="18sp" /> 220 android:textSize="18sp" />
218 221
219 <TextView 222 <TextView
223 android:id="@+id/tv_account_school"
220 android:layout_width="wrap_content" 224 android:layout_width="wrap_content"
221 android:layout_height="wrap_content" 225 android:layout_height="wrap_content"
222 android:text="删除用户" 226 android:text=""
223 android:textSize="18sp" /> 227 android:textSize="18sp" />
224 228
225 <TextView 229 <TextView
230 android:id="@+id/tv_account_adress"
226 android:layout_width="wrap_content" 231 android:layout_width="wrap_content"
227 android:layout_height="wrap_content" 232 android:layout_height="wrap_content"
228 android:text="使用中" 233 android:text=""
229 android:textSize="18sp" /> 234 android:textSize="18sp" />
230 235
231 236
232 </LinearLayout> 237 </LinearLayout>
233 238
234 <ImageView 239 <ImageView
235 android:layout_width="wrap_content" 240 android:layout_width="wrap_content"
236 android:layout_height="wrap_content" 241 android:layout_height="wrap_content"
237 android:layout_gravity="right" 242 android:layout_gravity="right"
238 android:layout_marginLeft="60dp" 243 android:layout_marginLeft="60dp"
239 android:src="@mipmap/shiyongzhong" /> 244 android:src="@mipmap/shiyongzhong" />
240 245
241 </LinearLayout> 246 </LinearLayout>
242 247
243 <View 248 <View
244 android:layout_width="match_parent" 249 android:layout_width="match_parent"
245 android:layout_height="0.7dp" 250 android:layout_height="0.7dp"
246 android:layout_margin="10dp" 251 android:layout_margin="10dp"
247 android:background="@color/cutoff_line"> 252 android:background="@color/cutoff_line">
248 253
249 </View> 254 </View>
250 255
251 <LinearLayout 256 <LinearLayout
252 android:layout_width="match_parent" 257 android:layout_width="match_parent"
253 android:layout_height="wrap_content" 258 android:layout_height="wrap_content"
254 android:layout_marginBottom="10dp" 259 android:layout_marginBottom="10dp"
255 android:orientation="horizontal"> 260 android:orientation="horizontal">
256 261
257 <TextView 262 <TextView
263 android:id="@+id/tv_account_delete"
258 android:layout_width="0dp" 264 android:layout_width="0dp"
259 android:layout_height="wrap_content" 265 android:layout_height="wrap_content"
260 android:layout_weight="1" 266 android:layout_weight="1"
261 android:gravity="center" 267 android:gravity="center"
262 android:text="删除用户" 268 android:text="删除用户"
263 android:textSize="18sp" /> 269 android:textSize="18sp" />
264 270
265 <TextView 271 <TextView
266 android:layout_width="0dp" 272 android:layout_width="0dp"
267 android:layout_height="wrap_content" 273 android:layout_height="wrap_content"
268 android:layout_weight="1" 274 android:layout_weight="1"
269 android:gravity="center" 275 android:gravity="center"
270 android:text="使用中" 276 android:text="使用中"
271 android:textSize="18sp" /> 277 android:textSize="18sp" />
272 278
273 279
274 </LinearLayout> 280 </LinearLayout>
275 281
276 </LinearLayout> 282 </LinearLayout>
277 283
278 284
279 </LinearLayout> 285 </LinearLayout>
280 286
281 <LinearLayout 287 <LinearLayout
282 android:layout_width="0dp" 288 android:layout_width="0dp"
283 android:layout_height="wrap_content" 289 android:layout_height="wrap_content"
284 android:layout_weight="1"> 290 android:layout_weight="1">
285 291
286 </LinearLayout> 292 </LinearLayout>
287 293
288 <LinearLayout 294 <LinearLayout
289 android:layout_width="0dp" 295 android:layout_width="0dp"
290 android:layout_height="wrap_content" 296 android:layout_height="wrap_content"
291 android:layout_weight="1"> 297 android:layout_weight="1">
292 298
293 </LinearLayout> 299 </LinearLayout>
294 </LinearLayout> 300 </LinearLayout>
295 301
296 <LinearLayout 302 <RelativeLayout
297 android:layout_width="match_parent" 303 android:layout_width="match_parent"
298 android:layout_height="wrap_content" 304 android:layout_height="wrap_content"
305 android:layout_marginTop="20dp"
299 android:orientation="horizontal"> 306 android:orientation="horizontal">
300 <android.support.v7.widget.RecyclerView 307 <android.support.v7.widget.RecyclerView
301 android:id="@+id/id_recyclerview_horizontal" 308 android:id="@+id/id_recyclerview_horizontal"
302 android:layout_width="wrap_content" 309 android:layout_width="wrap_content"
310 android:layout_toLeftOf="@+id/add_account"
303 android:layout_height="wrap_content" 311 android:layout_height="wrap_content"
304 android:layout_centerVertical="true" 312 android:layout_centerVertical="true"
305 android:scrollbars="none" 313 android:scrollbars="none"
306 > 314 >
307 </android.support.v7.widget.RecyclerView> 315 </android.support.v7.widget.RecyclerView>
308 <LinearLayout 316 <LinearLayout
309 android:layout_width="wrap_content" 317 android:id="@+id/add_account"
310 android:layout_height="wrap_content" 318 android:layout_width="415dp"
311 android:background="@drawable/corcle_blue_bg" 319 android:layout_height="165dp"
320 android:layout_marginLeft="10dp"
321 android:layout_alignParentRight="true"
322 android:background="@drawable/corcle_black_bg"
312 android:gravity="center"> 323 android:gravity="center">
313 <ImageView 324 <ImageView
314 android:layout_width="wrap_content" 325 android:layout_width="wrap_content"
315 android:layout_height="wrap_content" 326 android:layout_height="wrap_content"
316 android:src="@mipmap/jia"/> 327 android:src="@mipmap/jia"/>
317 328
318 </LinearLayout> 329 </LinearLayout>
319 330
320 331
321 332
322 333
323 </LinearLayout> 334 </RelativeLayout>
324 335
325 </LinearLayout> 336 </LinearLayout>
326 337
327 338
328 </LinearLayout> 339 </LinearLayout>
PersonalCenter/app/src/main/res/layout/activity_main.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 xmlns:fresco="http://schemas.android.com/apk/res-auto" 5 xmlns:fresco="http://schemas.android.com/apk/res-auto"
6 android:orientation="vertical"> 6 android:orientation="vertical">
7 7
8 <RelativeLayout 8 <RelativeLayout
9 android:id="@+id/title" 9 android:id="@+id/title"
10 android:layout_width="match_parent" 10 android:layout_width="match_parent"
11 android:layout_height="50dp" 11 android:layout_height="50dp"
12 android:background="@color/login_text_blue"> 12 android:background="@color/login_text_blue">
13 13
14 <ImageView 14 <ImageView
15 android:id="@+id/cancel" 15 android:id="@+id/cancel"
16 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
17 android:layout_height="match_parent" 17 android:layout_height="match_parent"
18 android:paddingLeft="20dp" 18 android:paddingLeft="20dp"
19 android:paddingRight="20dp" 19 android:paddingRight="20dp"
20 android:visibility="gone" 20 android:visibility="gone"
21 android:src="@mipmap/title_back" /> 21 android:src="@mipmap/title_back" />
22 22
23 <TextView 23 <TextView
24 android:id="@+id/menu_title" 24 android:id="@+id/menu_title"
25 android:layout_width="wrap_content" 25 android:layout_width="wrap_content"
26 android:layout_height="match_parent" 26 android:layout_height="match_parent"
27 android:layout_centerInParent="true" 27 android:layout_centerInParent="true"
28 android:gravity="center_vertical" 28 android:gravity="center_vertical"
29 android:text="@string/titel_preson" 29 android:text="@string/titel_preson"
30 android:textColor="@android:color/white" 30 android:textColor="@android:color/white"
31 android:textSize="22sp" /> 31 android:textSize="22sp" />
32 32
33 <ImageView 33 <ImageView
34 android:id="@+id/iv_setting" 34 android:id="@+id/iv_setting"
35 android:layout_width="wrap_content" 35 android:layout_width="wrap_content"
36 android:layout_height="match_parent" 36 android:layout_height="match_parent"
37 android:layout_marginRight="10dp" 37 android:layout_marginRight="10dp"
38 android:layout_toLeftOf="@+id/iv_skin" 38 android:layout_toLeftOf="@+id/iv_skin"
39 android:gravity="center_vertical" 39 android:gravity="center_vertical"
40 android:padding="10dp" 40 android:padding="10dp"
41 android:src="@mipmap/shezhi" 41 android:src="@mipmap/shezhi"
42 android:textColor="@android:color/white" 42 android:textColor="@android:color/white"
43 android:textSize="22sp" /> 43 android:textSize="22sp" />
44 44
45 <ImageView 45 <ImageView
46 android:id="@+id/iv_skin" 46 android:id="@+id/iv_skin"
47 android:layout_width="wrap_content" 47 android:layout_width="wrap_content"
48 android:layout_height="match_parent" 48 android:layout_height="match_parent"
49 android:layout_marginRight="10dp" 49 android:layout_marginRight="10dp"
50 android:layout_toLeftOf="@+id/iv_imformatioan" 50 android:layout_toLeftOf="@+id/iv_imformatioan"
51 android:gravity="center_vertical" 51 android:gravity="center_vertical"
52 android:padding="10dp" 52 android:padding="10dp"
53 android:src="@mipmap/pifu" 53 android:src="@mipmap/pifu"
54 android:textColor="@android:color/white" 54 android:textColor="@android:color/white"
55 android:textSize="22sp" /> 55 android:textSize="22sp" />
56 56
57 <ImageView 57 <ImageView
58 android:id="@+id/iv_imformatioan" 58 android:id="@+id/iv_imformatioan"
59 android:layout_width="wrap_content" 59 android:layout_width="wrap_content"
60 android:layout_height="match_parent" 60 android:layout_height="match_parent"
61 android:layout_alignParentRight="true" 61 android:layout_alignParentRight="true"
62 android:layout_marginRight="10dp" 62 android:layout_marginRight="10dp"
63 android:gravity="center_vertical" 63 android:gravity="center_vertical"
64 android:padding="10dp" 64 android:padding="10dp"
65 android:src="@mipmap/fankui" 65 android:src="@mipmap/fankui"
66 android:textColor="@android:color/white" 66 android:textColor="@android:color/white"
67 android:textSize="22sp" /> 67 android:textSize="22sp" />
68 68
69 69
70 </RelativeLayout> 70 </RelativeLayout>
71 71
72 <LinearLayout 72 <LinearLayout
73 android:layout_width="match_parent" 73 android:layout_width="match_parent"
74 android:layout_height="match_parent"> 74 android:layout_height="match_parent">
75 75
76 <LinearLayout 76 <LinearLayout
77 android:layout_width="0dp" 77 android:layout_width="0dp"
78 android:layout_height="match_parent" 78 android:layout_height="match_parent"
79 android:layout_weight="1" 79 android:layout_weight="1"
80 android:orientation="vertical"> 80 android:orientation="vertical">
81 81
82 <LinearLayout 82 <LinearLayout
83 android:layout_width="match_parent" 83 android:layout_width="match_parent"
84 android:layout_height="wrap_content" 84 android:layout_height="wrap_content"
85 android:layout_marginTop="20dp" 85 android:layout_marginTop="20dp"
86 android:orientation="horizontal"> 86 android:orientation="horizontal">
87 <ImageView 87 <ImageView
88 android:id="@+id/iv_look_card" 88 android:id="@+id/iv_look_card"
89 android:layout_width="wrap_content" 89 android:layout_width="wrap_content"
90 android:layout_height="wrap_content" 90 android:layout_height="wrap_content"
91 android:padding="10dp" 91 android:padding="10dp"
92 android:layout_marginLeft="20dp" 92 android:layout_marginLeft="20dp"
93 android:src="@mipmap/card_icoc" /> 93 android:src="@mipmap/card_icoc" />
94 <com.facebook.drawee.view.SimpleDraweeView 94 <com.facebook.drawee.view.SimpleDraweeView
95 android:id="@+id/iv_head" 95 android:id="@+id/iv_head"
96 android:layout_width="60dp" 96 android:layout_width="60dp"
97 android:layout_height="60dp" 97 android:layout_height="60dp"
98 android:layout_marginLeft="60dp" 98 android:layout_marginLeft="60dp"
99 android:layout_gravity="center" 99 android:layout_gravity="center"
100 fresco:placeholderImage="@mipmap/header_default" 100 fresco:placeholderImage="@mipmap/header_default"
101 fresco:roundAsCircle="true" 101 fresco:roundAsCircle="true"
102 fresco:placeholderImageScaleType="fitCenter" /> 102 fresco:placeholderImageScaleType="fitCenter" />
103 103
104 <TextView 104 <TextView
105 android:layout_width="wrap_content" 105 android:layout_width="wrap_content"
106 android:layout_height="wrap_content" 106 android:layout_height="wrap_content"
107 android:layout_marginLeft="18dp" 107 android:layout_marginLeft="18dp"
108 android:layout_marginTop="20dp" 108 android:layout_marginTop="20dp"
109 android:background="@drawable/corcle_blue_bg" 109 android:background="@drawable/corcle_blue_bg"
110 android:paddingLeft="5dp" 110 android:paddingLeft="5dp"
111 android:paddingRight="5dp" 111 android:paddingRight="5dp"
112 android:gravity="center_vertical" 112 android:gravity="center_vertical"
113 android:text="签到" 113 android:text="签到"
114 android:textColor="@color/login_text_blue" 114 android:textColor="@color/login_text_blue"
115 android:textSize="18sp" /> 115 android:textSize="18sp" />
116 116
117 </LinearLayout> 117 </LinearLayout>
118 118
119 <LinearLayout 119 <LinearLayout
120 android:layout_width="match_parent" 120 android:layout_width="match_parent"
121 android:layout_height="wrap_content" 121 android:layout_height="wrap_content"
122 android:layout_marginLeft="20dp" 122 android:layout_marginLeft="20dp"
123 android:layout_marginTop="20dp" 123 android:layout_marginTop="20dp"
124 android:orientation="horizontal"> 124 android:orientation="horizontal">
125 125
126 <TextView 126 <TextView
127 android:id="@+id/tv_username" 127 android:id="@+id/tv_username"
128 android:layout_width="wrap_content" 128 android:layout_width="wrap_content"
129 android:layout_height="wrap_content" 129 android:layout_height="wrap_content"
130 android:text="姓名" 130 android:text="姓名"
131 android:textSize="20dp" /> 131 android:textSize="20dp" />
132 132
133 <ImageView 133 <ImageView
134 android:id="@+id/iv_sex" 134 android:id="@+id/iv_sex"
135 android:layout_width="wrap_content" 135 android:layout_width="wrap_content"
136 android:layout_height="wrap_content" 136 android:layout_height="wrap_content"
137 android:layout_marginLeft="50dp" 137 android:layout_marginLeft="50dp"
138 android:src="@mipmap/men" /> 138 android:src="@mipmap/men" />
139 139
140 </LinearLayout> 140 </LinearLayout>
141 141
142 <LinearLayout 142 <LinearLayout
143 android:layout_width="match_parent" 143 android:layout_width="match_parent"
144 android:layout_height="wrap_content" 144 android:layout_height="wrap_content"
145 android:layout_marginLeft="20dp" 145 android:layout_marginLeft="20dp"
146 android:layout_marginTop="20dp" 146 android:layout_marginTop="20dp"
147 android:gravity="center" 147 android:gravity="center"
148 android:orientation="horizontal"> 148 android:orientation="horizontal">
149 149
150 <TextView 150 <TextView
151 android:id="@+id/tv_sign" 151 android:id="@+id/tv_sign"
152 android:layout_width="0dp" 152 android:layout_width="0dp"
153 android:layout_height="wrap_content" 153 android:layout_height="wrap_content"
154 android:layout_weight="5" 154 android:layout_weight="5"
155 android:text="请输入个性签名" 155 android:text="请输入个性签名"
156 android:textSize="18sp" /> 156 android:textSize="18sp" />
157 157
158 <ImageView 158 <ImageView
159 android:id="@+id/iv_sign" 159 android:id="@+id/iv_sign"
160 android:layout_width="0dp" 160 android:layout_width="0dp"
161 android:layout_height="wrap_content" 161 android:layout_height="wrap_content"
162 android:layout_weight="1" 162 android:layout_weight="1"
163 android:padding="10dp" 163 android:padding="10dp"
164 android:src="@mipmap/pencil" /> 164 android:src="@mipmap/pencil" />
165 165
166 166
167 </LinearLayout> 167 </LinearLayout>
168 168
169 <View 169 <View
170 android:layout_width="match_parent" 170 android:layout_width="match_parent"
171 android:layout_height="0.7dp" 171 android:layout_height="0.7dp"
172 android:layout_marginTop="20dp" 172 android:layout_marginTop="20dp"
173 android:background="@color/cutoff_line"> 173 android:background="@color/cutoff_line">
174 174
175 </View> 175 </View>
176 176
177 <LinearLayout 177 <LinearLayout
178 android:id="@+id/linel_mycuoti" 178 android:id="@+id/linel_mycuoti"
179 android:layout_width="match_parent" 179 android:layout_width="match_parent"
180 android:layout_height="wrap_content" 180 android:layout_height="wrap_content"
181 android:layout_marginTop="30dp" 181 android:layout_marginTop="30dp"
182 android:orientation="vertical"> 182 android:orientation="vertical">
183 183
184 <LinearLayout 184 <LinearLayout
185 android:layout_width="match_parent" 185 android:layout_width="match_parent"
186 android:layout_height="wrap_content" 186 android:layout_height="wrap_content"
187 android:gravity="center_vertical" 187 android:gravity="center_vertical"
188 android:orientation="horizontal"> 188 android:orientation="horizontal">
189 189
190 <ImageView 190 <ImageView
191 android:layout_width="0dp" 191 android:layout_width="0dp"
192 android:layout_height="wrap_content" 192 android:layout_height="wrap_content"
193 android:layout_weight="1" 193 android:layout_weight="1"
194 android:src="@mipmap/wodecuoti" /> 194 android:src="@mipmap/wodecuoti" />
195 195
196 <TextView 196 <TextView
197 android:layout_width="0dp" 197 android:layout_width="0dp"
198 android:layout_height="wrap_content" 198 android:layout_height="wrap_content"
199 android:layout_weight="5" 199 android:layout_weight="5"
200 android:text="我的错题" 200 android:text="我的错题"
201 android:textSize="20sp" /> 201 android:textSize="20sp" />
202 202
203 <ImageView 203 <ImageView
204 android:layout_width="0dp" 204 android:layout_width="0dp"
205 android:layout_height="wrap_content" 205 android:layout_height="wrap_content"
206 android:layout_weight="1" 206 android:layout_weight="1"
207 android:src="@mipmap/youjiantou" /> 207 android:src="@mipmap/youjiantou" />
208 208
209 </LinearLayout> 209 </LinearLayout>
210 210
211 <LinearLayout 211 <LinearLayout
212 android:id="@+id/linel_mynote" 212 android:id="@+id/linel_mynote"
213 android:layout_width="match_parent" 213 android:layout_width="match_parent"
214 android:layout_height="wrap_content" 214 android:layout_height="wrap_content"
215 android:layout_marginTop="35dp" 215 android:layout_marginTop="35dp"
216 android:gravity="center_vertical" 216 android:gravity="center_vertical"
217 android:orientation="horizontal"> 217 android:orientation="horizontal">
218 218
219 <ImageView 219 <ImageView
220 android:layout_width="0dp" 220 android:layout_width="0dp"
221 android:layout_height="wrap_content" 221 android:layout_height="wrap_content"
222 android:layout_weight="1" 222 android:layout_weight="1"
223 android:src="@mipmap/wodebiji" /> 223 android:src="@mipmap/wodebiji" />
224 224
225 <TextView 225 <TextView
226 android:layout_width="0dp" 226 android:layout_width="0dp"
227 android:layout_height="wrap_content" 227 android:layout_height="wrap_content"
228 android:layout_weight="5" 228 android:layout_weight="5"
229 android:text="我的笔记" 229 android:text="我的笔记"
230 android:textSize="20sp" /> 230 android:textSize="20sp" />
231 231
232 <ImageView 232 <ImageView
233 android:layout_width="0dp" 233 android:layout_width="0dp"
234 android:layout_height="wrap_content" 234 android:layout_height="wrap_content"
235 android:layout_weight="1" 235 android:layout_weight="1"
236 android:src="@mipmap/youjiantou" /> 236 android:src="@mipmap/youjiantou" />
237 237
238 </LinearLayout> 238 </LinearLayout>
239 239
240 <LinearLayout 240 <LinearLayout
241 android:id="@+id/linel_mycollege" 241 android:id="@+id/linel_mycollege"
242 android:layout_width="match_parent" 242 android:layout_width="match_parent"
243 android:layout_height="wrap_content" 243 android:layout_height="wrap_content"
244 android:layout_marginTop="35dp" 244 android:layout_marginTop="35dp"
245 android:gravity="center_vertical" 245 android:gravity="center_vertical"
246 android:orientation="horizontal"> 246 android:orientation="horizontal">
247 247
248 <ImageView 248 <ImageView
249 android:layout_width="0dp" 249 android:layout_width="0dp"
250 android:layout_height="wrap_content" 250 android:layout_height="wrap_content"
251 android:layout_weight="1" 251 android:layout_weight="1"
252 android:src="@mipmap/wodeshoucang" /> 252 android:src="@mipmap/wodeshoucang" />
253 253
254 <TextView 254 <TextView
255 android:layout_width="0dp" 255 android:layout_width="0dp"
256 android:layout_height="wrap_content" 256 android:layout_height="wrap_content"
257 android:layout_weight="5" 257 android:layout_weight="5"
258 android:text="我的收藏" 258 android:text="我的收藏"
259 android:textSize="20sp" /> 259 android:textSize="20sp" />
260 260
261 <ImageView 261 <ImageView
262 android:layout_width="0dp" 262 android:layout_width="0dp"
263 android:layout_height="wrap_content" 263 android:layout_height="wrap_content"
264 android:layout_weight="1" 264 android:layout_weight="1"
265 android:src="@mipmap/youjiantou" /> 265 android:src="@mipmap/youjiantou" />
266 266
267 </LinearLayout> 267 </LinearLayout>
268 268
269 <LinearLayout 269 <LinearLayout
270 android:id="@+id/linel_myclass" 270 android:id="@+id/linel_myclass"
271 android:layout_width="match_parent" 271 android:layout_width="match_parent"
272 android:layout_height="wrap_content" 272 android:layout_height="wrap_content"
273 android:layout_marginTop="35dp" 273 android:layout_marginTop="35dp"
274 android:gravity="center_vertical" 274 android:gravity="center_vertical"
275 android:orientation="horizontal"> 275 android:orientation="horizontal">
276 276
277 <ImageView 277 <ImageView
278 android:layout_width="0dp" 278 android:layout_width="0dp"
279 android:layout_height="wrap_content" 279 android:layout_height="wrap_content"
280 android:layout_weight="1" 280 android:layout_weight="1"
281 android:src="@mipmap/wodebanji" /> 281 android:src="@mipmap/wodebanji" />
282 282
283 <TextView 283 <TextView
284 android:layout_width="0dp" 284 android:layout_width="0dp"
285 android:layout_height="wrap_content" 285 android:layout_height="wrap_content"
286 android:layout_weight="5" 286 android:layout_weight="5"
287 android:text="我的班级" 287 android:text="我的班级"
288 android:textSize="20sp" /> 288 android:textSize="20sp" />
289 289
290 <ImageView 290 <ImageView
291 android:layout_width="0dp" 291 android:layout_width="0dp"
292 android:layout_height="wrap_content" 292 android:layout_height="wrap_content"
293 android:layout_weight="1" 293 android:layout_weight="1"
294 android:src="@mipmap/youjiantou" /> 294 android:src="@mipmap/youjiantou" />
295 295
296 </LinearLayout> 296 </LinearLayout>
297 297
298 298
299 </LinearLayout> 299 </LinearLayout>
300 300
301 <LinearLayout 301 <LinearLayout
302 android:layout_width="match_parent" 302 android:layout_width="match_parent"
303 android:layout_height="match_parent" 303 android:layout_height="match_parent"
304 android:layout_marginTop="120dp" 304 android:layout_marginTop="120dp"
305 android:background="@mipmap/xiaoguanggao"> 305 android:background="@mipmap/xiaoguanggao">
306 306
307 </LinearLayout> 307 </LinearLayout>
308 308
309 309
310 </LinearLayout> 310 </LinearLayout>
311 311
312 312
313 <View 313 <View
314 android:layout_width="0.7dp" 314 android:layout_width="0.7dp"
315 android:layout_height="match_parent" 315 android:layout_height="match_parent"
316 android:background="@color/cutoff_line"> 316 android:background="@color/cutoff_line">
317 317
318 </View> 318 </View>
319 319
320 <LinearLayout 320 <LinearLayout
321 android:layout_width="0dp" 321 android:layout_width="0dp"
322 android:layout_height="match_parent" 322 android:layout_height="match_parent"
323 android:layout_weight="2.5" 323 android:layout_weight="2.5"
324 android:orientation="vertical"> 324 android:orientation="vertical">
325 325
326 <LinearLayout 326 <LinearLayout
327 android:layout_width="match_parent" 327 android:layout_width="match_parent"
328 android:layout_height="wrap_content" 328 android:layout_height="wrap_content"
329 android:layout_margin="20dp" 329 android:layout_margin="20dp"
330 android:gravity="center_vertical" 330 android:gravity="center_vertical"
331 android:orientation="horizontal"> 331 android:orientation="horizontal">
332 332
333 <View 333 <View
334 android:layout_width="5dp" 334 android:layout_width="5dp"
335 android:layout_height="20dp" 335 android:layout_height="20dp"
336 android:background="@color/login_text_blue"> 336 android:background="@color/login_text_blue">
337 337
338 </View> 338 </View>
339 339
340 <TextView 340 <TextView
341 android:layout_width="wrap_content" 341 android:layout_width="wrap_content"
342 android:layout_height="wrap_content" 342 android:layout_height="wrap_content"
343 android:layout_marginLeft="5dp" 343 android:layout_marginLeft="5dp"
344 android:text="最近学习" 344 android:text="最近学习"
345 android:textSize="22sp" /> 345 android:textSize="22sp" />
346 346
347 </LinearLayout> 347 </LinearLayout>
348 348
349 <LinearLayout 349 <LinearLayout
350 android:layout_width="match_parent" 350 android:layout_width="match_parent"
351 android:layout_height="wrap_content"> 351 android:layout_height="wrap_content">
352 352
353 <android.support.v7.widget.RecyclerView 353 <android.support.v7.widget.RecyclerView
354 android:id="@+id/id_recyclerview_horizontal" 354 android:id="@+id/id_recyclerview_horizontal"
355 android:layout_width="match_parent" 355 android:layout_width="match_parent"
356 android:layout_height="wrap_content" 356 android:layout_height="match_parent"
357 android:layout_centerVertical="true" 357 android:layout_centerVertical="true"
358 android:scrollbars="none" 358 android:scrollbars="none" />
359 >
360
361 </android.support.v7.widget.RecyclerView>
362 </LinearLayout> 359 </LinearLayout>
363 360
364 <View 361 <View
365 android:layout_width="match_parent" 362 android:layout_width="match_parent"
366 android:layout_height="0.7dp" 363 android:layout_height="0.7dp"
367 android:background="@color/cutoff_line"> 364 android:background="@color/cutoff_line">
368 365
369 </View> 366 </View>
370 367
371 <LinearLayout 368 <LinearLayout
372 android:layout_width="match_parent" 369 android:layout_width="match_parent"
373 android:layout_height="wrap_content" 370 android:layout_height="wrap_content"
374 android:layout_margin="20dp" 371 android:layout_margin="20dp"
375 android:gravity="center_vertical" 372 android:gravity="center_vertical"
376 android:orientation="horizontal"> 373 android:orientation="horizontal">
377 374
378 <View 375 <View
379 android:layout_width="5dp" 376 android:layout_width="5dp"
380 android:layout_height="20dp" 377 android:layout_height="20dp"
381 android:background="@color/login_text_blue"> 378 android:background="@color/login_text_blue">
382 379
383 </View> 380 </View>
384 381
385 <TextView 382 <TextView
386 android:layout_width="0dp" 383 android:layout_width="0dp"
387 android:layout_height="wrap_content" 384 android:layout_height="wrap_content"
388 android:layout_marginLeft="5dp" 385 android:layout_marginLeft="5dp"
389 android:layout_weight="2" 386 android:layout_weight="2"
390 android:text="个人信息" 387 android:text="个人信息"
391 android:textSize="22sp" /> 388 android:textSize="22sp" />
392 389
393 <TextView 390 <TextView
394 android:id="@+id/tv_edit_presoninfo" 391 android:id="@+id/tv_edit_presoninfo"
395 android:padding="5dp" 392 android:padding="5dp"
396 android:layout_width="0dp" 393 android:layout_width="0dp"
397 android:layout_height="wrap_content" 394 android:layout_height="wrap_content"
398 android:layout_marginLeft="10dp" 395 android:layout_marginLeft="10dp"
399 android:layout_weight="0.2" 396 android:layout_weight="0.2"
400 android:text="编辑" 397 android:text="编辑"
401 android:textSize="18sp" /> 398 android:textSize="18sp" />
402 399
403 <ImageView 400 <ImageView
404 android:layout_width="0dp" 401 android:layout_width="0dp"
405 android:layout_height="wrap_content" 402 android:layout_height="wrap_content"
406 android:layout_weight="0.1" 403 android:layout_weight="0.1"
407 404
408 android:src="@mipmap/youjiantou" /> 405 android:src="@mipmap/youjiantou" />
409 406
410 407
411 </LinearLayout> 408 </LinearLayout>
412 409
413 <LinearLayout 410 <LinearLayout
414 android:layout_width="match_parent" 411 android:layout_width="match_parent"
415 android:layout_height="wrap_content" 412 android:layout_height="wrap_content"
416 android:layout_marginLeft="50dp" 413 android:layout_marginLeft="50dp"
417 android:layout_marginTop="10dp" 414 android:layout_marginTop="10dp"
418 android:orientation="vertical"> 415 android:orientation="vertical">
419 416
420 <LinearLayout 417 <LinearLayout
421 android:layout_width="match_parent" 418 android:layout_width="match_parent"
422 android:layout_height="wrap_content" 419 android:layout_height="wrap_content"
423 android:gravity="center_vertical" 420 android:gravity="center_vertical"
424 android:orientation="horizontal"> 421 android:orientation="horizontal">
425 422
426 <TextView 423 <TextView
427 android:layout_width="0dp" 424 android:layout_width="0dp"
428 android:layout_height="wrap_content" 425 android:layout_height="wrap_content"
429 android:layout_weight="1" 426 android:layout_weight="1"
430 android:text="昵称" 427 android:text="昵称"
431 android:textSize="20sp" /> 428 android:textSize="20sp" />
432 429
433 <TextView 430 <TextView
434 android:id="@+id/tv_username1" 431 android:id="@+id/tv_username1"
435 android:layout_width="0dp" 432 android:layout_width="0dp"
436 android:layout_height="wrap_content" 433 android:layout_height="wrap_content"
437 android:layout_weight="2" 434 android:layout_weight="2"
438 android:hint="未填写" 435 android:hint="未填写"
439 android:textSize="20sp" /> 436 android:textSize="20sp" />
440 437
441 <TextView 438 <TextView
442 android:layout_width="1dp" 439 android:layout_width="1dp"
443 android:layout_height="wrap_content" 440 android:layout_height="wrap_content"
444 android:layout_weight="1" 441 android:layout_weight="1"
445 android:text="星座" 442 android:text="星座"
446 android:textSize="20sp" /> 443 android:textSize="20sp" />
447 444
448 <TextView 445 <TextView
449 android:id="@+id/tv_mygad" 446 android:id="@+id/tv_mygad"
450 android:layout_width="0dp" 447 android:layout_width="0dp"
451 android:layout_height="wrap_content" 448 android:layout_height="wrap_content"
452 android:layout_weight="2" 449 android:layout_weight="2"
453 android:hint="未填写" 450 android:hint="未填写"
454 android:textSize="20sp" /> 451 android:textSize="20sp" />
455 </LinearLayout> 452 </LinearLayout>
456 453
457 <LinearLayout 454 <LinearLayout
458 android:layout_width="match_parent" 455 android:layout_width="match_parent"
459 android:layout_height="wrap_content" 456 android:layout_height="wrap_content"
460 android:layout_marginTop="20dp" 457 android:layout_marginTop="20dp"
461 android:gravity="center_vertical" 458 android:gravity="center_vertical"
462 android:orientation="horizontal"> 459 android:orientation="horizontal">
463 460
464 <TextView 461 <TextView
465 android:layout_width="0dp" 462 android:layout_width="0dp"
466 android:layout_height="wrap_content" 463 android:layout_height="wrap_content"
467 android:layout_weight="1" 464 android:layout_weight="1"
468 android:text="性别" 465 android:text="性别"
469 android:textSize="20sp" /> 466 android:textSize="20sp" />
470 467
471 <TextView 468 <TextView
472 android:id="@+id/tv_sex" 469 android:id="@+id/tv_sex"
473 android:layout_width="0dp" 470 android:layout_width="0dp"
474 android:layout_height="wrap_content" 471 android:layout_height="wrap_content"
475 android:layout_weight="2" 472 android:layout_weight="2"
476 android:hint="未填写" 473 android:hint="未填写"
477 android:textSize="20sp" /> 474 android:textSize="20sp" />
478 475
479 <TextView 476 <TextView
480 android:layout_width="1dp" 477 android:layout_width="1dp"
481 android:layout_height="wrap_content" 478 android:layout_height="wrap_content"
482 android:layout_weight="1" 479 android:layout_weight="1"
483 android:text="地区" 480 android:text="地区"
484 android:textSize="20sp" /> 481 android:textSize="20sp" />
485 482
486 <TextView 483 <TextView
487 android:id="@+id/tv_useinfo_adress" 484 android:id="@+id/tv_useinfo_adress"
488 android:layout_width="0dp" 485 android:layout_width="0dp"
489 android:layout_height="wrap_content" 486 android:layout_height="wrap_content"
490 android:layout_weight="2" 487 android:layout_weight="2"
491 android:hint="未填写" 488 android:hint="未填写"
492 android:textSize="20sp" /> 489 android:textSize="20sp" />
493 </LinearLayout> 490 </LinearLayout>
494 491
495 <LinearLayout 492 <LinearLayout
496 android:layout_width="match_parent" 493 android:layout_width="match_parent"
497 android:layout_height="wrap_content" 494 android:layout_height="wrap_content"
498 android:layout_marginTop="20dp" 495 android:layout_marginTop="20dp"
499 android:gravity="center_vertical" 496 android:gravity="center_vertical"
500 android:orientation="horizontal"> 497 android:orientation="horizontal">
501 498
502 <TextView 499 <TextView
503 android:layout_width="0dp" 500 android:layout_width="0dp"
504 android:layout_height="wrap_content" 501 android:layout_height="wrap_content"
505 android:layout_weight="1" 502 android:layout_weight="1"
506 android:text="生日" 503 android:text="生日"
507 android:textSize="20sp" /> 504 android:textSize="20sp" />
508 505
509 <TextView 506 <TextView
510 android:id="@+id/tv_useinfo_birthday" 507 android:id="@+id/tv_useinfo_birthday"
511 android:layout_width="0dp" 508 android:layout_width="0dp"
512 android:layout_height="wrap_content" 509 android:layout_height="wrap_content"
513 android:layout_weight="2" 510 android:layout_weight="2"
514 android:hint="未填写" 511 android:hint="未填写"
515 android:textSize="20sp" /> 512 android:textSize="20sp" />
516 513
517 <TextView 514 <TextView
518 android:layout_width="1dp" 515 android:layout_width="1dp"
519 android:layout_height="wrap_content" 516 android:layout_height="wrap_content"
520 android:layout_weight="1" 517 android:layout_weight="1"
521 android:text="学校" 518 android:text="学校"
522 android:textSize="20sp" /> 519 android:textSize="20sp" />
523 520
524 <TextView 521 <TextView
525 android:id="@+id/tv_useinfo_school" 522 android:id="@+id/tv_useinfo_school"
526 android:layout_width="0dp" 523 android:layout_width="0dp"
527 android:layout_height="wrap_content" 524 android:layout_height="wrap_content"
528 android:layout_weight="2" 525 android:layout_weight="2"
529 android:hint="未填写" 526 android:hint="未填写"
530 android:textSize="20sp" /> 527 android:textSize="20sp" />
531 </LinearLayout> 528 </LinearLayout>
532 529
533 <LinearLayout 530 <LinearLayout
534 android:layout_width="match_parent" 531 android:layout_width="match_parent"
535 android:layout_height="wrap_content" 532 android:layout_height="wrap_content"
536 android:layout_marginTop="20dp" 533 android:layout_marginTop="20dp"
537 android:gravity="center_vertical" 534 android:gravity="center_vertical"
538 android:orientation="horizontal"> 535 android:orientation="horizontal">
539 536
540 <TextView 537 <TextView
541 android:layout_width="0dp" 538 android:layout_width="0dp"
542 android:layout_height="wrap_content" 539 android:layout_height="wrap_content"
543 android:layout_weight="1" 540 android:layout_weight="1"
544 android:text="Q Q" 541 android:text="Q Q"
545 android:textSize="20sp" /> 542 android:textSize="20sp" />
546 543
547 <TextView 544 <TextView
548 android:id="@+id/tv_useinfo_qq" 545 android:id="@+id/tv_useinfo_qq"
549 android:layout_width="0dp" 546 android:layout_width="0dp"
550 android:layout_height="wrap_content" 547 android:layout_height="wrap_content"
551 android:layout_weight="2" 548 android:layout_weight="2"
552 android:hint="未填写" 549 android:hint="未填写"
553 android:textSize="20sp" /> 550 android:textSize="20sp" />
554 551
555 <TextView 552 <TextView
556 android:layout_width="1dp" 553 android:layout_width="1dp"
557 android:layout_height="wrap_content" 554 android:layout_height="wrap_content"
558 android:layout_weight="1" 555 android:layout_weight="1"
559 android:text="年级" 556 android:text="年级"
560 android:textSize="20sp" /> 557 android:textSize="20sp" />
561 558
562 <TextView 559 <TextView
563 android:id="@+id/tv_useinfo_gender" 560 android:id="@+id/tv_useinfo_gender"
564 android:layout_width="0dp" 561 android:layout_width="0dp"
565 android:layout_height="wrap_content" 562 android:layout_height="wrap_content"
566 android:layout_weight="2" 563 android:layout_weight="2"
567 android:hint="未填写" 564 android:hint="未填写"
568 android:textSize="20sp" /> 565 android:textSize="20sp" />
569 </LinearLayout> 566 </LinearLayout>
570 567
571 568
572 </LinearLayout> 569 </LinearLayout>
573 <View 570 <View
574 android:layout_width="match_parent" 571 android:layout_width="match_parent"
575 android:layout_height="0.7dp" 572 android:layout_height="0.7dp"
576 android:layout_marginTop="20dp" 573 android:layout_marginTop="20dp"
577 android:background="@color/cutoff_line"> 574 android:background="@color/cutoff_line">
578 575
579 </View> 576 </View>
580 <LinearLayout 577 <LinearLayout
581 android:layout_width="match_parent" 578 android:layout_width="match_parent"
582 android:layout_height="wrap_content" 579 android:layout_height="wrap_content"
583 android:layout_margin="20dp" 580 android:layout_margin="20dp"
584 android:gravity="center_vertical" 581 android:gravity="center_vertical"
585 android:orientation="horizontal"> 582 android:orientation="horizontal">
586 583
587 <View 584 <View
588 android:layout_width="5dp" 585 android:layout_width="5dp"
589 android:layout_height="20dp" 586 android:layout_height="20dp"
590 android:background="@color/login_text_blue"> 587 android:background="@color/login_text_blue">
591 588
592 </View> 589 </View>
593 590
594 <TextView 591 <TextView
595 android:layout_width="wrap_content" 592 android:layout_width="wrap_content"
596 android:layout_height="wrap_content" 593 android:layout_height="wrap_content"
597 android:layout_marginLeft="5dp" 594 android:layout_marginLeft="5dp"
598 android:text="版本信息" 595 android:text="版本信息"
599 android:textSize="22sp" /> 596 android:textSize="22sp" />
600 597
601 </LinearLayout> 598 </LinearLayout>
602 599
603 <LinearLayout 600 <LinearLayout
604 android:layout_width="match_parent" 601 android:layout_width="match_parent"
605 android:layout_height="wrap_content" 602 android:layout_height="wrap_content"
606 android:layout_marginTop="20dp"> 603 android:layout_marginTop="20dp">
607 604
608 <TextView 605 <TextView
609 android:layout_width="match_parent" 606 android:layout_width="match_parent"
610 android:layout_height="100dp" 607 android:layout_height="100dp"
611 android:layout_marginLeft="20dp" 608 android:layout_marginLeft="20dp"
612 android:layout_marginTop="10dp" 609 android:layout_marginTop="10dp"
613 android:gravity="center" 610 android:gravity="center"
614 android:text="这里需要显示水平滑动的" /> 611 android:text="这里需要显示水平滑动的" />
615 </LinearLayout> 612 </LinearLayout>
616 613
617 614
618 </LinearLayout> 615 </LinearLayout>
619 616
620 617
621 </LinearLayout> 618 </LinearLayout>
622 619
623 620
624 </LinearLayout> 621 </LinearLayout>
625 622
PersonalCenter/app/src/main/res/layout/custom_adilog_school_list_items.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" android:layout_width="match_parent" 3 android:orientation="vertical" android:layout_width="match_parent"
4 android:layout_height="match_parent"> 4 android:layout_height="match_parent">
5 <TextView 5 <TextView
6 android:id="@+id/list_school_items" 6 android:id="@+id/list_school_items"
7 android:textSize="18sp" 7 android:textSize="18sp"
8 android:gravity="center_vertical"
8 android:layout_width="match_parent" 9 android:layout_width="match_parent"
9 android:layout_height="50dp" 10 android:layout_height="50dp"
10 android:textColor="@color/btn_text_color"/> 11 android:textColor="@color/btn_text_color"/>
11 12
12 </LinearLayout> 13 </LinearLayout>
PersonalCenter/app/src/main/res/layout/recycler_childaccunt_item_view.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical" android:layout_width="match_parent" 3 android:orientation="vertical" android:layout_width="415dp"
4 android:layout_height="match_parent"> 4 android:layout_height="match_parent">
5 <LinearLayout 5 <LinearLayout
6 android:layout_width="wrap_content" 6 android:layout_width="wrap_content"
7 android:layout_height="wrap_content" 7 android:layout_height="wrap_content"
8 android:background="@drawable/corcle_black_bg" 8 android:background="@drawable/corcle_black_bg"
9 android:orientation="vertical"> 9 android:orientation="vertical">
10 10
11 <LinearLayout 11 <LinearLayout
12 android:layout_width="match_parent" 12 android:layout_width="wrap_content"
13 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
14 android:orientation="horizontal"> 14 android:orientation="horizontal">
15 15
16 <ImageView 16 <ImageView
17 android:id="@+id/iv_child_head" 17 android:id="@+id/iv_child_head"
18 android:layout_width="wrap_content" 18 android:layout_width="wrap_content"
19 android:layout_height="wrap_content" 19 android:layout_height="wrap_content"
20 android:layout_margin="10dp" 20 android:layout_margin="10dp"
21 android:src="@mipmap/header_default" /> 21 android:src="@mipmap/header_default" />
22 22
23 <LinearLayout 23 <LinearLayout
24 android:layout_width="0dp" 24 android:layout_width="0dp"
25 android:layout_height="wrap_content" 25 android:layout_height="wrap_content"
26 android:layout_marginLeft="10dp" 26 android:layout_marginLeft="10dp"
27 android:layout_marginTop="10dp" 27 android:layout_marginTop="10dp"
28 android:layout_weight="1" 28 android:layout_weight="1"
29 android:orientation="vertical"> 29 android:orientation="vertical">
30 30
31 <TextView 31 <TextView
32 android:id="@+id/iv_child_name" 32 android:id="@+id/iv_child_name"
33 android:layout_width="wrap_content" 33 android:layout_width="wrap_content"
34 android:layout_height="wrap_content" 34 android:layout_height="wrap_content"
35 android:text="删除用户" 35 android:text="删除用户"
36 android:textSize="18sp" /> 36 android:textSize="18sp" />
37 37
38 <TextView 38 <TextView
39 android:id="@+id/iv_child_grade" 39 android:id="@+id/iv_child_grade"
40 android:layout_width="wrap_content" 40 android:layout_width="wrap_content"
41 android:layout_height="wrap_content" 41 android:layout_height="wrap_content"
42 android:text="使用中" 42 android:text="使用中"
43 android:textSize="18sp" /> 43 android:textSize="18sp" />
44 44
45 <TextView 45 <TextView
46 android:id="@+id/iv_child_school" 46 android:id="@+id/iv_child_school"
47 android:layout_width="wrap_content" 47 android:layout_width="wrap_content"
48 android:layout_height="wrap_content" 48 android:layout_height="wrap_content"
49 android:text="删除用户" 49 android:text="删除用户"
50 android:textSize="18sp" /> 50 android:textSize="18sp" />
51 51
52 <TextView 52 <TextView
53 android:id="@+id/iv_child_adress" 53 android:id="@+id/iv_child_adress"
54 android:layout_width="wrap_content" 54 android:layout_width="wrap_content"
55 android:layout_height="wrap_content" 55 android:layout_height="wrap_content"
56 android:text="使用中" 56 android:text="使用中"
57 android:textSize="18sp" /> 57 android:textSize="18sp" />
58 58
59 59
60 </LinearLayout> 60 </LinearLayout>
61 61
62 62
63 </LinearLayout> 63 </LinearLayout>
64 64
65 <View 65 <View
66 android:layout_width="match_parent" 66 android:layout_width="wrap_content"
67 android:layout_height="0.7dp" 67 android:layout_height="0.7dp"
68 android:layout_margin="10dp" 68 android:layout_margin="10dp"
69 android:background="@color/cutoff_line"> 69 android:background="@color/cutoff_line">
70 70
71 </View> 71 </View>
72 72
73 <LinearLayout 73 <LinearLayout
74 android:layout_width="match_parent" 74 android:layout_width="match_parent"
75 android:layout_height="wrap_content" 75 android:layout_height="wrap_content"
76 android:layout_marginBottom="10dp" 76 android:layout_marginBottom="10dp"
77 android:orientation="horizontal"> 77 android:orientation="horizontal">
78 78
79 <TextView 79 <TextView
80 android:id="@+id/delete_child_account"
80 android:layout_width="0dp" 81 android:layout_width="0dp"
81 android:layout_height="wrap_content" 82 android:layout_height="wrap_content"
82 android:layout_weight="1" 83 android:layout_weight="1"
83 android:gravity="center" 84 android:gravity="center"
84 android:text="删除用户" 85 android:text="删除用户"
85 android:textSize="18sp" /> 86 android:textSize="18sp" />
86 87
87 <TextView 88 <TextView
89 android:id="@+id/chang_account"
88 android:layout_width="0dp" 90 android:layout_width="0dp"
89 android:layout_height="wrap_content" 91 android:layout_height="wrap_content"
90 android:layout_weight="1" 92 android:layout_weight="1"
91 android:gravity="center" 93 android:gravity="center"
92 android:text="切换使用" 94 android:text="切换使用"
93 android:textSize="18sp" /> 95 android:textSize="18sp" />
94 96
95 97
96 </LinearLayout> 98 </LinearLayout>
97 99
98 </LinearLayout> 100 </LinearLayout>
99 101
100 </LinearLayout> 102 </LinearLayout>
PersonalCenter/app/src/main/res/layout/recycler_study_tem_view.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="120dp"
4 android:layout_height="match_parent" 4 android:layout_height="120dp"
5 android:orientation="vertical"> 5 >
6 6
7 <LinearLayout 7 <ImageView
8 android:id="@+id/id_index_gallery_item_image"
9 android:layout_width="80dp"
10 android:layout_height="80dp"
11 android:layout_alignParentTop="true"
12 android:layout_centerHorizontal="true"
13 android:layout_margin="5dp"
14 android:scaleType="centerCrop" />
15
16 <TextView
17 android:id="@+id/id_index_gallery_item_text"
8 android:layout_width="wrap_content" 18 android:layout_width="wrap_content"
9 android:layout_height="wrap_content" 19 android:layout_height="wrap_content"
10 android:layout_gravity="center" 20 android:layout_below="@id/id_index_gallery_item_image"
11 android:gravity="center" 21 android:layout_centerHorizontal="true"
12 android:orientation="vertical"> 22 android:layout_marginBottom="5dp"
13 23 android:layout_marginTop="5dp"
14 <TextView 24 android:textColor="#ff0000"
15 android:id="@+id/item_text" 25 android:text="some info"
16 android:layout_width="wrap_content" 26 android:textSize="12dp" />
17 android:layout_height="wrap_content"
18 android:text="test"
19 android:textColor="@android:color/black"
20 android:textSize="36sp" />