Commit bb076c6230a99dfcf026893b4359564bf81a4d32
1 parent
8906c92400
Exists in
master
用户反馈接口和头像上传接口调试
Showing
27 changed files
with
468 additions
and
466 deletions
Show diff stats
PersonalCenter/app/src/androidTest/java/com/hjx/personalcenter/ExampleInstrumentedTest.java
| 1 | package com.hjx.personalcenter; | 1 | package com.hjx.personalcenter; |
| 2 | 2 | ||
| 3 | import android.os.Handler; | ||
| 4 | import android.os.Message; | ||
| 5 | |||
| 6 | /** | 3 | /** |
| 7 | * Instrumentation test, which will execute on an Android device. | 4 | * Instrumentation test, which will execute on an Android device. |
| 8 | * | 5 | * |
| 9 | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | 6 | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
| 10 | */ | 7 | */ |
| 11 | public class ExampleInstrumentedTest { | 8 | public class ExampleInstrumentedTest { |
| 12 | 9 | ||
| 13 | // handler类接收数据 | ||
| 14 | Handler handler = new Handler() { | ||
| 15 | public void handleMessage(Message msg) { | ||
| 16 | if (msg.what == 1) { | ||
| 17 | System.out.println("receive...."); | ||
| 18 | } | ||
| 19 | }; | ||
| 20 | }; | ||
| 21 | |||
| 22 | // 线程类 | ||
| 23 | class ThreadShow implements Runnable { | ||
| 24 | |||
| 25 | @Override | ||
| 26 | public void run() { | ||
| 27 | // TODO Auto-generated method stub | ||
| 28 | while (true) { | ||
| 29 | try { | ||
| 30 | Thread.sleep(1000); | ||
| 31 | Message msg = new Message(); | ||
| 32 | msg.what = 1; | ||
| 33 | handler.sendMessage(msg); | ||
| 34 | System.out.println("send..."); | ||
| 35 | } catch (Exception e) { | ||
| 36 | // TODO Auto-generated catch block | ||
| 37 | e.printStackTrace(); | ||
| 38 | System.out.println("thread error..."); | ||
| 39 | } | ||
| 40 | } | ||
| 41 | } | ||
| 42 | } | ||
| 43 | } | 10 | } |
| 44 | 11 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/AccountManagementActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | import android.os.Message; | 6 | import android.os.Message; |
| 7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
| 8 | import android.support.v7.widget.LinearLayoutManager; | 8 | import android.support.v7.widget.LinearLayoutManager; |
| 9 | import android.support.v7.widget.RecyclerView; | 9 | import android.support.v7.widget.RecyclerView; |
| 10 | import android.view.View; | 10 | import android.view.View; |
| 11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
| 12 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
| 13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
| 14 | 14 | ||
| 15 | import com.facebook.drawee.view.SimpleDraweeView; | 15 | import com.facebook.drawee.view.SimpleDraweeView; |
| 16 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
| 17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; | 17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; |
| 18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
| 19 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
| 20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
| 21 | import com.hjx.personalcenter.http.HttpCode; | 21 | import com.hjx.personalcenter.http.HttpCode; |
| 22 | import com.hjx.personalcenter.http.HttpManager; | 22 | import com.hjx.personalcenter.http.HttpManager; |
| 23 | import com.hjx.personalcenter.model.ChildsInfo; | 23 | import com.hjx.personalcenter.model.ChildsInfo; |
| 24 | import com.hjx.personalcenter.util.AlertUtils; | 24 | import com.hjx.personalcenter.util.AlertUtils; |
| 25 | import com.hjx.personalcenter.util.GetDevicesUtil; | 25 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 26 | 26 | ||
| 27 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
| 28 | import java.util.List; | 28 | import java.util.List; |
| 29 | 29 | ||
| 30 | /**账户管理 熊巍 | 30 | /** |
| 31 | * 账户管理 熊巍 | ||
| 31 | * Created by h on 2017/8/12. | 32 | * Created by h on 2017/8/12. |
| 32 | */ | 33 | */ |
| 33 | 34 | ||
| 34 | public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener { | 35 | public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener { |
| 35 | private TextView changbangding,changpassword,usernames, | 36 | private TextView changbangding, changpassword, usernames, |
| 36 | tv_username,tv_grade,tv_school,tv_adress,tv_changzhu; | 37 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; |
| 37 | private ImageView iv_useing,cancel; | 38 | private ImageView iv_useing, cancel; |
| 38 | private SimpleDraweeView mSimpleDraweeView; | 39 | private SimpleDraweeView mSimpleDraweeView; |
| 39 | private RecyclerView listview; | 40 | private RecyclerView listview; |
| 40 | private LinearLayout add_accunt,ll_zhu_backgrangd; | 41 | private LinearLayout add_accunt, ll_zhu_backgrangd; |
| 41 | private AccountChildsAdapter childsAdapter; | 42 | private AccountChildsAdapter childsAdapter; |
| 42 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); | 43 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); |
| 43 | Handler handler = new Handler(){ | 44 | Handler handler = new Handler() { |
| 44 | @Override | 45 | @Override |
| 45 | public void handleMessage(Message msg) { | 46 | public void handleMessage(Message msg) { |
| 46 | super.handleMessage(msg); | 47 | super.handleMessage(msg); |
| 47 | switch (msg.what){ | 48 | switch (msg.what) { |
| 48 | case HttpCode.CHILDS_SUCESS: | 49 | case HttpCode.CHILDS_SUCESS: |
| 49 | String name = null; | 50 | ChildsInfo childsInfo = new ChildsInfo(); |
| 50 | String grade = null; | 51 | if (childsInfo.getStatus()==1000) { |
| 51 | String school = null; | 52 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.USERNAME); |
| 52 | String addr = null; | 53 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.ADRESS); |
| 53 | String phote = null; | 54 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); |
| 54 | List<ChildsInfo.DataBean> childList = new ArrayList<>() ; | 55 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); |
| 55 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>)msg.obj ; | 56 | tv_username.setText(names); |
| 56 | for (int i = 0; i < list.size(); i++) { | 57 | tv_grade.setText(grades); |
| 57 | int type = list.get(i).getType(); | 58 | tv_school.setText(schools); |
| 58 | if(type == 1){ | 59 | tv_adress.setText(adress); |
| 59 | name = list.get(i).getName(); | 60 | tv_changzhu.setText("使用中"); |
| 60 | grade = list.get(i).getGrade(); | 61 | tv_changzhu.setEnabled(false); |
| 61 | school = list.get(i).getSchool(); | 62 | iv_useing.setVisibility(View.VISIBLE); |
| 62 | addr = list.get(i).getRegion(); | 63 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
| 63 | phote = list.get(i).getImage(); | 64 | //mSimpleDraweeView.setImageURI(phote); |
| 64 | }else if (type == 2){ | 65 | |
| 65 | childList.add(list.get(i)); | 66 | } else { |
| 67 | String name = null; | ||
| 68 | String grade = null; | ||
| 69 | String school = null; | ||
| 70 | String addr = null; | ||
| 71 | String phote = null; | ||
| 72 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); | ||
| 73 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; | ||
| 74 | for (int i = 0; i < list.size(); i++) { | ||
| 75 | int type = list.get(i).getType(); | ||
| 76 | if (type == 1) { | ||
| 77 | name = list.get(i).getName(); | ||
| 78 | grade = list.get(i).getGrade(); | ||
| 79 | school = list.get(i).getSchool(); | ||
| 80 | addr = list.get(i).getRegion(); | ||
| 81 | phote = list.get(i).getImage(); | ||
| 82 | } else if (type == 2) { | ||
| 83 | childList.add(list.get(i)); | ||
| 84 | } | ||
| 66 | } | 85 | } |
| 86 | tv_username.setText(name); | ||
| 87 | tv_grade.setText(grade); | ||
| 88 | tv_school.setText(school); | ||
| 89 | tv_adress.setText(addr); | ||
| 90 | mSimpleDraweeView.setImageURI(phote); | ||
| 91 | data.clear(); | ||
| 92 | data.addAll(childList); | ||
| 93 | childsAdapter.notifyDataSetChanged(); | ||
| 67 | } | 94 | } |
| 68 | tv_username.setText(name); | ||
| 69 | tv_grade.setText(grade); | ||
| 70 | tv_school.setText(school); | ||
| 71 | tv_adress.setText(addr); | ||
| 72 | data.clear(); | ||
| 73 | data.addAll(childList); | ||
| 74 | childsAdapter.notifyDataSetChanged(); | ||
| 75 | break; | 95 | break; |
| 76 | } | 96 | } |
| 77 | } | 97 | } |
| 78 | }; | 98 | }; |
| 99 | |||
| 79 | @Override | 100 | @Override |
| 80 | protected void onCreate(Bundle savedInstanceState) { | 101 | protected void onCreate(Bundle savedInstanceState) { |
| 81 | super.onCreate(savedInstanceState); | 102 | super.onCreate(savedInstanceState); |
| 82 | setContentView(R.layout.activity_account_management); | 103 | setContentView(R.layout.activity_account_management); |
| 83 | 104 | ||
| 84 | initView(); | 105 | initView(); |
| 85 | initData(); | 106 | initData(); |
| 86 | initLister(); | 107 | initLister(); |
| 87 | } | 108 | } |
| 88 | 109 | ||
| 89 | private void initView() { | 110 | private void initView() { |
| 90 | changbangding = (TextView) findViewById(R.id.changBangding); | 111 | changbangding = (TextView) findViewById(R.id.changBangding); |
| 91 | changpassword = (TextView) findViewById(R.id.changpassword); | 112 | changpassword = (TextView) findViewById(R.id.changpassword); |
| 92 | usernames = (TextView) findViewById(R.id.cunt_username); | 113 | usernames = (TextView) findViewById(R.id.cunt_username); |
| 93 | tv_username = (TextView) findViewById(R.id.tv_account_name); | 114 | tv_username = (TextView) findViewById(R.id.tv_account_name); |
| 94 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); | 115 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); |
| 95 | tv_school = (TextView) findViewById(R.id.tv_account_school); | 116 | tv_school = (TextView) findViewById(R.id.tv_account_school); |
| 96 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); | 117 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); |
| 97 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.tv_account_head); | 118 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.tv_account_head); |
| 98 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); | 119 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); |
| 99 | cancel = (ImageView) findViewById(R.id.cancel); | 120 | cancel = (ImageView) findViewById(R.id.cancel); |
| 100 | add_accunt = (LinearLayout) findViewById(R.id.add_account); | 121 | add_accunt = (LinearLayout) findViewById(R.id.add_account); |
| 101 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); | 122 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); |
| 102 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); | 123 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); |
| 103 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 124 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
| 104 | } | 125 | } |
| 105 | 126 | ||
| 106 | private void initData() { | 127 | private void initData() { |
| 107 | String cunt_username = SaveParam.getInstance().getLoginParam(this,"username"); | 128 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
| 108 | String tv_usernames = SaveParam.getInstance().getLoginParam(this,SaveParam.USERNAME); | 129 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 109 | String tv_grades = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADES); | ||
| 110 | String tv_schools = SaveParam.getInstance().getLoginParam(this,SaveParam.SCHOOL); | ||
| 111 | String tv_adresss = SaveParam.getInstance().getLoginParam(this,SaveParam.ADRESS); | ||
| 112 | String account = SaveParam.getInstance().getLoginParam(this,SaveParam.ACCOUNT); | ||
| 113 | usernames.setText(cunt_username); | 130 | usernames.setText(cunt_username); |
| 114 | 131 | ||
| 115 | if (account.equals("1")){ | 132 | if (account.equals("1")) { |
| 116 | tv_changzhu.setText("使用中"); | 133 | tv_changzhu.setText("使用中"); |
| 117 | tv_changzhu.setEnabled(false); | 134 | tv_changzhu.setEnabled(false); |
| 118 | iv_useing.setVisibility(View.VISIBLE); | 135 | iv_useing.setVisibility(View.VISIBLE); |
| 119 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 136 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
| 120 | }else { | 137 | } else { |
| 121 | 138 | ||
| 122 | tv_changzhu.setText("切换主账户"); | 139 | tv_changzhu.setText("切换主账户"); |
| 123 | tv_changzhu.setEnabled(true); | 140 | tv_changzhu.setEnabled(true); |
| 124 | iv_useing.setVisibility(View.GONE); | 141 | iv_useing.setVisibility(View.GONE); |
| 125 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 142 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
| 126 | } | 143 | } |
| 127 | 144 | ||
| 128 | 145 | ||
| 129 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 146 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
| 130 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 147 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
| 131 | listview.setLayoutManager(linearLayoutManager); | 148 | listview.setLayoutManager(linearLayoutManager); |
| 132 | childsAdapter = new AccountChildsAdapter(data,this); | 149 | childsAdapter = new AccountChildsAdapter(data, this); |
| 133 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); | 150 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); |
| 134 | listview.setAdapter(childsAdapter); | 151 | listview.setAdapter(childsAdapter); |
| 135 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { | 152 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { |
| 136 | @Override | 153 | @Override |
| 137 | public void onItemClick(View view, int position) { | 154 | public void onItemClick(View view, int position) { |
| 138 | 155 | ||
| 139 | AlertUtils.showToast(AccountManagementActivity.this,"你点击了"+data.get(position)); | 156 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); |
| 140 | } | 157 | } |
| 141 | }); | 158 | }); |
| 142 | 159 | ||
| 143 | } | 160 | } |
| 144 | 161 | ||
| 145 | 162 | ||
| 146 | private void initLister() { | 163 | private void initLister() { |
| 147 | changbangding.setOnClickListener(this); | 164 | changbangding.setOnClickListener(this); |
| 148 | changpassword.setOnClickListener(this); | 165 | changpassword.setOnClickListener(this); |
| 149 | cancel.setOnClickListener(this); | 166 | cancel.setOnClickListener(this); |
| 150 | add_accunt.setOnClickListener(this); | 167 | add_accunt.setOnClickListener(this); |
| 151 | tv_changzhu.setOnClickListener(this); | 168 | tv_changzhu.setOnClickListener(this); |
| 152 | 169 | ||
| 153 | 170 | ||
| 154 | |||
| 155 | } | 171 | } |
| 156 | 172 | ||
| 157 | @Override | 173 | @Override |
| 158 | public void onClick(View v) { | 174 | public void onClick(View v) { |
| 159 | switch (v.getId()){ | 175 | switch (v.getId()) { |
| 160 | case R.id.changBangding: | 176 | case R.id.changBangding: |
| 161 | Intent changebangding = new Intent(); | 177 | Intent changebangding = new Intent(); |
| 162 | changebangding.setClass(AccountManagementActivity.this,ChangeBangDingActivity.class); | 178 | changebangding.setClass(AccountManagementActivity.this, ChangeBangDingActivity.class); |
| 163 | startActivity(changebangding); | 179 | startActivity(changebangding); |
| 164 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 180 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 165 | break; | 181 | break; |
| 166 | case R.id.changpassword: | 182 | case R.id.changpassword: |
| 167 | Content.authcodeflag = 1; | 183 | Content.authcodeflag = 1; |
| 168 | Intent changpwd = new Intent(); | 184 | Intent changpwd = new Intent(); |
| 169 | changpwd.setClass(AccountManagementActivity.this,ChangePasswordActivity.class); | 185 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); |
| 170 | startActivity(changpwd); | 186 | startActivity(changpwd); |
| 171 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 187 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 172 | break; | 188 | break; |
| 173 | case R.id.add_account: | 189 | case R.id.add_account: |
| 174 | Content.accountflag = 2; | 190 | Content.accountflag = 2; |
| 175 | Intent account = new Intent(); | 191 | Intent account = new Intent(); |
| 176 | account.setClass(AccountManagementActivity.this,RegisterInfoActivity.class); | 192 | account.setClass(AccountManagementActivity.this, RegisterInfoActivity.class); |
| 177 | startActivity(account); | 193 | startActivity(account); |
| 178 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 194 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 179 | 195 | ||
| 180 | break; | 196 | break; |
| 181 | case R.id.change_zhu_account: | 197 | case R.id.change_zhu_account: |
| 182 | Content.changgeaccountflag =1; | 198 | Content.changgeaccountflag = 1; |
| 183 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 199 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 184 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ACCOUNT,"1"); | 200 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); |
| 185 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 201 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
| 186 | try { | 202 | try { |
| 187 | long auserID = Long.parseLong(userID); | 203 | long auserID = Long.parseLong(userID); |
| 188 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this,auserID, | 204 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, |
| 189 | devicenumber,1); | 205 | devicenumber, 1); |
| 190 | 206 | ||
| 191 | } catch (NumberFormatException e) { | 207 | } catch (NumberFormatException e) { |
| 192 | e.printStackTrace(); | 208 | e.printStackTrace(); |
| 193 | } | 209 | } |
| 194 | 210 | ||
| 195 | 211 | ||
| 196 | break; | 212 | break; |
| 197 | case R.id.cancel: | 213 | case R.id.cancel: |
| 198 | finish(); | 214 | finish(); |
| 199 | break; | 215 | break; |
| 200 | 216 | ||
| 201 | } | 217 | } |
| 202 | 218 | ||
| 203 | } | 219 | } |
| 204 | 220 | ||
| 205 | @Override | 221 | @Override |
| 206 | protected void onResume() { | 222 | protected void onResume() { |
| 207 | super.onResume(); | 223 | super.onResume(); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeElectronicCardAdressInfoActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | import android.os.Handler; | 4 | import android.os.Handler; |
| 5 | import android.os.Message; | 5 | import android.os.Message; |
| 6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v7.app.AppCompatActivity; |
| 7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.widget.Button; | 9 | import android.widget.Button; |
| 10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
| 11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
| 12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
| 13 | 13 | ||
| 14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
| 15 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 15 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
| 16 | import com.hjx.personalcenter.customdialog.CountryDialog; | 16 | import com.hjx.personalcenter.customdialog.CountryDialog; |
| 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 18 | import com.hjx.personalcenter.db.SaveParam; | 18 | import com.hjx.personalcenter.db.SaveParam; |
| 19 | import com.hjx.personalcenter.http.HttpCode; | 19 | import com.hjx.personalcenter.http.HttpCode; |
| 20 | import com.hjx.personalcenter.http.HttpManager; | 20 | import com.hjx.personalcenter.http.HttpManager; |
| 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 22 | import com.hjx.personalcenter.model.CityInfo; | 22 | import com.hjx.personalcenter.model.CityInfo; |
| 23 | import com.hjx.personalcenter.model.CountyInfo; | 23 | import com.hjx.personalcenter.model.CountyInfo; |
| 24 | import com.hjx.personalcenter.model.ProvinceInfo; | 24 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 25 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
| 26 | import com.hjx.personalcenter.util.Judgment; | 26 | import com.hjx.personalcenter.util.Judgment; |
| 27 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 27 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
| 28 | 28 | ||
| 29 | import org.json.JSONObject; | 29 | import org.json.JSONObject; |
| 30 | 30 | ||
| 31 | import java.util.ArrayList; | 31 | import java.util.ArrayList; |
| 32 | import java.util.TimerTask; | ||
| 32 | 33 | ||
| 33 | /** | 34 | /** |
| 34 | * Created by h on 2017/8/9. | 35 | * Created by h on 2017/8/9. |
| 35 | */ | 36 | */ |
| 36 | 37 | ||
| 37 | public class ChangeElectronicCardAdressInfoActivity extends AppCompatActivity implements View.OnClickListener | 38 | public class ChangeElectronicCardAdressInfoActivity extends AppCompatActivity implements View.OnClickListener |
| 38 | ,DialogCallBack.ProvincesCallBack | 39 | ,DialogCallBack.ProvincesCallBack |
| 39 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ | 40 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ |
| 40 | private ImageView back_forgit; | 41 | private ImageView back_forgit; |
| 41 | private EditText forot_pwd_phone,forot_pwd_anthcode,newadress; | 42 | private EditText forot_pwd_phone,forot_pwd_anthcode,newadress; |
| 42 | private TextView adress; | 43 | private TextView adress; |
| 43 | private Button forot_pwd_sub,forot_pwd_getanthcode; | 44 | private Button forot_pwd_sub,forot_pwd_getanthcode; |
| 44 | private String typeStr = "register"; | 45 | private String typeStr = "register"; |
| 45 | private int i = 0; | 46 | private int delayTime=60; |
| 46 | private Thread thread; | 47 | private java.util.Timer Delaytimer; |
| 47 | Handler handler = new Handler() { | 48 | Handler handler = new Handler() { |
| 48 | @Override | 49 | @Override |
| 49 | public void handleMessage(Message msg) { | 50 | public void handleMessage(Message msg) { |
| 50 | super.handleMessage(msg); | 51 | super.handleMessage(msg); |
| 51 | JSONObject jsonObject; | 52 | JSONObject jsonObject; |
| 52 | String status; | 53 | String status; |
| 53 | switch (msg.what) { | 54 | switch (msg.what) { |
| 54 | case HttpCode.AUTHCODE_SUCESS1: | 55 | case HttpCode.AUTHCODE_SUCESS1: |
| 55 | jsonObject = (JSONObject) msg.obj; | 56 | jsonObject = (JSONObject) msg.obj; |
| 56 | status = jsonObject.optString("status"); | 57 | status = jsonObject.optString("status"); |
| 57 | if (status.equals("100")) { | 58 | if (status.equals("100")) { |
| 58 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "验证码发送成功"); | 59 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "验证码发送成功"); |
| 59 | } | 60 | } |
| 60 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 61 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
| 61 | break; | 62 | break; |
| 62 | case HttpCode.AUTHCODE_FAIL1: | 63 | case HttpCode.AUTHCODE_FAIL1: |
| 63 | jsonObject = (JSONObject) msg.obj; | 64 | jsonObject = (JSONObject) msg.obj; |
| 64 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); | 65 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); |
| 65 | break; | 66 | break; |
| 66 | case 1: | 67 | case 21: |
| 67 | forot_pwd_getanthcode.setEnabled(false); | 68 | if(delayTime<=0){ |
| 68 | forot_pwd_getanthcode.setClickable(false); | 69 | if(Delaytimer!=null){ |
| 69 | forot_pwd_getanthcode.setText(Integer.toString(i--)+" s"); | 70 | Delaytimer.cancel(); |
| 70 | if (i<=0){ | 71 | } |
| 71 | forot_pwd_getanthcode.setEnabled(true); | 72 | forot_pwd_getanthcode.setEnabled(true); |
| 72 | forot_pwd_getanthcode.setClickable(true); | 73 | forot_pwd_getanthcode.setClickable(true); |
| 73 | forot_pwd_getanthcode.setText("获取验证码"); | 74 | forot_pwd_getanthcode.setText("获取验证码"); |
| 74 | 75 | delayTime=60; | |
| 76 | }else{ | ||
| 77 | forot_pwd_getanthcode.setEnabled(false); | ||
| 78 | forot_pwd_getanthcode.setClickable(false); | ||
| 79 | forot_pwd_getanthcode.setText(delayTime + " s"); | ||
| 75 | } | 80 | } |
| 76 | break; | 81 | break; |
| 77 | } | 82 | } |
| 78 | } | 83 | } |
| 79 | }; | 84 | }; |
| 80 | @Override | 85 | @Override |
| 81 | protected void onCreate(Bundle savedInstanceState) { | 86 | protected void onCreate(Bundle savedInstanceState) { |
| 82 | super.onCreate(savedInstanceState); | 87 | super.onCreate(savedInstanceState); |
| 83 | setContentView(R.layout.activity_change_card_validation); | 88 | setContentView(R.layout.activity_change_card_validation); |
| 84 | initView(); | 89 | initView(); |
| 85 | setLister(); | 90 | setLister(); |
| 86 | } | 91 | } |
| 87 | //获取验证码 | 92 | //获取验证码 |
| 88 | private void getauthcode() { | 93 | private void getauthcode() { |
| 89 | forot_pwd_anthcode.requestFocus(); | 94 | forot_pwd_anthcode.requestFocus(); |
| 90 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 95 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
| 91 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); | 96 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); |
| 92 | i = 60; | 97 | valiDelay(); |
| 93 | if(thread == null){ | ||
| 94 | thread = new Thread( new ThreadShow()); | ||
| 95 | thread.start(); | ||
| 96 | } | ||
| 97 | 98 | ||
| 98 | } | 99 | } |
| 99 | private void initView() { | 100 | private void initView() { |
| 100 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); | 101 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); |
| 101 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); | 102 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); |
| 102 | adress = (TextView) findViewById(R.id.et_newpassword); | 103 | adress = (TextView) findViewById(R.id.et_newpassword); |
| 103 | newadress = (EditText) findViewById(R.id.et_again_newpassword); | 104 | newadress = (EditText) findViewById(R.id.et_again_newpassword); |
| 104 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); | 105 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); |
| 105 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); | 106 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); |
| 106 | back_forgit= (ImageView) findViewById(R.id.cancel); | 107 | back_forgit= (ImageView) findViewById(R.id.cancel); |
| 107 | } | 108 | } |
| 108 | private void setLister() { | 109 | private void setLister() { |
| 109 | back_forgit.setOnClickListener(this); | 110 | back_forgit.setOnClickListener(this); |
| 110 | forot_pwd_sub.setOnClickListener(this); | 111 | forot_pwd_sub.setOnClickListener(this); |
| 111 | forot_pwd_getanthcode.setOnClickListener(this); | 112 | forot_pwd_getanthcode.setOnClickListener(this); |
| 112 | adress.setOnClickListener(this); | 113 | adress.setOnClickListener(this); |
| 113 | 114 | ||
| 114 | } | 115 | } |
| 115 | 116 | ||
| 116 | @Override | 117 | @Override |
| 117 | public void onClick(View view) { | 118 | public void onClick(View view) { |
| 118 | switch (view.getId()){ | 119 | switch (view.getId()){ |
| 119 | case R.id.btn_ok: | 120 | case R.id.btn_ok: |
| 120 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 121 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
| 121 | String forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); | 122 | String forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); |
| 122 | String forot_pwd_pwd3 = adress.getText().toString().trim(); | 123 | String forot_pwd_pwd3 = adress.getText().toString().trim(); |
| 123 | String forot_pwd_pwd4 = newadress.getText().toString().trim(); | 124 | String forot_pwd_pwd4 = newadress.getText().toString().trim(); |
| 124 | if (TextUtils.isEmpty(forot_pwd_phone1)|| | 125 | if (TextUtils.isEmpty(forot_pwd_phone1)|| |
| 125 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ | 126 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ |
| 126 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请将必填项填写完整"); | 127 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请将必填项填写完整"); |
| 127 | return; | 128 | return; |
| 128 | }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ | 129 | }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ |
| 129 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "手机号码输入有误"); | 130 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "手机号码输入有误"); |
| 130 | 131 | ||
| 131 | } else { | 132 | } else { |
| 132 | //修改地址接口 | 133 | //修改地址接口 |
| 133 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 134 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
| 134 | long auserID = 0; | 135 | long auserID = 0; |
| 135 | try { | 136 | try { |
| 136 | auserID = Long.parseLong(userID); | 137 | auserID = Long.parseLong(userID); |
| 137 | HttpManager.getInstance().changecardadressinfo(this,auserID,forot_pwd_phone1,forot_pwd_anthcode1,forot_pwd_pwd3+forot_pwd_pwd4); | 138 | HttpManager.getInstance().changecardadressinfo(this,auserID,forot_pwd_phone1,forot_pwd_anthcode1,forot_pwd_pwd3+forot_pwd_pwd4); |
| 138 | } catch (NumberFormatException e) { | 139 | } catch (NumberFormatException e) { |
| 139 | e.printStackTrace(); | 140 | e.printStackTrace(); |
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | } | 143 | } |
| 143 | break; | 144 | break; |
| 144 | case R.id.btn_authcode: | 145 | case R.id.btn_authcode: |
| 145 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 146 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
| 146 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ | 147 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ |
| 147 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请输入正确的手机号"); | 148 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请输入正确的手机号"); |
| 148 | }else { | 149 | }else { |
| 149 | forot_pwd_anthcode.requestFocus(); | 150 | forot_pwd_anthcode.requestFocus(); |
| 150 | getauthcode(); | 151 | getauthcode(); |
| 151 | 152 | ||
| 152 | } | 153 | } |
| 153 | 154 | ||
| 154 | break; | 155 | break; |
| 155 | case R.id.et_newpassword: | 156 | case R.id.et_newpassword: |
| 156 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) ChangeElectronicCardAdressInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 157 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) ChangeElectronicCardAdressInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
| 157 | break; | 158 | break; |
| 158 | 159 | ||
| 159 | case R.id.cancel: | 160 | case R.id.cancel: |
| 160 | finish(); | 161 | finish(); |
| 161 | break; | 162 | break; |
| 162 | } | 163 | } |
| 163 | } | 164 | } |
| 164 | 165 | ||
| 165 | @Override | 166 | @Override |
| 166 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 167 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
| 167 | String regionName = data.get(position).getRegionName(); | 168 | String regionName = data.get(position).getRegionName(); |
| 168 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 169 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
| 169 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 170 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
| 170 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 171 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
| 171 | adress.setText(""); | 172 | adress.setText(""); |
| 172 | adress.setText(provice+regionName); | 173 | adress.setText(provice+regionName); |
| 173 | 174 | ||
| 174 | 175 | ||
| 175 | } | 176 | } |
| 176 | 177 | ||
| 177 | @Override | 178 | @Override |
| 178 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 179 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
| 179 | String regionName = data.get(position).getRegionName(); | 180 | String regionName = data.get(position).getRegionName(); |
| 180 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 181 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
| 181 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 182 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
| 182 | adress.setText(""); | 183 | adress.setText(""); |
| 183 | adress.setText(provices+citys+regionName); | 184 | adress.setText(provices+citys+regionName); |
| 184 | } | 185 | } |
| 185 | 186 | ||
| 186 | @Override | 187 | @Override |
| 187 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 188 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
| 188 | String regionName = data.get(position).getRegionName(); | 189 | String regionName = data.get(position).getRegionName(); |
| 189 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 190 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
| 190 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 191 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
| 191 | 192 | adress.setText(""); | |
| 193 | adress.setText(regionName); | ||
| 192 | } | 194 | } |
| 193 | 195 | ||
| 194 | // 线程类 定时器 | 196 | // 线程类 定时器 |
| 195 | class ThreadShow implements Runnable { | 197 | public void valiDelay() { |
| 198 | |||
| 199 | Delaytimer = new java.util.Timer(true); | ||
| 200 | |||
| 201 | |||
| 202 | TimerTask task = new TimerTask() { | ||
| 203 | public void run() { | ||
| 204 | //每次需要执行的代码放到这里面。 | ||
| 205 | delayTime--; | ||
| 206 | handler.sendEmptyMessage(21); | ||
| 207 | |||
| 208 | |||
| 196 | 209 | ||
| 197 | @Override | ||
| 198 | public void run() { | ||
| 199 | // TODO Auto-generated method stub | ||
| 200 | while (true) { |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | import android.os.Message; | 6 | import android.os.Message; |
| 7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.widget.Button; | 9 | import android.widget.Button; |
| 10 | import android.widget.GridView; | 10 | import android.widget.GridView; |
| 11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
| 12 | import android.widget.SimpleAdapter; | 12 | import android.widget.SimpleAdapter; |
| 13 | 13 | ||
| 14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
| 15 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 15 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
| 16 | import com.hjx.personalcenter.db.SaveParam; | 16 | import com.hjx.personalcenter.db.SaveParam; |
| 17 | import com.hjx.personalcenter.http.HttpCode; | 17 | import com.hjx.personalcenter.http.HttpCode; |
| 18 | import com.hjx.personalcenter.http.HttpManager; | 18 | import com.hjx.personalcenter.http.HttpManager; |
| 19 | import com.hjx.personalcenter.util.AlertUtils; | ||
| 19 | 20 | ||
| 20 | import org.json.JSONException; | 21 | import org.json.JSONException; |
| 21 | import org.json.JSONObject; | 22 | import org.json.JSONObject; |
| 22 | 23 | ||
| 23 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
| 24 | import java.util.HashMap; | 25 | import java.util.HashMap; |
| 25 | import java.util.List; | 26 | import java.util.List; |
| 26 | import java.util.Map; | 27 | import java.util.Map; |
| 27 | 28 | ||
| 28 | /**选择教材 | 29 | /** |
| 30 | * 选择教材 | ||
| 29 | * Created by h on 2017/8/10. | 31 | * Created by h on 2017/8/10. |
| 30 | */ | 32 | */ |
| 31 | 33 | ||
| 32 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener { | 34 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener { |
| 33 | private GridView gridView; | 35 | private GridView gridView; |
| 34 | private Button btn_ok; | 36 | private Button btn_ok; |
| 35 | private ImageView cancel; | 37 | private ImageView cancel; |
| 36 | private List<Map<String, Object>> data_list; | 38 | private List<Map<String, Object>> data_list; |
| 37 | private SimpleAdapter sim_adapter; | 39 | private SimpleAdapter sim_adapter; |
| 38 | // 图片封装为一个数组 | 40 | // 图片封装为一个数组 |
| 39 | private int[] icon = { R.mipmap.ic_launcher, R.mipmap.ic_launcher, | 41 | private int[] icon = {R.mipmap.ic_launcher, R.mipmap.ic_launcher, |
| 40 | R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, | 42 | R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, |
| 41 | R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, | 43 | R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, |
| 42 | R.mipmap.ic_launcher}; | 44 | R.mipmap.ic_launcher}; |
| 43 | private String[] subject = { "语文", "数学", "英语", "物理", "化学", "生物", "政治", | 45 | private String[] subject = {"语文", "数学", "英语", "物理", "化学", "生物", "政治", |
| 44 | "历史", "地理" }; | 46 | "历史", "地理"}; |
| 45 | private String[] publish = { "人民教育出版社", "人民教育出版社", "人民教育出版社", | 47 | private String[] publish = {"人民教育出版社", "人民教育出版社", "人民教育出版社", |
| 46 | "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社", | 48 | "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社", |
| 47 | "人民教育出版社", "人民教育出版社" }; | 49 | "人民教育出版社", "人民教育出版社"}; |
| 48 | 50 | ||
| 49 | 51 | ||
| 50 | Handler handler = new Handler(){ | 52 | Handler handler = new Handler() { |
| 51 | @Override | 53 | @Override |
| 52 | public void handleMessage(Message msg) { | 54 | public void handleMessage(Message msg) { |
| 53 | super.handleMessage(msg); | 55 | super.handleMessage(msg); |
| 54 | JSONObject jsonObject; | 56 | JSONObject jsonObject; |
| 55 | String status; | 57 | String status; |
| 56 | switch (msg.what){ | 58 | switch (msg.what) { |
| 57 | case HttpCode.CHECKCARD: | 59 | case HttpCode.CHECKCARD: |
| 58 | try { | 60 | try { |
| 59 | jsonObject = new JSONObject( (String) msg.obj); | 61 | jsonObject = new JSONObject((String) msg.obj); |
| 60 | status = jsonObject.optString("status"); | 62 | status = jsonObject.optString("status"); |
| 61 | if (status.equals("1")){ | 63 | if (status.equals("1")) { |
| 62 | Intent intent = new Intent(); | 64 | Intent intent = new Intent(); |
| 63 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 65 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
| 64 | ChoiseTextBookActivity.this.startActivity(intent); | 66 | ChoiseTextBookActivity.this.startActivity(intent); |
| 65 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 67 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 66 | finish(); | 68 | finish(); |
| 67 | }else if(status.equals("2001")){ | 69 | } else if (status.equals("2001")) { |
| 68 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); | 70 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); |
| 69 | } | 71 | } |
| 70 | 72 | ||
| 71 | } catch (JSONException e) { | 73 | } catch (JSONException e) { |
| 72 | e.printStackTrace(); | 74 | e.printStackTrace(); |
| 73 | } | 75 | } |
| 74 | 76 | ||
| 75 | break; | 77 | break; |
| 76 | 78 | ||
| 77 | } | 79 | } |
| 78 | 80 | ||
| 79 | } | 81 | } |
| 80 | }; | 82 | }; |
| 81 | 83 | ||
| 82 | @Override | 84 | @Override |
| 83 | protected void onCreate(Bundle savedInstanceState) { | 85 | protected void onCreate(Bundle savedInstanceState) { |
| 84 | super.onCreate(savedInstanceState); | 86 | super.onCreate(savedInstanceState); |
| 85 | setContentView(R.layout.activity_choisetextbook); | 87 | setContentView(R.layout.activity_choisetextbook); |
| 86 | initView(); | 88 | initView(); |
| 87 | initData(); | 89 | initData(); |
| 88 | initLister(); | 90 | initLister(); |
| 89 | } | 91 | } |
| 90 | 92 | ||
| 91 | private void initView() { | 93 | private void initView() { |
| 92 | gridView = (GridView) findViewById(R.id.grideview); | 94 | gridView = (GridView) findViewById(R.id.grideview); |
| 93 | cancel = (ImageView) findViewById(R.id.cancel); | 95 | cancel = (ImageView) findViewById(R.id.cancel); |
| 94 | btn_ok = (Button) findViewById(R.id.btn_ok); | 96 | btn_ok = (Button) findViewById(R.id.btn_ok); |
| 95 | } | 97 | } |
| 96 | 98 | ||
| 97 | private void initData() { | 99 | private void initData() { |
| 98 | data_list = new ArrayList<Map<String, Object>>(); | 100 | data_list = new ArrayList<Map<String, Object>>(); |
| 99 | getData(); | 101 | getData(); |
| 100 | String [] from ={"image","text","text1"}; | 102 | String[] from = {"image", "text", "text1"}; |
| 101 | int [] to = {R.id.image,R.id.text}; | 103 | int[] to = {R.id.image, R.id.text}; |
| 102 | sim_adapter = new SimpleAdapter(this, data_list, R.layout.activity_choisetextbook_items, from, to); | 104 | sim_adapter = new SimpleAdapter(this, data_list, R.layout.activity_choisetextbook_items, from, to); |
| 103 | //配置适配器 | 105 | //配置适配器 |
| 104 | gridView.setAdapter(sim_adapter); | 106 | gridView.setAdapter(sim_adapter); |
| 105 | 107 | ||
| 106 | } | 108 | } |
| 107 | 109 | ||
| 108 | private void initLister() { | 110 | private void initLister() { |
| 109 | btn_ok.setOnClickListener(this); | 111 | btn_ok.setOnClickListener(this); |
| 110 | cancel.setOnClickListener(this); | 112 | cancel.setOnClickListener(this); |
| 111 | 113 | ||
| 112 | } | 114 | } |
| 113 | public List<Map<String, Object>> getData(){ | 115 | |
| 116 | public List<Map<String, Object>> getData() { | ||
| 114 | //cion和iconName的长度是相同的,这里任选其一都可以 | 117 | //cion和iconName的长度是相同的,这里任选其一都可以 |
| 115 | for(int i=0;i<icon.length;i++){ | 118 | for (int i = 0; i < icon.length; i++) { |
| 116 | Map<String, Object> map = new HashMap<String, Object>(); | 119 | Map<String, Object> map = new HashMap<String, Object>(); |
| 117 | map.put("image", icon[i]); | 120 | map.put("image", icon[i]); |
| 118 | map.put("text", subject[i]); | 121 | map.put("text", subject[i]); |
| 119 | map.put("text1", publish[i]); | 122 | map.put("text1", publish[i]); |
| 120 | data_list.add(map); | 123 | data_list.add(map); |
| 121 | } | 124 | } |
| 122 | 125 | ||
| 123 | return data_list; | 126 | return data_list; |
| 124 | } | 127 | } |
| 125 | 128 | ||
| 126 | @Override | 129 | @Override |
| 127 | public void onClick(View v) { | 130 | public void onClick(View v) { |
| 128 | switch (v.getId()){ | 131 | switch (v.getId()) { |
| 129 | case R.id.btn_ok: | 132 | case R.id.btn_ok: |
| 130 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 133 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 131 | try { | 134 | try { |
| 132 | long auserID = Long.parseLong(userID); | 135 | if (userID == null) { |
| 133 | HttpManager.getInstance().cardinfocheck(this,auserID,handler); | 136 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
| 137 | |||
| 138 | } else { | ||
| 139 | long auserID = Long.parseLong(userID); | ||
| 140 | HttpManager.getInstance().cardinfocheck(this, auserID, handler); | ||
| 141 | } | ||
| 142 | |||
| 134 | } catch (NumberFormatException e) { | 143 | } catch (NumberFormatException e) { |
| 135 | e.printStackTrace(); | 144 | e.printStackTrace(); |
| 136 | } | 145 | } |
| 137 | 146 | ||
| 138 | break; | 147 | break; |
| 139 | case R.id.cancel: | 148 | case R.id.cancel: |
| 140 | finish(); | 149 | finish(); |
| 141 | break; | 150 | break; |
| 142 | } | 151 | } |
| 143 | 152 | ||
| 144 | } | 153 | } |
| 145 | } | 154 | } |
| 146 | 155 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardEditInfoActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.graphics.Color; | ||
| 5 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 6 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
| 7 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
| 8 | import android.view.View; | 7 | import android.view.View; |
| 9 | import android.widget.Button; | 8 | import android.widget.Button; |
| 10 | import android.widget.EditText; | 9 | import android.widget.EditText; |
| 11 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
| 12 | import android.widget.LinearLayout; | 11 | import android.widget.LinearLayout; |
| 13 | import android.widget.TextView; | 12 | import android.widget.TextView; |
| 14 | 13 | ||
| 15 | import com.bigkoo.pickerview.TimePickerView; | 14 | import com.bigkoo.pickerview.TimePickerView; |
| 16 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
| 17 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 16 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
| 18 | import com.hjx.personalcenter.customdialog.CountryDialog; | 17 | import com.hjx.personalcenter.customdialog.CountryDialog; |
| 19 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 18 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 20 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
| 21 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
| 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 23 | import com.hjx.personalcenter.model.CityInfo; | 22 | import com.hjx.personalcenter.model.CityInfo; |
| 24 | import com.hjx.personalcenter.model.CountyInfo; | 23 | import com.hjx.personalcenter.model.CountyInfo; |
| 25 | import com.hjx.personalcenter.model.ProvinceInfo; | 24 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 26 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
| 27 | import com.hjx.personalcenter.util.GetDate; | 26 | import com.hjx.personalcenter.util.GetDate; |
| 28 | 27 | ||
| 29 | import java.text.SimpleDateFormat; | ||
| 30 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
| 31 | import java.util.Date; | ||
| 32 | 29 | ||
| 33 | /**填写保卡信息 熊巍 | 30 | /**填写保卡信息 熊巍 |
| 34 | * Created by h on 2017/8/11. | 31 | * Created by h on 2017/8/11. |
| 35 | */ | 32 | */ |
| 36 | 33 | ||
| 37 | public class ElectronicCardEditInfoActivity extends AppCompatActivity implements View.OnClickListener | 34 | public class ElectronicCardEditInfoActivity extends AppCompatActivity implements View.OnClickListener |
| 38 | ,DialogCallBack.ProvincesCallBack | 35 | ,DialogCallBack.ProvincesCallBack |
| 39 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ | 36 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ |
| 40 | private LinearLayout lineL_buy_time; | 37 | private LinearLayout lineL_buy_time; |
| 41 | private TextView tv_buy_time,adress_shop,adress_custem; | 38 | private TextView tv_buy_time,adress_shop,adress_custem; |
| 42 | private EditText username,store,detalAdress,telphone; | 39 | private EditText username,store,detalAdress,telphone; |
| 43 | private TimePickerView pvTime; | 40 | private TimePickerView pvTime; |
| 44 | private Button btn_change_info; | 41 | private Button btn_change_info; |
| 45 | private ImageView iv_card_back; | 42 | private ImageView iv_card_back; |
| 46 | 43 | ||
| 47 | @Override | 44 | @Override |
| 48 | protected void onCreate(Bundle savedInstanceState) { | 45 | protected void onCreate(Bundle savedInstanceState) { |
| 49 | super.onCreate(savedInstanceState); | 46 | super.onCreate(savedInstanceState); |
| 50 | setContentView(R.layout.activity_electroniccard_info); | 47 | setContentView(R.layout.activity_electroniccard_info); |
| 51 | initView(); | 48 | initView(); |
| 52 | initData(); | 49 | initData(); |
| 53 | initLister(); | 50 | initLister(); |
| 54 | initTimePicker(); | ||
| 55 | } | 51 | } |
| 56 | 52 | ||
| 57 | private void initView() { | 53 | private void initView() { |
| 58 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); | 54 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); |
| 59 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); | 55 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); |
| 60 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); | 56 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); |
| 61 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); | 57 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); |
| 62 | username = (EditText) findViewById(R.id.et_edit_username); | 58 | username = (EditText) findViewById(R.id.et_edit_username); |
| 63 | store = (EditText) findViewById(R.id.et_edit_store); | 59 | store = (EditText) findViewById(R.id.et_edit_store); |
| 64 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); | 60 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); |
| 65 | telphone = (EditText) findViewById(R.id.et_edit_telphone); | 61 | telphone = (EditText) findViewById(R.id.et_edit_telphone); |
| 66 | btn_change_info = (Button) findViewById(R.id.btn_change_info); | 62 | btn_change_info = (Button) findViewById(R.id.btn_change_info); |
| 67 | iv_card_back = (ImageView) findViewById(R.id.iv_card_back); | 63 | iv_card_back = (ImageView) findViewById(R.id.iv_card_back); |
| 68 | } | 64 | } |
| 69 | 65 | ||
| 70 | private void initData() { | 66 | private void initData() { |
| 71 | GetDate date = new GetDate(); | 67 | GetDate date = new GetDate(); |
| 72 | tv_buy_time.setText(date.getYMD().toString()); | 68 | tv_buy_time.setText(date.getYMD().toString()); |
| 73 | 69 | ||
| 74 | } | 70 | } |
| 75 | 71 | ||
| 76 | private void initLister() { | 72 | private void initLister() { |
| 77 | lineL_buy_time.setOnClickListener(this); | ||
| 78 | adress_shop.setOnClickListener(this); | 73 | adress_shop.setOnClickListener(this); |
| 79 | adress_custem.setOnClickListener(this); | 74 | adress_custem.setOnClickListener(this); |
| 80 | btn_change_info.setOnClickListener(this); | 75 | btn_change_info.setOnClickListener(this); |
| 81 | 76 | ||
| 82 | } | 77 | } |
| 83 | //自定义时间选择器 | ||
| 84 | private void initTimePicker() { | ||
| 85 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | ||
| 86 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | ||
| 87 | // Calendar selectedDate = Calendar.getInstance(); | ||
| 88 | // Calendar startDate = Calendar.getInstance(); | ||
| 89 | // startDate.set(1900, 1, 1); | ||
| 90 | // Calendar endDate = Calendar.getInstance(); | ||
| 91 | // endDate.set(2100, 1, 1); | ||
| 92 | //时间选择器 | ||
| 93 | pvTime = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() { | ||
| 94 | @Override | ||
| 95 | public void onTimeSelect(Date date, View v) {//选中事件回调 | ||
| 96 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | ||
| 97 | /*btn_Time.setText(getTime(date));*/ | ||
| 98 | TextView btn = (TextView) v; | ||
| 99 | btn.setText(getTime(date)); | ||
| 100 | } | ||
| 101 | }) | ||
| 102 | //年月日时分秒 的显示与否,不设置则默认全部显示 | ||
| 103 | .setType(new boolean[]{true, true, true, false, false, false}) | ||
| 104 | .setLabel("", "", "", "", "", "") | ||
| 105 | .isCenterLabel(false) | ||
| 106 | .setDividerColor(Color.DKGRAY) | ||
| 107 | .setContentSize(21) | ||
| 108 | // .setDate(selectedDate) | ||
| 109 | // .setRangDate(startDate, endDate) | ||
| 110 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | ||
| 111 | .setDecorView(null) | ||
| 112 | .setTitleText("购买日期") | ||
| 113 | .setTitleSize(22) | ||
| 114 | .setCancelColor(Color.GRAY) | ||
| 115 | .setSubCalSize(22) | ||
| 116 | .setDividerColor(Color.GRAY) | ||
| 117 | .setSubmitColor(Color.GRAY) | ||
| 118 | .build(); | ||
| 119 | } | ||
| 120 | private String getTime(Date date) {//可根据需要自行截取数据显示 | ||
| 121 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 122 | return format.format(date); | ||
| 123 | } | ||
| 124 | 78 | ||
| 125 | @Override | 79 | @Override |
| 126 | public void onClick(View v) { | 80 | public void onClick(View v) { |
| 127 | switch (v.getId()){ | 81 | switch (v.getId()){ |
| 128 | case R.id.lineL_buy_time: | ||
| 129 | |||
| 130 | //pvTime.show(tv_buy_time);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | ||
| 131 | break; | ||
| 132 | case R.id.btn_change_info: | 82 | case R.id.btn_change_info: |
| 133 | String info1 =username.getText().toString().trim(); | 83 | String info1 =username.getText().toString().trim(); |
| 134 | String info2 =adress_custem.getText().toString().trim(); | 84 | String info2 =adress_custem.getText().toString().trim(); |
| 135 | String info3 =detalAdress.getText().toString().trim(); | 85 | String info3 =detalAdress.getText().toString().trim(); |
| 136 | String info4 =tv_buy_time.getText().toString().trim(); | 86 | String info4 =tv_buy_time.getText().toString().trim(); |
| 137 | String info5 =adress_shop.getText().toString().trim(); | 87 | String info5 =adress_shop.getText().toString().trim(); |
| 138 | String info6 =store.getText().toString().trim(); | 88 | String info6 =store.getText().toString().trim(); |
| 139 | String info7 =telphone.getText().toString().trim(); | 89 | String info7 =telphone.getText().toString().trim(); |
| 140 | 90 | ||
| 141 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2)||TextUtils.isEmpty(info3) | 91 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2)||TextUtils.isEmpty(info3) |
| 142 | ||TextUtils.isEmpty(info4)||TextUtils.isEmpty(info5)||TextUtils.isEmpty(info6) | 92 | ||TextUtils.isEmpty(info4)||TextUtils.isEmpty(info5)||TextUtils.isEmpty(info6) |
| 143 | ||TextUtils.isEmpty(info7)) { | 93 | ||TextUtils.isEmpty(info7)) { |
| 144 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); | 94 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); |
| 145 | return; | 95 | return; |
| 146 | }else { | 96 | }else { |
| 147 | savedata(); | 97 | savedata(); |
| 148 | Intent intent = new Intent(); | 98 | Intent intent = new Intent(); |
| 149 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); | 99 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); |
| 150 | startActivity(intent); | 100 | startActivity(intent); |
| 151 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 101 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 152 | } | 102 | } |
| 153 | 103 | ||
| 154 | break; | 104 | break; |
| 155 | case R.id.tv_edit_adress_shop: | 105 | case R.id.tv_edit_adress_shop: |
| 156 | Content.adressflag =1; | 106 | Content.adressflag =1; |
| 157 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 107 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
| 158 | 108 | ||
| 159 | break; | 109 | break; |
| 160 | case R.id.tv_edit_adress_custem: | 110 | case R.id.tv_edit_adress_custem: |
| 161 | Content.adressflag =2; | 111 | Content.adressflag =2; |
| 162 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 112 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
| 163 | 113 | ||
| 164 | break; | 114 | break; |
| 165 | case R.id.iv_card_back: | 115 | case R.id.iv_card_back: |
| 166 | finish(); | 116 | finish(); |
| 167 | break; | 117 | break; |
| 168 | 118 | ||
| 169 | } | 119 | } |
| 170 | 120 | ||
| 171 | 121 | ||
| 172 | } | 122 | } |
| 173 | //保存数据 | 123 | //保存数据 |
| 174 | private void savedata() { | 124 | private void savedata() { |
| 175 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CUNSTEMNAME, username.getText().toString().trim()); | 125 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CUNSTEMNAME, username.getText().toString().trim()); |
| 176 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim()+detalAdress.getText().toString().trim()); | 126 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim()+detalAdress.getText().toString().trim()); |
| 177 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); | 127 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); |
| 178 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPADRESS, adress_shop.getText().toString().trim()+store.getText().toString().trim()); | 128 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPADRESS, adress_shop.getText().toString().trim()+store.getText().toString().trim()); |
| 179 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); | 129 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); |
| 180 | 130 | ||
| 181 | } | 131 | } |
| 182 | 132 | ||
| 183 | @Override | 133 | @Override |
| 184 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 134 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
| 185 | String regionName = data.get(position).getRegionName(); | 135 | String regionName = data.get(position).getRegionName(); |
| 186 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 136 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
| 187 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 137 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
| 188 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 138 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
| 189 | if (Content.adressflag ==1){ | 139 | if (Content.adressflag ==1){ |
| 190 | adress_shop.setText(""); | 140 | adress_shop.setText(""); |
| 191 | adress_shop.setText(provice+regionName); | 141 | adress_shop.setText(provice+regionName); |
| 192 | }else { | 142 | }else { |
| 193 | adress_custem.setText(""); | 143 | adress_custem.setText(""); |
| 194 | adress_custem.setText(provice+regionName); | 144 | adress_custem.setText(provice+regionName); |
| 195 | } | 145 | } |
| 196 | 146 | ||
| 197 | } | 147 | } |
| 198 | 148 | ||
| 199 | @Override | 149 | @Override |
| 200 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 150 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
| 201 | String regionName = data.get(position).getRegionName(); | 151 | String regionName = data.get(position).getRegionName(); |
| 202 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 152 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
| 203 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 153 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
| 204 | if (Content.adressflag ==1){ | 154 | if (Content.adressflag ==1){ |
| 205 | adress_shop.setText(""); | 155 | adress_shop.setText(""); |
| 206 | adress_shop.setText(provices+citys+regionName); | 156 | adress_shop.setText(provices+citys+regionName); |
| 207 | }else { | 157 | }else { |
| 208 | adress_custem.setText(""); | 158 | adress_custem.setText(""); |
| 209 | adress_custem.setText(provices+citys+regionName); | 159 | adress_custem.setText(provices+citys+regionName); |
| 210 | } | 160 | } |
| 211 | 161 | ||
| 212 | 162 | ||
| 213 | 163 | ||
| 214 | } | 164 | } |
| 215 | 165 | ||
| 216 | @Override | 166 | @Override |
| 217 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 167 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
| 218 | String regionName = data.get(position).getRegionName(); | 168 | String regionName = data.get(position).getRegionName(); |
| 219 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 169 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
| 220 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 170 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
| 221 | 171 | adress_custem.setText(""); | |
| 172 | adress_custem.setText(regionName); | ||
| 222 | 173 | ||
| 223 | } | 174 | } |
| 224 | } | 175 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardValidationActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | import android.os.Message; | 6 | import android.os.Message; |
| 7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
| 8 | import android.text.TextUtils; | 8 | import android.text.TextUtils; |
| 9 | import android.view.View; | 9 | import android.view.View; |
| 10 | import android.widget.Button; | 10 | import android.widget.Button; |
| 11 | import android.widget.EditText; | 11 | import android.widget.EditText; |
| 12 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
| 13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
| 14 | 14 | ||
| 15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
| 16 | import com.hjx.personalcenter.db.Content; | 16 | import com.hjx.personalcenter.db.Content; |
| 17 | import com.hjx.personalcenter.db.SaveParam; | 17 | import com.hjx.personalcenter.db.SaveParam; |
| 18 | import com.hjx.personalcenter.http.HttpCode; | 18 | import com.hjx.personalcenter.http.HttpCode; |
| 19 | import com.hjx.personalcenter.http.HttpManager; | 19 | import com.hjx.personalcenter.http.HttpManager; |
| 20 | import com.hjx.personalcenter.util.AlertUtils; | 20 | import com.hjx.personalcenter.util.AlertUtils; |
| 21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
| 22 | 22 | ||
| 23 | import org.json.JSONObject; | 23 | import org.json.JSONObject; |
| 24 | 24 | ||
| 25 | import java.util.TimerTask; | ||
| 26 | |||
| 25 | /** | 27 | /** |
| 26 | * Created by h on 2017/8/9. | 28 | * Created by h on 2017/8/9. |
| 27 | */ | 29 | */ |
| 28 | 30 | ||
| 29 | public class ElectronicCardValidationActivity extends AppCompatActivity implements View.OnClickListener { | 31 | public class ElectronicCardValidationActivity extends AppCompatActivity implements View.OnClickListener { |
| 30 | private Button btn_card_valiyanzhen,get_authcode; | 32 | private Button btn_card_valiyanzhen,get_authcode; |
| 31 | private EditText phonenumber,anth_6num;//;//密码 | 33 | private EditText phonenumber,anth_6num;//;//密码 |
| 32 | private TextView menu_title; | 34 | private TextView menu_title; |
| 33 | private ImageView cancel; | 35 | private ImageView cancel; |
| 34 | private int i = 0; | 36 | private int delayTime=60; |
| 35 | private Thread thread; | 37 | private java.util.Timer Delaytimer; |
| 36 | private String sourceStr ="android"; | 38 | private String sourceStr ="android"; |
| 37 | private String typeStr = "register"; | 39 | private String typeStr = "register"; |
| 38 | String authcode = ""; | 40 | String authcode = ""; |
| 39 | Handler handler = new Handler() { | 41 | Handler handler = new Handler() { |
| 40 | @Override | 42 | @Override |
| 41 | public void handleMessage(Message msg) { | 43 | public void handleMessage(Message msg) { |
| 42 | super.handleMessage(msg); | 44 | super.handleMessage(msg); |
| 43 | JSONObject jsonObject; | 45 | JSONObject jsonObject; |
| 44 | String status; | 46 | String status; |
| 45 | switch (msg.what) { | 47 | switch (msg.what) { |
| 46 | case HttpCode.AUTHCODE_SUCESS: | 48 | case HttpCode.AUTHCODE_SUCESS: |
| 47 | jsonObject = (JSONObject) msg.obj; | 49 | jsonObject = (JSONObject) msg.obj; |
| 48 | status = jsonObject.optString("status"); | 50 | status = jsonObject.optString("status"); |
| 49 | authcode = jsonObject.optString("jsessionid"); | 51 | authcode = jsonObject.optString("jsessionid"); |
| 50 | if (status.equals("100")) { | 52 | if (status.equals("100")) { |
| 51 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); | 53 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); |
| 52 | } | 54 | } |
| 53 | 55 | ||
| 54 | break; | 56 | break; |
| 55 | case HttpCode.AUTHCODE_FAIL: | 57 | case HttpCode.AUTHCODE_FAIL: |
| 56 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); | 58 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); |
| 57 | break; | 59 | break; |
| 58 | case 1: | 60 | case 21: |
| 59 | get_authcode.setEnabled(false); | 61 | if(delayTime<=0){ |
| 60 | get_authcode.setClickable(false); | 62 | if(Delaytimer!=null){ |
| 61 | get_authcode.setText(Integer.toString(i--)+" s"); | 63 | Delaytimer.cancel(); |
| 62 | if (i<=0){ | 64 | } |
| 63 | get_authcode.setEnabled(true); | 65 | get_authcode.setEnabled(true); |
| 64 | get_authcode.setClickable(true); | 66 | get_authcode.setClickable(true); |
| 65 | get_authcode.setText("获取验证码"); | 67 | get_authcode.setText("获取验证码"); |
| 68 | delayTime=60; | ||
| 69 | }else{ | ||
| 70 | get_authcode.setEnabled(false); | ||
| 71 | get_authcode.setClickable(false); | ||
| 72 | get_authcode.setText(delayTime + " s"); | ||
| 66 | } | 73 | } |
| 67 | break; | 74 | break; |
| 68 | } | 75 | } |
| 69 | } | 76 | } |
| 70 | }; | 77 | }; |
| 71 | @Override | 78 | @Override |
| 72 | protected void onCreate(Bundle savedInstanceState) { | 79 | protected void onCreate(Bundle savedInstanceState) { |
| 73 | super.onCreate(savedInstanceState); | 80 | super.onCreate(savedInstanceState); |
| 74 | setContentView(R.layout.activity_electroniccard_validation); | 81 | setContentView(R.layout.activity_electroniccard_validation); |
| 75 | initView(); | 82 | initView(); |
| 76 | initData(); | 83 | initData(); |
| 77 | initLister(); | 84 | initLister(); |
| 78 | } | 85 | } |
| 79 | 86 | ||
| 80 | private void initView() { | 87 | private void initView() { |
| 81 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); | 88 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); |
| 82 | get_authcode = (Button) findViewById(R.id.btn_authcode); | 89 | get_authcode = (Button) findViewById(R.id.btn_authcode); |
| 83 | anth_6num = (EditText) findViewById(R.id.et_authcode); | 90 | anth_6num = (EditText) findViewById(R.id.et_authcode); |
| 84 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); | 91 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); |
| 85 | menu_title = (TextView) findViewById(R.id.menu_title); | 92 | menu_title = (TextView) findViewById(R.id.menu_title); |
| 86 | cancel = (ImageView) findViewById(R.id.cancel); | 93 | cancel = (ImageView) findViewById(R.id.cancel); |
| 87 | } | 94 | } |
| 88 | 95 | ||
| 89 | private void initData() { | 96 | private void initData() { |
| 90 | if (Content.authcodeflag==1){ | 97 | if (Content.authcodeflag==1){ |
| 91 | menu_title.setText("更换绑定"); | 98 | menu_title.setText("更换绑定"); |
| 92 | btn_card_valiyanzhen.setText("确定"); | 99 | btn_card_valiyanzhen.setText("确定"); |
| 93 | 100 | ||
| 94 | }else if (Content.authcodeflag==2){ | 101 | }else if (Content.authcodeflag==2){ |
| 95 | menu_title.setText("修改保卡信息"); | 102 | menu_title.setText("修改保卡信息"); |
| 96 | btn_card_valiyanzhen.setText("确定"); | 103 | btn_card_valiyanzhen.setText("确定"); |
| 97 | 104 | ||
| 98 | }else { | 105 | }else { |
| 99 | menu_title.setText("填写保卡信息"); | 106 | menu_title.setText("填写保卡信息"); |
| 100 | btn_card_valiyanzhen.setText("下一步"); | 107 | btn_card_valiyanzhen.setText("下一步"); |
| 101 | } | 108 | } |
| 102 | 109 | ||
| 103 | 110 | ||
| 104 | 111 | ||
| 105 | } | 112 | } |
| 106 | 113 | ||
| 107 | private void initLister() { | 114 | private void initLister() { |
| 108 | get_authcode.setOnClickListener(this); | 115 | get_authcode.setOnClickListener(this); |
| 109 | btn_card_valiyanzhen.setOnClickListener(this); | 116 | btn_card_valiyanzhen.setOnClickListener(this); |
| 110 | cancel.setOnClickListener(this); | 117 | cancel.setOnClickListener(this); |
| 111 | 118 | ||
| 112 | } | 119 | } |
| 113 | 120 | ||
| 114 | @Override | 121 | @Override |
| 115 | public void onClick(View v) { | 122 | public void onClick(View v) { |
| 116 | switch (v.getId()){ | 123 | switch (v.getId()){ |
| 117 | case R.id.btn_card_valiyanzhen: | 124 | case R.id.btn_card_valiyanzhen: |
| 118 | 125 | ||
| 119 | String usernameStr = phonenumber.getText().toString().trim(); | 126 | String usernameStr = phonenumber.getText().toString().trim(); |
| 120 | String authcodeStr = anth_6num.getText().toString().trim(); | 127 | String authcodeStr = anth_6num.getText().toString().trim(); |
| 121 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { | 128 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { |
| 122 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); | 129 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); |
| 123 | return; | 130 | return; |
| 124 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 131 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ |
| 125 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); | 132 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); |
| 126 | 133 | ||
| 127 | }else if (!authcode.equals(authcodeStr)){ | 134 | }else if (!authcode.equals(authcodeStr)){ |
| 128 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); | 135 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); |
| 129 | }else { | 136 | }else { |
| 130 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 137 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
| 131 | int auserID = 0; | 138 | int auserID = 0; |
| 132 | try { | 139 | try { |
| 133 | auserID = Integer.parseInt(userID); | 140 | auserID = Integer.parseInt(userID); |
| 134 | } catch (NumberFormatException e) { | 141 | } catch (NumberFormatException e) { |
| 135 | e.printStackTrace(); | 142 | e.printStackTrace(); |
| 136 | } | 143 | } |
| 137 | if (Content.authcodeflag==1){ | 144 | if (Content.authcodeflag==1){ |
| 138 | //修改账户手机号 | 145 | //修改账户手机号 |
| 139 | HttpManager.getInstance().changecardinfophone(this, | 146 | HttpManager.getInstance().changecardinfophone(this, |
| 140 | auserID,usernameStr,authcodeStr); | 147 | auserID,usernameStr,authcodeStr); |
| 141 | 148 | ||
| 142 | 149 | ||
| 143 | }else if (Content.authcodeflag==2){ | 150 | }else if (Content.authcodeflag==2){ |
| 144 | //修改保卡手机号 | 151 | //修改保卡手机号 |
| 145 | HttpManager.getInstance().changecardinfophone(this, | 152 | HttpManager.getInstance().changecardinfophone(this, |
| 146 | auserID,usernameStr,authcodeStr); | 153 | auserID,usernameStr,authcodeStr); |
| 147 | }else { | 154 | }else { |
| 148 | String phone =phonenumber.getText().toString().trim(); | 155 | String phone =phonenumber.getText().toString().trim(); |
| 149 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone ); | 156 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone ); |
| 150 | Intent intent = new Intent(); | 157 | Intent intent = new Intent(); |
| 151 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | 158 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); |
| 152 | startActivity(intent); | 159 | startActivity(intent); |
| 153 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 160 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 154 | } | 161 | } |
| 155 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); | 162 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); |
| 156 | // Intent intent = new Intent(); | 163 | // Intent intent = new Intent(); |
| 157 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | 164 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); |
| 158 | // startActivity(intent); | 165 | // startActivity(intent); |
| 159 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); | 166 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 160 | } | 167 | } |
| 161 | break; | 168 | break; |
| 162 | case R.id.btn_authcode: | 169 | case R.id.btn_authcode: |
| 163 | String usernameStr1 = phonenumber.getText().toString().trim(); | 170 | String usernameStr1 = phonenumber.getText().toString().trim(); |
| 164 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ | 171 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ |
| 165 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); | 172 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); |
| 166 | }else { | 173 | }else { |
| 167 | anth_6num.requestFocus(); | 174 | anth_6num.requestFocus(); |
| 168 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); | 175 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); |
| 169 | i = 60; | 176 | valiDelay(); |
| 170 | if(thread == null){ | ||
| 171 | thread = new Thread( new ThreadShow()); | ||
| 172 | thread.start(); | ||
| 173 | } | ||
| 174 | 177 | ||
| 175 | } | 178 | } |
| 176 | 179 | ||
| 177 | break; | 180 | break; |
| 178 | case R.id.cancel: | 181 | case R.id.cancel: |
| 179 | finish(); | 182 | finish(); |
| 180 | break; | 183 | break; |
| 181 | } | 184 | } |
| 182 | } | 185 | } |
| 183 | // 线程类 定时器 | 186 | // 线程类 定时器 |
| 184 | class ThreadShow implements Runnable { | 187 | public void valiDelay() { |
| 185 | 188 | ||
| 186 | @Override | 189 | Delaytimer = new java.util.Timer(true); |
| 187 | public void run() { | 190 | |
| 188 | // TODO Auto-generated method stub | 191 | |
| 189 | while (true) { | 192 | TimerTask task = new TimerTask() { |
| 190 | try { | 193 | public void run() { |
| 191 | Thread.sleep(1000); | 194 | //每次需要执行的代码放到这里面。 |
| 192 | Message msg = new Message(); | 195 | delayTime--; |
| 193 | msg.what = 1; | 196 | handler.sendEmptyMessage(21); |
| 194 | handler.sendMessage(msg); | ||
| 195 | System.out.println("send..."); | ||
| 196 | } catch (Exception e) { | ||
| 197 | // TODO Auto-generated catch block | ||
| 198 | e.printStackTrace(); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/FeedBackActivity.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.content.pm.PackageManager; | 4 | import android.content.pm.PackageManager; |
| 5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
| 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.provider.MediaStore; | 9 | import android.provider.MediaStore; |
| 10 | import android.support.annotation.NonNull; | 10 | import android.support.annotation.NonNull; |
| 11 | import android.support.v4.content.FileProvider; | 11 | import android.support.v4.content.FileProvider; |
| 12 | import android.support.v7.app.AppCompatActivity; | 12 | import android.support.v7.app.AppCompatActivity; |
| 13 | import android.text.TextUtils; | 13 | import android.text.TextUtils; |
| 14 | import android.util.Log; | ||
| 15 | import android.view.Gravity; | 14 | import android.view.Gravity; |
| 16 | import android.view.View; | 15 | import android.view.View; |
| 17 | import android.widget.AdapterView; | 16 | import android.widget.AdapterView; |
| 18 | import android.widget.EditText; | 17 | import android.widget.EditText; |
| 19 | import android.widget.ImageView; | 18 | import android.widget.ImageView; |
| 20 | import android.widget.TextView; | 19 | import android.widget.TextView; |
| 21 | import android.widget.Toast; | 20 | import android.widget.Toast; |
| 22 | 21 | ||
| 23 | import com.facebook.drawee.backends.pipeline.Fresco; | 22 | import com.facebook.drawee.backends.pipeline.Fresco; |
| 24 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 23 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
| 25 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 24 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
| 26 | import com.facebook.drawee.generic.RoundingParams; | 25 | import com.facebook.drawee.generic.RoundingParams; |
| 27 | import com.facebook.drawee.interfaces.DraweeController; | 26 | import com.facebook.drawee.interfaces.DraweeController; |
| 28 | import com.facebook.drawee.view.SimpleDraweeView; | 27 | import com.facebook.drawee.view.SimpleDraweeView; |
| 29 | import com.hjx.personalcenter.R; | 28 | import com.hjx.personalcenter.R; |
| 30 | import com.hjx.personalcenter.db.SaveParam; | 29 | import com.hjx.personalcenter.db.SaveParam; |
| 31 | import com.hjx.personalcenter.http.HttpManager; | 30 | import com.hjx.personalcenter.http.HttpManager; |
| 32 | import com.hjx.personalcenter.model.FeedBackInfo; | ||
| 33 | import com.hjx.personalcenter.util.AlertUtils; | 31 | import com.hjx.personalcenter.util.AlertUtils; |
| 34 | import com.hjx.personalcenter.util.CropUtils; | 32 | import com.hjx.personalcenter.util.CropUtils; |
| 35 | import com.hjx.personalcenter.util.DialogPermission; | 33 | import com.hjx.personalcenter.util.DialogPermission; |
| 36 | import com.hjx.personalcenter.util.FileUtil; | 34 | import com.hjx.personalcenter.util.FileUtil; |
| 37 | import com.hjx.personalcenter.util.GetDate; | ||
| 38 | import com.hjx.personalcenter.util.PermissionUtil; | 35 | import com.hjx.personalcenter.util.PermissionUtil; |
| 39 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 36 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
| 40 | import com.mylhyl.circledialog.CircleDialog; | 37 | import com.mylhyl.circledialog.CircleDialog; |
| 41 | import com.mylhyl.circledialog.callback.ConfigButton; | 38 | import com.mylhyl.circledialog.callback.ConfigButton; |
| 42 | import com.mylhyl.circledialog.callback.ConfigDialog; | 39 | import com.mylhyl.circledialog.callback.ConfigDialog; |
| 43 | import com.mylhyl.circledialog.params.ButtonParams; | 40 | import com.mylhyl.circledialog.params.ButtonParams; |
| 44 | import com.mylhyl.circledialog.params.DialogParams; | 41 | import com.mylhyl.circledialog.params.DialogParams; |
| 45 | 42 | ||
| 46 | import java.io.File; | 43 | import java.io.File; |
| 47 | import java.util.ArrayList; | ||
| 48 | import java.util.List; | ||
| 49 | 44 | ||
| 50 | /** | 45 | /** |
| 51 | * Created by h on 2017/8/11. | 46 | * Created by h on 2017/8/11. |
| 52 | */ | 47 | */ |
| 53 | 48 | ||
| 54 | public class FeedBackActivity extends AppCompatActivity implements View.OnClickListener { | 49 | public class FeedBackActivity extends AppCompatActivity implements View.OnClickListener { |
| 55 | private ImageView iv_cance, iv_show, iv_take; | 50 | private ImageView iv_cance, iv_show, iv_take; |
| 56 | private EditText content, phone; | 51 | private EditText content, phone; |
| 57 | private TextView tv_sub; | 52 | private TextView tv_sub; |
| 58 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 53 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
| 59 | private static final int REQUEST_CODE_ALBUM = 2; | 54 | private static final int REQUEST_CODE_ALBUM = 2; |
| 60 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 55 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
| 61 | SimpleDraweeView mSimpleDraweeView; | 56 | SimpleDraweeView mSimpleDraweeView; |
| 57 | String type = "个人中心"; | ||
| 62 | private File file; | 58 | private File file; |
| 63 | private Uri uri; | 59 | private Uri uri; |
| 64 | 60 | ||
| 65 | @Override | 61 | @Override |
| 66 | protected void onCreate(Bundle savedInstanceState) { | 62 | protected void onCreate(Bundle savedInstanceState) { |
| 67 | super.onCreate(savedInstanceState); | 63 | super.onCreate(savedInstanceState); |
| 68 | Fresco.initialize(this); | 64 | Fresco.initialize(this); |
| 69 | setContentView(R.layout.activity_feedback); | 65 | setContentView(R.layout.activity_feedback); |
| 70 | initView(); | 66 | initView(); |
| 71 | initData(); | 67 | initData(); |
| 72 | initLister(); | 68 | initLister(); |
| 73 | } | 69 | } |
| 74 | 70 | ||
| 75 | private void initView() { | 71 | private void initView() { |
| 76 | iv_cance = (ImageView) findViewById(R.id.cancel); | 72 | iv_cance = (ImageView) findViewById(R.id.cancel); |
| 77 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.show_iv); | 73 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.show_iv); |
| 78 | iv_take = (ImageView) findViewById(R.id.iv_take); | 74 | iv_take = (ImageView) findViewById(R.id.iv_take); |
| 79 | content = (EditText) findViewById(R.id.feedback_content); | 75 | content = (EditText) findViewById(R.id.feedback_content); |
| 80 | phone = (EditText) findViewById(R.id.feedback_phone); | 76 | phone = (EditText) findViewById(R.id.feedback_phone); |
| 81 | tv_sub = (TextView) findViewById(R.id.feedback_sub); | 77 | tv_sub = (TextView) findViewById(R.id.feedback_sub); |
| 82 | 78 | ||
| 83 | } | 79 | } |
| 84 | 80 | ||
| 85 | private void initData() { | 81 | private void initData() { |
| 86 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 82 | file = new File(FileUtil.getCachePath(this), "user-feedback.jpg"); |
| 87 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 83 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 88 | uri = Uri.fromFile(file); | 84 | uri = Uri.fromFile(file); |
| 89 | } else { | 85 | } else { |
| 90 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 86 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
| 91 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 87 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
| 92 | } | 88 | } |
| 93 | 89 | ||
| 94 | } | 90 | } |
| 95 | 91 | ||
| 96 | private void initLister() { | 92 | private void initLister() { |
| 97 | iv_cance.setOnClickListener(this); | 93 | iv_cance.setOnClickListener(this); |
| 98 | iv_take.setOnClickListener(this); | 94 | iv_take.setOnClickListener(this); |
| 99 | tv_sub.setOnClickListener(this); | 95 | tv_sub.setOnClickListener(this); |
| 100 | mSimpleDraweeView.setOnClickListener(this); | 96 | mSimpleDraweeView.setOnClickListener(this); |
| 101 | 97 | ||
| 102 | } | 98 | } |
| 103 | 99 | ||
| 104 | @Override | 100 | @Override |
| 105 | public void onClick(View v) { | 101 | public void onClick(View v) { |
| 106 | String contents = content.getText().toString().trim(); | 102 | String contents = content.getText().toString().trim(); |
| 107 | String contants = phone.getText().toString().trim(); | 103 | String contants = phone.getText().toString().trim(); |
| 108 | switch (v.getId()) { | 104 | switch (v.getId()) { |
| 109 | case R.id.cancel: | 105 | case R.id.cancel: |
| 110 | finish(); | 106 | finish(); |
| 111 | break; | 107 | break; |
| 112 | case R.id.iv_take: | 108 | case R.id.iv_take: |
| 113 | choiceAvatar(); | 109 | choiceAvatar(); |
| 114 | break; | 110 | break; |
| 115 | case R.id.feedback_sub: | 111 | case R.id.feedback_sub: |
| 116 | //提交用户反馈 | 112 | //提交用户反馈 |
| 117 | if (TextUtils.isEmpty(contents)) { | 113 | if (TextUtils.isEmpty(contents)) { |
| 118 | AlertUtils.showToast(FeedBackActivity.this, "请将必填项填写完整"); | 114 | AlertUtils.showToast(FeedBackActivity.this, "请将必填项填写完整"); |
| 119 | return; | 115 | return; |
| 120 | } | 116 | } |
| 121 | long auserID = 0; | ||
| 122 | GetDate date = new GetDate(); | ||
| 123 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 117 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 124 | try { | 118 | try { |
| 125 | auserID = Long.parseLong(userID); | 119 | HttpManager.getInstance().feedback(FeedBackActivity.this, userID, |
| 126 | 120 | contents,contants,file.getPath(),type); | |
| 127 | FeedBackInfo feedBackInfo = new FeedBackInfo(); | ||
| 128 | feedBackInfo.setUserId(auserID); | ||
| 129 | feedBackInfo.setContact(contants); | ||
| 130 | feedBackInfo.setContent(contents); | ||
| 131 | feedBackInfo.setFeedBackDate(date.getYMD().toString()); | ||
| 132 | feedBackInfo.setFeedtype("个人中心"); | ||
| 133 | List<FeedBackInfo.ImgUrlBean> feedbackBean = new ArrayList<>(); | ||
| 134 | FeedBackInfo.ImgUrlBean imgurl = new FeedBackInfo.ImgUrlBean(); | ||
| 135 | imgurl.setImgUrl(file.getPath()); | ||
| 136 | feedbackBean.add(imgurl); | ||
| 137 | feedBackInfo.setImgUrl(feedbackBean); | ||
| 138 | Log.e("test", feedBackInfo.toString()); | ||
| 139 | HttpManager.getInstance().feedback(FeedBackActivity.this, feedBackInfo); | ||
| 140 | } catch (Exception e) { | 121 | } catch (Exception e) { |
| 141 | e.printStackTrace(); | 122 | e.printStackTrace(); |
| 142 | } | 123 | } |
| 143 | break; | 124 | break; |
| 144 | case R.id.show_iv: | 125 | case R.id.show_iv: |
| 145 | 126 | ||
| 146 | 127 | ||
| 147 | break; | 128 | break; |
| 148 | } | 129 | } |
| 149 | } | 130 | } |
| 150 | 131 | ||
| 151 | //拍摄头像 | 132 | //拍摄头像 |
| 152 | private void choiceAvatar() { | 133 | private void choiceAvatar() { |
| 153 | final String[] items = {"拍照", "从相册选择"}; | 134 | final String[] items = {"拍照", "从相册选择"}; |
| 154 | new CircleDialog.Builder(this) | 135 | new CircleDialog.Builder(this) |
| 155 | .configDialog(new ConfigDialog() { | 136 | .configDialog(new ConfigDialog() { |
| 156 | @Override | 137 | @Override |
| 157 | public void onConfig(DialogParams params) { | 138 | public void onConfig(DialogParams params) { |
| 158 | //增加弹出动画 | 139 | //增加弹出动画 |
| 159 | params.gravity = Gravity.CENTER; | 140 | params.gravity = Gravity.CENTER; |
| 160 | } | 141 | } |
| 161 | }) | 142 | }) |
| 162 | .setTitle("请选择图片来源") | 143 | .setTitle("请选择图片来源") |
| 163 | .setWidth(0.5f) | 144 | .setWidth(0.5f) |
| 164 | .setItems(items, new AdapterView.OnItemClickListener() { | 145 | .setItems(items, new AdapterView.OnItemClickListener() { |
| 165 | @Override | 146 | @Override |
| 166 | public void onItemClick(AdapterView<?> parent, View view, int | 147 | public void onItemClick(AdapterView<?> parent, View view, int |
| 167 | position, long id) { | 148 | position, long id) { |
| 168 | switch (position) { | 149 | switch (position) { |
| 169 | case 0: | 150 | case 0: |
| 170 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { | 151 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { |
| 171 | uploadAvatarFromPhotoRequest(); | 152 | uploadAvatarFromPhotoRequest(); |
| 172 | } | 153 | } |
| 173 | break; | 154 | break; |
| 174 | case 1: | 155 | case 1: |
| 175 | uploadAvatarFromAlbumRequest(); | 156 | uploadAvatarFromAlbumRequest(); |
| 176 | break; | 157 | break; |
| 177 | } | 158 | } |
| 178 | 159 | ||
| 179 | } | 160 | } |
| 180 | }) | 161 | }) |
| 181 | .setNegative("取消", null) | 162 | .setNegative("取消", null) |
| 182 | .configNegative(new ConfigButton() { | 163 | .configNegative(new ConfigButton() { |
| 183 | @Override | 164 | @Override |
| 184 | public void onConfig(ButtonParams params) { | 165 | public void onConfig(ButtonParams params) { |
| 185 | //取消按钮字体颜色 | 166 | //取消按钮字体颜色 |
| 186 | params.textColor = Color.RED; | 167 | params.textColor = Color.RED; |
| 187 | } | 168 | } |
| 188 | }) | 169 | }) |
| 189 | .show(); | 170 | .show(); |
| 190 | 171 | ||
| 191 | 172 | ||
| 192 | } | 173 | } |
| 193 | 174 | ||
| 194 | //照相 | 175 | //照相 |
| 195 | private void uploadAvatarFromPhotoRequest() { | 176 | private void uploadAvatarFromPhotoRequest() { |
| 196 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 177 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
| 197 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 178 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 198 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 179 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
| 199 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 180 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
| 200 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 181 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
| 201 | } | 182 | } |
| 202 | 183 | ||
| 203 | //选择图库 | 184 | //选择图库 |
| 204 | private void uploadAvatarFromAlbumRequest() { | 185 | private void uploadAvatarFromAlbumRequest() { |
| 205 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 186 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
| 206 | photoPickerIntent.setType("image/*"); | 187 | photoPickerIntent.setType("image/*"); |
| 207 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 188 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
| 208 | } | 189 | } |
| 209 | 190 | ||
| 210 | //回掉 | 191 | //回掉 |
| 211 | @Override | 192 | @Override |
| 212 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 193 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 213 | super.onActivityResult(requestCode, resultCode, data); | 194 | super.onActivityResult(requestCode, resultCode, data); |
| 214 | if (resultCode != -1) { | 195 | if (resultCode != -1) { |
| 215 | return; | 196 | return; |
| 216 | } | 197 | } |
| 217 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 198 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
| 218 | Uri newUri; | 199 | Uri newUri; |
| 219 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 200 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 220 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 201 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
| 221 | } else { | 202 | } else { |
| 222 | newUri = data.getData(); | 203 | newUri = data.getData(); |
| 223 | } | 204 | } |
| 224 | if (newUri != null) { | 205 | if (newUri != null) { |
| 225 | uploadAvatarFromPhoto(); | 206 | uploadAvatarFromPhoto(); |
| 226 | //裁剪图片 | 207 | //裁剪图片 |
| 227 | //startPhotoZoom(newUri); | 208 | //startPhotoZoom(newUri); |
| 228 | } else { | 209 | } else { |
| 229 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 210 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
| 230 | } | 211 | } |
| 231 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 212 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
| 232 | uploadAvatarFromPhoto(); | 213 | uploadAvatarFromPhoto(); |
| 233 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 214 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
| 234 | uploadAvatarFromPhoto(); | 215 | uploadAvatarFromPhoto(); |
| 235 | } | 216 | } |
| 236 | } | 217 | } |
| 237 | 218 | ||
| 238 | private void uploadAvatarFromPhoto() { | 219 | private void uploadAvatarFromPhoto() { |
| 239 | compressAndUploadAvatar(file.getPath()); | 220 | compressAndUploadAvatar(file.getPath()); |
| 240 | 221 | ||
| 241 | } | 222 | } |
| 242 | 223 | ||
| 243 | private void compressAndUploadAvatar(String fileSrc) { | 224 | private void compressAndUploadAvatar(String fileSrc) { |
| 244 | 225 | ||
| 245 | 226 | ||
| 246 | //上传到服务器 | 227 | //上传到服务器 |
| 247 | 228 | ||
| 248 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 229 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
| 249 | String mimeType = "image/*"; | 230 | String mimeType = "image/*"; |
| 250 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 231 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
| 251 | //String fileName = cover.getName(); | 232 | //String fileName = cover.getName(); |
| 252 | //HttpManager.getInstance().header(this, fileSrc); | 233 | //HttpManager.getInstance().header(this, fileSrc); |
| 253 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 234 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
| 254 | //Fresco设置圆形头像 | 235 | //Fresco设置圆形头像 |
| 255 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 236 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
| 256 | GenericDraweeHierarchy hierarchy = builder | 237 | GenericDraweeHierarchy hierarchy = builder |
| 257 | .setDesiredAspectRatio(1f) | 238 | .setDesiredAspectRatio(1f) |
| 258 | .setFailureImage(R.mipmap.blank) | 239 | .setFailureImage(R.mipmap.blank) |
| 259 | //圆形头像 | 240 | //圆形头像 |
| 260 | .setRoundingParams(RoundingParams.fromCornersRadius(0.7f)) | 241 | .setRoundingParams(RoundingParams.fromCornersRadius(0.7f)) |
| 261 | .build(); | 242 | .build(); |
| 262 | 243 | ||
| 263 | //加载本地图片 | 244 | //加载本地图片 |
| 264 | Uri uri = Uri.fromFile(cover); | 245 | Uri uri = Uri.fromFile(cover); |
| 265 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 246 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
| 266 | .setOldController(mSimpleDraweeView.getController()) | 247 | .setOldController(mSimpleDraweeView.getController()) |
| 267 | .setUri(uri) | 248 | .setUri(uri) |
| 268 | .build(); | 249 | .build(); |
| 269 | mSimpleDraweeView.setHierarchy(hierarchy); | 250 | mSimpleDraweeView.setHierarchy(hierarchy); |
| 270 | mSimpleDraweeView.setController(controller); | 251 | mSimpleDraweeView.setController(controller); |
| 271 | 252 | ||
| 272 | } | 253 | } |
| 273 | 254 | ||
| 274 | public void startPhotoZoom(Uri uri) { | 255 | public void startPhotoZoom(Uri uri) { |
| 275 | Intent intent = new Intent("com.android.camera.action.CROP"); | 256 | Intent intent = new Intent("com.android.camera.action.CROP"); |
| 276 | intent.setDataAndType(uri, "image/*"); | 257 | intent.setDataAndType(uri, "image/*"); |
| 277 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 258 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 278 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 259 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
| 279 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 260 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
| 280 | intent.putExtra("aspectY", 1);// x:y=1:1 | 261 | intent.putExtra("aspectY", 1);// x:y=1:1 |
| 281 | // intent.putExtra("outputX", 400);//图片输出大小 | 262 | // intent.putExtra("outputX", 400);//图片输出大小 |
| 282 | // intent.putExtra("outputY", 400); | 263 | // intent.putExtra("outputY", 400); |
| 283 | intent.putExtra("output", Uri.fromFile(file)); | 264 | intent.putExtra("output", Uri.fromFile(file)); |
| 284 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 265 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
| 285 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 266 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
| 286 | } | 267 | } |
| 287 | 268 | ||
| 288 | @Override | 269 | @Override |
| 289 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 270 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
| 290 | switch (requestCode) { | 271 | switch (requestCode) { |
| 291 | 272 | ||
| 292 | case PermissionUtil.REQUEST_SHOWCAMERA: | 273 | case PermissionUtil.REQUEST_SHOWCAMERA: |
| 293 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 274 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
| 294 | // Permission Granted | 275 | // Permission Granted |
| 295 | uploadAvatarFromPhotoRequest(); | 276 | uploadAvatarFromPhotoRequest(); |
| 296 | 277 | ||
| 297 | } else { | 278 | } else { |
| 298 | if (!SharedPreferenceMark.getHasShowCamera()) { | 279 | if (!SharedPreferenceMark.getHasShowCamera()) { |
| 299 | SharedPreferenceMark.setHasShowCamera(true); | 280 | SharedPreferenceMark.setHasShowCamera(true); |
| 300 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 281 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
| 301 | 282 | ||
| 302 | } else { | 283 | } else { |
| 303 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 284 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
| 304 | .show(); | 285 | .show(); |
| 305 | } | 286 | } |
| 306 | } | 287 | } |
| 307 | break; | 288 | break; |
| 308 | default: | 289 | default: |
| 309 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 290 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 310 | } | 291 | } |
| 311 | } | 292 | } |
| 312 | } | 293 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ForgotPasswordActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | import android.os.Handler; | 4 | import android.os.Handler; |
| 5 | import android.os.Message; | 5 | import android.os.Message; |
| 6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v7.app.AppCompatActivity; |
| 7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 8 | import android.text.method.HideReturnsTransformationMethod; | 8 | import android.text.method.HideReturnsTransformationMethod; |
| 9 | import android.text.method.PasswordTransformationMethod; | 9 | import android.text.method.PasswordTransformationMethod; |
| 10 | import android.view.View; | 10 | import android.view.View; |
| 11 | import android.widget.Button; | 11 | import android.widget.Button; |
| 12 | import android.widget.EditText; | 12 | import android.widget.EditText; |
| 13 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
| 14 | 14 | ||
| 15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
| 16 | import com.hjx.personalcenter.http.HttpCode; | 16 | import com.hjx.personalcenter.http.HttpCode; |
| 17 | import com.hjx.personalcenter.http.HttpManager; | 17 | import com.hjx.personalcenter.http.HttpManager; |
| 18 | import com.hjx.personalcenter.util.AlertUtils; | 18 | import com.hjx.personalcenter.util.AlertUtils; |
| 19 | import com.hjx.personalcenter.util.Judgment; | 19 | import com.hjx.personalcenter.util.Judgment; |
| 20 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 20 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
| 21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
| 22 | 22 | ||
| 23 | import org.json.JSONException; | 23 | import org.json.JSONException; |
| 24 | import org.json.JSONObject; | 24 | import org.json.JSONObject; |
| 25 | 25 | ||
| 26 | import java.util.Timer; | ||
| 27 | import java.util.TimerTask; | 26 | import java.util.TimerTask; |
| 28 | 27 | ||
| 29 | /** | 28 | /** |
| 30 | * 忘记密码 | 29 | * 忘记密码 |
| 31 | * Created by h on 2017/6/17. | 30 | * Created by h on 2017/6/17. |
| 32 | */ | 31 | */ |
| 33 | 32 | ||
| 34 | public class ForgotPasswordActivity extends AppCompatActivity implements View.OnClickListener { | 33 | public class ForgotPasswordActivity extends AppCompatActivity implements View.OnClickListener { |
| 35 | private ImageView back_forgit, iv_pwd_change; | 34 | private ImageView back_forgit, iv_pwd_change; |
| 36 | private EditText forot_pwd_phone, forot_pwd_anthcode, forot_pwd_pwd, forot_pwd_pwd2; | 35 | private EditText forot_pwd_phone, forot_pwd_anthcode, forot_pwd_pwd, forot_pwd_pwd2; |
| 37 | private Button forot_pwd_sub, forot_pwd_getanthcode; | 36 | private Button forot_pwd_sub, forot_pwd_getanthcode; |
| 38 | private String forot_pwd_phone1; | 37 | private String forot_pwd_phone1; |
| 39 | private String forot_pwd_anthcode1; | 38 | private String forot_pwd_anthcode1; |
| 40 | private String forot_pwd_pwd3; | 39 | private String forot_pwd_pwd3; |
| 41 | private String forot_pwd_pwd4; | 40 | private String forot_pwd_pwd4; |
| 42 | private String typeStr = "login"; | 41 | private String typeStr = "login"; |
| 43 | private int i = 0; | 42 | private int delayTime=60; |
| 44 | private Thread thread; | 43 | private java.util.Timer Delaytimer; |
| 45 | public static Boolean showPassword = false; | 44 | public static Boolean showPassword = false; |
| 46 | 45 | ||
| 47 | Handler handler = new Handler() { | 46 | Handler handler = new Handler() { |
| 48 | @Override | 47 | @Override |
| 49 | public void handleMessage(Message msg) { | 48 | public void handleMessage(Message msg) { |
| 50 | super.handleMessage(msg); | 49 | super.handleMessage(msg); |
| 51 | try { | 50 | try { |
| 52 | JSONObject jsonObject; | 51 | JSONObject jsonObject; |
| 53 | String status; | 52 | String status; |
| 54 | switch (msg.what) { | 53 | switch (msg.what) { |
| 55 | case HttpCode.PASSWORD_SUCESS: | 54 | case HttpCode.PASSWORD_SUCESS: |
| 56 | jsonObject = (JSONObject) msg.obj; | 55 | jsonObject = (JSONObject) msg.obj; |
| 57 | status = jsonObject.getString("status"); | 56 | status = jsonObject.getString("status"); |
| 58 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 57 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
| 59 | if (status.equals("100")) { | 58 | if (status.equals("100")) { |
| 60 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改成功"); | 59 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改成功"); |
| 61 | } | 60 | } |
| 62 | 61 | ||
| 63 | break; | 62 | break; |
| 64 | case HttpCode.PASSWORD_FAIL: | 63 | case HttpCode.PASSWORD_FAIL: |
| 65 | jsonObject = (JSONObject) msg.obj; | 64 | jsonObject = (JSONObject) msg.obj; |
| 66 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); | 65 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); |
| 67 | break; | 66 | break; |
| 68 | case HttpCode.AUTHCODE_SUCESS1: | 67 | case HttpCode.AUTHCODE_SUCESS1: |
| 69 | jsonObject = (JSONObject) msg.obj; | 68 | jsonObject = (JSONObject) msg.obj; |
| 70 | status = jsonObject.optString("status"); | 69 | status = jsonObject.optString("status"); |
| 71 | if (status.equals("100")) { | 70 | if (status.equals("100")) { |
| 72 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); | 71 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); |
| 73 | } | 72 | } |
| 74 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 73 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
| 75 | break; | 74 | break; |
| 76 | case HttpCode.AUTHCODE_FAIL1: | 75 | case HttpCode.AUTHCODE_FAIL1: |
| 77 | jsonObject = (JSONObject) msg.obj; | 76 | jsonObject = (JSONObject) msg.obj; |
| 78 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); | 77 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); |
| 79 | break; | 78 | break; |
| 80 | case HttpCode.IS_REFISTER: | 79 | case HttpCode.IS_REFISTER: |
| 81 | jsonObject = (JSONObject) msg.obj; | 80 | jsonObject = (JSONObject) msg.obj; |
| 82 | status = jsonObject.getString("status"); | 81 | status = jsonObject.getString("status"); |
| 83 | if (status.equals("true")) { | 82 | if (status.equals("true")) { |
| 84 | getauthcode(); | 83 | getauthcode(); |
| 85 | 84 | ||
| 86 | } else { | 85 | } else { |
| 87 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); | 86 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); |
| 88 | } | 87 | } |
| 89 | break; | 88 | break; |
| 90 | case 21: | 89 | case 21: |
| 91 | forot_pwd_getanthcode.setEnabled(false); | 90 | |
| 92 | forot_pwd_getanthcode.setClickable(false); | 91 | if(delayTime<=0){ |
| 93 | forot_pwd_getanthcode.setText(Integer.toString(i--) + " s"); | 92 | if(Delaytimer!=null){ |
| 94 | if (i <= 0) { | 93 | Delaytimer.cancel(); |
| 94 | } | ||
| 95 | forot_pwd_getanthcode.setEnabled(true); | 95 | forot_pwd_getanthcode.setEnabled(true); |
| 96 | forot_pwd_getanthcode.setClickable(true); | 96 | forot_pwd_getanthcode.setClickable(true); |
| 97 | forot_pwd_getanthcode.setText("获取验证码"); | 97 | forot_pwd_getanthcode.setText("获取验证码"); |
| 98 | 98 | delayTime=60; | |
| 99 | }else{ | ||
| 100 | forot_pwd_getanthcode.setEnabled(false); | ||
| 101 | forot_pwd_getanthcode.setClickable(false); | ||
| 102 | forot_pwd_getanthcode.setText(delayTime + " s"); | ||
| 99 | } | 103 | } |
| 100 | break; | 104 | break; |
| 101 | } | 105 | } |
| 102 | } catch (JSONException e) { | 106 | } catch (JSONException e) { |
| 103 | e.printStackTrace(); | 107 | e.printStackTrace(); |
| 104 | } | 108 | } |
| 105 | } | 109 | } |
| 106 | }; | 110 | }; |
| 107 | 111 | ||
| 108 | @Override | 112 | @Override |
| 109 | protected void onCreate(Bundle savedInstanceState) { | 113 | protected void onCreate(Bundle savedInstanceState) { |
| 110 | super.onCreate(savedInstanceState); | 114 | super.onCreate(savedInstanceState); |
| 111 | setContentView(R.layout.activity_forgetpsword); | 115 | setContentView(R.layout.activity_forgetpsword); |
| 112 | initView(); | 116 | initView(); |
| 113 | setLister(); | 117 | setLister(); |
| 114 | } | 118 | } |
| 115 | 119 | ||
| 116 | //获取验证码 | 120 | //获取验证码 |
| 117 | private void getauthcode() { | 121 | private void getauthcode() { |
| 118 | forot_pwd_anthcode.requestFocus(); | 122 | forot_pwd_anthcode.requestFocus(); |
| 119 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); | 123 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); |
| 120 | i = 60; | 124 | valiDelay(); |
| 121 | if (thread == null) { | ||
| 122 | thread = new Thread(new ThreadShow()); | ||
| 123 | thread.start(); | ||
| 124 | |||
| 125 | } | ||
| 126 | 125 | ||
| 127 | } | 126 | } |
| 128 | 127 | ||
| 129 | private void initView() { | 128 | private void initView() { |
| 130 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); | 129 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); |
| 131 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); | 130 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); |
| 132 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); | 131 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); |
| 133 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); | 132 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); |
| 134 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); | 133 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); |
| 135 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); | 134 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); |
| 136 | iv_pwd_change = (ImageView) findViewById(R.id.iv_pwd_change); | 135 | iv_pwd_change = (ImageView) findViewById(R.id.iv_pwd_change); |
| 137 | back_forgit = (ImageView) findViewById(R.id.cancel); | 136 | back_forgit = (ImageView) findViewById(R.id.cancel); |
| 138 | } | 137 | } |
| 139 | 138 | ||
| 140 | private void setLister() { | 139 | private void setLister() { |
| 141 | iv_pwd_change.setOnClickListener(this); | 140 | iv_pwd_change.setOnClickListener(this); |
| 142 | back_forgit.setOnClickListener(this); | 141 | back_forgit.setOnClickListener(this); |
| 143 | forot_pwd_sub.setOnClickListener(this); | 142 | forot_pwd_sub.setOnClickListener(this); |
| 144 | forot_pwd_getanthcode.setOnClickListener(this); | 143 | forot_pwd_getanthcode.setOnClickListener(this); |
| 145 | 144 | ||
| 146 | } | 145 | } |
| 147 | 146 | ||
| 148 | 147 | ||
| 149 | @Override | 148 | @Override |
| 150 | public void onClick(View view) { | 149 | public void onClick(View view) { |
| 151 | switch (view.getId()) { | 150 | switch (view.getId()) { |
| 152 | case R.id.btn_ok: | 151 | case R.id.btn_ok: |
| 153 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 152 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
| 154 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); | 153 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); |
| 155 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); | 154 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); |
| 156 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); | 155 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); |
| 157 | if (TextUtils.isEmpty(forot_pwd_phone1) || | 156 | if (TextUtils.isEmpty(forot_pwd_phone1) || |
| 158 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)) { | 157 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)) { |
| 159 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); | 158 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); |
| 160 | return; | 159 | return; |
| 161 | } else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)) { | 160 | } else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)) { |
| 162 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); | 161 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); |
| 163 | 162 | ||
| 164 | } else if (forot_pwd_pwd3.length() < 8 || forot_pwd_pwd4.length() < 8) { | 163 | } else if (forot_pwd_pwd3.length() < 8 || forot_pwd_pwd4.length() < 8) { |
| 165 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); | 164 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); |
| 166 | } else if (!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER) || !forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)) { | 165 | } else if (!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER) || !forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)) { |
| 167 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); | 166 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); |
| 168 | } else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)) { | 167 | } else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)) { |
| 169 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); | 168 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); |
| 170 | return; | 169 | return; |
| 171 | } else { | 170 | } else { |
| 172 | //忘记密码接口 | 171 | //忘记密码接口 |
| 173 | HttpManager.getInstance().forgetpassword(this, forot_pwd_phone1, forot_pwd_pwd3, forot_pwd_anthcode1, handler); | 172 | HttpManager.getInstance().forgetpassword(this, forot_pwd_phone1, forot_pwd_pwd3, forot_pwd_anthcode1, handler); |
| 174 | } | 173 | } |
| 175 | break; | 174 | break; |
| 176 | case R.id.btn_authcode: | 175 | case R.id.btn_authcode: |
| 177 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 176 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
| 178 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)) { | 177 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)) { |
| 179 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); | 178 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); |
| 180 | } else { | 179 | } else { |
| 181 | forot_pwd_anthcode.requestFocus(); | 180 | forot_pwd_anthcode.requestFocus(); |
| 182 | ifregister(); | 181 | ifregister(); |
| 183 | 182 | ||
| 184 | } | 183 | } |
| 185 | 184 | ||
| 186 | break; | 185 | break; |
| 187 | case R.id.iv_pwd_change: | 186 | case R.id.iv_pwd_change: |
| 188 | if (showPassword) {//显示密码 | 187 | if (showPassword) {//显示密码 |
| 189 | showPassword = !showPassword; | 188 | showPassword = !showPassword; |
| 190 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); | 189 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); |
| 191 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 190 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
| 192 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 191 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
| 193 | } else {//隐藏密码 | 192 | } else {//隐藏密码 |
| 194 | showPassword = !showPassword; | 193 | showPassword = !showPassword; |
| 195 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); | 194 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); |
| 196 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 195 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
| 197 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 196 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
| 198 | } | 197 | } |
| 199 | break; | 198 | break; |
| 200 | 199 | ||
| 201 | case R.id.cancel: | 200 | case R.id.cancel: |
| 202 | finish(); | 201 | finish(); |
| 203 | break; | 202 | break; |
| 204 | } | 203 | } |
| 205 | } | 204 | } |
| 206 | 205 | ||
| 207 | //是否注册 | 206 | //是否注册 |
| 208 | private void ifregister() { | 207 | private void ifregister() { |
| 209 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 208 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
| 210 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); | 209 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); |
| 211 | } | 210 | } |
| 212 | 211 | ||
| 213 | // 线程类 定时器 | 212 | // 线程类 定时器 |
| 214 | class ThreadShow implements Runnable { | 213 | public void valiDelay() { |
| 215 | 214 | ||
| 216 | @Override | 215 | Delaytimer = new java.util.Timer(true); |
| 217 | public void run() { | 216 | |
| 218 | // TODO Auto-generated method stub | 217 | |
| 219 | while (true) { | 218 | TimerTask task = new TimerTask() { |
| 220 | try { | 219 | public void run() { |
| 221 | Thread.sleep(1000); | 220 | //每次需要执行的代码放到这里面。 |
| 222 | // thread.interrupt(); | 221 | delayTime--; |
| 223 | Message msg = new Message(); | 222 | handler.sendEmptyMessage(21); |
| 224 | msg.what = 21; | ||
| 225 | handler.sendMessage(msg); | ||
| 226 | System.out.println("内存泄露..."); | ||
| 227 | } catch (Exception e) { | ||
| 228 | // TODO Auto-generated catch block | ||
| 229 | e.printStackTrace(); | ||
| 230 | System.out.println("thread error..."); | ||
| 231 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/LoginAndRegisterActivity.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.annotation.Nullable; | 5 | import android.support.annotation.Nullable; |
| 6 | import android.support.v4.app.Fragment; | 6 | import android.support.v4.app.Fragment; |
| 7 | import android.support.v4.view.ViewPager; | 7 | import android.support.v4.view.ViewPager; |
| 8 | import android.support.v7.app.AppCompatActivity; | 8 | import android.support.v7.app.AppCompatActivity; |
| 9 | 9 | ||
| 10 | import com.hjx.personalcenter.R; | 10 | import com.hjx.personalcenter.R; |
| 11 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; | 11 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; |
| 12 | import com.hjx.personalcenter.db.SaveParam; | 12 | import com.hjx.personalcenter.db.SaveParam; |
| 13 | import com.hjx.personalcenter.fragment.RegisterFragment; | 13 | import com.hjx.personalcenter.fragment.RegisterFragment; |
| 14 | import com.hjx.personalcenter.fragment.LoginFragment; | 14 | import com.hjx.personalcenter.fragment.LoginFragment; |
| 15 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; | 15 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; |
| 16 | 16 | ||
| 17 | import java.util.ArrayList; | 17 | import java.util.ArrayList; |
| 18 | import java.util.Arrays; | 18 | import java.util.Arrays; |
| 19 | import java.util.List; | 19 | import java.util.List; |
| 20 | 20 | ||
| 21 | /** | 21 | /** |
| 22 | * 登录和注册 熊巍 | 22 | * 登录和注册 熊巍 |
| 23 | * Created by h on 2017/8/8. | 23 | * Created by h on 2017/8/8. |
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | public class LoginAndRegisterActivity extends AppCompatActivity { | 26 | public class LoginAndRegisterActivity extends AppCompatActivity { |
| 27 | private ViewPager viewPager; | 27 | private ViewPager viewPager; |
| 28 | private SlidingTabLayout tableLayout; | 28 | private SlidingTabLayout tableLayout; |
| 29 | private List<Fragment> loginlist; | 29 | private List<Fragment> loginlist; |
| 30 | private LoginAndRegisterAdapter logindapter; | 30 | private LoginAndRegisterAdapter logindapter; |
| 31 | private List<String> title = Arrays.asList("登录", "注册"); | 31 | private List<String> title = Arrays.asList("登录", "注册"); |
| 32 | 32 | ||
| 33 | @Override | 33 | @Override |
| 34 | protected void onCreate(@Nullable Bundle savedInstanceState) { | 34 | protected void onCreate(@Nullable Bundle savedInstanceState) { |
| 35 | super.onCreate(savedInstanceState); | 35 | super.onCreate(savedInstanceState); |
| 36 | String islogin =SaveParam.getInstance().getLoginParam(this,"login"); | 36 | String islogin =SaveParam.getInstance().getLoginParam(this,"login"); |
| 37 | String type =SaveParam.getInstance().getCustomizeParam(LoginAndRegisterActivity.this,SaveParam.ACCOUNT); | ||
| 38 | if (type==null){ | ||
| 39 | SaveParam.getInstance().saveCustomizeParam(LoginAndRegisterActivity.this, SaveParam.ACCOUNT,"1"); | ||
| 40 | } | ||
| 37 | if ("true".equals(islogin)){ | 41 | if ("true".equals(islogin)){ |
| 38 | Intent intent = new Intent(); | 42 | Intent intent = new Intent(); |
| 39 | intent.setClass(this,MainActivity.class); | 43 | intent.setClass(this,MainActivity.class); |
| 40 | startActivity(intent); | 44 | startActivity(intent); |
| 41 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 45 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 42 | finish(); | 46 | finish(); |
| 43 | 47 | ||
| 44 | } | 48 | } |
| 45 | setContentView(R.layout.activity_loginandregister); | 49 | setContentView(R.layout.activity_loginandregister); |
| 46 | initView(); | 50 | initView(); |
| 47 | initData(); | 51 | initData(); |
| 48 | setLister(); | 52 | setLister(); |
| 49 | } | 53 | } |
| 50 | 54 | ||
| 51 | private void initView() { | 55 | private void initView() { |
| 52 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); | 56 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); |
| 53 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); | 57 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); |
| 54 | } | 58 | } |
| 55 | 59 | ||
| 56 | private void initData() { | 60 | private void initData() { |
| 57 | loginlist = new ArrayList<>(); | 61 | loginlist = new ArrayList<>(); |
| 58 | for (int i = 0; i < title.size(); i++) { | 62 | for (int i = 0; i < title.size(); i++) { |
| 59 | if (title.get(i).equals("登录")) { | 63 | if (title.get(i).equals("登录")) { |
| 60 | loginlist.add(LoginFragment.newInstance(i + 1)); | 64 | loginlist.add(LoginFragment.newInstance(i + 1)); |
| 61 | } else { | 65 | } else { |
| 62 | loginlist.add(RegisterFragment.newInstance(i + 1)); | 66 | loginlist.add(RegisterFragment.newInstance(i + 1)); |
| 63 | } | 67 | } |
| 64 | } | 68 | } |
| 65 | 69 | ||
| 66 | 70 | ||
| 67 | //设置Tab上的标题 | 71 | //设置Tab上的标题 |
| 68 | tableLayout.setData(title); | 72 | tableLayout.setData(title); |
| 69 | //设置关联的ViewPager | 73 | //设置关联的ViewPager |
| 70 | tableLayout.setViewPager(viewPager, 0); | 74 | tableLayout.setViewPager(viewPager, 0); |
| 71 | logindapter = new LoginAndRegisterAdapter(loginlist, getSupportFragmentManager()); | 75 | logindapter = new LoginAndRegisterAdapter(loginlist, getSupportFragmentManager()); |
| 72 | //给ViewPager设置适配器 | 76 | //给ViewPager设置适配器 |
| 73 | viewPager.setAdapter(logindapter); | 77 | viewPager.setAdapter(logindapter); |
| 74 | //设置滑动时数据不丢失 | 78 | //设置滑动时数据不丢失 |
| 75 | viewPager.setOffscreenPageLimit(1); | 79 | viewPager.setOffscreenPageLimit(1); |
| 76 | //将TabLayout和ViewPager关联起来。 | 80 | //将TabLayout和ViewPager关联起来。 |
| 77 | } | 81 | } |
| 78 | 82 | ||
| 79 | private void setLister() { | 83 | private void setLister() { |
| 84 | |||
| 80 | } | 85 | } |
| 81 | 86 | ||
| 82 | 87 | ||
| 83 | } | 88 | } |
| 84 | 89 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
| 6 | import android.net.Uri; | 6 | import android.net.Uri; |
| 7 | import android.os.Build; | 7 | import android.os.Build; |
| 8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
| 9 | import android.os.Handler; | 9 | import android.os.Handler; |
| 10 | import android.os.Message; | 10 | import android.os.Message; |
| 11 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
| 12 | import android.support.annotation.NonNull; | 12 | import android.support.annotation.NonNull; |
| 13 | import android.support.v4.content.FileProvider; | 13 | import android.support.v4.content.FileProvider; |
| 14 | import android.support.v7.app.AppCompatActivity; | 14 | import android.support.v7.app.AppCompatActivity; |
| 15 | import android.support.v7.widget.LinearLayoutManager; | 15 | import android.support.v7.widget.LinearLayoutManager; |
| 16 | import android.support.v7.widget.RecyclerView; | 16 | import android.support.v7.widget.RecyclerView; |
| 17 | import android.view.KeyEvent; | 17 | import android.view.KeyEvent; |
| 18 | import android.view.View; | 18 | import android.view.View; |
| 19 | import android.widget.ImageView; | 19 | import android.widget.ImageView; |
| 20 | import android.widget.LinearLayout; | 20 | import android.widget.LinearLayout; |
| 21 | import android.widget.TextView; | 21 | import android.widget.TextView; |
| 22 | import android.widget.Toast; | 22 | import android.widget.Toast; |
| 23 | 23 | ||
| 24 | import com.facebook.drawee.backends.pipeline.Fresco; | 24 | import com.facebook.drawee.backends.pipeline.Fresco; |
| 25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
| 26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
| 27 | import com.facebook.drawee.generic.RoundingParams; | 27 | import com.facebook.drawee.generic.RoundingParams; |
| 28 | import com.facebook.drawee.interfaces.DraweeController; | 28 | import com.facebook.drawee.interfaces.DraweeController; |
| 29 | import com.facebook.drawee.view.SimpleDraweeView; | 29 | import com.facebook.drawee.view.SimpleDraweeView; |
| 30 | import com.hjx.personalcenter.R; | 30 | import com.hjx.personalcenter.R; |
| 31 | import com.hjx.personalcenter.adapter.GalleryAdapter; | 31 | import com.hjx.personalcenter.adapter.GalleryAdapter; |
| 32 | import com.hjx.personalcenter.customdialog.HeadDialog; | 32 | import com.hjx.personalcenter.customdialog.HeadDialog; |
| 33 | import com.hjx.personalcenter.db.SaveParam; | 33 | import com.hjx.personalcenter.db.SaveParam; |
| 34 | import com.hjx.personalcenter.http.HttpCode; | 34 | import com.hjx.personalcenter.http.HttpCode; |
| 35 | import com.hjx.personalcenter.http.HttpManager; | 35 | import com.hjx.personalcenter.http.HttpManager; |
| 36 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 36 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 37 | import com.hjx.personalcenter.model.PesonalInfo; | 37 | import com.hjx.personalcenter.model.PesonalInfo; |
| 38 | import com.hjx.personalcenter.model.SignInfo; | 38 | import com.hjx.personalcenter.model.SignInfo; |
| 39 | import com.hjx.personalcenter.update.UpdateChecker; | 39 | import com.hjx.personalcenter.update.UpdateChecker; |
| 40 | import com.hjx.personalcenter.util.AlertUtils; | 40 | import com.hjx.personalcenter.util.AlertUtils; |
| 41 | import com.hjx.personalcenter.util.CropUtils; | 41 | import com.hjx.personalcenter.util.CropUtils; |
| 42 | import com.hjx.personalcenter.util.DialogPermission; | 42 | import com.hjx.personalcenter.util.DialogPermission; |
| 43 | import com.hjx.personalcenter.util.FileUtil; | 43 | import com.hjx.personalcenter.util.FileUtil; |
| 44 | import com.hjx.personalcenter.util.PermissionUtil; | 44 | import com.hjx.personalcenter.util.PermissionUtil; |
| 45 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 45 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
| 46 | import com.mylhyl.circledialog.CircleDialog; | 46 | import com.mylhyl.circledialog.CircleDialog; |
| 47 | import com.mylhyl.circledialog.callback.ConfigInput; | 47 | import com.mylhyl.circledialog.callback.ConfigInput; |
| 48 | import com.mylhyl.circledialog.params.InputParams; | 48 | import com.mylhyl.circledialog.params.InputParams; |
| 49 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 49 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
| 50 | import com.zaaach.toprightmenu.MenuItem; | 50 | import com.zaaach.toprightmenu.MenuItem; |
| 51 | import com.zaaach.toprightmenu.TopRightMenu; | 51 | import com.zaaach.toprightmenu.TopRightMenu; |
| 52 | 52 | ||
| 53 | import java.io.File; | 53 | import java.io.File; |
| 54 | import java.io.UnsupportedEncodingException; | ||
| 54 | import java.util.ArrayList; | 55 | import java.util.ArrayList; |
| 55 | import java.util.Arrays; | 56 | import java.util.Arrays; |
| 56 | import java.util.List; | 57 | import java.util.List; |
| 57 | 58 | ||
| 58 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 59 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
| 59 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; | 60 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; |
| 60 | private TextView tv_edit_presoninfo, tv_sign, | 61 | private TextView tv_edit_presoninfo, tv_sign, |
| 61 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 62 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
| 62 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; | 63 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; |
| 63 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; | 64 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; |
| 64 | private TopRightMenu mTopRightMenu; | 65 | private TopRightMenu mTopRightMenu; |
| 65 | //水平滑动 | 66 | //水平滑动 |
| 66 | private RecyclerView mRecyclerView; | 67 | private RecyclerView mRecyclerView; |
| 67 | private GalleryAdapter RecyclerViewadapter; | 68 | private GalleryAdapter RecyclerViewadapter; |
| 68 | private List<Integer> mDatas = new ArrayList<Integer>(Arrays.asList(R.mipmap.default_avatar2, | 69 | private List<Integer> mDatas = new ArrayList<Integer>(Arrays.asList(R.mipmap.default_avatar2, |
| 69 | R.mipmap.default_avatar2, R.mipmap.default_avatar2, R.mipmap.default_avatar2)); | 70 | R.mipmap.default_avatar2, R.mipmap.default_avatar2, R.mipmap.default_avatar2)); |
| 70 | private boolean showIcon = true; | 71 | private boolean showIcon = true; |
| 71 | private boolean dimBg = true; | 72 | private boolean dimBg = true; |
| 72 | private boolean needAnim = true; | 73 | private boolean needAnim = true; |
| 73 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 74 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
| 74 | private static final int REQUEST_CODE_ALBUM = 2; | 75 | private static final int REQUEST_CODE_ALBUM = 2; |
| 75 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 76 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
| 76 | SimpleDraweeView mSimpleDraweeView; | 77 | SimpleDraweeView mSimpleDraweeView; |
| 77 | private File file; | 78 | private File file; |
| 78 | private Uri uri; | 79 | private Uri uri; |
| 79 | Handler handler = new Handler(){ | 80 | Handler handler = new Handler(){ |
| 80 | @Override | 81 | @Override |
| 81 | public void handleMessage(Message msg) { | 82 | public void handleMessage(Message msg) { |
| 82 | super.handleMessage(msg); | 83 | super.handleMessage(msg); |
| 83 | switch (msg.what){ | 84 | switch (msg.what){ |
| 84 | case HttpCode.GETINFO: | 85 | case HttpCode.GETINFO: |
| 85 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; | 86 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; |
| 86 | tv_username.setText(cardinfoBean.getNickName()); | 87 | tv_username.setText(cardinfoBean.getNickName()); |
| 87 | tv_username1.setText(cardinfoBean.getNickName()); | 88 | tv_username1.setText(cardinfoBean.getNickName()); |
| 88 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 89 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
| 89 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 90 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
| 90 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 91 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
| 91 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 92 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
| 92 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 93 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
| 93 | String sex = cardinfoBean.getGender(); | 94 | String sex = cardinfoBean.getGender(); |
| 94 | if ("0".equals(sex)){ | 95 | if ("0".equals(sex)){ |
| 95 | tv_sex.setText("男"); | 96 | tv_sex.setText("男"); |
| 96 | iv_sex.setImageResource(R.mipmap.men); | 97 | iv_sex.setImageResource(R.mipmap.men); |
| 97 | }else { | 98 | }else { |
| 98 | tv_sex.setText("女"); | 99 | tv_sex.setText("女"); |
| 99 | iv_sex.setImageResource(R.mipmap.women); | 100 | iv_sex.setImageResource(R.mipmap.women); |
| 100 | } | 101 | } |
| 102 | String imageurl = SaveParam.getInstance().getLoginParam(MainActivity.this,SaveParam.HEADURL); | ||
| 103 | mSimpleDraweeView.setImageURI(imageurl); | ||
| 101 | break; | 104 | break; |
| 102 | case HttpCode.SIGN: | 105 | case HttpCode.SIGN: |
| 103 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; | 106 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; |
| 104 | if (dataBean.getSignature()==null){ | 107 | if (dataBean.getSignature()==null){ |
| 105 | tv_sign.setText("你还未设置个性签名"); | 108 | tv_sign.setText("你还未设置个性签名"); |
| 106 | }else { | 109 | }else { |
| 107 | tv_sign.setText(dataBean.getSignature()); | 110 | tv_sign.setText(dataBean.getSignature()); |
| 108 | } | 111 | } |
| 109 | 112 | ||
| 110 | break; | 113 | break; |
| 111 | } | 114 | } |
| 112 | } | 115 | } |
| 113 | }; | 116 | }; |
| 114 | 117 | ||
| 115 | @Override | 118 | @Override |
| 116 | protected void onCreate(Bundle savedInstanceState) { | 119 | protected void onCreate(Bundle savedInstanceState) { |
| 117 | super.onCreate(savedInstanceState); | 120 | super.onCreate(savedInstanceState); |
| 118 | Fresco.initialize(this); | 121 | Fresco.initialize(this); |
| 119 | setContentView(R.layout.activity_main); | 122 | setContentView(R.layout.activity_main); |
| 120 | initView(); | 123 | initView(); |
| 121 | initData(); | 124 | initData(); |
| 122 | initLister(); | 125 | initLister(); |
| 123 | updateVersion(); | 126 | updateVersion(); |
| 124 | } | 127 | } |
| 125 | //////版本更新 | 128 | //////版本更新 |
| 126 | private void updateVersion() { | 129 | private void updateVersion() { |
| 127 | UpdateChecker updateChecker = new UpdateChecker(this); | 130 | UpdateChecker updateChecker = new UpdateChecker(this); |
| 128 | updateChecker.checkForUpdates(); | 131 | updateChecker.checkForUpdates(); |
| 129 | 132 | ||
| 130 | 133 | ||
| 131 | } | 134 | } |
| 132 | 135 | ||
| 133 | private void initView() { | 136 | private void initView() { |
| 134 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 137 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
| 135 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); | 138 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); |
| 136 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); | 139 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); |
| 137 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 140 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
| 138 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 141 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
| 139 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 142 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
| 140 | //头像 | 143 | //头像 |
| 141 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 144 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
| 142 | //初始化个人信息 | 145 | //初始化个人信息 |
| 143 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 146 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
| 144 | tv_username = (TextView) findViewById(R.id.tv_username); | 147 | tv_username = (TextView) findViewById(R.id.tv_username); |
| 145 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 148 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
| 146 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 149 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
| 147 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 150 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
| 148 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 151 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
| 149 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 152 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
| 150 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 153 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
| 151 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 154 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
| 152 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 155 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
| 153 | //跳转其他应用 | 156 | //跳转其他应用 |
| 154 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); | 157 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); |
| 155 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); | 158 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); |
| 156 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); | 159 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); |
| 157 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); | 160 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); |
| 158 | // | 161 | // |
| 159 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 162 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
| 160 | 163 | ||
| 161 | } | 164 | } |
| 162 | 165 | ||
| 163 | 166 | ||
| 164 | private void initData() { | 167 | private void initData() { |
| 165 | //加载最近学习视频 | 168 | //加载最近学习视频 |
| 166 | 169 | ||
| 167 | 170 | ||
| 168 | //设置布局管理器 | 171 | //设置布局管理器 |
| 169 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 172 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
| 170 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 173 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
| 171 | mRecyclerView.setLayoutManager(linearLayoutManager); | 174 | mRecyclerView.setLayoutManager(linearLayoutManager); |
| 172 | //设置适配器 | 175 | //设置适配器 |
| 173 | RecyclerViewadapter = new GalleryAdapter(this, mDatas); | 176 | RecyclerViewadapter = new GalleryAdapter(this, mDatas); |
| 174 | mRecyclerView.setAdapter(RecyclerViewadapter); | 177 | mRecyclerView.setAdapter(RecyclerViewadapter); |
| 175 | 178 | ||
| 176 | //加载个人信息 | 179 | //加载个人信息 |
| 177 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); | 180 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); |
| 178 | if (xiongzuo==null){ | 181 | if (xiongzuo==null){ |
| 179 | tv_mygad.setText(""); | 182 | tv_mygad.setText(""); |
| 180 | }else { | 183 | }else { |
| 181 | tv_mygad.setText(xiongzuo); | 184 | tv_mygad.setText(xiongzuo); |
| 182 | } | 185 | } |
| 183 | //加载版本信息 | 186 | //加载版本信息 |
| 184 | 187 | ||
| 185 | 188 | ||
| 186 | //获取个性签名 | 189 | //获取个性签名 |
| 187 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 190 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
| 188 | String typeaccount = SaveParam.getInstance().getLoginParam(this,SaveParam.ACCOUNT); | 191 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
| 189 | try { | 192 | try { |
| 190 | long auserID = Long.parseLong(userID); | 193 | long auserID = Long.parseLong(userID); |
| 191 | int typeaccount1=Integer.parseInt(typeaccount); | 194 | int typeaccount1=Integer.parseInt(typeaccount); |
| 192 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,typeaccount1,handler); | 195 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,typeaccount1,handler); |
| 193 | 196 | ||
| 194 | } catch (NumberFormatException e) { | 197 | } catch (NumberFormatException e) { |
| 195 | e.printStackTrace(); | 198 | e.printStackTrace(); |
| 196 | } | 199 | } |
| 197 | 200 | ||
| 198 | 201 | ||
| 199 | 202 | ||
| 200 | //初始化图片 | 203 | //初始化图片 |
| 201 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 204 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
| 202 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 205 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 203 | uri = Uri.fromFile(file); | 206 | uri = Uri.fromFile(file); |
| 204 | } else { | 207 | } else { |
| 205 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 208 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
| 206 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 209 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
| 207 | } | 210 | } |
| 208 | 211 | ||
| 209 | } | 212 | } |
| 210 | 213 | ||
| 211 | private void initLister() { | 214 | private void initLister() { |
| 212 | iv_imformatioan.setOnClickListener(this); | 215 | iv_imformatioan.setOnClickListener(this); |
| 213 | iv_look_card.setOnClickListener(this); | 216 | iv_look_card.setOnClickListener(this); |
| 214 | tv_edit_presoninfo.setOnClickListener(this); | 217 | tv_edit_presoninfo.setOnClickListener(this); |
| 215 | iv_setting.setOnClickListener(this); | 218 | iv_setting.setOnClickListener(this); |
| 216 | iv_sign.setOnClickListener(this); | 219 | iv_sign.setOnClickListener(this); |
| 217 | mSimpleDraweeView.setOnClickListener(this); | 220 | mSimpleDraweeView.setOnClickListener(this); |
| 218 | linel_mycuoti.setOnClickListener(this); | 221 | linel_mycuoti.setOnClickListener(this); |
| 219 | linel_mynote.setOnClickListener(this); | 222 | linel_mynote.setOnClickListener(this); |
| 220 | linel_mycollege.setOnClickListener(this); | 223 | linel_mycollege.setOnClickListener(this); |
| 221 | linel_myclass.setOnClickListener(this); | 224 | linel_myclass.setOnClickListener(this); |
| 222 | 225 | ||
| 223 | } | 226 | } |
| 224 | 227 | ||
| 225 | @Override | 228 | @Override |
| 226 | public void onClick(View v) { | 229 | public void onClick(View v) { |
| 227 | switch (v.getId()) { | 230 | switch (v.getId()) { |
| 228 | case R.id.iv_imformatioan: | 231 | case R.id.iv_imformatioan: |
| 229 | Intent intent = new Intent(); | 232 | Intent intent = new Intent(); |
| 230 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 233 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
| 231 | startActivity(intent); | 234 | startActivity(intent); |
| 232 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 235 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 233 | break; | 236 | break; |
| 234 | case R.id.iv_look_card: | 237 | case R.id.iv_look_card: |
| 235 | Intent lookintent = new Intent(); | 238 | Intent lookintent = new Intent(); |
| 236 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 239 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
| 237 | startActivity(lookintent); | 240 | startActivity(lookintent); |
| 238 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 241 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 239 | break; | 242 | break; |
| 240 | case R.id.tv_edit_presoninfo: | 243 | case R.id.tv_edit_presoninfo: |
| 241 | Intent editintent = new Intent(); | 244 | Intent editintent = new Intent(); |
| 242 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 245 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
| 243 | startActivity(editintent); | 246 | startActivity(editintent); |
| 244 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 247 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 245 | break; | 248 | break; |
| 246 | case R.id.iv_head: | 249 | case R.id.iv_head: |
| 247 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 250 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
| 248 | break; | 251 | break; |
| 249 | case R.id.iv_setting: | 252 | case R.id.iv_setting: |
| 250 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 253 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
| 251 | List<MenuItem> menuItems = new ArrayList<>(); | 254 | List<MenuItem> menuItems = new ArrayList<>(); |
| 252 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 255 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); |
| 253 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 256 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); |
| 254 | mTopRightMenu | 257 | mTopRightMenu |
| 255 | .setHeight(150) //默认高度480 | 258 | .setHeight(150) //默认高度480 |
| 256 | .setWidth(320) //默认宽度wrap_content | 259 | .setWidth(320) //默认宽度wrap_content |
| 257 | .showIcon(showIcon) //显示菜单图标,默认为true | 260 | .showIcon(showIcon) //显示菜单图标,默认为true |
| 258 | .dimBackground(dimBg) //背景变暗,默认为true | 261 | .dimBackground(dimBg) //背景变暗,默认为true |
| 259 | .needAnimationStyle(needAnim) //显示动画,默认为true | 262 | .needAnimationStyle(needAnim) //显示动画,默认为true |
| 260 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 263 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
| 261 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 264 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
| 262 | @Override | 265 | @Override |
| 263 | public void onMenuItemClick(int position) { | 266 | public void onMenuItemClick(int position) { |
| 264 | switch (position) { | 267 | switch (position) { |
| 265 | case 0: | 268 | case 0: |
| 266 | //清除数据 | 269 | //清除数据 |
| 267 | SaveParam.getInstance().clearData(MainActivity.this); | 270 | SaveParam.getInstance().clearData(MainActivity.this); |
| 268 | Intent settingintent = new Intent(); | 271 | Intent settingintent = new Intent(); |
| 269 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 272 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 270 | startActivity(settingintent); | 273 | startActivity(settingintent); |
| 271 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 274 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 272 | finish(); | 275 | finish(); |
| 273 | break; | 276 | break; |
| 274 | case 1: | 277 | case 1: |
| 275 | Intent accontMintent = new Intent(); | 278 | Intent accontMintent = new Intent(); |
| 276 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 279 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
| 277 | startActivity(accontMintent); | 280 | startActivity(accontMintent); |
| 278 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 281 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 279 | break; | 282 | break; |
| 280 | } | 283 | } |
| 281 | } | 284 | } |
| 282 | }) | 285 | }) |
| 283 | .addMenuList(menuItems) | 286 | .addMenuList(menuItems) |
| 284 | .showAsDropDown(iv_setting, -250, 0); | 287 | .showAsDropDown(iv_setting, -250, 0); |
| 285 | break; | 288 | break; |
| 286 | case R.id.iv_sign: | 289 | case R.id.iv_sign: |
| 287 | new CircleDialog.Builder(this) | 290 | new CircleDialog.Builder(this) |
| 288 | .setCanceledOnTouchOutside(false) | 291 | .setCanceledOnTouchOutside(false) |
| 289 | .setCancelable(true) | 292 | .setCancelable(true) |
| 290 | .setTitle("个性签名") | 293 | .setTitle("个性签名") |
| 291 | .setInputHint("请输入个性签名") | 294 | .setInputHint("请输入个性签名") |
| 292 | .setWidth(0.5f) | 295 | .setWidth(0.5f) |
| 293 | .configInput(new ConfigInput() { | 296 | .configInput(new ConfigInput() { |
| 294 | @Override | 297 | @Override |
| 295 | public void onConfig(InputParams params) { | 298 | public void onConfig(InputParams params) { |
| 296 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 299 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
| 297 | } | 300 | } |
| 298 | }) | 301 | }) |
| 299 | .setNegative("取消", null) | 302 | .setNegative("取消", null) |
| 300 | .setPositiveInput("确定", new OnInputClickListener() { | 303 | .setPositiveInput("确定", new OnInputClickListener() { |
| 301 | @Override | 304 | @Override |
| 302 | public void onClick(String text, View v) { | 305 | public void onClick(String text, View v) { |
| 303 | if (text.equals("")) { | 306 | if (text.equals("")) { |
| 304 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 307 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
| 305 | } else { | 308 | } else { |
| 306 | try { | 309 | try { |
| 307 | String typeaccount = SaveParam.getInstance().getLoginParam(MainActivity.this,SaveParam.ACCOUNT); | 310 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this,SaveParam.ACCOUNT); |
| 308 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); | 311 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); |
| 309 | long auserID = Long.parseLong(userID); | 312 | long auserID = Long.parseLong(userID); |
| 310 | int typeaccount1=Integer.parseInt(typeaccount); | 313 | int typeaccount1=Integer.parseInt(typeaccount); |
| 311 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,typeaccount1,text); | 314 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,typeaccount1,text); |
| 312 | } catch (NumberFormatException e) { | 315 | } catch (NumberFormatException e) { |
| 313 | e.printStackTrace(); | 316 | e.printStackTrace(); |
| 314 | } | 317 | } |
| 315 | 318 | ||
| 316 | tv_sign.setText(text); | 319 | tv_sign.setText(text); |
| 317 | } | 320 | } |
| 318 | 321 | ||
| 319 | } | 322 | } |
| 320 | }) | 323 | }) |
| 321 | .show(); | 324 | .show(); |
| 322 | break; | 325 | break; |
| 323 | case R.id.linel_mycuoti: | 326 | case R.id.linel_mycuoti: |
| 324 | AlertUtils.showToast(this, "hhahahah "); | 327 | AlertUtils.showToast(this, "hhahahah "); |
| 325 | break; | 328 | break; |
| 326 | case R.id.linel_mynote: | 329 | case R.id.linel_mynote: |
| 327 | AlertUtils.showToast(this, "hhahahah "); | 330 | AlertUtils.showToast(this, "hhahahah "); |
| 328 | break; | 331 | break; |
| 329 | case R.id.linel_mycollege: | 332 | case R.id.linel_mycollege: |
| 330 | AlertUtils.showToast(this, "hhahahah "); | 333 | AlertUtils.showToast(this, "hhahahah "); |
| 331 | break; | 334 | break; |
| 332 | case R.id.linel_myclass: | 335 | case R.id.linel_myclass: |
| 333 | AlertUtils.showToast(this, "hhahahah "); | 336 | AlertUtils.showToast(this, "hhahahah "); |
| 334 | break; | 337 | break; |
| 335 | } | 338 | } |
| 336 | 339 | ||
| 337 | } | 340 | } |
| 338 | 341 | ||
| 339 | @Override | 342 | @Override |
| 340 | protected void onResume() { | 343 | protected void onResume() { |
| 341 | super.onResume(); | 344 | super.onResume(); |
| 342 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 345 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
| 343 | String typeaccount = SaveParam.getInstance().getLoginParam(this,SaveParam.ACCOUNT); | 346 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
| 344 | try { | 347 | try { |
| 345 | long auserID = Long.parseLong(userID); | 348 | long auserID = Long.parseLong(userID); |
| 346 | int typeaccount1=Integer.parseInt(typeaccount); | 349 | int typeaccount1=Integer.parseInt(typeaccount); |
| 347 | //获取个人信息 | 350 | //获取个人信息 |
| 348 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,typeaccount1,handler); | 351 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,typeaccount1,handler); |
| 349 | 352 | ||
| 350 | } catch (NumberFormatException e) { | 353 | } catch (NumberFormatException e) { |
| 351 | e.printStackTrace(); | 354 | e.printStackTrace(); |
| 352 | } | 355 | } |
| 353 | 356 | ||
| 354 | } | 357 | } |
| 355 | 358 | ||
| 356 | //回调头像监听 | 359 | //回调头像监听 |
| 357 | @Override | 360 | @Override |
| 358 | public void heard(Context context, View v,int headpitiaon) { | 361 | public void heard(Context context, View v,int headpitiaon) { |
| 359 | String picUrl; | 362 | String picUrl; |
| 360 | switch (v.getId()){ | 363 | switch (v.getId()){ |
| 361 | //选择默认图片 | 364 | //选择默认图片 |
| 362 | case R.id.oktakephone: | 365 | case R.id.oktakephone: |
| 363 | if (headpitiaon==1){ | 366 | if (headpitiaon==1){ |
| 364 | mSimpleDraweeView.setImageDrawable(null); | 367 | mSimpleDraweeView.setImageDrawable(null); |
| 365 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 368 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
| 366 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; | 369 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; |
| 367 | }else if (headpitiaon==2){ | 370 | }else if (headpitiaon==2){ |
| 368 | mSimpleDraweeView.setImageDrawable(null); | 371 | mSimpleDraweeView.setImageDrawable(null); |
| 369 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 372 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
| 370 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; | 373 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; |
| 371 | }else if (headpitiaon==3){ | 374 | }else if (headpitiaon==3){ |
| 372 | mSimpleDraweeView.setImageDrawable(null); | 375 | mSimpleDraweeView.setImageDrawable(null); |
| 373 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 376 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
| 374 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; | 377 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; |
| 375 | }else if (headpitiaon==4){ | 378 | }else if (headpitiaon==4){ |
| 376 | mSimpleDraweeView.setImageDrawable(null); | 379 | mSimpleDraweeView.setImageDrawable(null); |
| 377 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 380 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
| 378 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png "; | 381 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png "; |
| 379 | }else if (headpitiaon==0){ | 382 | }else if (headpitiaon==0){ |
| 380 | AlertUtils.showToast(this, "你还没有设置头像 "); | 383 | AlertUtils.showToast(this, "你还没有设置头像 "); |
| 381 | } | 384 | } |
| 382 | break; | 385 | break; |
| 383 | case R.id.canceltakephone: | 386 | case R.id.canceltakephone: |
| 384 | 387 | ||
| 385 | break; | 388 | break; |
| 386 | //拍摄和相册 | 389 | //拍摄和相册 |
| 387 | case R.id.take_pic: | 390 | case R.id.take_pic: |
| 388 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 391 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
| 389 | uploadAvatarFromPhotoRequest(); | 392 | uploadAvatarFromPhotoRequest(); |
| 390 | } | 393 | } |
| 391 | 394 | ||
| 392 | break; | 395 | break; |
| 393 | case R.id.xiangce: | 396 | case R.id.xiangce: |
| 394 | uploadAvatarFromAlbumRequest(); | 397 | uploadAvatarFromAlbumRequest(); |
| 395 | break; | 398 | break; |
| 396 | 399 | ||
| 397 | } | 400 | } |
| 398 | 401 | ||
| 399 | } | 402 | } |
| 400 | 403 | ||
| 401 | //照相 | 404 | //照相 |
| 402 | private void uploadAvatarFromPhotoRequest() { | 405 | private void uploadAvatarFromPhotoRequest() { |
| 403 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 406 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
| 404 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 407 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 405 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 408 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
| 406 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 409 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
| 407 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 410 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
| 408 | } | 411 | } |
| 409 | 412 | ||
| 410 | //选择图库 | 413 | //选择图库 |
| 411 | private void uploadAvatarFromAlbumRequest() { | 414 | private void uploadAvatarFromAlbumRequest() { |
| 412 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 415 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
| 413 | photoPickerIntent.setType("image/*"); | 416 | photoPickerIntent.setType("image/*"); |
| 414 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 417 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
| 415 | } | 418 | } |
| 416 | //回掉 | 419 | //回掉 |
| 417 | @Override | 420 | @Override |
| 418 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 421 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 419 | super.onActivityResult(requestCode, resultCode, data); | 422 | super.onActivityResult(requestCode, resultCode, data); |
| 420 | if (resultCode != -1) { | 423 | if (resultCode != -1) { |
| 421 | return; | 424 | return; |
| 422 | } | 425 | } |
| 423 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 426 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
| 424 | Uri newUri; | 427 | Uri newUri; |
| 425 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 428 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 426 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 429 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
| 427 | } else { | 430 | } else { |
| 428 | newUri = data.getData(); | 431 | newUri = data.getData(); |
| 429 | } | 432 | } |
| 430 | if (newUri != null) { | 433 | if (newUri != null) { |
| 431 | startPhotoZoom(newUri); | 434 | startPhotoZoom(newUri); |
| 432 | } else { | 435 | } else { |
| 433 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 436 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
| 434 | } | 437 | } |
| 435 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 438 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
| 436 | startPhotoZoom(uri); | 439 | startPhotoZoom(uri); |
| 437 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 440 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
| 438 | uploadAvatarFromPhoto(); | 441 | uploadAvatarFromPhoto(); |
| 439 | } | 442 | } |
| 440 | } | 443 | } |
| 441 | 444 | ||
| 442 | private void uploadAvatarFromPhoto() { | 445 | private void uploadAvatarFromPhoto() { |
| 443 | compressAndUploadAvatar(file.getPath()); | 446 | compressAndUploadAvatar(file.getPath()); |
| 444 | 447 | ||
| 445 | } | 448 | } |
| 446 | private void compressAndUploadAvatar(String fileSrc) { | 449 | private void compressAndUploadAvatar(String fileSrc) { |
| 447 | 450 | ||
| 448 | 451 | ||
| 449 | //上传到服务器 | 452 | //上传到服务器 |
| 450 | 453 | ||
| 451 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 454 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
| 452 | String mimeType = "image/*"; | 455 | String mimeType = "image/*"; |
| 453 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 456 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
| 454 | //String fileName = cover.getName(); | 457 | //String fileName = cover.getName(); |
| 455 | //HttpManager.getInstance().header(this, fileSrc); | 458 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
| 459 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | ||
| 460 | |||
| 461 | //上传头像 | ||
| 462 | |||
| 463 | try { | ||
| 464 | HttpManager.getInstance().header(this, userID,typeaccount,file.getPath()); | ||
| 465 | } catch (UnsupportedEncodingException e) { | ||
| 466 | e.printStackTrace(); | ||
| 467 | } | ||
| 468 | |||
| 456 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 469 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
| 457 | //Fresco设置圆形头像 | 470 | //Fresco设置圆形头像 |
| 458 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 471 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
| 459 | GenericDraweeHierarchy hierarchy = builder | 472 | GenericDraweeHierarchy hierarchy = builder |
| 460 | .setDesiredAspectRatio(1f) | 473 | .setDesiredAspectRatio(1f) |
| 461 | .setFailureImage(R.mipmap.blank) | 474 | .setFailureImage(R.mipmap.blank) |
| 462 | //圆形头像 | 475 | //圆形头像 |
| 463 | .setRoundingParams(RoundingParams.asCircle()) | 476 | .setRoundingParams(RoundingParams.asCircle()) |
| 464 | .build(); | 477 | .build(); |
| 465 | 478 | ||
| 466 | //加载本地图片 | 479 | //加载本地图片 |
| 467 | Uri uri = Uri.fromFile(cover); | 480 | Uri uri = Uri.fromFile(cover); |
| 468 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 481 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
| 469 | .setOldController(mSimpleDraweeView.getController()) | 482 | .setOldController(mSimpleDraweeView.getController()) |
| 470 | .setUri(uri) | 483 | .setUri(uri) |
| 471 | .build(); | 484 | .build(); |
| 472 | mSimpleDraweeView.setHierarchy(hierarchy); | 485 | mSimpleDraweeView.setHierarchy(hierarchy); |
| 473 | mSimpleDraweeView.setController(controller); | 486 | mSimpleDraweeView.setController(controller); |
| 474 | 487 | ||
| 475 | } | 488 | } |
| 476 | 489 | ||
| 477 | public void startPhotoZoom(Uri uri) { | 490 | public void startPhotoZoom(Uri uri) { |
| 478 | Intent intent = new Intent("com.android.camera.action.CROP"); | 491 | Intent intent = new Intent("com.android.camera.action.CROP"); |
| 479 | intent.setDataAndType(uri, "image/*"); | 492 | intent.setDataAndType(uri, "image/*"); |
| 480 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 493 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 481 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 494 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
| 482 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 495 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
| 483 | intent.putExtra("aspectY", 1);// x:y=1:1 | 496 | intent.putExtra("aspectY", 1);// x:y=1:1 |
| 484 | // intent.putExtra("outputX", 400);//图片输出大小 | 497 | // intent.putExtra("outputX", 400);//图片输出大小 |
| 485 | // intent.putExtra("outputY", 400); | 498 | // intent.putExtra("outputY", 400); |
| 486 | intent.putExtra("output", Uri.fromFile(file)); | 499 | intent.putExtra("output", Uri.fromFile(file)); |
| 487 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 500 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
| 488 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 501 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
| 489 | } | 502 | } |
| 490 | 503 | ||
| 491 | @Override | 504 | @Override |
| 492 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 505 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
| 493 | switch (requestCode) { | 506 | switch (requestCode) { |
| 494 | 507 | ||
| 495 | case PermissionUtil.REQUEST_SHOWCAMERA: | 508 | case PermissionUtil.REQUEST_SHOWCAMERA: |
| 496 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 509 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
| 497 | // Permission Granted | 510 | // Permission Granted |
| 498 | uploadAvatarFromPhotoRequest(); | 511 | uploadAvatarFromPhotoRequest(); |
| 499 | 512 | ||
| 500 | } else { | 513 | } else { |
| 501 | if (!SharedPreferenceMark.getHasShowCamera()) { | 514 | if (!SharedPreferenceMark.getHasShowCamera()) { |
| 502 | SharedPreferenceMark.setHasShowCamera(true); | 515 | SharedPreferenceMark.setHasShowCamera(true); |
| 503 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 516 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
| 504 | 517 | ||
| 505 | } else { | 518 | } else { |
| 506 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 519 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
| 507 | .show(); | 520 | .show(); |
| 508 | } | 521 | } |
| 509 | } | 522 | } |
| 510 | break; | 523 | break; |
| 511 | default: | 524 | default: |
| 512 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 525 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 513 | } | 526 | } |
| 514 | } | 527 | } |
| 515 | private long exitTime = 0; | 528 | private long exitTime = 0; |
| 516 | @Override | 529 | @Override |
| 517 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 530 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| 518 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 531 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 519 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 532 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
| 520 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 533 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
| 521 | Toast.LENGTH_SHORT).show(); | 534 | Toast.LENGTH_SHORT).show(); |
| 522 | exitTime = System.currentTimeMillis(); | 535 | exitTime = System.currentTimeMillis(); |
| 523 | } else { | 536 | } else { |
| 524 | finish(); | 537 | finish(); |
| 525 | System.exit(0); | 538 | System.exit(0); |
| 526 | } | 539 | } |
| 527 | return false; | 540 | return false; |
| 528 | } | 541 | } |
| 529 | return super.onKeyDown(keyCode, event); | 542 | return super.onKeyDown(keyCode, event); |
| 530 | } | 543 | } |
| 531 | } | 544 | } |
| 532 | 545 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
| 6 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
| 7 | import android.view.KeyEvent; | 7 | import android.view.KeyEvent; |
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.widget.Button; | 9 | import android.widget.Button; |
| 10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
| 11 | import android.widget.TextView; | 11 | import android.widget.TextView; |
| 12 | 12 | ||
| 13 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
| 14 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 14 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
| 15 | import com.hjx.personalcenter.customdialog.CountryDialog; | 15 | import com.hjx.personalcenter.customdialog.CountryDialog; |
| 16 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 16 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
| 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
| 19 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
| 20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
| 21 | import com.hjx.personalcenter.http.HttpManager; | 21 | import com.hjx.personalcenter.http.HttpManager; |
| 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 23 | import com.hjx.personalcenter.model.CityInfo; | 23 | import com.hjx.personalcenter.model.CityInfo; |
| 24 | import com.hjx.personalcenter.model.CountyInfo; | 24 | import com.hjx.personalcenter.model.CountyInfo; |
| 25 | import com.hjx.personalcenter.model.GradeInfo; | 25 | import com.hjx.personalcenter.model.GradeInfo; |
| 26 | import com.hjx.personalcenter.model.ProvinceInfo; | 26 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 27 | import com.hjx.personalcenter.model.SchoolInfo; | 27 | import com.hjx.personalcenter.model.SchoolInfo; |
| 28 | import com.hjx.personalcenter.util.AlertUtils; | 28 | import com.hjx.personalcenter.util.AlertUtils; |
| 29 | import com.hjx.personalcenter.util.GetDevicesUtil; | 29 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 30 | 30 | ||
| 31 | import java.util.ArrayList; | 31 | import java.util.ArrayList; |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | * 填写注册信息 熊巍 | 34 | * 填写注册信息 熊巍 |
| 35 | * Created by h on 2017/8/9. | 35 | * Created by h on 2017/8/9. |
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 38 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
| 39 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 39 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
| 40 | private EditText et_username; | 40 | private EditText et_username; |
| 41 | private TextView et_region, et_grade, et_school; | 41 | private TextView et_region, et_grade, et_school; |
| 42 | private Button btn_ok; | 42 | private Button btn_ok; |
| 43 | 43 | ||
| 44 | @Override | 44 | @Override |
| 45 | protected void onCreate(Bundle savedInstanceState) { | 45 | protected void onCreate(Bundle savedInstanceState) { |
| 46 | super.onCreate(savedInstanceState); | 46 | super.onCreate(savedInstanceState); |
| 47 | setContentView(R.layout.activity_registerinfo); | 47 | setContentView(R.layout.activity_registerinfo); |
| 48 | initView(); | 48 | initView(); |
| 49 | initData(); | 49 | initData(); |
| 50 | initLister(); | 50 | initLister(); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | private void initView() { | 53 | private void initView() { |
| 54 | et_username = (EditText) findViewById(R.id.et_username); | 54 | et_username = (EditText) findViewById(R.id.et_username); |
| 55 | et_region = (TextView) findViewById(R.id.et_region); | 55 | et_region = (TextView) findViewById(R.id.et_region); |
| 56 | et_grade = (TextView) findViewById(R.id.et_grade); | 56 | et_grade = (TextView) findViewById(R.id.et_grade); |
| 57 | et_school = (TextView) findViewById(R.id.et_school); | 57 | et_school = (TextView) findViewById(R.id.et_school); |
| 58 | btn_ok = (Button) findViewById(R.id.btn_ok); | 58 | btn_ok = (Button) findViewById(R.id.btn_ok); |
| 59 | 59 | ||
| 60 | 60 | ||
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | private void initData() { | 63 | private void initData() { |
| 64 | if (Content.accountflag == 2) { | 64 | if (Content.accountflag == 2) { |
| 65 | btn_ok.setText("提交"); | 65 | btn_ok.setText("提交"); |
| 66 | 66 | ||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | private void initLister() { | 71 | private void initLister() { |
| 72 | et_region.setOnClickListener(this); | 72 | et_region.setOnClickListener(this); |
| 73 | et_grade.setOnClickListener(this); | 73 | et_grade.setOnClickListener(this); |
| 74 | et_school.setOnClickListener(this); | 74 | et_school.setOnClickListener(this); |
| 75 | btn_ok.setOnClickListener(this); | 75 | btn_ok.setOnClickListener(this); |
| 76 | 76 | ||
| 77 | 77 | ||
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | @Override | 80 | @Override |
| 81 | public void onClick(View v) { | 81 | public void onClick(View v) { |
| 82 | String register1 = et_username.getText().toString().trim(); | 82 | String register1 = et_username.getText().toString().trim(); |
| 83 | String register2 = et_region.getText().toString().trim(); | 83 | String register2 = et_region.getText().toString().trim(); |
| 84 | String register3 = et_grade.getText().toString().trim(); | 84 | String register3 = et_grade.getText().toString().trim(); |
| 85 | String register4 = et_school.getText().toString().trim(); | 85 | String register4 = et_school.getText().toString().trim(); |
| 86 | switch (v.getId()) { | 86 | switch (v.getId()) { |
| 87 | case R.id.et_region: | 87 | case R.id.et_region: |
| 88 | choiseregion(); | 88 | choiseregion(); |
| 89 | break; | 89 | break; |
| 90 | case R.id.et_grade: | 90 | case R.id.et_grade: |
| 91 | choisegrade(); | 91 | choisegrade(); |
| 92 | break; | 92 | break; |
| 93 | case R.id.et_school: | 93 | case R.id.et_school: |
| 94 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { | 94 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
| 95 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); | 95 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); |
| 96 | return; | 96 | return; |
| 97 | } else { | 97 | } else { |
| 98 | choiseschool(); | 98 | choiseschool(); |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | break; | 101 | break; |
| 102 | case R.id.btn_ok: | 102 | case R.id.btn_ok: |
| 103 | if (TextUtils.isEmpty(register1) || | 103 | if (TextUtils.isEmpty(register1) || |
| 104 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { | 104 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
| 105 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | 105 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
| 106 | return; | 106 | return; |
| 107 | } else { | 107 | } else { |
| 108 | String register5 = et_username.getText().toString().trim(); | 108 | String register5 = et_username.getText().toString().trim(); |
| 109 | String register6 = et_region.getText().toString().trim(); | 109 | String register6 = et_region.getText().toString().trim(); |
| 110 | String register7 = et_grade.getText().toString().trim(); | 110 | String register7 = et_grade.getText().toString().trim(); |
| 111 | String register8 = et_school.getText().toString().trim(); | 111 | String register8 = et_school.getText().toString().trim(); |
| 112 | if (Content.accountflag == 2) { | 112 | if (Content.accountflag == 2) { |
| 113 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 113 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 114 | String grade = SaveParam.getInstance().getLoginParam(this, SaveParam.GRADENS); | 114 | String grade = SaveParam.getInstance().getLoginParam(this, SaveParam.GRADENS); |
| 115 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); | 115 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); |
| 116 | String regionId = SaveParam.getInstance().getLoginParam(this, SaveParam.COUNTRY); | 116 | String regionId = SaveParam.getInstance().getLoginParam(this, SaveParam.COUNTRY); |
| 117 | String regionId1 = SaveParam.getInstance().getLoginParam(this, SaveParam.CITYS); | 117 | String regionId1 = SaveParam.getInstance().getLoginParam(this, SaveParam.CITYS); |
| 118 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 118 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
| 119 | if (regionId == null) { | 119 | if (regionId == null) { |
| 120 | regionId = regionId1; | 120 | regionId = regionId1; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | try { | 123 | try { |
| 124 | Object schoolss; | 124 | Object schoolss; |
| 125 | long auserID = Long.parseLong(userID); | 125 | long auserID = Long.parseLong(userID); |
| 126 | long grades = Long.parseLong(grade); | 126 | long grades = Long.parseLong(grade); |
| 127 | if (TextUtils.isEmpty(register8)) { | 127 | if (TextUtils.isEmpty(register8)) { |
| 128 | schoolss = null; | 128 | schoolss = null; |
| 129 | } else { | 129 | } else { |
| 130 | schoolss = Long.parseLong(School); | 130 | schoolss = Long.parseLong(School); |
| 131 | } | 131 | } |
| 132 | long regionIds = Long.parseLong(regionId); | 132 | long regionIds = Long.parseLong(regionId); |
| 133 | HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this, auserID, "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png", | 133 | HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this, auserID, "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png", |
| 134 | register5, grades, schoolss, regionIds, devicenumber, register6); | 134 | register5, grades, schoolss, regionIds, devicenumber, register6); |
| 135 | 135 | ||
| 136 | } catch (NumberFormatException e) { | 136 | } catch (NumberFormatException e) { |
| 137 | e.printStackTrace(); | 137 | e.printStackTrace(); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | } else { | 140 | } else { |
| 141 | saveinfo(); | 141 | saveinfo(); |
| 142 | Intent intent = new Intent(); | 142 | Intent intent = new Intent(); |
| 143 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); | 143 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); |
| 144 | startActivity(intent); | 144 | startActivity(intent); |
| 145 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 145 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | break; | 150 | break; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | @Override | 155 | @Override |
| 156 | protected void onResume() { | 156 | protected void onResume() { |
| 157 | super.onResume(); | 157 | super.onResume(); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | //保存个人信息 | 160 | //保存个人信息 |
| 161 | private void saveinfo() { | 161 | private void saveinfo() { |
| 162 | String register1 = et_username.getText().toString().trim(); | 162 | String register1 = et_username.getText().toString().trim(); |
| 163 | String register2 = et_region.getText().toString().trim(); | 163 | String register2 = et_region.getText().toString().trim(); |
| 164 | String register3 = et_grade.getText().toString().trim(); | 164 | String register3 = et_grade.getText().toString().trim(); |
| 165 | String register4 = et_school.getText().toString().trim(); | 165 | String register4 = et_school.getText().toString().trim(); |
| 166 | SaveParam.getInstance().saveLoginParam(this, SaveParam.USERNAME, register1); | 166 | SaveParam.getInstance().saveLoginParam(this, SaveParam.USERNAME, register1); |
| 167 | SaveParam.getInstance().saveLoginParam(this, SaveParam.ADRESS, register2); | 167 | SaveParam.getInstance().saveLoginParam(this, SaveParam.ADRESS, register2); |
| 168 | SaveParam.getInstance().saveLoginParam(this, SaveParam.GRADES, register3); | 168 | SaveParam.getInstance().saveLoginParam(this, SaveParam.GRADES, register3); |
| 169 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SCHOOL, register4); | 169 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SCHOOL, register4); |
| 170 | 170 | ||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | //选择地区 | 173 | //选择地区 |
| 174 | private void choiseregion() { | 174 | private void choiseregion() { |
| 175 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 175 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
| 176 | 176 | ||
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | //选择年级 | 179 | //选择年级 |
| 180 | private void choisegrade() { | 180 | private void choisegrade() { |
| 181 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); | 181 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); |
| 182 | 182 | ||
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | //选择学校 | 185 | //选择学校 |
| 186 | private void choiseschool() { | 186 | private void choiseschool() { |
| 187 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); | 187 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); |
| 188 | 188 | ||
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | 191 | ||
| 192 | @Override | 192 | @Override |
| 193 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 193 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
| 194 | String regionName = data.get(position).getRegionName(); | 194 | String regionName = data.get(position).getRegionName(); |
| 195 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); | 195 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); |
| 196 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 196 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
| 197 | 197 | et_region.setText(""); | |
| 198 | et_region.setText(regionName); | ||
| 198 | 199 | ||
| 199 | } | 200 | } |
| 200 | 201 | ||
| 201 | @Override | 202 | @Override |
| 202 | public boolean onKeyUp(int keyCode, KeyEvent event) { | 203 | public boolean onKeyUp(int keyCode, KeyEvent event) { |
| 203 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 204 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 204 | finish(); | 205 | finish(); |
| 205 | 206 | ||
| 206 | } | 207 | } |
| 207 | return super.onKeyUp(keyCode, event); | 208 | return super.onKeyUp(keyCode, event); |
| 208 | } | 209 | } |
| 209 | 210 | ||
| 210 | @Override | 211 | @Override |
| 211 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 212 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
| 212 | String regionName = data.get(position).getName(); | 213 | String regionName = data.get(position).getName(); |
| 213 | et_grade.setText(regionName); | 214 | et_grade.setText(regionName); |
| 214 | 215 | ||
| 215 | } | 216 | } |
| 216 | 217 | ||
| 217 | @Override | 218 | @Override |
| 218 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 219 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
| 219 | String regionName = data.get(position).getRegionName(); | 220 | String regionName = data.get(position).getRegionName(); |
| 220 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); | 221 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); |
| 221 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); | 222 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); |
| 222 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 223 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
| 223 | et_region.setText(""); | 224 | et_region.setText(""); |
| 224 | et_region.setText(provice + regionName); | 225 | et_region.setText(provice + regionName); |
| 225 | 226 | ||
| 226 | } | 227 | } |
| 227 | 228 | ||
| 228 | @Override | 229 | @Override |
| 229 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 230 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
| 230 | String regionName = data.get(position).getRegionName(); | 231 | String regionName = data.get(position).getRegionName(); |
| 231 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); | 232 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); |
| 232 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); | 233 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); |
| 233 | et_region.setText(""); | 234 | et_region.setText(""); |
| 234 | et_region.setText(provices + citys + regionName); | 235 | et_region.setText(provices + citys + regionName); |
| 235 | 236 | ||
| 236 | } | 237 | } |
| 237 | 238 | ||
| 238 | @Override | 239 | @Override |
| 239 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 240 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
| 240 | String regionName = data.get(position).getSchoolName(); | 241 | String regionName = data.get(position).getSchoolName(); |
| 241 | et_school.setText(regionName); | 242 | et_school.setText(regionName); |
| 242 | 243 | ||
| 243 | } | 244 | } |
| 244 | } | 245 | } |
| 245 | 246 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/AccountChildsAdapter.java
| 1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.support.v4.app.FragmentActivity; | 4 | import android.support.v4.app.FragmentActivity; |
| 5 | import android.support.v7.widget.RecyclerView; | 5 | import android.support.v7.widget.RecyclerView; |
| 6 | import android.view.LayoutInflater; | 6 | import android.view.LayoutInflater; |
| 7 | import android.view.View; | 7 | import android.view.View; |
| 8 | import android.view.ViewGroup; | 8 | import android.view.ViewGroup; |
| 9 | import android.widget.ImageView; | 9 | import android.widget.ImageView; |
| 10 | import android.widget.LinearLayout; | 10 | import android.widget.LinearLayout; |
| 11 | import android.widget.TextView; | 11 | import android.widget.TextView; |
| 12 | 12 | ||
| 13 | import com.facebook.drawee.view.SimpleDraweeView; | 13 | import com.facebook.drawee.view.SimpleDraweeView; |
| 14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
| 15 | import com.hjx.personalcenter.db.Content; | 15 | import com.hjx.personalcenter.db.Content; |
| 16 | import com.hjx.personalcenter.db.SaveParam; | 16 | import com.hjx.personalcenter.db.SaveParam; |
| 17 | import com.hjx.personalcenter.http.HttpManager; | 17 | import com.hjx.personalcenter.http.HttpManager; |
| 18 | import com.hjx.personalcenter.model.ChildsInfo; | 18 | import com.hjx.personalcenter.model.ChildsInfo; |
| 19 | import com.hjx.personalcenter.util.GetDevicesUtil; | 19 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 20 | import com.mylhyl.circledialog.CircleDialog; | 20 | import com.mylhyl.circledialog.CircleDialog; |
| 21 | 21 | ||
| 22 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
| 23 | import java.util.List; | 23 | import java.util.List; |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | * Created by h on 2017/8/26. | 26 | * Created by h on 2017/8/26. |
| 27 | */ | 27 | */ |
| 28 | 28 | ||
| 29 | public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> implements View.OnClickListener { | 29 | public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> implements View.OnClickListener { |
| 30 | private List<ChildsInfo.DataBean> specailList; | 30 | private List<ChildsInfo.DataBean> specailList; |
| 31 | private LayoutInflater mInflater; | 31 | private LayoutInflater mInflater; |
| 32 | private Context mContext ; | 32 | private Context mContext ; |
| 33 | 33 | ||
| 34 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) { | 34 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) { |
| 35 | this.mContext = context; | 35 | this.mContext = context; |
| 36 | this.specailList = specailList; | 36 | this.specailList = specailList; |
| 37 | mInflater = LayoutInflater.from(context); | 37 | mInflater = LayoutInflater.from(context); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | public OnItemClickListener mOnItemClickListener; | 40 | public OnItemClickListener mOnItemClickListener; |
| 41 | 41 | ||
| 42 | @Override | 42 | @Override |
| 43 | public void onClick(View v) { | 43 | public void onClick(View v) { |
| 44 | if (mOnItemClickListener ==null){ | 44 | if (mOnItemClickListener ==null){ |
| 45 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); | 45 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | public interface OnItemClickListener { | 50 | public interface OnItemClickListener { |
| 51 | void onItemClick(View view, int position); | 51 | void onItemClick(View view, int position); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { | 54 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { |
| 55 | this.mOnItemClickListener = mOnItemClickLitener; | 55 | this.mOnItemClickListener = mOnItemClickLitener; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | public void setList(List<ChildsInfo.DataBean> list) { | 58 | public void setList(List<ChildsInfo.DataBean> list) { |
| 59 | this.specailList = list; | 59 | this.specailList = list; |
| 60 | notifyDataSetChanged(); | 60 | notifyDataSetChanged(); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | @Override | 63 | @Override |
| 64 | public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 64 | public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
| 65 | View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false); | 65 | View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false); |
| 66 | view.setOnClickListener(this); | 66 | view.setOnClickListener(this); |
| 67 | AccountChildsHolder holder = new AccountChildsHolder(view); | 67 | AccountChildsHolder holder = new AccountChildsHolder(view); |
| 68 | return holder; | 68 | return holder; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | @Override | 71 | @Override |
| 72 | public void onBindViewHolder(AccountChildsHolder holder, int position) { | 72 | public void onBindViewHolder(AccountChildsHolder holder, int position) { |
| 73 | final ChildsInfo.DataBean bean = specailList.get(position); | 73 | final ChildsInfo.DataBean bean = specailList.get(position); |
| 74 | if (bean != null) { | 74 | if (bean != null) { |
| 75 | holder.mSimpleDraweeView.setImageURI(bean.getImage()); | 75 | holder.mSimpleDraweeView.setImageURI(bean.getImage()); |
| 76 | holder.iv_child_name.setText(bean.getName()); | 76 | holder.iv_child_name.setText(bean.getName()); |
| 77 | holder.iv_child_grade.setText(bean.getGrade()); | 77 | holder.iv_child_grade.setText(bean.getGrade()); |
| 78 | holder.iv_child_school.setText(bean.getSchool()); | 78 | holder.iv_child_school.setText(bean.getSchool()); |
| 79 | holder.iv_child_adress.setText(bean.getRegion()); | 79 | holder.iv_child_adress.setText(bean.getRegion()); |
| 80 | if ("已使用".equals(bean.getStatus())){ | 80 | if ("已使用".equals(bean.getStatus())){ |
| 81 | holder.chang_account.setText("使用中"); | 81 | holder.chang_account.setText("使用中"); |
| 82 | holder.chang_account.setEnabled(false); | 82 | holder.chang_account.setEnabled(false); |
| 83 | holder.delete_account.setEnabled(false); | 83 | holder.delete_account.setEnabled(false); |
| 84 | holder.iv_using_pic.setVisibility(View.VISIBLE); | 84 | holder.iv_using_pic.setVisibility(View.VISIBLE); |
| 85 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 85 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
| 86 | }else { | 86 | }else { |
| 87 | holder.chang_account.setText("切换用户"); | 87 | holder.chang_account.setText("切换用户"); |
| 88 | holder.chang_account.setEnabled(true); | 88 | holder.chang_account.setEnabled(true); |
| 89 | holder.delete_account.setEnabled(true); | 89 | holder.delete_account.setEnabled(true); |
| 90 | holder.iv_using_pic.setVisibility(View.GONE); | 90 | holder.iv_using_pic.setVisibility(View.GONE); |
| 91 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 91 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
| 92 | } | 92 | } |
| 93 | holder.delete_account.setOnClickListener(new View.OnClickListener() { | 93 | holder.delete_account.setOnClickListener(new View.OnClickListener() { |
| 94 | @Override | 94 | @Override |
| 95 | public void onClick(View v) { | 95 | public void onClick(View v) { |
| 96 | new CircleDialog.Builder((FragmentActivity)mContext) | 96 | new CircleDialog.Builder((FragmentActivity)mContext) |
| 97 | .setCanceledOnTouchOutside(false) | 97 | .setCanceledOnTouchOutside(false) |
| 98 | .setWidth(0.4f) | 98 | .setWidth(0.4f) |
| 99 | .setCancelable(false) | 99 | .setCancelable(false) |
| 100 | .setText("您确定删除该子账户?") | 100 | .setText("您确定删除该子账户?") |
| 101 | .setNegative("取消", null) | 101 | .setNegative("取消", null) |
| 102 | .setPositive("确定", new View.OnClickListener() { | 102 | .setPositive("确定", new View.OnClickListener() { |
| 103 | @Override | 103 | @Override |
| 104 | public void onClick(View v) { | 104 | public void onClick(View v) { |
| 105 | HttpManager.getInstance().deletechildAccountinfo(mContext,bean.getSubAccountId()); | 105 | HttpManager.getInstance().deletechildAccountinfo(mContext,bean.getSubAccountId()); |
| 106 | } | 106 | } |
| 107 | }) | 107 | }) |
| 108 | .show(); | 108 | .show(); |
| 109 | 109 | ||
| 110 | 110 | ||
| 111 | 111 | ||
| 112 | } | 112 | } |
| 113 | }); | 113 | }); |
| 114 | holder.chang_account.setOnClickListener(new View.OnClickListener() { | 114 | holder.chang_account.setOnClickListener(new View.OnClickListener() { |
| 115 | @Override | 115 | @Override |
| 116 | public void onClick(View v) { | 116 | public void onClick(View v) { |
| 117 | new CircleDialog.Builder((FragmentActivity)mContext) | 117 | new CircleDialog.Builder((FragmentActivity)mContext) |
| 118 | .setCanceledOnTouchOutside(false) | 118 | .setCanceledOnTouchOutside(false) |
| 119 | .setWidth(0.4f) | 119 | .setWidth(0.4f) |
| 120 | .setCancelable(false) | 120 | .setCancelable(false) |
| 121 | .setText("您确定切换为该子账户?") | 121 | .setText("您确定切换为该子账户?") |
| 122 | .setNegative("取消", null) | 122 | .setNegative("取消", null) |
| 123 | .setPositive("确定", new View.OnClickListener() { | 123 | .setPositive("确定", new View.OnClickListener() { |
| 124 | @Override | 124 | @Override |
| 125 | public void onClick(View v) { | 125 | public void onClick(View v) { |
| 126 | Content.changgeaccountflag =2; | 126 | Content.changgeaccountflag =2; |
| 127 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.ACCOUNT,"2"); | 127 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ACCOUNT,"2"); |
| 128 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); | 128 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); |
| 129 | HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId(), | 129 | HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId(), |
| 130 | devicenumber,2); | 130 | devicenumber,2); |
| 131 | } | 131 | } |
| 132 | }) | 132 | }) |
| 133 | .show(); | 133 | .show(); |
| 134 | 134 | ||
| 135 | } | 135 | } |
| 136 | }); | 136 | }); |
| 137 | 137 | ||
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | 140 | ||
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | @Override | 143 | @Override |
| 144 | public int getItemCount() { | 144 | public int getItemCount() { |
| 145 | 145 | ||
| 146 | return specailList.size(); | 146 | return specailList.size(); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | class AccountChildsHolder extends RecyclerView.ViewHolder { | 149 | class AccountChildsHolder extends RecyclerView.ViewHolder { |
| 150 | ImageView iv_using_pic; | 150 | ImageView iv_using_pic; |
| 151 | LinearLayout ll_backgrangd; | 151 | LinearLayout ll_backgrangd; |
| 152 | SimpleDraweeView mSimpleDraweeView; | 152 | SimpleDraweeView mSimpleDraweeView; |
| 153 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, | 153 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, |
| 154 | delete_account,chang_account; | 154 | delete_account,chang_account; |
| 155 | public AccountChildsHolder(View itemView) { | 155 | public AccountChildsHolder(View itemView) { |
| 156 | super(itemView); | 156 | super(itemView); |
| 157 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); | 157 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); |
| 158 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); | 158 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); |
| 159 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); | 159 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); |
| 160 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); | 160 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); |
| 161 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); | 161 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); |
| 162 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); | 162 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); |
| 163 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); | 163 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); |
| 164 | iv_using_pic = (ImageView) itemView.findViewById(R.id.iv_using_pic); | 164 | iv_using_pic = (ImageView) itemView.findViewById(R.id.iv_using_pic); |
| 165 | ll_backgrangd = (LinearLayout) itemView.findViewById(R.id.ll_backgrangd); | 165 | ll_backgrangd = (LinearLayout) itemView.findViewById(R.id.ll_backgrangd); |
| 166 | 166 | ||
| 167 | } | 167 | } |
| 168 | } | 168 | } |
| 169 | } | 169 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/ElectronicCardDialog.java
| 1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
| 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.graphics.Color; | 5 | import android.graphics.Color; |
| 6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 7 | import android.view.Gravity; | 7 | import android.view.Gravity; |
| 8 | import android.view.LayoutInflater; | 8 | import android.view.LayoutInflater; |
| 9 | import android.view.View; | 9 | import android.view.View; |
| 10 | import android.view.ViewGroup; | 10 | import android.view.ViewGroup; |
| 11 | 11 | ||
| 12 | import com.hjx.personalcenter.R; | 12 | import com.hjx.personalcenter.R; |
| 13 | import com.hjx.personalcenter.activity.ElectronicCardValidationActivity; | 13 | import com.hjx.personalcenter.activity.ElectronicCardValidationActivity; |
| 14 | import com.mylhyl.circledialog.BaseCircleDialog; | 14 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 15 | import com.mylhyl.circledialog.res.values.CircleDimen; | 15 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | * Created by h on 2017/8/10. | 18 | * Created by h on 2017/8/10. |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | public class ElectronicCardDialog extends BaseCircleDialog { | 21 | public class ElectronicCardDialog extends BaseCircleDialog { |
| 22 | public static ElectronicCardDialog getInstance() { | 22 | public static ElectronicCardDialog getInstance() { |
| 23 | ElectronicCardDialog dialogFragment = new ElectronicCardDialog(); | 23 | ElectronicCardDialog dialogFragment = new ElectronicCardDialog(); |
| 24 | dialogFragment.setCanceledBack(true); | 24 | dialogFragment.setCanceledBack(true); |
| 25 | dialogFragment.setCanceledOnTouchOutside(true); | 25 | dialogFragment.setCanceledOnTouchOutside(true); |
| 26 | dialogFragment.setRadius(CircleDimen.RADIUS); | 26 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 27 | dialogFragment.setWidth(0.8f); | 27 | dialogFragment.setWidth(0.8f); |
| 28 | dialogFragment.setGravity(Gravity.CENTER); | 28 | dialogFragment.setGravity(Gravity.CENTER); |
| 29 | dialogFragment.setBackgroundColor(Color.WHITE); | 29 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 30 | return dialogFragment; | 30 | return dialogFragment; |
| 31 | } | 31 | } |
| 32 | @Override | 32 | @Override |
| 33 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 33 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 34 | return inflater.inflate(R.layout.custom_adilog_electroniccard, container, false); | 34 | return inflater.inflate(R.layout.custom_adilog_electroniccard, container, false); |
| 35 | } | 35 | } |
| 36 | @Override | 36 | @Override |
| 37 | public void onActivityCreated(Bundle savedInstanceState) { | 37 | public void onActivityCreated(Bundle savedInstanceState) { |
| 38 | super.onActivityCreated(savedInstanceState); | 38 | super.onActivityCreated(savedInstanceState); |
| 39 | getView().findViewById(R.id.fill_card).setOnClickListener(new View.OnClickListener() { | 39 | getView().findViewById(R.id.fill_card).setOnClickListener(new View.OnClickListener() { |
| 40 | @Override | 40 | @Override |
| 41 | public void onClick(View v) { | 41 | public void onClick(View v) { |
| 42 | Intent intent = new Intent(); | 42 | Intent intent = new Intent(); |
| 43 | intent.setClass(getActivity(),ElectronicCardValidationActivity.class); | 43 | intent.setClass(getActivity(),ElectronicCardValidationActivity.class); |
| 44 | startActivity(intent); | 44 | startActivity(intent); |
| 45 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 45 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 46 | getActivity().finish(); | ||
| 47 | 46 | ||
| 48 | } | 47 | } |
| 49 | }); | 48 | }); |
| 50 | 49 | ||
| 51 | } | 50 | } |
| 52 | 51 | ||
| 53 | } | 52 | } |
| 54 | 53 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
| 1 | package com.hjx.personalcenter.db; | 1 | package com.hjx.personalcenter.db; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.content.SharedPreferences; | 5 | import android.content.SharedPreferences; |
| 6 | 6 | ||
| 7 | public class SaveParam { | 7 | public class SaveParam { |
| 8 | 8 | ||
| 9 | private static SaveParam instance; | 9 | private static SaveParam instance; |
| 10 | public static SaveParam getInstance(){ | 10 | public static SaveParam getInstance(){ |
| 11 | if (instance==null){ | 11 | if (instance==null){ |
| 12 | instance = new SaveParam(); | 12 | instance = new SaveParam(); |
| 13 | } | 13 | } |
| 14 | return instance; | 14 | return instance; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | public static String GRADENS = "gradens";//年级id | 17 | public static String GRADENS = "gradens";//年级id |
| 18 | public static String SCHOOOlID = "schoolid";//年级id | 18 | public static String SCHOOOlID = "schoolid";//年级id |
| 19 | //个人信息 | 19 | //个人信息 |
| 20 | public static String USERNAME = "usernames";//昵称 | 20 | public static String USERNAME = "usernames";//昵称 |
| 21 | public static String ADRESS = "adress";//地址 | 21 | public static String ADRESS = "adress";//地址 |
| 22 | public static String GRADES = "gadens";//年级 | 22 | public static String GRADES = "gadens";//年级 |
| 23 | public static String SCHOOL = "school";//学校 | 23 | public static String SCHOOL = "school";//学校 |
| 24 | public static String CONSTELLATION = "constellations";//星座 | 24 | public static String CONSTELLATION = "constellations";//星座 |
| 25 | public static String HEADURL = "headurl";//星座 | ||
| 25 | 26 | ||
| 26 | //电子保卡信息 | 27 | //电子保卡信息 |
| 27 | public static String CARDPHONE = "cardphone";//保卡手机号 | 28 | public static String CARDPHONE = "cardphone";//保卡手机号 |
| 28 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 | 29 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 |
| 29 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 | 30 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 |
| 30 | public static String SHOPTIME = "shoptime";//购买时间 | 31 | public static String SHOPTIME = "shoptime";//购买时间 |
| 31 | public static String SHOPADRESS = "shopadress";//购买地址 | 32 | public static String SHOPADRESS = "shopadress";//购买地址 |
| 32 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 | 33 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 |
| 33 | 34 | ||
| 34 | //省市区参数、 | 35 | //省市区参数、 |
| 35 | public static String PROVINCES = "provinces";//省 | 36 | public static String PROVINCES = "provinces";//省 |
| 36 | public static String CITYS = "citys";//市 | 37 | public static String CITYS = "citys";//市 |
| 37 | public static String COUNTRY = "country";//区 | 38 | public static String COUNTRY = "country";//区 |
| 38 | 39 | ||
| 39 | //账户管理 | 40 | //账户管理 |
| 40 | public static String ACCOUNT = "account";//账户类型 | 41 | public static String ACCOUNT = "account";//账户类型 |
| 41 | 42 | ||
| 42 | 43 | ||
| 43 | public void saveLoginParam(Context context,String spname, String spstr) { | 44 | public void saveLoginParam(Context context,String spname, String spstr) { |
| 44 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 45 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 45 | Activity.MODE_PRIVATE); | 46 | Activity.MODE_PRIVATE); |
| 46 | 47 | ||
| 47 | sp.edit().putString(spname, spstr).commit(); | 48 | sp.edit().putString(spname, spstr).commit(); |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | 51 | ||
| 51 | public String getLoginParam(Context context,String spname) { | 52 | public String getLoginParam(Context context,String spname) { |
| 52 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 53 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 53 | Activity.MODE_PRIVATE); | 54 | Activity.MODE_PRIVATE); |
| 54 | String param = sp.getString(spname, null); | 55 | String param = sp.getString(spname, null); |
| 55 | return param; | 56 | return param; |
| 56 | } | 57 | } |
| 57 | public void clearData(Context context) { | 58 | public void clearData(Context context) { |
| 58 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 59 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 59 | Activity.MODE_PRIVATE); | 60 | Activity.MODE_PRIVATE); |
| 60 | sp.edit().clear().commit(); | 61 | sp.edit().clear().commit(); |
| 61 | } | 62 | } |
| 62 | 63 | ||
| 63 | public void saveCustomizeParam(Context context,String spname, String spstr) { | 64 | public void saveCustomizeParam(Context context,String spname, String spstr) { |
| 64 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 65 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 65 | Activity.MODE_PRIVATE); | 66 | Activity.MODE_PRIVATE); |
| 66 | 67 | ||
| 67 | sp.edit().putString(spname, spstr).commit(); | 68 | sp.edit().putString(spname, spstr).commit(); |
| 68 | 69 | ||
| 69 | } | 70 | } |
| 70 | 71 | ||
| 71 | public String getCustomizeParam(Context context,String spname) { | 72 | public String getCustomizeParam(Context context,String spname) { |
| 72 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 73 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 73 | Activity.MODE_PRIVATE); | 74 | Activity.MODE_PRIVATE); |
| 74 | String param = sp.getString(spname, null); | 75 | String param = sp.getString(spname, null); |
| 75 | return param; | 76 | return param; |
| 76 | } | 77 | } |
| 77 | 78 | ||
| 78 | public void clearCustomizeParam(Context context ){ | 79 | public void clearCustomizeParam(Context context ){ |
| 79 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 80 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 80 | Activity.MODE_PRIVATE); | 81 | Activity.MODE_PRIVATE); |
| 81 | sp.edit().clear().commit(); | 82 | sp.edit().clear().commit(); |
| 82 | } | 83 | } |
| 83 | } | 84 | } |
| 84 | 85 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/LoginFragment.java
| 1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | import android.os.Message; | 6 | import android.os.Message; |
| 7 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
| 8 | import android.support.v4.app.Fragment; | 8 | import android.support.v4.app.Fragment; |
| 9 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
| 10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
| 11 | import android.view.View; | 11 | import android.view.View; |
| 12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
| 13 | import android.widget.Button; | 13 | import android.widget.Button; |
| 14 | import android.widget.EditText; | 14 | import android.widget.EditText; |
| 15 | import android.widget.TextView; | 15 | import android.widget.TextView; |
| 16 | import android.widget.Toast; | 16 | import android.widget.Toast; |
| 17 | 17 | ||
| 18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
| 19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; | 19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; |
| 20 | import com.hjx.personalcenter.activity.MainActivity; | 20 | import com.hjx.personalcenter.activity.MainActivity; |
| 21 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 21 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
| 22 | import com.hjx.personalcenter.db.SaveParam; | ||
| 23 | import com.hjx.personalcenter.http.HttpCode; | 22 | import com.hjx.personalcenter.http.HttpCode; |
| 24 | import com.hjx.personalcenter.http.HttpManager; | 23 | import com.hjx.personalcenter.http.HttpManager; |
| 25 | import com.hjx.personalcenter.util.AlertUtils; | 24 | import com.hjx.personalcenter.util.AlertUtils; |
| 26 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 25 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
| 27 | 26 | ||
| 28 | import org.json.JSONException; | 27 | import org.json.JSONException; |
| 29 | import org.json.JSONObject; | 28 | import org.json.JSONObject; |
| 30 | 29 | ||
| 31 | /** | 30 | /** |
| 32 | * 登录 | 31 | * 登录 |
| 33 | * Created by h on 2017/8/8. | 32 | * Created by h on 2017/8/8. |
| 34 | */ | 33 | */ |
| 35 | 34 | ||
| 36 | public class LoginFragment extends Fragment implements View.OnClickListener { | 35 | public class LoginFragment extends Fragment implements View.OnClickListener { |
| 37 | private View mView; | 36 | private View mView; |
| 38 | private int type; | 37 | private int type; |
| 39 | private TextView tv_forget_pwd; | 38 | private TextView tv_forget_pwd; |
| 40 | private Button btn_login; | 39 | private Button btn_login; |
| 41 | private EditText phonenumber,login_pwwd; | 40 | private EditText phonenumber,login_pwwd; |
| 42 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 41 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
| 43 | Intent intent = new Intent(); | 42 | Intent intent = new Intent(); |
| 44 | public static LoginFragment newInstance(int type) { | 43 | public static LoginFragment newInstance(int type) { |
| 45 | LoginFragment fragment = new LoginFragment(); | 44 | LoginFragment fragment = new LoginFragment(); |
| 46 | Bundle bundle = new Bundle(); | 45 | Bundle bundle = new Bundle(); |
| 47 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 46 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
| 48 | fragment.setArguments(bundle); | 47 | fragment.setArguments(bundle); |
| 49 | return fragment; | 48 | return fragment; |
| 50 | 49 | ||
| 51 | } | 50 | } |
| 52 | Handler handler = new Handler(){ | 51 | Handler handler = new Handler(){ |
| 53 | @Override | 52 | @Override |
| 54 | public void handleMessage(Message msg) { | 53 | public void handleMessage(Message msg) { |
| 55 | super.handleMessage(msg); | 54 | super.handleMessage(msg); |
| 56 | 55 | ||
| 57 | switch (msg.what){ | 56 | switch (msg.what){ |
| 58 | case HttpCode.LOGIN_SUCESS: | 57 | case HttpCode.LOGIN_SUCESS: |
| 59 | JSONObject jsonObject; | 58 | JSONObject jsonObject; |
| 60 | String status; | 59 | String status; |
| 61 | try { | 60 | try { |
| 62 | jsonObject = new JSONObject((String) msg.obj); | 61 | jsonObject = new JSONObject((String) msg.obj); |
| 63 | status = jsonObject.getString("status"); | 62 | status = jsonObject.getString("status"); |
| 64 | if (status.equals("100")) { | 63 | if (status.equals("100")) { |
| 65 | String access_token = jsonObject.getString("access_token"); | 64 | String access_token = jsonObject.getString("access_token"); |
| 66 | String userId = jsonObject.getString("userId"); | 65 | String userId = jsonObject.getString("userId"); |
| 67 | final String name = phonenumber.getText().toString().trim(); | 66 | final String name = phonenumber.getText().toString().trim(); |
| 68 | final String pwd = login_pwwd.getText().toString().trim(); | 67 | final String pwd = login_pwwd.getText().toString().trim(); |
| 69 | // | 68 | // |
| 70 | try { | 69 | try { |
| 71 | long auserID = Long.parseLong(userId); | 70 | long auserID = Long.parseLong(userId); |
| 72 | //是否填写保卡 | 71 | //是否填写保卡 |
| 73 | HttpManager.getInstance().cardinfocheck(getActivity(),auserID,handler); | 72 | HttpManager.getInstance().cardinfocheck(getActivity(),auserID,handler); |
| 74 | //登录成功,保存登录数据并且获取个人信息 | 73 | //登录成功,保存登录数据并且获取个人信息 |
| 75 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, "true", userId); | 74 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, "true", userId); |
| 76 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.ACCOUNT,"1"); | ||
| 77 | } catch (NumberFormatException e) { | 75 | } catch (NumberFormatException e) { |
| 78 | e.printStackTrace(); | 76 | e.printStackTrace(); |
| 79 | } | 77 | } |
| 80 | 78 | ||
| 81 | 79 | ||
| 82 | } else if (status.equals("200")) { | 80 | } else if (status.equals("200")) { |
| 83 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); | 81 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); |
| 84 | return; | 82 | return; |
| 85 | } else if (status.equals("204")) { | 83 | } else if (status.equals("204")) { |
| 86 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); | 84 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); |
| 87 | } else { | 85 | } else { |
| 88 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); | 86 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); |
| 89 | 87 | ||
| 90 | 88 | ||
| 91 | } | 89 | } |
| 92 | } catch (JSONException e) { | 90 | } catch (JSONException e) { |
| 93 | e.printStackTrace(); | 91 | e.printStackTrace(); |
| 94 | } | 92 | } |
| 95 | break; | 93 | break; |
| 96 | case HttpCode.CHECKCARD: | 94 | case HttpCode.CHECKCARD: |
| 97 | try { | 95 | try { |
| 98 | jsonObject = new JSONObject( (String) msg.obj); | 96 | jsonObject = new JSONObject( (String) msg.obj); |
| 99 | status = jsonObject.optString("status"); | 97 | status = jsonObject.optString("status"); |
| 100 | if (status.equals("1")){ | 98 | if (status.equals("1")){ |
| 101 | Intent intent = new Intent(); | 99 | Intent intent = new Intent(); |
| 102 | intent.setClass(getActivity(), MainActivity.class); | 100 | intent.setClass(getActivity(), MainActivity.class); |
| 103 | getActivity().startActivity(intent); | 101 | getActivity().startActivity(intent); |
| 104 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 102 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 105 | }else if(status.equals("2001")){ | 103 | }else if(status.equals("2001")){ |
| 106 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); | 104 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); |
| 107 | }else{ | 105 | }else{ |
| 108 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | 106 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); |
| 109 | } | 107 | } |
| 110 | 108 | ||
| 111 | } catch (JSONException e) { | 109 | } catch (JSONException e) { |
| 112 | e.printStackTrace(); | 110 | e.printStackTrace(); |
| 113 | } | 111 | } |
| 114 | 112 | ||
| 115 | break; | 113 | break; |
| 116 | } | 114 | } |
| 117 | } | 115 | } |
| 118 | }; | 116 | }; |
| 119 | 117 | ||
| 120 | @Override | 118 | @Override |
| 121 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 119 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 122 | if (mView == null) { | 120 | if (mView == null) { |
| 123 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); | 121 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); |
| 124 | initView(mView); | 122 | initView(mView); |
| 125 | initData(); | 123 | initData(); |
| 126 | setLister(); | 124 | setLister(); |
| 127 | 125 | ||
| 128 | 126 | ||
| 129 | } | 127 | } |
| 130 | return mView; | 128 | return mView; |
| 131 | } | 129 | } |
| 132 | //初始化 | 130 | //初始化 |
| 133 | private void initView(View mView) { | 131 | private void initView(View mView) { |
| 134 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); | 132 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); |
| 135 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); | 133 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); |
| 136 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); | 134 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); |
| 137 | btn_login = (Button) mView.findViewById(R.id.btn_login); | 135 | btn_login = (Button) mView.findViewById(R.id.btn_login); |
| 138 | 136 | ||
| 139 | } | 137 | } |
| 140 | private void initData() { | 138 | private void initData() { |
| 141 | } | 139 | } |
| 142 | private void setLister() { | 140 | private void setLister() { |
| 143 | tv_forget_pwd.setOnClickListener(this); | 141 | tv_forget_pwd.setOnClickListener(this); |
| 144 | btn_login.setOnClickListener(this); | 142 | btn_login.setOnClickListener(this); |
| 145 | } | 143 | } |
| 146 | 144 | ||
| 147 | 145 | ||
| 148 | @Override | 146 | @Override |
| 149 | public void onClick(View v) { | 147 | public void onClick(View v) { |
| 150 | switch (v.getId()){ | 148 | switch (v.getId()){ |
| 151 | case R.id.tv_forget_pwd: | 149 | case R.id.tv_forget_pwd: |
| 152 | intent.setClass(getActivity(),ForgotPasswordActivity.class); | 150 | intent.setClass(getActivity(),ForgotPasswordActivity.class); |
| 153 | startActivity(intent); | 151 | startActivity(intent); |
| 154 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 152 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 155 | break; | 153 | break; |
| 156 | case R.id.btn_login: | 154 | case R.id.btn_login: |
| 157 | login(); | 155 | login(); |
| 158 | break; | 156 | break; |
| 159 | } | 157 | } |
| 160 | 158 | ||
| 161 | } | 159 | } |
| 162 | 160 | ||
| 163 | private void login() { | 161 | private void login() { |
| 164 | final String name = phonenumber.getText().toString().trim(); | 162 | final String name = phonenumber.getText().toString().trim(); |
| 165 | final String pwd = login_pwwd.getText().toString().trim(); | 163 | final String pwd = login_pwwd.getText().toString().trim(); |
| 166 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { | 164 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { |
| 167 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); | 165 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); |
| 168 | return; | 166 | return; |
| 169 | }else if (!PhoneNumCheckUtils.isPhone(name)){ | 167 | }else if (!PhoneNumCheckUtils.isPhone(name)){ |
| 170 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); | 168 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); |
| 171 | }else { | 169 | }else { |
| 172 | //登录接口 | 170 | //登录接口 |
| 173 | HttpManager.getInstance().login(name,pwd, getActivity(),handler); | 171 | HttpManager.getInstance().login(name,pwd, getActivity(),handler); |
| 174 | } | 172 | } |
| 175 | 173 | ||
| 176 | 174 | ||
| 177 | } | 175 | } |
| 178 | } | 176 | } |
| 179 | 177 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
| 1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.graphics.Color; | 4 | import android.graphics.Color; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
| 8 | import android.view.Gravity; | 8 | import android.view.Gravity; |
| 9 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
| 10 | import android.view.View; | 10 | import android.view.View; |
| 11 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
| 12 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
| 13 | import android.widget.EditText; | 13 | import android.widget.EditText; |
| 14 | import android.widget.TextView; | 14 | import android.widget.TextView; |
| 15 | 15 | ||
| 16 | import com.bigkoo.pickerview.TimePickerView; | 16 | import com.bigkoo.pickerview.TimePickerView; |
| 17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
| 18 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 18 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
| 19 | import com.hjx.personalcenter.customdialog.CountryDialog; | 19 | import com.hjx.personalcenter.customdialog.CountryDialog; |
| 20 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 20 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
| 21 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 21 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 22 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 22 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
| 23 | import com.hjx.personalcenter.db.SaveParam; | 23 | import com.hjx.personalcenter.db.SaveParam; |
| 24 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
| 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 26 | import com.hjx.personalcenter.model.CityInfo; | 26 | import com.hjx.personalcenter.model.CityInfo; |
| 27 | import com.hjx.personalcenter.model.CountyInfo; | 27 | import com.hjx.personalcenter.model.CountyInfo; |
| 28 | import com.hjx.personalcenter.model.GradeInfo; | 28 | import com.hjx.personalcenter.model.GradeInfo; |
| 29 | import com.hjx.personalcenter.model.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.util.AlertUtils; | 31 | import com.hjx.personalcenter.util.AlertUtils; |
| 32 | import com.hjx.personalcenter.util.BrithdayStar; | 32 | import com.hjx.personalcenter.util.BrithdayStar; |
| 33 | import com.hjx.personalcenter.util.GetDevicesUtil; | 33 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 34 | import com.mylhyl.circledialog.CircleDialog; | 34 | import com.mylhyl.circledialog.CircleDialog; |
| 35 | import com.mylhyl.circledialog.callback.ConfigDialog; | 35 | import com.mylhyl.circledialog.callback.ConfigDialog; |
| 36 | import com.mylhyl.circledialog.params.DialogParams; | 36 | import com.mylhyl.circledialog.params.DialogParams; |
| 37 | 37 | ||
| 38 | import org.apache.http.util.TextUtils; | 38 | import org.apache.http.util.TextUtils; |
| 39 | 39 | ||
| 40 | import java.text.SimpleDateFormat; | 40 | import java.text.SimpleDateFormat; |
| 41 | import java.util.ArrayList; | 41 | import java.util.ArrayList; |
| 42 | import java.util.Date; | 42 | import java.util.Date; |
| 43 | 43 | ||
| 44 | /** | 44 | /** |
| 45 | * Created by h on 2017/8/12. | 45 | * Created by h on 2017/8/12. |
| 46 | */ | 46 | */ |
| 47 | 47 | ||
| 48 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 48 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
| 49 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 49 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
| 50 | private View mView; | 50 | private View mView; |
| 51 | private int type; | 51 | private int type; |
| 52 | private TimePickerView pvTime; | 52 | private TimePickerView pvTime; |
| 53 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; | 53 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
| 54 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; | 54 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; |
| 55 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 55 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
| 56 | 56 | ||
| 57 | public static PresonInfoFragment newInstance(int type) { | 57 | public static PresonInfoFragment newInstance(int type) { |
| 58 | PresonInfoFragment fragment = new PresonInfoFragment(); | 58 | PresonInfoFragment fragment = new PresonInfoFragment(); |
| 59 | Bundle bundle = new Bundle(); | 59 | Bundle bundle = new Bundle(); |
| 60 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 60 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
| 61 | fragment.setArguments(bundle); | 61 | fragment.setArguments(bundle); |
| 62 | return fragment; | 62 | return fragment; |
| 63 | 63 | ||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | @Override | 66 | @Override |
| 67 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 67 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 68 | if (mView == null) { | 68 | if (mView == null) { |
| 69 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 69 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
| 70 | initView(mView); | 70 | initView(mView); |
| 71 | initData(); | 71 | initData(); |
| 72 | setLister(); | 72 | setLister(); |
| 73 | initTimePicker(); | 73 | initTimePicker(); |
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | } | 76 | } |
| 77 | return mView; | 77 | return mView; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | //初始化 | 80 | //初始化 |
| 81 | private void initView(View mView) { | 81 | private void initView(View mView) { |
| 82 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 82 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
| 83 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 83 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
| 84 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 84 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
| 85 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 85 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
| 86 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 86 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
| 87 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 87 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
| 88 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 88 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
| 89 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 89 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | private void initData() { | 94 | private void initData() { |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | private void setLister() { | 97 | private void setLister() { |
| 98 | tv_sex.setOnClickListener(this); | 98 | tv_sex.setOnClickListener(this); |
| 99 | tv_useinfo_adress.setOnClickListener(this); | 99 | tv_useinfo_adress.setOnClickListener(this); |
| 100 | tv_useinfo_birthday.setOnClickListener(this); | 100 | tv_useinfo_birthday.setOnClickListener(this); |
| 101 | tv_useinfo_school.setOnClickListener(this); | 101 | tv_useinfo_school.setOnClickListener(this); |
| 102 | tv_useinfo_gender.setOnClickListener(this); | 102 | tv_useinfo_gender.setOnClickListener(this); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | @Override | 105 | @Override |
| 106 | public void onClick(View v) { | 106 | public void onClick(View v) { |
| 107 | String presonal1 = tv_username1.getText().toString().trim(); | 107 | String presonal1 = tv_username1.getText().toString().trim(); |
| 108 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | 108 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); |
| 109 | String presonal3 = tv_sex.getText().toString().trim(); | 109 | String presonal3 = tv_sex.getText().toString().trim(); |
| 110 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | 110 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); |
| 111 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | 111 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); |
| 112 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | 112 | String presonal6 = tv_useinfo_school.getText().toString().trim(); |
| 113 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | 113 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); |
| 114 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | 114 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); |
| 115 | switch (v.getId()) { | 115 | switch (v.getId()) { |
| 116 | case R.id.tv_sex: | 116 | case R.id.tv_sex: |
| 117 | final String[] items = {"男", "女"}; | 117 | final String[] items = {"男", "女"}; |
| 118 | new CircleDialog.Builder(getActivity()) | 118 | new CircleDialog.Builder(getActivity()) |
| 119 | .configDialog(new ConfigDialog() { | 119 | .configDialog(new ConfigDialog() { |
| 120 | @Override | 120 | @Override |
| 121 | public void onConfig(DialogParams params) { | 121 | public void onConfig(DialogParams params) { |
| 122 | //增加弹出动画 | 122 | //增加弹出动画 |
| 123 | params.gravity = Gravity.CENTER; | 123 | params.gravity = Gravity.CENTER; |
| 124 | } | 124 | } |
| 125 | }) | 125 | }) |
| 126 | .setTitle("请选择性别") | 126 | .setTitle("请选择性别") |
| 127 | .setWidth(0.5f) | 127 | .setWidth(0.5f) |
| 128 | .setItems(items, new AdapterView.OnItemClickListener() { | 128 | .setItems(items, new AdapterView.OnItemClickListener() { |
| 129 | @Override | 129 | @Override |
| 130 | public void onItemClick(AdapterView<?> parent, View view, int | 130 | public void onItemClick(AdapterView<?> parent, View view, int |
| 131 | position, long id) { | 131 | position, long id) { |
| 132 | switch (position) { | 132 | switch (position) { |
| 133 | case 0: | 133 | case 0: |
| 134 | tv_sex.setText("男"); | 134 | tv_sex.setText("男"); |
| 135 | break; | 135 | break; |
| 136 | case 1: | 136 | case 1: |
| 137 | tv_sex.setText("女"); | 137 | tv_sex.setText("女"); |
| 138 | break; | 138 | break; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | } | 141 | } |
| 142 | }) | 142 | }) |
| 143 | .show(); | 143 | .show(); |
| 144 | break; | 144 | break; |
| 145 | case R.id.tv_useinfo_adress: | 145 | case R.id.tv_useinfo_adress: |
| 146 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); | 146 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
| 147 | break; | 147 | break; |
| 148 | case R.id.tv_useinfo_birthday: | 148 | case R.id.tv_useinfo_birthday: |
| 149 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 149 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
| 150 | break; | 150 | break; |
| 151 | case R.id.tv_useinfo_school: | 151 | case R.id.tv_useinfo_school: |
| 152 | if (TextUtils.isEmpty(presonal4) || | 152 | if (TextUtils.isEmpty(presonal4) || |
| 153 | TextUtils.isEmpty(presonal7)) { | 153 | TextUtils.isEmpty(presonal7)) { |
| 154 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | 154 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); |
| 155 | return; | 155 | return; |
| 156 | } else { | 156 | } else { |
| 157 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | 157 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | 160 | ||
| 161 | break; | 161 | break; |
| 162 | case R.id.tv_useinfo_gender: | 162 | case R.id.tv_useinfo_gender: |
| 163 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); | 163 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
| 164 | break; | 164 | break; |
| 165 | case R.id.presonal_sub: | 165 | case R.id.presonal_sub: |
| 166 | if (TextUtils.isEmpty(presonal1) || | 166 | if (TextUtils.isEmpty(presonal1) || |
| 167 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || | 167 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || |
| 168 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || | 168 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || |
| 169 | TextUtils.isEmpty(presonal8)) { | 169 | TextUtils.isEmpty(presonal8)) { |
| 170 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); | 170 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
| 171 | return; | 171 | return; |
| 172 | } else { | 172 | } else { |
| 173 | 173 | ||
| 174 | int a = 0, b = 0; | 174 | int a = 0, b = 0; |
| 175 | int d =1; | 175 | int d = 1; |
| 176 | Object schoolids; | ||
| 176 | Long f = null; | 177 | Long f = null; |
| 177 | //保存星座 | 178 | //保存星座 |
| 178 | BrithdayStar brithdayStar = new BrithdayStar(); | 179 | BrithdayStar brithdayStar = new BrithdayStar(); |
| 179 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | 180 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); |
| 180 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); | 181 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); |
| 181 | 182 | ||
| 182 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); | 183 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); |
| 183 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 184 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
| 184 | if (regionId == null) { | 185 | if (regionId == null) { |
| 185 | regionId = regionId1; | 186 | regionId = regionId1; |
| 186 | } | 187 | } |
| 187 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 188 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
| 188 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | 189 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); |
| 189 | String type = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.ACCOUNT); | 190 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
| 190 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 191 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
| 191 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | 192 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); |
| 192 | String changeinfo = null; | 193 | String changeinfo = null; |
| 193 | if ("男".equals(presonal3)) { | 194 | if ("男".equals(presonal3)) { |
| 194 | changeinfo="male"; | 195 | changeinfo = "male"; |
| 195 | } else { | 196 | } else { |
| 196 | changeinfo=("female"); | 197 | changeinfo = "female"; |
| 197 | } | 198 | } |
| 198 | try { | 199 | try { |
| 199 | Object c ; | ||
| 200 | a = Integer.parseInt(regionId); | 200 | a = Integer.parseInt(regionId); |
| 201 | b = Integer.parseInt(grade); | 201 | b = Integer.parseInt(grade); |
| 202 | 202 | if (TextUtils.isEmpty(presonal6)) { | |
| 203 | if (TextUtils.isEmpty(presonal6)){ | 203 | schoolids = null; |
| 204 | c = null; | 204 | } else { |
| 205 | }else { | 205 | schoolids = Long.parseLong(schoolid); |
| 206 | c = Long.parseLong(schoolid); | ||
| 207 | } | 206 | } |
| 208 | d = Integer.parseInt(type); | 207 | d = Integer.parseInt(type); |
| 209 | f = Long.parseLong(userID); | 208 | f = Long.parseLong(userID); |
| 210 | //提交个人信息 | 209 | //提交个人信息 |
| 211 | HttpManager.getInstance().changepresonalinfo(getActivity(), | 210 | HttpManager.getInstance().changepresonalinfo(getActivity(), |
| 212 | f,d,presonal1,presonal5,b, a,c,presonal8,changeinfo,presonal4 + presonal2,devicenumber); | 211 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 + presonal2, devicenumber); |
| 213 | 212 | ||
| 214 | } catch (Exception e) { | 213 | } catch (Exception e) { |
| 215 | e.printStackTrace(); | 214 | e.printStackTrace(); |
| 216 | } | 215 | } |
| 217 | 216 | ||
| 218 | break; | 217 | break; |
| 219 | } | 218 | } |
| 220 | } | 219 | } |
| 221 | } | 220 | } |
| 222 | 221 | ||
| 223 | //自定义时间选择器 | 222 | //自定义时间选择器 |
| 224 | private void initTimePicker() { | 223 | private void initTimePicker() { |
| 225 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 224 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
| 226 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 225 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
| 227 | // Calendar selectedDate = Calendar.getInstance(); | 226 | // Calendar selectedDate = Calendar.getInstance(); |
| 228 | // Calendar startDate = Calendar.getInstance(); | 227 | // Calendar startDate = Calendar.getInstance(); |
| 229 | // startDate.set(1900, 1, 1); | 228 | // startDate.set(1900, 1, 1); |
| 230 | // Calendar endDate = Calendar.getInstance(); | 229 | // Calendar endDate = Calendar.getInstance(); |
| 231 | // endDate.set(2100, 1, 1); | 230 | // endDate.set(2100, 1, 1); |
| 232 | //时间选择器 | 231 | //时间选择器 |
| 233 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 232 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
| 234 | @Override | 233 | @Override |
| 235 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 234 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
| 236 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 235 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
| 237 | /*btn_Time.setText(getTime(date));*/ | 236 | /*btn_Time.setText(getTime(date));*/ |
| 238 | TextView btn = (TextView) v; | 237 | TextView btn = (TextView) v; |
| 239 | btn.setText(getTime(date)); | 238 | btn.setText(getTime(date)); |
| 240 | } | 239 | } |
| 241 | }) | 240 | }) |
| 242 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 241 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
| 243 | .setType(new boolean[]{true, true, true, false, false, false}) | 242 | .setType(new boolean[]{true, true, true, false, false, false}) |
| 244 | .setLabel("", "", "", "", "", "") | 243 | .setLabel("", "", "", "", "", "") |
| 245 | .isCenterLabel(false) | 244 | .isCenterLabel(false) |
| 246 | .setDividerColor(Color.DKGRAY) | 245 | .setDividerColor(Color.DKGRAY) |
| 247 | .setContentSize(21) | 246 | .setContentSize(21) |
| 248 | // .setDate(selectedDate) | 247 | // .setDate(selectedDate) |
| 249 | // .setRangDate(startDate, endDate) | 248 | // .setRangDate(startDate, endDate) |
| 250 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 249 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
| 251 | .setDecorView(null) | 250 | .setDecorView(null) |
| 252 | .setTitleText("出生日期") | 251 | .setTitleText("出生日期") |
| 253 | .setTitleSize(22) | 252 | .setTitleSize(22) |
| 254 | .setCancelColor(Color.GRAY) | 253 | .setCancelColor(Color.GRAY) |
| 255 | .setSubCalSize(22) | 254 | .setSubCalSize(22) |
| 256 | .setDividerColor(Color.GRAY) | 255 | .setDividerColor(Color.GRAY) |
| 257 | .setSubmitColor(Color.GRAY) | 256 | .setSubmitColor(Color.GRAY) |
| 258 | .build(); | 257 | .build(); |
| 259 | } | 258 | } |
| 260 | 259 | ||
| 261 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 260 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
| 262 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 261 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| 263 | return format.format(date); | 262 | return format.format(date); |
| 264 | } | 263 | } |
| 265 | 264 | ||
| 266 | @Override | 265 | @Override |
| 267 | public void onAttach(Activity activity) { | 266 | public void onAttach(Activity activity) { |
| 268 | super.onAttach(activity); | 267 | super.onAttach(activity); |
| 269 | View rootView = activity.getWindow().getDecorView(); | 268 | View rootView = activity.getWindow().getDecorView(); |
| 270 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | 269 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); |
| 271 | sub.setOnClickListener(this); | 270 | sub.setOnClickListener(this); |
| 272 | } | 271 | } |
| 273 | 272 | ||
| 274 | @Override | 273 | @Override |
| 275 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 274 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
| 276 | String regionName = data.get(position).getRegionName(); | 275 | String regionName = data.get(position).getRegionName(); |
| 277 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 276 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
| 278 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | 277 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); |
| 279 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | 278 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); |
| 280 | tv_useinfo_adress.setText(""); | 279 | tv_useinfo_adress.setText(""); |
| 281 | tv_useinfo_adress.setText(provice + regionName); | 280 | tv_useinfo_adress.setText(provice + regionName); |
| 282 | 281 | ||
| 283 | 282 | ||
| 284 | } | 283 | } |
| 285 | 284 | ||
| 286 | @Override | 285 | @Override |
| 287 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 286 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
| 288 | String regionName = data.get(position).getRegionName(); | 287 | String regionName = data.get(position).getRegionName(); |
| 289 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 288 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
| 290 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); | 289 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); |
| 291 | tv_useinfo_adress.setText(""); | 290 | tv_useinfo_adress.setText(""); |
| 292 | tv_useinfo_adress.setText(provices + citys + regionName); | 291 | tv_useinfo_adress.setText(provices + citys + regionName); |
| 293 | 292 | ||
| 294 | } | 293 | } |
| 295 | 294 | ||
| 296 | @Override | 295 | @Override |
| 297 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 296 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
| 298 | String regionName = data.get(position).getName(); | 297 | String regionName = data.get(position).getName(); |
| 299 | tv_useinfo_gender.setText(regionName); | 298 | tv_useinfo_gender.setText(regionName); |
| 300 | } | 299 | } |
| 301 | 300 | ||
| 302 | @Override | 301 | @Override |
| 303 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 302 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
| 304 | String regionName = data.get(position).getRegionName(); | 303 | String regionName = data.get(position).getRegionName(); |
| 305 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); | 304 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); |
| 306 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); | 305 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); |
| 307 | 306 | tv_useinfo_adress.setText(""); | |
| 307 | tv_useinfo_adress.setText(regionName); | ||
| 308 | } | 308 | } |
| 309 | 309 | ||
| 310 | @Override | 310 | @Override |
| 311 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 311 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
| 312 | String regionName = data.get(position).getSchoolName(); | 312 | String regionName = data.get(position).getSchoolName(); |
| 313 | tv_useinfo_school.setText(regionName); | 313 | tv_useinfo_school.setText(regionName); |
| 314 | 314 | ||
| 315 | 315 | ||
| 316 | } | 316 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/RegisterFragment.java
| 1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | import android.os.Message; | 6 | import android.os.Message; |
| 7 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
| 8 | import android.support.v4.app.Fragment; | 8 | import android.support.v4.app.Fragment; |
| 9 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
| 10 | import android.text.method.HideReturnsTransformationMethod; | 10 | import android.text.method.HideReturnsTransformationMethod; |
| 11 | import android.text.method.PasswordTransformationMethod; | 11 | import android.text.method.PasswordTransformationMethod; |
| 12 | import android.view.LayoutInflater; | 12 | import android.view.LayoutInflater; |
| 13 | import android.view.View; | 13 | import android.view.View; |
| 14 | import android.view.ViewGroup; | 14 | import android.view.ViewGroup; |
| 15 | import android.widget.Button; | 15 | import android.widget.Button; |
| 16 | import android.widget.EditText; | 16 | import android.widget.EditText; |
| 17 | import android.widget.ImageView; | 17 | import android.widget.ImageView; |
| 18 | 18 | ||
| 19 | import com.hjx.personalcenter.R; | 19 | import com.hjx.personalcenter.R; |
| 20 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | 20 | import com.hjx.personalcenter.activity.RegisterInfoActivity; |
| 21 | import com.hjx.personalcenter.db.Content; | 21 | import com.hjx.personalcenter.db.Content; |
| 22 | import com.hjx.personalcenter.http.HttpCode; | 22 | import com.hjx.personalcenter.http.HttpCode; |
| 23 | import com.hjx.personalcenter.http.HttpManager; | 23 | import com.hjx.personalcenter.http.HttpManager; |
| 24 | import com.hjx.personalcenter.util.AlertUtils; | 24 | import com.hjx.personalcenter.util.AlertUtils; |
| 25 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 25 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
| 26 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 26 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
| 27 | 27 | ||
| 28 | import org.json.JSONException; | 28 | import org.json.JSONException; |
| 29 | import org.json.JSONObject; | 29 | import org.json.JSONObject; |
| 30 | 30 | ||
| 31 | import java.util.TimerTask; | ||
| 32 | |||
| 31 | /** | 33 | /** |
| 32 | * 注册 | 34 | * 注册 |
| 33 | * Created by Administrator on 2016/11/7. | 35 | * Created by Administrator on 2016/11/7. |
| 34 | */ | 36 | */ |
| 35 | 37 | ||
| 36 | public class RegisterFragment extends Fragment implements View.OnClickListener { | 38 | public class RegisterFragment extends Fragment implements View.OnClickListener { |
| 37 | private View mView; | 39 | private View mView; |
| 38 | 40 | ||
| 39 | private Button btn_register,get_authcode; | 41 | private Button btn_register,get_authcode; |
| 40 | private EditText phonenumber,password,anth_6num;//;//密码 | 42 | private EditText phonenumber,password,anth_6num;//;//密码 |
| 41 | private ImageView openeyes; | 43 | private ImageView openeyes; |
| 42 | private String sourceStr ="android"; | 44 | private String sourceStr ="android"; |
| 43 | private String typeStr = "register"; | 45 | private String typeStr = "register"; |
| 44 | private int i = 0; | 46 | private int delayTime=60; |
| 45 | private Thread thread; | 47 | private java.util.Timer Delaytimer; |
| 46 | private int type; | 48 | private int type; |
| 47 | public static Boolean showPassword = false; | 49 | public static Boolean showPassword = false; |
| 48 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 50 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
| 49 | 51 | ||
| 50 | public static RegisterFragment newInstance(int type) { | 52 | public static RegisterFragment newInstance(int type) { |
| 51 | RegisterFragment fragment = new RegisterFragment(); | 53 | RegisterFragment fragment = new RegisterFragment(); |
| 52 | Bundle bundle = new Bundle(); | 54 | Bundle bundle = new Bundle(); |
| 53 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 55 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
| 54 | fragment.setArguments(bundle); | 56 | fragment.setArguments(bundle); |
| 55 | return fragment; | 57 | return fragment; |
| 56 | 58 | ||
| 57 | } | 59 | } |
| 58 | Handler handler = new Handler() { | 60 | Handler handler = new Handler() { |
| 59 | @Override | 61 | @Override |
| 60 | public void handleMessage(Message msg) { | 62 | public void handleMessage(Message msg) { |
| 61 | super.handleMessage(msg); | 63 | super.handleMessage(msg); |
| 62 | try { | 64 | try { |
| 63 | JSONObject jsonObject; | 65 | JSONObject jsonObject; |
| 64 | String status; | 66 | String status; |
| 65 | switch (msg.what) { | 67 | switch (msg.what) { |
| 66 | case HttpCode.REGISTERED_SUCESS: | 68 | case HttpCode.REGISTERED_SUCESS: |
| 67 | jsonObject = (JSONObject) msg.obj; | 69 | jsonObject = (JSONObject) msg.obj; |
| 68 | status = jsonObject.getString("status"); | 70 | status = jsonObject.getString("status"); |
| 69 | //AlertUtils.showToast(RegisterActivity.this, jsonObject.optString("message")); | 71 | //AlertUtils.showToast(RegisterActivity.this, jsonObject.optString("message")); |
| 70 | String access_token = jsonObject.getString("access_token"); | 72 | String access_token = jsonObject.getString("access_token"); |
| 71 | String userId = jsonObject.getString("userId"); | 73 | String userId = jsonObject.getString("userId"); |
| 72 | if (status.equals("100")) { | 74 | if (status.equals("100")) { |
| 73 | String usernameStr = phonenumber.getText().toString().trim(); | 75 | String usernameStr = phonenumber.getText().toString().trim(); |
| 74 | String passwordStr = password.getText().toString().trim(); | 76 | String passwordStr = password.getText().toString().trim(); |
| 75 | //HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,"true",userId); | 77 | HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,"true",userId); |
| 76 | AlertUtils.showToast(getActivity(), "注册成功!"); | 78 | AlertUtils.showToast(getActivity(), "注册成功!"); |
| 77 | Content.accountflag =1; | 79 | Content.accountflag =1; |
| 78 | //检查信息是否填写完整 | 80 | //检查信息是否填写完整 |
| 79 | Intent intent = new Intent(); | 81 | Intent intent = new Intent(); |
| 80 | intent.setClass(getActivity(),RegisterInfoActivity.class); | 82 | intent.setClass(getActivity(),RegisterInfoActivity.class); |
| 81 | startActivity(intent); | 83 | startActivity(intent); |
| 82 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 84 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 83 | getActivity().finish(); | 85 | getActivity().finish(); |
| 84 | } | 86 | } |
| 85 | break; | 87 | break; |
| 86 | case HttpCode.REGISTERED_FAIL: | 88 | case HttpCode.REGISTERED_FAIL: |
| 87 | AlertUtils.showToast(getActivity(), "注册失败"); | 89 | AlertUtils.showToast(getActivity(), "注册失败"); |
| 88 | break; | 90 | break; |
| 89 | case HttpCode.AUTHCODE_SUCESS: | 91 | case HttpCode.AUTHCODE_SUCESS: |
| 90 | jsonObject = (JSONObject) msg.obj; | 92 | jsonObject = (JSONObject) msg.obj; |
| 91 | status = jsonObject.optString("status"); | 93 | status = jsonObject.optString("status"); |
| 92 | if (status.equals("100")) { | 94 | if (status.equals("100")) { |
| 93 | AlertUtils.showToast(getActivity(), "验证码发送成功"); | 95 | AlertUtils.showToast(getActivity(), "验证码发送成功"); |
| 94 | } | 96 | } |
| 95 | 97 | ||
| 96 | break; | 98 | break; |
| 97 | case HttpCode.AUTHCODE_FAIL: | 99 | case HttpCode.AUTHCODE_FAIL: |
| 98 | jsonObject = (JSONObject) msg.obj; | 100 | jsonObject = (JSONObject) msg.obj; |
| 99 | AlertUtils.showToast(getActivity(), "验证码发送失败"); | 101 | AlertUtils.showToast(getActivity(), "验证码发送失败"); |
| 100 | break; | 102 | break; |
| 101 | case HttpCode.IS_REFISTER: | 103 | case HttpCode.IS_REFISTER: |
| 102 | jsonObject = (JSONObject) msg.obj; | 104 | jsonObject = (JSONObject) msg.obj; |
| 103 | status = jsonObject.getString("status"); | 105 | status = jsonObject.getString("status"); |
| 104 | if (!status.equals("true")) { | 106 | if (!status.equals("true")) { |
| 105 | getauthcode(); | 107 | getauthcode(); |
| 106 | 108 | ||
| 107 | }else { | 109 | }else { |
| 108 | AlertUtils.showToast(getActivity(), "该手机号已经注册过了"); | 110 | AlertUtils.showToast(getActivity(), "该手机号已经注册过了"); |
| 109 | } | 111 | } |
| 110 | break; | 112 | break; |
| 111 | case 1: | 113 | case 21: |
| 112 | get_authcode.setEnabled(false); | 114 | if(delayTime<=0){ |
| 113 | get_authcode.setClickable(false); | 115 | if(Delaytimer!=null){ |
| 114 | get_authcode.setText(Integer.toString(i--)+" s"); | 116 | Delaytimer.cancel(); |
| 115 | if (i<=0){ | 117 | } |
| 116 | get_authcode.setEnabled(true); | 118 | get_authcode.setEnabled(true); |
| 117 | get_authcode.setClickable(true); | 119 | get_authcode.setClickable(true); |
| 118 | get_authcode.setText("获取验证码"); | 120 | get_authcode.setText("获取验证码"); |
| 121 | delayTime=60; | ||
| 122 | }else{ | ||
| 123 | get_authcode.setEnabled(false); | ||
| 124 | get_authcode.setClickable(false); | ||
| 125 | get_authcode.setText(delayTime + " s"); | ||
| 119 | } | 126 | } |
| 120 | break; | 127 | break; |
| 121 | } | 128 | } |
| 122 | } catch (JSONException e) { | 129 | } catch (JSONException e) { |
| 123 | e.printStackTrace(); | 130 | e.printStackTrace(); |
| 124 | } | 131 | } |
| 125 | } | 132 | } |
| 126 | }; | 133 | }; |
| 127 | @Override | 134 | @Override |
| 128 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 135 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 129 | if (mView == null) { | 136 | if (mView == null) { |
| 130 | mView = inflater.inflate(R.layout.fragment_loginandregister_register, container, false); | 137 | mView = inflater.inflate(R.layout.fragment_loginandregister_register, container, false); |
| 131 | initView(mView); | 138 | initView(mView); |
| 132 | initData(); | 139 | initData(); |
| 133 | setLister(); | 140 | setLister(); |
| 134 | 141 | ||
| 135 | 142 | ||
| 136 | } | 143 | } |
| 137 | return mView; | 144 | return mView; |
| 138 | } | 145 | } |
| 139 | 146 | ||
| 140 | private void initView(View mView) { | 147 | private void initView(View mView) { |
| 141 | get_authcode = (Button) mView.findViewById(R.id.btn_authcode); | 148 | get_authcode = (Button) mView.findViewById(R.id.btn_authcode); |
| 142 | anth_6num = (EditText) mView.findViewById(R.id.et_authcode); | 149 | anth_6num = (EditText) mView.findViewById(R.id.et_authcode); |
| 143 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); | 150 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); |
| 144 | password = (EditText) mView.findViewById(R.id.et_password); | 151 | password = (EditText) mView.findViewById(R.id.et_password); |
| 145 | openeyes= (ImageView) mView.findViewById(R.id.iv_pwd_change); | 152 | openeyes= (ImageView) mView.findViewById(R.id.iv_pwd_change); |
| 146 | btn_register = (Button) mView.findViewById(R.id.btn_register); | 153 | btn_register = (Button) mView.findViewById(R.id.btn_register); |
| 147 | 154 | ||
| 148 | } | 155 | } |
| 149 | private void initData() { | 156 | private void initData() { |
| 150 | } | 157 | } |
| 151 | private void setLister() { | 158 | private void setLister() { |
| 152 | get_authcode.setOnClickListener(this); | 159 | get_authcode.setOnClickListener(this); |
| 153 | openeyes.setOnClickListener(this); | 160 | openeyes.setOnClickListener(this); |
| 154 | btn_register.setOnClickListener(this); | 161 | btn_register.setOnClickListener(this); |
| 155 | } | 162 | } |
| 156 | 163 | ||
| 157 | 164 | ||
| 158 | @Override | 165 | @Override |
| 159 | public void onClick(View v) { | 166 | public void onClick(View v) { |
| 160 | switch (v.getId()){ | 167 | switch (v.getId()){ |
| 161 | case R.id.btn_register: | 168 | case R.id.btn_register: |
| 162 | //测试 | 169 | //测试 |
| 163 | // | 170 | // |
| 164 | 171 | ||
| 165 | String usernameStr = phonenumber.getText().toString().trim(); | 172 | String usernameStr = phonenumber.getText().toString().trim(); |
| 166 | String authcodeStr = anth_6num.getText().toString().trim(); | 173 | String authcodeStr = anth_6num.getText().toString().trim(); |
| 167 | String passwordStr = password.getText().toString().trim(); | 174 | String passwordStr = password.getText().toString().trim(); |
| 168 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)||TextUtils.isEmpty(passwordStr)) { | 175 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)||TextUtils.isEmpty(passwordStr)) { |
| 169 | AlertUtils.showToast(getActivity(), "手机号,密码和验证码不能为空"); | 176 | AlertUtils.showToast(getActivity(), "手机号,密码和验证码不能为空"); |
| 170 | return; | 177 | return; |
| 171 | } else if(passwordStr.length()<8){ | 178 | } else if(passwordStr.length()<8){ |
| 172 | AlertUtils.showToast(getActivity(), "密码不能少于8位"); | 179 | AlertUtils.showToast(getActivity(), "密码不能少于8位"); |
| 173 | }else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 180 | }else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ |
| 174 | AlertUtils.showToast(getActivity(), "手机号码输入错误"); | 181 | AlertUtils.showToast(getActivity(), "手机号码输入错误"); |
| 175 | 182 | ||
| 176 | }else if(!passwordStr.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ | 183 | }else if(!passwordStr.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ |
| 177 | AlertUtils.showToast(getActivity(), "密码由英文和数字组成"); | 184 | AlertUtils.showToast(getActivity(), "密码由英文和数字组成"); |
| 178 | }else { | 185 | }else { |
| 179 | register(); | 186 | register(); |
| 180 | } | 187 | } |
| 181 | 188 | ||
| 182 | break; | 189 | break; |
| 183 | case R.id.iv_pwd_change: | 190 | case R.id.iv_pwd_change: |
| 184 | if(showPassword){//显示密码 | 191 | if(showPassword){//显示密码 |
| 185 | showPassword = !showPassword; | 192 | showPassword = !showPassword; |
| 186 | openeyes.setImageResource(R.mipmap.pwd_open); | 193 | openeyes.setImageResource(R.mipmap.pwd_open); |
| 187 | password.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 194 | password.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
| 188 | password.setSelection(password.getText().toString().length()); | 195 | password.setSelection(password.getText().toString().length()); |
| 189 | }else{//隐藏密码 | 196 | }else{//隐藏密码 |
| 190 | showPassword = !showPassword; | 197 | showPassword = !showPassword; |
| 191 | openeyes.setImageResource(R.mipmap.pwd_hide); | 198 | openeyes.setImageResource(R.mipmap.pwd_hide); |
| 192 | password.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 199 | password.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
| 193 | password.setSelection(password.getText().toString().length()); | 200 | password.setSelection(password.getText().toString().length()); |
| 194 | } | 201 | } |
| 195 | break; | 202 | break; |
| 196 | case R.id.btn_authcode: | 203 | case R.id.btn_authcode: |
| 197 | usernameStr = phonenumber.getText().toString().trim(); | 204 | usernameStr = phonenumber.getText().toString().trim(); |
| 198 | if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 205 | if (!PhoneNumCheckUtils.isPhone(usernameStr)){ |
| 199 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); | 206 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); |
| 200 | }else { | 207 | }else { |
| 201 | anth_6num.requestFocus(); | 208 | anth_6num.requestFocus(); |
| 202 | ifregister(); | 209 | ifregister(); |
| 203 | } | 210 | } |
| 204 | 211 | ||
| 205 | break; | 212 | break; |
| 206 | } | 213 | } |
| 207 | 214 | ||
| 208 | } | 215 | } |
| 209 | //获取验证码 | 216 | //获取验证码 |
| 210 | private void getauthcode() { | 217 | private void getauthcode() { |
| 211 | String usernameStr = phonenumber.getText().toString().trim(); | 218 | String usernameStr = phonenumber.getText().toString().trim(); |
| 212 | HttpManager.getInstance().authCode(typeStr, usernameStr, handler, getActivity()); | 219 | HttpManager.getInstance().authCode(typeStr, usernameStr, handler, getActivity()); |
| 213 | i = 60; | 220 | valiDelay(); |
| 214 | if(thread == null){ | ||
| 215 | thread = new Thread( new ThreadShow()); | ||
| 216 | thread.start(); | ||
| 217 | } | ||
| 218 | } | 221 | } |
| 219 | 222 | ||
| 220 | private void ifregister() { | 223 | private void ifregister() { |
| 221 | String usernameStr = phonenumber.getText().toString().trim(); | 224 | String usernameStr = phonenumber.getText().toString().trim(); |
| 222 | HttpManager.getInstance().isregistered(usernameStr, handler, getActivity()); | 225 | HttpManager.getInstance().isregistered(usernameStr, handler, getActivity()); |
| 223 | } | 226 | } |
| 224 | 227 | ||
| 225 | private void register() { | 228 | private void register() { |
| 226 | String usernameStr = phonenumber.getText().toString().trim(); | 229 | String usernameStr = phonenumber.getText().toString().trim(); |
| 227 | String authcodeStr = anth_6num.getText().toString().trim(); | 230 | String authcodeStr = anth_6num.getText().toString().trim(); |
| 228 | String passwordStr = password.getText().toString().trim(); | 231 | String passwordStr = password.getText().toString().trim(); |
| 229 | HttpManager.getInstance().register(getActivity(), usernameStr, passwordStr, authcodeStr, sourceStr,handler); | 232 | HttpManager.getInstance().register(getActivity(), usernameStr, passwordStr, authcodeStr, sourceStr,handler); |
| 230 | } | 233 | } |
| 231 | // 线程类 定时器 | 234 | // 线程类 定时器 |
| 232 | class ThreadShow implements Runnable { | 235 | public void valiDelay() { |
| 233 | 236 | ||
| 234 | @Override | 237 | Delaytimer = new java.util.Timer(true); |
| 235 | public void run() { | 238 | |
| 236 | // TODO Auto-generated method stub | 239 | |
| 237 | while (true) { | 240 | TimerTask task = new TimerTask() { |
| 238 | try { | 241 | public void run() { |
| 239 | Thread.sleep(1000); | 242 | //每次需要执行的代码放到这里面。 |
| 240 | Message msg = new Message(); | 243 | delayTime--; |
| 241 | msg.what = 1; | 244 | handler.sendEmptyMessage(21); |
| 242 | handler.sendMessage(msg); | ||
| 243 | System.out.println("send..."); | ||
| 244 | } catch (Exception e) { | ||
| 245 | // TODO Auto-generated catch block | ||
| 246 | e.printStackTrace(); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
| 1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.app.ProgressDialog; | 4 | import android.app.ProgressDialog; |
| 5 | import android.content.Context; | 5 | import android.content.Context; |
| 6 | import android.content.Intent; | 6 | import android.content.Intent; |
| 7 | import android.os.Handler; | 7 | import android.os.Handler; |
| 8 | import android.os.Message; | 8 | import android.os.Message; |
| 9 | import android.provider.Settings; | 9 | import android.provider.Settings; |
| 10 | import android.support.v4.app.FragmentActivity; | 10 | import android.support.v4.app.FragmentActivity; |
| 11 | import android.util.Log; | 11 | import android.util.Log; |
| 12 | import android.view.Gravity; | 12 | import android.view.Gravity; |
| 13 | import android.view.View; | 13 | import android.view.View; |
| 14 | import android.widget.Toast; | 14 | import android.widget.Toast; |
| 15 | 15 | ||
| 16 | import com.google.gson.Gson; | 16 | import com.google.gson.Gson; |
| 17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
| 18 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 18 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
| 19 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 19 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
| 20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
| 21 | import com.hjx.personalcenter.gson.GsonTool; | 21 | import com.hjx.personalcenter.gson.GsonTool; |
| 22 | import com.hjx.personalcenter.model.AppVersion; | 22 | import com.hjx.personalcenter.model.AppVersion; |
| 23 | import com.hjx.personalcenter.model.CardInfo; | 23 | import com.hjx.personalcenter.model.CardInfo; |
| 24 | import com.hjx.personalcenter.model.ChildsInfo; | 24 | import com.hjx.personalcenter.model.ChildsInfo; |
| 25 | import com.hjx.personalcenter.model.CityInfo; | 25 | import com.hjx.personalcenter.model.CityInfo; |
| 26 | import com.hjx.personalcenter.model.CountyInfo; | 26 | import com.hjx.personalcenter.model.CountyInfo; |
| 27 | import com.hjx.personalcenter.model.GradeInfo; | 27 | import com.hjx.personalcenter.model.GradeInfo; |
| 28 | import com.hjx.personalcenter.model.PesonalInfo; | 28 | import com.hjx.personalcenter.model.PesonalInfo; |
| 29 | import com.hjx.personalcenter.model.ProvinceInfo; | 29 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 30 | import com.hjx.personalcenter.model.SchoolInfo; | 30 | import com.hjx.personalcenter.model.SchoolInfo; |
| 31 | import com.hjx.personalcenter.model.SignInfo; | 31 | import com.hjx.personalcenter.model.SignInfo; |
| 32 | import com.hjx.personalcenter.util.AlertUtils; | 32 | import com.hjx.personalcenter.util.AlertUtils; |
| 33 | import com.hjx.personalcenter.util.DialogPermission; | 33 | import com.hjx.personalcenter.util.DialogPermission; |
| 34 | import com.loopj.android.http.AsyncHttpResponseHandler; | 34 | import com.loopj.android.http.AsyncHttpResponseHandler; |
| 35 | import com.loopj.android.http.JsonHttpResponseHandler; | 35 | import com.loopj.android.http.JsonHttpResponseHandler; |
| 36 | import com.loopj.android.http.RequestParams; | 36 | import com.loopj.android.http.RequestParams; |
| 37 | import com.mylhyl.circledialog.CircleDialog; | 37 | import com.mylhyl.circledialog.CircleDialog; |
| 38 | import com.mylhyl.circledialog.callback.ConfigText; | 38 | import com.mylhyl.circledialog.callback.ConfigText; |
| 39 | import com.mylhyl.circledialog.params.TextParams; | 39 | import com.mylhyl.circledialog.params.TextParams; |
| 40 | 40 | ||
| 41 | import org.apache.http.Header; | 41 | import org.apache.http.Header; |
| 42 | import org.apache.http.entity.ByteArrayEntity; | 42 | import org.apache.http.entity.ByteArrayEntity; |
| 43 | import org.apache.http.message.BasicHeader; | 43 | import org.apache.http.message.BasicHeader; |
| 44 | import org.apache.http.protocol.HTTP; | 44 | import org.apache.http.protocol.HTTP; |
| 45 | import org.json.JSONException; | 45 | import org.json.JSONException; |
| 46 | import org.json.JSONObject; | 46 | import org.json.JSONObject; |
| 47 | 47 | ||
| 48 | import java.io.File; | ||
| 49 | import java.io.FileNotFoundException; | ||
| 48 | import java.io.UnsupportedEncodingException; | 50 | import java.io.UnsupportedEncodingException; |
| 49 | import java.util.ArrayList; | 51 | import java.util.ArrayList; |
| 50 | import java.util.List; | 52 | import java.util.List; |
| 51 | 53 | ||
| 52 | public class HttpManager { | 54 | public class HttpManager { |
| 53 | private static HttpManager instance; | 55 | private static HttpManager instance; |
| 54 | private ProgressDialog mProgress = null; | 56 | private ProgressDialog mProgress = null; |
| 55 | 57 | ||
| 56 | public static HttpManager getInstance() { | 58 | public static HttpManager getInstance() { |
| 57 | if (instance == null) { | 59 | if (instance == null) { |
| 58 | instance = new HttpManager(); | 60 | instance = new HttpManager(); |
| 59 | } | 61 | } |
| 60 | return instance; | 62 | return instance; |
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | 65 | ||
| 64 | //登录接口 | 66 | //登录接口 |
| 65 | 67 | ||
| 66 | public void login(final String username, final String password, final Context mContext, final Handler handler) { | 68 | public void login(final String username, final String password, final Context mContext, final Handler handler) { |
| 67 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 69 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
| 68 | false, true, null); | 70 | false, true, null); |
| 69 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 71 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 70 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 72 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
| 71 | @Override | 73 | @Override |
| 72 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 74 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 73 | closeProgress(); | 75 | closeProgress(); |
| 74 | Message msg = Message.obtain(); | 76 | Message msg = Message.obtain(); |
| 75 | msg.what = HttpCode.LOGIN_SUCESS; | 77 | msg.what = HttpCode.LOGIN_SUCESS; |
| 76 | msg.obj = new String(arg2); | 78 | msg.obj = new String(arg2); |
| 77 | handler.sendMessage(msg); | 79 | handler.sendMessage(msg); |
| 78 | 80 | ||
| 79 | 81 | ||
| 80 | } | 82 | } |
| 81 | 83 | ||
| 82 | @Override | 84 | @Override |
| 83 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 85 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 84 | closeProgress(); | 86 | closeProgress(); |
| 85 | new CircleDialog.Builder((FragmentActivity) mContext) | 87 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 86 | .setCanceledOnTouchOutside(false) | 88 | .setCanceledOnTouchOutside(false) |
| 87 | .setCancelable(false) | 89 | .setCancelable(false) |
| 88 | .setWidth(0.5f) | 90 | .setWidth(0.5f) |
| 89 | .configText(new ConfigText() { | 91 | .configText(new ConfigText() { |
| 90 | @Override | 92 | @Override |
| 91 | public void onConfig(TextParams params) { | 93 | public void onConfig(TextParams params) { |
| 92 | params.gravity = Gravity.CENTER; | 94 | params.gravity = Gravity.CENTER; |
| 93 | params.padding = new int[]{50, 50, 50, 50}; | 95 | params.padding = new int[]{50, 50, 50, 50}; |
| 94 | } | 96 | } |
| 95 | }) | 97 | }) |
| 96 | .setText("当前无网络,请检查网络设置") | 98 | .setText("当前无网络,请检查网络设置") |
| 97 | .setNegative("继续使用", null) | 99 | .setNegative("继续使用", null) |
| 98 | .setPositive("设置网络", new View.OnClickListener() { | 100 | .setPositive("设置网络", new View.OnClickListener() { |
| 99 | @Override | 101 | @Override |
| 100 | public void onClick(View v) { | 102 | public void onClick(View v) { |
| 101 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 103 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 102 | mContext.startActivity(intent); | 104 | mContext.startActivity(intent); |
| 103 | } | 105 | } |
| 104 | }) | 106 | }) |
| 105 | .show(); | 107 | .show(); |
| 106 | } | 108 | } |
| 107 | }); | 109 | }); |
| 108 | } | 110 | } |
| 109 | 111 | ||
| 110 | //注册接口 | 112 | //注册接口 |
| 111 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 113 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
| 112 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 114 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
| 113 | false, true, null); | 115 | false, true, null); |
| 114 | JSONObject jsonObject = new JSONObject(); | 116 | JSONObject jsonObject = new JSONObject(); |
| 115 | ByteArrayEntity entity = null; | 117 | ByteArrayEntity entity = null; |
| 116 | try { | 118 | try { |
| 117 | jsonObject.put(HttpKey.USERNAME, username); | 119 | jsonObject.put(HttpKey.USERNAME, username); |
| 118 | jsonObject.put(HttpKey.PASSWORD, password); | 120 | jsonObject.put(HttpKey.PASSWORD, password); |
| 119 | jsonObject.put(HttpKey.SMSCODE, smscode); | 121 | jsonObject.put(HttpKey.SMSCODE, smscode); |
| 120 | jsonObject.put(HttpKey.SOURCE, source); | 122 | jsonObject.put(HttpKey.SOURCE, source); |
| 121 | Log.e("test", "jsonObject" + jsonObject); | 123 | Log.e("test", "jsonObject" + jsonObject); |
| 122 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 124 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
| 123 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 125 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
| 124 | } catch (JSONException e) { | 126 | } catch (JSONException e) { |
| 125 | e.printStackTrace(); | 127 | e.printStackTrace(); |
| 126 | } catch (UnsupportedEncodingException e) { | 128 | } catch (UnsupportedEncodingException e) { |
| 127 | e.printStackTrace(); | 129 | e.printStackTrace(); |
| 128 | } | 130 | } |
| 129 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 131 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 130 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 132 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
| 131 | @Override | 133 | @Override |
| 132 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 134 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 133 | super.onSuccess(statusCode, headers, response); | 135 | super.onSuccess(statusCode, headers, response); |
| 134 | closeProgress(); | 136 | closeProgress(); |
| 135 | Log.e("test", "onSuccess" + response); | 137 | Log.e("test", "onSuccess" + response); |
| 136 | Message msg = Message.obtain(); | 138 | Message msg = Message.obtain(); |
| 137 | msg.what = HttpCode.REGISTERED_SUCESS; | 139 | msg.what = HttpCode.REGISTERED_SUCESS; |
| 138 | msg.obj = response; | 140 | msg.obj = response; |
| 139 | handler.sendMessage(msg); | 141 | handler.sendMessage(msg); |
| 140 | 142 | ||
| 141 | } | 143 | } |
| 142 | 144 | ||
| 143 | @Override | 145 | @Override |
| 144 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 146 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 145 | super.onFailure(statusCode, headers, throwable, errorResponse); | 147 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 146 | closeProgress(); | 148 | closeProgress(); |
| 147 | Log.e("test", "onFailure" + errorResponse); | 149 | Log.e("test", "onFailure" + errorResponse); |
| 148 | new CircleDialog.Builder((FragmentActivity) context) | 150 | new CircleDialog.Builder((FragmentActivity) context) |
| 149 | .setCanceledOnTouchOutside(false) | 151 | .setCanceledOnTouchOutside(false) |
| 150 | .setCancelable(false) | 152 | .setCancelable(false) |
| 151 | .setWidth(0.5f) | 153 | .setWidth(0.5f) |
| 152 | .configText(new ConfigText() { | 154 | .configText(new ConfigText() { |
| 153 | @Override | 155 | @Override |
| 154 | public void onConfig(TextParams params) { | 156 | public void onConfig(TextParams params) { |
| 155 | params.gravity = Gravity.CENTER; | 157 | params.gravity = Gravity.CENTER; |
| 156 | params.padding = new int[]{50, 50, 50, 50}; | 158 | params.padding = new int[]{50, 50, 50, 50}; |
| 157 | } | 159 | } |
| 158 | }) | 160 | }) |
| 159 | .setText("当前无网络,请检查网络设置") | 161 | .setText("当前无网络,请检查网络设置") |
| 160 | .setNegative("继续使用", null) | 162 | .setNegative("继续使用", null) |
| 161 | .setPositive("设置网络", new View.OnClickListener() { | 163 | .setPositive("设置网络", new View.OnClickListener() { |
| 162 | @Override | 164 | @Override |
| 163 | public void onClick(View v) { | 165 | public void onClick(View v) { |
| 164 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 166 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 165 | context.startActivity(intent); | 167 | context.startActivity(intent); |
| 166 | } | 168 | } |
| 167 | }) | 169 | }) |
| 168 | .show(); | 170 | .show(); |
| 169 | } | 171 | } |
| 170 | 172 | ||
| 171 | }); | 173 | }); |
| 172 | } | 174 | } |
| 173 | 175 | ||
| 174 | //注册验证码 | 176 | //注册验证码 |
| 175 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 177 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
| 176 | RequestParams params = new RequestParams(); | 178 | RequestParams params = new RequestParams(); |
| 177 | params.put(HttpKey.TYPE, type); | 179 | params.put(HttpKey.TYPE, type); |
| 178 | params.put(HttpKey.MOBIL, mobile); | 180 | params.put(HttpKey.MOBIL, mobile); |
| 179 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 181 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 180 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 182 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
| 181 | 183 | ||
| 182 | @Override | 184 | @Override |
| 183 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 185 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 184 | Log.e("test", "onSuccess-----" + response); | 186 | Log.e("test", "onSuccess-----" + response); |
| 185 | Message msg = Message.obtain(); | 187 | Message msg = Message.obtain(); |
| 186 | msg.what = HttpCode.AUTHCODE_SUCESS; | 188 | msg.what = HttpCode.AUTHCODE_SUCESS; |
| 187 | msg.obj = response; | 189 | msg.obj = response; |
| 188 | handler.sendMessage(msg); | 190 | handler.sendMessage(msg); |
| 189 | } | 191 | } |
| 190 | 192 | ||
| 191 | @Override | 193 | @Override |
| 192 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 194 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 193 | new CircleDialog.Builder((FragmentActivity) mContext) | 195 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 194 | .setCanceledOnTouchOutside(false) | 196 | .setCanceledOnTouchOutside(false) |
| 195 | .setCancelable(false) | 197 | .setCancelable(false) |
| 196 | .setWidth(0.5f) | 198 | .setWidth(0.5f) |
| 197 | .configText(new ConfigText() { | 199 | .configText(new ConfigText() { |
| 198 | @Override | 200 | @Override |
| 199 | public void onConfig(TextParams params) { | 201 | public void onConfig(TextParams params) { |
| 200 | params.gravity = Gravity.CENTER; | 202 | params.gravity = Gravity.CENTER; |
| 201 | params.padding = new int[]{50, 50, 50, 50}; | 203 | params.padding = new int[]{50, 50, 50, 50}; |
| 202 | } | 204 | } |
| 203 | }) | 205 | }) |
| 204 | .setText("当前无网络,请检查网络设置") | 206 | .setText("当前无网络,请检查网络设置") |
| 205 | .setNegative("继续使用", null) | 207 | .setNegative("继续使用", null) |
| 206 | .setPositive("设置网络", new View.OnClickListener() { | 208 | .setPositive("设置网络", new View.OnClickListener() { |
| 207 | @Override | 209 | @Override |
| 208 | public void onClick(View v) { | 210 | public void onClick(View v) { |
| 209 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 211 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 210 | mContext.startActivity(intent); | 212 | mContext.startActivity(intent); |
| 211 | } | 213 | } |
| 212 | }) | 214 | }) |
| 213 | .show(); | 215 | .show(); |
| 214 | } | 216 | } |
| 215 | }); | 217 | }); |
| 216 | } | 218 | } |
| 217 | 219 | ||
| 218 | 220 | ||
| 219 | //手机号是否注册 | 221 | //手机号是否注册 |
| 220 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 222 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
| 221 | RequestParams params = new RequestParams(); | 223 | RequestParams params = new RequestParams(); |
| 222 | params.put(HttpKey.USERNAME, mobile); | 224 | params.put(HttpKey.USERNAME, mobile); |
| 223 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 225 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
| 224 | @Override | 226 | @Override |
| 225 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 227 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 226 | Log.e("test", "isregistered" + response.toString()); | 228 | Log.e("test", "isregistered" + response.toString()); |
| 227 | Message msg = Message.obtain(); | 229 | Message msg = Message.obtain(); |
| 228 | msg.what = HttpCode.IS_REFISTER; | 230 | msg.what = HttpCode.IS_REFISTER; |
| 229 | msg.obj = response; | 231 | msg.obj = response; |
| 230 | handler.sendMessage(msg); | 232 | handler.sendMessage(msg); |
| 231 | 233 | ||
| 232 | } | 234 | } |
| 233 | 235 | ||
| 234 | @Override | 236 | @Override |
| 235 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 237 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 236 | new CircleDialog.Builder((FragmentActivity) mContext) | 238 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 237 | .setCanceledOnTouchOutside(false) | 239 | .setCanceledOnTouchOutside(false) |
| 238 | .setCancelable(false) | 240 | .setCancelable(false) |
| 239 | .setWidth(0.5f) | 241 | .setWidth(0.5f) |
| 240 | .configText(new ConfigText() { | 242 | .configText(new ConfigText() { |
| 241 | @Override | 243 | @Override |
| 242 | public void onConfig(TextParams params) { | 244 | public void onConfig(TextParams params) { |
| 243 | params.gravity = Gravity.CENTER; | 245 | params.gravity = Gravity.CENTER; |
| 244 | params.padding = new int[]{50, 50, 50, 50}; | 246 | params.padding = new int[]{50, 50, 50, 50}; |
| 245 | } | 247 | } |
| 246 | }) | 248 | }) |
| 247 | .setText("当前无网络,请检查网络设置") | 249 | .setText("当前无网络,请检查网络设置") |
| 248 | .setNegative("继续使用", null) | 250 | .setNegative("继续使用", null) |
| 249 | .setPositive("设置网络", new View.OnClickListener() { | 251 | .setPositive("设置网络", new View.OnClickListener() { |
| 250 | @Override | 252 | @Override |
| 251 | public void onClick(View v) { | 253 | public void onClick(View v) { |
| 252 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 254 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 253 | mContext.startActivity(intent); | 255 | mContext.startActivity(intent); |
| 254 | } | 256 | } |
| 255 | }) | 257 | }) |
| 256 | .show(); | 258 | .show(); |
| 257 | 259 | ||
| 258 | } | 260 | } |
| 259 | }); | 261 | }); |
| 260 | } | 262 | } |
| 261 | 263 | ||
| 262 | //修改密码 | 264 | //修改密码 |
| 263 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 265 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
| 264 | RequestParams params = new RequestParams(); | 266 | RequestParams params = new RequestParams(); |
| 265 | params.put(HttpKey.USERNAME, username); | 267 | params.put(HttpKey.USERNAME, username); |
| 266 | params.put(HttpKey.OLDPASS, old_pwd1); | 268 | params.put(HttpKey.OLDPASS, old_pwd1); |
| 267 | params.put(HttpKey.NEWPASS, newpassword3); | 269 | params.put(HttpKey.NEWPASS, newpassword3); |
| 268 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 270 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 269 | HttpClient.getInstance().setTimeout(10 * 1000); | 271 | HttpClient.getInstance().setTimeout(10 * 1000); |
| 270 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 272 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
| 271 | @Override | 273 | @Override |
| 272 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 274 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 273 | try { | 275 | try { |
| 274 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 276 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 275 | String status = jsonObject.optString("status"); | 277 | String status = jsonObject.optString("status"); |
| 276 | if (status.equals("100")) { | 278 | if (status.equals("100")) { |
| 277 | Log.e("test", "onSuccess" + new String(bytes)); | 279 | Log.e("test", "onSuccess" + new String(bytes)); |
| 278 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 280 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 279 | SaveParam.getInstance().clearData((Activity) context); | 281 | SaveParam.getInstance().clearData((Activity) context); |
| 280 | Intent intent = new Intent(); | 282 | Intent intent = new Intent(); |
| 281 | intent.setClass(context, LoginAndRegisterActivity.class); | 283 | intent.setClass(context, LoginAndRegisterActivity.class); |
| 282 | ((Activity) context).startActivity(intent); | 284 | ((Activity) context).startActivity(intent); |
| 283 | ((Activity) context).finish(); | 285 | ((Activity) context).finish(); |
| 284 | } else { | 286 | } else { |
| 285 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 287 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
| 286 | } | 288 | } |
| 287 | } catch (JSONException e) { | 289 | } catch (JSONException e) { |
| 288 | e.printStackTrace(); | 290 | e.printStackTrace(); |
| 289 | } | 291 | } |
| 290 | } | 292 | } |
| 291 | 293 | ||
| 292 | @Override | 294 | @Override |
| 293 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 295 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 294 | Log.e("test", "onFailure" + new String(bytes)); | 296 | Log.e("test", "onFailure" + new String(bytes)); |
| 295 | new CircleDialog.Builder((FragmentActivity) context) | 297 | new CircleDialog.Builder((FragmentActivity) context) |
| 296 | .setCanceledOnTouchOutside(false) | 298 | .setCanceledOnTouchOutside(false) |
| 297 | .setCancelable(false) | 299 | .setCancelable(false) |
| 298 | .setWidth(0.5f) | 300 | .setWidth(0.5f) |
| 299 | .configText(new ConfigText() { | 301 | .configText(new ConfigText() { |
| 300 | @Override | 302 | @Override |
| 301 | public void onConfig(TextParams params) { | 303 | public void onConfig(TextParams params) { |
| 302 | params.gravity = Gravity.CENTER; | 304 | params.gravity = Gravity.CENTER; |
| 303 | params.padding = new int[]{50, 50, 50, 50}; | 305 | params.padding = new int[]{50, 50, 50, 50}; |
| 304 | } | 306 | } |
| 305 | }) | 307 | }) |
| 306 | .setText("当前无网络,请检查网络设置") | 308 | .setText("当前无网络,请检查网络设置") |
| 307 | .setNegative("继续使用", null) | 309 | .setNegative("继续使用", null) |
| 308 | .setPositive("设置网络", new View.OnClickListener() { | 310 | .setPositive("设置网络", new View.OnClickListener() { |
| 309 | @Override | 311 | @Override |
| 310 | public void onClick(View v) { | 312 | public void onClick(View v) { |
| 311 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 313 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 312 | context.startActivity(intent); | 314 | context.startActivity(intent); |
| 313 | } | 315 | } |
| 314 | }) | 316 | }) |
| 315 | .show(); | 317 | .show(); |
| 316 | } | 318 | } |
| 317 | }); | 319 | }); |
| 318 | 320 | ||
| 319 | } | 321 | } |
| 320 | 322 | ||
| 321 | //忘记密码 | 323 | //忘记密码 |
| 322 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 324 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
| 323 | RequestParams params = new RequestParams(); | 325 | RequestParams params = new RequestParams(); |
| 324 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 326 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
| 325 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 327 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
| 326 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 328 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
| 327 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 329 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 328 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 330 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
| 329 | @Override | 331 | @Override |
| 330 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 332 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 331 | try { | 333 | try { |
| 332 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 334 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 333 | String status = jsonObject.optString("status"); | 335 | String status = jsonObject.optString("status"); |
| 334 | if (status.equals("100")) { | 336 | if (status.equals("100")) { |
| 335 | Log.e("test", "onSuccess" + new String(bytes)); | 337 | Log.e("test", "onSuccess" + new String(bytes)); |
| 336 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 338 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 337 | ((Activity) context).finish(); | 339 | ((Activity) context).finish(); |
| 338 | } else { | 340 | } else { |
| 339 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 341 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
| 340 | } | 342 | } |
| 341 | } catch (JSONException e) { | 343 | } catch (JSONException e) { |
| 342 | e.printStackTrace(); | 344 | e.printStackTrace(); |
| 343 | } | 345 | } |
| 344 | } | 346 | } |
| 345 | 347 | ||
| 346 | @Override | 348 | @Override |
| 347 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 349 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 348 | Log.e("test", "onFailure" + new String(bytes)); | 350 | Log.e("test", "onFailure" + new String(bytes)); |
| 349 | new CircleDialog.Builder((FragmentActivity) context) | 351 | new CircleDialog.Builder((FragmentActivity) context) |
| 350 | .setCanceledOnTouchOutside(false) | 352 | .setCanceledOnTouchOutside(false) |
| 351 | .setCancelable(false) | 353 | .setCancelable(false) |
| 352 | .setWidth(0.5f) | 354 | .setWidth(0.5f) |
| 353 | .configText(new ConfigText() { | 355 | .configText(new ConfigText() { |
| 354 | @Override | 356 | @Override |
| 355 | public void onConfig(TextParams params) { | 357 | public void onConfig(TextParams params) { |
| 356 | params.gravity = Gravity.CENTER; | 358 | params.gravity = Gravity.CENTER; |
| 357 | params.padding = new int[]{50, 50, 50, 50}; | 359 | params.padding = new int[]{50, 50, 50, 50}; |
| 358 | } | 360 | } |
| 359 | }) | 361 | }) |
| 360 | .setText("当前无网络,请检查网络设置") | 362 | .setText("当前无网络,请检查网络设置") |
| 361 | .setNegative("继续使用", null) | 363 | .setNegative("继续使用", null) |
| 362 | .setPositive("设置网络", new View.OnClickListener() { | 364 | .setPositive("设置网络", new View.OnClickListener() { |
| 363 | @Override | 365 | @Override |
| 364 | public void onClick(View v) { | 366 | public void onClick(View v) { |
| 365 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 367 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 366 | context.startActivity(intent); | 368 | context.startActivity(intent); |
| 367 | } | 369 | } |
| 368 | }) | 370 | }) |
| 369 | .show(); | 371 | .show(); |
| 370 | } | 372 | } |
| 371 | }); | 373 | }); |
| 372 | 374 | ||
| 373 | } | 375 | } |
| 374 | 376 | ||
| 375 | //保存用户登录信息 | 377 | //保存用户登录信息 |
| 376 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { | 378 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { |
| 377 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 379 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
| 378 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 380 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
| 379 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 381 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
| 380 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); | 382 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); |
| 381 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 383 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
| 382 | 384 | ||
| 383 | 385 | ||
| 384 | } | 386 | } |
| 385 | 387 | ||
| 386 | //提交保卡信息 | 388 | //提交保卡信息 |
| 387 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 389 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
| 388 | String buyAddress, String buyTime, String alterSaleCall, | 390 | String buyAddress, String buyTime, String alterSaleCall, |
| 389 | String productModel, String deviceNumber, String macAddress, | 391 | String productModel, String deviceNumber, String macAddress, |
| 390 | String mobilePhone) { | 392 | String mobilePhone) { |
| 391 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 393 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
| 392 | false, true, null); | 394 | false, true, null); |
| 393 | RequestParams params = new RequestParams(); | 395 | RequestParams params = new RequestParams(); |
| 394 | 396 | ||
| 395 | params.put(HttpKey.USEID, userId); | 397 | params.put(HttpKey.USEID, userId); |
| 396 | params.put(HttpKey.CUSTOMENAME, customerName); | 398 | params.put(HttpKey.CUSTOMENAME, customerName); |
| 397 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 399 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
| 398 | params.put(HttpKey.BUYADREES, buyAddress); | 400 | params.put(HttpKey.BUYADREES, buyAddress); |
| 399 | params.put(HttpKey.BUYTIME, buyTime); | 401 | params.put(HttpKey.BUYTIME, buyTime); |
| 400 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 402 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
| 401 | params.put(HttpKey.PRODUCTMODEL, productModel); | 403 | params.put(HttpKey.PRODUCTMODEL, productModel); |
| 402 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 404 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
| 403 | params.put(HttpKey.MACADRESS, macAddress); | 405 | params.put(HttpKey.MACADRESS, macAddress); |
| 404 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 406 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
| 405 | 407 | ||
| 406 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 408 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 407 | 409 | ||
| 408 | Log.e("test", "params" + params); | 410 | Log.e("test", "params" + params); |
| 409 | HttpClient.getInstance().setTimeout(5 * 1000); | 411 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 410 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 412 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
| 411 | @Override | 413 | @Override |
| 412 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 414 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 413 | JSONObject jsonObject = null; | 415 | JSONObject jsonObject = null; |
| 414 | closeProgress(); | 416 | closeProgress(); |
| 415 | try { | 417 | try { |
| 416 | jsonObject = new JSONObject(new String(bytes)); | 418 | jsonObject = new JSONObject(new String(bytes)); |
| 417 | String status = jsonObject.optString("status"); | 419 | String status = jsonObject.optString("status"); |
| 418 | if (status.equals("1")) { | 420 | if (status.equals("1")) { |
| 419 | Log.e("test", "onSuccess" + jsonObject); | 421 | Log.e("test", "onSuccess" + jsonObject); |
| 420 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 422 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
| 421 | Intent intent = new Intent(); | 423 | Intent intent = new Intent(); |
| 422 | intent.setClass((Activity) context, TheStartPageActivity.class); | 424 | intent.setClass((Activity) context, TheStartPageActivity.class); |
| 423 | ((Activity) context).startActivity(intent); | 425 | ((Activity) context).startActivity(intent); |
| 424 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 426 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 425 | ((Activity) context).finish(); | 427 | ((Activity) context).finish(); |
| 426 | } else { | 428 | } else { |
| 427 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 429 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
| 428 | } | 430 | } |
| 429 | } catch (JSONException e) { | 431 | } catch (JSONException e) { |
| 430 | e.printStackTrace(); | 432 | e.printStackTrace(); |
| 431 | } | 433 | } |
| 432 | 434 | ||
| 433 | 435 | ||
| 434 | } | 436 | } |
| 435 | 437 | ||
| 436 | @Override | 438 | @Override |
| 437 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 439 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 438 | Log.e("test", "onFailure" + (throwable)); | 440 | Log.e("test", "onFailure" + (throwable)); |
| 439 | closeProgress(); | 441 | closeProgress(); |
| 440 | new CircleDialog.Builder((FragmentActivity) context) | 442 | new CircleDialog.Builder((FragmentActivity) context) |
| 441 | .setCanceledOnTouchOutside(false) | 443 | .setCanceledOnTouchOutside(false) |
| 442 | .setCancelable(false) | 444 | .setCancelable(false) |
| 443 | .setWidth(0.5f) | 445 | .setWidth(0.5f) |
| 444 | .configText(new ConfigText() { | 446 | .configText(new ConfigText() { |
| 445 | @Override | 447 | @Override |
| 446 | public void onConfig(TextParams params) { | 448 | public void onConfig(TextParams params) { |
| 447 | params.gravity = Gravity.CENTER; | 449 | params.gravity = Gravity.CENTER; |
| 448 | params.padding = new int[]{50, 50, 50, 50}; | 450 | params.padding = new int[]{50, 50, 50, 50}; |
| 449 | } | 451 | } |
| 450 | }) | 452 | }) |
| 451 | .setText("当前无网络,请检查网络设置") | 453 | .setText("当前无网络,请检查网络设置") |
| 452 | .setNegative("继续使用", null) | 454 | .setNegative("继续使用", null) |
| 453 | .setPositive("设置网络", new View.OnClickListener() { | 455 | .setPositive("设置网络", new View.OnClickListener() { |
| 454 | @Override | 456 | @Override |
| 455 | public void onClick(View v) { | 457 | public void onClick(View v) { |
| 456 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 458 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 457 | context.startActivity(intent); | 459 | context.startActivity(intent); |
| 458 | } | 460 | } |
| 459 | }) | 461 | }) |
| 460 | .show(); | 462 | .show(); |
| 461 | 463 | ||
| 462 | } | 464 | } |
| 463 | }); | 465 | }); |
| 464 | 466 | ||
| 465 | } | 467 | } |
| 466 | 468 | ||
| 467 | //获取保卡信息 | 469 | //获取保卡信息 |
| 468 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { | 470 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { |
| 469 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 471 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
| 470 | false, true, null); | 472 | false, true, null); |
| 471 | HttpClient.getInstance().setTimeout(5 * 1000); | 473 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 472 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 474 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 473 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { | 475 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 474 | @Override | 476 | @Override |
| 475 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 477 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 476 | closeProgress(); | 478 | closeProgress(); |
| 477 | Log.e("test", "保卡信息" + new String(arg2)); | 479 | Log.e("test", "保卡信息" + new String(arg2)); |
| 478 | try { | 480 | try { |
| 479 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 481 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 480 | int status = jsonObject.optInt("status"); | 482 | int status = jsonObject.optInt("status"); |
| 481 | if (status == 1) { | 483 | if (status == 1) { |
| 482 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 484 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
| 483 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 485 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
| 484 | Message msg = Message.obtain(); | 486 | Message msg = Message.obtain(); |
| 485 | msg.what = HttpCode.SUCHCARDINFO; | 487 | msg.what = HttpCode.SUCHCARDINFO; |
| 486 | msg.obj = schoolInfoBeanList; | 488 | msg.obj = schoolInfoBeanList; |
| 487 | handler.sendMessage(msg); | 489 | handler.sendMessage(msg); |
| 488 | 490 | ||
| 489 | 491 | ||
| 490 | } else { | 492 | } else { |
| 491 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 493 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 492 | 494 | ||
| 493 | } | 495 | } |
| 494 | } catch (JSONException e) { | 496 | } catch (JSONException e) { |
| 495 | e.printStackTrace(); | 497 | e.printStackTrace(); |
| 496 | } | 498 | } |
| 497 | 499 | ||
| 498 | } | 500 | } |
| 499 | 501 | ||
| 500 | @Override | 502 | @Override |
| 501 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 503 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 502 | closeProgress(); | 504 | closeProgress(); |
| 503 | new CircleDialog.Builder((FragmentActivity) mContext) | 505 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 504 | .setCanceledOnTouchOutside(false) | 506 | .setCanceledOnTouchOutside(false) |
| 505 | .setCancelable(false) | 507 | .setCancelable(false) |
| 506 | .setWidth(0.5f) | 508 | .setWidth(0.5f) |
| 507 | .configText(new ConfigText() { | 509 | .configText(new ConfigText() { |
| 508 | @Override | 510 | @Override |
| 509 | public void onConfig(TextParams params) { | 511 | public void onConfig(TextParams params) { |
| 510 | params.gravity = Gravity.CENTER; | 512 | params.gravity = Gravity.CENTER; |
| 511 | params.padding = new int[]{50, 50, 50, 50}; | 513 | params.padding = new int[]{50, 50, 50, 50}; |
| 512 | } | 514 | } |
| 513 | }) | 515 | }) |
| 514 | .setText("当前无网络,请检查网络设置") | 516 | .setText("当前无网络,请检查网络设置") |
| 515 | .setNegative("继续使用", null) | 517 | .setNegative("继续使用", null) |
| 516 | .setPositive("设置网络", new View.OnClickListener() { | 518 | .setPositive("设置网络", new View.OnClickListener() { |
| 517 | @Override | 519 | @Override |
| 518 | public void onClick(View v) { | 520 | public void onClick(View v) { |
| 519 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 521 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 520 | mContext.startActivity(intent); | 522 | mContext.startActivity(intent); |
| 521 | } | 523 | } |
| 522 | }) | 524 | }) |
| 523 | .show(); | 525 | .show(); |
| 524 | } | 526 | } |
| 525 | }); | 527 | }); |
| 526 | } | 528 | } |
| 527 | 529 | ||
| 528 | //修改保卡信息电话 | 530 | //修改保卡信息电话 |
| 529 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { | 531 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { |
| 530 | RequestParams params = new RequestParams(); | 532 | RequestParams params = new RequestParams(); |
| 531 | params.put("userId", userId); | 533 | params.put("userId", userId); |
| 532 | params.put("customerPhone", customerPhone); | 534 | params.put("customerPhone", customerPhone); |
| 533 | params.put("authCode", authCode); | 535 | params.put("authCode", authCode); |
| 534 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 536 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 535 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 537 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 536 | @Override | 538 | @Override |
| 537 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 539 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 538 | try { | 540 | try { |
| 539 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 541 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 540 | String status = jsonObject.optString("status"); | 542 | String status = jsonObject.optString("status"); |
| 541 | if (status.equals("1")) { | 543 | if (status.equals("1")) { |
| 542 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 544 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 543 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 545 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
| 544 | ((Activity) mContext).finish(); | 546 | ((Activity) mContext).finish(); |
| 545 | } else if (status.equals("1001")) { | 547 | } else if (status.equals("1001")) { |
| 546 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 548 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 547 | } else { | 549 | } else { |
| 548 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 550 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 549 | } | 551 | } |
| 550 | } catch (JSONException e) { | 552 | } catch (JSONException e) { |
| 551 | e.printStackTrace(); | 553 | e.printStackTrace(); |
| 552 | } | 554 | } |
| 553 | } | 555 | } |
| 554 | 556 | ||
| 555 | @Override | 557 | @Override |
| 556 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 558 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 557 | Log.e("test", "onFailure" + new String(bytes)); | 559 | Log.e("test", "onFailure" + new String(bytes)); |
| 558 | new CircleDialog.Builder((FragmentActivity) mContext) | 560 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 559 | .setCanceledOnTouchOutside(false) | 561 | .setCanceledOnTouchOutside(false) |
| 560 | .setCancelable(false) | 562 | .setCancelable(false) |
| 561 | .setWidth(0.5f) | 563 | .setWidth(0.5f) |
| 562 | .configText(new ConfigText() { | 564 | .configText(new ConfigText() { |
| 563 | @Override | 565 | @Override |
| 564 | public void onConfig(TextParams params) { | 566 | public void onConfig(TextParams params) { |
| 565 | params.gravity = Gravity.CENTER; | 567 | params.gravity = Gravity.CENTER; |
| 566 | params.padding = new int[]{50, 50, 50, 50}; | 568 | params.padding = new int[]{50, 50, 50, 50}; |
| 567 | } | 569 | } |
| 568 | }) | 570 | }) |
| 569 | .setText("当前无网络,请检查网络设置") | 571 | .setText("当前无网络,请检查网络设置") |
| 570 | .setNegative("继续使用", null) | 572 | .setNegative("继续使用", null) |
| 571 | .setPositive("设置网络", new View.OnClickListener() { | 573 | .setPositive("设置网络", new View.OnClickListener() { |
| 572 | @Override | 574 | @Override |
| 573 | public void onClick(View v) { | 575 | public void onClick(View v) { |
| 574 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 576 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 575 | mContext.startActivity(intent); | 577 | mContext.startActivity(intent); |
| 576 | } | 578 | } |
| 577 | }) | 579 | }) |
| 578 | .show(); | 580 | .show(); |
| 579 | } | 581 | } |
| 580 | }); | 582 | }); |
| 581 | } | 583 | } |
| 582 | 584 | ||
| 583 | //修改保卡信息地址 | 585 | //修改保卡信息地址 |
| 584 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { | 586 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { |
| 585 | RequestParams params = new RequestParams(); | 587 | RequestParams params = new RequestParams(); |
| 586 | params.put("userId", userId); | 588 | params.put("userId", userId); |
| 587 | params.put("customerPhone", customerPhone); | 589 | params.put("customerPhone", customerPhone); |
| 588 | params.put("authCode", authCode); | 590 | params.put("authCode", authCode); |
| 589 | params.put("customerAddress", customerAddress); | 591 | params.put("customerAddress", customerAddress); |
| 590 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 592 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 591 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 593 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 592 | @Override | 594 | @Override |
| 593 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 595 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 594 | try { | 596 | try { |
| 595 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 597 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 596 | String status = jsonObject.optString("status"); | 598 | String status = jsonObject.optString("status"); |
| 597 | if (status.equals("1")) { | 599 | if (status.equals("1")) { |
| 598 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 600 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 599 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 601 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
| 600 | ((Activity) mContext).finish(); | 602 | ((Activity) mContext).finish(); |
| 601 | } else { | 603 | } else { |
| 602 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 604 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 603 | } | 605 | } |
| 604 | } catch (JSONException e) { | 606 | } catch (JSONException e) { |
| 605 | e.printStackTrace(); | 607 | e.printStackTrace(); |
| 606 | } | 608 | } |
| 607 | } | 609 | } |
| 608 | 610 | ||
| 609 | @Override | 611 | @Override |
| 610 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 612 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 611 | Log.e("test", "onFailure" + new String(bytes)); | 613 | Log.e("test", "onFailure" + new String(bytes)); |
| 612 | new CircleDialog.Builder((FragmentActivity) mContext) | 614 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 613 | .setCanceledOnTouchOutside(false) | 615 | .setCanceledOnTouchOutside(false) |
| 614 | .setCancelable(false) | 616 | .setCancelable(false) |
| 615 | .setWidth(0.5f) | 617 | .setWidth(0.5f) |
| 616 | .configText(new ConfigText() { | 618 | .configText(new ConfigText() { |
| 617 | @Override | 619 | @Override |
| 618 | public void onConfig(TextParams params) { | 620 | public void onConfig(TextParams params) { |
| 619 | params.gravity = Gravity.CENTER; | 621 | params.gravity = Gravity.CENTER; |
| 620 | params.padding = new int[]{50, 50, 50, 50}; | 622 | params.padding = new int[]{50, 50, 50, 50}; |
| 621 | } | 623 | } |
| 622 | }) | 624 | }) |
| 623 | .setText("当前无网络,请检查网络设置") | 625 | .setText("当前无网络,请检查网络设置") |
| 624 | .setNegative("继续使用", null) | 626 | .setNegative("继续使用", null) |
| 625 | .setPositive("设置网络", new View.OnClickListener() { | 627 | .setPositive("设置网络", new View.OnClickListener() { |
| 626 | @Override | 628 | @Override |
| 627 | public void onClick(View v) { | 629 | public void onClick(View v) { |
| 628 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 630 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 629 | mContext.startActivity(intent); | 631 | mContext.startActivity(intent); |
| 630 | } | 632 | } |
| 631 | }) | 633 | }) |
| 632 | .show(); | 634 | .show(); |
| 633 | } | 635 | } |
| 634 | }); | 636 | }); |
| 635 | } | 637 | } |
| 636 | 638 | ||
| 637 | //验证是否保卡信息 | 639 | //验证是否保卡信息 |
| 638 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { | 640 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { |
| 639 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 641 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
| 640 | false, true, null); | 642 | false, true, null); |
| 641 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 643 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 642 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { | 644 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 643 | @Override | 645 | @Override |
| 644 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 646 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 645 | Log.e("test", "---" + new String(arg2)); | 647 | Log.e("test", "---" + new String(arg2)); |
| 646 | closeProgress(); | 648 | closeProgress(); |
| 647 | Message msg = Message.obtain(); | 649 | Message msg = Message.obtain(); |
| 648 | msg.what = HttpCode.CHECKCARD; | 650 | msg.what = HttpCode.CHECKCARD; |
| 649 | msg.obj = new String(arg2); | 651 | msg.obj = new String(arg2); |
| 650 | handler.sendMessage(msg); | 652 | handler.sendMessage(msg); |
| 651 | 653 | ||
| 652 | 654 | ||
| 653 | } | 655 | } |
| 654 | 656 | ||
| 655 | @Override | 657 | @Override |
| 656 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 658 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 657 | closeProgress(); | 659 | closeProgress(); |
| 658 | new CircleDialog.Builder((FragmentActivity) mContext) | 660 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 659 | .setCanceledOnTouchOutside(false) | 661 | .setCanceledOnTouchOutside(false) |
| 660 | .setCancelable(false) | 662 | .setCancelable(false) |
| 661 | .setWidth(0.5f) | 663 | .setWidth(0.5f) |
| 662 | .configText(new ConfigText() { | 664 | .configText(new ConfigText() { |
| 663 | @Override | 665 | @Override |
| 664 | public void onConfig(TextParams params) { | 666 | public void onConfig(TextParams params) { |
| 665 | params.gravity = Gravity.CENTER; | 667 | params.gravity = Gravity.CENTER; |
| 666 | params.padding = new int[]{50, 50, 50, 50}; | 668 | params.padding = new int[]{50, 50, 50, 50}; |
| 667 | } | 669 | } |
| 668 | }) | 670 | }) |
| 669 | .setText("当前无网络,请检查网络设置") | 671 | .setText("当前无网络,请检查网络设置") |
| 670 | .setNegative("继续使用", null) | 672 | .setNegative("继续使用", null) |
| 671 | .setPositive("设置网络", new View.OnClickListener() { | 673 | .setPositive("设置网络", new View.OnClickListener() { |
| 672 | @Override | 674 | @Override |
| 673 | public void onClick(View v) { | 675 | public void onClick(View v) { |
| 674 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 676 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 675 | mContext.startActivity(intent); | 677 | mContext.startActivity(intent); |
| 676 | } | 678 | } |
| 677 | }) | 679 | }) |
| 678 | .show(); | 680 | .show(); |
| 679 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 681 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
| 680 | } | 682 | } |
| 681 | }); | 683 | }); |
| 682 | } | 684 | } |
| 683 | 685 | ||
| 684 | ///获取年级 | 686 | ///获取年级 |
| 685 | public void getgrade(final Context mContext, final Handler handler) { | 687 | public void getgrade(final Context mContext, final Handler handler) { |
| 686 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 688 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 687 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 689 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
| 688 | @Override | 690 | @Override |
| 689 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 691 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 690 | Log.e("test", "年级" + new String(arg2)); | 692 | Log.e("test", "年级" + new String(arg2)); |
| 691 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 693 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
| 692 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 694 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
| 693 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 695 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
| 694 | String name = gradeInfo.getData().get(i).getName(); | 696 | String name = gradeInfo.getData().get(i).getName(); |
| 695 | int id = gradeInfo.getData().get(i).getId(); | 697 | int id = gradeInfo.getData().get(i).getId(); |
| 696 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 698 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
| 697 | for (int j = 0; j < gradeinfoList.size(); j++) { | 699 | for (int j = 0; j < gradeinfoList.size(); j++) { |
| 698 | String secondname = gradeinfoList.get(j).getName(); | 700 | String secondname = gradeinfoList.get(j).getName(); |
| 699 | int secondid = gradeinfoList.get(j).getId(); | 701 | int secondid = gradeinfoList.get(j).getId(); |
| 700 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 702 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
| 701 | dataBean.setName(secondname); | 703 | dataBean.setName(secondname); |
| 702 | dataBean.setId(secondid); | 704 | dataBean.setId(secondid); |
| 703 | gradeInfoLists.add(dataBean); | 705 | gradeInfoLists.add(dataBean); |
| 704 | } | 706 | } |
| 705 | 707 | ||
| 706 | } | 708 | } |
| 707 | 709 | ||
| 708 | Message message = Message.obtain(); | 710 | Message message = Message.obtain(); |
| 709 | message.what = HttpCode.GRADER; | 711 | message.what = HttpCode.GRADER; |
| 710 | message.obj = gradeInfoLists; | 712 | message.obj = gradeInfoLists; |
| 711 | handler.sendMessage(message); | 713 | handler.sendMessage(message); |
| 712 | 714 | ||
| 713 | 715 | ||
| 714 | } | 716 | } |
| 715 | 717 | ||
| 716 | @Override | 718 | @Override |
| 717 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 719 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 718 | new CircleDialog.Builder((FragmentActivity) mContext) | 720 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 719 | .setCanceledOnTouchOutside(false) | 721 | .setCanceledOnTouchOutside(false) |
| 720 | .setCancelable(false) | 722 | .setCancelable(false) |
| 721 | .setWidth(0.5f) | 723 | .setWidth(0.5f) |
| 722 | .configText(new ConfigText() { | 724 | .configText(new ConfigText() { |
| 723 | @Override | 725 | @Override |
| 724 | public void onConfig(TextParams params) { | 726 | public void onConfig(TextParams params) { |
| 725 | params.gravity = Gravity.CENTER; | 727 | params.gravity = Gravity.CENTER; |
| 726 | params.padding = new int[]{50, 50, 50, 50}; | 728 | params.padding = new int[]{50, 50, 50, 50}; |
| 727 | } | 729 | } |
| 728 | }) | 730 | }) |
| 729 | .setText("当前无网络,请检查网络设置") | 731 | .setText("当前无网络,请检查网络设置") |
| 730 | .setNegative("继续使用", null) | 732 | .setNegative("继续使用", null) |
| 731 | .setPositive("设置网络", new View.OnClickListener() { | 733 | .setPositive("设置网络", new View.OnClickListener() { |
| 732 | @Override | 734 | @Override |
| 733 | public void onClick(View v) { | 735 | public void onClick(View v) { |
| 734 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 736 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 735 | mContext.startActivity(intent); | 737 | mContext.startActivity(intent); |
| 736 | } | 738 | } |
| 737 | }) | 739 | }) |
| 738 | .show(); | 740 | .show(); |
| 739 | } | 741 | } |
| 740 | }); | 742 | }); |
| 741 | } | 743 | } |
| 742 | 744 | ||
| 743 | /** | 745 | /** |
| 744 | * 获取学校 | 746 | * 获取学校 |
| 745 | * | 747 | * |
| 746 | * @param mContext | 748 | * @param mContext |
| 747 | * @param regionId | 749 | * @param regionId |
| 748 | * @param gradeId | 750 | * @param gradeId |
| 749 | * @param handler | 751 | * @param handler |
| 750 | */ | 752 | */ |
| 751 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 753 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
| 752 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 754 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 753 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 755 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
| 754 | @Override | 756 | @Override |
| 755 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 757 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 756 | Log.e("test", "学校" + new String(arg2)); | 758 | Log.e("test", "学校" + new String(arg2)); |
| 757 | try { | 759 | try { |
| 758 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 760 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 759 | int status = jsonObject.optInt("status"); | 761 | int status = jsonObject.optInt("status"); |
| 760 | if (status == 1) { | 762 | if (status == 1) { |
| 761 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 763 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
| 762 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 764 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
| 763 | Message message = Message.obtain(); | 765 | Message message = Message.obtain(); |
| 764 | message.what = HttpCode.SCHOOL; | 766 | message.what = HttpCode.SCHOOL; |
| 765 | message.obj = schoolInfoBeanList; | 767 | message.obj = schoolInfoBeanList; |
| 766 | handler.sendMessage(message); | 768 | handler.sendMessage(message); |
| 767 | 769 | ||
| 768 | 770 | ||
| 769 | } else { | 771 | } else { |
| 770 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 772 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 771 | 773 | ||
| 772 | } | 774 | } |
| 773 | } catch (JSONException e) { | 775 | } catch (JSONException e) { |
| 774 | e.printStackTrace(); | 776 | e.printStackTrace(); |
| 775 | } | 777 | } |
| 776 | 778 | ||
| 777 | } | 779 | } |
| 778 | 780 | ||
| 779 | @Override | 781 | @Override |
| 780 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 782 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 781 | new CircleDialog.Builder((FragmentActivity) mContext) | 783 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 782 | .setCanceledOnTouchOutside(false) | 784 | .setCanceledOnTouchOutside(false) |
| 783 | .setCancelable(false) | 785 | .setCancelable(false) |
| 784 | .setWidth(0.5f) | 786 | .setWidth(0.5f) |
| 785 | .configText(new ConfigText() { | 787 | .configText(new ConfigText() { |
| 786 | @Override | 788 | @Override |
| 787 | public void onConfig(TextParams params) { | 789 | public void onConfig(TextParams params) { |
| 788 | params.gravity = Gravity.CENTER; | 790 | params.gravity = Gravity.CENTER; |
| 789 | params.padding = new int[]{50, 50, 50, 50}; | 791 | params.padding = new int[]{50, 50, 50, 50}; |
| 790 | } | 792 | } |
| 791 | }) | 793 | }) |
| 792 | .setText("当前无网络,请检查网络设置") | 794 | .setText("当前无网络,请检查网络设置") |
| 793 | .setNegative("继续使用", null) | 795 | .setNegative("继续使用", null) |
| 794 | .setPositive("设置网络", new View.OnClickListener() { | 796 | .setPositive("设置网络", new View.OnClickListener() { |
| 795 | @Override | 797 | @Override |
| 796 | public void onClick(View v) { | 798 | public void onClick(View v) { |
| 797 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 799 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 798 | mContext.startActivity(intent); | 800 | mContext.startActivity(intent); |
| 799 | } | 801 | } |
| 800 | }) | 802 | }) |
| 801 | .show(); | 803 | .show(); |
| 802 | } | 804 | } |
| 803 | }); | 805 | }); |
| 804 | } | 806 | } |
| 805 | 807 | ||
| 806 | 808 | ||
| 807 | /** | 809 | /** |
| 808 | * 获取个人信息 | 810 | * 获取个人信息 |
| 809 | * | 811 | * |
| 810 | * @param mContext | 812 | * @param mContext |
| 811 | * @param userId | 813 | * @param userId |
| 812 | * @param handler | 814 | * @param handler |
| 813 | */ | 815 | */ |
| 814 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { | 816 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
| 815 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 817 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
| 816 | false, true, null); | 818 | false, true, null); |
| 817 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 819 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 818 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 820 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
| 819 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 821 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 820 | @Override | 822 | @Override |
| 821 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 823 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 822 | closeProgress(); | 824 | closeProgress(); |
| 823 | Log.e("test", "个人信息" + new String(arg2)); | 825 | Log.e("test", "个人信息" + new String(arg2)); |
| 824 | try { | 826 | try { |
| 825 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 827 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 826 | int status = jsonObject.optInt("status"); | 828 | int status = jsonObject.optInt("status"); |
| 827 | if (status == 1) { | 829 | if (status == 1) { |
| 828 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 830 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
| 829 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 831 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
| 830 | Message message = Message.obtain(); | 832 | Message message = Message.obtain(); |
| 831 | message.what = HttpCode.GETINFO; | 833 | message.what = HttpCode.GETINFO; |
| 832 | message.obj = pesonalInfoBeanList; | 834 | message.obj = pesonalInfoBeanList; |
| 833 | handler.sendMessage(message); | 835 | handler.sendMessage(message); |
| 834 | 836 | ||
| 835 | 837 | ||
| 836 | } else { | 838 | } else { |
| 837 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 839 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 838 | 840 | ||
| 839 | } | 841 | } |
| 840 | } catch (JSONException e) { | 842 | } catch (JSONException e) { |
| 841 | e.printStackTrace(); | 843 | e.printStackTrace(); |
| 842 | } | 844 | } |
| 843 | 845 | ||
| 844 | 846 | ||
| 845 | } | 847 | } |
| 846 | 848 | ||
| 847 | @Override | 849 | @Override |
| 848 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 850 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 849 | closeProgress(); | 851 | closeProgress(); |
| 850 | new CircleDialog.Builder((FragmentActivity) mContext) | 852 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 851 | .setCanceledOnTouchOutside(false) | 853 | .setCanceledOnTouchOutside(false) |
| 852 | .setCancelable(false) | 854 | .setCancelable(false) |
| 853 | .setWidth(0.5f) | 855 | .setWidth(0.5f) |
| 854 | .configText(new ConfigText() { | 856 | .configText(new ConfigText() { |
| 855 | @Override | 857 | @Override |
| 856 | public void onConfig(TextParams params) { | 858 | public void onConfig(TextParams params) { |
| 857 | params.gravity = Gravity.CENTER; | 859 | params.gravity = Gravity.CENTER; |
| 858 | params.padding = new int[]{50, 50, 50, 50}; | 860 | params.padding = new int[]{50, 50, 50, 50}; |
| 859 | } | 861 | } |
| 860 | }) | 862 | }) |
| 861 | .setText("当前无网络,请检查网络设置") | 863 | .setText("当前无网络,请检查网络设置") |
| 862 | .setNegative("继续使用", null) | 864 | .setNegative("继续使用", null) |
| 863 | .setPositive("设置网络", new View.OnClickListener() { | 865 | .setPositive("设置网络", new View.OnClickListener() { |
| 864 | @Override | 866 | @Override |
| 865 | public void onClick(View v) { | 867 | public void onClick(View v) { |
| 866 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 868 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 867 | mContext.startActivity(intent); | 869 | mContext.startActivity(intent); |
| 868 | } | 870 | } |
| 869 | }) | 871 | }) |
| 870 | .show(); | 872 | .show(); |
| 871 | } | 873 | } |
| 872 | }); | 874 | }); |
| 873 | } | 875 | } |
| 874 | 876 | ||
| 875 | //修改个人信息 | 877 | //修改个人信息 |
| 876 | public void changepresonalinfo(final Context mContext, Long id, int type | 878 | public void changepresonalinfo(final Context mContext, Long id, int type |
| 877 | ,String name,String birthday,int gradeId,long regionId, | 879 | , String name, String birthday, int gradeId, long regionId, |
| 878 | Object schoolId,String qq,String gender | 880 | Object schoolId, String qq, String gender |
| 879 | ,String regionName,String devicenumber) throws UnsupportedEncodingException { | 881 | , String regionName, String devicenumber) throws UnsupportedEncodingException { |
| 880 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 882 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
| 881 | false, true, null); | 883 | false, true, null); |
| 882 | RequestParams params = new RequestParams(); | 884 | RequestParams params = new RequestParams(); |
| 883 | 885 | ||
| 884 | params.put(HttpKey.USEID, id); | 886 | params.put(HttpKey.USEID, id); |
| 885 | params.put(HttpKey.TYPE, type); | 887 | params.put(HttpKey.TYPE, type); |
| 886 | params.put(HttpKey.NAME, name); | 888 | params.put(HttpKey.NAME, name); |
| 887 | params.put(HttpKey.BIRDays, birthday); | 889 | params.put(HttpKey.BIRDays, birthday); |
| 888 | params.put(HttpKey.GRADE, gradeId); | 890 | params.put(HttpKey.GRADE, gradeId); |
| 889 | params.put(HttpKey.REGION, regionId); | 891 | params.put(HttpKey.REGION, regionId); |
| 890 | params.put(HttpKey.SCHOOL, schoolId); | 892 | params.put(HttpKey.SCHOOL, schoolId); |
| 891 | params.put(HttpKey.QQ, qq); | 893 | params.put(HttpKey.QQ, qq); |
| 892 | params.put(HttpKey.GENDER, gender); | 894 | params.put(HttpKey.GENDER, gender); |
| 893 | params.put(HttpKey.REGIONNAME, regionName); | 895 | params.put(HttpKey.REGIONNAME, regionName); |
| 894 | params.put(HttpKey.DEVINUMBER, devicenumber); | 896 | params.put(HttpKey.DEVINUMBER, devicenumber); |
| 895 | Log.e("test", "个人信息" + params); | 897 | Log.e("test", "个人信息" + params); |
| 896 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 898 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 897 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { | 899 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { |
| 898 | @Override | 900 | @Override |
| 899 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 901 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 900 | super.onSuccess(statusCode, headers, response); | 902 | super.onSuccess(statusCode, headers, response); |
| 901 | closeProgress(); | 903 | closeProgress(); |
| 902 | String status = response.optString("status"); | 904 | String status = response.optString("status"); |
| 903 | if (status.equals("1")) { | 905 | if (status.equals("1")) { |
| 904 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 906 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
| 905 | ((Activity) mContext).finish(); | 907 | ((Activity) mContext).finish(); |
| 906 | } else { | 908 | } else { |
| 907 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 909 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 908 | } | 910 | } |
| 909 | 911 | ||
| 910 | } | 912 | } |
| 911 | 913 | ||
| 912 | @Override | 914 | @Override |
| 913 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 915 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 914 | super.onFailure(statusCode, headers, throwable, errorResponse); | 916 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 915 | closeProgress(); | 917 | closeProgress(); |
| 916 | Log.e("test", "onFailure" + errorResponse); | 918 | Log.e("test", "onFailure" + errorResponse); |
| 917 | new CircleDialog.Builder((FragmentActivity) mContext) | 919 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 918 | .setCanceledOnTouchOutside(false) | 920 | .setCanceledOnTouchOutside(false) |
| 919 | .setCancelable(false) | 921 | .setCancelable(false) |
| 920 | .setWidth(0.5f) | 922 | .setWidth(0.5f) |
| 921 | .configText(new ConfigText() { | 923 | .configText(new ConfigText() { |
| 922 | @Override | 924 | @Override |
| 923 | public void onConfig(TextParams params) { | 925 | public void onConfig(TextParams params) { |
| 924 | params.gravity = Gravity.CENTER; | 926 | params.gravity = Gravity.CENTER; |
| 925 | params.padding = new int[]{50, 50, 50, 50}; | 927 | params.padding = new int[]{50, 50, 50, 50}; |
| 926 | } | 928 | } |
| 927 | }) | 929 | }) |
| 928 | .setText("当前无网络,请检查网络设置") | 930 | .setText("当前无网络,请检查网络设置") |
| 929 | .setNegative("继续使用", null) | 931 | .setNegative("继续使用", null) |
| 930 | .setPositive("设置网络", new View.OnClickListener() { | 932 | .setPositive("设置网络", new View.OnClickListener() { |
| 931 | @Override | 933 | @Override |
| 932 | public void onClick(View v) { | 934 | public void onClick(View v) { |
| 933 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 935 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 934 | mContext.startActivity(intent); | 936 | mContext.startActivity(intent); |
| 935 | } | 937 | } |
| 936 | }) | 938 | }) |
| 937 | .show(); | 939 | .show(); |
| 938 | } | 940 | } |
| 939 | 941 | ||
| 940 | }); | 942 | }); |
| 941 | } | 943 | } |
| 942 | 944 | ||
| 943 | //修改个性签名 | 945 | //修改个性签名 |
| 944 | public void changsignature(final Context mContext, long userId, int type, final String signature) { | 946 | public void changsignature(final Context mContext, long userId, int type, final String signature) { |
| 945 | RequestParams params = new RequestParams(); | 947 | RequestParams params = new RequestParams(); |
| 946 | params.put("userId", userId); | 948 | params.put("userId", userId); |
| 947 | params.put("type", type); | 949 | params.put("type", type); |
| 948 | params.put("signature", signature); | 950 | params.put("signature", signature); |
| 949 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 951 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 950 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 952 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
| 951 | @Override | 953 | @Override |
| 952 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 954 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 953 | try { | 955 | try { |
| 954 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 956 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 955 | String status = jsonObject.optString("status"); | 957 | String status = jsonObject.optString("status"); |
| 956 | if (status.equals("1")) { | 958 | if (status.equals("1")) { |
| 957 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 959 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
| 958 | } else { | 960 | } else { |
| 959 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 961 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 960 | } | 962 | } |
| 961 | } catch (JSONException e) { | 963 | } catch (JSONException e) { |
| 962 | e.printStackTrace(); | 964 | e.printStackTrace(); |
| 963 | } | 965 | } |
| 964 | } | 966 | } |
| 965 | 967 | ||
| 966 | @Override | 968 | @Override |
| 967 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 969 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 968 | Log.e("test", "onFailure" + new String(bytes)); | 970 | Log.e("test", "onFailure" + new String(bytes)); |
| 969 | new CircleDialog.Builder((FragmentActivity) mContext) | 971 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 970 | .setCanceledOnTouchOutside(false) | 972 | .setCanceledOnTouchOutside(false) |
| 971 | .setCancelable(false) | 973 | .setCancelable(false) |
| 972 | .setWidth(0.5f) | 974 | .setWidth(0.5f) |
| 973 | .configText(new ConfigText() { | 975 | .configText(new ConfigText() { |
| 974 | @Override | 976 | @Override |
| 975 | public void onConfig(TextParams params) { | 977 | public void onConfig(TextParams params) { |
| 976 | params.gravity = Gravity.CENTER; | 978 | params.gravity = Gravity.CENTER; |
| 977 | params.padding = new int[]{50, 50, 50, 50}; | 979 | params.padding = new int[]{50, 50, 50, 50}; |
| 978 | } | 980 | } |
| 979 | }) | 981 | }) |
| 980 | .setText("当前无网络,请检查网络设置") | 982 | .setText("当前无网络,请检查网络设置") |
| 981 | .setNegative("继续使用", null) | 983 | .setNegative("继续使用", null) |
| 982 | .setPositive("设置网络", new View.OnClickListener() { | 984 | .setPositive("设置网络", new View.OnClickListener() { |
| 983 | @Override | 985 | @Override |
| 984 | public void onClick(View v) { | 986 | public void onClick(View v) { |
| 985 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 987 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 986 | mContext.startActivity(intent); | 988 | mContext.startActivity(intent); |
| 987 | } | 989 | } |
| 988 | }) | 990 | }) |
| 989 | .show(); | 991 | .show(); |
| 990 | } | 992 | } |
| 991 | }); | 993 | }); |
| 992 | } | 994 | } |
| 993 | 995 | ||
| 994 | /** | 996 | /** |
| 995 | * 获取个性签名 | 997 | * 获取个性签名 |
| 996 | * | 998 | * |
| 997 | * @param mContext | 999 | * @param mContext |
| 998 | * @param userId | 1000 | * @param userId |
| 999 | * @param handler | 1001 | * @param handler |
| 1000 | */ | 1002 | */ |
| 1001 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { | 1003 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { |
| 1002 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1004 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1003 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 1005 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1004 | @Override | 1006 | @Override |
| 1005 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1007 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1006 | Log.e("test", "个性签名" + new String(arg2)); | 1008 | Log.e("test", "个性签名" + new String(arg2)); |
| 1007 | try { | 1009 | try { |
| 1008 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1010 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1009 | int status = jsonObject.optInt("status"); | 1011 | int status = jsonObject.optInt("status"); |
| 1010 | if (status == 1) { | 1012 | if (status == 1) { |
| 1011 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 1013 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
| 1012 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 1014 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
| 1013 | Message message = Message.obtain(); | 1015 | Message message = Message.obtain(); |
| 1014 | message.what = HttpCode.SIGN; | 1016 | message.what = HttpCode.SIGN; |
| 1015 | message.obj = signInfoBeanList; | 1017 | message.obj = signInfoBeanList; |
| 1016 | handler.sendMessage(message); | 1018 | handler.sendMessage(message); |
| 1017 | 1019 | ||
| 1018 | 1020 | ||
| 1021 | } else if (status == 1000) { | ||
| 1022 | AlertUtils.showToast(mContext, "您还没有签名哦"); | ||
| 1023 | |||
| 1019 | } else { | 1024 | } else { |
| 1020 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1025 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1021 | |||
| 1022 | } | 1026 | } |
| 1023 | } catch (JSONException e) { | 1027 | } catch (JSONException e) { |
| 1024 | e.printStackTrace(); | 1028 | e.printStackTrace(); |
| 1025 | } | 1029 | } |
| 1026 | 1030 | ||
| 1027 | 1031 | ||
| 1028 | } | 1032 | } |
| 1029 | 1033 | ||
| 1030 | @Override | 1034 | @Override |
| 1031 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1035 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1032 | Log.e("test", "失败原因" + arg3); | 1036 | Log.e("test", "失败原因" + arg3); |
| 1033 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1037 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1034 | } | 1038 | } |
| 1035 | }); | 1039 | }); |
| 1036 | } | 1040 | } |
| 1037 | 1041 | ||
| 1038 | /** | 1042 | /** |
| 1039 | * 用户反馈 | 1043 | * 用户反馈 |
| 1040 | * | 1044 | * |
| 1041 | * @param mContext | 1045 | * @param mContext |
| 1042 | * @param object | 1046 | * @param userId |
| 1047 | * @param content | ||
| 1048 | * @param contact | ||
| 1049 | * @param imgs | ||
| 1050 | * @param feedtype | ||
| 1043 | * @throws UnsupportedEncodingException | 1051 | * @throws UnsupportedEncodingException |
| 1044 | */ | 1052 | */ |
| 1045 | public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException { | 1053 | public void feedback(final Context mContext, String userId, String content, |
| 1046 | Gson gson = new Gson(); | 1054 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { |
| 1047 | String jsonObject = gson.toJson(object); | ||
| 1048 | Log.e("test", "onSuccess" + jsonObject); | ||
| 1049 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 1055 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
| 1050 | false, true, null); | 1056 | false, true, null); |
| 1051 | ByteArrayEntity entity = null; | 1057 | File file = new File(imgs); |
| 1052 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); | 1058 | if (file.exists() && file.length() > 0) { |
| 1053 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 1059 | RequestParams params = new RequestParams(); |
| 1054 | 1060 | try { | |
| 1055 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1061 | params.put("userId", userId); |
| 1056 | HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() { | 1062 | params.put("content", content); |
| 1057 | @Override | 1063 | params.put("contact", contact); |
| 1058 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 1064 | params.put("imgs", file); |
| 1059 | super.onSuccess(statusCode, headers, response); | 1065 | params.put("feedtype", feedtype); |
| 1060 | closeProgress(); | 1066 | } catch (FileNotFoundException e) { |
| 1061 | String status = response.optString("status"); | 1067 | e.printStackTrace(); |
| 1062 | if (status.equals("1")) { | ||
| 1063 | Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show(); | ||
| 1064 | ((Activity) mContext).finish(); | ||
| 1065 | } else { | ||
| 1066 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | ||
| 1067 | } | ||
| 1068 | Log.e("test", "onSuccess" + response); | ||
| 1069 | |||
| 1070 | } | 1068 | } |
| 1069 | Log.e("test", "onSuccess" + params); | ||
| 1070 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { | ||
| 1071 | @Override | ||
| 1072 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | ||
| 1073 | closeProgress(); | ||
| 1074 | Log.e("test", "onSuccess" + new String(bytes)); | ||
| 1075 | try { | ||
| 1076 | JSONObject jsonObject = new JSONObject(new String(bytes)); | ||
| 1077 | String status = jsonObject.optString("status"); | ||
| 1078 | if (status.equals("1")) { | ||
| 1079 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); | ||
| 1080 | ((Activity) mContext).finish(); | ||
| 1081 | } else { | ||
| 1082 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | ||
| 1083 | } | ||
| 1084 | } catch (JSONException e) { | ||
| 1085 | e.printStackTrace(); | ||
| 1086 | } | ||
| 1087 | } | ||
| 1071 | 1088 | ||
| 1072 | @Override | 1089 | @Override |
| 1073 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 1090 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 1074 | super.onFailure(statusCode, headers, throwable, errorResponse); | 1091 | closeProgress(); |
| 1075 | closeProgress(); | 1092 | Log.e("test", "错误信息" + new String(bytes)); |
| 1076 | Log.e("test", "onFailure" + errorResponse); | 1093 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1077 | new CircleDialog.Builder((FragmentActivity) mContext) | 1094 | .setCanceledOnTouchOutside(false) |
| 1078 | .setCanceledOnTouchOutside(false) | 1095 | .setCancelable(false) |
| 1079 | .setCancelable(false) | 1096 | .setWidth(0.5f) |
| 1080 | .setWidth(0.5f) | 1097 | .configText(new ConfigText() { |
| 1081 | .configText(new ConfigText() { | 1098 | @Override |
| 1082 | @Override | 1099 | public void onConfig(TextParams params) { |
| 1083 | public void onConfig(TextParams params) { | 1100 | params.gravity = Gravity.CENTER; |
| 1084 | params.gravity = Gravity.CENTER; | 1101 | params.padding = new int[]{50, 50, 50, 50}; |
| 1085 | params.padding = new int[]{50, 50, 50, 50}; | 1102 | } |
| 1086 | } | 1103 | }) |
| 1087 | }) | 1104 | .setText("当前无网络,请检查网络设置") |
| 1088 | .setText("当前无网络,请检查网络设置") | 1105 | .setNegative("继续使用", null) |
| 1089 | .setNegative("继续使用", null) | 1106 | .setPositive("设置网络", new View.OnClickListener() { |
| 1090 | .setPositive("设置网络", new View.OnClickListener() { | 1107 | @Override |
| 1091 | @Override | 1108 | public void onClick(View v) { |
| 1092 | public void onClick(View v) { | 1109 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1093 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1110 | mContext.startActivity(intent); |
| 1094 | mContext.startActivity(intent); | 1111 | } |
| 1095 | } | 1112 | }) |
| 1096 | }) | 1113 | .show(); |
| 1097 | .show(); | ||
| 1098 | } | ||
| 1099 | 1114 | ||
| 1100 | }); | 1115 | } |
| 1116 | }); | ||
| 1117 | } else { | ||
| 1118 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | ||
| 1119 | } | ||
| 1101 | } | 1120 | } |
| 1102 | 1121 | ||
| 1103 | /** | 1122 | /** |
| 1104 | * 查询子账户信息 | 1123 | * 查询子账户信息 |
| 1105 | * | 1124 | * |
| 1106 | * @param mContext | 1125 | * @param mContext |
| 1107 | * @param userId | 1126 | * @param userId |
| 1108 | * @param handler | 1127 | * @param handler |
| 1109 | */ | 1128 | */ |
| 1110 | public void getchildAccountinfo(final Context mContext, long userId,String deviceNumber ,final Handler handler) { | 1129 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { |
| 1111 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", | 1130 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", |
| 1112 | false, true, null); | 1131 | false, true, null); |
| 1113 | 1132 | ||
| 1114 | Log.e("test", "ID" + userId); | 1133 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); |
| 1115 | HttpClient.getInstance().setTimeout(5 * 1000); | 1134 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1116 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1135 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1117 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId+"&deviceNumber="+deviceNumber, new AsyncHttpResponseHandler() { | 1136 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 1118 | @Override | 1137 | @Override |
| 1119 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1138 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1120 | closeProgress(); | 1139 | closeProgress(); |
| 1121 | Log.e("test", "子账户信息" + new String(arg2)); | 1140 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1122 | try { | 1141 | try { |
| 1123 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1142 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1124 | int status = jsonObject.optInt("status"); | 1143 | int status = jsonObject.optInt("status"); |
| 1125 | if (status == 0) { | 1144 | if (status == 0) { |
| 1126 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 1145 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
| 1127 | } else if (status == 1000) { | 1146 | } else if(status == 1000){ |
| 1128 | AlertUtils.showToast(mContext, "你好,你还未添加子账号,子账号为空!"); | 1147 | AlertUtils.showToast(mContext, "您还没有子账户哦"); |
| 1129 | } else { | 1148 | }else { |
| 1130 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 1149 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
| 1131 | Log.e("test", "子账户信息" + childsInfo); | 1150 | Log.e("test", "子账户信息" + childsInfo); |
| 1132 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 1151 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
| 1133 | Log.e("test", "子账户信息" + schoolInfoBeanList); | 1152 | Log.e("test", "子账户信息" + schoolInfoBeanList); |
| 1134 | Message msg = Message.obtain(); | 1153 | Message msg = Message.obtain(); |
| 1135 | msg.what = HttpCode.CHILDS_SUCESS; | 1154 | msg.what = HttpCode.CHILDS_SUCESS; |
| 1136 | msg.obj = schoolInfoBeanList; | 1155 | msg.obj = schoolInfoBeanList; |
| 1137 | handler.sendMessage(msg); | 1156 | handler.sendMessage(msg); |
| 1138 | 1157 | ||
| 1139 | } | 1158 | } |
| 1140 | } catch (JSONException e) { | 1159 | } catch (JSONException e) { |
| 1141 | e.printStackTrace(); | 1160 | e.printStackTrace(); |
| 1161 | |||
| 1142 | } | 1162 | } |
| 1143 | 1163 | ||
| 1144 | } | 1164 | } |
| 1145 | 1165 | ||
| 1146 | @Override | 1166 | @Override |
| 1147 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1167 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1148 | closeProgress(); | 1168 | closeProgress(); |
| 1149 | Log.e("test", "错误信息" + new String(arg2)); | 1169 | Log.e("test", "错误信息" + new String(arg2)); |
| 1150 | new CircleDialog.Builder((FragmentActivity) mContext) | 1170 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1151 | .setCanceledOnTouchOutside(false) | 1171 | .setCanceledOnTouchOutside(false) |
| 1152 | .setCancelable(false) | 1172 | .setCancelable(false) |
| 1153 | .setWidth(0.5f) | 1173 | .setWidth(0.5f) |
| 1154 | .configText(new ConfigText() { | 1174 | .configText(new ConfigText() { |
| 1155 | @Override | 1175 | @Override |
| 1156 | public void onConfig(TextParams params) { | 1176 | public void onConfig(TextParams params) { |
| 1157 | params.gravity = Gravity.CENTER; | 1177 | params.gravity = Gravity.CENTER; |
| 1158 | params.padding = new int[]{50, 50, 50, 50}; | 1178 | params.padding = new int[]{50, 50, 50, 50}; |
| 1159 | } | 1179 | } |
| 1160 | }) | 1180 | }) |
| 1161 | .setText("当前无网络,请检查网络设置") | 1181 | .setText("当前无网络,请检查网络设置") |
| 1162 | .setNegative("继续使用", null) | 1182 | .setNegative("继续使用", null) |
| 1163 | .setPositive("设置网络", new View.OnClickListener() { | 1183 | .setPositive("设置网络", new View.OnClickListener() { |
| 1164 | @Override | 1184 | @Override |
| 1165 | public void onClick(View v) { | 1185 | public void onClick(View v) { |
| 1166 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1186 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1167 | mContext.startActivity(intent); | 1187 | mContext.startActivity(intent); |
| 1168 | } | 1188 | } |
| 1169 | }) | 1189 | }) |
| 1170 | .show(); | 1190 | .show(); |
| 1171 | } | 1191 | } |
| 1172 | }); | 1192 | }); |
| 1173 | 1193 | ||
| 1174 | } | 1194 | } |
| 1175 | 1195 | ||
| 1176 | /** | 1196 | /** |
| 1177 | * 删除子账户信息 | 1197 | * 删除子账户信息 |
| 1178 | * | 1198 | * |
| 1179 | * @param mContext | 1199 | * @param mContext |
| 1180 | * @param subAccountId | 1200 | * @param subAccountId |
| 1181 | */ | 1201 | */ |
| 1182 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { | 1202 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { |
| 1183 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 1203 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
| 1184 | false, true, null); | 1204 | false, true, null); |
| 1185 | HttpClient.getInstance().setTimeout(5 * 1000); | 1205 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1186 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1206 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1187 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 1207 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
| 1188 | @Override | 1208 | @Override |
| 1189 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1209 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1190 | closeProgress(); | 1210 | closeProgress(); |
| 1191 | Log.e("test", "子账户信息" + new String(arg2)); | 1211 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1192 | try { | 1212 | try { |
| 1193 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1213 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1194 | int status = jsonObject.optInt("status"); | 1214 | int status = jsonObject.optInt("status"); |
| 1195 | if (status == 1) { | 1215 | if (status == 1) { |
| 1196 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 1216 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
| 1197 | ((Activity) mContext).finish(); | 1217 | ((Activity) mContext).finish(); |
| 1198 | } else { | 1218 | } else { |
| 1199 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 1219 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
| 1200 | 1220 | ||
| 1201 | } | 1221 | } |
| 1202 | } catch (JSONException e) { | 1222 | } catch (JSONException e) { |
| 1203 | e.printStackTrace(); | 1223 | e.printStackTrace(); |
| 1204 | } | 1224 | } |
| 1205 | 1225 | ||
| 1206 | } | 1226 | } |
| 1207 | 1227 | ||
| 1208 | @Override | 1228 | @Override |
| 1209 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1229 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1210 | closeProgress(); | 1230 | closeProgress(); |
| 1211 | Log.e("test", "错误信息" + new String(arg2)); | 1231 | Log.e("test", "错误信息" + new String(arg2)); |
| 1212 | new CircleDialog.Builder((FragmentActivity) mContext) | 1232 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1213 | .setCanceledOnTouchOutside(false) | 1233 | .setCanceledOnTouchOutside(false) |
| 1214 | .setCancelable(false) | 1234 | .setCancelable(false) |
| 1215 | .setWidth(0.5f) | 1235 | .setWidth(0.5f) |
| 1216 | .configText(new ConfigText() { | 1236 | .configText(new ConfigText() { |
| 1217 | @Override | 1237 | @Override |
| 1218 | public void onConfig(TextParams params) { | 1238 | public void onConfig(TextParams params) { |
| 1219 | params.gravity = Gravity.CENTER; | 1239 | params.gravity = Gravity.CENTER; |
| 1220 | params.padding = new int[]{50, 50, 50, 50}; | 1240 | params.padding = new int[]{50, 50, 50, 50}; |
| 1221 | } | 1241 | } |
| 1222 | }) | 1242 | }) |
| 1223 | .setText("当前无网络,请检查网络设置") | 1243 | .setText("当前无网络,请检查网络设置") |
| 1224 | .setNegative("继续使用", null) | 1244 | .setNegative("继续使用", null) |
| 1225 | .setPositive("设置网络", new View.OnClickListener() { | 1245 | .setPositive("设置网络", new View.OnClickListener() { |
| 1226 | @Override | 1246 | @Override |
| 1227 | public void onClick(View v) { | 1247 | public void onClick(View v) { |
| 1228 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1248 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1229 | mContext.startActivity(intent); | 1249 | mContext.startActivity(intent); |
| 1230 | } | 1250 | } |
| 1231 | }) | 1251 | }) |
| 1232 | .show(); | 1252 | .show(); |
| 1233 | } | 1253 | } |
| 1234 | }); | 1254 | }); |
| 1235 | 1255 | ||
| 1236 | } | 1256 | } |
| 1237 | 1257 | ||
| 1238 | /** | 1258 | /** |
| 1239 | * 添加子账户信息 | 1259 | * 添加子账户信息 |
| 1240 | */ | 1260 | */ |
| 1241 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 1261 | public void addchildAccountinfo(final Context mContext, long parentId, String image, |
| 1242 | String name, Long grade, Object school, Long region | 1262 | String name, Long grade, Object school, Long region |
| 1243 | , String deviceNumber, String regionName) { | 1263 | , String deviceNumber, String regionName) { |
| 1244 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 1264 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
| 1245 | false, true, null); | 1265 | false, true, null); |
| 1246 | RequestParams params = new RequestParams(); | 1266 | RequestParams params = new RequestParams(); |
| 1247 | 1267 | ||
| 1248 | params.put(HttpKey.PARENTID, parentId); | 1268 | params.put(HttpKey.PARENTID, parentId); |
| 1249 | params.put(HttpKey.IMAGE, image); | 1269 | params.put(HttpKey.IMAGE, image); |
| 1250 | params.put(HttpKey.NAME, name); | 1270 | params.put(HttpKey.NAME, name); |
| 1251 | params.put(HttpKey.GRADE, grade); | 1271 | params.put(HttpKey.GRADE, grade); |
| 1252 | params.put(HttpKey.SCHOOL, school); | 1272 | params.put(HttpKey.SCHOOL, school); |
| 1253 | params.put(HttpKey.REGION, region); | 1273 | params.put(HttpKey.REGION, region); |
| 1254 | params.put(HttpKey.DEVINUMBER, deviceNumber); | 1274 | params.put(HttpKey.DEVINUMBER, deviceNumber); |
| 1255 | params.put(HttpKey.REGIONNAME, regionName); | 1275 | params.put(HttpKey.REGIONNAME, regionName); |
| 1256 | 1276 | ||
| 1257 | Log.e("test", "子账户信息" + params); | 1277 | Log.e("test", "子账户信息" + params); |
| 1258 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1278 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 1259 | HttpClient.getInstance().setTimeout(5 * 1000); | 1279 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1260 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1280 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1261 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 1281 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
| 1262 | @Override | 1282 | @Override |
| 1263 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1283 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1264 | closeProgress(); | 1284 | closeProgress(); |
| 1265 | 1285 | ||
| 1266 | Log.e("test", "子账户信息" + new String(arg2)); | 1286 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1267 | try { | 1287 | try { |
| 1268 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1288 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1269 | int status = jsonObject.optInt("status"); | 1289 | int status = jsonObject.optInt("status"); |
| 1270 | if (status == 1) { | 1290 | if (status == 1) { |
| 1271 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1291 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
| 1272 | ((Activity) mContext).finish(); | 1292 | ((Activity) mContext).finish(); |
| 1273 | } else { | 1293 | } else { |
| 1274 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1294 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
| 1275 | 1295 | ||
| 1276 | } | 1296 | } |
| 1277 | } catch (JSONException e) { | 1297 | } catch (JSONException e) { |
| 1278 | e.printStackTrace(); | 1298 | e.printStackTrace(); |
| 1279 | } | 1299 | } |
| 1280 | 1300 | ||
| 1281 | } | 1301 | } |
| 1282 | 1302 | ||
| 1283 | @Override | 1303 | @Override |
| 1284 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1304 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1285 | closeProgress(); | 1305 | closeProgress(); |
| 1286 | Log.e("test", "错误信息" + new String(arg2)); | 1306 | Log.e("test", "错误信息" + new String(arg2)); |
| 1287 | new CircleDialog.Builder((FragmentActivity) mContext) | 1307 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1288 | .setCanceledOnTouchOutside(false) | 1308 | .setCanceledOnTouchOutside(false) |
| 1289 | .setCancelable(false) | 1309 | .setCancelable(false) |
| 1290 | .setWidth(0.5f) | 1310 | .setWidth(0.5f) |
| 1291 | .configText(new ConfigText() { | 1311 | .configText(new ConfigText() { |
| 1292 | @Override | 1312 | @Override |
| 1293 | public void onConfig(TextParams params) { | 1313 | public void onConfig(TextParams params) { |
| 1294 | params.gravity = Gravity.CENTER; | 1314 | params.gravity = Gravity.CENTER; |
| 1295 | params.padding = new int[]{50, 50, 50, 50}; | 1315 | params.padding = new int[]{50, 50, 50, 50}; |
| 1296 | } | 1316 | } |
| 1297 | }) | 1317 | }) |
| 1298 | .setText("当前无网络,请检查网络设置") | 1318 | .setText("当前无网络,请检查网络设置") |
| 1299 | .setNegative("继续使用", null) | 1319 | .setNegative("继续使用", null) |
| 1300 | .setPositive("设置网络", new View.OnClickListener() { | 1320 | .setPositive("设置网络", new View.OnClickListener() { |
| 1301 | @Override | 1321 | @Override |
| 1302 | public void onClick(View v) { | 1322 | public void onClick(View v) { |
| 1303 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1323 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1304 | mContext.startActivity(intent); | 1324 | mContext.startActivity(intent); |
| 1305 | } | 1325 | } |
| 1306 | }) | 1326 | }) |
| 1307 | .show(); | 1327 | .show(); |
| 1308 | } | 1328 | } |
| 1309 | }); | 1329 | }); |
| 1310 | 1330 | ||
| 1311 | } | 1331 | } |
| 1312 | 1332 | ||
| 1313 | /** | 1333 | /** |
| 1314 | * 切换子账户信息 | 1334 | * 切换子账户信息 |
| 1315 | * | 1335 | * |
| 1316 | * @param mContext | 1336 | * @param mContext |
| 1317 | * @param subAccountId | 1337 | * @param subAccountId |
| 1318 | */ | 1338 | */ |
| 1319 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId | 1339 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId |
| 1320 | ,String deviceNumber,int type) { | 1340 | , String deviceNumber, int type) { |
| 1321 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1341 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
| 1322 | false, true, null); | 1342 | false, true, null); |
| 1323 | HttpClient.getInstance().setTimeout(5 * 1000); | 1343 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1324 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1344 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1325 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId | 1345 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId |
| 1326 | + "&deviceNumber=" + deviceNumber+ "&type=" + type, new AsyncHttpResponseHandler() { | 1346 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1327 | @Override | 1347 | @Override |
| 1328 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1348 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1329 | closeProgress(); | 1349 | closeProgress(); |
| 1330 | Log.e("test", "子账户信息" + new String(arg2)); | 1350 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1331 | try { | 1351 | try { |
| 1332 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1352 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1333 | int status = jsonObject.optInt("status"); | 1353 | int status = jsonObject.optInt("status"); |
| 1334 | if (status == 1) { | 1354 | if (status == 1) { |
| 1335 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1355 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
| 1336 | ((Activity) mContext).finish(); | 1356 | ((Activity) mContext).finish(); |
| 1337 | 1357 | ||
| 1338 | } else { | 1358 | } else { |
| 1339 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1359 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
| 1340 | 1360 | ||
| 1341 | } | 1361 | } |
| 1342 | } catch (JSONException e) { | 1362 | } catch (JSONException e) { |
| 1343 | e.printStackTrace(); | 1363 | e.printStackTrace(); |
| 1344 | } | 1364 | } |
| 1345 | 1365 | ||
| 1346 | } | 1366 | } |
| 1347 | 1367 | ||
| 1348 | @Override | 1368 | @Override |
| 1349 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1369 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1350 | closeProgress(); | 1370 | closeProgress(); |
| 1351 | Log.e("test", "错误信息" + new String(arg2)); | 1371 | Log.e("test", "错误信息" + new String(arg2)); |
| 1352 | new CircleDialog.Builder((FragmentActivity) mContext) | 1372 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1353 | .setCanceledOnTouchOutside(false) | 1373 | .setCanceledOnTouchOutside(false) |
| 1354 | .setCancelable(false) | 1374 | .setCancelable(false) |
| 1355 | .setWidth(0.5f) | 1375 | .setWidth(0.5f) |
| 1356 | .configText(new ConfigText() { | 1376 | .configText(new ConfigText() { |
| 1357 | @Override | 1377 | @Override |
| 1358 | public void onConfig(TextParams params) { | 1378 | public void onConfig(TextParams params) { |
| 1359 | params.gravity = Gravity.CENTER; | 1379 | params.gravity = Gravity.CENTER; |
| 1360 | params.padding = new int[]{50, 50, 50, 50}; | 1380 | params.padding = new int[]{50, 50, 50, 50}; |
| 1361 | } | 1381 | } |
| 1362 | }) | 1382 | }) |
| 1363 | .setText("当前无网络,请检查网络设置") | 1383 | .setText("当前无网络,请检查网络设置") |
| 1364 | .setNegative("继续使用", null) | 1384 | .setNegative("继续使用", null) |
| 1365 | .setPositive("设置网络", new View.OnClickListener() { | 1385 | .setPositive("设置网络", new View.OnClickListener() { |
| 1366 | @Override | 1386 | @Override |
| 1367 | public void onClick(View v) { | 1387 | public void onClick(View v) { |
| 1368 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1388 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1369 | mContext.startActivity(intent); | 1389 | mContext.startActivity(intent); |
| 1370 | } | 1390 | } |
| 1371 | }) | 1391 | }) |
| 1372 | .show(); | 1392 | .show(); |
| 1373 | } | 1393 | } |
| 1374 | }); | 1394 | }); |
| 1375 | 1395 | ||
| 1376 | } | 1396 | } |
| 1397 | |||
| 1377 | /** | 1398 | /** |
| 1378 | * 切换主账户信息 | 1399 | * 切换主账户信息 |
| 1379 | * | 1400 | * |
| 1380 | * @param mContext | 1401 | * @param mContext |
| 1381 | * @param type | 1402 | * @param type |
| 1382 | */ | 1403 | */ |
| 1383 | public void Accountinfo(final Context mContext, long userId | 1404 | public void Accountinfo(final Context mContext, long userId |
| 1384 | ,String deviceNumber,int type) { | 1405 | , String deviceNumber, int type) { |
| 1385 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", | 1406 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", |
| 1386 | false, true, null); | 1407 | false, true, null); |
| 1387 | HttpClient.getInstance().setTimeout(5 * 1000); | 1408 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1388 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1409 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1389 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber | 1410 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber |
| 1390 | + "&type=" + type, new AsyncHttpResponseHandler() { | 1411 | + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1391 | @Override | 1412 | @Override |
| 1392 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1413 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1393 | closeProgress(); | 1414 | closeProgress(); |
| 1394 | Log.e("test", "子账户信息" + new String(arg2)); | 1415 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1395 | try { | 1416 | try { |
| 1396 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1417 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1397 | int status = jsonObject.optInt("status"); | 1418 | int status = jsonObject.optInt("status"); |
| 1398 | if (status == 1) { | 1419 | if (status == 1) { |
| 1399 | AlertUtils.showToast(mContext, "主账号切换成功!"); | 1420 | AlertUtils.showToast(mContext, "主账号切换成功!"); |
| 1400 | ((Activity) mContext).finish(); | 1421 | ((Activity) mContext).finish(); |
| 1401 | 1422 | ||
| 1402 | } else { | 1423 | } else { |
| 1403 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); | 1424 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); |
| 1404 | 1425 | ||
| 1405 | } | 1426 | } |
| 1406 | } catch (JSONException e) { | 1427 | } catch (JSONException e) { |
| 1407 | e.printStackTrace(); | 1428 | e.printStackTrace(); |
| 1408 | } | 1429 | } |
| 1409 | 1430 | ||
| 1410 | } | 1431 | } |
| 1411 | 1432 | ||
| 1412 | @Override | 1433 | @Override |
| 1413 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1434 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1414 | closeProgress(); | 1435 | closeProgress(); |
| 1415 | Log.e("test", "错误信息" + new String(arg2)); | 1436 | Log.e("test", "错误信息" + new String(arg2)); |
| 1416 | new CircleDialog.Builder((FragmentActivity) mContext) | 1437 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1417 | .setCanceledOnTouchOutside(false) | 1438 | .setCanceledOnTouchOutside(false) |
| 1418 | .setCancelable(false) | 1439 | .setCancelable(false) |
| 1419 | .setWidth(0.5f) | 1440 | .setWidth(0.5f) |
| 1420 | .configText(new ConfigText() { | 1441 | .configText(new ConfigText() { |
| 1421 | @Override | 1442 | @Override |
| 1422 | public void onConfig(TextParams params) { | 1443 | public void onConfig(TextParams params) { |
| 1423 | params.gravity = Gravity.CENTER; | 1444 | params.gravity = Gravity.CENTER; |
| 1424 | params.padding = new int[]{50, 50, 50, 50}; | 1445 | params.padding = new int[]{50, 50, 50, 50}; |
| 1425 | } | 1446 | } |
| 1426 | }) | 1447 | }) |
| 1427 | .setText("当前无网络,请检查网络设置") | 1448 | .setText("当前无网络,请检查网络设置") |
| 1428 | .setNegative("继续使用", null) | 1449 | .setNegative("继续使用", null) |
| 1429 | .setPositive("设置网络", new View.OnClickListener() { | 1450 | .setPositive("设置网络", new View.OnClickListener() { |
| 1430 | @Override | 1451 | @Override |
| 1431 | public void onClick(View v) { | 1452 | public void onClick(View v) { |
| 1432 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1453 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1433 | mContext.startActivity(intent); | 1454 | mContext.startActivity(intent); |
| 1434 | } | 1455 | } |
| 1435 | }) | 1456 | }) |
| 1436 | .show(); | 1457 | .show(); |
| 1437 | } | 1458 | } |
| 1438 | }); | 1459 | }); |
| 1439 | 1460 | ||
| 1440 | } | 1461 | } |
| 1441 | 1462 | ||
| 1442 | /** | 1463 | /** |
| 1464 | * 头像 | ||
| 1465 | * | ||
| 1466 | * @param mContext | ||
| 1467 | * @param userId | ||
| 1468 | * @param img | ||
| 1469 | * @throws UnsupportedEncodingException | ||
| 1470 | */ | ||
| 1471 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { | ||
| 1472 | // mProgress = DialogPermission.showProgress(mContext, null, "正在上传头像...", | ||
| 1473 | // false, true, null); | ||
| 1474 | File file = new File(img); | ||
| 1475 | if (file.exists() && file.length() > 0) { | ||
| 1476 | RequestParams params = new RequestParams(); | ||
| 1477 | try { | ||
| 1478 | params.put("userId", userId); | ||
| 1479 | params.put("type", type); | ||
| 1480 | params.put("img", file); | ||
| 1481 | } catch (FileNotFoundException e) { | ||
| 1482 | e.printStackTrace(); | ||
| 1483 | } | ||
| 1484 | Log.e("test", "onSuccess" + params); | ||
| 1485 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { | ||
| 1486 | @Override | ||
| 1487 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | ||
| 1488 | closeProgress(); | ||
| 1489 | Log.e("test", "onSuccess" + new String(bytes)); | ||
| 1490 | try { | ||
| 1491 | JSONObject jsonObject = new JSONObject(new String(bytes)); | ||
| 1492 | String status = jsonObject.optString("status"); | ||
| 1493 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); | ||
| 1494 | String imagUrl = jsonObject1.optString("imgUrl"); | ||
| 1495 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); | ||
| 1496 | if (status.equals("1")) { | ||
| 1497 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | ||
| 1498 | } else { | ||
| 1499 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | ||
| 1500 | } | ||
| 1501 | } catch (JSONException e) { | ||
| 1502 | e.printStackTrace(); | ||
| 1503 | } | ||
| 1504 | } | ||
| 1505 | |||
| 1506 | @Override | ||
| 1507 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | ||
| 1508 | closeProgress(); | ||
| 1509 | Log.e("test", "错误信息" + new String(bytes)); | ||
| 1510 | new CircleDialog.Builder((FragmentActivity) mContext) | ||
| 1511 | .setCanceledOnTouchOutside(false) | ||
| 1512 | .setCancelable(false) | ||
| 1513 | .setWidth(0.5f) | ||
| 1514 | .configText(new ConfigText() { | ||
| 1515 | @Override | ||
| 1516 | public void onConfig(TextParams params) { | ||
| 1517 | params.gravity = Gravity.CENTER; | ||
| 1518 | params.padding = new int[]{50, 50, 50, 50}; | ||
| 1519 | } | ||
| 1520 | }) | ||
| 1521 | .setText("当前无网络,请检查网络设置") | ||
| 1522 | .setNegative("继续使用", null) | ||
| 1523 | .setPositive("设置网络", new View.OnClickListener() { | ||
| 1524 | @Override | ||
| 1525 | public void onClick(View v) { | ||
| 1526 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | ||
| 1527 | mContext.startActivity(intent); | ||
| 1528 | } | ||
| 1529 | }) | ||
| 1530 | .show(); | ||
| 1531 | |||
| 1532 | } | ||
| 1533 | }); | ||
| 1534 | } else { | ||
| 1535 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | ||
| 1536 | } | ||
| 1537 | } | ||
| 1538 | |||
| 1539 | |||
| 1540 | /** | ||
| 1443 | * 系统升级 | 1541 | * 系统升级 |
| 1444 | * | 1542 | * |
| 1445 | * @param mContext | 1543 | * @param mContext |
| 1446 | * @param pid appName | 1544 | * @param pid appName |
| 1447 | */ | 1545 | */ |
| 1448 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1546 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
| 1449 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1547 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
| 1450 | false, true, null); | 1548 | false, true, null); |
| 1451 | HttpClient.getInstance().setTimeout(5 * 1000); | 1549 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1452 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1550 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1453 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1551 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
| 1454 | @Override | 1552 | @Override |
| 1455 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1553 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1456 | closeProgress(); | 1554 | closeProgress(); |
| 1457 | Log.e("test", "版本升级信息" + new String(arg2)); | 1555 | Log.e("test", "版本升级信息" + new String(arg2)); |
| 1458 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 | 1556 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 |
| 1459 | Message msg = Message.obtain(); | 1557 | Message msg = Message.obtain(); |
| 1460 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1558 | msg.what = HttpCode.APPUPDATE_SUCESS; |
| 1461 | msg.obj = appVersion; | 1559 | msg.obj = appVersion; |
| 1462 | handler.sendMessage(msg); | 1560 | handler.sendMessage(msg); |
| 1463 | 1561 | ||
| 1464 | 1562 | ||
| 1465 | } | 1563 | } |
| 1466 | 1564 | ||
| 1467 | @Override | 1565 | @Override |
| 1468 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1566 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1469 | closeProgress(); | 1567 | closeProgress(); |
| 1470 | Log.e("test", "错误信息" + new String(arg2)); | 1568 | Log.e("test", "错误信息" + new String(arg2)); |
| 1471 | new CircleDialog.Builder((FragmentActivity) mContext) | 1569 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1472 | .setCanceledOnTouchOutside(false) | 1570 | .setCanceledOnTouchOutside(false) |
| 1473 | .setCancelable(false) | 1571 | .setCancelable(false) |
| 1474 | .setWidth(0.5f) | 1572 | .setWidth(0.5f) |
| 1475 | .configText(new ConfigText() { | 1573 | .configText(new ConfigText() { |
| 1476 | @Override | 1574 | @Override |
| 1477 | public void onConfig(TextParams params) { | 1575 | public void onConfig(TextParams params) { |
| 1478 | params.gravity = Gravity.CENTER; | 1576 | params.gravity = Gravity.CENTER; |
| 1479 | params.padding = new int[]{50, 50, 50, 50}; | 1577 | params.padding = new int[]{50, 50, 50, 50}; |
| 1480 | } | 1578 | } |
| 1481 | }) | 1579 | }) |
| 1482 | .setText("当前无网络,请检查网络设置") | 1580 | .setText("当前无网络,请检查网络设置") |
| 1483 | .setNegative("继续使用", null) | 1581 | .setNegative("继续使用", null) |
| 1484 | .setPositive("设置网络", new View.OnClickListener() { | 1582 | .setPositive("设置网络", new View.OnClickListener() { |
| 1485 | @Override | 1583 | @Override |
| 1486 | public void onClick(View v) { | 1584 | public void onClick(View v) { |
| 1487 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1585 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1488 | mContext.startActivity(intent); | 1586 | mContext.startActivity(intent); |
| 1489 | } | 1587 | } |
| 1490 | }) | 1588 | }) |
| 1491 | .show(); | 1589 | .show(); |
| 1492 | } | 1590 | } |
| 1493 | }); | 1591 | }); |
| 1494 | 1592 | ||
| 1495 | } | 1593 | } |
| 1496 | 1594 | ||
| 1497 | 1595 | ||
| 1498 | ///省级接口 | 1596 | ///省级接口 |
| 1499 | public void provices(final Context mContext, final Handler handler) { | 1597 | public void provices(final Context mContext, final Handler handler) { |
| 1500 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1598 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1501 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1599 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
| 1502 | @Override | 1600 | @Override |
| 1503 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1601 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1504 | Log.e("test", "省" + new String(arg2)); | 1602 | Log.e("test", "省" + new String(arg2)); |
| 1505 | try { | 1603 | try { |
| 1506 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1604 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1507 | int status = jsonObject.optInt("status"); | 1605 | int status = jsonObject.optInt("status"); |
| 1508 | if (status == 100) { | 1606 | if (status == 100) { |
| 1509 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1607 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
| 1510 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1608 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
| 1511 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1609 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
| 1512 | Message message = Message.obtain(); | 1610 | Message message = Message.obtain(); |
| 1513 | message.what = HttpCode.PROVICES; | 1611 | message.what = HttpCode.PROVICES; |
| 1514 | message.obj = provincesBeanList; | 1612 | message.obj = provincesBeanList; |
| 1515 | handler.sendMessage(message); | 1613 | handler.sendMessage(message); |
| 1516 | 1614 | ||
| 1517 | 1615 | ||
| 1518 | } else { | 1616 | } else { |
| 1519 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1617 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1520 | 1618 | ||
| 1521 | } | 1619 | } |
| 1522 | } catch (JSONException e) { | 1620 | } catch (JSONException e) { |
| 1523 | e.printStackTrace(); | 1621 | e.printStackTrace(); |
| 1524 | } | 1622 | } |
| 1525 | 1623 | ||
| 1526 | 1624 | ||
| 1527 | } | 1625 | } |
| 1528 | 1626 | ||
| 1529 | @Override | 1627 | @Override |
| 1530 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1628 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1531 | new CircleDialog.Builder((FragmentActivity) mContext) | 1629 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1532 | .setCanceledOnTouchOutside(false) | 1630 | .setCanceledOnTouchOutside(false) |
| 1533 | .setCancelable(false) | 1631 | .setCancelable(false) |
| 1534 | .setWidth(0.5f) | 1632 | .setWidth(0.5f) |
| 1535 | .configText(new ConfigText() { | 1633 | .configText(new ConfigText() { |
| 1536 | @Override | 1634 | @Override |
| 1537 | public void onConfig(TextParams params) { | 1635 | public void onConfig(TextParams params) { |
| 1538 | params.gravity = Gravity.CENTER; | 1636 | params.gravity = Gravity.CENTER; |
| 1539 | params.padding = new int[]{50, 50, 50, 50}; | 1637 | params.padding = new int[]{50, 50, 50, 50}; |
| 1540 | } | 1638 | } |
| 1541 | }) | 1639 | }) |
| 1542 | .setText("当前无网络,请检查网络设置") | 1640 | .setText("当前无网络,请检查网络设置") |
| 1543 | .setNegative("继续使用", null) | 1641 | .setNegative("继续使用", null) |
| 1544 | .setPositive("设置网络", new View.OnClickListener() { | 1642 | .setPositive("设置网络", new View.OnClickListener() { |
| 1545 | @Override | 1643 | @Override |
| 1546 | public void onClick(View v) { | 1644 | public void onClick(View v) { |
| 1547 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1645 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1548 | mContext.startActivity(intent); | 1646 | mContext.startActivity(intent); |
| 1549 | } | 1647 | } |
| 1550 | }) | 1648 | }) |
| 1551 | .show(); | 1649 | .show(); |
| 1552 | } | 1650 | } |
| 1553 | }); | 1651 | }); |
| 1554 | } | 1652 | } |
| 1555 | 1653 | ||
| 1556 | //市级接口 | 1654 | //市级接口 |
| 1557 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1655 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
| 1558 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1656 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1559 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1657 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
| 1560 | @Override | 1658 | @Override |
| 1561 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1659 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1562 | Log.e("test", "市" + new String(arg2)); | 1660 | Log.e("test", "市" + new String(arg2)); |
| 1563 | try { | 1661 | try { |
| 1564 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1662 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1565 | int status = jsonObject.optInt("status"); | 1663 | int status = jsonObject.optInt("status"); |
| 1566 | if (status == 100) { | 1664 | if (status == 100) { |
| 1567 | Gson gson = new Gson(); | 1665 | Gson gson = new Gson(); |
| 1568 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1666 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
| 1569 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1667 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
| 1570 | Message message = Message.obtain(); | 1668 | Message message = Message.obtain(); |
| 1571 | message.what = HttpCode.CITYS; | 1669 | message.what = HttpCode.CITYS; |
| 1572 | message.obj = cityInfoBeanList; | 1670 | message.obj = cityInfoBeanList; |
| 1573 | handler.sendMessage(message); | 1671 | handler.sendMessage(message); |
| 1574 | 1672 | ||
| 1575 | } else { | 1673 | } else { |
| 1576 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1674 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1577 | 1675 | ||
| 1578 | } | 1676 | } |
| 1579 | } catch (JSONException e) { | 1677 | } catch (JSONException e) { |
| 1580 | e.printStackTrace(); | 1678 | e.printStackTrace(); |
| 1581 | } | 1679 | } |
| 1582 | 1680 | ||
| 1583 | 1681 | ||
| 1584 | } | 1682 | } |
| 1585 | 1683 | ||
| 1586 | @Override | 1684 | @Override |
| 1587 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1685 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1588 | new CircleDialog.Builder((FragmentActivity) mContext) | 1686 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1589 | .setCanceledOnTouchOutside(false) | 1687 | .setCanceledOnTouchOutside(false) |
| 1590 | .setCancelable(false) | 1688 | .setCancelable(false) |
| 1591 | .setWidth(0.5f) | 1689 | .setWidth(0.5f) |
| 1592 | .configText(new ConfigText() { | 1690 | .configText(new ConfigText() { |
| 1593 | @Override | 1691 | @Override |
| 1594 | public void onConfig(TextParams params) { | 1692 | public void onConfig(TextParams params) { |
| 1595 | params.gravity = Gravity.CENTER; | 1693 | params.gravity = Gravity.CENTER; |
| 1596 | params.padding = new int[]{50, 50, 50, 50}; | 1694 | params.padding = new int[]{50, 50, 50, 50}; |
| 1597 | } | 1695 | } |
| 1598 | }) | 1696 | }) |
| 1599 | .setText("当前无网络,请检查网络设置") | 1697 | .setText("当前无网络,请检查网络设置") |
| 1600 | .setNegative("继续使用", null) | 1698 | .setNegative("继续使用", null) |
| 1601 | .setPositive("设置网络", new View.OnClickListener() { | 1699 | .setPositive("设置网络", new View.OnClickListener() { |
| 1602 | @Override | 1700 | @Override |
| 1603 | public void onClick(View v) { | 1701 | public void onClick(View v) { |
| 1604 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1702 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1605 | mContext.startActivity(intent); | 1703 | mContext.startActivity(intent); |
| 1606 | } | 1704 | } |
| 1607 | }) | 1705 | }) |
| 1608 | .show(); | 1706 | .show(); |
| 1609 | } | 1707 | } |
| 1610 | }); | 1708 | }); |
| 1611 | } | 1709 | } |
| 1612 | 1710 | ||
| 1613 | //区县级接口 | 1711 | //区县级接口 |
| 1614 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1712 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
| 1615 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1713 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1616 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1714 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
| 1617 | @Override | 1715 | @Override |
| 1618 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1716 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1619 | Log.e("test", "区" + new String(arg2)); | 1717 | Log.e("test", "区" + new String(arg2)); |
| 1620 | try { | 1718 | try { |
| 1621 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1719 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1622 | int status = jsonObject.optInt("status"); | 1720 | int status = jsonObject.optInt("status"); |
| 1623 | if (status == 100) { | 1721 | if (status == 100) { |
| 1624 | Gson gson = new Gson(); | 1722 | Gson gson = new Gson(); |
| 1625 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1723 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
| 1626 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1724 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
| 1627 | Message message = Message.obtain(); | 1725 | Message message = Message.obtain(); |
| 1628 | message.what = HttpCode.COUNTRY; | 1726 | message.what = HttpCode.COUNTRY; |
| 1629 | message.obj = countyInfoInfoBeanList; | 1727 | message.obj = countyInfoInfoBeanList; |
| 1630 | handler.sendMessage(message); | 1728 | handler.sendMessage(message); |
| 1631 | } else { | 1729 | } else { |
| 1632 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1730 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1633 | 1731 | ||
| 1634 | } | 1732 | } |
| 1635 | } catch (JSONException e) { | 1733 | } catch (JSONException e) { |
| 1636 | e.printStackTrace(); | 1734 | e.printStackTrace(); |
| 1637 | } | 1735 | } |
| 1638 | 1736 | ||
| 1639 | 1737 | ||
| 1640 | } | 1738 | } |
| 1641 | 1739 | ||
| 1642 | @Override | 1740 | @Override |
| 1643 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1741 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1644 | new CircleDialog.Builder((FragmentActivity) mContext) | 1742 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1645 | .setCanceledOnTouchOutside(false) | 1743 | .setCanceledOnTouchOutside(false) |
| 1646 | .setCancelable(false) | 1744 | .setCancelable(false) |
| 1647 | .setWidth(0.5f) | 1745 | .setWidth(0.5f) |
| 1648 | .configText(new ConfigText() { | 1746 | .configText(new ConfigText() { |
| 1649 | @Override | 1747 | @Override |
| 1650 | public void onConfig(TextParams params) { | 1748 | public void onConfig(TextParams params) { |
| 1651 | params.gravity = Gravity.CENTER; | 1749 | params.gravity = Gravity.CENTER; |
| 1652 | params.padding = new int[]{50, 50, 50, 50}; | 1750 | params.padding = new int[]{50, 50, 50, 50}; |
| 1653 | } | 1751 | } |
| 1654 | }) | 1752 | }) |
| 1655 | .setText("当前无网络,请检查网络设置") | 1753 | .setText("当前无网络,请检查网络设置") |
| 1656 | .setNegative("继续使用", null) | 1754 | .setNegative("继续使用", null) |
| 1657 | .setPositive("设置网络", new View.OnClickListener() { | 1755 | .setPositive("设置网络", new View.OnClickListener() { |
| 1658 | @Override | 1756 | @Override |
| 1659 | public void onClick(View v) { | 1757 | public void onClick(View v) { |
| 1660 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1758 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1661 | mContext.startActivity(intent); | 1759 | mContext.startActivity(intent); |
| 1662 | } | 1760 | } |
| 1663 | }) | 1761 | }) |
| 1664 | .show(); | 1762 | .show(); |
| 1665 | } | 1763 | } |
| 1666 | }); | 1764 | }); |
| 1667 | } | 1765 | } |
| 1668 | 1766 | ||
| 1669 | 1767 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
| 1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * Created by h on 2017/8/15. | 4 | * Created by h on 2017/8/15. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | public class HttpUrl { | 7 | public class HttpUrl { |
| 8 | private final static String Enviroment = "DEVELOPMENT"; | 8 | private final static String Enviroment = "DEVELOPMENT"; |
| 9 | 9 | ||
| 10 | public static String GetDomain(){ | 10 | public static String GetDomain(){ |
| 11 | return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; | 11 | return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 | 14 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 |
| 15 | public static String schoolUrl = GetDomain()+"/school/get";//学校 | 15 | public static String schoolUrl = GetDomain()+"/school/get";//学校 |
| 16 | public static String gradesUrl = GetDomain()+"/grades";//年级 | 16 | public static String gradesUrl = GetDomain()+"/grades";//年级 |
| 17 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 | 17 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 |
| 18 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 | 18 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 |
| 19 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 | 19 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 |
| 20 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ | 20 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ |
| 21 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 | 21 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 |
| 22 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 | 22 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 |
| 23 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 | 23 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 |
| 24 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 | 24 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 |
| 25 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 | 25 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 |
| 26 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 | 26 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 |
| 27 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 | 27 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 |
| 28 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 | 28 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 |
| 29 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 | 29 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 |
| 30 | public static String getpresonalinfo=GetDomain()+"/personal/get";//获取个人信息 | 30 | public static String getpresonalinfo=GetDomain()+"/personal/get";//获取个人信息 |
| 31 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 | 31 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 |
| 32 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 | 32 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 |
| 33 | public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 | 33 | public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 |
| 34 | public static String childUserURL=GetDomain()+"/childUser/info";//获取子账户信息 | 34 | public static String childUserURL=GetDomain()+"/childUser/info";//获取子账户信息 |
| 35 | public static String deletechildUserURL=GetDomain()+"/childUser/delete";//删除子账户 | 35 | public static String deletechildUserURL=GetDomain()+"/childUser/delete";//删除子账户 |
| 36 | public static String addchildUserURL=GetDomain()+"/childUser/addChildUser";//添加子账户 | 36 | public static String addchildUserURL=GetDomain()+"/childUser/addChildUser";//添加子账户 |
| 37 | public static String changechildUserURL=GetDomain()+"/childUser/update";//切换子账户 | 37 | public static String changechildUserURL=GetDomain()+"/childUser/update";//切换子账户 |
| 38 | public static String updateappURL=GetDomain()+"/general/release/version";//系统升级 | 38 | public static String updateappURL=GetDomain()+"/general/release/version";//系统升级 |
| 39 | public static String headerURL=GetDomain()+"/profile/picture/update";//头像上传 | ||
| 39 | 40 | ||
| 40 | 41 | ||
| 41 | 42 | ||
| 42 | 43 | ||
| 43 | 44 | ||
| 44 | } | 45 | } |
| 45 | 46 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/PesonalInfo.java
| 1 | package com.hjx.personalcenter.model; | 1 | package com.hjx.personalcenter.model; |
| 2 | 2 | ||
| 3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
| 4 | 4 | ||
| 5 | /** | 5 | /** |
| 6 | * Created by h on 2017/8/22. | 6 | * Created by h on 2017/8/22. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | public class PesonalInfo implements Serializable{ | 9 | public class PesonalInfo implements Serializable{ |
| 10 | 10 | ||
| 11 | /** | 11 | /** |
| 12 | * status : 1 | 12 | * status : 1 |
| 13 | * pageSize : 0 | 13 | * pageSize : 0 |
| 14 | * data : {"region":{"regionName":"闵行区","regionId":"310112"},"nickName":"1688kkkkkkkkk","gender":"female","school":{"schoolId":"499705","schoolName":"上海五中"},"grade":{"gradeName":"初中六年级","gradeId":"9"},"birthday":"2017-09-12","qq":"1666600"} | 14 | * data : {"region":{"regionName":"闵行区","regionId":"310112"},"nickName":"1688kkkkkkkkk","gender":"female","school":{"schoolId":"499705","schoolName":"上海五中"},"grade":{"gradeName":"初中六年级","gradeId":"9"},"birthday":"2017-09-12","qq":"1666600"} |
| 15 | * msg : success | 15 | * msg : success |
| 16 | * pageNum : 0 | 16 | * pageNum : 0 |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | private int status; | 19 | private int status; |
| 20 | private int pageSize; | 20 | private int pageSize; |
| 21 | private DataBean data; | 21 | private DataBean data; |
| 22 | private String msg; | 22 | private String msg; |
| 23 | private int pageNum; | 23 | private int pageNum; |
| 24 | 24 | ||
| 25 | public int getStatus() { | 25 | public int getStatus() { |
| 26 | return status; | 26 | return status; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | public void setStatus(int status) { | 29 | public void setStatus(int status) { |
| 30 | this.status = status; | 30 | this.status = status; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | public int getPageSize() { | 33 | public int getPageSize() { |
| 34 | return pageSize; | 34 | return pageSize; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | public void setPageSize(int pageSize) { | 37 | public void setPageSize(int pageSize) { |
| 38 | this.pageSize = pageSize; | 38 | this.pageSize = pageSize; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | public DataBean getData() { | 41 | public DataBean getData() { |
| 42 | return data; | 42 | return data; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | public void setData(DataBean data) { | 45 | public void setData(DataBean data) { |
| 46 | this.data = data; | 46 | this.data = data; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | public String getMsg() { | 49 | public String getMsg() { |
| 50 | return msg; | 50 | return msg; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | public void setMsg(String msg) { | 53 | public void setMsg(String msg) { |
| 54 | this.msg = msg; | 54 | this.msg = msg; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | public int getPageNum() { | 57 | public int getPageNum() { |
| 58 | return pageNum; | 58 | return pageNum; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | public void setPageNum(int pageNum) { | 61 | public void setPageNum(int pageNum) { |
| 62 | this.pageNum = pageNum; | 62 | this.pageNum = pageNum; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | public static class DataBean { | 65 | public static class DataBean { |
| 66 | /** | 66 | /** |
| 67 | * region : {"regionName":"闵行区","regionId":"310112"} | 67 | * region : {"regionName":"闵行区","regionId":"310112"} |
| 68 | * nickName : 1688kkkkkkkkk | 68 | * nickName : 1688kkkkkkkkk |
| 69 | * gender : female | 69 | * gender : female |
| 70 | * school : {"schoolId":"499705","schoolName":"上海五中"} | 70 | * school : {"schoolId":"499705","schoolName":"上海五中"} |
| 71 | * grade : {"gradeName":"初中六年级","gradeId":"9"} | 71 | * grade : {"gradeName":"初中六年级","gradeId":"9"} |
| 72 | * birthday : 2017-09-12 | 72 | * birthday : 2017-09-12 |
| 73 | * qq : 1666600 | 73 | * qq : 1666600 |
| 74 | */ | 74 | */ |
| 75 | 75 | ||
| 76 | private RegionBean region; | 76 | private RegionBean region; |
| 77 | private String nickName; | 77 | private String nickName; |
| 78 | private String gender; | 78 | private String gender; |
| 79 | |||
| 80 | private String portrait; | ||
| 79 | private SchoolBean school; | 81 | private SchoolBean school; |
| 80 | private GradeBean grade; | 82 | private GradeBean grade; |
| 81 | private String birthday; | 83 | private String birthday; |
| 82 | private String qq; | 84 | private String qq; |
| 85 | public String getPortrait() { | ||
| 86 | return portrait; | ||
| 87 | } | ||
| 83 | 88 | ||
| 89 | public void setPortrait(String portrait) { | ||
| 90 | this.portrait = portrait; | ||
| 91 | } | ||
| 84 | public RegionBean getRegion() { | 92 | public RegionBean getRegion() { |
| 85 | return region; | 93 | return region; |
| 86 | } | 94 | } |
| 87 | 95 | ||
| 88 | public void setRegion(RegionBean region) { | 96 | public void setRegion(RegionBean region) { |
| 89 | this.region = region; | 97 | this.region = region; |
| 90 | } | 98 | } |
| 91 | 99 | ||
| 92 | public String getNickName() { | 100 | public String getNickName() { |
| 93 | return nickName; | 101 | return nickName; |
| 94 | } | 102 | } |
| 95 | 103 | ||
| 96 | public void setNickName(String nickName) { | 104 | public void setNickName(String nickName) { |
| 97 | this.nickName = nickName; | 105 | this.nickName = nickName; |
| 98 | } | 106 | } |
| 99 | 107 | ||
| 100 | public String getGender() { | 108 | public String getGender() { |
| 101 | return gender; | 109 | return gender; |
| 102 | } | 110 | } |
| 103 | 111 | ||
| 104 | public void setGender(String gender) { | 112 | public void setGender(String gender) { |
| 105 | this.gender = gender; | 113 | this.gender = gender; |
| 106 | } | 114 | } |
| 107 | 115 | ||
| 108 | public SchoolBean getSchool() { | 116 | public SchoolBean getSchool() { |
| 109 | return school; | 117 | return school; |
| 110 | } | 118 | } |
| 111 | 119 | ||
| 112 | public void setSchool(SchoolBean school) { | 120 | public void setSchool(SchoolBean school) { |
| 113 | this.school = school; | 121 | this.school = school; |
| 114 | } | 122 | } |
| 115 | 123 | ||
| 116 | public GradeBean getGrade() { | 124 | public GradeBean getGrade() { |
| 117 | return grade; | 125 | return grade; |
| 118 | } | 126 | } |
| 119 | 127 | ||
| 120 | public void setGrade(GradeBean grade) { | 128 | public void setGrade(GradeBean grade) { |
| 121 | this.grade = grade; | 129 | this.grade = grade; |
| 122 | } | 130 | } |
| 123 | 131 | ||
| 124 | public String getBirthday() { | 132 | public String getBirthday() { |
| 125 | return birthday; | 133 | return birthday; |
| 126 | } | 134 | } |
| 127 | 135 | ||
| 128 | public void setBirthday(String birthday) { | 136 | public void setBirthday(String birthday) { |
| 129 | this.birthday = birthday; | 137 | this.birthday = birthday; |
| 130 | } | 138 | } |
| 131 | 139 | ||
| 132 | public String getQq() { | 140 | public String getQq() { |
| 133 | return qq; | 141 | return qq; |
| 134 | } | 142 | } |
| 135 | 143 | ||
| 136 | public void setQq(String qq) { | 144 | public void setQq(String qq) { |
| 137 | this.qq = qq; | 145 | this.qq = qq; |
| 138 | } | 146 | } |
| 139 | 147 | ||
| 140 | public static class RegionBean { | 148 | public static class RegionBean { |
| 141 | /** | 149 | /** |
| 142 | * regionName : 闵行区 | 150 | * regionName : 闵行区 |
| 143 | * regionId : 310112 | 151 | * regionId : 310112 |
| 144 | */ | 152 | */ |
| 145 | 153 | ||
| 146 | private String regionName; | 154 | private String regionName; |
| 147 | private String regionId; | 155 | private String regionId; |
| 148 | 156 | ||
| 149 | public String getRegionName() { | 157 | public String getRegionName() { |
| 150 | return regionName; | 158 | return regionName; |
| 151 | } | 159 | } |
| 152 | 160 | ||
| 153 | public void setRegionName(String regionName) { | 161 | public void setRegionName(String regionName) { |
| 154 | this.regionName = regionName; | 162 | this.regionName = regionName; |
| 155 | } | 163 | } |
| 156 | 164 | ||
| 157 | public String getRegionId() { | 165 | public String getRegionId() { |
| 158 | return regionId; | 166 | return regionId; |
| 159 | } | 167 | } |
| 160 | 168 | ||
| 161 | public void setRegionId(String regionId) { | 169 | public void setRegionId(String regionId) { |
| 162 | this.regionId = regionId; | 170 | this.regionId = regionId; |
| 163 | } | 171 | } |
| 164 | } | 172 | } |
| 165 | 173 | ||
| 166 | public static class SchoolBean { | 174 | public static class SchoolBean { |
| 167 | /** | 175 | /** |
| 168 | * schoolId : 499705 | 176 | * schoolId : 499705 |
| 169 | * schoolName : 上海五中 | 177 | * schoolName : 上海五中 |
| 170 | */ | 178 | */ |
| 171 | 179 | ||
| 172 | private String schoolId; | 180 | private String schoolId; |
| 173 | private String schoolName; | 181 | private String schoolName; |
| 174 | 182 | ||
| 175 | public String getSchoolId() { | 183 | public String getSchoolId() { |
| 176 | return schoolId; | 184 | return schoolId; |
| 177 | } | 185 | } |
| 178 | 186 | ||
| 179 | public void setSchoolId(String schoolId) { | 187 | public void setSchoolId(String schoolId) { |
| 180 | this.schoolId = schoolId; | 188 | this.schoolId = schoolId; |
| 181 | } | 189 | } |
| 182 | 190 | ||
| 183 | public String getSchoolName() { | 191 | public String getSchoolName() { |
| 184 | return schoolName; | 192 | return schoolName; |
| 185 | } | 193 | } |
| 186 | 194 | ||
| 187 | public void setSchoolName(String schoolName) { | 195 | public void setSchoolName(String schoolName) { |
| 188 | this.schoolName = schoolName; | 196 | this.schoolName = schoolName; |
| 189 | } | 197 | } |
| 190 | } | 198 | } |
| 191 | 199 | ||
| 192 | public static class GradeBean { | 200 | public static class GradeBean { |
| 193 | /** | 201 | /** |
| 194 | * gradeName : 初中六年级 | 202 | * gradeName : 初中六年级 |
| 195 | * gradeId : 9 | 203 | * gradeId : 9 |
| 196 | */ | 204 | */ |
| 197 | 205 | ||
| 198 | private String gradeName; | 206 | private String gradeName; |
| 199 | private String gradeId; | 207 | private String gradeId; |
| 200 | 208 | ||
| 201 | public String getGradeName() { | 209 | public String getGradeName() { |
| 202 | return gradeName; | 210 | return gradeName; |
| 203 | } | 211 | } |
| 204 | 212 | ||
| 205 | public void setGradeName(String gradeName) { | 213 | public void setGradeName(String gradeName) { |
| 206 | this.gradeName = gradeName; | 214 | this.gradeName = gradeName; |
| 207 | } | 215 | } |
| 208 | 216 | ||
| 209 | public String getGradeId() { | 217 | public String getGradeId() { |
| 210 | return gradeId; | 218 | return gradeId; |
| 211 | } | 219 | } |
| 212 | 220 | ||
| 213 | public void setGradeId(String gradeId) { | 221 | public void setGradeId(String gradeId) { |
| 214 | this.gradeId = gradeId; | 222 | this.gradeId = gradeId; |
| 215 | } | 223 | } |
| 216 | } | 224 | } |
| 217 | } | 225 | } |
| 218 | } | 226 | } |
| 219 | 227 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/MachineUtil.java
| 1 | package com.hjx.personalcenter.util; | 1 | package com.hjx.personalcenter.util; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.os.Build; | 4 | import android.os.Build; |
| 5 | import android.provider.Settings; | 5 | import android.provider.Settings; |
| 6 | import android.telephony.TelephonyManager; | 6 | import android.telephony.TelephonyManager; |
| 7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 8 | 8 | ||
| 9 | import java.io.InputStreamReader; | 9 | import java.io.InputStreamReader; |
| 10 | import java.io.LineNumberReader; | 10 | import java.io.LineNumberReader; |
| 11 | 11 | ||
| 12 | public class MachineUtil { | 12 | public class MachineUtil { |
| 13 | 13 | ||
| 14 | public static String getMachineCode(Context context) { | 14 | public static String getMachineCode(Context context) { |
| 15 | String cpuAddress = null; | 15 | String cpuAddress = null; |
| 16 | try{ | 16 | try{ |
| 17 | // PmpsManager pmps = new PmpsManager(); | 17 | TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); |
| 18 | // cpuAddress = pmps.getDeviceId(context); | 18 | if (mTelephony.getDeviceId() != null) { |
| 19 | cpuAddress = mTelephony.getDeviceId(); | ||
| 20 | } else { | ||
| 21 | //android.provider.Settings; | ||
| 22 | cpuAddress = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID); | ||
| 23 | } | ||
| 24 | //cpuAddress = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); | ||
| 19 | }catch(Exception e){ | 25 | }catch(Exception e){ |
| 20 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("mac地址获取失败"); | 26 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 4 get device id error"); |
| 21 | }catch(NoClassDefFoundError e){ | 27 | }catch(NoClassDefFoundError e){ |
| 22 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("设备不是好记星"); | 28 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("设备不是好记星"); |
| 23 | } | 29 | } |
| 24 | if(!TextUtils.isEmpty(cpuAddress) && !"A818A81800".equals(cpuAddress)){ | 30 | if(!TextUtils.isEmpty(cpuAddress) && !"A818A81800".equals(cpuAddress)){ |
| 25 | //Log.e("=========.MACHINE.=========", "function 1 get device id:"+cpuAddress); | 31 | //Log.e("=========.MACHINE.=========", "function 1 get device id:"+cpuAddress); |
| 26 | return cpuAddress; | 32 | return cpuAddress; |
| 27 | } | 33 | } |
| 28 | 34 | ||
| 29 | try{ | 35 | try{ |
| 30 | cpuAddress = android.provider.Settings.System.getString(context.getContentResolver(), "serial_number").trim(); | 36 | cpuAddress = android.provider.Settings.System.getString(context.getContentResolver(), "serial_number").trim(); |
| 31 | }catch(Exception e){ | 37 | }catch(Exception e){ |
| 32 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 2 get device id error"); | 38 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 2 get device id error"); |
| 33 | } | 39 | } |
| 34 | if(!TextUtils.isEmpty(cpuAddress)){ | 40 | if(!TextUtils.isEmpty(cpuAddress)){ |
| 35 | //Log.e("=========.MACHINE.=========", "function 2 get device id:"+cpuAddress); | 41 | //Log.e("=========.MACHINE.=========", "function 2 get device id:"+cpuAddress); |
| 36 | return cpuAddress; | 42 | return cpuAddress; |
| 37 | } | 43 | } |
| 38 | 44 | ||
| 39 | try { | 45 | try { |
| 40 | if("Top".equals(Build.MODEL)){ | 46 | if("Top".equals(Build.MODEL)){ |
| 41 | String str = "", strCPU = ""; | 47 | String str = "", strCPU = ""; |
| 42 | // 读取CPU信息 | 48 | // 读取CPU信息 |
| 43 | Process pp = Runtime.getRuntime().exec("cat/proc/cpuinfo"); | 49 | Process pp = Runtime.getRuntime().exec("cat/proc/cpuinfo"); |
| 44 | InputStreamReader ir = new InputStreamReader(pp.getInputStream()); | 50 | InputStreamReader ir = new InputStreamReader(pp.getInputStream()); |
| 45 | LineNumberReader input = new LineNumberReader(ir); | 51 | LineNumberReader input = new LineNumberReader(ir); |
| 46 | // 查找CPU序列号 | 52 | // 查找CPU序列号 |
| 47 | for (int i = 1; i < 100; i++) { | 53 | for (int i = 1; i < 100; i++) { |
| 48 | str = input.readLine(); | 54 | str = input.readLine(); |
| 49 | if (str != null) { | 55 | if (str != null) { |
| 50 | // 查找到序列号所在行 | 56 | // 查找到序列号所在行 |
| 51 | if (str.indexOf("Serial") > -1) { | 57 | if (str.indexOf("Serial") > -1) { |
| 52 | // 提取序列号 | 58 | // 提取序列号 |
| 53 | strCPU = str.substring(str.indexOf(":") + 1, str.length()); | 59 | strCPU = str.substring(str.indexOf(":") + 1, str.length()); |
| 54 | cpuAddress = strCPU.trim(); | 60 | cpuAddress = strCPU.trim(); |
| 55 | break; | 61 | break; |
| 56 | } | 62 | } |
| 57 | } else { | 63 | } else { |
| 58 | break; | 64 | break; |
| 59 | } | 65 | } |
| 60 | } | 66 | } |
| 61 | } | 67 | } |
| 62 | } catch (Exception e) { | 68 | } catch (Exception e) { |
| 63 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 3 get device id error"); | 69 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 3 get device id error"); |
| 64 | } | 70 | } |
| 65 | if(!TextUtils.isEmpty(cpuAddress)){ | 71 | if(!TextUtils.isEmpty(cpuAddress)){ |
| 66 | //Log.e("=========.MACHINE.=========", "function 3 get device id:"+cpuAddress); | 72 | //Log.e("=========.MACHINE.=========", "function 3 get device id:"+cpuAddress); |
| 67 | return cpuAddress; | 73 | return cpuAddress; |
| 68 | } | 74 | } |
| 69 | 75 | ||
| 70 | try{ | ||
| 71 | TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); | ||
| 72 | if (mTelephony.getDeviceId() != null) { | ||
| 73 | cpuAddress = mTelephony.getDeviceId(); | ||
| 74 | } else { | ||
| 75 | //android.provider.Settings; | ||
| 76 | cpuAddress = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID); | ||
| 77 | } | ||
| 78 | //cpuAddress = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); | ||
| 79 | }catch(Exception e){ | ||
| 80 | com.hjx.personalcenter.util.LogUtil.Instance().WriteLog("=========.MACHINE.=========function 4 get device id error"); | ||
| 81 | } | ||
| 82 | if(!TextUtils.isEmpty(cpuAddress)){ | 76 | if(!TextUtils.isEmpty(cpuAddress)){ |
| 83 | //Log.e("=========.MACHINE.=========", "function 4 get device id:"+cpuAddress); | 77 | //Log.e("=========.MACHINE.=========", "function 4 get device id:"+cpuAddress); |
| 84 | return cpuAddress; | 78 | return cpuAddress; |
| 85 | } | 79 | } |
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 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | ||
| 3 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 4 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
| 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="wrap_content" | 11 | android:layout_height="wrap_content" |
| 12 | android:background="@color/login_text_blue" | 12 | android:background="@color/login_text_blue" |
| 13 | android:minHeight="50dp"> | 13 | android:minHeight="50dp"> |
| 14 | 14 | ||
| 15 | <ImageView | 15 | <ImageView |
| 16 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
| 17 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
| 18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
| 19 | android:layout_centerVertical="true" | 19 | android:layout_centerVertical="true" |
| 20 | android:paddingLeft="20dp" | 20 | android:paddingLeft="20dp" |
| 21 | android:paddingRight="20dp" | 21 | android:paddingRight="20dp" |
| 22 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
| 23 | 23 | ||
| 24 | <TextView | 24 | <TextView |
| 25 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
| 26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
| 27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
| 28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
| 29 | android:text="@string/account_management" | 29 | android:text="@string/account_management" |
| 30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
| 31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
| 32 | </RelativeLayout> | 32 | </RelativeLayout> |
| 33 | 33 | ||
| 34 | <LinearLayout | 34 | <LinearLayout |
| 35 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
| 36 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
| 37 | android:layout_margin="20dp" | 37 | android:layout_margin="20dp" |
| 38 | android:gravity="center_vertical" | 38 | android:gravity="center_vertical" |
| 39 | android:orientation="horizontal"> | 39 | android:orientation="horizontal"> |
| 40 | 40 | ||
| 41 | <View | 41 | <View |
| 42 | android:layout_width="5dp" | 42 | android:layout_width="5dp" |
| 43 | android:layout_height="20dp" | 43 | android:layout_height="20dp" |
| 44 | android:background="@color/login_text_blue"> | 44 | android:background="@color/login_text_blue"> |
| 45 | 45 | ||
| 46 | </View> | 46 | </View> |
| 47 | 47 | ||
| 48 | <TextView | 48 | <TextView |
| 49 | android:layout_width="wrap_content" | 49 | android:layout_width="wrap_content" |
| 50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
| 51 | android:layout_marginLeft="5dp" | 51 | android:layout_marginLeft="5dp" |
| 52 | android:text="账户安全" | 52 | android:text="账户安全" |
| 53 | android:textSize="22sp" /> | 53 | android:textSize="22sp" /> |
| 54 | 54 | ||
| 55 | </LinearLayout> | 55 | </LinearLayout> |
| 56 | 56 | ||
| 57 | <LinearLayout | 57 | <LinearLayout |
| 58 | android:layout_width="match_parent" | 58 | android:layout_width="match_parent" |
| 59 | android:layout_height="wrap_content" | 59 | android:layout_height="wrap_content" |
| 60 | android:layout_marginLeft="60dp" | 60 | android:layout_marginLeft="60dp" |
| 61 | android:orientation="vertical"> | 61 | android:orientation="vertical"> |
| 62 | 62 | ||
| 63 | <LinearLayout | 63 | <LinearLayout |
| 64 | android:layout_width="match_parent" | 64 | android:layout_width="match_parent" |
| 65 | android:layout_height="wrap_content"> | 65 | android:layout_height="wrap_content"> |
| 66 | 66 | ||
| 67 | 67 | ||
| 68 | <TextView | 68 | <TextView |
| 69 | android:layout_width="0dp" | 69 | android:layout_width="0dp" |
| 70 | android:layout_height="wrap_content" | 70 | android:layout_height="wrap_content" |
| 71 | android:layout_weight="1.5" | 71 | android:layout_weight="1.5" |
| 72 | android:text="当前绑定手机号" | 72 | android:text="当前绑定手机号" |
| 73 | android:textSize="22sp" /> | 73 | android:textSize="22sp" /> |
| 74 | 74 | ||
| 75 | <TextView | 75 | <TextView |
| 76 | android:id="@+id/cunt_username" | 76 | android:id="@+id/cunt_username" |
| 77 | android:layout_width="0dp" | 77 | android:layout_width="0dp" |
| 78 | android:layout_height="wrap_content" | 78 | android:layout_height="wrap_content" |
| 79 | android:layout_marginLeft="50dp" | 79 | android:layout_marginLeft="50dp" |
| 80 | android:layout_weight="6" | 80 | android:layout_weight="6" |
| 81 | android:text="" | 81 | android:text="" |
| 82 | android:textSize="22sp" /> | 82 | android:textSize="22sp" /> |
| 83 | 83 | ||
| 84 | <TextView | 84 | <TextView |
| 85 | android:id="@+id/changBangding" | 85 | android:id="@+id/changBangding" |
| 86 | android:layout_width="0dp" | 86 | android:layout_width="0dp" |
| 87 | android:layout_height="wrap_content" | 87 | android:layout_height="wrap_content" |
| 88 | android:layout_weight="1" | 88 | android:layout_weight="1" |
| 89 | android:text="更换绑定" | 89 | android:text="更换绑定" |
| 90 | android:textSize="22sp" /> | 90 | android:textSize="22sp" /> |
| 91 | 91 | ||
| 92 | <ImageView | 92 | <ImageView |
| 93 | android:layout_width="wrap_content" | 93 | android:layout_width="wrap_content" |
| 94 | android:layout_height="wrap_content" | 94 | android:layout_height="wrap_content" |
| 95 | android:layout_weight="0.1" | 95 | android:layout_weight="0.1" |
| 96 | android:padding="10dp" | 96 | android:padding="10dp" |
| 97 | android:src="@mipmap/youjiantou" /> | 97 | android:src="@mipmap/youjiantou" /> |
| 98 | </LinearLayout> | 98 | </LinearLayout> |
| 99 | 99 | ||
| 100 | <LinearLayout | 100 | <LinearLayout |
| 101 | android:layout_width="match_parent" | 101 | android:layout_width="match_parent" |
| 102 | android:layout_height="wrap_content" | 102 | android:layout_height="wrap_content" |
| 103 | android:layout_marginTop="30dp"> | 103 | android:layout_marginTop="30dp"> |
| 104 | 104 | ||
| 105 | 105 | ||
| 106 | <TextView | 106 | <TextView |
| 107 | android:layout_width="0dp" | 107 | android:layout_width="0dp" |
| 108 | android:layout_height="wrap_content" | 108 | android:layout_height="wrap_content" |
| 109 | android:layout_weight="1.5" | 109 | android:layout_weight="1.5" |
| 110 | android:text="登录密码" | 110 | android:text="登录密码" |
| 111 | android:textSize="22sp" /> | 111 | android:textSize="22sp" /> |
| 112 | 112 | ||
| 113 | <TextView | 113 | <TextView |
| 114 | android:layout_width="0dp" | 114 | android:layout_width="0dp" |
| 115 | android:layout_height="wrap_content" | 115 | android:layout_height="wrap_content" |
| 116 | android:layout_marginLeft="50dp" | 116 | android:layout_marginLeft="50dp" |
| 117 | android:layout_weight="6" | 117 | android:layout_weight="6" |
| 118 | android:text="已设置" | 118 | android:text="已设置" |
| 119 | android:textSize="22sp" /> | 119 | android:textSize="22sp" /> |
| 120 | 120 | ||
| 121 | <TextView | 121 | <TextView |
| 122 | android:id="@+id/changpassword" | 122 | android:id="@+id/changpassword" |
| 123 | android:layout_width="0dp" | 123 | android:layout_width="0dp" |
| 124 | android:layout_height="wrap_content" | 124 | android:layout_height="wrap_content" |
| 125 | android:layout_weight="1" | 125 | android:layout_weight="1" |
| 126 | android:text="修改密码" | 126 | android:text="修改密码" |
| 127 | android:textSize="22sp" /> | 127 | android:textSize="22sp" /> |
| 128 | 128 | ||
| 129 | <ImageView | 129 | <ImageView |
| 130 | android:layout_width="wrap_content" | 130 | android:layout_width="wrap_content" |
| 131 | android:layout_height="wrap_content" | 131 | android:layout_height="wrap_content" |
| 132 | android:layout_weight="0.1" | 132 | android:layout_weight="0.1" |
| 133 | android:padding="10dp" | 133 | android:padding="10dp" |
| 134 | android:src="@mipmap/youjiantou" /> | 134 | android:src="@mipmap/youjiantou" /> |
| 135 | </LinearLayout> | 135 | </LinearLayout> |
| 136 | 136 | ||
| 137 | </LinearLayout> | 137 | </LinearLayout> |
| 138 | 138 | ||
| 139 | <View | 139 | <View |
| 140 | android:layout_width="match_parent" | 140 | android:layout_width="match_parent" |
| 141 | android:layout_height="0.7dp" | 141 | android:layout_height="0.7dp" |
| 142 | android:layout_margin="20dp" | 142 | android:layout_margin="20dp" |
| 143 | android:background="#FF909090" /> | 143 | android:background="#FF909090" /> |
| 144 | 144 | ||
| 145 | <LinearLayout | 145 | <LinearLayout |
| 146 | android:layout_width="wrap_content" | 146 | android:layout_width="wrap_content" |
| 147 | android:layout_height="wrap_content" | 147 | android:layout_height="wrap_content" |
| 148 | android:layout_margin="20dp" | 148 | android:layout_margin="20dp" |
| 149 | android:gravity="center_vertical" | 149 | android:gravity="center_vertical" |
| 150 | android:orientation="horizontal"> | 150 | android:orientation="horizontal"> |
| 151 | 151 | ||
| 152 | <View | 152 | <View |
| 153 | android:layout_width="5dp" | 153 | android:layout_width="5dp" |
| 154 | android:layout_height="20dp" | 154 | android:layout_height="20dp" |
| 155 | android:background="@color/login_text_blue"> | 155 | android:background="@color/login_text_blue"> |
| 156 | 156 | ||
| 157 | </View> | 157 | </View> |
| 158 | 158 | ||
| 159 | <TextView | 159 | <TextView |
| 160 | android:layout_width="wrap_content" | 160 | android:layout_width="wrap_content" |
| 161 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
| 162 | android:layout_marginLeft="5dp" | 162 | android:layout_marginLeft="5dp" |
| 163 | android:text="子账户管理" | 163 | android:text="子账户管理" |
| 164 | android:textSize="22sp" /> | 164 | android:textSize="22sp" /> |
| 165 | 165 | ||
| 166 | </LinearLayout> | 166 | </LinearLayout> |
| 167 | 167 | ||
| 168 | <LinearLayout | 168 | <LinearLayout |
| 169 | android:layout_width="match_parent" | 169 | android:layout_width="match_parent" |
| 170 | android:layout_height="match_parent" | 170 | android:layout_height="match_parent" |
| 171 | android:layout_marginLeft="30dp" | 171 | android:layout_marginLeft="30dp" |
| 172 | android:orientation="vertical"> | 172 | android:orientation="vertical"> |
| 173 | 173 | ||
| 174 | <LinearLayout | 174 | <LinearLayout |
| 175 | android:layout_width="match_parent" | 175 | android:layout_width="match_parent" |
| 176 | android:layout_height="wrap_content"> | 176 | android:layout_height="wrap_content"> |
| 177 | 177 | ||
| 178 | <LinearLayout | 178 | <LinearLayout |
| 179 | android:layout_width="0dp" | 179 | android:layout_width="0dp" |
| 180 | android:layout_height="wrap_content" | 180 | android:layout_height="wrap_content" |
| 181 | android:layout_weight="1"> | 181 | android:layout_weight="1"> |
| 182 | 182 | ||
| 183 | <LinearLayout | 183 | <LinearLayout |
| 184 | android:id="@+id/ll_zhu_backgrangd" | 184 | android:id="@+id/ll_zhu_backgrangd" |
| 185 | android:layout_width="wrap_content" | 185 | android:layout_width="wrap_content" |
| 186 | android:layout_height="wrap_content" | 186 | android:layout_height="wrap_content" |
| 187 | android:background="@drawable/corcle_blue_bg" | 187 | android:background="@drawable/corcle_blue_bg" |
| 188 | android:orientation="vertical"> | 188 | android:orientation="vertical"> |
| 189 | 189 | ||
| 190 | <LinearLayout | 190 | <LinearLayout |
| 191 | android:layout_width="match_parent" | 191 | android:layout_width="match_parent" |
| 192 | android:layout_height="wrap_content" | 192 | android:layout_height="wrap_content" |
| 193 | android:orientation="horizontal"> | 193 | android:orientation="horizontal"> |
| 194 | |||
| 194 | <com.facebook.drawee.view.SimpleDraweeView | 195 | <com.facebook.drawee.view.SimpleDraweeView |
| 195 | android:id="@+id/tv_account_head" | 196 | android:id="@+id/tv_account_head" |
| 196 | android:layout_width="60dp" | 197 | android:layout_width="60dp" |
| 197 | android:layout_height="60dp" | 198 | android:layout_height="60dp" |
| 198 | android:layout_margin="10dp" | 199 | android:layout_margin="10dp" |
| 199 | fresco:placeholderImage="@mipmap/header_default" | 200 | fresco:placeholderImage="@mipmap/header_default" |
| 200 | fresco:roundAsCircle="true" | 201 | fresco:placeholderImageScaleType="fitCenter" |
| 201 | fresco:placeholderImageScaleType="fitCenter" /> | 202 | fresco:roundAsCircle="true" /> |
| 202 | 203 | ||
| 203 | <LinearLayout | 204 | <LinearLayout |
| 204 | android:layout_width="0dp" | 205 | android:layout_width="0dp" |
| 205 | android:layout_height="wrap_content" | 206 | android:layout_height="wrap_content" |
| 206 | android:layout_marginLeft="10dp" | 207 | android:layout_marginLeft="10dp" |
| 207 | android:layout_marginTop="10dp" | 208 | android:layout_marginTop="10dp" |
| 208 | android:layout_weight="1" | 209 | android:layout_weight="1" |
| 209 | android:orientation="vertical"> | 210 | android:orientation="vertical"> |
| 210 | 211 | ||
| 211 | <TextView | 212 | <TextView |
| 212 | android:id="@+id/tv_account_name" | 213 | android:id="@+id/tv_account_name" |
| 213 | android:layout_width="wrap_content" | 214 | android:layout_width="wrap_content" |
| 214 | android:layout_height="wrap_content" | 215 | android:layout_height="wrap_content" |
| 215 | android:text="" | 216 | android:text="" |
| 216 | android:textSize="18sp" /> | 217 | android:textSize="18sp" /> |
| 217 | 218 | ||
| 218 | <TextView | 219 | <TextView |
| 219 | android:id="@+id/tv_account_grade" | 220 | android:id="@+id/tv_account_grade" |
| 220 | android:layout_width="wrap_content" | 221 | android:layout_width="wrap_content" |
| 221 | android:layout_height="wrap_content" | 222 | android:layout_height="wrap_content" |
| 222 | android:text="" | 223 | android:text="" |
| 223 | android:textSize="18sp" /> | 224 | android:textSize="18sp" /> |
| 224 | 225 | ||
| 225 | <TextView | 226 | <TextView |
| 226 | android:id="@+id/tv_account_school" | 227 | android:id="@+id/tv_account_school" |
| 227 | android:layout_width="wrap_content" | 228 | android:layout_width="wrap_content" |
| 228 | android:layout_height="wrap_content" | 229 | android:layout_height="wrap_content" |
| 229 | android:text="" | 230 | android:text="" |
| 230 | android:textSize="18sp" /> | 231 | android:textSize="18sp" /> |
| 231 | 232 | ||
| 232 | <TextView | 233 | <TextView |
| 233 | android:id="@+id/tv_account_adress" | 234 | android:id="@+id/tv_account_adress" |
| 234 | android:layout_width="wrap_content" | 235 | android:layout_width="wrap_content" |
| 235 | android:layout_height="wrap_content" | 236 | android:layout_height="wrap_content" |
| 236 | android:text="" | 237 | android:text="" |
| 237 | android:textSize="18sp" /> | 238 | android:textSize="18sp" /> |
| 238 | 239 | ||
| 239 | 240 | ||
| 240 | </LinearLayout> | 241 | </LinearLayout> |
| 241 | 242 | ||
| 242 | <ImageView | 243 | <ImageView |
| 243 | android:id="@+id/iv_shiyongzhong" | 244 | android:id="@+id/iv_shiyongzhong" |
| 244 | android:layout_width="wrap_content" | 245 | android:layout_width="wrap_content" |
| 245 | android:layout_height="wrap_content" | 246 | android:layout_height="wrap_content" |
| 246 | android:layout_gravity="right" | 247 | android:layout_gravity="right" |
| 247 | android:layout_marginLeft="60dp" | 248 | android:layout_marginLeft="60dp" |
| 248 | android:visibility="gone" | 249 | android:src="@mipmap/shiyongzhong" |
| 249 | android:src="@mipmap/shiyongzhong" /> | 250 | android:visibility="gone" /> |
| 250 | 251 | ||
| 251 | </LinearLayout> | 252 | </LinearLayout> |
| 252 | 253 | ||
| 253 | <View | 254 | <View |
| 254 | android:layout_width="match_parent" | 255 | android:layout_width="match_parent" |
| 255 | android:layout_height="0.7dp" | 256 | android:layout_height="0.7dp" |
| 256 | android:layout_margin="10dp" | 257 | android:layout_margin="10dp" |
| 257 | android:background="@color/cutoff_line"> | 258 | android:background="@color/cutoff_line"> |
| 258 | 259 | ||
| 259 | </View> | 260 | </View> |
| 260 | 261 | ||
| 261 | <LinearLayout | 262 | <LinearLayout |
| 262 | android:layout_width="match_parent" | 263 | android:layout_width="match_parent" |
| 263 | android:layout_height="wrap_content" | 264 | android:layout_height="wrap_content" |
| 264 | android:layout_marginBottom="10dp" | 265 | android:layout_marginBottom="10dp" |
| 265 | android:orientation="horizontal"> | 266 | android:orientation="horizontal"> |
| 266 | 267 | ||
| 267 | <TextView | 268 | <TextView |
| 268 | android:id="@+id/change_zhu_account" | 269 | android:id="@+id/change_zhu_account" |
| 269 | android:layout_width="0dp" | 270 | android:layout_width="0dp" |
| 270 | android:layout_height="wrap_content" | 271 | android:layout_height="wrap_content" |
| 271 | android:layout_weight="1" | 272 | android:layout_weight="1" |
| 272 | android:gravity="center" | 273 | android:gravity="center" |
| 273 | android:text="切换主账户" | 274 | android:text="切换主账户" |
| 274 | android:textSize="18sp" /> | 275 | android:textSize="18sp" /> |
| 275 | 276 | ||
| 276 | 277 | ||
| 277 | </LinearLayout> | 278 | </LinearLayout> |
| 278 | 279 | ||
| 279 | </LinearLayout> | 280 | </LinearLayout> |
| 280 | 281 | ||
| 281 | 282 | ||
| 282 | </LinearLayout> | 283 | </LinearLayout> |
| 283 | 284 | ||
| 284 | <LinearLayout | 285 | <LinearLayout |
| 285 | android:layout_width="0dp" | 286 | android:layout_width="0dp" |
| 286 | android:layout_height="wrap_content" | 287 | android:layout_height="wrap_content" |
| 287 | android:layout_weight="1"> | 288 | android:layout_weight="1"> |
| 288 | 289 | ||
| 289 | </LinearLayout> | 290 | </LinearLayout> |
| 290 | 291 | ||
| 291 | <LinearLayout | 292 | <LinearLayout |
| 292 | android:layout_width="0dp" | 293 | android:layout_width="0dp" |
| 293 | android:layout_height="wrap_content" | 294 | android:layout_height="wrap_content" |
| 294 | android:layout_weight="1"> | 295 | android:layout_weight="1"> |
| 295 | 296 | ||
| 296 | </LinearLayout> | 297 | </LinearLayout> |
| 297 | </LinearLayout> | 298 | </LinearLayout> |
| 298 | 299 | ||
| 299 | <RelativeLayout | 300 | <RelativeLayout |
| 300 | android:layout_width="match_parent" | 301 | android:layout_width="match_parent" |
| 301 | android:layout_height="wrap_content" | 302 | android:layout_height="wrap_content" |
| 302 | android:layout_marginTop="20dp" | 303 | android:layout_marginTop="20dp" |
| 303 | android:orientation="horizontal"> | 304 | android:orientation="horizontal"> |
| 305 | |||
| 304 | <android.support.v7.widget.RecyclerView | 306 | <android.support.v7.widget.RecyclerView |
| 305 | android:id="@+id/id_recyclerview_horizontal" | 307 | android:id="@+id/id_recyclerview_horizontal" |
| 306 | android:layout_width="wrap_content" | 308 | android:layout_width="wrap_content" |
| 307 | android:layout_toLeftOf="@+id/add_account" | ||
| 308 | android:layout_height="wrap_content" | 309 | android:layout_height="wrap_content" |
| 309 | android:layout_centerVertical="true" | 310 | android:layout_centerVertical="true" |
| 310 | android:scrollbars="none" | 311 | android:layout_toLeftOf="@+id/add_account" |
| 311 | > | 312 | android:scrollbars="none"></android.support.v7.widget.RecyclerView> |
| 312 | </android.support.v7.widget.RecyclerView> | 313 | |
| 313 | <LinearLayout | 314 | <LinearLayout |
| 314 | android:id="@+id/add_account" | 315 | android:id="@+id/add_account" |
| 315 | android:layout_width="415dp" | 316 | android:layout_width="415dp" |
| 316 | android:layout_height="165dp" | 317 | android:layout_height="165dp" |
| 317 | android:layout_marginLeft="10dp" | ||
| 318 | android:layout_alignParentRight="true" | 318 | android:layout_alignParentRight="true" |
| 319 | android:layout_marginLeft="10dp" | ||
| 320 | android:layout_marginRight="20dp" | ||
| 319 | android:background="@drawable/corcle_black_bg" | 321 | android:background="@drawable/corcle_black_bg" |
| 320 | android:gravity="center"> | 322 | android:gravity="center"> |
| 323 | |||
| 321 | <ImageView | 324 | <ImageView |
| 322 | android:layout_width="wrap_content" | 325 | android:layout_width="wrap_content" |
| 323 | android:layout_height="wrap_content" | 326 | android:layout_height="wrap_content" |
| 324 | android:src="@mipmap/jia"/> | 327 | android:src="@mipmap/jia" /> |
| 325 | 328 | ||
| 326 | </LinearLayout> | 329 | </LinearLayout> |
| 327 | 330 | ||
| 328 | 331 | ||
| 329 | |||
| 330 | |||
| 331 | </RelativeLayout> | 332 | </RelativeLayout> |
PersonalCenter/app/src/main/res/layout/activity_electronic_look_cardinfo.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/string_electroniccard_info_look" | 28 | android:text="@string/string_electroniccard_info_look" |
| 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="match_parent" | 34 | android:layout_width="match_parent" |
| 35 | android:layout_height="wrap_content" | 35 | android:layout_height="wrap_content" |
| 36 | android:layout_margin="20dp" | 36 | android:layout_margin="20dp" |
| 37 | android:background="@mipmap/cardbackgrangd" | 37 | android:background="@mipmap/cardbackgrangd" |
| 38 | android:gravity="center" | 38 | android:gravity="center" |
| 39 | android:orientation="vertical"> | 39 | android:orientation="vertical"> |
| 40 | 40 | ||
| 41 | <LinearLayout | 41 | <LinearLayout |
| 42 | android:layout_width="match_parent" | 42 | android:layout_width="match_parent" |
| 43 | android:layout_height="wrap_content" | 43 | android:layout_height="wrap_content" |
| 44 | android:layout_marginTop="70dp" | 44 | android:layout_marginTop="70dp" |
| 45 | android:gravity="center_vertical" | 45 | android:gravity="center_vertical" |
| 46 | android:orientation="horizontal"> | 46 | android:orientation="horizontal"> |
| 47 | 47 | ||
| 48 | <LinearLayout | 48 | <LinearLayout |
| 49 | android:layout_width="0dp" | 49 | android:layout_width="0dp" |
| 50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
| 51 | android:layout_marginLeft="200dp" | 51 | android:layout_marginLeft="200dp" |
| 52 | android:layout_weight="1" | 52 | android:layout_weight="1" |
| 53 | android:gravity="center_vertical"> | 53 | android:gravity="center_vertical"> |
| 54 | 54 | ||
| 55 | <ImageView | 55 | <ImageView |
| 56 | android:layout_width="wrap_content" | 56 | android:layout_width="wrap_content" |
| 57 | android:layout_height="wrap_content" | 57 | android:layout_height="wrap_content" |
| 58 | android:src="@mipmap/logo_info" /> | 58 | android:src="@mipmap/logo_info" /> |
| 59 | 59 | ||
| 60 | <TextView | 60 | <TextView |
| 61 | android:layout_width="wrap_content" | 61 | android:layout_width="wrap_content" |
| 62 | android:layout_height="wrap_content" | 62 | android:layout_height="wrap_content" |
| 63 | android:layout_marginLeft="50dp" | 63 | android:layout_marginLeft="50dp" |
| 64 | android:background="@null" | 64 | android:background="@null" |
| 65 | android:text="电子保卡" | 65 | android:text="电子保卡" |
| 66 | android:textColor="@color/electronic_card" | 66 | android:textColor="@color/electronic_card" |
| 67 | android:textSize="22sp" /> | 67 | android:textSize="22sp" /> |
| 68 | 68 | ||
| 69 | </LinearLayout> | 69 | </LinearLayout> |
| 70 | 70 | ||
| 71 | <LinearLayout | 71 | <LinearLayout |
| 72 | android:layout_width="0dp" | 72 | android:layout_width="0dp" |
| 73 | android:layout_height="80dp" | 73 | android:layout_height="80dp" |
| 74 | android:layout_weight="1" | 74 | android:layout_weight="1" |
| 75 | android:layout_marginLeft="80dp" | 75 | android:layout_marginLeft="80dp" |
| 76 | android:gravity="center_vertical"> | 76 | android:gravity="center_vertical"> |
| 77 | 77 | ||
| 78 | <TextView | 78 | <TextView |
| 79 | android:layout_width="wrap_content" | 79 | android:layout_width="wrap_content" |
| 80 | android:layout_height="wrap_content" | 80 | android:layout_height="wrap_content" |
| 81 | android:text="客户姓名" | 81 | android:text="客户姓名" |
| 82 | android:textColor="@color/btn_text_color" | ||
| 83 | android:textSize="22sp" /> | 82 | android:textSize="22sp" /> |
| 84 | 83 | ||
| 85 | <TextView | 84 | <TextView |
| 86 | android:id="@+id/iv_card_username" | 85 | android:id="@+id/iv_card_username" |
| 87 | android:layout_width="wrap_content" | 86 | android:layout_width="wrap_content" |
| 88 | android:layout_height="wrap_content" | 87 | android:layout_height="wrap_content" |
| 89 | android:layout_marginLeft="60dp" | 88 | android:layout_marginLeft="60dp" |
| 90 | android:text="" | 89 | android:text="" |
| 91 | android:textColor="@color/btn_text_color" | ||
| 92 | android:textSize="22sp" /> | 90 | android:textSize="22sp" /> |
| 93 | 91 | ||
| 94 | </LinearLayout> | 92 | </LinearLayout> |
| 95 | 93 | ||
| 96 | </LinearLayout> | 94 | </LinearLayout> |
| 97 | 95 | ||
| 98 | <LinearLayout | 96 | <LinearLayout |
| 99 | android:layout_width="match_parent" | 97 | android:layout_width="match_parent" |
| 100 | android:layout_height="wrap_content" | 98 | android:layout_height="wrap_content" |
| 101 | android:gravity="center_vertical" | 99 | android:gravity="center_vertical" |
| 102 | android:orientation="horizontal"> | 100 | android:orientation="horizontal"> |
| 103 | 101 | ||
| 104 | <LinearLayout | 102 | <LinearLayout |
| 105 | android:layout_width="0dp" | 103 | android:layout_width="0dp" |
| 106 | android:layout_height="60dp" | 104 | android:layout_height="60dp" |
| 107 | android:layout_weight="1" | 105 | android:layout_weight="1" |
| 108 | android:layout_marginLeft="200dp" | 106 | android:layout_marginLeft="200dp" |
| 109 | android:gravity="center_vertical"> | 107 | android:gravity="center_vertical"> |
| 110 | 108 | ||
| 111 | <TextView | 109 | <TextView |
| 112 | android:layout_width="wrap_content" | 110 | android:layout_width="wrap_content" |
| 113 | android:layout_height="wrap_content" | 111 | android:layout_height="wrap_content" |
| 114 | android:text="产品型号" | 112 | android:text="产品型号" |
| 115 | android:textColor="@color/btn_text_color" | ||
| 116 | android:textSize="22sp" /> | 113 | android:textSize="22sp" /> |
| 117 | 114 | ||
| 118 | <TextView | 115 | <TextView |
| 119 | android:id="@+id/tv_card_deviceModel" | 116 | android:id="@+id/tv_card_deviceModel" |
| 120 | android:layout_width="wrap_content" | 117 | android:layout_width="wrap_content" |
| 121 | android:layout_height="wrap_content" | 118 | android:layout_height="wrap_content" |
| 122 | android:layout_marginLeft="50dp" | 119 | android:layout_marginLeft="50dp" |
| 123 | android:text="" | 120 | android:text="" |
| 124 | android:textSize="22sp" /> | 121 | android:textSize="22sp" /> |
| 125 | 122 | ||
| 126 | 123 | ||
| 127 | </LinearLayout> | 124 | </LinearLayout> |
| 128 | 125 | ||
| 129 | <LinearLayout | 126 | <LinearLayout |
| 130 | android:layout_width="0dp" | 127 | android:layout_width="0dp" |
| 131 | android:layout_height="60dp" | 128 | android:layout_height="60dp" |
| 132 | android:layout_weight="1" | 129 | android:layout_weight="1" |
| 133 | android:layout_marginLeft="80dp" | 130 | android:layout_marginLeft="80dp" |
| 134 | android:gravity="center_vertical"> | 131 | android:gravity="center_vertical"> |
| 135 | 132 | ||
| 136 | <TextView | 133 | <TextView |
| 137 | android:layout_width="wrap_content" | 134 | android:layout_width="wrap_content" |
| 138 | android:layout_height="wrap_content" | 135 | android:layout_height="wrap_content" |
| 139 | android:textColor="@color/btn_text_color" | ||
| 140 | android:text="客户地址" | 136 | android:text="客户地址" |
| 141 | android:textSize="22sp" /> | 137 | android:textSize="22sp" /> |
| 142 | 138 | ||
| 143 | <TextView | 139 | <TextView |
| 144 | android:id="@+id/tv_card_adress" | 140 | android:id="@+id/tv_card_adress" |
| 145 | android:layout_width="wrap_content" | 141 | android:layout_width="wrap_content" |
| 146 | android:layout_height="wrap_content" | 142 | android:layout_height="wrap_content" |
| 147 | android:layout_marginLeft="60dp" | 143 | android:layout_marginLeft="60dp" |
| 148 | android:text="" | 144 | android:text="" |
| 149 | android:textSize="22sp" /> | 145 | android:textSize="22sp" /> |
| 150 | <TextView | 146 | <TextView |
| 151 | android:id="@+id/tv_card_adress_change" | 147 | android:id="@+id/tv_card_adress_change" |
| 152 | android:layout_width="wrap_content" | 148 | android:layout_width="wrap_content" |
| 153 | android:layout_height="wrap_content" | 149 | android:layout_height="wrap_content" |
| 154 | android:layout_marginLeft="18dp" | 150 | android:layout_marginLeft="18dp" |
| 155 | android:background="@drawable/corcle_black_bg" | 151 | android:background="@drawable/corcle_blue_bg" |
| 156 | android:text="修改" | 152 | android:text="修改" |
| 157 | android:paddingLeft="5dp" | 153 | android:paddingLeft="5dp" |
| 158 | android:paddingRight="5dp" | 154 | android:paddingRight="5dp" |
| 159 | android:textColor="@color/login_text_blue" | 155 | android:textColor="@color/login_text_blue" |
| 160 | android:textSize="18sp" /> | 156 | android:textSize="18sp" /> |
| 161 | 157 | ||
| 162 | 158 | ||
| 163 | </LinearLayout> | 159 | </LinearLayout> |
| 164 | 160 | ||
| 165 | </LinearLayout> | 161 | </LinearLayout> |
| 166 | 162 | ||
| 167 | <LinearLayout | 163 | <LinearLayout |
| 168 | android:layout_width="match_parent" | 164 | android:layout_width="match_parent" |
| 169 | android:layout_height="wrap_content" | 165 | android:layout_height="wrap_content" |
| 170 | android:gravity="center_vertical" | 166 | android:gravity="center_vertical" |
| 171 | android:orientation="horizontal"> | 167 | android:orientation="horizontal"> |
| 172 | 168 | ||
| 173 | <LinearLayout | 169 | <LinearLayout |
| 174 | android:layout_width="0dp" | 170 | android:layout_width="0dp" |
| 175 | android:layout_height="60dp" | 171 | android:layout_height="60dp" |
| 176 | android:layout_weight="1" | 172 | android:layout_weight="1" |
| 177 | android:layout_marginLeft="200dp" | 173 | android:layout_marginLeft="200dp" |
| 178 | android:gravity="center_vertical"> | 174 | android:gravity="center_vertical"> |
| 179 | 175 | ||
| 180 | <TextView | 176 | <TextView |
| 181 | android:layout_width="wrap_content" | 177 | android:layout_width="wrap_content" |
| 182 | android:layout_height="wrap_content" | 178 | android:layout_height="wrap_content" |
| 183 | android:textColor="@color/btn_text_color" | ||
| 184 | android:text="MAC地址" | 179 | android:text="MAC地址" |
| 185 | android:textSize="22sp" /> | 180 | android:textSize="22sp" /> |
| 186 | 181 | ||
| 187 | <TextView | 182 | <TextView |
| 188 | android:id="@+id/tv_card_mac" | 183 | android:id="@+id/tv_card_mac" |
| 189 | android:layout_width="wrap_content" | 184 | android:layout_width="wrap_content" |
| 190 | android:layout_height="wrap_content" | 185 | android:layout_height="wrap_content" |
| 191 | android:layout_marginLeft="50dp" | 186 | android:layout_marginLeft="50dp" |
| 192 | android:background="@null" | ||
| 193 | android:text="" | 187 | android:text="" |
| 194 | android:textSize="22sp" /> | 188 | android:textSize="22sp" /> |
| 195 | 189 | ||
| 196 | </LinearLayout> | 190 | </LinearLayout> |
| 197 | 191 | ||
| 198 | <LinearLayout | 192 | <LinearLayout |
| 199 | android:layout_width="0dp" | 193 | android:layout_width="0dp" |
| 200 | android:layout_height="60dp" | 194 | android:layout_height="60dp" |
| 201 | android:layout_weight="1" | 195 | android:layout_weight="1" |
| 202 | android:layout_marginLeft="80dp" | 196 | android:layout_marginLeft="80dp" |
| 203 | android:gravity="center_vertical"> | 197 | android:gravity="center_vertical"> |
| 204 | 198 | ||
| 205 | <TextView | 199 | <TextView |
| 206 | android:layout_width="wrap_content" | 200 | android:layout_width="wrap_content" |
| 207 | android:layout_height="wrap_content" | 201 | android:layout_height="wrap_content" |
| 208 | android:text="购买时间" | 202 | android:text="购买时间" |
| 209 | android:textColor="@color/btn_text_color" | ||
| 210 | android:textSize="22sp" /> | 203 | android:textSize="22sp" /> |
| 211 | 204 | ||
| 212 | <TextView | 205 | <TextView |
| 213 | android:id="@+id/tv_card_time" | 206 | android:id="@+id/tv_card_time" |
| 214 | android:layout_width="wrap_content" | 207 | android:layout_width="wrap_content" |
| 215 | android:layout_height="wrap_content" | 208 | android:layout_height="wrap_content" |
| 216 | android:layout_marginLeft="60dp" | 209 | android:layout_marginLeft="60dp" |
| 217 | android:background="@null" | ||
| 218 | android:text="" | 210 | android:text="" |
| 219 | android:textColor="@color/btn_text_color" | ||
| 220 | android:textSize="22sp" /> | 211 | android:textSize="22sp" /> |
| 221 | </LinearLayout> | 212 | </LinearLayout> |
| 222 | 213 | ||
| 223 | </LinearLayout> | 214 | </LinearLayout> |
| 224 | 215 | ||
| 225 | <LinearLayout | 216 | <LinearLayout |
| 226 | android:layout_width="match_parent" | 217 | android:layout_width="match_parent" |
| 227 | android:layout_height="wrap_content" | 218 | android:layout_height="wrap_content" |
| 228 | android:gravity="center_vertical" | 219 | android:gravity="center_vertical" |
| 229 | android:orientation="horizontal"> | 220 | android:orientation="horizontal"> |
| 230 | 221 | ||
| 231 | <LinearLayout | 222 | <LinearLayout |
| 232 | android:layout_width="0dp" | 223 | android:layout_width="0dp" |
| 233 | android:layout_height="60dp" | 224 | android:layout_height="60dp" |
| 234 | android:layout_weight="1" | 225 | android:layout_weight="1" |
| 235 | android:layout_marginLeft="200dp" | 226 | android:layout_marginLeft="200dp" |
| 236 | android:gravity="center_vertical"> | 227 | android:gravity="center_vertical"> |
| 237 | 228 | ||
| 238 | <TextView | 229 | <TextView |
| 239 | android:layout_width="wrap_content" | 230 | android:layout_width="wrap_content" |
| 240 | android:layout_height="wrap_content" | 231 | android:layout_height="wrap_content" |
| 241 | android:text="机身编码" | 232 | android:text="机身编码" |
| 242 | android:textColor="@color/btn_text_color" | ||
| 243 | android:textSize="22sp" /> | 233 | android:textSize="22sp" /> |
| 244 | 234 | ||
| 245 | <TextView | 235 | <TextView |
| 246 | android:id="@+id/tv_card_deviceNumber" | 236 | android:id="@+id/tv_card_deviceNumber" |
| 247 | android:layout_width="wrap_content" | 237 | android:layout_width="wrap_content" |
| 248 | android:layout_height="wrap_content" | 238 | android:layout_height="wrap_content" |
| 249 | android:layout_marginLeft="50dp" | 239 | android:layout_marginLeft="50dp" |
| 250 | android:hint="" | 240 | android:hint="" |
| 251 | android:textSize="22sp" /> | 241 | android:textSize="22sp" /> |
| 252 | 242 | ||
| 253 | </LinearLayout> | 243 | </LinearLayout> |
| 254 | 244 | ||
| 255 | <LinearLayout | 245 | <LinearLayout |
| 256 | android:layout_width="0dp" | 246 | android:layout_width="0dp" |
| 257 | android:layout_height="60dp" | 247 | android:layout_height="60dp" |
| 258 | android:layout_weight="1" | 248 | android:layout_weight="1" |
| 259 | android:layout_marginLeft="80dp" | 249 | android:layout_marginLeft="80dp" |
| 260 | android:gravity="center_vertical"> | 250 | android:gravity="center_vertical"> |
| 261 | 251 | ||
| 262 | <TextView | 252 | <TextView |
| 263 | android:layout_width="wrap_content" | 253 | android:layout_width="wrap_content" |
| 264 | android:layout_height="wrap_content" | 254 | android:layout_height="wrap_content" |
| 265 | android:text="购买地址" | 255 | android:text="购买地址" |
| 266 | android:textColor="@color/btn_text_color" | ||
| 267 | android:textSize="22sp" /> | 256 | android:textSize="22sp" /> |
| 268 | 257 | ||
| 269 | <TextView | 258 | <TextView |
| 270 | android:id="@+id/tv_card_shopAdress" | 259 | android:id="@+id/tv_card_shopAdress" |
| 271 | android:layout_width="wrap_content" | 260 | android:layout_width="wrap_content" |
| 272 | android:layout_height="wrap_content" | 261 | android:layout_height="wrap_content" |
| 273 | android:layout_marginLeft="60dp" | 262 | android:layout_marginLeft="60dp" |
| 274 | android:text="" | 263 | android:text="" |
| 275 | android:textColor="@color/btn_text_color" | ||
| 276 | android:textSize="22sp" /> | 264 | android:textSize="22sp" /> |
| 277 | </LinearLayout> | 265 | </LinearLayout> |
| 278 | 266 | ||
| 279 | </LinearLayout> | 267 | </LinearLayout> |
| 280 | 268 | ||
| 281 | <LinearLayout | 269 | <LinearLayout |
| 282 | android:layout_width="match_parent" | 270 | android:layout_width="match_parent" |
| 283 | android:layout_height="wrap_content" | 271 | android:layout_height="wrap_content" |
| 284 | android:gravity="center_vertical" | 272 | android:gravity="center_vertical" |
| 285 | android:layout_marginBottom="30dp" | 273 | android:layout_marginBottom="30dp" |
| 286 | android:orientation="horizontal"> | 274 | android:orientation="horizontal"> |
| 287 | 275 | ||
| 288 | <LinearLayout | 276 | <LinearLayout |
| 289 | android:layout_width="0dp" | 277 | android:layout_width="0dp" |
| 290 | android:layout_height="60dp" | 278 | android:layout_height="60dp" |
| 291 | android:layout_weight="1" | 279 | android:layout_weight="1" |
| 292 | android:layout_marginLeft="200dp" | 280 | android:layout_marginLeft="200dp" |
| 293 | android:gravity="center_vertical"> | 281 | android:gravity="center_vertical"> |
| 294 | 282 | ||
| 295 | <TextView | 283 | <TextView |
| 296 | android:layout_width="wrap_content" | 284 | android:layout_width="wrap_content" |
| 297 | android:layout_height="wrap_content" | 285 | android:layout_height="wrap_content" |
| 298 | android:text="手机号码" | 286 | android:text="手机号码" |
| 299 | android:textColor="@color/btn_text_color" | ||
| 300 | android:textSize="22sp" /> | 287 | android:textSize="22sp" /> |
| 301 | 288 | ||
| 302 | <TextView | 289 | <TextView |
| 303 | android:id="@+id/tv_card_phone" | 290 | android:id="@+id/tv_card_phone" |
| 304 | android:layout_width="wrap_content" | 291 | android:layout_width="wrap_content" |
| 305 | android:layout_height="wrap_content" | 292 | android:layout_height="wrap_content" |
| 306 | android:layout_marginLeft="50dp" | 293 | android:layout_marginLeft="50dp" |
| 307 | android:text="" | 294 | android:text="" |
| 308 | android:textSize="22sp" /> | 295 | android:textSize="22sp" /> |
| 309 | <TextView | 296 | <TextView |
| 310 | android:id="@+id/tv_card_phone_change" | 297 | android:id="@+id/tv_card_phone_change" |
| 311 | android:layout_width="wrap_content" | 298 | android:layout_width="wrap_content" |
| 312 | android:layout_height="wrap_content" | 299 | android:layout_height="wrap_content" |
| 313 | android:layout_marginLeft="18dp" | 300 | android:layout_marginLeft="18dp" |
| 314 | android:background="@drawable/corcle_black_bg" | 301 | android:background="@drawable/corcle_blue_bg" |
| 315 | android:text="修改" | 302 | android:text="修改" |
| 316 | android:paddingLeft="5dp" | 303 | android:paddingLeft="5dp" |
| 317 | android:paddingRight="5dp" | 304 | android:paddingRight="5dp" |
| 318 | android:textColor="@color/login_text_blue" | 305 | android:textColor="@color/login_text_blue" |
| 319 | android:textSize="18sp" /> | 306 | android:textSize="18sp" /> |
| 320 | 307 | ||
| 321 | 308 | ||
| 322 | </LinearLayout> | 309 | </LinearLayout> |
| 323 | 310 | ||
| 324 | <LinearLayout | 311 | <LinearLayout |
| 325 | android:layout_width="0dp" | 312 | android:layout_width="0dp" |
| 326 | android:layout_height="60dp" | 313 | android:layout_height="60dp" |
| 327 | android:layout_weight="1" | 314 | android:layout_weight="1" |
| 328 | android:layout_marginLeft="80dp" | 315 | android:layout_marginLeft="80dp" |
| 329 | android:gravity="center_vertical"> | 316 | android:gravity="center_vertical"> |
| 330 | 317 | ||
| 331 | <TextView | 318 | <TextView |
| 332 | android:layout_width="wrap_content" | 319 | android:layout_width="wrap_content" |
| 333 | android:layout_height="wrap_content" | 320 | android:layout_height="wrap_content" |
| 334 | android:textColor="@color/btn_text_color" | ||
| 335 | android:text="本地售后电话" | 321 | android:text="本地售后电话" |
| 336 | android:textSize="22sp" /> | 322 | android:textSize="22sp" /> |
| 337 | 323 | ||
| 338 | <TextView | 324 | <TextView |
| 339 | android:id="@+id/tv_card_tleNember" | 325 | android:id="@+id/tv_card_tleNember" |
| 340 | android:layout_width="wrap_content" | 326 | android:layout_width="wrap_content" |
| 341 | android:layout_height="wrap_content" | 327 | android:layout_height="wrap_content" |
| 342 | android:layout_marginLeft="60dp" | 328 | android:layout_marginLeft="60dp" |
| 343 | android:background="@null" | ||
| 344 | android:text="" | 329 | android:text="" |
| 345 | android:textSize="22sp" /> | 330 | android:textSize="22sp" /> |
| 346 | 331 | ||
| 347 | </LinearLayout> | 332 | </LinearLayout> |
| 348 | 333 | ||
| 349 | </LinearLayout> | 334 | </LinearLayout> |
| 350 | </LinearLayout> | 335 | </LinearLayout> |
| 351 | 336 | ||
| 352 | <LinearLayout | 337 | <LinearLayout |
| 353 | android:layout_width="match_parent" | 338 | android:layout_width="match_parent" |
| 354 | android:layout_height="wrap_content" | 339 | android:layout_height="wrap_content" |
| 355 | android:layout_marginTop="5dp" | 340 | android:layout_marginTop="5dp" |
| 356 | android:gravity="center" | 341 | android:gravity="center" |
| 357 | android:orientation="vertical"> | 342 | android:orientation="vertical"> |
| 358 | 343 | ||
| 359 | <TextView | 344 | <TextView |
| 360 | android:layout_width="wrap_content" | 345 | android:layout_width="wrap_content" |
| 361 | android:layout_height="wrap_content" | 346 | android:layout_height="wrap_content" |
| 362 | android:layout_marginTop="5dp" | 347 | android:layout_marginTop="5dp" |
| 363 | android:text="@string/electronic_card" | 348 | android:text="@string/electronic_card" |
| 364 | android:textColor="@color/electronic_text" | 349 | android:textColor="@color/electronic_text" |
| 365 | android:textSize="18sp" /> | 350 | android:textSize="18sp" /> |
| 366 | 351 | ||
| 367 | 352 | ||
| 368 | 353 | ||
| 369 | </LinearLayout> | 354 | </LinearLayout> |
| 370 | <LinearLayout | 355 | <LinearLayout |
| 371 | android:layout_width="match_parent" | 356 | android:layout_width="match_parent" |
| 372 | android:layout_height="wrap_content" | 357 | android:layout_height="wrap_content" |
| 373 | android:layout_marginTop="30dp" | 358 | android:layout_marginTop="30dp" |
| 374 | android:gravity="center" | 359 | android:gravity="center" |
| 375 | android:orientation="horizontal"> | 360 | android:orientation="horizontal"> |
| 376 | 361 | ||
| 377 | <ImageView | 362 | <ImageView |
| 378 | android:layout_width="wrap_content" | 363 | android:layout_width="wrap_content" |
| 379 | android:layout_height="wrap_content" | 364 | android:layout_height="wrap_content" |
| 380 | android:src="@mipmap/phone"/> | 365 | android:src="@mipmap/phone"/> |
| 381 | <TextView | 366 | <TextView |
| 382 | android:layout_width="wrap_content" | 367 | android:layout_width="wrap_content" |
| 383 | android:layout_height="wrap_content" | 368 | android:layout_height="wrap_content" |
| 384 | android:textSize="30sp" | 369 | android:textSize="30sp" |
| 385 | android:layout_marginLeft="5dp" | 370 | android:layout_marginLeft="5dp" |
| 386 | android:textColor="@color/login_text_blue" | 371 | android:textColor="@color/login_text_blue" |
| 387 | android:text="4006-123-678"/> | 372 | android:text="4006-123-678"/> |
| 388 | 373 | ||
| 389 | 374 | ||
| 390 | </LinearLayout> | 375 | </LinearLayout> |
| 391 | 376 | ||
| 392 | 377 | ||
| 393 | 378 | ||
| 394 | </LinearLayout> | 379 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/activity_electroniccard_info.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
| 6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 7 | 7 | ||
| 8 | <RelativeLayout | 8 | <RelativeLayout |
| 9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
| 10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
| 12 | android:background="@color/login_text_blue" | 12 | android:background="@color/login_text_blue" |
| 13 | android:minHeight="50dp"> | 13 | android:minHeight="50dp"> |
| 14 | 14 | ||
| 15 | <ImageView | 15 | <ImageView |
| 16 | android:id="@+id/iv_card_back" | 16 | android:id="@+id/iv_card_back" |
| 17 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
| 18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
| 19 | android:layout_centerVertical="true" | 19 | android:layout_centerVertical="true" |
| 20 | android:paddingLeft="20dp" | 20 | android:paddingLeft="20dp" |
| 21 | android:paddingRight="20dp" | 21 | android:paddingRight="20dp" |
| 22 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
| 23 | 23 | ||
| 24 | <TextView | 24 | <TextView |
| 25 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
| 26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
| 27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
| 28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
| 29 | android:text="@string/change_electroniccard_info_fill" | 29 | android:text="@string/change_electroniccard_info_fill" |
| 30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
| 31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
| 32 | </RelativeLayout> | 32 | </RelativeLayout> |
| 33 | 33 | ||
| 34 | <ImageView | 34 | <ImageView |
| 35 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
| 36 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
| 37 | android:layout_gravity="center" | 37 | android:layout_gravity="center" |
| 38 | android:layout_marginTop="20dp" | 38 | android:layout_marginTop="20dp" |
| 39 | android:src="@mipmap/change_info_icon" /> | 39 | android:src="@mipmap/change_info_icon" /> |
| 40 | 40 | ||
| 41 | <LinearLayout | 41 | <LinearLayout |
| 42 | android:layout_width="wrap_content" | 42 | android:layout_width="wrap_content" |
| 43 | android:layout_height="wrap_content" | 43 | android:layout_height="wrap_content" |
| 44 | android:layout_marginTop="60dp" | 44 | android:layout_marginTop="60dp" |
| 45 | android:orientation="horizontal"> | 45 | android:orientation="horizontal"> |
| 46 | 46 | ||
| 47 | <View | 47 | <View |
| 48 | android:layout_width="450dp" | 48 | android:layout_width="450dp" |
| 49 | android:layout_height="0.7dp" | 49 | android:layout_height="0.7dp" |
| 50 | android:layout_marginLeft="150dp" | 50 | android:layout_marginLeft="150dp" |
| 51 | android:background="@color/cutoff_line"> | 51 | android:background="@color/cutoff_line"> |
| 52 | 52 | ||
| 53 | </View> | 53 | </View> |
| 54 | 54 | ||
| 55 | <View | 55 | <View |
| 56 | android:layout_width="450dp" | 56 | android:layout_width="450dp" |
| 57 | android:layout_height="0.7dp" | 57 | android:layout_height="0.7dp" |
| 58 | android:layout_marginLeft="80dp" | 58 | android:layout_marginLeft="80dp" |
| 59 | android:background="@color/cutoff_line"> | 59 | android:background="@color/cutoff_line"> |
| 60 | 60 | ||
| 61 | </View> | 61 | </View> |
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | </LinearLayout> | 64 | </LinearLayout> |
| 65 | 65 | ||
| 66 | <LinearLayout | 66 | <LinearLayout |
| 67 | android:layout_width="match_parent" | 67 | android:layout_width="match_parent" |
| 68 | android:layout_height="wrap_content" | 68 | android:layout_height="wrap_content" |
| 69 | android:layout_marginLeft="200dp" | 69 | android:layout_marginLeft="200dp" |
| 70 | android:gravity="center_vertical" | 70 | android:gravity="center_vertical" |
| 71 | android:orientation="horizontal"> | 71 | android:orientation="horizontal"> |
| 72 | 72 | ||
| 73 | <LinearLayout | 73 | <LinearLayout |
| 74 | android:layout_width="0dp" | 74 | android:layout_width="0dp" |
| 75 | android:layout_height="80dp" | 75 | android:layout_height="80dp" |
| 76 | android:layout_weight="1" | 76 | android:layout_weight="1" |
| 77 | android:gravity="center_vertical"> | 77 | android:gravity="center_vertical"> |
| 78 | 78 | ||
| 79 | <TextView | 79 | <TextView |
| 80 | android:layout_width="wrap_content" | 80 | android:layout_width="wrap_content" |
| 81 | android:layout_height="wrap_content" | 81 | android:layout_height="wrap_content" |
| 82 | android:text="客户姓名" | 82 | android:text="客户姓名" |
| 83 | android:textSize="22sp" /> | 83 | android:textSize="22sp" /> |
| 84 | 84 | ||
| 85 | <EditText | 85 | <EditText |
| 86 | android:id="@+id/et_edit_username" | 86 | android:id="@+id/et_edit_username" |
| 87 | android:layout_width="wrap_content" | 87 | android:layout_width="wrap_content" |
| 88 | android:layout_height="wrap_content" | 88 | android:layout_height="wrap_content" |
| 89 | android:layout_marginLeft="50dp" | 89 | android:layout_marginLeft="50dp" |
| 90 | android:background="@null" | 90 | android:background="@null" |
| 91 | android:textColor="@color/electronic_text" | ||
| 91 | android:hint="请输入" | 92 | android:hint="请输入" |
| 92 | android:textSize="22sp" /> | 93 | android:textSize="22sp" /> |
| 93 | 94 | ||
| 94 | </LinearLayout> | 95 | </LinearLayout> |
| 95 | 96 | ||
| 96 | <LinearLayout | 97 | <LinearLayout |
| 97 | android:layout_width="0dp" | 98 | android:layout_width="0dp" |
| 98 | android:layout_height="80dp" | 99 | android:layout_height="80dp" |
| 99 | android:layout_weight="1" | 100 | android:layout_weight="1" |
| 100 | android:gravity="center_vertical"> | 101 | android:gravity="center_vertical"> |
| 101 | 102 | ||
| 102 | <TextView | 103 | <TextView |
| 103 | android:layout_width="150dp" | 104 | android:layout_width="150dp" |
| 104 | android:layout_height="wrap_content" | 105 | android:layout_height="wrap_content" |
| 105 | android:text="购买地址" | 106 | android:text="购买地址" |
| 106 | android:textSize="22sp" /> | 107 | android:textSize="22sp" /> |
| 107 | 108 | ||
| 108 | <TextView | 109 | <TextView |
| 109 | android:id="@+id/tv_edit_adress_shop" | 110 | android:id="@+id/tv_edit_adress_shop" |
| 110 | android:layout_width="wrap_content" | 111 | android:layout_width="wrap_content" |
| 111 | android:layout_height="wrap_content" | 112 | android:layout_height="wrap_content" |
| 112 | android:layout_marginLeft="20dp" | 113 | android:layout_marginLeft="20dp" |
| 114 | android:textColor="@color/electronic_text" | ||
| 113 | android:hint="请选择地区" | 115 | android:hint="请选择地区" |
| 114 | android:textSize="22sp" /> | 116 | android:textSize="22sp" /> |
| 115 | 117 | ||
| 116 | <ImageView | 118 | <ImageView |
| 117 | android:layout_width="wrap_content" | 119 | android:layout_width="wrap_content" |
| 118 | android:layout_height="wrap_content" | 120 | android:layout_height="wrap_content" |
| 119 | android:layout_marginLeft="60dp" | 121 | android:layout_marginLeft="60dp" |
| 120 | android:src="@mipmap/xiajiantou"> | 122 | android:src="@mipmap/xiajiantou"> |
| 121 | 123 | ||
| 122 | </ImageView> | 124 | </ImageView> |
| 123 | </LinearLayout> | 125 | </LinearLayout> |
| 124 | 126 | ||
| 125 | </LinearLayout> | 127 | </LinearLayout> |
| 126 | 128 | ||
| 127 | <LinearLayout | 129 | <LinearLayout |
| 128 | android:layout_width="wrap_content" | 130 | android:layout_width="wrap_content" |
| 129 | android:layout_height="wrap_content" | 131 | android:layout_height="wrap_content" |
| 130 | android:orientation="horizontal"> | 132 | android:orientation="horizontal"> |
| 131 | 133 | ||
| 132 | <View | 134 | <View |
| 133 | android:layout_width="450dp" | 135 | android:layout_width="450dp" |
| 134 | android:layout_height="0.7dp" | 136 | android:layout_height="0.7dp" |
| 135 | android:layout_marginLeft="150dp" | 137 | android:layout_marginLeft="150dp" |
| 136 | android:background="@color/cutoff_line"> | 138 | android:background="@color/cutoff_line"> |
| 137 | 139 | ||
| 138 | </View> | 140 | </View> |
| 139 | 141 | ||
| 140 | <View | 142 | <View |
| 141 | android:layout_width="450dp" | 143 | android:layout_width="450dp" |
| 142 | android:layout_height="0.7dp" | 144 | android:layout_height="0.7dp" |
| 143 | android:layout_marginLeft="80dp" | 145 | android:layout_marginLeft="80dp" |
| 144 | android:background="@color/cutoff_line"> | 146 | android:background="@color/cutoff_line"> |
| 145 | 147 | ||
| 146 | </View> | 148 | </View> |
| 147 | 149 | ||
| 148 | 150 | ||
| 149 | </LinearLayout> | 151 | </LinearLayout> |
| 150 | 152 | ||
| 151 | <LinearLayout | 153 | <LinearLayout |
| 152 | android:layout_width="match_parent" | 154 | android:layout_width="match_parent" |
| 153 | android:layout_height="wrap_content" | 155 | android:layout_height="wrap_content" |
| 154 | android:layout_marginLeft="200dp" | 156 | android:layout_marginLeft="200dp" |
| 155 | android:gravity="center_vertical" | 157 | android:gravity="center_vertical" |
| 156 | android:orientation="horizontal"> | 158 | android:orientation="horizontal"> |
| 157 | 159 | ||
| 158 | <LinearLayout | 160 | <LinearLayout |
| 159 | android:layout_width="0dp" | 161 | android:layout_width="0dp" |
| 160 | android:layout_height="80dp" | 162 | android:layout_height="80dp" |
| 161 | android:layout_weight="1" | 163 | android:layout_weight="1" |
| 162 | android:gravity="center_vertical"> | 164 | android:gravity="center_vertical"> |
| 163 | 165 | ||
| 164 | <TextView | 166 | <TextView |
| 165 | android:layout_width="wrap_content" | 167 | android:layout_width="wrap_content" |
| 166 | android:layout_height="wrap_content" | 168 | android:layout_height="wrap_content" |
| 167 | android:text="客户地址" | 169 | android:text="客户地址" |
| 168 | android:textSize="22sp" /> | 170 | android:textSize="22sp" /> |
| 169 | 171 | ||
| 170 | <TextView | 172 | <TextView |
| 171 | android:id="@+id/tv_edit_adress_custem" | 173 | android:id="@+id/tv_edit_adress_custem" |
| 172 | android:layout_width="wrap_content" | 174 | android:layout_width="wrap_content" |
| 173 | android:layout_height="wrap_content" | 175 | android:layout_height="wrap_content" |
| 174 | android:layout_marginLeft="50dp" | 176 | android:layout_marginLeft="50dp" |
| 177 | android:textColor="@color/electronic_text" | ||
| 175 | android:hint="请选择地区" | 178 | android:hint="请选择地区" |
| 176 | android:textSize="22sp" /> | 179 | android:textSize="22sp" /> |
| 177 | 180 | ||
| 178 | <ImageView | 181 | <ImageView |
| 179 | android:layout_width="wrap_content" | 182 | android:layout_width="wrap_content" |
| 180 | android:layout_height="wrap_content" | 183 | android:layout_height="wrap_content" |
| 181 | android:layout_marginLeft="60dp" | 184 | android:layout_marginLeft="60dp" |
| 182 | android:src="@mipmap/xiajiantou"> | 185 | android:src="@mipmap/xiajiantou"> |
| 183 | 186 | ||
| 184 | </ImageView> | 187 | </ImageView> |
| 185 | 188 | ||
| 186 | 189 | ||
| 187 | </LinearLayout> | 190 | </LinearLayout> |
| 188 | 191 | ||
| 189 | <LinearLayout | 192 | <LinearLayout |
| 190 | android:layout_width="0dp" | 193 | android:layout_width="0dp" |
| 191 | android:layout_height="80dp" | 194 | android:layout_height="80dp" |
| 192 | android:layout_weight="1" | 195 | android:layout_weight="1" |
| 193 | android:gravity="center_vertical"> | 196 | android:gravity="center_vertical"> |
| 194 | 197 | ||
| 195 | <TextView | 198 | <TextView |
| 196 | android:layout_width="150dp" | 199 | android:layout_width="150dp" |
| 197 | android:layout_height="wrap_content" | 200 | android:layout_height="wrap_content" |
| 198 | android:text=" " | 201 | android:text=" " |
| 199 | android:textColor="@color/white" | 202 | android:textColor="@color/white" |
| 200 | android:textSize="22sp" /> | 203 | android:textSize="22sp" /> |
| 201 | 204 | ||
| 202 | <EditText | 205 | <EditText |
| 203 | android:id="@+id/et_edit_store" | 206 | android:id="@+id/et_edit_store" |
| 204 | android:layout_width="wrap_content" | 207 | android:layout_width="wrap_content" |
| 205 | android:layout_height="wrap_content" | 208 | android:layout_height="wrap_content" |
| 206 | android:layout_marginLeft="20dp" | 209 | android:layout_marginLeft="20dp" |
| 207 | android:background="@null" | 210 | android:background="@null" |
| 211 | android:textColor="@color/electronic_text" | ||
| 208 | android:hint="请输入商店名称" | 212 | android:hint="请输入商店名称" |
| 209 | android:textSize="22sp" /> | 213 | android:textSize="22sp" /> |
| 210 | 214 | ||
| 211 | </LinearLayout> | 215 | </LinearLayout> |
| 212 | 216 | ||
| 213 | </LinearLayout> | 217 | </LinearLayout> |
| 214 | 218 | ||
| 215 | <LinearLayout | 219 | <LinearLayout |
| 216 | android:layout_width="wrap_content" | 220 | android:layout_width="wrap_content" |
| 217 | android:layout_height="wrap_content" | 221 | android:layout_height="wrap_content" |
| 218 | 222 | ||
| 219 | android:orientation="horizontal"> | 223 | android:orientation="horizontal"> |
| 220 | 224 | ||
| 221 | <View | 225 | <View |
| 222 | android:layout_width="450dp" | 226 | android:layout_width="450dp" |
| 223 | android:layout_height="0.7dp" | 227 | android:layout_height="0.7dp" |
| 224 | android:layout_marginLeft="150dp" | 228 | android:layout_marginLeft="150dp" |
| 225 | android:background="@color/cutoff_line"> | 229 | android:background="@color/cutoff_line"> |
| 226 | 230 | ||
| 227 | </View> | 231 | </View> |
| 228 | 232 | ||
| 229 | <View | 233 | <View |
| 230 | android:layout_width="450dp" | 234 | android:layout_width="450dp" |
| 231 | android:layout_height="0.7dp" | 235 | android:layout_height="0.7dp" |
| 232 | android:layout_marginLeft="80dp" | 236 | android:layout_marginLeft="80dp" |
| 233 | android:background="@color/cutoff_line"> | 237 | android:background="@color/cutoff_line"> |
| 234 | 238 | ||
| 235 | </View> | 239 | </View> |
| 236 | 240 | ||
| 237 | 241 | ||
| 238 | </LinearLayout> | 242 | </LinearLayout> |
| 239 | 243 | ||
| 240 | <LinearLayout | 244 | <LinearLayout |
| 241 | android:layout_width="match_parent" | 245 | android:layout_width="match_parent" |
| 242 | android:layout_height="wrap_content" | 246 | android:layout_height="wrap_content" |
| 243 | android:layout_marginLeft="200dp" | 247 | android:layout_marginLeft="200dp" |
| 244 | android:gravity="center_vertical" | 248 | android:gravity="center_vertical" |
| 245 | android:orientation="horizontal"> | 249 | android:orientation="horizontal"> |
| 246 | 250 | ||
| 247 | <LinearLayout | 251 | <LinearLayout |
| 248 | android:layout_width="0dp" | 252 | android:layout_width="0dp" |
| 249 | android:layout_height="80dp" | 253 | android:layout_height="80dp" |
| 250 | android:layout_weight="1" | 254 | android:layout_weight="1" |
| 251 | android:gravity="center_vertical"> | 255 | android:gravity="center_vertical"> |
| 252 | 256 | ||
| 253 | <TextView | 257 | <TextView |
| 254 | android:layout_width="wrap_content" | 258 | android:layout_width="wrap_content" |
| 255 | android:layout_height="wrap_content" | 259 | android:layout_height="wrap_content" |
| 256 | android:text=" " | 260 | android:text=" " |
| 257 | android:textColor="@color/white" | 261 | android:textColor="@color/white" |
| 258 | android:textSize="22sp" /> | 262 | android:textSize="22sp" /> |
| 259 | 263 | ||
| 260 | <EditText | 264 | <EditText |
| 261 | android:id="@+id/et_edit_adress_detail" | 265 | android:id="@+id/et_edit_adress_detail" |
| 262 | android:layout_width="wrap_content" | 266 | android:layout_width="wrap_content" |
| 263 | android:layout_height="wrap_content" | 267 | android:layout_height="wrap_content" |
| 264 | android:layout_marginLeft="100dp" | 268 | android:layout_marginLeft="100dp" |
| 265 | android:background="@null" | 269 | android:background="@null" |
| 270 | android:textColor="@color/electronic_text" | ||
| 266 | android:hint="请输入详细地址" | 271 | android:hint="请输入详细地址" |
| 267 | android:textSize="22sp" /> | 272 | android:textSize="22sp" /> |
| 268 | 273 | ||
| 269 | </LinearLayout> | 274 | </LinearLayout> |
| 270 | 275 | ||
| 271 | <LinearLayout | 276 | <LinearLayout |
| 272 | android:layout_width="0dp" | 277 | android:layout_width="0dp" |
| 273 | android:layout_height="80dp" | 278 | android:layout_height="80dp" |
| 274 | android:layout_weight="1" | 279 | android:layout_weight="1" |
| 275 | android:gravity="center_vertical"> | 280 | android:gravity="center_vertical"> |
| 276 | 281 | ||
| 277 | <TextView | 282 | <TextView |
| 278 | android:layout_width="150dp" | 283 | android:layout_width="150dp" |
| 279 | android:layout_height="wrap_content" | 284 | android:layout_height="wrap_content" |
| 280 | android:text="本地售后电话" | 285 | android:text="本地售后电话" |
| 281 | android:textSize="22sp" /> | 286 | android:textSize="22sp" /> |
| 282 | 287 | ||
| 283 | <EditText | 288 | <EditText |
| 284 | android:id="@+id/et_edit_telphone" | 289 | android:id="@+id/et_edit_telphone" |
| 285 | android:layout_width="wrap_content" | 290 | android:layout_width="wrap_content" |
| 286 | android:layout_height="wrap_content" | 291 | android:layout_height="wrap_content" |
| 287 | android:layout_marginLeft="20dp" | 292 | android:layout_marginLeft="20dp" |
| 288 | android:background="@null" | 293 | android:background="@null" |
| 294 | android:textColor="@color/electronic_text" | ||
| 289 | android:hint="请输入" | 295 | android:hint="请输入" |
| 290 | android:textSize="22sp" /> | 296 | android:textSize="22sp" /> |
| 291 | </LinearLayout> | 297 | </LinearLayout> |
| 292 | 298 | ||
| 293 | </LinearLayout> | 299 | </LinearLayout> |
| 294 | 300 | ||
| 295 | <LinearLayout | 301 | <LinearLayout |
| 296 | android:layout_width="wrap_content" | 302 | android:layout_width="wrap_content" |
| 297 | android:layout_height="wrap_content" | 303 | android:layout_height="wrap_content" |
| 298 | 304 | ||
| 299 | android:orientation="horizontal"> | 305 | android:orientation="horizontal"> |
| 300 | 306 | ||
| 301 | <View | 307 | <View |
| 302 | android:layout_width="450dp" | 308 | android:layout_width="450dp" |
| 303 | android:layout_height="0.7dp" | 309 | android:layout_height="0.7dp" |
| 304 | android:layout_marginLeft="150dp" | 310 | android:layout_marginLeft="150dp" |
| 305 | android:background="@color/cutoff_line"> | 311 | android:background="@color/cutoff_line"> |
| 306 | 312 | ||
| 307 | </View> | 313 | </View> |
| 308 | 314 | ||
| 309 | <View | 315 | <View |
| 310 | android:layout_width="450dp" | 316 | android:layout_width="450dp" |
| 311 | android:layout_height="0.7dp" | 317 | android:layout_height="0.7dp" |
| 312 | android:layout_marginLeft="80dp" | 318 | android:layout_marginLeft="80dp" |
| 313 | android:background="@color/cutoff_line"> | 319 | android:background="@color/cutoff_line"> |
| 314 | 320 | ||
| 315 | </View> | 321 | </View> |
| 316 | 322 | ||
| 317 | 323 | ||
| 318 | </LinearLayout> | 324 | </LinearLayout> |
| 319 | 325 | ||
| 320 | <LinearLayout | 326 | <LinearLayout |
| 321 | android:layout_width="match_parent" | 327 | android:layout_width="match_parent" |
| 322 | android:layout_height="wrap_content" | 328 | android:layout_height="wrap_content" |
| 323 | android:layout_marginLeft="200dp" | 329 | android:layout_marginLeft="200dp" |
| 324 | android:gravity="center_vertical" | 330 | android:gravity="center_vertical" |
| 325 | android:orientation="horizontal"> | 331 | android:orientation="horizontal"> |
| 326 | 332 | ||
| 327 | <LinearLayout | 333 | <LinearLayout |
| 328 | android:id="@+id/lineL_buy_time" | 334 | android:id="@+id/lineL_buy_time" |
| 329 | android:layout_width="0dp" | 335 | android:layout_width="0dp" |
| 330 | android:layout_height="80dp" | 336 | android:layout_height="80dp" |
| 331 | android:layout_weight="1" | 337 | android:layout_weight="1" |
| 332 | android:gravity="center_vertical"> | 338 | android:gravity="center_vertical"> |
| 333 | 339 | ||
| 334 | <TextView | 340 | <TextView |
| 335 | android:layout_width="wrap_content" | 341 | android:layout_width="wrap_content" |
| 336 | android:layout_height="wrap_content" | 342 | android:layout_height="wrap_content" |
| 337 | android:text="购买时间" | 343 | android:text="购买时间" |
| 338 | android:textSize="22sp" /> | 344 | android:textSize="22sp" /> |
| 339 | 345 | ||
| 340 | <TextView | 346 | <TextView |
| 341 | android:id="@+id/tv_buy_time" | 347 | android:id="@+id/tv_buy_time" |
| 342 | android:layout_width="wrap_content" | 348 | android:layout_width="wrap_content" |
| 343 | android:layout_height="wrap_content" | 349 | android:layout_height="wrap_content" |
| 344 | android:layout_marginLeft="50dp" | 350 | android:layout_marginLeft="50dp" |
| 345 | android:hint="请选择时间" | 351 | android:hint="请选择时间" |
| 346 | android:textSize="22sp" /> | 352 | android:textSize="22sp" /> |
| 347 | 353 | ||
| 348 | <ImageView | ||
| 349 | android:layout_width="wrap_content" | ||
| 350 | android:layout_height="wrap_content" | ||
| 351 | android:layout_marginLeft="60dp" | ||
| 352 | android:src="@mipmap/xiajiantou"> | ||
| 353 | |||
| 354 | </ImageView> | ||
| 355 | |||
| 356 | </LinearLayout> | 354 | </LinearLayout> |
| 357 | 355 | ||
| 358 | </LinearLayout> | 356 | </LinearLayout> |
| 359 | 357 | ||
| 360 | <LinearLayout | 358 | <LinearLayout |
| 361 | android:layout_width="wrap_content" | 359 | android:layout_width="wrap_content" |
| 362 | android:layout_height="wrap_content" | 360 | android:layout_height="wrap_content" |
| 363 | android:orientation="horizontal"> | 361 | android:orientation="horizontal"> |
| 364 | 362 | ||
| 365 | <View | 363 | <View |
| 366 | android:layout_width="450dp" | 364 | android:layout_width="450dp" |
| 367 | android:layout_height="0.7dp" | 365 | android:layout_height="0.7dp" |
| 368 | android:layout_marginLeft="150dp" | 366 | android:layout_marginLeft="150dp" |
| 369 | android:background="@color/cutoff_line"> | 367 | android:background="@color/cutoff_line"> |
| 370 | 368 | ||
| 371 | </View> | 369 | </View> |
| 372 | 370 | ||
| 373 | 371 | ||
| 374 | </LinearLayout> | 372 | </LinearLayout> |
| 375 | 373 | ||
| 376 | <Button | 374 | <Button |
| 377 | android:id="@+id/btn_change_info" | 375 | android:id="@+id/btn_change_info" |
| 378 | style="@style/button_login_register_style" | 376 | style="@style/button_login_register_style" |
| 379 | android:layout_marginLeft="200dp" | 377 | android:layout_marginLeft="200dp" |
PersonalCenter/app/src/main/res/layout/activity_ok_cardinfo.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/string_electroniccard_info_ok" | 28 | android:text="@string/string_electroniccard_info_ok" |
| 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="match_parent" | 34 | android:layout_width="match_parent" |
| 35 | android:layout_height="wrap_content" | 35 | android:layout_height="wrap_content" |
| 36 | android:layout_marginTop="50dp" | 36 | android:layout_marginTop="50dp" |
| 37 | android:layout_marginLeft="20dp" | 37 | android:layout_marginLeft="20dp" |
| 38 | android:layout_marginRight="20dp" | 38 | android:layout_marginRight="20dp" |
| 39 | android:layout_marginBottom="30dp" | 39 | android:layout_marginBottom="30dp" |
| 40 | android:background="@mipmap/cardbackgrangd" | 40 | android:background="@mipmap/cardbackgrangd" |
| 41 | android:gravity="center" | 41 | android:gravity="center" |
| 42 | android:orientation="vertical"> | 42 | android:orientation="vertical"> |
| 43 | 43 | ||
| 44 | <LinearLayout | 44 | <LinearLayout |
| 45 | android:layout_width="match_parent" | 45 | android:layout_width="match_parent" |
| 46 | android:layout_height="wrap_content" | 46 | android:layout_height="wrap_content" |
| 47 | android:layout_marginTop="50dp" | 47 | android:layout_marginTop="50dp" |
| 48 | android:gravity="center_vertical" | 48 | android:gravity="center_vertical" |
| 49 | android:orientation="horizontal"> | 49 | android:orientation="horizontal"> |
| 50 | 50 | ||
| 51 | <LinearLayout | 51 | <LinearLayout |
| 52 | android:layout_width="0dp" | 52 | android:layout_width="0dp" |
| 53 | android:layout_weight="1" | 53 | android:layout_weight="1" |
| 54 | android:layout_height="wrap_content" | 54 | android:layout_height="wrap_content" |
| 55 | android:layout_marginLeft="200dp" | 55 | android:layout_marginLeft="200dp" |
| 56 | android:gravity="center_vertical"> | 56 | android:gravity="center_vertical"> |
| 57 | 57 | ||
| 58 | <ImageView | 58 | <ImageView |
| 59 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
| 60 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
| 61 | android:src="@mipmap/logo_info" /> | 61 | android:src="@mipmap/logo_info" /> |
| 62 | 62 | ||
| 63 | <TextView | 63 | <TextView |
| 64 | android:layout_width="wrap_content" | 64 | android:layout_width="wrap_content" |
| 65 | android:layout_height="wrap_content" | 65 | android:layout_height="wrap_content" |
| 66 | android:layout_marginLeft="50dp" | 66 | android:layout_marginLeft="50dp" |
| 67 | android:background="@null" | 67 | android:background="@null" |
| 68 | android:text="电子保卡" | 68 | android:text="电子保卡" |
| 69 | android:textColor="@color/electronic_card" | 69 | android:textColor="@color/electronic_card" |
| 70 | android:textSize="22sp" /> | 70 | android:textSize="22sp" /> |
| 71 | 71 | ||
| 72 | </LinearLayout> | 72 | </LinearLayout> |
| 73 | 73 | ||
| 74 | <LinearLayout | 74 | <LinearLayout |
| 75 | android:layout_width="0dp" | 75 | android:layout_width="0dp" |
| 76 | android:layout_weight="1" | 76 | android:layout_weight="1" |
| 77 | android:layout_height="80dp" | 77 | android:layout_height="80dp" |
| 78 | android:layout_marginLeft="80dp" | 78 | android:layout_marginLeft="80dp" |
| 79 | android:gravity="center_vertical"> | 79 | android:gravity="center_vertical"> |
| 80 | 80 | ||
| 81 | <TextView | 81 | <TextView |
| 82 | android:layout_width="wrap_content" | 82 | android:layout_width="wrap_content" |
| 83 | android:layout_height="wrap_content" | 83 | android:layout_height="wrap_content" |
| 84 | android:text="客户姓名" | 84 | android:text="客户姓名" |
| 85 | android:textColor="@color/btn_text_color" | ||
| 86 | android:textSize="22sp" /> | 85 | android:textSize="22sp" /> |
| 87 | 86 | ||
| 88 | <TextView | 87 | <TextView |
| 89 | android:id="@+id/iv_card_username" | 88 | android:id="@+id/iv_card_username" |
| 90 | android:layout_width="wrap_content" | 89 | android:layout_width="wrap_content" |
| 91 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
| 92 | android:layout_marginLeft="80dp" | 91 | android:layout_marginLeft="80dp" |
| 93 | android:text="王小明" | 92 | android:text="" |
| 94 | android:textColor="@color/btn_text_color" | ||
| 95 | android:textSize="22sp" /> | 93 | android:textSize="22sp" /> |
| 96 | 94 | ||
| 97 | </LinearLayout> | 95 | </LinearLayout> |
| 98 | 96 | ||
| 99 | </LinearLayout> | 97 | </LinearLayout> |
| 100 | 98 | ||
| 101 | <LinearLayout | 99 | <LinearLayout |
| 102 | android:layout_width="match_parent" | 100 | android:layout_width="match_parent" |
| 103 | android:layout_height="wrap_content" | 101 | android:layout_height="wrap_content" |
| 104 | android:gravity="center_vertical" | 102 | android:gravity="center_vertical" |
| 105 | android:orientation="horizontal"> | 103 | android:orientation="horizontal"> |
| 106 | 104 | ||
| 107 | <LinearLayout | 105 | <LinearLayout |
| 108 | android:layout_width="0dp" | 106 | android:layout_width="0dp" |
| 109 | android:layout_weight="1" | 107 | android:layout_weight="1" |
| 110 | android:layout_height="60dp" | 108 | android:layout_height="60dp" |
| 111 | android:layout_marginLeft="200dp" | 109 | android:layout_marginLeft="200dp" |
| 112 | android:gravity="center_vertical"> | 110 | android:gravity="center_vertical"> |
| 113 | 111 | ||
| 114 | <TextView | 112 | <TextView |
| 115 | android:layout_width="wrap_content" | 113 | android:layout_width="wrap_content" |
| 116 | android:layout_height="wrap_content" | 114 | android:layout_height="wrap_content" |
| 117 | android:text="产品型号" | 115 | android:text="产品型号" |
| 118 | android:textColor="@color/btn_text_color" | ||
| 119 | android:textSize="22sp" /> | 116 | android:textSize="22sp" /> |
| 120 | 117 | ||
| 121 | <TextView | 118 | <TextView |
| 122 | android:id="@+id/tv_card_deviceModel" | 119 | android:id="@+id/tv_card_deviceModel" |
| 123 | android:layout_width="wrap_content" | 120 | android:layout_width="wrap_content" |
| 124 | android:layout_height="wrap_content" | 121 | android:layout_height="wrap_content" |
| 125 | android:layout_marginLeft="50dp" | 122 | android:layout_marginLeft="50dp" |
| 126 | android:text="IPone888" | 123 | android:text="" |
| 127 | android:textSize="22sp" /> | 124 | android:textSize="22sp" /> |
| 128 | 125 | ||
| 129 | 126 | ||
| 130 | </LinearLayout> | 127 | </LinearLayout> |
| 131 | 128 | ||
| 132 | <LinearLayout | 129 | <LinearLayout |
| 133 | android:layout_width="0dp" | 130 | android:layout_width="0dp" |
| 134 | android:layout_weight="1" | 131 | android:layout_weight="1" |
| 135 | android:layout_height="60dp" | 132 | android:layout_height="60dp" |
| 136 | android:layout_marginLeft="80dp" | 133 | android:layout_marginLeft="80dp" |
| 137 | android:gravity="center_vertical"> | 134 | android:gravity="center_vertical"> |
| 138 | 135 | ||
| 139 | <TextView | 136 | <TextView |
| 140 | android:layout_width="wrap_content" | 137 | android:layout_width="wrap_content" |
| 141 | android:layout_height="wrap_content" | 138 | android:layout_height="wrap_content" |
| 142 | android:text="客户地址" | 139 | android:text="客户地址" |
| 143 | android:textSize="22sp" /> | 140 | android:textSize="22sp" /> |
| 144 | 141 | ||
| 145 | <TextView | 142 | <TextView |
| 146 | android:id="@+id/tv_card_adress" | 143 | android:id="@+id/tv_card_adress" |
| 147 | android:layout_width="wrap_content" | 144 | android:layout_width="wrap_content" |
| 148 | android:layout_height="wrap_content" | 145 | android:layout_height="wrap_content" |
| 149 | android:layout_marginLeft="80dp" | 146 | android:layout_marginLeft="80dp" |
| 150 | android:background="@null" | 147 | android:background="@null" |
| 151 | android:text="北京市昭阳区三里屯" | 148 | android:text="" |
| 152 | android:textSize="22sp" /> | 149 | android:textSize="22sp" /> |
| 153 | 150 | ||
| 154 | </LinearLayout> | 151 | </LinearLayout> |
| 155 | 152 | ||
| 156 | </LinearLayout> | 153 | </LinearLayout> |
| 157 | 154 | ||
| 158 | <LinearLayout | 155 | <LinearLayout |
| 159 | android:layout_width="match_parent" | 156 | android:layout_width="match_parent" |
| 160 | android:layout_height="wrap_content" | 157 | android:layout_height="wrap_content" |
| 161 | android:gravity="center_vertical" | 158 | android:gravity="center_vertical" |
| 162 | android:orientation="horizontal"> | 159 | android:orientation="horizontal"> |
| 163 | 160 | ||
| 164 | <LinearLayout | 161 | <LinearLayout |
| 165 | android:layout_width="0dp" | 162 | android:layout_width="0dp" |
| 166 | android:layout_weight="1" | 163 | android:layout_weight="1" |
| 167 | android:layout_height="60dp" | 164 | android:layout_height="60dp" |
| 168 | android:layout_marginLeft="200dp" | 165 | android:layout_marginLeft="200dp" |
| 169 | android:gravity="center_vertical"> | 166 | android:gravity="center_vertical"> |
| 170 | 167 | ||
| 171 | <TextView | 168 | <TextView |
| 172 | android:layout_width="wrap_content" | 169 | android:layout_width="wrap_content" |
| 173 | android:layout_height="wrap_content" | 170 | android:layout_height="wrap_content" |
| 174 | android:text="MAC地址" | 171 | android:text="MAC地址" |
| 175 | android:textSize="22sp" /> | 172 | android:textSize="22sp" /> |
| 176 | 173 | ||
| 177 | <TextView | 174 | <TextView |
| 178 | android:id="@+id/tv_card_mac" | 175 | android:id="@+id/tv_card_mac" |
| 179 | android:layout_width="wrap_content" | 176 | android:layout_width="wrap_content" |
| 180 | android:layout_height="wrap_content" | 177 | android:layout_height="wrap_content" |
| 181 | android:layout_marginLeft="50dp" | 178 | android:layout_marginLeft="50dp" |
| 182 | android:background="@null" | 179 | android:background="@null" |
| 183 | android:text="237462873463278" | 180 | android:text="" |
| 184 | android:textSize="22sp" /> | 181 | android:textSize="22sp" /> |
| 185 | 182 | ||
| 186 | </LinearLayout> | 183 | </LinearLayout> |
| 187 | 184 | ||
| 188 | <LinearLayout | 185 | <LinearLayout |
| 189 | android:layout_width="0dp" | 186 | android:layout_width="0dp" |
| 190 | android:layout_weight="1" | 187 | android:layout_weight="1" |
| 191 | android:layout_height="60dp" | 188 | android:layout_height="60dp" |
| 192 | android:layout_marginLeft="80dp" | 189 | android:layout_marginLeft="80dp" |
| 193 | android:gravity="center_vertical"> | 190 | android:gravity="center_vertical"> |
| 194 | 191 | ||
| 195 | <TextView | 192 | <TextView |
| 196 | android:layout_width="wrap_content" | 193 | android:layout_width="wrap_content" |
| 197 | android:layout_height="wrap_content" | 194 | android:layout_height="wrap_content" |
| 198 | android:text="购买时间" | 195 | android:text="购买时间" |
| 199 | android:textColor="@color/btn_text_color" | ||
| 200 | android:textSize="22sp" /> | 196 | android:textSize="22sp" /> |
| 201 | 197 | ||
| 202 | <TextView | 198 | <TextView |
| 203 | android:id="@+id/tv_card_time" | 199 | android:id="@+id/tv_card_time" |
| 204 | android:layout_width="wrap_content" | 200 | android:layout_width="wrap_content" |
| 205 | android:layout_height="wrap_content" | 201 | android:layout_height="wrap_content" |
| 206 | android:layout_marginLeft="80dp" | 202 | android:layout_marginLeft="80dp" |
| 207 | android:background="@null" | 203 | android:background="@null" |
| 208 | android:text="4433322-334--34" | 204 | android:text="" |
| 209 | android:textColor="@color/btn_text_color" | ||
| 210 | android:textSize="22sp" /> | 205 | android:textSize="22sp" /> |
| 211 | </LinearLayout> | 206 | </LinearLayout> |
| 212 | 207 | ||
| 213 | </LinearLayout> | 208 | </LinearLayout> |
| 214 | 209 | ||
| 215 | <LinearLayout | 210 | <LinearLayout |
| 216 | android:layout_width="match_parent" | 211 | android:layout_width="match_parent" |
| 217 | android:layout_height="wrap_content" | 212 | android:layout_height="wrap_content" |
| 218 | android:gravity="center_vertical" | 213 | android:gravity="center_vertical" |
| 219 | android:orientation="horizontal"> | 214 | android:orientation="horizontal"> |
| 220 | 215 | ||
| 221 | <LinearLayout | 216 | <LinearLayout |
| 222 | android:layout_width="0dp" | 217 | android:layout_width="0dp" |
| 223 | android:layout_weight="1" | 218 | android:layout_weight="1" |
| 224 | android:layout_height="60dp" | 219 | android:layout_height="60dp" |
| 225 | android:layout_marginLeft="200dp" | 220 | android:layout_marginLeft="200dp" |
| 226 | android:gravity="center_vertical"> | 221 | android:gravity="center_vertical"> |
| 227 | 222 | ||
| 228 | <TextView | 223 | <TextView |
| 229 | android:layout_width="wrap_content" | 224 | android:layout_width="wrap_content" |
| 230 | android:layout_height="wrap_content" | 225 | android:layout_height="wrap_content" |
| 231 | android:text="机身编码" | 226 | android:text="机身编码" |
| 232 | android:textColor="@color/btn_text_color" | ||
| 233 | android:textSize="22sp" /> | 227 | android:textSize="22sp" /> |
| 234 | 228 | ||
| 235 | <TextView | 229 | <TextView |
| 236 | android:id="@+id/tv_card_deviceNumber" | 230 | android:id="@+id/tv_card_deviceNumber" |
| 237 | android:layout_width="wrap_content" | 231 | android:layout_width="wrap_content" |
| 238 | android:layout_height="wrap_content" | 232 | android:layout_height="wrap_content" |
| 239 | android:layout_marginLeft="50dp" | 233 | android:layout_marginLeft="50dp" |
| 240 | android:hint="473463746343" | 234 | android:hint="" |
| 241 | android:textSize="22sp" /> | 235 | android:textSize="22sp" /> |
| 242 | 236 | ||
| 243 | </LinearLayout> | 237 | </LinearLayout> |
| 244 | 238 | ||
| 245 | <LinearLayout | 239 | <LinearLayout |
| 246 | android:layout_width="0dp" | 240 | android:layout_width="0dp" |
| 247 | android:layout_weight="1" | 241 | android:layout_weight="1" |
| 248 | android:layout_height="60dp" | 242 | android:layout_height="60dp" |
| 249 | android:layout_marginLeft="80dp" | 243 | android:layout_marginLeft="80dp" |
| 250 | android:gravity="center_vertical"> | 244 | android:gravity="center_vertical"> |
| 251 | 245 | ||
| 252 | <TextView | 246 | <TextView |
| 253 | android:layout_width="wrap_content" | 247 | android:layout_width="wrap_content" |
| 254 | android:layout_height="wrap_content" | 248 | android:layout_height="wrap_content" |
| 255 | android:text="购买地址" | 249 | android:text="购买地址" |
| 256 | android:textColor="@color/btn_text_color" | ||
| 257 | android:textSize="22sp" /> | 250 | android:textSize="22sp" /> |
| 258 | 251 | ||
| 259 | <TextView | 252 | <TextView |
| 260 | android:id="@+id/tv_card_shopAdress" | 253 | android:id="@+id/tv_card_shopAdress" |
| 261 | android:layout_width="wrap_content" | 254 | android:layout_width="wrap_content" |
| 262 | android:layout_height="wrap_content" | 255 | android:layout_height="wrap_content" |
| 263 | android:layout_marginLeft="80dp" | 256 | android:layout_marginLeft="80dp" |
| 264 | android:text="啥啥啥 专卖店" | 257 | android:text="" |
| 265 | android:textColor="@color/btn_text_color" | ||
| 266 | android:textSize="22sp" /> | 258 | android:textSize="22sp" /> |
| 267 | </LinearLayout> | 259 | </LinearLayout> |
| 268 | 260 | ||
| 269 | </LinearLayout> | 261 | </LinearLayout> |
| 270 | 262 | ||
| 271 | <LinearLayout | 263 | <LinearLayout |
| 272 | android:layout_width="match_parent" | 264 | android:layout_width="match_parent" |
| 273 | android:layout_height="wrap_content" | 265 | android:layout_height="wrap_content" |
| 274 | android:gravity="center_vertical" | 266 | android:gravity="center_vertical" |
| 275 | android:layout_marginBottom="30dp" | 267 | android:layout_marginBottom="30dp" |
| 276 | android:orientation="horizontal"> | 268 | android:orientation="horizontal"> |
| 277 | 269 | ||
| 278 | <LinearLayout | 270 | <LinearLayout |
| 279 | android:layout_width="0dp" | 271 | android:layout_width="0dp" |
| 280 | android:layout_weight="1" | 272 | android:layout_weight="1" |
| 281 | android:layout_height="60dp" | 273 | android:layout_height="60dp" |
| 282 | android:layout_marginLeft="200dp" | 274 | android:layout_marginLeft="200dp" |
| 283 | android:gravity="center_vertical"> | 275 | android:gravity="center_vertical"> |
| 284 | 276 | ||
| 285 | <TextView | 277 | <TextView |
| 286 | android:layout_width="wrap_content" | 278 | android:layout_width="wrap_content" |
| 287 | android:layout_height="wrap_content" | 279 | android:layout_height="wrap_content" |
| 288 | android:text="手机号码" | 280 | android:text="手机号码" |
| 289 | android:textColor="@color/btn_text_color" | ||
| 290 | android:textSize="22sp" /> | 281 | android:textSize="22sp" /> |
| 291 | 282 | ||
| 292 | <TextView | 283 | <TextView |
| 293 | android:id="@+id/tv_card_phone" | 284 | android:id="@+id/tv_card_phone" |
| 294 | android:layout_width="wrap_content" | 285 | android:layout_width="wrap_content" |
| 295 | android:layout_height="wrap_content" | 286 | android:layout_height="wrap_content" |
| 296 | android:layout_marginLeft="50dp" | 287 | android:layout_marginLeft="50dp" |
| 297 | android:text="IPone888" | 288 | android:text="" |
| 298 | android:textSize="22sp" /> | 289 | android:textSize="22sp" /> |
| 299 | 290 | ||
| 300 | 291 | ||
| 301 | </LinearLayout> | 292 | </LinearLayout> |
| 302 | 293 | ||
| 303 | <LinearLayout | 294 | <LinearLayout |
| 304 | android:layout_width="0dp" | 295 | android:layout_width="0dp" |
| 305 | android:layout_weight="1" | 296 | android:layout_weight="1" |
| 306 | android:layout_height="60dp" | 297 | android:layout_height="60dp" |
| 307 | android:layout_marginLeft="80dp" | 298 | android:layout_marginLeft="80dp" |
| 308 | android:gravity="center_vertical"> | 299 | android:gravity="center_vertical"> |
| 309 | 300 | ||
| 310 | <TextView | 301 | <TextView |
| 311 | android:layout_width="wrap_content" | 302 | android:layout_width="wrap_content" |
| 312 | android:layout_height="wrap_content" | 303 | android:layout_height="wrap_content" |
| 313 | android:text="本地售后电话" | 304 | android:text="本地售后电话" |
| 314 | android:textSize="22sp" /> | 305 | android:textSize="22sp" /> |
| 315 | 306 | ||
| 316 | <TextView | 307 | <TextView |
| 317 | android:id="@+id/tv_card_tleNember" | 308 | android:id="@+id/tv_card_tleNember" |
| 318 | android:layout_width="wrap_content" | 309 | android:layout_width="wrap_content" |
| 319 | android:layout_height="wrap_content" | 310 | android:layout_height="wrap_content" |
| 320 | android:layout_marginLeft="40dp" | 311 | android:layout_marginLeft="40dp" |
| 321 | android:background="@null" | 312 | android:background="@null" |
| 322 | android:text="1111111" | 313 | android:text="" |
| 323 | android:textSize="22sp" /> | 314 | android:textSize="22sp" /> |
| 324 | 315 | ||
| 325 | </LinearLayout> | 316 | </LinearLayout> |
| 326 | 317 | ||
| 327 | </LinearLayout> | 318 | </LinearLayout> |
| 328 | </LinearLayout> | 319 | </LinearLayout> |
| 329 | 320 | ||
| 330 | <LinearLayout | 321 | <LinearLayout |
| 331 | android:layout_width="match_parent" | 322 | android:layout_width="match_parent" |
| 332 | android:layout_height="wrap_content" | 323 | android:layout_height="wrap_content" |
| 333 | android:layout_marginTop="5dp" | 324 | android:layout_marginTop="5dp" |
| 334 | android:gravity="center" | 325 | android:gravity="center" |
| 335 | android:orientation="vertical"> | 326 | android:orientation="vertical"> |
| 336 | 327 | ||
| 337 | <TextView | 328 | <TextView |
| 338 | android:layout_width="wrap_content" | 329 | android:layout_width="wrap_content" |
| 339 | android:layout_height="wrap_content" | 330 | android:layout_height="wrap_content" |
| 340 | android:layout_marginTop="5dp" | 331 | android:layout_marginTop="5dp" |
| 341 | android:text="@string/electronic_card3" | 332 | android:text="@string/electronic_card3" |
| 342 | android:textColor="@color/electronic_text" | 333 | android:textColor="@color/electronic_text" |
| 343 | android:textSize="18sp" /> | 334 | android:textSize="18sp" /> |
| 344 | 335 | ||
| 345 | <TextView | 336 | <TextView |
| 346 | android:layout_width="wrap_content" | 337 | android:layout_width="wrap_content" |
| 347 | android:layout_height="wrap_content" | 338 | android:layout_height="wrap_content" |
| 348 | android:layout_marginTop="5dp" | 339 | android:layout_marginTop="5dp" |
| 349 | android:text="@string/electronic_card4" | 340 | android:text="@string/electronic_card4" |
| 350 | android:textColor="@color/electronic_text" | 341 | android:textColor="@color/electronic_text" |
| 351 | android:textSize="18sp" /> | 342 | android:textSize="18sp" /> |
| 352 | 343 | ||
| 353 | 344 | ||
| 354 | </LinearLayout> | 345 | </LinearLayout> |
| 355 | 346 | ||
| 356 | <LinearLayout | 347 | <LinearLayout |
| 357 | android:layout_width="match_parent" | 348 | android:layout_width="match_parent" |
| 358 | android:layout_height="wrap_content" | 349 | android:layout_height="wrap_content" |
| 359 | android:layout_marginTop="30dp" | 350 | android:layout_marginTop="30dp" |
| 360 | android:gravity="center" | 351 | android:gravity="center" |
| 361 | android:orientation="horizontal"> | 352 | android:orientation="horizontal"> |
| 362 | 353 | ||
| 363 | <Button | 354 | <Button |
| 364 | android:id="@+id/btn_bangding" | 355 | android:id="@+id/btn_bangding" |
| 365 | android:layout_width="300dp" | 356 | android:layout_width="300dp" |
| 366 | android:layout_height="wrap_content" | 357 | android:layout_height="wrap_content" |
| 367 | android:background="@drawable/selector_blue_btn_bg" | 358 | android:background="@drawable/selector_blue_btn_bg" |
| 368 | android:text="@string/bangding" | 359 | android:text="@string/bangding" |
| 369 | android:textColor="@color/white" | 360 | android:textColor="@color/white" |
| 370 | android:textSize="23sp" /> | 361 | android:textSize="23sp" /> |
| 371 | 362 | ||
| 372 | <Button | 363 | <Button |
| 373 | android:id="@+id/btn_finish" | 364 | android:id="@+id/btn_finish" |
| 374 | android:layout_width="300dp" | 365 | android:layout_width="300dp" |
| 375 | android:layout_height="wrap_content" | 366 | android:layout_height="wrap_content" |
| 376 | android:layout_marginLeft="50dp" | 367 | android:layout_marginLeft="50dp" |
| 377 | android:background="@drawable/selector_blue_btn_bg" | 368 | android:background="@drawable/selector_blue_btn_bg" |
| 378 | android:text="@string/finish" | 369 | android:text="@string/finish" |
| 379 | android:textColor="@color/white" | 370 | android:textColor="@color/white" |
| 380 | android:textSize="23sp" /> | 371 | android:textSize="23sp" /> |
| 381 | 372 | ||
| 382 | 373 | ||
| 383 | </LinearLayout> | 374 | </LinearLayout> |
| 384 | 375 | ||
| 385 | 376 | ||
| 386 | </LinearLayout> | 377 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_presonal_info.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
| 6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | <LinearLayout | 9 | <LinearLayout |
| 10 | android:layout_width="wrap_content" | 10 | android:layout_width="wrap_content" |
| 11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
| 12 | android:layout_marginTop="80dp" | 12 | android:layout_marginTop="80dp" |
| 13 | android:orientation="horizontal"> | 13 | android:orientation="horizontal"> |
| 14 | 14 | ||
| 15 | <View | 15 | <View |
| 16 | android:layout_width="450dp" | 16 | android:layout_width="450dp" |
| 17 | android:layout_height="0.7dp" | 17 | android:layout_height="0.7dp" |
| 18 | android:layout_marginLeft="150dp" | 18 | android:layout_marginLeft="150dp" |
| 19 | android:background="@color/cutoff_line"> | 19 | android:background="@color/cutoff_line"> |
| 20 | 20 | ||
| 21 | </View> | 21 | </View> |
| 22 | 22 | ||
| 23 | <View | 23 | <View |
| 24 | android:layout_width="450dp" | 24 | android:layout_width="450dp" |
| 25 | android:layout_height="0.7dp" | 25 | android:layout_height="0.7dp" |
| 26 | android:layout_marginLeft="80dp" | 26 | android:layout_marginLeft="80dp" |
| 27 | android:background="@color/cutoff_line"> | 27 | android:background="@color/cutoff_line"> |
| 28 | 28 | ||
| 29 | </View> | 29 | </View> |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | </LinearLayout> | 32 | </LinearLayout> |
| 33 | 33 | ||
| 34 | <LinearLayout | 34 | <LinearLayout |
| 35 | android:layout_width="match_parent" | 35 | android:layout_width="match_parent" |
| 36 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
| 37 | android:layout_marginLeft="200dp" | 37 | android:layout_marginLeft="200dp" |
| 38 | android:gravity="center_vertical" | 38 | android:gravity="center_vertical" |
| 39 | android:orientation="horizontal"> | 39 | android:orientation="horizontal"> |
| 40 | 40 | ||
| 41 | <LinearLayout | 41 | <LinearLayout |
| 42 | android:layout_width="0dp" | 42 | android:layout_width="0dp" |
| 43 | android:layout_height="80dp" | 43 | android:layout_height="80dp" |
| 44 | android:layout_weight="1" | 44 | android:layout_weight="1" |
| 45 | android:gravity="center_vertical"> | 45 | android:gravity="center_vertical"> |
| 46 | 46 | ||
| 47 | <TextView | 47 | <TextView |
| 48 | android:layout_width="wrap_content" | 48 | android:layout_width="wrap_content" |
| 49 | android:layout_height="wrap_content" | 49 | android:layout_height="wrap_content" |
| 50 | android:text="昵称" | 50 | android:text="昵称" |
| 51 | android:textSize="22sp" /> | 51 | android:textSize="22sp" /> |
| 52 | 52 | ||
| 53 | <EditText | 53 | <EditText |
| 54 | android:id="@+id/tv_username1" | 54 | android:id="@+id/tv_username1" |
| 55 | android:layout_width="wrap_content" | 55 | android:layout_width="wrap_content" |
| 56 | android:layout_height="wrap_content" | 56 | android:layout_height="wrap_content" |
| 57 | android:layout_marginLeft="50dp" | 57 | android:layout_marginLeft="50dp" |
| 58 | android:textColor="@color/electronic_text" | ||
| 58 | android:background="@null" | 59 | android:background="@null" |
| 59 | android:hint="请输入12个以内的中文或英文字符" | 60 | android:hint="请输入12个以内的中文或英文字符" |
| 60 | android:textColor="@color/electronic_text" | ||
| 61 | android:textSize="22sp" /> | 61 | android:textSize="22sp" /> |
| 62 | 62 | ||
| 63 | </LinearLayout> | 63 | </LinearLayout> |
| 64 | 64 | ||
| 65 | <LinearLayout | 65 | <LinearLayout |
| 66 | android:layout_width="0dp" | 66 | android:layout_width="0dp" |
| 67 | android:layout_height="80dp" | 67 | android:layout_height="80dp" |
| 68 | android:layout_weight="1" | 68 | android:layout_weight="1" |
| 69 | android:gravity="center_vertical"> | 69 | android:gravity="center_vertical"> |
| 70 | 70 | ||
| 71 | <TextView | 71 | <TextView |
| 72 | android:layout_width="wrap_content" | 72 | android:layout_width="wrap_content" |
| 73 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
| 74 | android:text="地区" | 74 | android:text="地区" |
| 75 | android:textSize="22sp" /> | 75 | android:textSize="22sp" /> |
| 76 | 76 | ||
| 77 | <TextView | 77 | <TextView |
| 78 | android:id="@+id/tv_useinfo_adress" | 78 | android:id="@+id/tv_useinfo_adress" |
| 79 | android:layout_width="wrap_content" | 79 | android:layout_width="wrap_content" |
| 80 | android:layout_height="wrap_content" | 80 | android:layout_height="wrap_content" |
| 81 | android:layout_marginLeft="50dp" | 81 | android:layout_marginLeft="50dp" |
| 82 | android:hint="请选择" | 82 | android:hint="请选择" |
| 83 | android:textColor="@color/btn_text_color" | ||
| 84 | android:textSize="22sp" /> | 83 | android:textSize="22sp" /> |
| 85 | 84 | ||
| 86 | <ImageView | 85 | <ImageView |
| 87 | android:layout_width="wrap_content" | 86 | android:layout_width="wrap_content" |
| 88 | android:layout_height="wrap_content" | 87 | android:layout_height="wrap_content" |
| 89 | android:layout_marginLeft="150dp" | 88 | android:layout_marginLeft="150dp" |
| 90 | android:src="@mipmap/xiajiantou"> | 89 | android:src="@mipmap/xiajiantou"> |
| 91 | 90 | ||
| 92 | </ImageView> | 91 | </ImageView> |
| 93 | </LinearLayout> | 92 | </LinearLayout> |
| 94 | 93 | ||
| 95 | </LinearLayout> | 94 | </LinearLayout> |
| 96 | 95 | ||
| 97 | <LinearLayout | 96 | <LinearLayout |
| 98 | android:layout_width="wrap_content" | 97 | android:layout_width="wrap_content" |
| 99 | android:layout_height="wrap_content" | 98 | android:layout_height="wrap_content" |
| 100 | android:orientation="horizontal"> | 99 | android:orientation="horizontal"> |
| 101 | 100 | ||
| 102 | <View | 101 | <View |
| 103 | android:layout_width="450dp" | 102 | android:layout_width="450dp" |
| 104 | android:layout_height="0.7dp" | 103 | android:layout_height="0.7dp" |
| 105 | android:layout_marginLeft="150dp" | 104 | android:layout_marginLeft="150dp" |
| 106 | android:background="@color/cutoff_line"> | 105 | android:background="@color/cutoff_line"> |
| 107 | 106 | ||
| 108 | </View> | 107 | </View> |
| 109 | 108 | ||
| 110 | <View | 109 | <View |
| 111 | android:layout_width="450dp" | 110 | android:layout_width="450dp" |
| 112 | android:layout_height="0.7dp" | 111 | android:layout_height="0.7dp" |
| 113 | android:layout_marginLeft="80dp" | 112 | android:layout_marginLeft="80dp" |
| 114 | android:background="@color/cutoff_line"> | 113 | android:background="@color/cutoff_line"> |
| 115 | 114 | ||
| 116 | </View> | 115 | </View> |
| 117 | 116 | ||
| 118 | 117 | ||
| 119 | </LinearLayout> | 118 | </LinearLayout> |
| 120 | 119 | ||
| 121 | <LinearLayout | 120 | <LinearLayout |
| 122 | android:layout_width="match_parent" | 121 | android:layout_width="match_parent" |
| 123 | android:layout_height="wrap_content" | 122 | android:layout_height="wrap_content" |
| 124 | android:layout_marginLeft="200dp" | 123 | android:layout_marginLeft="200dp" |
| 125 | android:gravity="center_vertical" | 124 | android:gravity="center_vertical" |
| 126 | android:orientation="horizontal"> | 125 | android:orientation="horizontal"> |
| 127 | 126 | ||
| 128 | <LinearLayout | 127 | <LinearLayout |
| 129 | android:layout_width="0dp" | 128 | android:layout_width="0dp" |
| 130 | android:layout_height="80dp" | 129 | android:layout_height="80dp" |
| 131 | android:layout_weight="1" | 130 | android:layout_weight="1" |
| 132 | android:gravity="center_vertical"> | 131 | android:gravity="center_vertical"> |
| 133 | 132 | ||
| 134 | <TextView | 133 | <TextView |
| 135 | android:layout_width="wrap_content" | 134 | android:layout_width="wrap_content" |
| 136 | android:layout_height="wrap_content" | 135 | android:layout_height="wrap_content" |
| 137 | android:text="性别" | 136 | android:text="性别" |
| 138 | android:textSize="22sp" /> | 137 | android:textSize="22sp" /> |
| 139 | 138 | ||
| 140 | <TextView | 139 | <TextView |
| 141 | android:id="@+id/tv_sex" | 140 | android:id="@+id/tv_sex" |
| 142 | android:layout_width="wrap_content" | 141 | android:layout_width="wrap_content" |
| 143 | android:layout_height="wrap_content" | 142 | android:layout_height="wrap_content" |
| 144 | android:layout_marginLeft="50dp" | 143 | android:layout_marginLeft="50dp" |
| 145 | android:hint="请选择" | 144 | android:hint="请选择" |
| 146 | android:textSize="22sp" /> | 145 | android:textSize="22sp" /> |
| 147 | 146 | ||
| 148 | <ImageView | 147 | <ImageView |
| 149 | android:layout_width="wrap_content" | 148 | android:layout_width="wrap_content" |
| 150 | android:layout_height="wrap_content" | 149 | android:layout_height="wrap_content" |
| 151 | android:layout_marginLeft="150dp" | 150 | android:layout_marginLeft="150dp" |
| 152 | android:src="@mipmap/xiajiantou"> | 151 | android:src="@mipmap/xiajiantou"> |
| 153 | 152 | ||
| 154 | </ImageView> | 153 | </ImageView> |
| 155 | 154 | ||
| 156 | 155 | ||
| 157 | </LinearLayout> | 156 | </LinearLayout> |
| 158 | 157 | ||
| 159 | <LinearLayout | 158 | <LinearLayout |
| 160 | android:layout_width="0dp" | 159 | android:layout_width="0dp" |
| 161 | android:layout_height="80dp" | 160 | android:layout_height="80dp" |
| 162 | android:layout_weight="1" | 161 | android:layout_weight="1" |
| 163 | android:gravity="center_vertical"> | 162 | android:gravity="center_vertical"> |
| 164 | 163 | ||
| 165 | <TextView | 164 | <TextView |
| 166 | android:layout_width="wrap_content" | 165 | android:layout_width="wrap_content" |
| 167 | android:layout_height="wrap_content" | 166 | android:layout_height="wrap_content" |
| 168 | android:text=" " | 167 | android:text=" " |
| 169 | android:textColor="@color/white" | 168 | android:textColor="@color/white" |
| 170 | android:textSize="22sp" /> | 169 | android:textSize="22sp" /> |
| 171 | 170 | ||
| 172 | <EditText | 171 | <EditText |
| 173 | android:id="@+id/tv_useinfo_adress1" | 172 | android:id="@+id/tv_useinfo_adress1" |
| 174 | android:layout_width="wrap_content" | 173 | android:layout_width="wrap_content" |
| 175 | android:layout_height="wrap_content" | 174 | android:layout_height="wrap_content" |
| 176 | android:layout_marginLeft="50dp" | 175 | android:layout_marginLeft="50dp" |
| 176 | android:textColor="@color/electronic_text" | ||
| 177 | android:background="@null" | 177 | android:background="@null" |
| 178 | android:hint="请输入详细地址" | 178 | android:hint="请输入详细地址" |
| 179 | android:textSize="22sp" /> | 179 | android:textSize="22sp" /> |
| 180 | 180 | ||
| 181 | </LinearLayout> | 181 | </LinearLayout> |
| 182 | 182 | ||
| 183 | </LinearLayout> | 183 | </LinearLayout> |
| 184 | 184 | ||
| 185 | <LinearLayout | 185 | <LinearLayout |
| 186 | android:layout_width="wrap_content" | 186 | android:layout_width="wrap_content" |
| 187 | android:layout_height="wrap_content" | 187 | android:layout_height="wrap_content" |
| 188 | 188 | ||
| 189 | android:orientation="horizontal"> | 189 | android:orientation="horizontal"> |
| 190 | 190 | ||
| 191 | <View | 191 | <View |
| 192 | android:layout_width="450dp" | 192 | android:layout_width="450dp" |
| 193 | android:layout_height="0.7dp" | 193 | android:layout_height="0.7dp" |
| 194 | android:layout_marginLeft="150dp" | 194 | android:layout_marginLeft="150dp" |
| 195 | android:background="@color/cutoff_line"> | 195 | android:background="@color/cutoff_line"> |
| 196 | 196 | ||
| 197 | </View> | 197 | </View> |
| 198 | 198 | ||
| 199 | <View | 199 | <View |
| 200 | android:layout_width="450dp" | 200 | android:layout_width="450dp" |
| 201 | android:layout_height="0.7dp" | 201 | android:layout_height="0.7dp" |
| 202 | android:layout_marginLeft="80dp" | 202 | android:layout_marginLeft="80dp" |
| 203 | android:background="@color/cutoff_line"> | 203 | android:background="@color/cutoff_line"> |
| 204 | 204 | ||
| 205 | </View> | 205 | </View> |
| 206 | 206 | ||
| 207 | 207 | ||
| 208 | </LinearLayout> | 208 | </LinearLayout> |
| 209 | 209 | ||
| 210 | <LinearLayout | 210 | <LinearLayout |
| 211 | android:layout_width="match_parent" | 211 | android:layout_width="match_parent" |
| 212 | android:layout_height="wrap_content" | 212 | android:layout_height="wrap_content" |
| 213 | android:layout_marginLeft="200dp" | 213 | android:layout_marginLeft="200dp" |
| 214 | android:gravity="center_vertical" | 214 | android:gravity="center_vertical" |
| 215 | android:orientation="horizontal"> | 215 | android:orientation="horizontal"> |
| 216 | 216 | ||
| 217 | 217 | ||
| 218 | <LinearLayout | 218 | <LinearLayout |
| 219 | android:layout_width="0dp" | 219 | android:layout_width="0dp" |
| 220 | android:layout_height="80dp" | 220 | android:layout_height="80dp" |
| 221 | android:layout_weight="1" | 221 | android:layout_weight="1" |
| 222 | android:gravity="center_vertical"> | 222 | android:gravity="center_vertical"> |
| 223 | 223 | ||
| 224 | <TextView | 224 | <TextView |
| 225 | android:layout_width="wrap_content" | 225 | android:layout_width="wrap_content" |
| 226 | android:layout_height="wrap_content" | 226 | android:layout_height="wrap_content" |
| 227 | android:text="生日" | 227 | android:text="生日" |
| 228 | android:textSize="22sp" /> | 228 | android:textSize="22sp" /> |
| 229 | 229 | ||
| 230 | <TextView | 230 | <TextView |
| 231 | android:id="@+id/tv_useinfo_birthday" | 231 | android:id="@+id/tv_useinfo_birthday" |
| 232 | android:layout_width="wrap_content" | 232 | android:layout_width="wrap_content" |
| 233 | android:layout_height="wrap_content" | 233 | android:layout_height="wrap_content" |
| 234 | android:layout_marginLeft="50dp" | 234 | android:layout_marginLeft="50dp" |
| 235 | android:hint="请选择" | 235 | android:hint="请选择" |
| 236 | android:textSize="22sp" /> | 236 | android:textSize="22sp" /> |
| 237 | 237 | ||
| 238 | <ImageView | 238 | <ImageView |
| 239 | android:layout_width="wrap_content" | 239 | android:layout_width="wrap_content" |
| 240 | android:layout_height="wrap_content" | 240 | android:layout_height="wrap_content" |
| 241 | android:layout_marginLeft="150dp" | 241 | android:layout_marginLeft="150dp" |
| 242 | android:src="@mipmap/xiajiantou"/> | 242 | android:src="@mipmap/xiajiantou"/> |
| 243 | </LinearLayout> | 243 | </LinearLayout> |
| 244 | <LinearLayout | 244 | <LinearLayout |
| 245 | android:layout_width="0dp" | 245 | android:layout_width="0dp" |
| 246 | android:layout_height="80dp" | 246 | android:layout_height="80dp" |
| 247 | android:layout_weight="1" | 247 | android:layout_weight="1" |
| 248 | android:gravity="center_vertical"> | 248 | android:gravity="center_vertical"> |
| 249 | 249 | ||
| 250 | <TextView | 250 | <TextView |
| 251 | android:layout_width="wrap_content" | 251 | android:layout_width="wrap_content" |
| 252 | android:layout_height="wrap_content" | 252 | android:layout_height="wrap_content" |
| 253 | android:text="年级" | 253 | android:text="年级" |
| 254 | android:textSize="22sp" /> | 254 | android:textSize="22sp" /> |
| 255 | 255 | ||
| 256 | <TextView | 256 | <TextView |
| 257 | android:id="@+id/tv_useinfo_gender" | 257 | android:id="@+id/tv_useinfo_gender" |
| 258 | android:layout_width="wrap_content" | 258 | android:layout_width="wrap_content" |
| 259 | android:layout_height="wrap_content" | 259 | android:layout_height="wrap_content" |
| 260 | android:layout_marginLeft="50dp" | 260 | android:layout_marginLeft="50dp" |
| 261 | android:hint="请选择" | 261 | android:hint="请选择" |
| 262 | android:textSize="22sp" /> | 262 | android:textSize="22sp" /> |
| 263 | 263 | ||
| 264 | <ImageView | 264 | <ImageView |
| 265 | android:layout_width="wrap_content" | 265 | android:layout_width="wrap_content" |
| 266 | android:layout_height="wrap_content" | 266 | android:layout_height="wrap_content" |
| 267 | android:layout_marginLeft="150dp" | 267 | android:layout_marginLeft="150dp" |
| 268 | android:src="@mipmap/xiajiantou"/> | 268 | android:src="@mipmap/xiajiantou"/> |
| 269 | </LinearLayout> | 269 | </LinearLayout> |
| 270 | 270 | ||
| 271 | </LinearLayout> | 271 | </LinearLayout> |
| 272 | 272 | ||
| 273 | <LinearLayout | 273 | <LinearLayout |
| 274 | android:layout_width="wrap_content" | 274 | android:layout_width="wrap_content" |
| 275 | android:layout_height="wrap_content" | 275 | android:layout_height="wrap_content" |
| 276 | 276 | ||
| 277 | android:orientation="horizontal"> | 277 | android:orientation="horizontal"> |
| 278 | 278 | ||
| 279 | <View | 279 | <View |
| 280 | android:layout_width="450dp" | 280 | android:layout_width="450dp" |
| 281 | android:layout_height="0.7dp" | 281 | android:layout_height="0.7dp" |
| 282 | android:layout_marginLeft="150dp" | 282 | android:layout_marginLeft="150dp" |
| 283 | android:background="@color/cutoff_line"> | 283 | android:background="@color/cutoff_line"> |
| 284 | 284 | ||
| 285 | </View> | 285 | </View> |
| 286 | 286 | ||
| 287 | <View | 287 | <View |
| 288 | android:layout_width="450dp" | 288 | android:layout_width="450dp" |
| 289 | android:layout_height="0.7dp" | 289 | android:layout_height="0.7dp" |
| 290 | android:layout_marginLeft="80dp" | 290 | android:layout_marginLeft="80dp" |
| 291 | android:background="@color/cutoff_line"> | 291 | android:background="@color/cutoff_line"> |
| 292 | 292 | ||
| 293 | </View> | 293 | </View> |
| 294 | 294 | ||
| 295 | 295 | ||
| 296 | </LinearLayout> | 296 | </LinearLayout> |
| 297 | 297 | ||
| 298 | <LinearLayout | 298 | <LinearLayout |
| 299 | android:layout_width="match_parent" | 299 | android:layout_width="match_parent" |
| 300 | android:layout_height="wrap_content" | 300 | android:layout_height="wrap_content" |
| 301 | android:layout_marginLeft="200dp" | 301 | android:layout_marginLeft="200dp" |
| 302 | android:gravity="center_vertical" | 302 | android:gravity="center_vertical" |
| 303 | android:orientation="horizontal"> | 303 | android:orientation="horizontal"> |
| 304 | 304 | ||
| 305 | <LinearLayout | 305 | <LinearLayout |
| 306 | android:id="@+id/lineL_buy_time" | 306 | android:id="@+id/lineL_buy_time" |
| 307 | android:layout_width="0dp" | 307 | android:layout_width="0dp" |
| 308 | android:layout_height="80dp" | 308 | android:layout_height="80dp" |
| 309 | android:layout_weight="1" | 309 | android:layout_weight="1" |
| 310 | android:gravity="center_vertical"> | 310 | android:gravity="center_vertical"> |
| 311 | 311 | ||
| 312 | <TextView | 312 | <TextView |
| 313 | android:layout_width="wrap_content" | 313 | android:layout_width="wrap_content" |
| 314 | android:layout_height="wrap_content" | 314 | android:layout_height="wrap_content" |
| 315 | android:text="Q Q" | 315 | android:text="Q Q" |
| 316 | android:textSize="22sp" /> | 316 | android:textSize="22sp" /> |
| 317 | 317 | ||
| 318 | <EditText | 318 | <EditText |
| 319 | android:id="@+id/tv_useinfo_qq" | 319 | android:id="@+id/tv_useinfo_qq" |
| 320 | android:layout_width="wrap_content" | 320 | android:layout_width="wrap_content" |
| 321 | android:layout_height="wrap_content" | 321 | android:layout_height="wrap_content" |
| 322 | android:layout_marginLeft="50dp" | 322 | android:layout_marginLeft="50dp" |
| 323 | android:background="@null" | 323 | android:background="@null" |
| 324 | android:textColor="@color/electronic_text" | ||
| 324 | android:hint="请输入" | 325 | android:hint="请输入" |
| 325 | android:textSize="22sp" /> | 326 | android:textSize="22sp" /> |
| 326 | 327 | ||
| 327 | </LinearLayout> | 328 | </LinearLayout> |
| 328 | 329 | ||
| 329 | <LinearLayout | 330 | <LinearLayout |
| 330 | android:layout_width="0dp" | 331 | android:layout_width="0dp" |
| 331 | android:layout_height="80dp" | 332 | android:layout_height="80dp" |
| 332 | android:layout_weight="1" | 333 | android:layout_weight="1" |
| 333 | 334 | ||
| 334 | android:gravity="center_vertical"> | 335 | android:gravity="center_vertical"> |
| 335 | 336 | ||
| 336 | <TextView | 337 | <TextView |
| 337 | android:layout_width="wrap_content" | 338 | android:layout_width="wrap_content" |
| 338 | android:layout_height="wrap_content" | 339 | android:layout_height="wrap_content" |
| 339 | android:text="学校" | 340 | android:text="学校" |
| 340 | android:textSize="22sp" /> | 341 | android:textSize="22sp" /> |
| 341 | 342 | ||
| 342 | <TextView | 343 | <TextView |
| 343 | android:id="@+id/tv_useinfo_school" | 344 | android:id="@+id/tv_useinfo_school" |
| 344 | android:layout_width="wrap_content" | 345 | android:layout_width="wrap_content" |
| 345 | android:layout_height="wrap_content" | 346 | android:layout_height="wrap_content" |
| 346 | android:layout_marginLeft="50dp" | 347 | android:layout_marginLeft="50dp" |
| 347 | android:hint="请选择" | 348 | android:hint="请选择" |
| 348 | android:textColor="@color/btn_text_color" | ||
| 349 | android:textSize="22sp" /> | 349 | android:textSize="22sp" /> |
| 350 | 350 | ||
| 351 | <ImageView | 351 | <ImageView |
| 352 | android:layout_width="wrap_content" | 352 | android:layout_width="wrap_content" |
| 353 | android:layout_height="wrap_content" | 353 | android:layout_height="wrap_content" |
| 354 | android:layout_marginLeft="150dp" | 354 | android:layout_marginLeft="150dp" |
| 355 | android:src="@mipmap/xiajiantou"> | 355 | android:src="@mipmap/xiajiantou"> |
| 356 | 356 | ||
| 357 | </ImageView> | 357 | </ImageView> |
| 358 | </LinearLayout> | 358 | </LinearLayout> |
| 359 | 359 | ||
| 360 | </LinearLayout> | 360 | </LinearLayout> |
| 361 | 361 | ||
| 362 | <LinearLayout | 362 | <LinearLayout |
| 363 | android:layout_width="wrap_content" | 363 | android:layout_width="wrap_content" |
| 364 | android:layout_height="wrap_content" | 364 | android:layout_height="wrap_content" |
| 365 | android:orientation="horizontal"> | 365 | android:orientation="horizontal"> |
| 366 | 366 | ||
| 367 | <View | 367 | <View |
| 368 | android:layout_width="450dp" | 368 | android:layout_width="450dp" |
| 369 | android:layout_height="0.7dp" | 369 | android:layout_height="0.7dp" |
| 370 | android:layout_marginLeft="150dp" | 370 | android:layout_marginLeft="150dp" |
| 371 | android:background="@color/cutoff_line"> | 371 | android:background="@color/cutoff_line"> |
| 372 | 372 | ||
| 373 | </View> | 373 | </View> |
| 374 | 374 | ||
| 375 | <View | 375 | <View |
| 376 | android:layout_width="450dp" | 376 | android:layout_width="450dp" |
| 377 | android:layout_height="0.7dp" | 377 | android:layout_height="0.7dp" |
| 378 | android:layout_marginLeft="80dp" | 378 | android:layout_marginLeft="80dp" |
| 379 | android:background="@color/cutoff_line"> | 379 | android:background="@color/cutoff_line"> |
| 380 | 380 | ||
| 381 | </View> | 381 | </View> |
| 382 | 382 | ||
| 383 | 383 |
PersonalCenter/app/src/test/java/com/hjx/personalcenter/ExampleUnitTest.java
| 1 | package com.hjx.personalcenter; | 1 | package com.hjx.personalcenter; |
| 2 | 2 | ||
| 3 | import org.junit.Test; | 3 | import org.junit.Test; |
| 4 | 4 | ||
| 5 | import java.util.Timer; | 5 | import java.util.Timer; |
| 6 | import java.util.TimerTask; | 6 | import java.util.TimerTask; |
| 7 | 7 | ||
| 8 | import static org.junit.Assert.*; | 8 | import static org.junit.Assert.*; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| 11 | * Example local unit test, which will execute on the development machine (host). | 11 | * Example local unit test, which will execute on the development machine (host). |
| 12 | * | 12 | * |
| 13 | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | 13 | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
| 14 | */ | 14 | */ |
| 15 | public class ExampleUnitTest { | 15 | public class ExampleUnitTest { |
| 16 | @Test | 16 | @Test |
| 17 | public void addition_isCorrect() throws Exception { | 17 | public void addition_isCorrect() throws Exception { |
| 18 | // assertEquals(4, 2 + 2); | 18 | assertEquals(4, 2 + 2); |
| 19 | Timer timer = new Timer(); | 19 | Timer timer = new Timer(); |
| 20 | timer.schedule(new TimerTask() { | 20 | timer.schedule(new TimerTask() { |
| 21 | @Override | 21 | @Override |
| 22 | public void run() { | 22 | public void run() { |
| 23 | System.out.print("爆炸"); | 23 | System.out.print("爆炸"); |
| 24 | } | 24 | } |
| 25 | }, 60 * 1000, 1000); | 25 | }, 60 * 1000, 1000); |
| 26 | } | 26 | } |
| 27 | } | 27 | } |