Commit e93f210b0a757e5c10e6595fd72a2578e3dc2c79
1 parent
78458fa9f2
Exists in
master
个人信息获取,头像和拍照
Showing
26 changed files
with
859 additions
and
214 deletions
Show diff stats
PersonalCenter/.idea/misc.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project version="4"> | 2 | <project version="4"> |
| 3 | <component name="EntryPointsManager"> | 3 | <component name="EntryPointsManager"> |
| 4 | <entry_points version="2.0" /> | 4 | <entry_points version="2.0" /> |
| 5 | </component> | 5 | </component> |
| 6 | <component name="NullableNotNullManager"> | 6 | <component name="NullableNotNullManager"> |
| 7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> | 7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> |
| 8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> | 8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> |
| 9 | <option name="myNullables"> | 9 | <option name="myNullables"> |
| 10 | <value> | 10 | <value> |
| 11 | <list size="4"> | 11 | <list size="4"> |
| 12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | 12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> |
| 13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | 13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> |
| 14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | 14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> |
| 15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | 15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> |
| 16 | </list> | 16 | </list> |
| 17 | </value> | 17 | </value> |
| 18 | </option> | 18 | </option> |
| 19 | <option name="myNotNulls"> | 19 | <option name="myNotNulls"> |
| 20 | <value> | 20 | <value> |
| 21 | <list size="4"> | 21 | <list size="4"> |
| 22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | 22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> |
| 23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | 23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> |
| 24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | 24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> |
| 25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | 25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> |
| 26 | </list> | 26 | </list> |
| 27 | </value> | 27 | </value> |
| 28 | </option> | 28 | </option> |
| 29 | </component> | 29 | </component> |
| 30 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> | 30 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> |
| 31 | <OptionsSetting value="true" id="Add" /> | 31 | <OptionsSetting value="true" id="Add" /> |
| 32 | <OptionsSetting value="true" id="Remove" /> | 32 | <OptionsSetting value="true" id="Remove" /> |
| 33 | <OptionsSetting value="true" id="Checkout" /> | 33 | <OptionsSetting value="true" id="Checkout" /> |
| 34 | <OptionsSetting value="true" id="Update" /> | 34 | <OptionsSetting value="true" id="Update" /> |
| 35 | <OptionsSetting value="true" id="Status" /> | 35 | <OptionsSetting value="true" id="Status" /> |
| 36 | <OptionsSetting value="true" id="Edit" /> | 36 | <OptionsSetting value="true" id="Edit" /> |
| 37 | <ConfirmationsSetting value="0" id="Add" /> | 37 | <ConfirmationsSetting value="0" id="Add" /> |
| 38 | <ConfirmationsSetting value="0" id="Remove" /> | 38 | <ConfirmationsSetting value="0" id="Remove" /> |
| 39 | </component> | 39 | </component> |
| 40 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 40 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
| 41 | <output url="file://$PROJECT_DIR$/build/classes" /> | 41 | <output url="file://$PROJECT_DIR$/build/classes" /> |
| 42 | </component> | 42 | </component> |
| 43 | <component name="ProjectType"> | 43 | <component name="ProjectType"> |
| 44 | <option name="id" value="Android" /> | 44 | <option name="id" value="Android" /> |
| 45 | </component> | 45 | </component> |
| 46 | </project> | 46 | </project> |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangePresonalInfoActivity.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.support.v4.app.Fragment; | 4 | import android.support.v4.app.Fragment; |
| 5 | import android.support.v4.view.ViewPager; | 5 | import android.support.v4.view.ViewPager; |
| 6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v7.app.AppCompatActivity; |
| 7 | import android.widget.TextView; | ||
| 7 | 8 | ||
| 8 | import com.hjx.personalcenter.R; | 9 | import com.hjx.personalcenter.R; |
| 9 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; | 10 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; |
| 10 | import com.hjx.personalcenter.fragment.PresonInfoFragment; | 11 | import com.hjx.personalcenter.fragment.PresonInfoFragment; |
| 11 | import com.hjx.personalcenter.fragment.VersionsInfoFragment; | 12 | import com.hjx.personalcenter.fragment.VersionsInfoFragment; |
| 12 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; | 13 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; |
| 13 | 14 | ||
| 14 | import java.util.ArrayList; | 15 | import java.util.ArrayList; |
| 15 | import java.util.Arrays; | 16 | import java.util.Arrays; |
| 16 | import java.util.List; | 17 | import java.util.List; |
| 17 | 18 | ||
| 18 | /** | 19 | /** |
| 19 | * Created by h on 2017/8/12. | 20 | * Created by h on 2017/8/12. |
| 20 | */ | 21 | */ |
| 21 | 22 | ||
| 22 | public class ChangePresonalInfoActivity extends AppCompatActivity { | 23 | public class ChangePresonalInfoActivity extends AppCompatActivity { |
| 23 | private ViewPager viewPager; | 24 | private ViewPager viewPager; |
| 24 | private SlidingTabLayout tableLayout; | 25 | private SlidingTabLayout tableLayout; |
| 26 | private TextView subsave; | ||
| 25 | private List<Fragment> presoninfo; | 27 | private List<Fragment> presoninfo; |
| 26 | private LoginAndRegisterAdapter presoninfodapter; | 28 | private LoginAndRegisterAdapter presoninfodapter; |
| 27 | private List<String> title = Arrays.asList("个人信息", "版本信息"); | 29 | private List<String> title = Arrays.asList("个人信息", "版本信息"); |
| 28 | @Override | 30 | @Override |
| 29 | protected void onCreate(Bundle savedInstanceState) { | 31 | protected void onCreate(Bundle savedInstanceState) { |
| 30 | super.onCreate(savedInstanceState); | 32 | super.onCreate(savedInstanceState); |
| 31 | setContentView(R.layout.activity_change_preson_info); | 33 | setContentView(R.layout.activity_change_preson_info); |
| 32 | initView(); | 34 | initView(); |
| 33 | initData(); | 35 | initData(); |
| 34 | setLister(); | 36 | setLister(); |
| 35 | 37 | ||
| 36 | } | 38 | } |
| 37 | private void initView() { | 39 | private void initView() { |
| 38 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); | 40 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); |
| 39 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); | 41 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); |
| 42 | subsave = (TextView) findViewById(R.id.presonal_sub); | ||
| 40 | } | 43 | } |
| 41 | 44 | ||
| 42 | private void initData() { | 45 | private void initData() { |
| 43 | presoninfo = new ArrayList<>(); | 46 | presoninfo = new ArrayList<>(); |
| 44 | for (int i = 0; i < title.size(); i++) { | 47 | for (int i = 0; i < title.size(); i++) { |
| 45 | if (title.get(i).equals("个人信息")) { | 48 | if (title.get(i).equals("个人信息")) { |
| 46 | presoninfo.add(PresonInfoFragment.newInstance(i + 1)); | 49 | presoninfo.add(PresonInfoFragment.newInstance(i + 1)); |
| 47 | } else { | 50 | } else { |
| 48 | presoninfo.add(VersionsInfoFragment.newInstance(i + 1)); | 51 | presoninfo.add(VersionsInfoFragment.newInstance(i + 1)); |
| 49 | } | 52 | } |
| 50 | } | 53 | } |
| 51 | 54 | ||
| 52 | 55 | ||
| 53 | //设置Tab上的标题 | 56 | //设置Tab上的标题 |
| 54 | tableLayout.setData(title); | 57 | tableLayout.setData(title); |
| 55 | //设置关联的ViewPager | 58 | //设置关联的ViewPager |
| 56 | tableLayout.setViewPager(viewPager, 0); | 59 | tableLayout.setViewPager(viewPager, 0); |
| 57 | presoninfodapter = new LoginAndRegisterAdapter(presoninfo, getSupportFragmentManager()); | 60 | presoninfodapter = new LoginAndRegisterAdapter(presoninfo, getSupportFragmentManager()); |
| 58 | //给ViewPager设置适配器 | 61 | //给ViewPager设置适配器 |
| 59 | viewPager.setAdapter(presoninfodapter); | 62 | viewPager.setAdapter(presoninfodapter); |
| 60 | //设置滑动时数据不丢失 | 63 | //设置滑动时数据不丢失 |
| 61 | viewPager.setOffscreenPageLimit(1); | 64 | viewPager.setOffscreenPageLimit(1); |
| 62 | //将TabLayout和ViewPager关联起来。 | 65 | //将TabLayout和ViewPager关联起来。 |
| 63 | } | 66 | } |
| 64 | 67 | ||
| 65 | private void setLister() { | 68 | private void setLister() { |
| 66 | } | 69 | } |
| 67 | 70 | ||
| 68 | } | 71 | } |
| 69 | 72 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardLookInfoActivity.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.ImageView; | 9 | import android.widget.ImageView; |
| 10 | import android.widget.TextView; | 10 | import android.widget.TextView; |
| 11 | 11 | ||
| 12 | import com.hjx.personalcenter.R; | 12 | import com.hjx.personalcenter.R; |
| 13 | import com.hjx.personalcenter.db.Content; | 13 | import com.hjx.personalcenter.db.Content; |
| 14 | import com.hjx.personalcenter.db.SaveParam; | 14 | import com.hjx.personalcenter.db.SaveParam; |
| 15 | import com.hjx.personalcenter.http.HttpCode; | 15 | import com.hjx.personalcenter.http.HttpCode; |
| 16 | import com.hjx.personalcenter.http.HttpManager; | 16 | import com.hjx.personalcenter.http.HttpManager; |
| 17 | import com.hjx.personalcenter.model.CardInfo; | 17 | import com.hjx.personalcenter.model.CardInfo; |
| 18 | import com.hjx.personalcenter.util.AlertUtils; | 18 | import com.hjx.personalcenter.util.AlertUtils; |
| 19 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
| 20 | 19 | ||
| 21 | import org.json.JSONException; | 20 | import java.util.ArrayList; |
| 22 | import org.json.JSONObject; | ||
| 23 | 21 | ||
| 24 | /** | 22 | /** |
| 25 | * Created by h on 2017/8/11. | 23 | * Created by h on 2017/8/11. |
| 26 | */ | 24 | */ |
| 27 | 25 | ||
| 28 | public class ElectronicCardLookInfoActivity extends AppCompatActivity implements View.OnClickListener{ | 26 | public class ElectronicCardLookInfoActivity extends AppCompatActivity implements View.OnClickListener{ |
| 29 | private ImageView iv_last_step; | 27 | private ImageView iv_last_step; |
| 30 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber, | 28 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber, |
| 31 | shopadress,phone,tlePhone,tv_card_adress_change,tv_card_phone_change; | 29 | shopadress,phone,tlePhone,tv_card_adress_change,tv_card_phone_change; |
| 30 | private ArrayList<CardInfo.DataBean> data = new ArrayList<>(); | ||
| 32 | 31 | ||
| 33 | Handler handler = new Handler(){ | 32 | Handler handler = new Handler(){ |
| 34 | @Override | 33 | @Override |
| 35 | public void handleMessage(Message msg) { | 34 | public void handleMessage(Message msg) { |
| 36 | super.handleMessage(msg); | 35 | super.handleMessage(msg); |
| 37 | JSONObject jsonObject; | ||
| 38 | String status; | ||
| 39 | switch (msg.what){ | 36 | switch (msg.what){ |
| 40 | 37 | ||
| 41 | case HttpCode.SUCHCARDINFO: | 38 | case HttpCode.SUCHCARDINFO: |
| 42 | CardInfo cardInfo = new CardInfo(); | ||
| 43 | try { | ||
| 44 | jsonObject = new JSONObject( (String) msg.obj); | ||
| 45 | status = jsonObject.optString("status"); | ||
| 46 | if (status.equals("1")){ | ||
| 47 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"显示电子保卡信息"); | 39 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"显示电子保卡信息"); |
| 48 | cardInfo.setCustomerName(jsonObject.optString("customerName")); | 40 | CardInfo.DataBean cardinfoBean =(CardInfo.DataBean)msg.obj; |
| 41 | //获取设备信息 | ||
| 42 | deviceModel.setText(cardinfoBean.getProductModel()); | ||
| 43 | deviceNumber.setText(cardinfoBean.getDeviceNumber()); | ||
| 44 | mac_adress.setText(cardinfoBean.getMacAddress()); | ||
| 45 | //获取保卡信息 | ||
| 46 | usename.setText(cardinfoBean.getCustomerName()); | ||
| 47 | customer_address.setText(cardinfoBean.getCustomerAddress()); | ||
| 48 | shoptime.setText(cardinfoBean.getBuyTime()); | ||
| 49 | shopadress.setText(cardinfoBean.getBuyAddress()); | ||
| 50 | tlePhone.setText(cardinfoBean.getAlterSaleCall()); | ||
| 51 | phone.setText(cardinfoBean.getMobilePhone()); | ||
| 49 | 52 | ||
| 50 | }else { | ||
| 51 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"保卡信息查询失败"); | ||
| 52 | } | ||
| 53 | |||
| 54 | } catch (JSONException e) { | ||
| 55 | e.printStackTrace(); | ||
| 56 | } | ||
| 57 | 53 | ||
| 58 | break; | 54 | break; |
| 59 | 55 | ||
| 60 | } | 56 | } |
| 61 | 57 | ||
| 62 | } | 58 | } |
| 63 | }; | 59 | }; |
| 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 | setContentView(R.layout.activity_electronic_look_cardinfo); | 64 | setContentView(R.layout.activity_electronic_look_cardinfo); |
| 69 | initView(); | 65 | initView(); |
| 70 | initData(); | 66 | initData(); |
| 71 | initLister(); | 67 | initLister(); |
| 72 | } | 68 | } |
| 73 | private void initView() { | 69 | private void initView() { |
| 74 | usename = (TextView) findViewById(R.id.iv_card_username); | 70 | usename = (TextView) findViewById(R.id.iv_card_username); |
| 75 | iv_last_step = (ImageView) findViewById(R.id.cancel); | 71 | iv_last_step = (ImageView) findViewById(R.id.cancel); |
| 76 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 72 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
| 77 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 73 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
| 78 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 74 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
| 79 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 75 | shoptime = (TextView) findViewById(R.id.tv_card_time); |
| 80 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 76 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
| 81 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 77 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
| 82 | phone = (TextView) findViewById(R.id.tv_card_phone); | 78 | phone = (TextView) findViewById(R.id.tv_card_phone); |
| 83 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 79 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
| 84 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); | 80 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); |
| 85 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); | 81 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); |
| 86 | } | 82 | } |
| 87 | private void initData() { | 83 | private void initData() { |
| 88 | HttpManager.getInstance().getcardinfo(this,736,handler); | 84 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
| 89 | //获取设备信息 | 85 | try { |
| 90 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 86 | int a = Integer.parseInt(userID); |
| 91 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 87 | HttpManager.getInstance().getcardinfo(this,a,handler); |
| 92 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 88 | } catch (NumberFormatException e) { |
| 93 | //获取保卡信息 | 89 | e.printStackTrace(); |
| 94 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | 90 | } |
| 95 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | 91 | |
| 96 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | 92 | // //获取设备信息 |
| 97 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | 93 | // deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
| 98 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | 94 | // deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
| 99 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | 95 | // mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
| 96 | // //获取保卡信息 | ||
| 97 | // usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | ||
| 98 | // customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | ||
| 99 | // shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | ||
| 100 | // shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | ||
| 101 | // tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | ||
| 102 | // phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | ||
| 100 | 103 | ||
| 101 | 104 | ||
| 102 | } | 105 | } |
| 103 | private void initLister() { | 106 | private void initLister() { |
| 104 | tv_card_adress_change.setOnClickListener(this); | 107 | tv_card_adress_change.setOnClickListener(this); |
| 105 | tv_card_phone_change.setOnClickListener(this); | 108 | tv_card_phone_change.setOnClickListener(this); |
| 106 | iv_last_step.setOnClickListener(this); | 109 | iv_last_step.setOnClickListener(this); |
| 107 | } | 110 | } |
| 108 | @Override | 111 | @Override |
| 109 | public void onClick(View v) { | 112 | public void onClick(View v) { |
| 110 | switch (v.getId()){ | 113 | switch (v.getId()){ |
| 111 | case R.id.tv_card_adress_change: | 114 | case R.id.tv_card_adress_change: |
| 112 | Intent intent = new Intent(); | 115 | Intent intent = new Intent(); |
| 113 | intent.setClass(this,ChangeElectronicCardAdressInfoActivity.class); | 116 | intent.setClass(this,ChangeElectronicCardAdressInfoActivity.class); |
| 114 | startActivity(intent); | 117 | startActivity(intent); |
| 115 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 118 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 116 | 119 | ||
| 117 | break; | 120 | break; |
| 118 | case R.id.tv_card_phone_change: | 121 | case R.id.tv_card_phone_change: |
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; | ||
| 6 | import android.net.Uri; | ||
| 7 | import android.os.Build; | ||
| 5 | import android.os.Bundle; | 8 | import android.os.Bundle; |
| 9 | import android.provider.MediaStore; | ||
| 10 | import android.support.annotation.NonNull; | ||
| 11 | import android.support.v4.content.FileProvider; | ||
| 6 | import android.support.v7.app.AppCompatActivity; | 12 | import android.support.v7.app.AppCompatActivity; |
| 7 | import android.view.LayoutInflater; | ||
| 8 | import android.view.View; | 13 | import android.view.View; |
| 9 | import android.view.ViewGroup; | ||
| 10 | import android.widget.ImageView; | 14 | import android.widget.ImageView; |
| 11 | import android.widget.LinearLayout; | 15 | import android.widget.LinearLayout; |
| 12 | import android.widget.TextView; | 16 | import android.widget.TextView; |
| 17 | import android.widget.Toast; | ||
| 13 | 18 | ||
| 19 | import com.facebook.drawee.backends.pipeline.Fresco; | ||
| 20 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | ||
| 21 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | ||
| 22 | import com.facebook.drawee.generic.RoundingParams; | ||
| 23 | import com.facebook.drawee.interfaces.DraweeController; | ||
| 24 | import com.facebook.drawee.view.SimpleDraweeView; | ||
| 14 | import com.hjx.personalcenter.R; | 25 | import com.hjx.personalcenter.R; |
| 15 | import com.hjx.personalcenter.customdialog.HeadDialog; | 26 | import com.hjx.personalcenter.customdialog.HeadDialog; |
| 16 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 27 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 17 | import com.hjx.personalcenter.util.AlertUtils; | 28 | import com.hjx.personalcenter.util.AlertUtils; |
| 29 | import com.hjx.personalcenter.util.CropUtils; | ||
| 30 | import com.hjx.personalcenter.util.DialogPermission; | ||
| 31 | import com.hjx.personalcenter.util.FileUtil; | ||
| 32 | import com.hjx.personalcenter.util.PermissionUtil; | ||
| 33 | import com.hjx.personalcenter.util.SharedPreferenceMark; | ||
| 18 | import com.mylhyl.circledialog.CircleDialog; | 34 | import com.mylhyl.circledialog.CircleDialog; |
| 19 | import com.mylhyl.circledialog.callback.ConfigInput; | 35 | import com.mylhyl.circledialog.callback.ConfigInput; |
| 20 | import com.mylhyl.circledialog.params.InputParams; | 36 | import com.mylhyl.circledialog.params.InputParams; |
| 21 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 37 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
| 22 | import com.zaaach.toprightmenu.MenuItem; | 38 | import com.zaaach.toprightmenu.MenuItem; |
| 23 | import com.zaaach.toprightmenu.TopRightMenu; | 39 | import com.zaaach.toprightmenu.TopRightMenu; |
| 24 | 40 | ||
| 41 | import java.io.File; | ||
| 25 | import java.util.ArrayList; | 42 | import java.util.ArrayList; |
| 26 | import java.util.List; | 43 | import java.util.List; |
| 27 | 44 | ||
| 28 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 45 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
| 29 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_head, iv_sex; | 46 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; |
| 30 | private TextView tv_edit_presoninfo, tv_sign, oktakephone, cancetakephone, | 47 | private TextView tv_edit_presoninfo, tv_sign, |
| 31 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 48 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
| 32 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; | 49 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; |
| 33 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; | 50 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; |
| 34 | private TopRightMenu mTopRightMenu; | 51 | private TopRightMenu mTopRightMenu; |
| 35 | private boolean showIcon = true; | 52 | private boolean showIcon = true; |
| 36 | private boolean dimBg = true; | 53 | private boolean dimBg = true; |
| 37 | private boolean needAnim = true; | 54 | private boolean needAnim = true; |
| 55 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | ||
| 56 | private static final int REQUEST_CODE_ALBUM = 2; | ||
| 57 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | ||
| 58 | SimpleDraweeView mSimpleDraweeView; | ||
| 59 | private File file; | ||
| 60 | private Uri uri; | ||
| 38 | 61 | ||
| 39 | @Override | 62 | @Override |
| 40 | protected void onCreate(Bundle savedInstanceState) { | 63 | protected void onCreate(Bundle savedInstanceState) { |
| 41 | super.onCreate(savedInstanceState); | 64 | super.onCreate(savedInstanceState); |
| 65 | Fresco.initialize(this); | ||
| 42 | setContentView(R.layout.activity_main); | 66 | setContentView(R.layout.activity_main); |
| 43 | initView(); | 67 | initView(); |
| 44 | initData(); | 68 | initData(); |
| 45 | initLister(); | 69 | initLister(); |
| 46 | } | 70 | } |
| 47 | 71 | ||
| 48 | private void initView() { | 72 | private void initView() { |
| 49 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 73 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
| 50 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); | 74 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); |
| 51 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); | 75 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); |
| 52 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 76 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
| 53 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 77 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
| 54 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 78 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
| 55 | //头像 | 79 | //头像 |
| 56 | iv_head = (ImageView) findViewById(R.id.iv_head); | 80 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
| 57 | //初始化个人信息 | 81 | //初始化个人信息 |
| 58 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 82 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
| 59 | tv_username = (TextView) findViewById(R.id.tv_username); | 83 | tv_username = (TextView) findViewById(R.id.tv_username); |
| 60 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 84 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
| 61 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 85 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
| 62 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 86 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
| 63 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 87 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
| 64 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 88 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
| 65 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 89 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
| 66 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 90 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
| 67 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 91 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
| 68 | //跳转其他应用 | 92 | //跳转其他应用 |
| 69 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); | 93 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); |
| 70 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); | 94 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); |
| 71 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); | 95 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); |
| 72 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); | 96 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); |
| 73 | 97 | ||
| 74 | } | 98 | } |
| 75 | 99 | ||
| 76 | private void initData() { | 100 | private void initData() { |
| 77 | //加载个人信息 | 101 | //加载个人信息 |
| 78 | 102 | ||
| 103 | //初始化图片 | ||
| 104 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | ||
| 105 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | ||
| 106 | uri = Uri.fromFile(file); | ||
| 107 | } else { | ||
| 108 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | ||
| 109 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | ||
| 110 | } | ||
| 111 | |||
| 79 | } | 112 | } |
| 80 | 113 | ||
| 81 | private void initLister() { | 114 | private void initLister() { |
| 82 | iv_imformatioan.setOnClickListener(this); | 115 | iv_imformatioan.setOnClickListener(this); |
| 83 | iv_look_card.setOnClickListener(this); | 116 | iv_look_card.setOnClickListener(this); |
| 84 | tv_edit_presoninfo.setOnClickListener(this); | 117 | tv_edit_presoninfo.setOnClickListener(this); |
| 85 | iv_setting.setOnClickListener(this); | 118 | iv_setting.setOnClickListener(this); |
| 86 | iv_sign.setOnClickListener(this); | 119 | iv_sign.setOnClickListener(this); |
| 87 | iv_head.setOnClickListener(this); | 120 | mSimpleDraweeView.setOnClickListener(this); |
| 88 | linel_mycuoti.setOnClickListener(this); | 121 | linel_mycuoti.setOnClickListener(this); |
| 89 | linel_mynote.setOnClickListener(this); | 122 | linel_mynote.setOnClickListener(this); |
| 90 | linel_mycollege.setOnClickListener(this); | 123 | linel_mycollege.setOnClickListener(this); |
| 91 | linel_myclass.setOnClickListener(this); | 124 | linel_myclass.setOnClickListener(this); |
| 92 | 125 | ||
| 93 | } | 126 | } |
| 94 | 127 | ||
| 95 | @Override | 128 | @Override |
| 96 | public void onClick(View v) { | 129 | public void onClick(View v) { |
| 97 | switch (v.getId()) { | 130 | switch (v.getId()) { |
| 98 | case R.id.iv_imformatioan: | 131 | case R.id.iv_imformatioan: |
| 99 | Intent intent = new Intent(); | 132 | Intent intent = new Intent(); |
| 100 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 133 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
| 101 | startActivity(intent); | 134 | startActivity(intent); |
| 102 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 135 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 103 | break; | 136 | break; |
| 104 | case R.id.iv_look_card: | 137 | case R.id.iv_look_card: |
| 105 | Intent lookintent = new Intent(); | 138 | Intent lookintent = new Intent(); |
| 106 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 139 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
| 107 | startActivity(lookintent); | 140 | startActivity(lookintent); |
| 108 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 141 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 109 | break; | 142 | break; |
| 110 | case R.id.tv_edit_presoninfo: | 143 | case R.id.tv_edit_presoninfo: |
| 111 | Intent editintent = new Intent(); | 144 | Intent editintent = new Intent(); |
| 112 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 145 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
| 113 | startActivity(editintent); | 146 | startActivity(editintent); |
| 114 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 147 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 115 | break; | 148 | break; |
| 116 | case R.id.iv_head: | 149 | case R.id.iv_head: |
| 117 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 150 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
| 118 | break; | 151 | break; |
| 119 | case R.id.iv_setting: | 152 | case R.id.iv_setting: |
| 120 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 153 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
| 121 | List<MenuItem> menuItems = new ArrayList<>(); | 154 | List<MenuItem> menuItems = new ArrayList<>(); |
| 122 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 155 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); |
| 123 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 156 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); |
| 124 | mTopRightMenu | 157 | mTopRightMenu |
| 125 | .setHeight(150) //默认高度480 | 158 | .setHeight(150) //默认高度480 |
| 126 | .setWidth(320) //默认宽度wrap_content | 159 | .setWidth(320) //默认宽度wrap_content |
| 127 | .showIcon(showIcon) //显示菜单图标,默认为true | 160 | .showIcon(showIcon) //显示菜单图标,默认为true |
| 128 | .dimBackground(dimBg) //背景变暗,默认为true | 161 | .dimBackground(dimBg) //背景变暗,默认为true |
| 129 | .needAnimationStyle(needAnim) //显示动画,默认为true | 162 | .needAnimationStyle(needAnim) //显示动画,默认为true |
| 130 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 163 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
| 131 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 164 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
| 132 | @Override | 165 | @Override |
| 133 | public void onMenuItemClick(int position) { | 166 | public void onMenuItemClick(int position) { |
| 134 | switch (position) { | 167 | switch (position) { |
| 135 | case 0: | 168 | case 0: |
| 136 | //清除数据 | 169 | //清除数据 |
| 137 | Intent settingintent = new Intent(); | 170 | Intent settingintent = new Intent(); |
| 138 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 171 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 139 | startActivity(settingintent); | 172 | startActivity(settingintent); |
| 140 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 173 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 141 | break; | 174 | break; |
| 142 | case 1: | 175 | case 1: |
| 143 | Intent accontMintent = new Intent(); | 176 | Intent accontMintent = new Intent(); |
| 144 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 177 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
| 145 | startActivity(accontMintent); | 178 | startActivity(accontMintent); |
| 146 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 179 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 147 | break; | 180 | break; |
| 148 | } | 181 | } |
| 149 | } | 182 | } |
| 150 | }) | 183 | }) |
| 151 | .addMenuList(menuItems) | 184 | .addMenuList(menuItems) |
| 152 | .showAsDropDown(iv_setting, -250, 0); | 185 | .showAsDropDown(iv_setting, -250, 0); |
| 153 | break; | 186 | break; |
| 154 | case R.id.iv_sign: | 187 | case R.id.iv_sign: |
| 155 | new CircleDialog.Builder(this) | 188 | new CircleDialog.Builder(this) |
| 156 | .setCanceledOnTouchOutside(false) | 189 | .setCanceledOnTouchOutside(false) |
| 157 | .setCancelable(true) | 190 | .setCancelable(true) |
| 158 | .setTitle("个性签名") | 191 | .setTitle("个性签名") |
| 159 | .setInputHint("请输入个性签名") | 192 | .setInputHint("请输入个性签名") |
| 160 | .setWidth(0.5f) | 193 | .setWidth(0.5f) |
| 161 | .configInput(new ConfigInput() { | 194 | .configInput(new ConfigInput() { |
| 162 | @Override | 195 | @Override |
| 163 | public void onConfig(InputParams params) { | 196 | public void onConfig(InputParams params) { |
| 164 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 197 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
| 165 | } | 198 | } |
| 166 | }) | 199 | }) |
| 167 | .setNegative("取消", null) | 200 | .setNegative("取消", null) |
| 168 | .setPositiveInput("确定", new OnInputClickListener() { | 201 | .setPositiveInput("确定", new OnInputClickListener() { |
| 169 | @Override | 202 | @Override |
| 170 | public void onClick(String text, View v) { | 203 | public void onClick(String text, View v) { |
| 171 | if (text.equals("")) { | 204 | if (text.equals("")) { |
| 172 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 205 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
| 173 | } else { | 206 | } else { |
| 174 | tv_sign.setText(text); | 207 | tv_sign.setText(text); |
| 175 | } | 208 | } |
| 176 | 209 | ||
| 177 | } | 210 | } |
| 178 | }) | 211 | }) |
| 179 | .show(); | 212 | .show(); |
| 180 | break; | 213 | break; |
| 181 | case R.id.linel_mycuoti: | 214 | case R.id.linel_mycuoti: |
| 182 | AlertUtils.showToast(this, "hhahahah "); | 215 | AlertUtils.showToast(this, "hhahahah "); |
| 183 | break; | 216 | break; |
| 184 | case R.id.linel_mynote: | 217 | case R.id.linel_mynote: |
| 185 | AlertUtils.showToast(this, "hhahahah "); | 218 | AlertUtils.showToast(this, "hhahahah "); |
| 186 | break; | 219 | break; |
| 187 | case R.id.linel_mycollege: | 220 | case R.id.linel_mycollege: |
| 188 | AlertUtils.showToast(this, "hhahahah "); | 221 | AlertUtils.showToast(this, "hhahahah "); |
| 189 | break; | 222 | break; |
| 190 | case R.id.linel_myclass: | 223 | case R.id.linel_myclass: |
| 191 | AlertUtils.showToast(this, "hhahahah "); | 224 | AlertUtils.showToast(this, "hhahahah "); |
| 192 | break; | 225 | break; |
| 226 | } | ||
| 227 | |||
| 228 | } | ||
| 229 | //回调头像监听 | ||
| 230 | @Override | ||
| 231 | public void heard(Context context, View v) { | ||
| 232 | switch (v.getId()){ | ||
| 233 | //选择默认图片 | ||
| 193 | case R.id.oktakephone: | 234 | case R.id.oktakephone: |
| 194 | AlertUtils.showToast(this, "hhahahah "); | 235 | AlertUtils.showToast(this, "您选择了默认图片 "); |
| 195 | break; | 236 | break; |
| 196 | case R.id.canceltakephone: | 237 | case R.id.canceltakephone: |
| 197 | AlertUtils.showToast(this, "hhahahah "); | 238 | |
| 239 | break; | ||
| 240 | //拍摄和相册 | ||
| 241 | case R.id.take_pic: | ||
| 242 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | ||
| 243 | uploadAvatarFromPhotoRequest(); | ||
| 244 | } | ||
| 245 | |||
| 246 | break; | ||
| 247 | case R.id.xiangce: | ||
| 248 | uploadAvatarFromAlbumRequest(); | ||
| 198 | break; | 249 | break; |
| 199 | 250 | ||
| 200 | } | 251 | } |
| 201 | 252 | ||
| 202 | } | 253 | } |
| 203 | 254 | ||
| 255 | //照相 | ||
| 256 | private void uploadAvatarFromPhotoRequest() { | ||
| 257 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | ||
| 258 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | ||
| 259 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | ||
| 260 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | ||
| 261 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | ||
| 262 | } | ||
| 263 | |||
| 264 | //选择图库 | ||
| 265 | private void uploadAvatarFromAlbumRequest() { | ||
| 266 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | ||
| 267 | photoPickerIntent.setType("image/*"); | ||
| 268 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | ||
| 269 | } | ||
| 270 | //回掉 | ||
| 204 | @Override | 271 | @Override |
| 205 | public void provinceOnItemClick(Context context, LayoutInflater inflater, ViewGroup container) { | 272 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 206 | View mView = inflater.inflate(R.layout.custom_adilog_lhead, container, false); | 273 | super.onActivityResult(requestCode, resultCode, data); |
| 207 | oktakephone = (TextView) mView.findViewById(R.id.oktakephone); | 274 | if (resultCode != -1) { |
| 208 | cancetakephone = (TextView) mView.findViewById(R.id.canceltakephone); | 275 | return; |
| 209 | oktakephone.setOnClickListener(this); | 276 | } |
| 210 | cancetakephone.setOnClickListener(this); | 277 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
| 278 | Uri newUri; | ||
| 279 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | ||
| 280 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | ||
| 281 | } else { | ||
| 282 | newUri = data.getData(); | ||
| 283 | } | ||
| 284 | if (newUri != null) { | ||
| 285 | startPhotoZoom(newUri); | ||
| 286 | } else { | ||
| 287 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | ||
| 288 | } | ||
| 289 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | ||
| 290 | startPhotoZoom(uri); | ||
| 291 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | ||
| 292 | uploadAvatarFromPhoto(); | ||
| 293 | } | ||
| 294 | } | ||
| 211 | 295 | ||
| 296 | private void uploadAvatarFromPhoto() { | ||
| 297 | compressAndUploadAvatar(file.getPath()); | ||
| 298 | |||
| 299 | } | ||
| 300 | private void compressAndUploadAvatar(String fileSrc) { | ||
| 301 | |||
| 302 | |||
| 303 | //上传到服务器 | ||
| 304 | |||
| 305 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | ||
| 306 | String mimeType = "image/*"; | ||
| 307 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | ||
| 308 | //String fileName = cover.getName(); | ||
| 309 | //HttpManager.getInstance().header(this, fileSrc); | ||
| 310 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | ||
| 311 | //Fresco设置圆形头像 | ||
| 312 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | ||
| 313 | GenericDraweeHierarchy hierarchy = builder | ||
| 314 | .setDesiredAspectRatio(1f) | ||
| 315 | .setFailureImage(R.mipmap.blank) | ||
| 316 | //圆形头像 | ||
| 317 | .setRoundingParams(RoundingParams.asCircle()) | ||
| 318 | .build(); | ||
| 319 | |||
| 320 | //加载本地图片 | ||
| 321 | Uri uri = Uri.fromFile(cover); | ||
| 322 | DraweeController controller = Fresco.newDraweeControllerBuilder() | ||
| 323 | .setOldController(mSimpleDraweeView.getController()) | ||
| 324 | .setUri(uri) | ||
| 325 | .build(); | ||
| 326 | mSimpleDraweeView.setHierarchy(hierarchy); | ||
| 327 | mSimpleDraweeView.setController(controller); | ||
| 328 | |||
| 329 | } | ||
| 330 | |||
| 331 | public void startPhotoZoom(Uri uri) { | ||
| 332 | Intent intent = new Intent("com.android.camera.action.CROP"); | ||
| 333 | intent.setDataAndType(uri, "image/*"); | ||
| 334 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | ||
| 335 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | ||
| 336 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | ||
| 337 | intent.putExtra("aspectY", 1);// x:y=1:1 | ||
| 338 | // intent.putExtra("outputX", 400);//图片输出大小 | ||
| 339 | // intent.putExtra("outputY", 400); | ||
| 340 | intent.putExtra("output", Uri.fromFile(file)); | ||
| 341 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | ||
| 342 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | ||
| 343 | } | ||
| 344 | |||
| 345 | @Override | ||
| 346 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | ||
| 347 | switch (requestCode) { | ||
| 348 | |||
| 349 | case PermissionUtil.REQUEST_SHOWCAMERA: | ||
| 350 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | ||
| 351 | // Permission Granted | ||
| 352 | uploadAvatarFromPhotoRequest(); | ||
| 353 | |||
| 354 | } else { | ||
| 355 | if (!SharedPreferenceMark.getHasShowCamera()) { | ||
| 356 | SharedPreferenceMark.setHasShowCamera(true); | ||
| 357 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | ||
| 358 | |||
| 359 | } else { | ||
| 360 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | ||
| 361 | .show(); | ||
| 362 | } | ||
| 363 | } | ||
| 364 | break; | ||
| 365 | default: | ||
| 366 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | ||
| 367 | } | ||
| 212 | } | 368 | } |
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.AdapterView; | 9 | import android.widget.AdapterView; |
| 10 | import android.widget.Button; | 10 | import android.widget.Button; |
| 11 | import android.widget.EditText; | 11 | import android.widget.EditText; |
| 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.GradeListDialog; | 17 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
| 18 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 18 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 19 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 19 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
| 20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
| 21 | import com.hjx.personalcenter.http.HttpManager; | ||
| 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 23 | import com.hjx.personalcenter.util.AlertUtils; | 22 | import com.hjx.personalcenter.util.AlertUtils; |
| 24 | 23 | ||
| 25 | /**填写注册信息 熊巍 | 24 | /**填写注册信息 熊巍 |
| 26 | * Created by h on 2017/8/9. | 25 | * Created by h on 2017/8/9. |
| 27 | */ | 26 | */ |
| 28 | 27 | ||
| 29 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener,DialogCallBack.CallBack { | 28 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener,DialogCallBack.CallBack { |
| 30 | private EditText et_username; | 29 | private EditText et_username; |
| 31 | private TextView et_region,et_grade,et_school; | 30 | private TextView et_region,et_grade,et_school; |
| 32 | private Button btn_ok; | 31 | private Button btn_ok; |
| 33 | 32 | ||
| 34 | @Override | 33 | @Override |
| 35 | protected void onCreate(Bundle savedInstanceState) { | 34 | protected void onCreate(Bundle savedInstanceState) { |
| 36 | super.onCreate(savedInstanceState); | 35 | super.onCreate(savedInstanceState); |
| 37 | setContentView(R.layout.activity_registerinfo); | 36 | setContentView(R.layout.activity_registerinfo); |
| 38 | initView(); | 37 | initView(); |
| 39 | initData(); | 38 | initData(); |
| 40 | initLister(); | 39 | initLister(); |
| 41 | } | 40 | } |
| 42 | 41 | ||
| 43 | private void initView() { | 42 | private void initView() { |
| 44 | et_username = (EditText) findViewById(R.id.et_username); | 43 | et_username = (EditText) findViewById(R.id.et_username); |
| 45 | et_region = (TextView) findViewById(R.id.et_region); | 44 | et_region = (TextView) findViewById(R.id.et_region); |
| 46 | et_grade = (TextView) findViewById(R.id.et_grade); | 45 | et_grade = (TextView) findViewById(R.id.et_grade); |
| 47 | et_school = (TextView) findViewById(R.id.et_school); | 46 | et_school = (TextView) findViewById(R.id.et_school); |
| 48 | btn_ok = (Button) findViewById(R.id.btn_ok); | 47 | btn_ok = (Button) findViewById(R.id.btn_ok); |
| 49 | 48 | ||
| 50 | 49 | ||
| 51 | } | 50 | } |
| 52 | 51 | ||
| 53 | private void initData() { | 52 | private void initData() { |
| 54 | 53 | ||
| 55 | } | 54 | } |
| 56 | 55 | ||
| 57 | private void initLister() { | 56 | private void initLister() { |
| 58 | et_region.setOnClickListener(this); | 57 | et_region.setOnClickListener(this); |
| 59 | et_grade.setOnClickListener(this); | 58 | et_grade.setOnClickListener(this); |
| 60 | et_school.setOnClickListener(this); | 59 | et_school.setOnClickListener(this); |
| 61 | btn_ok.setOnClickListener(this); | 60 | btn_ok.setOnClickListener(this); |
| 62 | 61 | ||
| 63 | 62 | ||
| 64 | } | 63 | } |
| 65 | 64 | ||
| 66 | @Override | 65 | @Override |
| 67 | public void onClick(View v) { | 66 | public void onClick(View v) { |
| 68 | String register1 = et_username.getText().toString().trim(); | 67 | String register1 = et_username.getText().toString().trim(); |
| 69 | String register2 = et_region.getText().toString().trim(); | 68 | String register2 = et_region.getText().toString().trim(); |
| 70 | String register3 = et_grade.getText().toString().trim(); | 69 | String register3 = et_grade.getText().toString().trim(); |
| 71 | String register4 = et_school.getText().toString().trim(); | 70 | String register4 = et_school.getText().toString().trim(); |
| 72 | switch (v.getId()){ | 71 | switch (v.getId()){ |
| 73 | case R.id.et_region: | 72 | case R.id.et_region: |
| 74 | choiseregion(); | 73 | choiseregion(); |
| 75 | break; | 74 | break; |
| 76 | case R.id.et_grade: | 75 | case R.id.et_grade: |
| 77 | choisegrade(); | 76 | choisegrade(); |
| 78 | break; | 77 | break; |
| 79 | case R.id.et_school: | 78 | case R.id.et_school: |
| 80 | // if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ | 79 | // if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ |
| 81 | // AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); | 80 | // AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); |
| 82 | // return; | 81 | // return; |
| 83 | // }else { | 82 | // }else { |
| 84 | choiseschool(); | 83 | choiseschool(); |
| 85 | // } | 84 | // } |
| 86 | 85 | ||
| 87 | break; | 86 | break; |
| 88 | case R.id.btn_ok: | 87 | case R.id.btn_ok: |
| 89 | if (TextUtils.isEmpty(register1)||TextUtils.isEmpty(register4) || | 88 | if (TextUtils.isEmpty(register1)||TextUtils.isEmpty(register4) || |
| 90 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ | 89 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ |
| 91 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | 90 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
| 92 | return; | 91 | return; |
| 93 | }else{ | 92 | }else{ |
| 94 | Intent intent = new Intent(); | 93 | Intent intent = new Intent(); |
| 95 | intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class); | 94 | intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class); |
| 96 | startActivity(intent); | 95 | startActivity(intent); |
| 97 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 96 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 98 | } | 97 | } |
| 99 | 98 | ||
| 100 | break; | 99 | break; |
| 101 | } | 100 | } |
| 102 | 101 | ||
| 103 | } | 102 | } |
| 104 | 103 | ||
| 105 | //选择地区 | 104 | //选择地区 |
| 106 | private void choiseregion() { | 105 | private void choiseregion() { |
| 107 | |||
| 108 | ProvinceListDialog.getInstance(this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 106 | ProvinceListDialog.getInstance(this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
| 109 | 107 | ||
| 110 | } | 108 | } |
| 111 | //选择年级 | 109 | //选择年级 |
| 112 | private void choisegrade() { | 110 | private void choisegrade() { |
| 113 | HttpManager.getInstance().getgrade(RegisterInfoActivity.this); | 111 | GradeListDialog.getInstance(this).show(getSupportFragmentManager(), "GradeListDialog"); |
| 114 | GradeListDialog.getInstance().show(getSupportFragmentManager(), "GradeListDialog"); | ||
| 115 | 112 | ||
| 116 | } | 113 | } |
| 117 | //选择学校 | 114 | //选择学校 |
| 118 | private void choiseschool() { | 115 | private void choiseschool() { |
| 119 | SchoolListDialog.getInstance().show(getSupportFragmentManager(), "SchoolListDialog"); | 116 | SchoolListDialog.getInstance(this).show(getSupportFragmentManager(), "SchoolListDialog"); |
| 120 | 117 | ||
| 121 | } | 118 | } |
| 122 | 119 | ||
| 123 | 120 | ||
| 124 | @Override | 121 | @Override |
| 125 | public void provinceOnItemClick(AdapterView<?> parent, View view, int position, long id,int type) { | 122 | public void provinceOnItemClick(AdapterView<?> parent, View view, int position, long id,int type) { |
| 123 | View View = parent.getChildAt(position); | ||
| 124 | TextView Tv = (TextView)View.findViewById(R.id.list_items); | ||
| 125 | switch (type){ | ||
| 126 | 126 | ||
| 127 | if (type==1){ | 127 | case 1: |
| 128 | View gradeView = parent.getChildAt(position); | 128 | SaveParam.getInstance().saveLoginParam(this,"sheng",Tv.getText().toString()); |
| 129 | TextView gradeTv = (TextView)gradeView.findViewById(R.id.list_items); | 129 | CitysListDialog.getInstance(this).show(getSupportFragmentManager(), "CitysListDialog"); |
| 130 | SaveParam.getInstance().saveLoginParam(this,"sheng",gradeTv.getText().toString()); | 130 | break; |
| 131 | CitysListDialog.getInstance(this).show(getSupportFragmentManager(), "CitysListDialog"); | 131 | case 2: |
| 132 | } | 132 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
| 133 | 133 | SaveParam.getInstance().saveLoginParam(this,"shi",Tv.getText().toString()); | |
| 134 | if (type==2){ | 134 | CountryDialog.getInstance(this).show(getSupportFragmentManager(), "CountryDialog"); |
| 135 | View gradeView = parent.getChildAt(position); | 135 | et_region.setText(""); |
| 136 | TextView gradeTv = (TextView)gradeView.findViewById(R.id.list_items); | 136 | et_region.setText(provice+Tv.getText().toString()); |
| 137 | SaveParam.getInstance().saveLoginParam(this,"shi",gradeTv.getText().toString()); | 137 | break; |
| 138 | CountryDialog.getInstance(this).show(getSupportFragmentManager(), "CountryDialog"); | 138 | case 3: |
| 139 | } | 139 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
| 140 | 140 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | |
| 141 | if (type==3){ | 141 | et_region.setText(""); |
| 142 | View gradeView = parent.getChildAt(position); | 142 | et_region.setText(provices+citys+Tv.getText().toString()); |
| 143 | TextView gradeTv = (TextView)gradeView.findViewById(R.id.list_items); | 143 | break; |
| 144 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 144 | case 4: |
| 145 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 145 | et_school.setText(Tv.getText().toString()); |
| 146 | et_region.setText(provice+citys+gradeTv.getText().toString()); | 146 | break; |
| 147 | case 5: | ||
| 148 | et_grade.setText(Tv.getText().toString()); | ||
| 149 | break; | ||
| 147 | } | 150 | } |
| 148 | 151 | ||
| 149 | |||
| 150 | |||
| 151 | } | 152 | } |
| 152 | @Override | 153 | @Override |
| 153 | public boolean onKeyUp(int keyCode, KeyEvent event) { | 154 | public boolean onKeyUp(int keyCode, KeyEvent event) { |
| 154 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 155 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 155 | finish(); | 156 | finish(); |
| 156 | 157 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/GrandeAdapter.java
| 1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.view.View; | 4 | import android.view.View; |
| 5 | import android.view.ViewGroup; | 5 | import android.view.ViewGroup; |
| 6 | import android.widget.BaseAdapter; | 6 | import android.widget.BaseAdapter; |
| 7 | import android.widget.TextView; | 7 | import android.widget.TextView; |
| 8 | 8 | ||
| 9 | import com.hjx.personalcenter.R; | 9 | import com.hjx.personalcenter.R; |
| 10 | import com.hjx.personalcenter.model.GradeInfo; | 10 | import com.hjx.personalcenter.model.GradeInfo; |
| 11 | 11 | ||
| 12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | * Created by h on 2017/8/21. | 15 | * Created by h on 2017/8/21. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | public class GrandeAdapter extends BaseAdapter{ | 18 | public class GrandeAdapter extends BaseAdapter{ |
| 19 | ArrayList<GradeInfo.DataBean> objects; | 19 | ArrayList<GradeInfo.DataBean.ChildrenBean> objects; |
| 20 | private Context context; | 20 | private Context context; |
| 21 | 21 | ||
| 22 | public GrandeAdapter(ArrayList<GradeInfo.DataBean> objects, Context context) { | 22 | public GrandeAdapter(ArrayList<GradeInfo.DataBean.ChildrenBean> objects, Context context) { |
| 23 | this.objects = objects; | 23 | this.objects = objects; |
| 24 | this.context = context; | 24 | this.context = context; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | @Override | 27 | @Override |
| 28 | public int getCount() { | 28 | public int getCount() { |
| 29 | return objects.size(); | 29 | return objects.size(); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | @Override | 32 | @Override |
| 33 | public Object getItem(int position) { | 33 | public Object getItem(int position) { |
| 34 | return position; | 34 | return position; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | @Override | 37 | @Override |
| 38 | public long getItemId(int position) { | 38 | public long getItemId(int position) { |
| 39 | return position; | 39 | return position; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | @Override | 42 | @Override |
| 43 | public View getView(final int position, View convertView, ViewGroup parent) { | 43 | public View getView(final int position, View convertView, ViewGroup parent) { |
| 44 | 44 | ||
| 45 | ProvincesAdapter.ViewHolder holder = null; | 45 | ProvincesAdapter.ViewHolder holder = null; |
| 46 | 46 | ||
| 47 | if (convertView == null) { | 47 | if (convertView == null) { |
| 48 | convertView = View.inflate(context, R.layout.custom_adilog_list_item, null); | 48 | convertView = View.inflate(context, R.layout.custom_adilog_list_item, null); |
| 49 | holder = new ProvincesAdapter.ViewHolder(); | 49 | holder = new ProvincesAdapter.ViewHolder(); |
| 50 | holder.nameText = (TextView) convertView.findViewById(R.id.list_items); | 50 | holder.nameText = (TextView) convertView.findViewById(R.id.list_items); |
| 51 | convertView.setTag(holder); | 51 | convertView.setTag(holder); |
| 52 | } else { | 52 | } else { |
| 53 | holder = (ProvincesAdapter.ViewHolder) convertView.getTag(); | 53 | holder = (ProvincesAdapter.ViewHolder) convertView.getTag(); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | holder.nameText.setText(objects.get(position).getName()); | 56 | holder.nameText.setText(objects.get(position).getName()); |
| 57 | 57 | ||
| 58 | return convertView; | 58 | return convertView; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | 61 | ||
| 62 | static class ViewHolder { | 62 | static class ViewHolder { |
| 63 | TextView nameText; | 63 | TextView nameText; |
| 64 | } | 64 | } |
| 65 | } | 65 | } |
| 66 | 66 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CitysListDialog.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.graphics.Color; | 4 | import android.graphics.Color; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.os.Handler; | 6 | import android.os.Handler; |
| 7 | import android.os.Message; | 7 | import android.os.Message; |
| 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.ListView; | 13 | import android.widget.ListView; |
| 14 | 14 | ||
| 15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
| 16 | import com.hjx.personalcenter.adapter.CitysAdapter; | 16 | import com.hjx.personalcenter.adapter.CitysAdapter; |
| 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.interfaces.DialogCallBack; | 20 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 21 | import com.hjx.personalcenter.model.CityInfo; | 21 | import com.hjx.personalcenter.model.CityInfo; |
| 22 | import com.hjx.personalcenter.model.ProvinceInfo; | ||
| 23 | import com.mylhyl.circledialog.BaseCircleDialog; | 22 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 24 | import com.mylhyl.circledialog.res.values.CircleDimen; | 23 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 25 | 24 | ||
| 26 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
| 27 | import java.util.List; | 26 | import java.util.List; |
| 28 | 27 | ||
| 29 | /** | 28 | /** |
| 30 | * 自定义市级列表对话框 | 29 | * 自定义市级列表对话框 |
| 31 | * Created by h on 2017/8/10. | 30 | * Created by h on 2017/8/10. |
| 32 | */ | 31 | */ |
| 33 | 32 | ||
| 34 | public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 33 | public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
| 35 | private CitysAdapter listadapter; | 34 | private CitysAdapter listadapter; |
| 36 | private ListView listView; | 35 | private ListView listView; |
| 37 | private DialogCallBack.CallBack mCallBack; | 36 | private DialogCallBack.CallBack mCallBack; |
| 38 | private ArrayList<CityInfo.CitiesBean> data = new ArrayList<>(); | 37 | private ArrayList<CityInfo.CitiesBean> data = new ArrayList<>(); |
| 39 | public CitysListDialog(DialogCallBack.CallBack callBack) { | 38 | public CitysListDialog(DialogCallBack.CallBack callBack) { |
| 40 | this.mCallBack = callBack; | 39 | this.mCallBack = callBack; |
| 41 | } | 40 | } |
| 42 | public static CitysListDialog getInstance(DialogCallBack.CallBack callBack) { | 41 | public static CitysListDialog getInstance(DialogCallBack.CallBack callBack) { |
| 43 | CitysListDialog dialogFragment = new CitysListDialog(callBack); | 42 | CitysListDialog dialogFragment = new CitysListDialog(callBack); |
| 44 | dialogFragment.setCanceledBack(true); | 43 | dialogFragment.setCanceledBack(true); |
| 45 | dialogFragment.setCanceledOnTouchOutside(true); | 44 | dialogFragment.setCanceledOnTouchOutside(true); |
| 46 | dialogFragment.setRadius(CircleDimen.RADIUS); | 45 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 47 | dialogFragment.setWidth(0.5f); | 46 | dialogFragment.setWidth(0.5f); |
| 48 | dialogFragment.setGravity(Gravity.CENTER); | 47 | dialogFragment.setGravity(Gravity.CENTER); |
| 49 | dialogFragment.setBackgroundColor(Color.WHITE); | 48 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 50 | return dialogFragment; | 49 | return dialogFragment; |
| 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 | switch (msg.what){ | 55 | switch (msg.what){ |
| 57 | case HttpCode.CITYS: | 56 | case HttpCode.CITYS: |
| 58 | data.clear(); | 57 | data.clear(); |
| 59 | data.addAll( (List<CityInfo.CitiesBean>)msg.obj); | 58 | data.addAll( (List<CityInfo.CitiesBean>)msg.obj); |
| 60 | listadapter.notifyDataSetChanged(); | 59 | listadapter.notifyDataSetChanged(); |
| 61 | break; | 60 | break; |
| 62 | } | 61 | } |
| 63 | } | 62 | } |
| 64 | }; | 63 | }; |
| 65 | 64 | ||
| 66 | @Override | 65 | @Override |
| 67 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 66 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 68 | return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); | 67 | return inflater.inflate(R.layout.custom_adilog_cityslist, container, false); |
| 69 | } | 68 | } |
| 70 | 69 | ||
| 71 | @Override | 70 | @Override |
| 72 | public void onActivityCreated(Bundle savedInstanceState) { | 71 | public void onActivityCreated(Bundle savedInstanceState) { |
| 73 | super.onActivityCreated(savedInstanceState); | 72 | super.onActivityCreated(savedInstanceState); |
| 74 | listView = (ListView) getView().findViewById(R.id.listadapter); | 73 | listView = (ListView) getView().findViewById(R.id.listadapter); |
| 75 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.PROVINCES); | 74 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.PROVINCES); |
| 76 | listadapter = new CitysAdapter(data,getActivity()); | 75 | listadapter = new CitysAdapter(data,getActivity()); |
| 77 | listView.setAdapter(listadapter); | 76 | listView.setAdapter(listadapter); |
| 78 | listView.setOnItemClickListener(this); | 77 | listView.setOnItemClickListener(this); |
| 79 | try { | 78 | try { |
| 80 | int a = Integer.parseInt(citys); | 79 | long a = Long.parseLong(citys); |
| 81 | HttpManager.getInstance().cityinfo(getActivity(),a,handler); | 80 | HttpManager.getInstance().cityinfo(getActivity(),a,handler); |
| 82 | } catch (NumberFormatException e) { | 81 | } catch (NumberFormatException e) { |
| 83 | e.printStackTrace(); | 82 | e.printStackTrace(); |
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | 85 | ||
| 87 | } | 86 | } |
| 88 | 87 | ||
| 89 | @Override | 88 | @Override |
| 90 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 89 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
| 91 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CITYS, ""+data.get(position).getRegionId()); | 90 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CITYS, ""+data.get(position).getRegionId()); |
| 92 | mCallBack.provinceOnItemClick(parent,view,position,id,2); | 91 | mCallBack.provinceOnItemClick(parent,view,position,id,2); |
| 93 | dismiss(); | 92 | dismiss(); |
| 94 | 93 | ||
| 95 | } | 94 | } |
| 96 | } | 95 | } |
| 97 | 96 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CountryDialog.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.graphics.Color; | 4 | import android.graphics.Color; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.os.Handler; | 6 | import android.os.Handler; |
| 7 | import android.os.Message; | 7 | import android.os.Message; |
| 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.ListView; | 13 | import android.widget.ListView; |
| 14 | 14 | ||
| 15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
| 16 | import com.hjx.personalcenter.adapter.CitysAdapter; | ||
| 17 | import com.hjx.personalcenter.adapter.CountryAdapter; | 16 | import com.hjx.personalcenter.adapter.CountryAdapter; |
| 18 | import com.hjx.personalcenter.db.SaveParam; | 17 | import com.hjx.personalcenter.db.SaveParam; |
| 19 | import com.hjx.personalcenter.http.HttpCode; | 18 | import com.hjx.personalcenter.http.HttpCode; |
| 20 | import com.hjx.personalcenter.http.HttpManager; | 19 | import com.hjx.personalcenter.http.HttpManager; |
| 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 20 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 22 | import com.hjx.personalcenter.model.CityInfo; | ||
| 23 | import com.hjx.personalcenter.model.CountyInfo; | 21 | import com.hjx.personalcenter.model.CountyInfo; |
| 24 | import com.mylhyl.circledialog.BaseCircleDialog; | 22 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 25 | import com.mylhyl.circledialog.res.values.CircleDimen; | 23 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 26 | 24 | ||
| 27 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
| 28 | import java.util.List; | 26 | import java.util.List; |
| 29 | 27 | ||
| 30 | /** | 28 | /** |
| 31 | * Created by wei on 2017/8/21. | 29 | * Created by wei on 2017/8/21. |
| 32 | */ | 30 | */ |
| 33 | 31 | ||
| 34 | public class CountryDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 32 | public class CountryDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
| 35 | private CountryAdapter listadapter; | 33 | private CountryAdapter listadapter; |
| 36 | private ListView listView; | 34 | private ListView listView; |
| 37 | private DialogCallBack.CallBack mCallBack; | 35 | private DialogCallBack.CallBack mCallBack; |
| 38 | private ArrayList<CountyInfo.CountiesBean> data = new ArrayList<>(); | 36 | private ArrayList<CountyInfo.CountiesBean> data = new ArrayList<>(); |
| 39 | public CountryDialog(DialogCallBack.CallBack callBack) { | 37 | public CountryDialog(DialogCallBack.CallBack callBack) { |
| 40 | this.mCallBack = callBack; | 38 | this.mCallBack = callBack; |
| 41 | } | 39 | } |
| 42 | public static CountryDialog getInstance(DialogCallBack.CallBack callBack) { | 40 | public static CountryDialog getInstance(DialogCallBack.CallBack callBack) { |
| 43 | CountryDialog dialogFragment = new CountryDialog(callBack); | 41 | CountryDialog dialogFragment = new CountryDialog(callBack); |
| 44 | dialogFragment.setCanceledBack(true); | 42 | dialogFragment.setCanceledBack(true); |
| 45 | dialogFragment.setCanceledOnTouchOutside(true); | 43 | dialogFragment.setCanceledOnTouchOutside(true); |
| 46 | dialogFragment.setRadius(CircleDimen.RADIUS); | 44 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 47 | dialogFragment.setWidth(0.5f); | 45 | dialogFragment.setWidth(0.5f); |
| 48 | dialogFragment.setGravity(Gravity.CENTER); | 46 | dialogFragment.setGravity(Gravity.CENTER); |
| 49 | dialogFragment.setBackgroundColor(Color.WHITE); | 47 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 50 | return dialogFragment; | 48 | return dialogFragment; |
| 51 | } | 49 | } |
| 52 | Handler handler = new Handler(){ | 50 | Handler handler = new Handler(){ |
| 53 | @Override | 51 | @Override |
| 54 | public void handleMessage(Message msg) { | 52 | public void handleMessage(Message msg) { |
| 55 | super.handleMessage(msg); | 53 | super.handleMessage(msg); |
| 56 | switch (msg.what){ | 54 | switch (msg.what){ |
| 57 | case HttpCode.COUNTRY: | 55 | case HttpCode.COUNTRY: |
| 56 | |||
| 58 | data.clear(); | 57 | data.clear(); |
| 59 | data.addAll( (List<CountyInfo.CountiesBean>)msg.obj); | 58 | data.addAll( (List<CountyInfo.CountiesBean>)msg.obj); |
| 60 | listadapter.notifyDataSetChanged(); | 59 | listadapter.notifyDataSetChanged(); |
| 61 | break; | 60 | break; |
| 62 | } | 61 | } |
| 63 | } | 62 | } |
| 64 | }; | 63 | }; |
| 65 | 64 | ||
| 66 | @Override | 65 | @Override |
| 67 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 66 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 68 | return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); | 67 | return inflater.inflate(R.layout.custom_adilog_countrylist, container, false); |
| 69 | } | 68 | } |
| 70 | 69 | ||
| 71 | @Override | 70 | @Override |
| 72 | public void onActivityCreated(Bundle savedInstanceState) { | 71 | public void onActivityCreated(Bundle savedInstanceState) { |
| 73 | super.onActivityCreated(savedInstanceState); | 72 | super.onActivityCreated(savedInstanceState); |
| 74 | listView = (ListView) getView().findViewById(R.id.listadapter); | 73 | listView = (ListView) getView().findViewById(R.id.listadapter); |
| 75 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 74 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
| 76 | listadapter = new CountryAdapter(data,getActivity()); | 75 | listadapter = new CountryAdapter(data,getActivity()); |
| 77 | listView.setAdapter(listadapter); | 76 | listView.setAdapter(listadapter); |
| 78 | listView.setOnItemClickListener(this); | 77 | listView.setOnItemClickListener(this); |
| 79 | try { | 78 | try { |
| 80 | int a = Integer.parseInt(citys); | 79 | int a = Integer.parseInt(citys); |
| 81 | HttpManager.getInstance().countyinfo(getActivity(),a,handler); | 80 | HttpManager.getInstance().countyinfo(getActivity(),a,handler); |
| 82 | } catch (NumberFormatException e) { | 81 | } catch (NumberFormatException e) { |
| 83 | e.printStackTrace(); | 82 | e.printStackTrace(); |
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | 85 | ||
| 87 | } | 86 | } |
| 88 | 87 | ||
| 89 | @Override | 88 | @Override |
| 90 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 89 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
| 91 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CITYS, ""+data.get(position).getRegionId()); | 90 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CITYS, ""+data.get(position).getRegionId()); |
| 92 | mCallBack.provinceOnItemClick(parent,view,position,id,3); | 91 | mCallBack.provinceOnItemClick(parent,view,position,id,3); |
| 93 | dismiss(); | 92 | dismiss(); |
| 94 | 93 | ||
| 95 | } | 94 | } |
| 96 | } | 95 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/GradeListDialog.java
| 1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.graphics.Color; | 4 | import android.graphics.Color; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.os.Handler; | ||
| 7 | import android.os.Message; | ||
| 6 | import android.view.Gravity; | 8 | import android.view.Gravity; |
| 7 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
| 8 | import android.view.View; | 10 | import android.view.View; |
| 9 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
| 10 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
| 11 | import android.widget.ListView; | 13 | import android.widget.ListView; |
| 12 | import android.widget.Toast; | ||
| 13 | 14 | ||
| 14 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
| 15 | import com.hjx.personalcenter.adapter.GrandeAdapter; | 16 | import com.hjx.personalcenter.adapter.GrandeAdapter; |
| 16 | import com.hjx.personalcenter.db.SaveParam; | 17 | import com.hjx.personalcenter.db.SaveParam; |
| 18 | import com.hjx.personalcenter.http.HttpCode; | ||
| 17 | import com.hjx.personalcenter.http.HttpManager; | 19 | import com.hjx.personalcenter.http.HttpManager; |
| 20 | import com.hjx.personalcenter.interfaces.DialogCallBack; | ||
| 18 | import com.hjx.personalcenter.model.GradeInfo; | 21 | import com.hjx.personalcenter.model.GradeInfo; |
| 19 | import com.mylhyl.circledialog.BaseCircleDialog; | 22 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 20 | import com.mylhyl.circledialog.res.values.CircleDimen; | 23 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 21 | 24 | ||
| 22 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
| 26 | import java.util.List; | ||
| 23 | 27 | ||
| 24 | /**自定义年级列表对话框 | 28 | /**自定义年级列表对话框 |
| 25 | * Created by h on 2017/8/10. | 29 | * Created by h on 2017/8/10. |
| 26 | */ | 30 | */ |
| 27 | 31 | ||
| 28 | public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 32 | public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
| 29 | private GrandeAdapter listadapter; | 33 | private GrandeAdapter listadapter; |
| 30 | private ListView listView; | 34 | private ListView listView; |
| 31 | ArrayList<GradeInfo.DataBean> data = new ArrayList<>(); | 35 | ArrayList<GradeInfo.DataBean.ChildrenBean> data = new ArrayList<>(); |
| 32 | public static GradeListDialog getInstance() { | 36 | private DialogCallBack.CallBack mCallBack; |
| 33 | GradeListDialog dialogFragment = new GradeListDialog(); | 37 | public GradeListDialog(DialogCallBack.CallBack callBack) { |
| 38 | this.mCallBack = callBack; | ||
| 39 | } | ||
| 40 | public static GradeListDialog getInstance(DialogCallBack.CallBack callBack) { | ||
| 41 | GradeListDialog dialogFragment = new GradeListDialog(callBack); | ||
| 34 | dialogFragment.setCanceledBack(true); | 42 | dialogFragment.setCanceledBack(true); |
| 35 | dialogFragment.setCanceledOnTouchOutside(true); | 43 | dialogFragment.setCanceledOnTouchOutside(true); |
| 36 | dialogFragment.setRadius(CircleDimen.RADIUS); | 44 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 37 | dialogFragment.setWidth(0.5f); | 45 | dialogFragment.setWidth(0.5f); |
| 38 | dialogFragment.setGravity(Gravity.CENTER); | 46 | dialogFragment.setGravity(Gravity.CENTER); |
| 39 | dialogFragment.setBackgroundColor(Color.WHITE); | 47 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 40 | return dialogFragment; | 48 | return dialogFragment; |
| 41 | } | 49 | } |
| 50 | Handler handler = new Handler(){ | ||
| 51 | @Override | ||
| 52 | public void handleMessage(Message msg) { | ||
| 53 | super.handleMessage(msg); | ||
| 54 | switch (msg.what){ | ||
| 55 | case HttpCode.GRADER: | ||
| 56 | data.clear(); | ||
| 57 | data.addAll( (List<GradeInfo.DataBean.ChildrenBean>)msg.obj); | ||
| 58 | listadapter.notifyDataSetChanged(); | ||
| 59 | break; | ||
| 60 | } | ||
| 61 | } | ||
| 62 | }; | ||
| 42 | @Override | 63 | @Override |
| 43 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 64 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 44 | 65 | ||
| 45 | return inflater.inflate(R.layout.custom_adilog_gradelist, container, false); | 66 | return inflater.inflate(R.layout.custom_adilog_gradelist, container, false); |
| 46 | } | 67 | } |
| 47 | @Override | 68 | @Override |
| 48 | public void onActivityCreated(Bundle savedInstanceState) { | 69 | public void onActivityCreated(Bundle savedInstanceState) { |
| 49 | super.onActivityCreated(savedInstanceState); | 70 | super.onActivityCreated(savedInstanceState); |
| 50 | listView = (ListView) getView().findViewById(R.id.listadapter); | 71 | listView = (ListView) getView().findViewById(R.id.listadapter); |
| 51 | String gradens = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | ||
| 52 | if (gradens != null) { | ||
| 53 | |||
| 54 | for (int i = 0; i < gradens.split(",").length; i++) { | ||
| 55 | GradeInfo.DataBean dataBean = new GradeInfo.DataBean(); | ||
| 56 | dataBean.setName(gradens.split(",")[i]); | ||
| 57 | data.add(dataBean); | ||
| 58 | } | ||
| 59 | } else { | ||
| 60 | HttpManager.getInstance().getgrade(getActivity()); | ||
| 61 | } | ||
| 62 | listadapter = new GrandeAdapter(data,getActivity()); | 72 | listadapter = new GrandeAdapter(data,getActivity()); |
| 63 | listView.setAdapter(listadapter); | 73 | listView.setAdapter(listadapter); |
| 64 | listView.setOnItemClickListener(this); | 74 | listView.setOnItemClickListener(this); |
| 75 | HttpManager.getInstance().getgrade(getActivity(),handler); | ||
| 65 | 76 | ||
| 66 | } | 77 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/HeadDialog.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.graphics.Color; | 4 | import android.graphics.Color; |
| 5 | import android.os.Bundle; | ||
| 5 | import android.view.Gravity; | 6 | import android.view.Gravity; |
| 6 | import android.view.LayoutInflater; | 7 | import android.view.LayoutInflater; |
| 7 | import android.view.View; | 8 | import android.view.View; |
| 8 | import android.view.ViewGroup; | 9 | import android.view.ViewGroup; |
| 10 | import android.widget.LinearLayout; | ||
| 11 | import android.widget.TextView; | ||
| 9 | 12 | ||
| 10 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
| 11 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 14 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 12 | import com.mylhyl.circledialog.BaseCircleDialog; | 15 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 13 | import com.mylhyl.circledialog.res.values.CircleDimen; | 16 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 14 | 17 | ||
| 15 | /** | 18 | /** |
| 16 | * Created by h on 2017/8/20. | 19 | * Created by h on 2017/8/20. |
| 17 | */ | 20 | */ |
| 18 | 21 | ||
| 19 | public class HeadDialog extends BaseCircleDialog { | 22 | public class HeadDialog extends BaseCircleDialog implements View.OnClickListener { |
| 20 | private View mView; | 23 | private View mView; |
| 24 | private TextView oktakephone, cancetakephone; | ||
| 25 | private LinearLayout take_pic,xiangce; | ||
| 21 | private DialogCallBack.CallBackView mCallBack; | 26 | private DialogCallBack.CallBackView mCallBack; |
| 22 | 27 | ||
| 23 | public HeadDialog(DialogCallBack.CallBackView callBack) { | 28 | public HeadDialog(DialogCallBack.CallBackView callBack) { |
| 24 | this.mCallBack = callBack; | 29 | this.mCallBack = callBack; |
| 25 | } | 30 | } |
| 31 | |||
| 26 | public static HeadDialog getInstance(DialogCallBack.CallBackView callBackview) { | 32 | public static HeadDialog getInstance(DialogCallBack.CallBackView callBackview) { |
| 27 | HeadDialog dialogFragment = new HeadDialog(callBackview); | 33 | HeadDialog dialogFragment = new HeadDialog(callBackview); |
| 28 | dialogFragment.setCanceledBack(true); | 34 | dialogFragment.setCanceledBack(true); |
| 29 | dialogFragment.setCanceledOnTouchOutside(true); | 35 | dialogFragment.setCanceledOnTouchOutside(true); |
| 30 | dialogFragment.setRadius(CircleDimen.RADIUS); | 36 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 31 | dialogFragment.setWidth(0.4f); | 37 | dialogFragment.setWidth(0.4f); |
| 32 | dialogFragment.setGravity(Gravity.CENTER); | 38 | dialogFragment.setGravity(Gravity.CENTER); |
| 33 | dialogFragment.setBackgroundColor(Color.WHITE); | 39 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 34 | return dialogFragment; | 40 | return dialogFragment; |
| 35 | } | 41 | } |
| 36 | 42 | ||
| 37 | @Override | 43 | @Override |
| 38 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 44 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 39 | 45 | ||
| 40 | if (mView == null) { | 46 | if (mView == null) { |
| 41 | mView = inflater.inflate(R.layout.custom_adilog_lhead, container, false); | 47 | mView = inflater.inflate(R.layout.custom_adilog_lhead, container, false); |
| 42 | mCallBack.provinceOnItemClick(context,inflater,container); | ||
| 43 | } | 48 | } |
| 44 | return mView; | 49 | return mView; |
| 45 | } | 50 | } |
| 51 | |||
| 52 | @Override | ||
| 53 | public void onActivityCreated(Bundle savedInstanceState) { | ||
| 54 | super.onActivityCreated(savedInstanceState); | ||
| 55 | oktakephone = (TextView) mView.findViewById(R.id.oktakephone); | ||
| 56 | cancetakephone = (TextView) mView.findViewById(R.id.canceltakephone); | ||
| 57 | take_pic = (LinearLayout) mView.findViewById(R.id.take_pic); | ||
| 58 | xiangce = (LinearLayout) mView.findViewById(R.id.xiangce); | ||
| 59 | oktakephone.setOnClickListener(this); | ||
| 60 | cancetakephone.setOnClickListener(this); | ||
| 61 | take_pic.setOnClickListener(this); | ||
| 62 | xiangce.setOnClickListener(this); | ||
| 63 | |||
| 64 | |||
| 65 | } | ||
| 66 | |||
| 67 | @Override | ||
| 68 | public void onClick(View v) { | ||
| 69 | mCallBack.heard(getActivity(), v); | ||
| 70 | dismiss(); | ||
| 71 | } | ||
| 46 | } | 72 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/ProvinceListDialog.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.graphics.Color; | 4 | import android.graphics.Color; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.os.Handler; | 6 | import android.os.Handler; |
| 7 | import android.os.Message; | 7 | import android.os.Message; |
| 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.ListView; | 13 | import android.widget.ListView; |
| 14 | 14 | ||
| 15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
| 16 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | ||
| 17 | import com.hjx.personalcenter.adapter.ProvincesAdapter; | 16 | import com.hjx.personalcenter.adapter.ProvincesAdapter; |
| 18 | import com.hjx.personalcenter.db.SaveParam; | 17 | import com.hjx.personalcenter.db.SaveParam; |
| 19 | import com.hjx.personalcenter.http.HttpCode; | 18 | import com.hjx.personalcenter.http.HttpCode; |
| 20 | import com.hjx.personalcenter.http.HttpManager; | 19 | import com.hjx.personalcenter.http.HttpManager; |
| 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 20 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 22 | import com.hjx.personalcenter.model.ProvinceInfo; | 21 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 23 | import com.mylhyl.circledialog.BaseCircleDialog; | 22 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 24 | import com.mylhyl.circledialog.res.values.CircleDimen; | 23 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 25 | 24 | ||
| 26 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
| 27 | import java.util.List; | 26 | import java.util.List; |
| 28 | 27 | ||
| 29 | /** | 28 | /** |
| 30 | * 自定义年级列表对话框 | 29 | * 自定义年级列表对话框 |
| 31 | * Created by h on 2017/8/10. | 30 | * Created by h on 2017/8/10. |
| 32 | */ | 31 | */ |
| 33 | 32 | ||
| 34 | public class ProvinceListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 33 | public class ProvinceListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
| 35 | private ProvincesAdapter listadapter; | 34 | private ProvincesAdapter listadapter; |
| 36 | private ListView listView; | 35 | private ListView listView; |
| 37 | private ArrayList<ProvinceInfo.ProvincesBean> data = new ArrayList<>(); | 36 | private ArrayList<ProvinceInfo.ProvincesBean> data = new ArrayList<>(); |
| 38 | 37 | ||
| 39 | private DialogCallBack.CallBack mCallBack; | 38 | private DialogCallBack.CallBack mCallBack; |
| 40 | 39 | ||
| 41 | Handler handler = new Handler(){ | 40 | Handler handler = new Handler(){ |
| 42 | @Override | 41 | @Override |
| 43 | public void handleMessage(Message msg) { | 42 | public void handleMessage(Message msg) { |
| 44 | super.handleMessage(msg); | 43 | super.handleMessage(msg); |
| 45 | switch (msg.what){ | 44 | switch (msg.what){ |
| 46 | case HttpCode.PROVICES: | 45 | case HttpCode.PROVICES: |
| 47 | data.clear(); | 46 | data.clear(); |
| 48 | data.addAll( (List<ProvinceInfo.ProvincesBean>)msg.obj); | 47 | data.addAll( (List<ProvinceInfo.ProvincesBean>)msg.obj); |
| 49 | listadapter.notifyDataSetChanged(); | 48 | listadapter.notifyDataSetChanged(); |
| 49 | |||
| 50 | break; | 50 | break; |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | }; | 53 | }; |
| 54 | public ProvinceListDialog(DialogCallBack.CallBack callBack) { | 54 | public ProvinceListDialog(DialogCallBack.CallBack callBack) { |
| 55 | this.mCallBack = callBack; | 55 | this.mCallBack = callBack; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | public static ProvinceListDialog getInstance(DialogCallBack.CallBack callBack) { | 58 | public static ProvinceListDialog getInstance(DialogCallBack.CallBack callBack) { |
| 59 | ProvinceListDialog dialogFragment = new ProvinceListDialog(callBack); | 59 | ProvinceListDialog dialogFragment = new ProvinceListDialog(callBack); |
| 60 | dialogFragment.setCanceledBack(true); | 60 | dialogFragment.setCanceledBack(true); |
| 61 | dialogFragment.setCanceledOnTouchOutside(true); | 61 | dialogFragment.setCanceledOnTouchOutside(true); |
| 62 | dialogFragment.setRadius(CircleDimen.RADIUS); | 62 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 63 | dialogFragment.setWidth(0.5f); | 63 | dialogFragment.setWidth(0.5f); |
| 64 | dialogFragment.setGravity(Gravity.CENTER); | 64 | dialogFragment.setGravity(Gravity.CENTER); |
| 65 | dialogFragment.setBackgroundColor(Color.WHITE); | 65 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 66 | return dialogFragment; | 66 | return dialogFragment; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | @Override | 69 | @Override |
| 70 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 70 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 71 | return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); | 71 | return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | @Override | 74 | @Override |
| 75 | public void onActivityCreated(Bundle savedInstanceState) { | 75 | public void onActivityCreated(Bundle savedInstanceState) { |
| 76 | super.onActivityCreated(savedInstanceState); | 76 | super.onActivityCreated(savedInstanceState); |
| 77 | listView = (ListView) getView().findViewById(R.id.listadapter); | 77 | listView = (ListView) getView().findViewById(R.id.listadapter); |
| 78 | listadapter = new ProvincesAdapter(data,getActivity()); | 78 | listadapter = new ProvincesAdapter(data,getActivity()); |
| 79 | listView.setAdapter(listadapter); | 79 | listView.setAdapter(listadapter); |
| 80 | listView.setOnItemClickListener(this); | 80 | listView.setOnItemClickListener(this); |
| 81 | HttpManager.getInstance().provices(getActivity(),handler); | 81 | HttpManager.getInstance().provices(getActivity(),handler); |
| 82 | 82 | ||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | @Override | 85 | @Override |
| 86 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 86 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
| 87 | //Toast.makeText(getActivity(), "你点击了第" + position + "个", Toast.LENGTH_LONG).show(); | 87 | //Toast.makeText(getActivity(), "你点击了第" + position + "个", Toast.LENGTH_LONG).show(); |
| 88 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.PROVINCES, ""+data.get(position).getRegionId()); | 88 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.PROVINCES, ""+data.get(position).getRegionId()); |
| 89 | mCallBack.provinceOnItemClick(parent,view,position,id,1); | 89 | mCallBack.provinceOnItemClick(parent,view,position,id,1); |
| 90 | dismiss(); | 90 | dismiss(); |
| 91 | 91 | ||
| 92 | } | 92 | } |
| 93 | } | 93 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/SchoolListDialog.java
| 1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.graphics.Color; | 4 | import android.graphics.Color; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.os.Handler; | 6 | import android.os.Handler; |
| 7 | import android.os.Message; | 7 | import android.os.Message; |
| 8 | import android.text.Editable; | 8 | import android.text.Editable; |
| 9 | import android.text.TextWatcher; | 9 | import android.text.TextWatcher; |
| 10 | import android.view.Gravity; | 10 | import android.view.Gravity; |
| 11 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
| 12 | import android.view.View; | 12 | import android.view.View; |
| 13 | import android.view.ViewGroup; | 13 | import android.view.ViewGroup; |
| 14 | import android.widget.AdapterView; | 14 | import android.widget.AdapterView; |
| 15 | import android.widget.EditText; | 15 | import android.widget.EditText; |
| 16 | import android.widget.ListView; | 16 | import android.widget.ListView; |
| 17 | 17 | ||
| 18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
| 19 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | ||
| 20 | import com.hjx.personalcenter.adapter.SchoolAdapter; | 19 | import com.hjx.personalcenter.adapter.SchoolAdapter; |
| 21 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
| 22 | import com.hjx.personalcenter.http.HttpCode; | 21 | import com.hjx.personalcenter.http.HttpCode; |
| 23 | import com.hjx.personalcenter.http.HttpManager; | 22 | import com.hjx.personalcenter.http.HttpManager; |
| 24 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 23 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 25 | import com.hjx.personalcenter.model.CountyInfo; | ||
| 26 | import com.hjx.personalcenter.model.SchoolInfo; | 24 | import com.hjx.personalcenter.model.SchoolInfo; |
| 27 | import com.mylhyl.circledialog.BaseCircleDialog; | 25 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 28 | import com.mylhyl.circledialog.res.values.CircleDimen; | 26 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 29 | 27 | ||
| 30 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
| 31 | import java.util.List; | 29 | import java.util.List; |
| 32 | 30 | ||
| 33 | /** | 31 | /** |
| 34 | * Created by h on 2017/8/21. | 32 | * Created by h on 2017/8/21. |
| 35 | */ | 33 | */ |
| 36 | 34 | ||
| 37 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener, View.OnClickListener { | 35 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
| 38 | private ListView school_list; | 36 | private ListView school_list; |
| 39 | private EditText school_sech; | 37 | private EditText school_sech; |
| 40 | private SchoolAdapter listadapter; | 38 | private SchoolAdapter listadapter; |
| 41 | private View mView; | 39 | private View mView; |
| 42 | boolean isFilter; | 40 | boolean isFilter; |
| 43 | private DialogCallBack.CallBackView mCallBack; | ||
| 44 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); | 41 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); |
| 42 | private DialogCallBack.CallBack mCallBack; | ||
| 45 | 43 | ||
| 46 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { | 44 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { |
| 47 | // this.mCallBack = callBack; | 45 | // this.mCallBack = callBack; |
| 48 | // } | 46 | // } |
| 47 | public SchoolListDialog(DialogCallBack.CallBack callBack) { | ||
| 48 | this.mCallBack = callBack; | ||
| 49 | } | ||
| 49 | 50 | ||
| 50 | public static SchoolListDialog getInstance() { | 51 | public static SchoolListDialog getInstance(DialogCallBack.CallBack mCallBack) { |
| 51 | SchoolListDialog dialogFragment = new SchoolListDialog(); | 52 | SchoolListDialog dialogFragment = new SchoolListDialog(mCallBack); |
| 52 | dialogFragment.setCanceledBack(true); | 53 | dialogFragment.setCanceledBack(true); |
| 53 | dialogFragment.setCanceledOnTouchOutside(true); | 54 | dialogFragment.setCanceledOnTouchOutside(true); |
| 54 | dialogFragment.setRadius(CircleDimen.RADIUS); | 55 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 55 | dialogFragment.setWidth(0.5f); | 56 | dialogFragment.setWidth(0.5f); |
| 56 | dialogFragment.setGravity(Gravity.CENTER); | 57 | dialogFragment.setGravity(Gravity.CENTER); |
| 57 | dialogFragment.setBackgroundColor(Color.WHITE); | 58 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 58 | return dialogFragment; | 59 | return dialogFragment; |
| 59 | } | 60 | } |
| 61 | |||
| 60 | Handler handler = new Handler(){ | 62 | Handler handler = new Handler(){ |
| 61 | @Override | 63 | @Override |
| 62 | public void handleMessage(Message msg) { | 64 | public void handleMessage(Message msg) { |
| 63 | super.handleMessage(msg); | 65 | super.handleMessage(msg); |
| 64 | switch (msg.what){ | 66 | switch (msg.what){ |
| 65 | case HttpCode.SCHOOL: | 67 | case HttpCode.SCHOOL: |
| 66 | data.clear(); | 68 | data.clear(); |
| 67 | data.addAll( (List<SchoolInfo.DataBean>)msg.obj); | 69 | data.addAll( (List<SchoolInfo.DataBean>)msg.obj); |
| 68 | listadapter.notifyDataSetChanged(); | 70 | listadapter.notifyDataSetChanged(); |
| 69 | break; | 71 | break; |
| 70 | } | 72 | } |
| 71 | } | 73 | } |
| 72 | }; | 74 | }; |
| 75 | |||
| 76 | |||
| 73 | @Override | 77 | @Override |
| 74 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 78 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 75 | 79 | ||
| 76 | if (mView == null) { | 80 | if (mView == null) { |
| 77 | mView = inflater.inflate(R.layout.custom_adilog_school_list, container, false); | 81 | mView = inflater.inflate(R.layout.custom_adilog_school_list, container, false); |
| 78 | //mCallBack.provinceOnItemClick(context, inflater, container); | 82 | //mCallBack.provinceOnItemClick(context, inflater, container); |
| 79 | } | 83 | } |
| 80 | return mView; | 84 | return mView; |
| 81 | } | 85 | } |
| 82 | 86 | ||
| 83 | @Override | 87 | @Override |
| 84 | public void onActivityCreated(Bundle savedInstanceState) { | 88 | public void onActivityCreated(Bundle savedInstanceState) { |
| 85 | super.onActivityCreated(savedInstanceState); | 89 | super.onActivityCreated(savedInstanceState); |
| 86 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); | 90 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); |
| 87 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); | 91 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); |
| 88 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 92 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
| 93 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | ||
| 89 | listadapter = new SchoolAdapter(data, getActivity()); | 94 | listadapter = new SchoolAdapter(data, getActivity()); |
| 90 | school_list.setAdapter(listadapter); | 95 | school_list.setAdapter(listadapter); |
| 91 | school_list.setOnItemClickListener(this); | 96 | school_list.setOnItemClickListener(this); |
| 92 | school_sech.setOnClickListener(this); | ||
| 93 | try { | 97 | try { |
| 94 | int a = Integer.parseInt(citys); | 98 | int a = Integer.parseInt(citys); |
| 95 | HttpManager.getInstance().getschool(getActivity(),a,14,handler); | 99 | int b = Integer.parseInt(grade); |
| 100 | HttpManager.getInstance().getschool(getActivity(),130102,14,handler); | ||
| 96 | } catch (NumberFormatException e) { | 101 | } catch (NumberFormatException e) { |
| 97 | e.printStackTrace(); | 102 | e.printStackTrace(); |
| 98 | } | 103 | } |
| 99 | intiEditView(); | 104 | intiEditView(); |
| 100 | 105 | ||
| 101 | 106 | ||
| 102 | } | 107 | } |
| 103 | private void intiEditView() { | 108 | private void intiEditView() { |
| 104 | school_sech.addTextChangedListener(new TextWatcher() { | 109 | school_sech.addTextChangedListener(new TextWatcher() { |
| 105 | @Override | 110 | @Override |
| 106 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | 111 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
| 107 | 112 | ||
| 108 | } | 113 | } |
| 109 | 114 | ||
| 110 | @Override | 115 | @Override |
| 111 | public void onTextChanged(CharSequence s, int start, int before, int count) { | 116 | public void onTextChanged(CharSequence s, int start, int before, int count) { |
| 112 | // mAdapter.getFilter().filter(s); | 117 | // mAdapter.getFilter().filter(s); |
| 113 | 118 | ||
| 114 | listadapter.getFilter().filter(s); | 119 | listadapter.getFilter().filter(s); |
| 115 | } | 120 | } |
| 116 | 121 | ||
| 117 | @Override | 122 | @Override |
| 118 | public void afterTextChanged(Editable s) { | 123 | public void afterTextChanged(Editable s) { |
| 119 | 124 | ||
| 120 | } | 125 | } |
| 121 | }); | 126 | }); |
| 122 | } | 127 | } |
| 123 | 128 | ||
| 124 | @Override | 129 | @Override |
| 125 | public void onClick(View v) { | ||
| 126 | |||
| 127 | } |
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.graphics.Color; | 4 | import android.graphics.Color; |
| 4 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 5 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 6 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
| 8 | import android.view.Gravity; | ||
| 7 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
| 8 | import android.view.View; | 10 | import android.view.View; |
| 9 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
| 12 | import android.widget.AdapterView; | ||
| 10 | import android.widget.EditText; | 13 | import android.widget.EditText; |
| 11 | import android.widget.TextView; | 14 | import android.widget.TextView; |
| 12 | 15 | ||
| 13 | import com.bigkoo.pickerview.TimePickerView; | 16 | import com.bigkoo.pickerview.TimePickerView; |
| 14 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
| 15 | import com.hjx.personalcenter.util.AlertUtils; | 18 | import com.hjx.personalcenter.util.AlertUtils; |
| 19 | import com.mylhyl.circledialog.CircleDialog; | ||
| 20 | import com.mylhyl.circledialog.callback.ConfigButton; | ||
| 21 | import com.mylhyl.circledialog.callback.ConfigDialog; | ||
| 22 | import com.mylhyl.circledialog.params.ButtonParams; | ||
| 23 | import com.mylhyl.circledialog.params.DialogParams; | ||
| 16 | 24 | ||
| 17 | import java.text.SimpleDateFormat; | 25 | import java.text.SimpleDateFormat; |
| 18 | import java.util.Date; | 26 | import java.util.Date; |
| 19 | 27 | ||
| 20 | /** | 28 | /** |
| 21 | * Created by h on 2017/8/12. | 29 | * Created by h on 2017/8/12. |
| 22 | */ | 30 | */ |
| 23 | 31 | ||
| 24 | public class PresonInfoFragment extends Fragment implements View.OnClickListener { | 32 | public class PresonInfoFragment extends Fragment implements View.OnClickListener { |
| 25 | private View mView; | 33 | private View mView; |
| 26 | private int type; | 34 | private int type; |
| 27 | private TimePickerView pvTime; | 35 | private TimePickerView pvTime; |
| 28 | private EditText tv_username1,tv_useinfo_adress1,tv_useinfo_qq; | 36 | private EditText tv_username1,tv_useinfo_adress1,tv_useinfo_qq; |
| 29 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; | 37 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; |
| 30 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 38 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
| 31 | 39 | ||
| 32 | public static PresonInfoFragment newInstance(int type) { | 40 | public static PresonInfoFragment newInstance(int type) { |
| 33 | PresonInfoFragment fragment = new PresonInfoFragment(); | 41 | PresonInfoFragment fragment = new PresonInfoFragment(); |
| 34 | Bundle bundle = new Bundle(); | 42 | Bundle bundle = new Bundle(); |
| 35 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 43 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
| 36 | fragment.setArguments(bundle); | 44 | fragment.setArguments(bundle); |
| 37 | return fragment; | 45 | return fragment; |
| 38 | 46 | ||
| 39 | } | 47 | } |
| 40 | @Override | 48 | @Override |
| 41 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 49 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 42 | if (mView == null) { | 50 | if (mView == null) { |
| 43 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 51 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
| 44 | initView(mView); | 52 | initView(mView); |
| 45 | initData(); | 53 | initData(); |
| 46 | setLister(); | 54 | setLister(); |
| 47 | initTimePicker(); | 55 | initTimePicker(); |
| 48 | 56 | ||
| 49 | 57 | ||
| 50 | } | 58 | } |
| 51 | return mView; | 59 | return mView; |
| 52 | } | 60 | } |
| 53 | //初始化 | 61 | //初始化 |
| 54 | private void initView(View mView) { | 62 | private void initView(View mView) { |
| 55 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 63 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
| 56 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 64 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
| 57 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 65 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
| 58 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 66 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
| 59 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 67 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
| 60 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 68 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
| 61 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 69 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
| 62 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 70 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
| 63 | 71 | ||
| 64 | 72 | ||
| 65 | 73 | ||
| 66 | } | 74 | } |
| 67 | private void initData() { | 75 | private void initData() { |
| 68 | } | 76 | } |
| 69 | private void setLister() { | 77 | private void setLister() { |
| 70 | tv_sex.setOnClickListener(this); | 78 | tv_sex.setOnClickListener(this); |
| 71 | tv_useinfo_adress.setOnClickListener(this); | 79 | tv_useinfo_adress.setOnClickListener(this); |
| 72 | tv_useinfo_birthday.setOnClickListener(this); | 80 | tv_useinfo_birthday.setOnClickListener(this); |
| 73 | tv_useinfo_school.setOnClickListener(this); | 81 | tv_useinfo_school.setOnClickListener(this); |
| 74 | tv_useinfo_gender.setOnClickListener(this); | 82 | tv_useinfo_gender.setOnClickListener(this); |
| 75 | } | 83 | } |
| 76 | 84 | ||
| 77 | @Override | 85 | @Override |
| 78 | public void onClick(View v) { | 86 | public void onClick(View v) { |
| 79 | switch (v.getId()){ | 87 | switch (v.getId()){ |
| 80 | case R.id.tv_sex: | 88 | case R.id.tv_sex: |
| 81 | AlertUtils.showToast(getActivity(),"正在开发"); | 89 | final String[] items = {"男", "女"}; |
| 90 | new CircleDialog.Builder(getActivity()) | ||
| 91 | .configDialog(new ConfigDialog() { | ||
| 92 | @Override | ||
| 93 | public void onConfig(DialogParams params) { | ||
| 94 | //增加弹出动画 | ||
| 95 | params.gravity = Gravity.CENTER; | ||
| 96 | } | ||
| 97 | }) | ||
| 98 | .setTitle("请选择性别") | ||
| 99 | .setWidth(0.5f) | ||
| 100 | .setItems(items, new AdapterView.OnItemClickListener() { | ||
| 101 | @Override | ||
| 102 | public void onItemClick(AdapterView<?> parent, View view, int | ||
| 103 | position, long id) { | ||
| 104 | switch (position){ | ||
| 105 | case 0: | ||
| 106 | tv_sex.setText("男"); | ||
| 107 | break; | ||
| 108 | case 1: | ||
| 109 | tv_sex.setText("女"); | ||
| 110 | break; | ||
| 111 | } | ||
| 112 | |||
| 113 | } | ||
| 114 | }) | ||
| 115 | .setNegative("取消", null) | ||
| 116 | .configNegative(new ConfigButton() { | ||
| 117 | @Override | ||
| 118 | public void onConfig(ButtonParams params) { | ||
| 119 | //取消按钮字体颜色 | ||
| 120 | params.textColor = Color.RED; | ||
| 121 | } | ||
| 122 | }) | ||
| 123 | .show(); | ||
| 82 | break; | 124 | break; |
| 83 | case R.id.tv_useinfo_adress: | 125 | case R.id.tv_useinfo_adress: |
| 84 | AlertUtils.showToast(getActivity(),"正在开发"); | 126 | //ProvinceListDialog.getInstance(getActivity()).show(getSupportFragmentManager(), "ProvinceListDialog"); |
| 85 | break; | 127 | break; |
| 86 | case R.id.tv_useinfo_birthday: | 128 | case R.id.tv_useinfo_birthday: |
| 87 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 129 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
| 88 | break; | 130 | break; |
| 89 | case R.id.tv_useinfo_school: | 131 | case R.id.tv_useinfo_school: |
| 90 | AlertUtils.showToast(getActivity(),"正在开发"); | 132 | //SchoolListDialog.getInstance(getActivity()).show(getSupportFragmentManager(), "SchoolListDialog"); |
| 133 | |||
| 91 | break; | 134 | break; |
| 92 | case R.id.tv_useinfo_gender: | 135 | case R.id.tv_useinfo_gender: |
| 93 | AlertUtils.showToast(getActivity(),"正在开发"); | 136 | //GradeListDialog.getInstance(getActivity()).show(getSupportFragmentManager(), "GradeListDialog"); |
| 137 | break; | ||
| 138 | case R.id.presonal_sub: | ||
| 139 | AlertUtils.showToast(getActivity(),"你点击了提交"); | ||
| 140 | //保存星座 | ||
| 141 | // BrithdayStar brithdayStar = new BrithdayStar(); | ||
| 142 | // String s =brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | ||
| 94 | break; | 143 | break; |
| 95 | } | 144 | } |
| 96 | } | 145 | } |
| 97 | //自定义时间选择器 | 146 | //自定义时间选择器 |
| 98 | private void initTimePicker() { | 147 | private void initTimePicker() { |
| 99 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 148 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
| 100 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 149 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
| 101 | // Calendar selectedDate = Calendar.getInstance(); | 150 | // Calendar selectedDate = Calendar.getInstance(); |
| 102 | // Calendar startDate = Calendar.getInstance(); | 151 | // Calendar startDate = Calendar.getInstance(); |
| 103 | // startDate.set(1900, 1, 1); | 152 | // startDate.set(1900, 1, 1); |
| 104 | // Calendar endDate = Calendar.getInstance(); | 153 | // Calendar endDate = Calendar.getInstance(); |
| 105 | // endDate.set(2100, 1, 1); | 154 | // endDate.set(2100, 1, 1); |
| 106 | //时间选择器 | 155 | //时间选择器 |
| 107 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 156 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
| 108 | @Override | 157 | @Override |
| 109 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 158 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
| 110 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 159 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
| 111 | /*btn_Time.setText(getTime(date));*/ | 160 | /*btn_Time.setText(getTime(date));*/ |
| 112 | TextView btn = (TextView) v; | 161 | TextView btn = (TextView) v; |
| 113 | btn.setText(getTime(date)); | 162 | btn.setText(getTime(date)); |
| 114 | } | 163 | } |
| 115 | }) | 164 | }) |
| 116 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 165 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
| 117 | .setType(new boolean[]{true, true, true, false, false, false}) | 166 | .setType(new boolean[]{true, true, true, false, false, false}) |
| 118 | .setLabel("", "", "", "", "", "") | 167 | .setLabel("", "", "", "", "", "") |
| 119 | .isCenterLabel(false) | 168 | .isCenterLabel(false) |
| 120 | .setDividerColor(Color.DKGRAY) | 169 | .setDividerColor(Color.DKGRAY) |
| 121 | .setContentSize(21) | 170 | .setContentSize(21) |
| 122 | // .setDate(selectedDate) | 171 | // .setDate(selectedDate) |
| 123 | // .setRangDate(startDate, endDate) | 172 | // .setRangDate(startDate, endDate) |
| 124 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 173 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
| 125 | .setDecorView(null) | 174 | .setDecorView(null) |
| 126 | .setTitleText("购买日期") | 175 | .setTitleText("购买日期") |
| 127 | .setTitleSize(22) | 176 | .setTitleSize(22) |
| 128 | .setCancelColor(Color.GRAY) | 177 | .setCancelColor(Color.GRAY) |
| 129 | .setSubCalSize(22) | 178 | .setSubCalSize(22) |
| 130 | .setDividerColor(Color.GRAY) | 179 | .setDividerColor(Color.GRAY) |
| 131 | .setSubmitColor(Color.GRAY) | 180 | .setSubmitColor(Color.GRAY) |
| 132 | .build(); | 181 | .build(); |
| 133 | } | 182 | } |
| 134 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 183 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
| 135 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 184 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| 136 | return format.format(date); | 185 | return format.format(date); |
| 137 | } | 186 | } |
| 187 | |||
| 188 | @Override | ||
| 189 | public void onAttach(Activity activity) { | ||
| 190 | super.onAttach(activity); | ||
| 191 | View rootView = activity.getWindow().getDecorView(); | ||
| 192 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | ||
| 193 | sub.setOnClickListener(this); | ||
| 194 | } | ||
| 138 | } | 195 | } |
| 139 | 196 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
| 1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * Created by wei on 2017/6/21. | 4 | * Created by wei on 2017/6/21. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | public class HttpCode { | 7 | public class HttpCode { |
| 8 | //查询保卡信息 | 8 | //查询保卡信息 |
| 9 | public static final int SUCHCARDINFO = 1; | 9 | public static final int SUCHCARDINFO = 1; |
| 10 | //是否填写保卡信息 | 10 | //是否填写保卡信息 |
| 11 | public static final int CHECKCARD = 1; | 11 | public static final int CHECKCARD = 1; |
| 12 | //注册 | 12 | //注册 |
| 13 | public static final int REGISTERED_SUCESS = 2; | 13 | public static final int REGISTERED_SUCESS = 2; |
| 14 | public static final int REGISTERED_FAIL = 3; | 14 | public static final int REGISTERED_FAIL = 3; |
| 15 | //注册验证码 | 15 | //注册验证码 |
| 16 | public static final int AUTHCODE_SUCESS = 4; | 16 | public static final int AUTHCODE_SUCESS = 4; |
| 17 | public static final int AUTHCODE_FAIL = 5; | 17 | public static final int AUTHCODE_FAIL = 5; |
| 18 | //忘记密码验证码 | 18 | //忘记密码验证码 |
| 19 | public static final int AUTHCODE_SUCESS1 = 6; | 19 | public static final int AUTHCODE_SUCESS1 = 6; |
| 20 | public static final int AUTHCODE_FAIL1 = 7; | 20 | public static final int AUTHCODE_FAIL1 = 7; |
| 21 | //是否已经注册 | 21 | //是否已经注册 |
| 22 | public static final int IS_REFISTER = 8; | 22 | public static final int IS_REFISTER = 8; |
| 23 | //忘记密码 | 23 | //忘记密码 |
| 24 | public static final int PASSWORD_SUCESS = 9; | 24 | public static final int PASSWORD_SUCESS = 9; |
| 25 | public static final int PASSWORD_FAIL = 10; | 25 | public static final int PASSWORD_FAIL = 10; |
| 26 | //s省 | 26 | //s省 |
| 27 | public static final int PROVICES = 11; | 27 | public static final int PROVICES = 11; |
| 28 | //市 | 28 | //市 |
| 29 | public static final int CITYS = 12; | 29 | public static final int CITYS = 12; |
| 30 | //区 | 30 | //区 |
| 31 | public static final int COUNTRY = 13; | 31 | public static final int COUNTRY = 13; |
| 32 | //学校 | 32 | //学校 |
| 33 | public static final int SCHOOL = 14; | 33 | public static final int SCHOOL = 14; |
| 34 | //私人订制查询 | 34 | //年级 |
| 35 | public static final int PRIVATEDZ = 15; | 35 | public static final int GRADER = 15; |
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | } | 39 | } |
| 40 | 40 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
| 1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.app.ProgressDialog; | 4 | import android.app.ProgressDialog; |
| 5 | import android.content.ComponentName; | 5 | import android.content.ComponentName; |
| 6 | import android.content.Context; | 6 | import android.content.Context; |
| 7 | import android.content.Intent; | 7 | import android.content.Intent; |
| 8 | import android.os.Handler; | 8 | import android.os.Handler; |
| 9 | import android.os.Message; | 9 | import android.os.Message; |
| 10 | import android.provider.Settings; | 10 | import android.provider.Settings; |
| 11 | import android.support.v4.app.FragmentActivity; | 11 | import android.support.v4.app.FragmentActivity; |
| 12 | import android.util.Log; | 12 | import android.util.Log; |
| 13 | import android.view.Gravity; | 13 | import android.view.Gravity; |
| 14 | import android.view.View; | 14 | import android.view.View; |
| 15 | import android.widget.Toast; | 15 | import android.widget.Toast; |
| 16 | 16 | ||
| 17 | import com.google.gson.Gson; | 17 | import com.google.gson.Gson; |
| 18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
| 19 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 19 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
| 20 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 20 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
| 21 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
| 22 | import com.hjx.personalcenter.gson.GsonTool; | 22 | import com.hjx.personalcenter.gson.GsonTool; |
| 23 | import com.hjx.personalcenter.model.CardInfo; | ||
| 23 | import com.hjx.personalcenter.model.CityInfo; | 24 | import com.hjx.personalcenter.model.CityInfo; |
| 24 | import com.hjx.personalcenter.model.CountyInfo; | 25 | import com.hjx.personalcenter.model.CountyInfo; |
| 25 | import com.hjx.personalcenter.model.GradeInfo; | 26 | import com.hjx.personalcenter.model.GradeInfo; |
| 26 | import com.hjx.personalcenter.model.ProvinceInfo; | 27 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 27 | import com.hjx.personalcenter.model.SchoolInfo; | 28 | import com.hjx.personalcenter.model.SchoolInfo; |
| 28 | import com.hjx.personalcenter.util.DialogPermission; | 29 | import com.hjx.personalcenter.util.DialogPermission; |
| 29 | import com.loopj.android.http.AsyncHttpResponseHandler; | 30 | import com.loopj.android.http.AsyncHttpResponseHandler; |
| 30 | import com.loopj.android.http.JsonHttpResponseHandler; | 31 | import com.loopj.android.http.JsonHttpResponseHandler; |
| 31 | import com.loopj.android.http.RequestParams; | 32 | import com.loopj.android.http.RequestParams; |
| 32 | import com.mylhyl.circledialog.CircleDialog; | 33 | import com.mylhyl.circledialog.CircleDialog; |
| 33 | import com.mylhyl.circledialog.callback.ConfigText; | 34 | import com.mylhyl.circledialog.callback.ConfigText; |
| 34 | import com.mylhyl.circledialog.params.TextParams; | 35 | import com.mylhyl.circledialog.params.TextParams; |
| 35 | 36 | ||
| 36 | import org.apache.http.Header; | 37 | import org.apache.http.Header; |
| 37 | import org.apache.http.entity.ByteArrayEntity; | 38 | import org.apache.http.entity.ByteArrayEntity; |
| 38 | import org.apache.http.message.BasicHeader; | 39 | import org.apache.http.message.BasicHeader; |
| 39 | import org.apache.http.protocol.HTTP; | 40 | import org.apache.http.protocol.HTTP; |
| 40 | import org.json.JSONException; | 41 | import org.json.JSONException; |
| 41 | import org.json.JSONObject; | 42 | import org.json.JSONObject; |
| 42 | 43 | ||
| 43 | import java.io.UnsupportedEncodingException; | 44 | import java.io.UnsupportedEncodingException; |
| 44 | import java.util.List; | 45 | import java.util.List; |
| 45 | 46 | ||
| 46 | public class HttpManager { | 47 | public class HttpManager { |
| 47 | private static HttpManager instance; | 48 | private static HttpManager instance; |
| 48 | private ProgressDialog mProgress = null; | 49 | private ProgressDialog mProgress = null; |
| 49 | 50 | ||
| 50 | public static HttpManager getInstance() { | 51 | public static HttpManager getInstance() { |
| 51 | if (instance == null) { | 52 | if (instance == null) { |
| 52 | instance = new HttpManager(); | 53 | instance = new HttpManager(); |
| 53 | } | 54 | } |
| 54 | return instance; | 55 | return instance; |
| 55 | } | 56 | } |
| 56 | 57 | ||
| 57 | 58 | ||
| 58 | //登录接口 | 59 | //登录接口 |
| 59 | 60 | ||
| 60 | public void login(final String username, final String password, final Context mContext) { | 61 | public void login(final String username, final String password, final Context mContext) { |
| 61 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 62 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
| 62 | false, true, null); | 63 | false, true, null); |
| 63 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 64 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 64 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 65 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
| 65 | @Override | 66 | @Override |
| 66 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 67 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 67 | 68 | ||
| 68 | String str = new String(arg2); | 69 | String str = new String(arg2); |
| 69 | JSONObject jsonObject = null; | 70 | JSONObject jsonObject = null; |
| 70 | try { | 71 | try { |
| 71 | jsonObject = new JSONObject(new String(arg2)); | 72 | jsonObject = new JSONObject(new String(arg2)); |
| 72 | String status = jsonObject.getString("status"); | 73 | String status = jsonObject.getString("status"); |
| 73 | if (status.equals("100")) { | 74 | if (status.equals("100")) { |
| 74 | String access_token = jsonObject.getString("access_token"); | 75 | String access_token = jsonObject.getString("access_token"); |
| 75 | String userId = jsonObject.getString("userId"); | 76 | String userId = jsonObject.getString("userId"); |
| 76 | // //登录成功,保存登录数据并且获取个人信息 | 77 | // //登录成功,保存登录数据并且获取个人信息 |
| 77 | saveLoginInfo(mContext, username, password, access_token, "true", userId); | 78 | saveLoginInfo(mContext, username, password, access_token, "true", userId); |
| 78 | //HttpManager.getInstance().getuserinfo(username,mContext); | 79 | //HttpManager.getInstance().getuserinfo(username,mContext); |
| 79 | 80 | ||
| 80 | } else if (status.equals("200")) { | 81 | } else if (status.equals("200")) { |
| 81 | closeProgress(); | 82 | closeProgress(); |
| 82 | Toast.makeText(mContext, "用户名不存在!", Toast.LENGTH_LONG).show(); | 83 | Toast.makeText(mContext, "用户名不存在!", Toast.LENGTH_LONG).show(); |
| 83 | return; | 84 | return; |
| 84 | } else if (status.equals("204")) { | 85 | } else if (status.equals("204")) { |
| 85 | closeProgress(); | 86 | closeProgress(); |
| 86 | Toast.makeText(mContext, "密码错误!", Toast.LENGTH_LONG).show(); | 87 | Toast.makeText(mContext, "密码错误!", Toast.LENGTH_LONG).show(); |
| 87 | } else { | 88 | } else { |
| 88 | closeProgress(); | 89 | closeProgress(); |
| 89 | Toast.makeText(mContext, "登录失败!请检查网络", Toast.LENGTH_LONG).show(); | 90 | Toast.makeText(mContext, "登录失败!请检查网络", Toast.LENGTH_LONG).show(); |
| 90 | 91 | ||
| 91 | 92 | ||
| 92 | } | 93 | } |
| 93 | } catch (JSONException e) { | 94 | } catch (JSONException e) { |
| 94 | e.printStackTrace(); | 95 | e.printStackTrace(); |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | 98 | ||
| 98 | } | 99 | } |
| 99 | 100 | ||
| 100 | @Override | 101 | @Override |
| 101 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 102 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 102 | closeProgress(); | 103 | closeProgress(); |
| 103 | new CircleDialog.Builder((FragmentActivity) mContext) | 104 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 104 | .setCanceledOnTouchOutside(false) | 105 | .setCanceledOnTouchOutside(false) |
| 105 | .setCancelable(false) | 106 | .setCancelable(false) |
| 106 | .setWidth(0.5f) | 107 | .setWidth(0.5f) |
| 107 | .configText(new ConfigText() { | 108 | .configText(new ConfigText() { |
| 108 | @Override | 109 | @Override |
| 109 | public void onConfig(TextParams params) { | 110 | public void onConfig(TextParams params) { |
| 110 | params.gravity = Gravity.CENTER; | 111 | params.gravity = Gravity.CENTER; |
| 111 | params.padding = new int[]{50, 50, 50, 50}; | 112 | params.padding = new int[]{50, 50, 50, 50}; |
| 112 | } | 113 | } |
| 113 | }) | 114 | }) |
| 114 | .setText("当前无网络,请检查网络设置") | 115 | .setText("当前无网络,请检查网络设置") |
| 115 | .setNegative("继续使用", null) | 116 | .setNegative("继续使用", null) |
| 116 | .setPositive("设置网络", new View.OnClickListener() { | 117 | .setPositive("设置网络", new View.OnClickListener() { |
| 117 | @Override | 118 | @Override |
| 118 | public void onClick(View v) { | 119 | public void onClick(View v) { |
| 119 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 120 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 120 | mContext.startActivity(intent); | 121 | mContext.startActivity(intent); |
| 121 | } | 122 | } |
| 122 | }) | 123 | }) |
| 123 | .show(); | 124 | .show(); |
| 124 | } | 125 | } |
| 125 | }); | 126 | }); |
| 126 | } | 127 | } |
| 127 | 128 | ||
| 128 | //注册接口 | 129 | //注册接口 |
| 129 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 130 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
| 130 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 131 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
| 131 | false, true, null); | 132 | false, true, null); |
| 132 | JSONObject jsonObject = new JSONObject(); | 133 | JSONObject jsonObject = new JSONObject(); |
| 133 | ByteArrayEntity entity = null; | 134 | ByteArrayEntity entity = null; |
| 134 | try { | 135 | try { |
| 135 | jsonObject.put(HttpKey.USERNAME, username); | 136 | jsonObject.put(HttpKey.USERNAME, username); |
| 136 | jsonObject.put(HttpKey.PASSWORD, password); | 137 | jsonObject.put(HttpKey.PASSWORD, password); |
| 137 | jsonObject.put(HttpKey.SMSCODE, smscode); | 138 | jsonObject.put(HttpKey.SMSCODE, smscode); |
| 138 | jsonObject.put(HttpKey.SOURCE, source); | 139 | jsonObject.put(HttpKey.SOURCE, source); |
| 139 | Log.e("test", "jsonObject" + jsonObject); | 140 | Log.e("test", "jsonObject" + jsonObject); |
| 140 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 141 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
| 141 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 142 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
| 142 | } catch (JSONException e) { | 143 | } catch (JSONException e) { |
| 143 | e.printStackTrace(); | 144 | e.printStackTrace(); |
| 144 | } catch (UnsupportedEncodingException e) { | 145 | } catch (UnsupportedEncodingException e) { |
| 145 | e.printStackTrace(); | 146 | e.printStackTrace(); |
| 146 | } | 147 | } |
| 147 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 148 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 148 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 149 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
| 149 | @Override | 150 | @Override |
| 150 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 151 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 151 | super.onSuccess(statusCode, headers, response); | 152 | super.onSuccess(statusCode, headers, response); |
| 152 | closeProgress(); | 153 | closeProgress(); |
| 153 | Log.e("test", "onSuccess" + response); | 154 | Log.e("test", "onSuccess" + response); |
| 154 | Message msg = Message.obtain(); | 155 | Message msg = Message.obtain(); |
| 155 | msg.what = HttpCode.REGISTERED_SUCESS; | 156 | msg.what = HttpCode.REGISTERED_SUCESS; |
| 156 | msg.obj = response; | 157 | msg.obj = response; |
| 157 | handler.sendMessage(msg); | 158 | handler.sendMessage(msg); |
| 158 | 159 | ||
| 159 | } | 160 | } |
| 160 | 161 | ||
| 161 | @Override | 162 | @Override |
| 162 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 163 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 163 | super.onFailure(statusCode, headers, throwable, errorResponse); | 164 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 164 | closeProgress(); | 165 | closeProgress(); |
| 165 | Log.e("test", "onFailure" + errorResponse); | 166 | Log.e("test", "onFailure" + errorResponse); |
| 166 | new CircleDialog.Builder((FragmentActivity) context) | 167 | new CircleDialog.Builder((FragmentActivity) context) |
| 167 | .setCanceledOnTouchOutside(false) | 168 | .setCanceledOnTouchOutside(false) |
| 168 | .setCancelable(false) | 169 | .setCancelable(false) |
| 169 | .setWidth(0.5f) | 170 | .setWidth(0.5f) |
| 170 | .configText(new ConfigText() { | 171 | .configText(new ConfigText() { |
| 171 | @Override | 172 | @Override |
| 172 | public void onConfig(TextParams params) { | 173 | public void onConfig(TextParams params) { |
| 173 | params.gravity = Gravity.CENTER; | 174 | params.gravity = Gravity.CENTER; |
| 174 | params.padding = new int[]{50, 50, 50, 50}; | 175 | params.padding = new int[]{50, 50, 50, 50}; |
| 175 | } | 176 | } |
| 176 | }) | 177 | }) |
| 177 | .setText("当前无网络,请检查网络设置") | 178 | .setText("当前无网络,请检查网络设置") |
| 178 | .setNegative("继续使用", null) | 179 | .setNegative("继续使用", null) |
| 179 | .setPositive("设置网络", new View.OnClickListener() { | 180 | .setPositive("设置网络", new View.OnClickListener() { |
| 180 | @Override | 181 | @Override |
| 181 | public void onClick(View v) { | 182 | public void onClick(View v) { |
| 182 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 183 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 183 | context.startActivity(intent); | 184 | context.startActivity(intent); |
| 184 | } | 185 | } |
| 185 | }) | 186 | }) |
| 186 | .show(); | 187 | .show(); |
| 187 | } | 188 | } |
| 188 | 189 | ||
| 189 | }); | 190 | }); |
| 190 | } | 191 | } |
| 191 | 192 | ||
| 192 | //注册验证码 | 193 | //注册验证码 |
| 193 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 194 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
| 194 | RequestParams params = new RequestParams(); | 195 | RequestParams params = new RequestParams(); |
| 195 | params.put(HttpKey.TYPE, type); | 196 | params.put(HttpKey.TYPE, type); |
| 196 | params.put(HttpKey.MOBIL, mobile); | 197 | params.put(HttpKey.MOBIL, mobile); |
| 197 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 198 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 198 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 199 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
| 199 | 200 | ||
| 200 | @Override | 201 | @Override |
| 201 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 202 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 202 | Log.e("test", "onSuccess-----" + response); | 203 | Log.e("test", "onSuccess-----" + response); |
| 203 | Message msg = Message.obtain(); | 204 | Message msg = Message.obtain(); |
| 204 | msg.what = HttpCode.AUTHCODE_SUCESS; | 205 | msg.what = HttpCode.AUTHCODE_SUCESS; |
| 205 | msg.obj = response; | 206 | msg.obj = response; |
| 206 | handler.sendMessage(msg); | 207 | handler.sendMessage(msg); |
| 207 | } | 208 | } |
| 208 | 209 | ||
| 209 | @Override | 210 | @Override |
| 210 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 211 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 211 | new CircleDialog.Builder((FragmentActivity) mContext) | 212 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 212 | .setCanceledOnTouchOutside(false) | 213 | .setCanceledOnTouchOutside(false) |
| 213 | .setCancelable(false) | 214 | .setCancelable(false) |
| 214 | .setWidth(0.5f) | 215 | .setWidth(0.5f) |
| 215 | .configText(new ConfigText() { | 216 | .configText(new ConfigText() { |
| 216 | @Override | 217 | @Override |
| 217 | public void onConfig(TextParams params) { | 218 | public void onConfig(TextParams params) { |
| 218 | params.gravity = Gravity.CENTER; | 219 | params.gravity = Gravity.CENTER; |
| 219 | params.padding = new int[]{50, 50, 50, 50}; | 220 | params.padding = new int[]{50, 50, 50, 50}; |
| 220 | } | 221 | } |
| 221 | }) | 222 | }) |
| 222 | .setText("当前无网络,请检查网络设置") | 223 | .setText("当前无网络,请检查网络设置") |
| 223 | .setNegative("继续使用", null) | 224 | .setNegative("继续使用", null) |
| 224 | .setPositive("设置网络", new View.OnClickListener() { | 225 | .setPositive("设置网络", new View.OnClickListener() { |
| 225 | @Override | 226 | @Override |
| 226 | public void onClick(View v) { | 227 | public void onClick(View v) { |
| 227 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 228 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 228 | mContext.startActivity(intent); | 229 | mContext.startActivity(intent); |
| 229 | } | 230 | } |
| 230 | }) | 231 | }) |
| 231 | .show(); | 232 | .show(); |
| 232 | } | 233 | } |
| 233 | }); | 234 | }); |
| 234 | } | 235 | } |
| 235 | 236 | ||
| 236 | 237 | ||
| 237 | //手机号是否注册 | 238 | //手机号是否注册 |
| 238 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 239 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
| 239 | RequestParams params = new RequestParams(); | 240 | RequestParams params = new RequestParams(); |
| 240 | params.put(HttpKey.USERNAME, mobile); | 241 | params.put(HttpKey.USERNAME, mobile); |
| 241 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 242 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
| 242 | @Override | 243 | @Override |
| 243 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 244 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 244 | Log.e("test", "isregistered" + response.toString()); | 245 | Log.e("test", "isregistered" + response.toString()); |
| 245 | Message msg = Message.obtain(); | 246 | Message msg = Message.obtain(); |
| 246 | msg.what = HttpCode.IS_REFISTER; | 247 | msg.what = HttpCode.IS_REFISTER; |
| 247 | msg.obj = response; | 248 | msg.obj = response; |
| 248 | handler.sendMessage(msg); | 249 | handler.sendMessage(msg); |
| 249 | 250 | ||
| 250 | } | 251 | } |
| 251 | 252 | ||
| 252 | @Override | 253 | @Override |
| 253 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 254 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 254 | new CircleDialog.Builder((FragmentActivity) mContext) | 255 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 255 | .setCanceledOnTouchOutside(false) | 256 | .setCanceledOnTouchOutside(false) |
| 256 | .setCancelable(false) | 257 | .setCancelable(false) |
| 257 | .setWidth(0.5f) | 258 | .setWidth(0.5f) |
| 258 | .configText(new ConfigText() { | 259 | .configText(new ConfigText() { |
| 259 | @Override | 260 | @Override |
| 260 | public void onConfig(TextParams params) { | 261 | public void onConfig(TextParams params) { |
| 261 | params.gravity = Gravity.CENTER; | 262 | params.gravity = Gravity.CENTER; |
| 262 | params.padding = new int[]{50, 50, 50, 50}; | 263 | params.padding = new int[]{50, 50, 50, 50}; |
| 263 | } | 264 | } |
| 264 | }) | 265 | }) |
| 265 | .setText("当前无网络,请检查网络设置") | 266 | .setText("当前无网络,请检查网络设置") |
| 266 | .setNegative("继续使用", null) | 267 | .setNegative("继续使用", null) |
| 267 | .setPositive("设置网络", new View.OnClickListener() { | 268 | .setPositive("设置网络", new View.OnClickListener() { |
| 268 | @Override | 269 | @Override |
| 269 | public void onClick(View v) { | 270 | public void onClick(View v) { |
| 270 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 271 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 271 | mContext.startActivity(intent); | 272 | mContext.startActivity(intent); |
| 272 | } | 273 | } |
| 273 | }) | 274 | }) |
| 274 | .show(); | 275 | .show(); |
| 275 | 276 | ||
| 276 | } | 277 | } |
| 277 | }); | 278 | }); |
| 278 | } | 279 | } |
| 279 | 280 | ||
| 280 | //修改密码 | 281 | //修改密码 |
| 281 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 282 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
| 282 | RequestParams params = new RequestParams(); | 283 | RequestParams params = new RequestParams(); |
| 283 | params.put(HttpKey.USERNAME, username); | 284 | params.put(HttpKey.USERNAME, username); |
| 284 | params.put(HttpKey.OLDPASS, old_pwd1); | 285 | params.put(HttpKey.OLDPASS, old_pwd1); |
| 285 | params.put(HttpKey.NEWPASS, newpassword3); | 286 | params.put(HttpKey.NEWPASS, newpassword3); |
| 286 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 287 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 287 | HttpClient.getInstance().setTimeout(10 * 1000); | 288 | HttpClient.getInstance().setTimeout(10 * 1000); |
| 288 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 289 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
| 289 | @Override | 290 | @Override |
| 290 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 291 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 291 | try { | 292 | try { |
| 292 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 293 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 293 | String status = jsonObject.optString("status"); | 294 | String status = jsonObject.optString("status"); |
| 294 | if (status.equals("100")) { | 295 | if (status.equals("100")) { |
| 295 | Log.e("test", "onSuccess" + new String(bytes)); | 296 | Log.e("test", "onSuccess" + new String(bytes)); |
| 296 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 297 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 297 | SaveParam.getInstance().clearData((Activity) context); | 298 | SaveParam.getInstance().clearData((Activity) context); |
| 298 | Intent intent = new Intent(); | 299 | Intent intent = new Intent(); |
| 299 | intent.setClass(context, LoginAndRegisterActivity.class); | 300 | intent.setClass(context, LoginAndRegisterActivity.class); |
| 300 | ((Activity) context).startActivity(intent); | 301 | ((Activity) context).startActivity(intent); |
| 301 | ((Activity) context).finish(); | 302 | ((Activity) context).finish(); |
| 302 | } | 303 | } |
| 303 | } catch (JSONException e) { | 304 | } catch (JSONException e) { |
| 304 | e.printStackTrace(); | 305 | e.printStackTrace(); |
| 305 | } | 306 | } |
| 306 | } | 307 | } |
| 307 | 308 | ||
| 308 | @Override | 309 | @Override |
| 309 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 310 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 310 | Log.e("test", "onFailure" + new String(bytes)); | 311 | Log.e("test", "onFailure" + new String(bytes)); |
| 311 | new CircleDialog.Builder((FragmentActivity) context) | 312 | new CircleDialog.Builder((FragmentActivity) context) |
| 312 | .setCanceledOnTouchOutside(false) | 313 | .setCanceledOnTouchOutside(false) |
| 313 | .setCancelable(false) | 314 | .setCancelable(false) |
| 314 | .setWidth(0.5f) | 315 | .setWidth(0.5f) |
| 315 | .configText(new ConfigText() { | 316 | .configText(new ConfigText() { |
| 316 | @Override | 317 | @Override |
| 317 | public void onConfig(TextParams params) { | 318 | public void onConfig(TextParams params) { |
| 318 | params.gravity = Gravity.CENTER; | 319 | params.gravity = Gravity.CENTER; |
| 319 | params.padding = new int[]{50, 50, 50, 50}; | 320 | params.padding = new int[]{50, 50, 50, 50}; |
| 320 | } | 321 | } |
| 321 | }) | 322 | }) |
| 322 | .setText("当前无网络,请检查网络设置") | 323 | .setText("当前无网络,请检查网络设置") |
| 323 | .setNegative("继续使用", null) | 324 | .setNegative("继续使用", null) |
| 324 | .setPositive("设置网络", new View.OnClickListener() { | 325 | .setPositive("设置网络", new View.OnClickListener() { |
| 325 | @Override | 326 | @Override |
| 326 | public void onClick(View v) { | 327 | public void onClick(View v) { |
| 327 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 328 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 328 | context.startActivity(intent); | 329 | context.startActivity(intent); |
| 329 | } | 330 | } |
| 330 | }) | 331 | }) |
| 331 | .show(); | 332 | .show(); |
| 332 | } | 333 | } |
| 333 | }); | 334 | }); |
| 334 | 335 | ||
| 335 | } | 336 | } |
| 336 | 337 | ||
| 337 | //忘记密码 | 338 | //忘记密码 |
| 338 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 339 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
| 339 | RequestParams params = new RequestParams(); | 340 | RequestParams params = new RequestParams(); |
| 340 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 341 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
| 341 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 342 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
| 342 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 343 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
| 343 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 344 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 344 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 345 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
| 345 | @Override | 346 | @Override |
| 346 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 347 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 347 | try { | 348 | try { |
| 348 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 349 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 349 | String status = jsonObject.optString("status"); | 350 | String status = jsonObject.optString("status"); |
| 350 | if (status.equals("100")) { | 351 | if (status.equals("100")) { |
| 351 | Log.e("test", "onSuccess" + new String(bytes)); | 352 | Log.e("test", "onSuccess" + new String(bytes)); |
| 352 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 353 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 353 | ((Activity) context).finish(); | 354 | ((Activity) context).finish(); |
| 354 | } | 355 | } |
| 355 | } catch (JSONException e) { | 356 | } catch (JSONException e) { |
| 356 | e.printStackTrace(); | 357 | e.printStackTrace(); |
| 357 | } | 358 | } |
| 358 | } | 359 | } |
| 359 | 360 | ||
| 360 | @Override | 361 | @Override |
| 361 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 362 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 362 | Log.e("test", "onFailure" + new String(bytes)); | 363 | Log.e("test", "onFailure" + new String(bytes)); |
| 363 | new CircleDialog.Builder((FragmentActivity) context) | 364 | new CircleDialog.Builder((FragmentActivity) context) |
| 364 | .setCanceledOnTouchOutside(false) | 365 | .setCanceledOnTouchOutside(false) |
| 365 | .setCancelable(false) | 366 | .setCancelable(false) |
| 366 | .setWidth(0.5f) | 367 | .setWidth(0.5f) |
| 367 | .configText(new ConfigText() { | 368 | .configText(new ConfigText() { |
| 368 | @Override | 369 | @Override |
| 369 | public void onConfig(TextParams params) { | 370 | public void onConfig(TextParams params) { |
| 370 | params.gravity = Gravity.CENTER; | 371 | params.gravity = Gravity.CENTER; |
| 371 | params.padding = new int[]{50, 50, 50, 50}; | 372 | params.padding = new int[]{50, 50, 50, 50}; |
| 372 | } | 373 | } |
| 373 | }) | 374 | }) |
| 374 | .setText("当前无网络,请检查网络设置") | 375 | .setText("当前无网络,请检查网络设置") |
| 375 | .setNegative("继续使用", null) | 376 | .setNegative("继续使用", null) |
| 376 | .setPositive("设置网络", new View.OnClickListener() { | 377 | .setPositive("设置网络", new View.OnClickListener() { |
| 377 | @Override | 378 | @Override |
| 378 | public void onClick(View v) { | 379 | public void onClick(View v) { |
| 379 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 380 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 380 | context.startActivity(intent); | 381 | context.startActivity(intent); |
| 381 | } | 382 | } |
| 382 | }) | 383 | }) |
| 383 | .show(); | 384 | .show(); |
| 384 | } | 385 | } |
| 385 | }); | 386 | }); |
| 386 | 387 | ||
| 387 | } | 388 | } |
| 388 | 389 | ||
| 389 | //保存用户登录信息 | 390 | //保存用户登录信息 |
| 390 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { | 391 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { |
| 391 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 392 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
| 392 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 393 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
| 393 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 394 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
| 394 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); | 395 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); |
| 395 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 396 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
| 396 | 397 | ||
| 397 | 398 | ||
| 398 | } | 399 | } |
| 399 | 400 | ||
| 400 | //保存用户个人信息 | 401 | //保存用户个人信息 |
| 401 | public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) { | 402 | public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) { |
| 402 | SaveParam.getInstance().saveLoginParam(context, "lastname", lastname); | 403 | SaveParam.getInstance().saveLoginParam(context, "lastname", lastname); |
| 403 | SaveParam.getInstance().saveLoginParam(context, "gender", gender); | 404 | SaveParam.getInstance().saveLoginParam(context, "gender", gender); |
| 404 | SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait); | 405 | SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait); |
| 405 | } | 406 | } |
| 406 | 407 | ||
| 407 | //提交保卡信息 | 408 | //提交保卡信息 |
| 408 | public void subcardinfo(final Context context, int userId, String customerName, String customerAddress, | 409 | public void subcardinfo(final Context context, int userId, String customerName, String customerAddress, |
| 409 | String buyAddress, String buyTime, String alterSaleCall, | 410 | String buyAddress, String buyTime, String alterSaleCall, |
| 410 | String productModel, String deviceNumber, String macAddress, | 411 | String productModel, String deviceNumber, String macAddress, |
| 411 | String mobilePhone) { | 412 | String mobilePhone) { |
| 412 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 413 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
| 413 | false, true, null); | 414 | false, true, null); |
| 414 | RequestParams params = new RequestParams(); | 415 | RequestParams params = new RequestParams(); |
| 415 | 416 | ||
| 416 | params.put(HttpKey.USEID, userId); | 417 | params.put(HttpKey.USEID, userId); |
| 417 | params.put(HttpKey.CUSTOMENAME, customerName); | 418 | params.put(HttpKey.CUSTOMENAME, customerName); |
| 418 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 419 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
| 419 | params.put(HttpKey.BUYADREES, buyAddress); | 420 | params.put(HttpKey.BUYADREES, buyAddress); |
| 420 | params.put(HttpKey.BUYTIME, buyTime); | 421 | params.put(HttpKey.BUYTIME, buyTime); |
| 421 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 422 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
| 422 | params.put(HttpKey.PRODUCTMODEL, productModel); | 423 | params.put(HttpKey.PRODUCTMODEL, productModel); |
| 423 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 424 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
| 424 | params.put(HttpKey.MACADRESS, macAddress); | 425 | params.put(HttpKey.MACADRESS, macAddress); |
| 425 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 426 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
| 426 | 427 | ||
| 427 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 428 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 428 | 429 | ||
| 429 | Log.e("test", "params" + params); | 430 | Log.e("test", "params" + params); |
| 430 | HttpClient.getInstance().setTimeout(5 * 1000); | 431 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 431 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 432 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
| 432 | @Override | 433 | @Override |
| 433 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 434 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 434 | JSONObject jsonObject = null; | 435 | JSONObject jsonObject = null; |
| 435 | closeProgress(); | 436 | closeProgress(); |
| 436 | try { | 437 | try { |
| 437 | jsonObject = new JSONObject(new String(bytes)); | 438 | jsonObject = new JSONObject(new String(bytes)); |
| 438 | String status = jsonObject.optString("status"); | 439 | String status = jsonObject.optString("status"); |
| 439 | if (status.equals("1")) { | 440 | if (status.equals("1")) { |
| 440 | Log.e("test", "onSuccess" + jsonObject); | 441 | Log.e("test", "onSuccess" + jsonObject); |
| 441 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 442 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
| 442 | Intent intent = new Intent(); | 443 | Intent intent = new Intent(); |
| 443 | intent.setClass((Activity) context, TheStartPageActivity.class); | 444 | intent.setClass((Activity) context, TheStartPageActivity.class); |
| 444 | ((Activity) context).startActivity(intent); | 445 | ((Activity) context).startActivity(intent); |
| 445 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 446 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 446 | ((Activity) context).finish(); | 447 | ((Activity) context).finish(); |
| 447 | } | 448 | } |
| 448 | } catch (JSONException e) { | 449 | } catch (JSONException e) { |
| 449 | e.printStackTrace(); | 450 | e.printStackTrace(); |
| 450 | } | 451 | } |
| 451 | 452 | ||
| 452 | 453 | ||
| 453 | } | 454 | } |
| 454 | 455 | ||
| 455 | @Override | 456 | @Override |
| 456 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 457 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 457 | Log.e("test", "onFailure" + (throwable)); | 458 | Log.e("test", "onFailure" + (throwable)); |
| 458 | closeProgress(); | 459 | closeProgress(); |
| 459 | new CircleDialog.Builder((FragmentActivity) context) | 460 | new CircleDialog.Builder((FragmentActivity) context) |
| 460 | .setCanceledOnTouchOutside(false) | 461 | .setCanceledOnTouchOutside(false) |
| 461 | .setCancelable(false) | 462 | .setCancelable(false) |
| 462 | .setWidth(0.5f) | 463 | .setWidth(0.5f) |
| 463 | .configText(new ConfigText() { | 464 | .configText(new ConfigText() { |
| 464 | @Override | 465 | @Override |
| 465 | public void onConfig(TextParams params) { | 466 | public void onConfig(TextParams params) { |
| 466 | params.gravity = Gravity.CENTER; | 467 | params.gravity = Gravity.CENTER; |
| 467 | params.padding = new int[]{50, 50, 50, 50}; | 468 | params.padding = new int[]{50, 50, 50, 50}; |
| 468 | } | 469 | } |
| 469 | }) | 470 | }) |
| 470 | .setText("当前无网络,请检查网络设置") | 471 | .setText("当前无网络,请检查网络设置") |
| 471 | .setNegative("继续使用", null) | 472 | .setNegative("继续使用", null) |
| 472 | .setPositive("设置网络", new View.OnClickListener() { | 473 | .setPositive("设置网络", new View.OnClickListener() { |
| 473 | @Override | 474 | @Override |
| 474 | public void onClick(View v) { | 475 | public void onClick(View v) { |
| 475 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 476 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 476 | context.startActivity(intent); | 477 | context.startActivity(intent); |
| 477 | } | 478 | } |
| 478 | }) | 479 | }) |
| 479 | .show(); | 480 | .show(); |
| 480 | 481 | ||
| 481 | } | 482 | } |
| 482 | }); | 483 | }); |
| 483 | 484 | ||
| 484 | } | 485 | } |
| 485 | //获取保卡信息 | 486 | //获取保卡信息 |
| 486 | public void getcardinfo(final Context mContext, int userId , final Handler handler) { | 487 | public void getcardinfo(final Context mContext, int userId , final Handler handler) { |
| 487 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 488 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
| 488 | false, true, null); | 489 | false, true, null); |
| 489 | HttpClient.getInstance().setTimeout(5 * 1000); | 490 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 490 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 491 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 491 | HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() { | 492 | HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() { |
| 492 | @Override | 493 | @Override |
| 493 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 494 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 494 | closeProgress(); | 495 | closeProgress(); |
| 495 | Log.e("test", "省" + new String(arg2)); | 496 | Log.e("test", "保卡信息" + new String(arg2)); |
| 497 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | ||
| 498 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | ||
| 496 | Message msg = Message.obtain(); | 499 | Message msg = Message.obtain(); |
| 497 | msg.what = HttpCode.SUCHCARDINFO; | 500 | msg.what = HttpCode.SUCHCARDINFO; |
| 498 | msg.obj = new String(arg2); | 501 | msg.obj = schoolInfoBeanList; |
| 499 | handler.sendMessage(msg); | 502 | handler.sendMessage(msg); |
| 500 | } | 503 | } |
| 501 | 504 | ||
| 502 | @Override | 505 | @Override |
| 503 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 506 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 504 | closeProgress(); | 507 | closeProgress(); |
| 505 | new CircleDialog.Builder((FragmentActivity) mContext) | 508 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 506 | .setCanceledOnTouchOutside(false) | 509 | .setCanceledOnTouchOutside(false) |
| 507 | .setCancelable(false) | 510 | .setCancelable(false) |
| 508 | .setWidth(0.5f) | 511 | .setWidth(0.5f) |
| 509 | .configText(new ConfigText() { | 512 | .configText(new ConfigText() { |
| 510 | @Override | 513 | @Override |
| 511 | public void onConfig(TextParams params) { | 514 | public void onConfig(TextParams params) { |
| 512 | params.gravity = Gravity.CENTER; | 515 | params.gravity = Gravity.CENTER; |
| 513 | params.padding = new int[]{50, 50, 50, 50}; | 516 | params.padding = new int[]{50, 50, 50, 50}; |
| 514 | } | 517 | } |
| 515 | }) | 518 | }) |
| 516 | .setText("当前无网络,请检查网络设置") | 519 | .setText("当前无网络,请检查网络设置") |
| 517 | .setNegative("继续使用", null) | 520 | .setNegative("继续使用", null) |
| 518 | .setPositive("设置网络", new View.OnClickListener() { | 521 | .setPositive("设置网络", new View.OnClickListener() { |
| 519 | @Override | 522 | @Override |
| 520 | public void onClick(View v) { | 523 | public void onClick(View v) { |
| 521 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 524 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 522 | mContext.startActivity(intent); | 525 | mContext.startActivity(intent); |
| 523 | } | 526 | } |
| 524 | }) | 527 | }) |
| 525 | .show(); | 528 | .show(); |
| 526 | } | 529 | } |
| 527 | }); | 530 | }); |
| 528 | } | 531 | } |
| 529 | //修改保卡信息电话 | 532 | //修改保卡信息电话 |
| 530 | public void changecardinfophone(final Context mContext, int userId, final String customerPhone, String authCode) { | 533 | public void changecardinfophone(final Context mContext, int userId, final String customerPhone, String authCode) { |
| 531 | RequestParams params = new RequestParams(); | 534 | RequestParams params = new RequestParams(); |
| 532 | params.put("userId", userId); | 535 | params.put("userId", userId); |
| 533 | params.put("customerPhone", customerPhone); | 536 | params.put("customerPhone", customerPhone); |
| 534 | params.put("authCode", authCode); | 537 | params.put("authCode", authCode); |
| 535 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 538 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 536 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 539 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 537 | @Override | 540 | @Override |
| 538 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 541 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 539 | try { | 542 | try { |
| 540 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 543 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 541 | String status = jsonObject.optString("status"); | 544 | String status = jsonObject.optString("status"); |
| 542 | if (status.equals("1")) { | 545 | if (status.equals("1")) { |
| 543 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 546 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 544 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone); | 547 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone); |
| 545 | ((Activity) mContext).finish(); | 548 | ((Activity) mContext).finish(); |
| 546 | }else if (status.equals("1001")){ | 549 | }else if (status.equals("1001")){ |
| 547 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 550 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 548 | } | 551 | } |
| 549 | } catch (JSONException e) { | 552 | } catch (JSONException e) { |
| 550 | e.printStackTrace(); | 553 | e.printStackTrace(); |
| 551 | } | 554 | } |
| 552 | } | 555 | } |
| 553 | 556 | ||
| 554 | @Override | 557 | @Override |
| 555 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 558 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 556 | Log.e("test", "onFailure" + new String(bytes)); | 559 | Log.e("test", "onFailure" + new String(bytes)); |
| 557 | new CircleDialog.Builder((FragmentActivity) mContext) | 560 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 558 | .setCanceledOnTouchOutside(false) | 561 | .setCanceledOnTouchOutside(false) |
| 559 | .setCancelable(false) | 562 | .setCancelable(false) |
| 560 | .setWidth(0.5f) | 563 | .setWidth(0.5f) |
| 561 | .configText(new ConfigText() { | 564 | .configText(new ConfigText() { |
| 562 | @Override | 565 | @Override |
| 563 | public void onConfig(TextParams params) { | 566 | public void onConfig(TextParams params) { |
| 564 | params.gravity = Gravity.CENTER; | 567 | params.gravity = Gravity.CENTER; |
| 565 | params.padding = new int[]{50, 50, 50, 50}; | 568 | params.padding = new int[]{50, 50, 50, 50}; |
| 566 | } | 569 | } |
| 567 | }) | 570 | }) |
| 568 | .setText("当前无网络,请检查网络设置") | 571 | .setText("当前无网络,请检查网络设置") |
| 569 | .setNegative("继续使用", null) | 572 | .setNegative("继续使用", null) |
| 570 | .setPositive("设置网络", new View.OnClickListener() { | 573 | .setPositive("设置网络", new View.OnClickListener() { |
| 571 | @Override | 574 | @Override |
| 572 | public void onClick(View v) { | 575 | public void onClick(View v) { |
| 573 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 576 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 574 | mContext.startActivity(intent); | 577 | mContext.startActivity(intent); |
| 575 | } | 578 | } |
| 576 | }) | 579 | }) |
| 577 | .show(); | 580 | .show(); |
| 578 | } | 581 | } |
| 579 | }); | 582 | }); |
| 580 | } | 583 | } |
| 581 | //修改保卡信息地址 | 584 | //修改保卡信息地址 |
| 582 | public void changecardadressinfo(final Context mContext, int userId, final String customerPhone, String authCode, final String customerAddress) { | 585 | public void changecardadressinfo(final Context mContext, int userId, final String customerPhone, String authCode, final String customerAddress) { |
| 583 | RequestParams params = new RequestParams(); | 586 | RequestParams params = new RequestParams(); |
| 584 | params.put("userId", userId); | 587 | params.put("userId", userId); |
| 585 | params.put("customerPhone", customerPhone); | 588 | params.put("customerPhone", customerPhone); |
| 586 | params.put("authCode", authCode); | 589 | params.put("authCode", authCode); |
| 587 | params.put("customerAddress", customerAddress); | 590 | params.put("customerAddress", customerAddress); |
| 588 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 591 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 589 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 592 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 590 | @Override | 593 | @Override |
| 591 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 594 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 592 | try { | 595 | try { |
| 593 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 596 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 594 | String status = jsonObject.optString("status"); | 597 | String status = jsonObject.optString("status"); |
| 595 | if (status.equals("1")) { | 598 | if (status.equals("1")) { |
| 596 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 599 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 597 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress); | 600 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress); |
| 598 | ((Activity) mContext).finish(); | 601 | ((Activity) mContext).finish(); |
| 599 | } | 602 | } |
| 600 | } catch (JSONException e) { | 603 | } catch (JSONException e) { |
| 601 | e.printStackTrace(); | 604 | e.printStackTrace(); |
| 602 | } | 605 | } |
| 603 | } | 606 | } |
| 604 | 607 | ||
| 605 | @Override | 608 | @Override |
| 606 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 609 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 607 | Log.e("test", "onFailure" + new String(bytes)); | 610 | Log.e("test", "onFailure" + new String(bytes)); |
| 608 | new CircleDialog.Builder((FragmentActivity) mContext) | 611 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 609 | .setCanceledOnTouchOutside(false) | 612 | .setCanceledOnTouchOutside(false) |
| 610 | .setCancelable(false) | 613 | .setCancelable(false) |
| 611 | .setWidth(0.5f) | 614 | .setWidth(0.5f) |
| 612 | .configText(new ConfigText() { | 615 | .configText(new ConfigText() { |
| 613 | @Override | 616 | @Override |
| 614 | public void onConfig(TextParams params) { | 617 | public void onConfig(TextParams params) { |
| 615 | params.gravity = Gravity.CENTER; | 618 | params.gravity = Gravity.CENTER; |
| 616 | params.padding = new int[]{50, 50, 50, 50}; | 619 | params.padding = new int[]{50, 50, 50, 50}; |
| 617 | } | 620 | } |
| 618 | }) | 621 | }) |
| 619 | .setText("当前无网络,请检查网络设置") | 622 | .setText("当前无网络,请检查网络设置") |
| 620 | .setNegative("继续使用", null) | 623 | .setNegative("继续使用", null) |
| 621 | .setPositive("设置网络", new View.OnClickListener() { | 624 | .setPositive("设置网络", new View.OnClickListener() { |
| 622 | @Override | 625 | @Override |
| 623 | public void onClick(View v) { | 626 | public void onClick(View v) { |
| 624 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 627 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 625 | mContext.startActivity(intent); | 628 | mContext.startActivity(intent); |
| 626 | } | 629 | } |
| 627 | }) | 630 | }) |
| 628 | .show(); | 631 | .show(); |
| 629 | } | 632 | } |
| 630 | }); | 633 | }); |
| 631 | } | 634 | } |
| 632 | //验证是否保卡信息 | 635 | //验证是否保卡信息 |
| 633 | public void cardinfocheck(final Context mContext, int userId, final Handler handler) { | 636 | public void cardinfocheck(final Context mContext, int userId, final Handler handler) { |
| 634 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 637 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 635 | HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() { | 638 | HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 636 | @Override | 639 | @Override |
| 637 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 640 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 638 | Log.e("test", "---" + new String(arg2)); | 641 | Log.e("test", "---" + new String(arg2)); |
| 639 | Message msg = Message.obtain(); | 642 | Message msg = Message.obtain(); |
| 640 | msg.what = HttpCode.CHECKCARD; | 643 | msg.what = HttpCode.CHECKCARD; |
| 641 | msg.obj = new String(arg2); | 644 | msg.obj = new String(arg2); |
| 642 | handler.sendMessage(msg); | 645 | handler.sendMessage(msg); |
| 643 | } | 646 | } |
| 644 | 647 | ||
| 645 | @Override | 648 | @Override |
| 646 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 649 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 647 | new CircleDialog.Builder((FragmentActivity) mContext) | 650 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 648 | .setCanceledOnTouchOutside(false) | 651 | .setCanceledOnTouchOutside(false) |
| 649 | .setCancelable(false) | 652 | .setCancelable(false) |
| 650 | .configText(new ConfigText() { | 653 | .configText(new ConfigText() { |
| 651 | @Override | 654 | @Override |
| 652 | public void onConfig(TextParams params) { | 655 | public void onConfig(TextParams params) { |
| 653 | params.gravity = Gravity.CENTER; | 656 | params.gravity = Gravity.CENTER; |
| 654 | params.padding = new int[]{250, 50, 250, 50}; | 657 | params.padding = new int[]{250, 50, 250, 50}; |
| 655 | } | 658 | } |
| 656 | }) | 659 | }) |
| 657 | .setText("当前无网络,请检查网络设置") | 660 | .setText("当前无网络,请检查网络设置") |
| 658 | .setNegative("取消", null) | 661 | .setNegative("取消", null) |
| 659 | .setPositive("确定", new View.OnClickListener() { | 662 | .setPositive("确定", new View.OnClickListener() { |
| 660 | @Override | 663 | @Override |
| 661 | public void onClick(View v) { | 664 | public void onClick(View v) { |
| 662 | Intent intent = new Intent("/"); | 665 | Intent intent = new Intent("/"); |
| 663 | ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings"); | 666 | ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings"); |
| 664 | intent.setComponent(cm); | 667 | intent.setComponent(cm); |
| 665 | intent.setAction("android.intent.action.VIEW"); | 668 | intent.setAction("android.intent.action.VIEW"); |
| 666 | ((Activity) mContext).startActivityForResult( intent , 0); | 669 | ((Activity) mContext).startActivityForResult( intent , 0); |
| 667 | } | 670 | } |
| 668 | }) | 671 | }) |
| 669 | .show(); | 672 | .show(); |
| 670 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 673 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
| 671 | } | 674 | } |
| 672 | }); | 675 | }); |
| 673 | } | 676 | } |
| 674 | 677 | ||
| 675 | ///获取年级 | 678 | ///获取年级 |
| 676 | public void getgrade(final Context mContext) { | 679 | public void getgrade(final Context mContext, final Handler handler) { |
| 677 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 680 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 678 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 681 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
| 679 | @Override | 682 | @Override |
| 680 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 683 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 681 | Log.e("test", "年级" + new String(arg2)); | 684 | Log.e("test", "年级" + new String(arg2)); |
| 682 | GradeInfo gradensInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 685 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
| 683 | StringBuffer sb = new StringBuffer(); | 686 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoBeanList = null; |
| 684 | for (int i = 0; i < gradensInfo.getData().size(); i++) { | 687 | for (int i = 0 ;i<3;i++) { |
| 685 | sb.append(gradensInfo.getData().get(i).getName() + ","); | 688 | gradeInfoBeanList=(gradeInfo.getData().get(i).getChildren()); |
| 686 | |||
| 687 | } | 689 | } |
| 688 | Log.e("test", "年级" + sb.toString()); | 690 | |
| 689 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.GRADENS, "" + sb.toString()); | 691 | Message message = Message.obtain(); |
| 692 | message.what = HttpCode.GRADER; | ||
| 693 | message.obj = gradeInfoBeanList; | ||
| 694 | handler.sendMessage(message); | ||
| 690 | 695 | ||
| 691 | 696 | ||
| 692 | } | 697 | } |
| 693 | 698 | ||
| 694 | @Override | 699 | @Override |
| 695 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 700 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 696 | new CircleDialog.Builder((FragmentActivity) mContext) | 701 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 697 | .setCanceledOnTouchOutside(false) | 702 | .setCanceledOnTouchOutside(false) |
| 698 | .setCancelable(false) | 703 | .setCancelable(false) |
| 699 | .setWidth(0.5f) | 704 | .setWidth(0.5f) |
| 700 | .configText(new ConfigText() { | 705 | .configText(new ConfigText() { |
| 701 | @Override | 706 | @Override |
| 702 | public void onConfig(TextParams params) { | 707 | public void onConfig(TextParams params) { |
| 703 | params.gravity = Gravity.CENTER; | 708 | params.gravity = Gravity.CENTER; |
| 704 | params.padding = new int[]{50, 50, 50, 50}; | 709 | params.padding = new int[]{50, 50, 50, 50}; |
| 705 | } | 710 | } |
| 706 | }) | 711 | }) |
| 707 | .setText("当前无网络,请检查网络设置") | 712 | .setText("当前无网络,请检查网络设置") |
| 708 | .setNegative("继续使用", null) | 713 | .setNegative("继续使用", null) |
| 709 | .setPositive("设置网络", new View.OnClickListener() { | 714 | .setPositive("设置网络", new View.OnClickListener() { |
| 710 | @Override | 715 | @Override |
| 711 | public void onClick(View v) { | 716 | public void onClick(View v) { |
| 712 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 717 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 713 | mContext.startActivity(intent); | 718 | mContext.startActivity(intent); |
| 714 | } | 719 | } |
| 715 | }) | 720 | }) |
| 716 | .show(); | 721 | .show(); |
| 717 | } | 722 | } |
| 718 | }); | 723 | }); |
| 719 | } | 724 | } |
| 720 | ///获取学校 | 725 | ///获取学校 |
| 721 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 726 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
| 722 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 727 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 723 | HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 728 | HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
| 724 | @Override | 729 | @Override |
| 725 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 730 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 726 | Log.e("test", "学校" + new String(arg2)); | 731 | Log.e("test", "学校" + new String(arg2)); |
| 727 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 732 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
| 728 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 733 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
| 729 | Message message = Message.obtain(); | 734 | Message message = Message.obtain(); |
| 730 | message.what = HttpCode.SCHOOL; | 735 | message.what = HttpCode.SCHOOL; |
| 731 | message.obj = schoolInfoBeanList; | 736 | message.obj = schoolInfoBeanList; |
| 732 | handler.sendMessage(message); | 737 | handler.sendMessage(message); |
| 733 | 738 | ||
| 734 | } | 739 | } |
| 735 | 740 | ||
| 736 | @Override | 741 | @Override |
| 737 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 742 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 738 | new CircleDialog.Builder((FragmentActivity) mContext) | 743 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 739 | .setCanceledOnTouchOutside(false) | 744 | .setCanceledOnTouchOutside(false) |
| 740 | .setCancelable(false) | 745 | .setCancelable(false) |
| 741 | .setWidth(0.5f) | 746 | .setWidth(0.5f) |
| 742 | .configText(new ConfigText() { | 747 | .configText(new ConfigText() { |
| 743 | @Override | 748 | @Override |
| 744 | public void onConfig(TextParams params) { | 749 | public void onConfig(TextParams params) { |
| 745 | params.gravity = Gravity.CENTER; | 750 | params.gravity = Gravity.CENTER; |
| 746 | params.padding = new int[]{50, 50, 50, 50}; | 751 | params.padding = new int[]{50, 50, 50, 50}; |
| 747 | } | 752 | } |
| 748 | }) | 753 | }) |
| 749 | .setText("当前无网络,请检查网络设置") | 754 | .setText("当前无网络,请检查网络设置") |
| 750 | .setNegative("继续使用", null) | 755 | .setNegative("继续使用", null) |
| 751 | .setPositive("设置网络", new View.OnClickListener() { | 756 | .setPositive("设置网络", new View.OnClickListener() { |
| 752 | @Override | 757 | @Override |
| 753 | public void onClick(View v) { | 758 | public void onClick(View v) { |
| 754 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 759 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 755 | mContext.startActivity(intent); | 760 | mContext.startActivity(intent); |
| 756 | } | 761 | } |
| 757 | }) | 762 | }) |
| 758 | .show(); | 763 | .show(); |
| 759 | } | 764 | } |
| 760 | }); | 765 | }); |
| 761 | } | 766 | } |
| 762 | 767 | ||
| 763 | 768 | ||
| 764 | 769 | ||
| 765 | 770 | ||
| 766 | 771 | ||
| 767 | ///省级接口 | 772 | ///省级接口 |
| 768 | public void provices(final Context mContext, final Handler handler) { | 773 | public void provices(final Context mContext, final Handler handler) { |
| 769 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 774 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 770 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 775 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
| 771 | @Override | 776 | @Override |
| 772 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 777 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 773 | Log.e("test", "省" + new String(arg2)); | 778 | Log.e("test", "省" + new String(arg2)); |
| 774 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 779 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
| 775 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 780 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
| 776 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 781 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
| 777 | Message message = Message.obtain(); | 782 | Message message = Message.obtain(); |
| 778 | message.what = HttpCode.PROVICES; | 783 | message.what = HttpCode.PROVICES; |
| 779 | message.obj = provincesBeanList; | 784 | message.obj = provincesBeanList; |
| 780 | handler.sendMessage(message); | 785 | handler.sendMessage(message); |
| 781 | 786 | ||
| 782 | } | 787 | } |
| 783 | 788 | ||
| 784 | @Override | 789 | @Override |
| 785 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 790 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 786 | new CircleDialog.Builder((FragmentActivity) mContext) | 791 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 787 | .setCanceledOnTouchOutside(false) | 792 | .setCanceledOnTouchOutside(false) |
| 788 | .setCancelable(false) | 793 | .setCancelable(false) |
| 789 | .setWidth(0.5f) | 794 | .setWidth(0.5f) |
| 790 | .configText(new ConfigText() { | 795 | .configText(new ConfigText() { |
| 791 | @Override | 796 | @Override |
| 792 | public void onConfig(TextParams params) { | 797 | public void onConfig(TextParams params) { |
| 793 | params.gravity = Gravity.CENTER; | 798 | params.gravity = Gravity.CENTER; |
| 794 | params.padding = new int[]{50, 50, 50, 50}; | 799 | params.padding = new int[]{50, 50, 50, 50}; |
| 795 | } | 800 | } |
| 796 | }) | 801 | }) |
| 797 | .setText("当前无网络,请检查网络设置") | 802 | .setText("当前无网络,请检查网络设置") |
| 798 | .setNegative("继续使用", null) | 803 | .setNegative("继续使用", null) |
| 799 | .setPositive("设置网络", new View.OnClickListener() { | 804 | .setPositive("设置网络", new View.OnClickListener() { |
| 800 | @Override | 805 | @Override |
| 801 | public void onClick(View v) { | 806 | public void onClick(View v) { |
| 802 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 807 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 803 | mContext.startActivity(intent); | 808 | mContext.startActivity(intent); |
| 804 | } | 809 | } |
| 805 | }) | 810 | }) |
| 806 | .show(); | 811 | .show(); |
| 807 | } | 812 | } |
| 808 | }); | 813 | }); |
| 809 | } | 814 | } |
| 810 | 815 | ||
| 811 | //市级接口 | 816 | //市级接口 |
| 812 | public void cityinfo(final Context mContext, int regionId , final Handler handler) { | 817 | public void cityinfo(final Context mContext, long regionId , final Handler handler) { |
| 813 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 818 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 814 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 819 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
| 815 | @Override | 820 | @Override |
| 816 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 821 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 817 | Log.e("test", "市" + new String(arg2)); | 822 | Log.e("test", "市" + new String(arg2)); |
| 818 | Gson gson = new Gson(); | 823 | Gson gson = new Gson(); |
| 819 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 824 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
| 820 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 825 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
| 821 | Message message = Message.obtain(); | 826 | Message message = Message.obtain(); |
| 822 | message.what = HttpCode.CITYS; | 827 | message.what = HttpCode.CITYS; |
| 823 | message.obj = cityInfoBeanList; | 828 | message.obj = cityInfoBeanList; |
| 824 | handler.sendMessage(message); | 829 | handler.sendMessage(message); |
| 825 | 830 | ||
| 826 | 831 | ||
| 827 | } | 832 | } |
| 828 | 833 | ||
| 829 | @Override | 834 | @Override |
| 830 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 835 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 831 | new CircleDialog.Builder((FragmentActivity) mContext) | 836 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 832 | .setCanceledOnTouchOutside(false) | 837 | .setCanceledOnTouchOutside(false) |
| 833 | .setCancelable(false) | 838 | .setCancelable(false) |
| 834 | .setWidth(0.5f) | 839 | .setWidth(0.5f) |
| 835 | .configText(new ConfigText() { | 840 | .configText(new ConfigText() { |
| 836 | @Override | 841 | @Override |
| 837 | public void onConfig(TextParams params) { | 842 | public void onConfig(TextParams params) { |
| 838 | params.gravity = Gravity.CENTER; | 843 | params.gravity = Gravity.CENTER; |
| 839 | params.padding = new int[]{50, 50, 50, 50}; | 844 | params.padding = new int[]{50, 50, 50, 50}; |
| 840 | } | 845 | } |
| 841 | }) | 846 | }) |
| 842 | .setText("当前无网络,请检查网络设置") | 847 | .setText("当前无网络,请检查网络设置") |
| 843 | .setNegative("继续使用", null) | 848 | .setNegative("继续使用", null) |
| 844 | .setPositive("设置网络", new View.OnClickListener() { | 849 | .setPositive("设置网络", new View.OnClickListener() { |
| 845 | @Override | 850 | @Override |
| 846 | public void onClick(View v) { | 851 | public void onClick(View v) { |
| 847 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 852 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 848 | mContext.startActivity(intent); | 853 | mContext.startActivity(intent); |
| 849 | } | 854 | } |
| 850 | }) | 855 | }) |
| 851 | .show(); | 856 | .show(); |
| 852 | } | 857 | } |
| 853 | }); | 858 | }); |
| 854 | } | 859 | } |
| 855 | 860 | ||
| 856 | //区县级接口 | 861 | //区县级接口 |
| 857 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 862 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
| 858 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 863 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 859 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 864 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
| 860 | @Override | 865 | @Override |
| 861 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 866 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 862 | Log.e("test", "区" + new String(arg2)); | 867 | Log.e("test", "区" + new String(arg2)); |
| 863 | Gson gson = new Gson(); | 868 | Gson gson = new Gson(); |
| 864 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 869 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
| 865 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 870 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
| 866 | Message message = Message.obtain(); | 871 | Message message = Message.obtain(); |
| 867 | message.what = HttpCode.COUNTRY; | 872 | message.what = HttpCode.COUNTRY; |
| 868 | message.obj = countyInfoInfoBeanList; | 873 | message.obj = countyInfoInfoBeanList; |
| 869 | handler.sendMessage(message); | 874 | handler.sendMessage(message); |
| 870 | 875 | ||
| 871 | 876 | ||
| 872 | } | 877 | } |
| 873 | 878 | ||
| 874 | @Override | 879 | @Override |
| 875 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 880 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 876 | new CircleDialog.Builder((FragmentActivity) mContext) | 881 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 877 | .setCanceledOnTouchOutside(false) | 882 | .setCanceledOnTouchOutside(false) |
| 878 | .setCancelable(false) | 883 | .setCancelable(false) |
| 879 | .setWidth(0.5f) | 884 | .setWidth(0.5f) |
| 880 | .configText(new ConfigText() { | 885 | .configText(new ConfigText() { |
| 881 | @Override | 886 | @Override |
| 882 | public void onConfig(TextParams params) { | 887 | public void onConfig(TextParams params) { |
| 883 | params.gravity = Gravity.CENTER; | 888 | params.gravity = Gravity.CENTER; |
| 884 | params.padding = new int[]{50, 50, 50, 50}; | 889 | params.padding = new int[]{50, 50, 50, 50}; |
| 885 | } | 890 | } |
| 886 | }) | 891 | }) |
| 887 | .setText("当前无网络,请检查网络设置") | 892 | .setText("当前无网络,请检查网络设置") |
| 888 | .setNegative("继续使用", null) | 893 | .setNegative("继续使用", null) |
| 889 | .setPositive("设置网络", new View.OnClickListener() { | 894 | .setPositive("设置网络", new View.OnClickListener() { |
| 890 | @Override | 895 | @Override |
| 891 | public void onClick(View v) { | 896 | public void onClick(View v) { |
| 892 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 897 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 893 | mContext.startActivity(intent); | 898 | mContext.startActivity(intent); |
| 894 | } | 899 | } |
| 895 | }) | 900 | }) |
| 896 | .show(); | 901 | .show(); |
| 897 | } | 902 | } |
| 898 | }); | 903 | }); |
| 899 | } | 904 | } |
| 900 | 905 | ||
| 901 | 906 | ||
| 902 | private void closeProgress() { | 907 | private void closeProgress() { |
| 903 | try { | 908 | try { |
| 904 | if (mProgress != null) { | 909 | if (mProgress != null) { |
| 905 | mProgress.dismiss(); | 910 | mProgress.dismiss(); |
| 906 | mProgress = null; | 911 | mProgress = null; |
| 907 | } | 912 | } |
| 908 | } catch (Exception e) { | 913 | } catch (Exception e) { |
| 909 | e.printStackTrace(); | 914 | e.printStackTrace(); |
| 910 | } | 915 | } |
| 911 | } | 916 | } |
| 912 | 917 | ||
| 913 | } | 918 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/interfaces/DialogCallBack.java
| 1 | package com.hjx.personalcenter.interfaces; | 1 | package com.hjx.personalcenter.interfaces; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.view.LayoutInflater; | ||
| 5 | import android.view.View; | 4 | import android.view.View; |
| 6 | import android.view.ViewGroup; | ||
| 7 | import android.widget.AdapterView; | 5 | import android.widget.AdapterView; |
| 8 | 6 | ||
| 9 | /** | 7 | /** |
| 10 | * Created by wei on 2017/8/17. | 8 | * Created by wei on 2017/8/17. |
| 11 | */ | 9 | */ |
| 12 | 10 | ||
| 13 | public class DialogCallBack { | 11 | public class DialogCallBack { |
| 12 | //对话框回调 | ||
| 14 | public interface CallBack{ | 13 | public interface CallBack{ |
| 15 | void provinceOnItemClick(AdapterView<?> parent, View view, int position, long id,int type); | 14 | void provinceOnItemClick(AdapterView<?> parent, View view, int position, long id,int type); |
| 16 | } | 15 | } |
| 16 | //头像回调 | ||
| 17 | public interface CallBackView{ | 17 | public interface CallBackView{ |
| 18 | void provinceOnItemClick(Context context, LayoutInflater inflater, ViewGroup container); | 18 | void heard(Context context,View v); |
| 19 | } | 19 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/CardInfo.java
| 1 | package com.hjx.personalcenter.model; | 1 | package com.hjx.personalcenter.model; |
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * Created by h on 2017/8/18. | 4 | * Created by h on 2017/8/18. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | public class CardInfo { | 7 | public class CardInfo { |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * customerName : FuQiang | 10 | * status : 1 |
| 11 | * createTime : 2017-08-01 13:21:00 | 11 | * pageSize : 1 |
| 12 | * mobilePhone : 13162530008 | 12 | * data : {"customerName":"FuQiang","createTime":"2017-08-01 13:21:00","mobilePhone":"13162530008","buyTime":"2017-08-01 12:23:50","productModel":"GT-N7100","buyAddress":"HaojixingZhengZhou","customerAddress":"HeNamZhengSheng","alterSaleCall":"4022210201","macAddress":"00:22:F4:93:7A:B\n","deviceNumber":"A909A90997011012"} |
| 13 | * buyTime : 2017-08-01 12:23:50 | 13 | * msg : success |
| 14 | * productModel : GT-N7100 | 14 | * pageNum : 9 |
| 15 | * buyAddress : HaojixingZhengZhou | ||
| 16 | * customerAddress : HeNamZhengSheng | ||
| 17 | * alterSaleCall : 4022210201 | ||
| 18 | * macAddress : 00:22:F4:93:7A:B | ||
| 19 | |||
| 20 | * deviceNumber : A909A90997011012 | ||
| 21 | */ | 15 | */ |
| 22 | 16 | ||
| 23 | private String customerName; | 17 | private int status; |
| 24 | private String createTime; | 18 | private int pageSize; |
| 25 | private String mobilePhone; | 19 | private DataBean data; |
| 26 | private String buyTime; | 20 | private String msg; |
| 27 | private String productModel; | 21 | private int pageNum; |
| 28 | private String buyAddress; | ||
| 29 | private String customerAddress; | ||
| 30 | private String alterSaleCall; | ||
| 31 | private String macAddress; | ||
| 32 | private String deviceNumber; | ||
| 33 | |||
| 34 | public String getCustomerName() { | ||
| 35 | return customerName; | ||
| 36 | } | ||
| 37 | 22 | ||
| 38 | public void setCustomerName(String customerName) { | 23 | public int getStatus() { |
| 39 | this.customerName = customerName; | 24 | return status; |
| 40 | } | 25 | } |
| 41 | 26 | ||
| 42 | public String getCreateTime() { | 27 | public void setStatus(int status) { |
| 43 | return createTime; | 28 | this.status = status; |
| 44 | } | 29 | } |
| 45 | 30 | ||
| 46 | public void setCreateTime(String createTime) { | 31 | public int getPageSize() { |
| 47 | this.createTime = createTime; | 32 | return pageSize; |
| 48 | } | 33 | } |
| 49 | 34 | ||
| 50 | public String getMobilePhone() { | 35 | public void setPageSize(int pageSize) { |
| 51 | return mobilePhone; | 36 | this.pageSize = pageSize; |
| 52 | } | 37 | } |
| 53 | 38 | ||
| 54 | public void setMobilePhone(String mobilePhone) { | 39 | public DataBean getData() { |
| 55 | this.mobilePhone = mobilePhone; | 40 | return data; |
| 56 | } | 41 | } |
| 57 | 42 | ||
| 58 | public String getBuyTime() { | 43 | public void setData(DataBean data) { |
| 59 | return buyTime; | 44 | this.data = data; |
| 60 | } | 45 | } |
| 61 | 46 | ||
| 62 | public void setBuyTime(String buyTime) { | 47 | public String getMsg() { |
| 63 | this.buyTime = buyTime; | 48 | return msg; |
| 64 | } | 49 | } |
| 65 | 50 | ||
| 66 | public String getProductModel() { | 51 | public void setMsg(String msg) { |
| 67 | return productModel; | 52 | this.msg = msg; |
| 68 | } | 53 | } |
| 69 | 54 | ||
| 70 | public void setProductModel(String productModel) { | 55 | public int getPageNum() { |
| 71 | this.productModel = productModel; | 56 | return pageNum; |
| 72 | } | 57 | } |
| 73 | 58 | ||
| 74 | public String getBuyAddress() { | 59 | public void setPageNum(int pageNum) { |
| 75 | return buyAddress; | 60 | this.pageNum = pageNum; |
| 76 | } | 61 | } |
| 77 | 62 | ||
| 78 | public void setBuyAddress(String buyAddress) { | 63 | public static class DataBean { |
| 79 | this.buyAddress = buyAddress; | 64 | /** |
| 80 | } | 65 | * customerName : FuQiang |
| 66 | * createTime : 2017-08-01 13:21:00 | ||
| 67 | * mobilePhone : 13162530008 | ||
| 68 | * buyTime : 2017-08-01 12:23:50 | ||
| 69 | * productModel : GT-N7100 | ||
| 70 | * buyAddress : HaojixingZhengZhou | ||
| 71 | * customerAddress : HeNamZhengSheng | ||
| 72 | * alterSaleCall : 4022210201 | ||
| 73 | * macAddress : 00:22:F4:93:7A:B | ||
| 81 | 74 | ||
| 82 | public String getCustomerAddress() { | 75 | * deviceNumber : A909A90997011012 |
| 83 | return customerAddress; | 76 | */ |
| 84 | } | ||
| 85 | 77 | ||
| 86 | public void setCustomerAddress(String customerAddress) { | 78 | private String customerName; |
| 87 | this.customerAddress = customerAddress; | 79 | private String createTime; |
| 88 | } | 80 | private String mobilePhone; |
| 81 | private String buyTime; | ||
| 82 | private String productModel; | ||
| 83 | private String buyAddress; | ||
| 84 | private String customerAddress; | ||
| 85 | private String alterSaleCall; | ||
| 86 | private String macAddress; | ||
| 87 | private String deviceNumber; | ||
| 89 | 88 | ||
| 90 | public String getAlterSaleCall() { | 89 | public String getCustomerName() { |
| 91 | return alterSaleCall; | 90 | return customerName; |
| 92 | } | 91 | } |
| 93 | 92 | ||
| 94 | public void setAlterSaleCall(String alterSaleCall) { | 93 | public void setCustomerName(String customerName) { |
| 95 | this.alterSaleCall = alterSaleCall; | 94 | this.customerName = customerName; |
| 96 | } | 95 | } |
| 97 | 96 | ||
| 98 | public String getMacAddress() { | 97 | public String getCreateTime() { |
| 99 | return macAddress; | 98 | return createTime; |
| 100 | } | 99 | } |
| 101 | 100 | ||
| 102 | public void setMacAddress(String macAddress) { | 101 | public void setCreateTime(String createTime) { |
| 103 | this.macAddress = macAddress; | 102 | this.createTime = createTime; |
| 104 | } | 103 | } |
| 105 | 104 | ||
| 106 | public String getDeviceNumber() { | 105 | public String getMobilePhone() { |
| 107 | return deviceNumber; | 106 | return mobilePhone; |
| 108 | } | 107 | } |
| 108 | |||
| 109 | public void setMobilePhone(String mobilePhone) { | ||
| 110 | this.mobilePhone = mobilePhone; | ||
| 111 | } | ||
| 112 | |||
| 113 | public String getBuyTime() { | ||
| 114 | return buyTime; | ||
| 115 | } | ||
| 116 | |||
| 117 | public void setBuyTime(String buyTime) { | ||
| 118 | this.buyTime = buyTime; | ||
| 119 | } | ||
| 120 | |||
| 121 | public String getProductModel() { | ||
| 122 | return productModel; | ||
| 123 | } | ||
| 124 | |||
| 125 | public void setProductModel(String productModel) { | ||
| 126 | this.productModel = productModel; | ||
| 127 | } | ||
| 128 | |||
| 129 | public String getBuyAddress() { | ||
| 130 | return buyAddress; | ||
| 131 | } | ||
| 132 | |||
| 133 | public void setBuyAddress(String buyAddress) { | ||
| 134 | this.buyAddress = buyAddress; | ||
| 135 | } | ||
| 136 | |||
| 137 | public String getCustomerAddress() { | ||
| 138 | return customerAddress; | ||
| 139 | } | ||
| 140 | |||
| 141 | public void setCustomerAddress(String customerAddress) { | ||
| 142 | this.customerAddress = customerAddress; | ||
| 143 | } | ||
| 144 | |||
| 145 | public String getAlterSaleCall() { | ||
| 146 | return alterSaleCall; | ||
| 147 | } | ||
| 109 | 148 | ||
| 110 | public void setDeviceNumber(String deviceNumber) { | 149 | public void setAlterSaleCall(String alterSaleCall) { |
| 111 | this.deviceNumber = deviceNumber; | 150 | this.alterSaleCall = alterSaleCall; |
| 151 | } | ||
| 152 | |||
| 153 | public String getMacAddress() { | ||
| 154 | return macAddress; |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/CityInfo.java
| 1 | package com.hjx.personalcenter.model; | 1 | package com.hjx.personalcenter.model; |
| 2 | 2 | ||
| 3 | import java.io.Serializable; | ||
| 3 | import java.util.List; | 4 | import java.util.List; |
| 4 | 5 | ||
| 5 | /** | 6 | /** |
| 6 | * Created by h on 2017/8/16. | 7 | * Created by h on 2017/8/16. |
| 7 | */ | 8 | */ |
| 8 | 9 | ||
| 9 | public class CityInfo { | 10 | public class CityInfo implements Serializable { |
| 10 | 11 | ||
| 11 | /** | 12 | /** |
| 12 | * status : 100 | 13 | * status : 100 |
| 13 | * message : success | 14 | * message : success |
| 14 | * cities : [{"regionId":210100,"parentId":210000,"regionName":"沈阳"},{"regionId":210200,"parentId":210000,"regionName":"大连"},{"regionId":210300,"parentId":210000,"regionName":"鞍山"},{"regionId":210400,"parentId":210000,"regionName":"抚顺"},{"regionId":210500,"parentId":210000,"regionName":"本溪"},{"regionId":210600,"parentId":210000,"regionName":"丹东"},{"regionId":210700,"parentId":210000,"regionName":"锦州"},{"regionId":210800,"parentId":210000,"regionName":"营口"},{"regionId":210900,"parentId":210000,"regionName":"阜新"},{"regionId":211000,"parentId":210000,"regionName":"辽阳"},{"regionId":211100,"parentId":210000,"regionName":"盘锦"},{"regionId":211200,"parentId":210000,"regionName":"铁岭"},{"regionId":211300,"parentId":210000,"regionName":"朝阳"},{"regionId":211400,"parentId":210000,"regionName":"葫芦岛"}] | 15 | * cities : [{"regionId":210100,"parentId":210000,"regionName":"沈阳"},{"regionId":210200,"parentId":210000,"regionName":"大连"},{"regionId":210300,"parentId":210000,"regionName":"鞍山"},{"regionId":210400,"parentId":210000,"regionName":"抚顺"},{"regionId":210500,"parentId":210000,"regionName":"本溪"},{"regionId":210600,"parentId":210000,"regionName":"丹东"},{"regionId":210700,"parentId":210000,"regionName":"锦州"},{"regionId":210800,"parentId":210000,"regionName":"营口"},{"regionId":210900,"parentId":210000,"regionName":"阜新"},{"regionId":211000,"parentId":210000,"regionName":"辽阳"},{"regionId":211100,"parentId":210000,"regionName":"盘锦"},{"regionId":211200,"parentId":210000,"regionName":"铁岭"},{"regionId":211300,"parentId":210000,"regionName":"朝阳"},{"regionId":211400,"parentId":210000,"regionName":"葫芦岛"}] |
| 15 | */ | 16 | */ |
| 16 | 17 | ||
| 17 | private int status; | 18 | private int status; |
| 18 | private String message; | 19 | private String message; |
| 19 | private List<CitiesBean> cities; | 20 | private List<CitiesBean> cities; |
| 20 | 21 | ||
| 21 | public int getStatus() { | 22 | public int getStatus() { |
| 22 | return status; | 23 | return status; |
| 23 | } | 24 | } |
| 24 | 25 | ||
| 25 | public void setStatus(int status) { | 26 | public void setStatus(int status) { |
| 26 | this.status = status; | 27 | this.status = status; |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | public String getMessage() { | 30 | public String getMessage() { |
| 30 | return message; | 31 | return message; |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | public void setMessage(String message) { | 34 | public void setMessage(String message) { |
| 34 | this.message = message; | 35 | this.message = message; |
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | public List<CitiesBean> getCities() { | 38 | public List<CitiesBean> getCities() { |
| 38 | return cities; | 39 | return cities; |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | public void setCities(List<CitiesBean> cities) { | 42 | public void setCities(List<CitiesBean> cities) { |
| 42 | this.cities = cities; | 43 | this.cities = cities; |
| 43 | } | 44 | } |
| 44 | 45 | ||
| 45 | public static class CitiesBean { | 46 | public static class CitiesBean { |
| 46 | /** | 47 | /** |
| 47 | * regionId : 210100 | 48 | * regionId : 210100 |
| 48 | * parentId : 210000 | 49 | * parentId : 210000 |
| 49 | * regionName : 沈阳 | 50 | * regionName : 沈阳 |
| 50 | */ | 51 | */ |
| 51 | 52 | ||
| 52 | private int regionId; | 53 | private int regionId; |
| 53 | private int parentId; | 54 | private int parentId; |
| 54 | private String regionName; | 55 | private String regionName; |
| 55 | 56 | ||
| 56 | public int getRegionId() { | 57 | public int getRegionId() { |
| 57 | return regionId; | 58 | return regionId; |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | public void setRegionId(int regionId) { | 61 | public void setRegionId(int regionId) { |
| 61 | this.regionId = regionId; | 62 | this.regionId = regionId; |
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | public int getParentId() { | 65 | public int getParentId() { |
| 65 | return parentId; | 66 | return parentId; |
| 66 | } | 67 | } |
| 67 | 68 | ||
| 68 | public void setParentId(int parentId) { | 69 | public void setParentId(int parentId) { |
| 69 | this.parentId = parentId; | 70 | this.parentId = parentId; |
| 70 | } | 71 | } |
| 71 | 72 | ||
| 72 | public String getRegionName() { | 73 | public String getRegionName() { |
| 73 | return regionName; | 74 | return regionName; |
| 74 | } | 75 | } |
| 75 | 76 | ||
| 76 | public void setRegionName(String regionName) { | 77 | public void setRegionName(String regionName) { |
| 77 | this.regionName = regionName; | 78 | this.regionName = regionName; |
| 78 | } | 79 | } |
| 79 | } | 80 | } |
| 80 | } | 81 | } |
| 81 | 82 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/CountyInfo.java
| 1 | package com.hjx.personalcenter.model; | 1 | package com.hjx.personalcenter.model; |
| 2 | 2 | ||
| 3 | import java.io.Serializable; | ||
| 3 | import java.util.List; | 4 | import java.util.List; |
| 4 | 5 | ||
| 5 | /** | 6 | /** |
| 6 | * Created by h on 2017/8/16. | 7 | * Created by h on 2017/8/16. |
| 7 | */ | 8 | */ |
| 8 | 9 | ||
| 9 | public class CountyInfo { | 10 | public class CountyInfo implements Serializable{ |
| 10 | 11 | ||
| 11 | 12 | ||
| 12 | /** | 13 | /** |
| 13 | * status : 100 | 14 | * status : 100 |
| 14 | * message : success | 15 | * message : success |
| 15 | * counties : [{"regionId":210302,"parentId":210300,"regionName":"铁东"},{"regionId":210303,"parentId":210300,"regionName":"铁西"},{"regionId":210304,"parentId":210300,"regionName":"立山"},{"regionId":210311,"parentId":210300,"regionName":"千山"},{"regionId":210321,"parentId":210300,"regionName":"台安"},{"regionId":210323,"parentId":210300,"regionName":"岫岩"},{"regionId":210381,"parentId":210300,"regionName":"海城"}] | 16 | * counties : [{"regionId":210302,"parentId":210300,"regionName":"铁东"},{"regionId":210303,"parentId":210300,"regionName":"铁西"},{"regionId":210304,"parentId":210300,"regionName":"立山"},{"regionId":210311,"parentId":210300,"regionName":"千山"},{"regionId":210321,"parentId":210300,"regionName":"台安"},{"regionId":210323,"parentId":210300,"regionName":"岫岩"},{"regionId":210381,"parentId":210300,"regionName":"海城"}] |
| 16 | */ | 17 | */ |
| 17 | 18 | ||
| 18 | private int status; | 19 | private int status; |
| 19 | private String message; | 20 | private String message; |
| 20 | private List<CountiesBean> counties; | 21 | private List<CountiesBean> counties; |
| 21 | 22 | ||
| 22 | public int getStatus() { | 23 | public int getStatus() { |
| 23 | return status; | 24 | return status; |
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | public void setStatus(int status) { | 27 | public void setStatus(int status) { |
| 27 | this.status = status; | 28 | this.status = status; |
| 28 | } | 29 | } |
| 29 | 30 | ||
| 30 | public String getMessage() { | 31 | public String getMessage() { |
| 31 | return message; | 32 | return message; |
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | public void setMessage(String message) { | 35 | public void setMessage(String message) { |
| 35 | this.message = message; | 36 | this.message = message; |
| 36 | } | 37 | } |
| 37 | 38 | ||
| 38 | public List<CountiesBean> getCounties() { | 39 | public List<CountiesBean> getCounties() { |
| 39 | return counties; | 40 | return counties; |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | public void setCounties(List<CountiesBean> counties) { | 43 | public void setCounties(List<CountiesBean> counties) { |
| 43 | this.counties = counties; | 44 | this.counties = counties; |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | public static class CountiesBean { | 47 | public static class CountiesBean { |
| 47 | /** | 48 | /** |
| 48 | * regionId : 210302 | 49 | * regionId : 210302 |
| 49 | * parentId : 210300 | 50 | * parentId : 210300 |
| 50 | * regionName : 铁东 | 51 | * regionName : 铁东 |
| 51 | */ | 52 | */ |
| 52 | 53 | ||
| 53 | private int regionId; | 54 | private int regionId; |
| 54 | private int parentId; | 55 | private int parentId; |
| 55 | private String regionName; | 56 | private String regionName; |
| 56 | 57 | ||
| 57 | public int getRegionId() { | 58 | public int getRegionId() { |
| 58 | return regionId; | 59 | return regionId; |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | public void setRegionId(int regionId) { | 62 | public void setRegionId(int regionId) { |
| 62 | this.regionId = regionId; | 63 | this.regionId = regionId; |
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | public int getParentId() { | 66 | public int getParentId() { |
| 66 | return parentId; | 67 | return parentId; |
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | public void setParentId(int parentId) { | 70 | public void setParentId(int parentId) { |
| 70 | this.parentId = parentId; | 71 | this.parentId = parentId; |
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | public String getRegionName() { | 74 | public String getRegionName() { |
| 74 | return regionName; | 75 | return regionName; |
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | public void setRegionName(String regionName) { | 78 | public void setRegionName(String regionName) { |
| 78 | this.regionName = regionName; | 79 | this.regionName = regionName; |
| 79 | } | 80 | } |
| 80 | } | 81 | } |
| 81 | } | 82 | } |
| 82 | 83 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/PesonalInfo.java
| File was created | 1 | package com.hjx.personalcenter.model; | |
| 2 | |||
| 3 | import java.io.Serializable; | ||
| 4 | |||
| 5 | /** | ||
| 6 | * Created by h on 2017/8/22. | ||
| 7 | */ | ||
| 8 | |||
| 9 | public class PesonalInfo implements Serializable{ | ||
| 10 | |||
| 11 | /** | ||
| 12 | * status : 1 | ||
| 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"} | ||
| 15 | * msg : success | ||
| 16 | * pageNum : 0 | ||
| 17 | */ | ||
| 18 | |||
| 19 | private int status; | ||
| 20 | private int pageSize; | ||
| 21 | private DataBean data; | ||
| 22 | private String msg; | ||
| 23 | private int pageNum; | ||
| 24 | |||
| 25 | public int getStatus() { | ||
| 26 | return status; | ||
| 27 | } | ||
| 28 | |||
| 29 | public void setStatus(int status) { | ||
| 30 | this.status = status; | ||
| 31 | } | ||
| 32 | |||
| 33 | public int getPageSize() { | ||
| 34 | return pageSize; | ||
| 35 | } | ||
| 36 | |||
| 37 | public void setPageSize(int pageSize) { | ||
| 38 | this.pageSize = pageSize; | ||
| 39 | } | ||
| 40 | |||
| 41 | public DataBean getData() { | ||
| 42 | return data; | ||
| 43 | } | ||
| 44 | |||
| 45 | public void setData(DataBean data) { | ||
| 46 | this.data = data; | ||
| 47 | } | ||
| 48 | |||
| 49 | public String getMsg() { | ||
| 50 | return msg; | ||
| 51 | } | ||
| 52 | |||
| 53 | public void setMsg(String msg) { | ||
| 54 | this.msg = msg; | ||
| 55 | } | ||
| 56 | |||
| 57 | public int getPageNum() { | ||
| 58 | return pageNum; | ||
| 59 | } | ||
| 60 | |||
| 61 | public void setPageNum(int pageNum) { | ||
| 62 | this.pageNum = pageNum; | ||
| 63 | } | ||
| 64 | |||
| 65 | public static class DataBean { | ||
| 66 | /** | ||
| 67 | * region : {"regionName":"闵行区","regionId":"310112"} | ||
| 68 | * nickName : 1688kkkkkkkkk | ||
| 69 | * gender : female | ||
| 70 | * school : {"schoolId":"499705","schoolName":"上海五中"} | ||
| 71 | * grade : {"gradeName":"初中六年级","gradeId":"9"} | ||
| 72 | * birthday : 2017-09-12 | ||
| 73 | * qq : 1666600 | ||
| 74 | */ | ||
| 75 | |||
| 76 | private RegionBean region; | ||
| 77 | private String nickName; | ||
| 78 | private String gender; | ||
| 79 | private SchoolBean school; | ||
| 80 | private GradeBean grade; | ||
| 81 | private String birthday; | ||
| 82 | private String qq; | ||
| 83 | |||
| 84 | public RegionBean getRegion() { | ||
| 85 | return region; | ||
| 86 | } | ||
| 87 | |||
| 88 | public void setRegion(RegionBean region) { | ||
| 89 | this.region = region; | ||
| 90 | } | ||
| 91 | |||
| 92 | public String getNickName() { | ||
| 93 | return nickName; | ||
| 94 | } | ||
| 95 | |||
| 96 | public void setNickName(String nickName) { | ||
| 97 | this.nickName = nickName; | ||
| 98 | } | ||
| 99 | |||
| 100 | public String getGender() { | ||
| 101 | return gender; | ||
| 102 | } | ||
| 103 | |||
| 104 | public void setGender(String gender) { | ||
| 105 | this.gender = gender; | ||
| 106 | } | ||
| 107 | |||
| 108 | public SchoolBean getSchool() { | ||
| 109 | return school; | ||
| 110 | } | ||
| 111 | |||
| 112 | public void setSchool(SchoolBean school) { | ||
| 113 | this.school = school; | ||
| 114 | } | ||
| 115 | |||
| 116 | public GradeBean getGrade() { | ||
| 117 | return grade; | ||
| 118 | } | ||
| 119 | |||
| 120 | public void setGrade(GradeBean grade) { | ||
| 121 | this.grade = grade; | ||
| 122 | } | ||
| 123 | |||
| 124 | public String getBirthday() { | ||
| 125 | return birthday; | ||
| 126 | } | ||
| 127 | |||
| 128 | public void setBirthday(String birthday) { | ||
| 129 | this.birthday = birthday; | ||
| 130 | } | ||
| 131 | |||
| 132 | public String getQq() { | ||
| 133 | return qq; | ||
| 134 | } | ||
| 135 | |||
| 136 | public void setQq(String qq) { | ||
| 137 | this.qq = qq; | ||
| 138 | } | ||
| 139 | |||
| 140 | public static class RegionBean { | ||
| 141 | /** | ||
| 142 | * regionName : 闵行区 | ||
| 143 | * regionId : 310112 | ||
| 144 | */ | ||
| 145 | |||
| 146 | private String regionName; | ||
| 147 | private String regionId; | ||
| 148 | |||
| 149 | public String getRegionName() { | ||
| 150 | return regionName; | ||
| 151 | } | ||
| 152 | |||
| 153 | public void setRegionName(String regionName) { | ||
| 154 | this.regionName = regionName; | ||
| 155 | } | ||
| 156 | |||
| 157 | public String getRegionId() { | ||
| 158 | return regionId; | ||
| 159 | } | ||
| 160 | |||
| 161 | public void setRegionId(String regionId) { | ||
| 162 | this.regionId = regionId; | ||
| 163 | } | ||
| 164 | } | ||
| 165 | |||
| 166 | public static class SchoolBean { | ||
| 167 | /** | ||
| 168 | * schoolId : 499705 | ||
| 169 | * schoolName : 上海五中 | ||
| 170 | */ | ||
| 171 | |||
| 172 | private String schoolId; | ||
| 173 | private String schoolName; | ||
| 174 | |||
| 175 | public String getSchoolId() { | ||
| 176 | return schoolId; | ||
| 177 | } | ||
| 178 | |||
| 179 | public void setSchoolId(String schoolId) { | ||
| 180 | this.schoolId = schoolId; | ||
| 181 | } | ||
| 182 | |||
| 183 | public String getSchoolName() { | ||
| 184 | return schoolName; | ||
| 185 | } | ||
| 186 | |||
| 187 | public void setSchoolName(String schoolName) { | ||
| 188 | this.schoolName = schoolName; | ||
| 189 | } | ||
| 190 | } | ||
| 191 | |||
| 192 | public static class GradeBean { | ||
| 193 | /** | ||
| 194 | * gradeName : 初中六年级 | ||
| 195 | * gradeId : 9 | ||
| 196 | */ | ||
| 197 | |||
| 198 | private String gradeName; | ||
| 199 | private String gradeId; | ||
| 200 | |||
| 201 | public String getGradeName() { | ||
| 202 | return gradeName; | ||
| 203 | } | ||
| 204 | |||
| 205 | public void setGradeName(String gradeName) { | ||
| 206 | this.gradeName = gradeName; | ||
| 207 | } | ||
| 208 | |||
| 209 | public String getGradeId() { | ||
| 210 | return gradeId; | ||
| 211 | } | ||
| 212 | |||
| 213 | public void setGradeId(String gradeId) { | ||
| 214 | this.gradeId = gradeId; | ||
| 215 | } | ||
| 216 | } | ||
| 217 | } | ||
| 218 | } | ||
| 219 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/BrithdayStar.java
| File was created | 1 | package com.hjx.personalcenter.util; | |
| 2 | |||
| 3 | /** | ||
| 4 | * Created by h on 2017/8/22. | ||
| 5 | */ | ||
| 6 | |||
| 7 | public class BrithdayStar { | ||
| 8 | String[][] constellations = {{"摩羯座", "水瓶座"}, {"水瓶座", "双鱼座"}, {"双鱼座", "白羊座"}, {"白羊座", "金牛座"}, {"金牛座", "双子座"}, {"双子座", "巨蟹座"}, {"巨蟹座", "狮子座"}, | ||
| 9 | {"狮子座", "处女座"}, {"处女座", "天秤座"}, {"天秤座", "天蝎座"}, {"天蝎座", "射手座"}, {"射手座", "摩羯座"}}; | ||
| 10 | //星座分割时间 | ||
| 11 | int[] date = {20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22}; | ||
| 12 | //星座生成 传进是日期格式为: yyyy-mm-dd | ||
| 13 | public String getConstellations(String birthday) { | ||
| 14 | String become_constellation = null; | ||
| 15 | String[] data = birthday.split("-"); | ||
| 16 | int day = date[Integer.parseInt(data[1]) - 1]; | ||
| 17 | String[] cl1 = constellations[Integer.parseInt(data[1]) - 1]; | ||
| 18 | if (Integer.parseInt(data[2]) >= day) { | ||
| 19 | become_constellation =cl1[1]; | ||
| 20 | } else { | ||
| 21 | become_constellation=cl1[0]; | ||
| 22 | } | ||
| 23 | return become_constellation; | ||
| 24 | } | ||
| 25 | } | ||
| 26 |
PersonalCenter/app/src/main/res/layout/activity_change_preson_info.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:tools="http://schemas.android.com/tools" | 3 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | android:id="@android:id/tabhost" | 4 | android:id="@android:id/tabhost" |
| 5 | android:layout_width="fill_parent" | 5 | android:layout_width="fill_parent" |
| 6 | android:layout_height="fill_parent" | 6 | android:layout_height="fill_parent" |
| 7 | android:background="@color/white" | 7 | android:background="@color/white" |
| 8 | tools:context="com.hjx.personalcenter.activity.LoginAndRegisterActivity"> | 8 | tools:context="com.hjx.personalcenter.activity.LoginAndRegisterActivity"> |
| 9 | <RelativeLayout | 9 | <RelativeLayout |
| 10 | android:id="@+id/title" | 10 | android:id="@+id/title" |
| 11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 12 | android:layout_height="50dp" | 12 | android:layout_height="50dp" |
| 13 | android:background="@color/login_text_blue"> | 13 | android:background="@color/login_text_blue"> |
| 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="match_parent" | 18 | android:layout_height="match_parent" |
| 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="match_parent" | 26 | android:layout_height="match_parent" |
| 27 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
| 28 | android:gravity="center_vertical" | 28 | android:gravity="center_vertical" |
| 29 | android:text="@string/changge_preson" | 29 | android:text="@string/changge_preson" |
| 30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
| 31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
| 32 | <TextView | 32 | <TextView |
| 33 | android:id="@+id/feedback_sub" | 33 | android:id="@+id/presonal_sub" |
| 34 | android:layout_width="wrap_content" | 34 | android:layout_width="wrap_content" |
| 35 | android:layout_height="match_parent" | 35 | android:layout_height="match_parent" |
| 36 | android:paddingLeft="20dp" | 36 | android:paddingLeft="20dp" |
| 37 | android:paddingRight="20dp" | 37 | android:paddingRight="20dp" |
| 38 | android:gravity="center_vertical" | 38 | android:gravity="center_vertical" |
| 39 | android:layout_alignParentRight="true" | 39 | android:layout_alignParentRight="true" |
| 40 | android:text="保存" | 40 | android:text="保存" |
| 41 | android:textColor="@android:color/white" | 41 | android:textColor="@android:color/white" |
| 42 | android:textSize="22sp" /> | 42 | android:textSize="22sp" /> |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | </RelativeLayout> | 45 | </RelativeLayout> |
| 46 | 46 | ||
| 47 | <LinearLayout | 47 | <LinearLayout |
| 48 | android:layout_width="wrap_content" | 48 | android:layout_width="wrap_content" |
| 49 | android:layout_height="wrap_content" | 49 | android:layout_height="wrap_content" |
| 50 | android:layout_marginTop="20dp" | 50 | android:layout_marginTop="20dp" |
| 51 | android:layout_below="@+id/title" | 51 | android:layout_below="@+id/title" |
| 52 | android:orientation="vertical"> | 52 | android:orientation="vertical"> |
| 53 | 53 | ||
| 54 | <com.hjx.personalcenter.thirdparty.SlidingTabLayout | 54 | <com.hjx.personalcenter.thirdparty.SlidingTabLayout |
| 55 | android:id="@+id/TabLayout_id" | 55 | android:id="@+id/TabLayout_id" |
| 56 | android:layout_gravity="center" | 56 | android:layout_gravity="center" |
| 57 | android:layout_width="wrap_content" | 57 | android:layout_width="wrap_content" |
| 58 | android:layout_height="50dp"> | 58 | android:layout_height="50dp"> |
| 59 | </com.hjx.personalcenter.thirdparty.SlidingTabLayout> | 59 | </com.hjx.personalcenter.thirdparty.SlidingTabLayout> |
| 60 | 60 | ||
| 61 | <android.support.v4.view.ViewPager | 61 | <android.support.v4.view.ViewPager |
| 62 | android:id="@+id/viewpager_login" | 62 | android:id="@+id/viewpager_login" |
| 63 | android:layout_width="match_parent" | 63 | android:layout_width="match_parent" |
| 64 | android:layout_height="match_parent" | 64 | android:layout_height="match_parent" |
| 65 | android:background="@color/white" /> | 65 | android:background="@color/white" /> |
| 66 | </LinearLayout> | 66 | </LinearLayout> |
| 67 | 67 | ||
| 68 | </RelativeLayout> | 68 | </RelativeLayout> |
PersonalCenter/app/src/main/res/layout/activity_main.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
| 4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
| 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | ||
| 5 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 6 | 7 | ||
| 7 | <RelativeLayout | 8 | <RelativeLayout |
| 8 | android:id="@+id/title" | 9 | android:id="@+id/title" |
| 9 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 10 | android:layout_height="50dp" | 11 | android:layout_height="50dp" |
| 11 | android:background="@color/login_text_blue"> | 12 | android:background="@color/login_text_blue"> |
| 12 | 13 | ||
| 13 | <ImageView | 14 | <ImageView |
| 14 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
| 15 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
| 16 | android:layout_height="match_parent" | 17 | android:layout_height="match_parent" |
| 17 | android:paddingLeft="20dp" | 18 | android:paddingLeft="20dp" |
| 18 | android:paddingRight="20dp" | 19 | android:paddingRight="20dp" |
| 19 | android:visibility="gone" | 20 | android:visibility="gone" |
| 20 | android:src="@mipmap/title_back" /> | 21 | android:src="@mipmap/title_back" /> |
| 21 | 22 | ||
| 22 | <TextView | 23 | <TextView |
| 23 | android:id="@+id/menu_title" | 24 | android:id="@+id/menu_title" |
| 24 | android:layout_width="wrap_content" | 25 | android:layout_width="wrap_content" |
| 25 | android:layout_height="match_parent" | 26 | android:layout_height="match_parent" |
| 26 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
| 27 | android:gravity="center_vertical" | 28 | android:gravity="center_vertical" |
| 28 | android:text="@string/titel_preson" | 29 | android:text="@string/titel_preson" |
| 29 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
| 30 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
| 31 | 32 | ||
| 32 | <ImageView | 33 | <ImageView |
| 33 | android:id="@+id/iv_setting" | 34 | android:id="@+id/iv_setting" |
| 34 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
| 35 | android:layout_height="match_parent" | 36 | android:layout_height="match_parent" |
| 36 | android:layout_marginRight="10dp" | 37 | android:layout_marginRight="10dp" |
| 37 | android:layout_toLeftOf="@+id/iv_skin" | 38 | android:layout_toLeftOf="@+id/iv_skin" |
| 38 | android:gravity="center_vertical" | 39 | android:gravity="center_vertical" |
| 39 | android:padding="10dp" | 40 | android:padding="10dp" |
| 40 | android:src="@mipmap/shezhi" | 41 | android:src="@mipmap/shezhi" |
| 41 | android:textColor="@android:color/white" | 42 | android:textColor="@android:color/white" |
| 42 | android:textSize="22sp" /> | 43 | android:textSize="22sp" /> |
| 43 | 44 | ||
| 44 | <ImageView | 45 | <ImageView |
| 45 | android:id="@+id/iv_skin" | 46 | android:id="@+id/iv_skin" |
| 46 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
| 47 | android:layout_height="match_parent" | 48 | android:layout_height="match_parent" |
| 48 | android:layout_marginRight="10dp" | 49 | android:layout_marginRight="10dp" |
| 49 | android:layout_toLeftOf="@+id/iv_imformatioan" | 50 | android:layout_toLeftOf="@+id/iv_imformatioan" |
| 50 | android:gravity="center_vertical" | 51 | android:gravity="center_vertical" |
| 51 | android:padding="10dp" | 52 | android:padding="10dp" |
| 52 | android:src="@mipmap/pifu" | 53 | android:src="@mipmap/pifu" |
| 53 | android:textColor="@android:color/white" | 54 | android:textColor="@android:color/white" |
| 54 | android:textSize="22sp" /> | 55 | android:textSize="22sp" /> |
| 55 | 56 | ||
| 56 | <ImageView | 57 | <ImageView |
| 57 | android:id="@+id/iv_imformatioan" | 58 | android:id="@+id/iv_imformatioan" |
| 58 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
| 59 | android:layout_height="match_parent" | 60 | android:layout_height="match_parent" |
| 60 | android:layout_alignParentRight="true" | 61 | android:layout_alignParentRight="true" |
| 61 | android:layout_marginRight="10dp" | 62 | android:layout_marginRight="10dp" |
| 62 | android:gravity="center_vertical" | 63 | android:gravity="center_vertical" |
| 63 | android:padding="10dp" | 64 | android:padding="10dp" |
| 64 | android:src="@mipmap/fankui" | 65 | android:src="@mipmap/fankui" |
| 65 | android:textColor="@android:color/white" | 66 | android:textColor="@android:color/white" |
| 66 | android:textSize="22sp" /> | 67 | android:textSize="22sp" /> |
| 67 | 68 | ||
| 68 | 69 | ||
| 69 | </RelativeLayout> | 70 | </RelativeLayout> |
| 70 | 71 | ||
| 71 | <LinearLayout | 72 | <LinearLayout |
| 72 | android:layout_width="match_parent" | 73 | android:layout_width="match_parent" |
| 73 | android:layout_height="match_parent"> | 74 | android:layout_height="match_parent"> |
| 74 | 75 | ||
| 75 | <LinearLayout | 76 | <LinearLayout |
| 76 | android:layout_width="0dp" | 77 | android:layout_width="0dp" |
| 77 | android:layout_height="match_parent" | 78 | android:layout_height="match_parent" |
| 78 | android:layout_weight="1" | 79 | android:layout_weight="1" |
| 79 | android:orientation="vertical"> | 80 | android:orientation="vertical"> |
| 80 | 81 | ||
| 81 | <LinearLayout | 82 | <LinearLayout |
| 82 | android:layout_width="match_parent" | 83 | android:layout_width="match_parent" |
| 83 | android:layout_height="wrap_content" | 84 | android:layout_height="wrap_content" |
| 84 | android:layout_marginTop="20dp" | 85 | android:layout_marginTop="20dp" |
| 85 | android:orientation="horizontal"> | 86 | android:orientation="horizontal"> |
| 86 | <ImageView | 87 | <ImageView |
| 87 | android:id="@+id/iv_look_card" | 88 | android:id="@+id/iv_look_card" |
| 88 | android:layout_width="wrap_content" | 89 | android:layout_width="wrap_content" |
| 89 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
| 90 | android:padding="10dp" | 91 | android:padding="10dp" |
| 91 | android:layout_marginLeft="20dp" | 92 | android:layout_marginLeft="20dp" |
| 92 | android:src="@mipmap/card_icoc" /> | 93 | android:src="@mipmap/card_icoc" /> |
| 93 | 94 | <com.facebook.drawee.view.SimpleDraweeView | |
| 94 | <ImageView | ||
| 95 | android:id="@+id/iv_head" | 95 | android:id="@+id/iv_head" |
| 96 | android:layout_width="wrap_content" | 96 | android:layout_width="60dp" |
| 97 | android:layout_height="wrap_content" | 97 | android:layout_height="60dp" |
| 98 | android:layout_marginLeft="60dp" | 98 | android:layout_marginLeft="60dp" |
| 99 | android:src="@mipmap/header_default" /> | 99 | android:layout_gravity="center" |
| 100 | fresco:placeholderImage="@mipmap/header_default" | ||
| 101 | fresco:roundAsCircle="true" | ||
| 102 | fresco:placeholderImageScaleType="fitCenter" /> | ||
| 100 | 103 | ||
| 101 | <TextView | 104 | <TextView |
| 102 | android:layout_width="wrap_content" | 105 | android:layout_width="wrap_content" |
| 103 | android:layout_height="wrap_content" | 106 | android:layout_height="wrap_content" |
| 104 | android:layout_marginLeft="18dp" | 107 | android:layout_marginLeft="18dp" |
| 105 | android:layout_marginTop="20dp" | 108 | android:layout_marginTop="20dp" |
| 106 | android:background="@drawable/corcle_blue_bg" | 109 | android:background="@drawable/corcle_blue_bg" |
| 107 | android:paddingLeft="5dp" | 110 | android:paddingLeft="5dp" |
| 108 | android:paddingRight="5dp" | 111 | android:paddingRight="5dp" |
| 109 | android:gravity="center_vertical" | 112 | android:gravity="center_vertical" |
| 110 | android:text="签到" | 113 | android:text="签到" |
| 111 | android:textColor="@color/login_text_blue" | 114 | android:textColor="@color/login_text_blue" |
| 112 | android:textSize="18sp" /> | 115 | android:textSize="18sp" /> |
| 113 | 116 | ||
| 114 | </LinearLayout> | 117 | </LinearLayout> |
| 115 | 118 | ||
| 116 | <LinearLayout | 119 | <LinearLayout |
| 117 | android:layout_width="match_parent" | 120 | android:layout_width="match_parent" |
| 118 | android:layout_height="wrap_content" | 121 | android:layout_height="wrap_content" |
| 119 | android:layout_marginLeft="20dp" | 122 | android:layout_marginLeft="20dp" |
| 120 | android:layout_marginTop="20dp" | 123 | android:layout_marginTop="20dp" |
| 121 | android:orientation="horizontal"> | 124 | android:orientation="horizontal"> |
| 122 | 125 | ||
| 123 | <TextView | 126 | <TextView |
| 124 | android:id="@+id/tv_username" | 127 | android:id="@+id/tv_username" |
| 125 | android:layout_width="wrap_content" | 128 | android:layout_width="wrap_content" |
| 126 | android:layout_height="wrap_content" | 129 | android:layout_height="wrap_content" |
| 127 | android:text="熊巍" | 130 | android:text="熊巍" |
| 128 | android:textSize="20dp" /> | 131 | android:textSize="20dp" /> |
| 129 | 132 | ||
| 130 | <ImageView | 133 | <ImageView |
| 131 | android:id="@+id/iv_sex" | 134 | android:id="@+id/iv_sex" |
| 132 | android:layout_width="wrap_content" | 135 | android:layout_width="wrap_content" |
| 133 | android:layout_height="wrap_content" | 136 | android:layout_height="wrap_content" |
| 134 | android:layout_marginLeft="50dp" | 137 | android:layout_marginLeft="50dp" |
| 135 | android:src="@mipmap/men" /> | 138 | android:src="@mipmap/men" /> |
| 136 | 139 | ||
| 137 | </LinearLayout> | 140 | </LinearLayout> |
| 138 | 141 | ||
| 139 | <LinearLayout | 142 | <LinearLayout |
| 140 | android:layout_width="match_parent" | 143 | android:layout_width="match_parent" |
| 141 | android:layout_height="wrap_content" | 144 | android:layout_height="wrap_content" |
| 142 | android:layout_marginLeft="20dp" | 145 | android:layout_marginLeft="20dp" |
| 143 | android:layout_marginTop="20dp" | 146 | android:layout_marginTop="20dp" |
| 144 | android:gravity="center" | 147 | android:gravity="center" |
| 145 | android:orientation="horizontal"> | 148 | android:orientation="horizontal"> |
| 146 | 149 | ||
| 147 | <TextView | 150 | <TextView |
| 148 | android:id="@+id/tv_sign" | 151 | android:id="@+id/tv_sign" |
| 149 | android:layout_width="0dp" | 152 | android:layout_width="0dp" |
| 150 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
| 151 | android:layout_weight="5" | 154 | android:layout_weight="5" |
| 152 | android:text="阿士大夫撒打发士大夫士大夫撒的范德萨" | 155 | android:text="阿士大夫撒打发士大夫士大夫撒的范德萨" |
| 153 | android:textSize="18sp" /> | 156 | android:textSize="18sp" /> |
| 154 | 157 | ||
| 155 | <ImageView | 158 | <ImageView |
| 156 | android:id="@+id/iv_sign" | 159 | android:id="@+id/iv_sign" |
| 157 | android:layout_width="0dp" | 160 | android:layout_width="0dp" |
| 158 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
| 159 | android:layout_weight="1" | 162 | android:layout_weight="1" |
| 160 | android:padding="10dp" | 163 | android:padding="10dp" |
| 161 | android:src="@mipmap/pencil" /> | 164 | android:src="@mipmap/pencil" /> |
| 162 | 165 | ||
| 163 | 166 | ||
| 164 | </LinearLayout> | 167 | </LinearLayout> |
| 165 | 168 | ||
| 166 | <View | 169 | <View |
| 167 | android:layout_width="match_parent" | 170 | android:layout_width="match_parent" |
| 168 | android:layout_height="0.7dp" | 171 | android:layout_height="0.7dp" |
| 169 | android:layout_marginTop="20dp" | 172 | android:layout_marginTop="20dp" |
| 170 | android:background="@color/cutoff_line"> | 173 | android:background="@color/cutoff_line"> |
| 171 | 174 | ||
| 172 | </View> | 175 | </View> |
| 173 | 176 | ||
| 174 | <LinearLayout | 177 | <LinearLayout |
| 175 | android:id="@+id/linel_mycuoti" | 178 | android:id="@+id/linel_mycuoti" |
| 176 | android:layout_width="match_parent" | 179 | android:layout_width="match_parent" |
| 177 | android:layout_height="wrap_content" | 180 | android:layout_height="wrap_content" |
| 178 | android:layout_marginTop="30dp" | 181 | android:layout_marginTop="30dp" |
| 179 | android:orientation="vertical"> | 182 | android:orientation="vertical"> |
| 180 | 183 | ||
| 181 | <LinearLayout | 184 | <LinearLayout |
| 182 | android:layout_width="match_parent" | 185 | android:layout_width="match_parent" |
| 183 | android:layout_height="wrap_content" | 186 | android:layout_height="wrap_content" |
| 184 | android:gravity="center_vertical" | 187 | android:gravity="center_vertical" |
| 185 | android:orientation="horizontal"> | 188 | android:orientation="horizontal"> |
| 186 | 189 | ||
| 187 | <ImageView | 190 | <ImageView |
| 188 | android:layout_width="0dp" | 191 | android:layout_width="0dp" |
| 189 | android:layout_height="wrap_content" | 192 | android:layout_height="wrap_content" |
| 190 | android:layout_weight="1" | 193 | android:layout_weight="1" |
| 191 | android:src="@mipmap/wodecuoti" /> | 194 | android:src="@mipmap/wodecuoti" /> |
| 192 | 195 | ||
| 193 | <TextView | 196 | <TextView |
| 194 | android:layout_width="0dp" | 197 | android:layout_width="0dp" |
| 195 | android:layout_height="wrap_content" | 198 | android:layout_height="wrap_content" |
| 196 | android:layout_weight="5" | 199 | android:layout_weight="5" |
| 197 | android:text="我的错题" | 200 | android:text="我的错题" |
| 198 | android:textSize="20sp" /> | 201 | android:textSize="20sp" /> |
| 199 | 202 | ||
| 200 | <ImageView | 203 | <ImageView |
| 201 | android:layout_width="0dp" | 204 | android:layout_width="0dp" |
| 202 | android:layout_height="wrap_content" | 205 | android:layout_height="wrap_content" |
| 203 | android:layout_weight="1" | 206 | android:layout_weight="1" |
| 204 | android:src="@mipmap/youjiantou" /> | 207 | android:src="@mipmap/youjiantou" /> |
| 205 | 208 | ||
| 206 | </LinearLayout> | 209 | </LinearLayout> |
| 207 | 210 | ||
| 208 | <LinearLayout | 211 | <LinearLayout |
| 209 | android:id="@+id/linel_mynote" | 212 | android:id="@+id/linel_mynote" |
| 210 | android:layout_width="match_parent" | 213 | android:layout_width="match_parent" |
| 211 | android:layout_height="wrap_content" | 214 | android:layout_height="wrap_content" |
| 212 | android:layout_marginTop="35dp" | 215 | android:layout_marginTop="35dp" |
| 213 | android:gravity="center_vertical" | 216 | android:gravity="center_vertical" |
| 214 | android:orientation="horizontal"> | 217 | android:orientation="horizontal"> |
| 215 | 218 | ||
| 216 | <ImageView | 219 | <ImageView |
| 217 | android:layout_width="0dp" | 220 | android:layout_width="0dp" |
| 218 | android:layout_height="wrap_content" | 221 | android:layout_height="wrap_content" |
| 219 | android:layout_weight="1" | 222 | android:layout_weight="1" |
| 220 | android:src="@mipmap/wodebiji" /> | 223 | android:src="@mipmap/wodebiji" /> |
| 221 | 224 | ||
| 222 | <TextView | 225 | <TextView |
| 223 | android:layout_width="0dp" | 226 | android:layout_width="0dp" |
| 224 | android:layout_height="wrap_content" | 227 | android:layout_height="wrap_content" |
| 225 | android:layout_weight="5" | 228 | android:layout_weight="5" |
| 226 | android:text="我的笔记" | 229 | android:text="我的笔记" |
| 227 | android:textSize="20sp" /> | 230 | android:textSize="20sp" /> |
| 228 | 231 | ||
| 229 | <ImageView | 232 | <ImageView |
| 230 | android:layout_width="0dp" | 233 | android:layout_width="0dp" |
| 231 | android:layout_height="wrap_content" | 234 | android:layout_height="wrap_content" |
| 232 | android:layout_weight="1" | 235 | android:layout_weight="1" |
| 233 | android:src="@mipmap/youjiantou" /> | 236 | android:src="@mipmap/youjiantou" /> |
| 234 | 237 | ||
| 235 | </LinearLayout> | 238 | </LinearLayout> |
| 236 | 239 | ||
| 237 | <LinearLayout | 240 | <LinearLayout |
| 238 | android:id="@+id/linel_mycollege" | 241 | android:id="@+id/linel_mycollege" |
| 239 | android:layout_width="match_parent" | 242 | android:layout_width="match_parent" |
| 240 | android:layout_height="wrap_content" | 243 | android:layout_height="wrap_content" |
| 241 | android:layout_marginTop="35dp" | 244 | android:layout_marginTop="35dp" |
| 242 | android:gravity="center_vertical" | 245 | android:gravity="center_vertical" |
| 243 | android:orientation="horizontal"> | 246 | android:orientation="horizontal"> |
| 244 | 247 | ||
| 245 | <ImageView | 248 | <ImageView |
| 246 | android:layout_width="0dp" | 249 | android:layout_width="0dp" |
| 247 | android:layout_height="wrap_content" | 250 | android:layout_height="wrap_content" |
| 248 | android:layout_weight="1" | 251 | android:layout_weight="1" |
| 249 | android:src="@mipmap/wodeshoucang" /> | 252 | android:src="@mipmap/wodeshoucang" /> |
| 250 | 253 | ||
| 251 | <TextView | 254 | <TextView |
| 252 | android:layout_width="0dp" | 255 | android:layout_width="0dp" |
| 253 | android:layout_height="wrap_content" | 256 | android:layout_height="wrap_content" |
| 254 | android:layout_weight="5" | 257 | android:layout_weight="5" |
| 255 | android:text="我的收藏" | 258 | android:text="我的收藏" |
| 256 | android:textSize="20sp" /> | 259 | android:textSize="20sp" /> |
| 257 | 260 | ||
| 258 | <ImageView | 261 | <ImageView |
| 259 | android:layout_width="0dp" | 262 | android:layout_width="0dp" |
| 260 | android:layout_height="wrap_content" | 263 | android:layout_height="wrap_content" |
| 261 | android:layout_weight="1" | 264 | android:layout_weight="1" |
| 262 | android:src="@mipmap/youjiantou" /> | 265 | android:src="@mipmap/youjiantou" /> |
| 263 | 266 | ||
| 264 | </LinearLayout> | 267 | </LinearLayout> |
| 265 | 268 | ||
| 266 | <LinearLayout | 269 | <LinearLayout |
| 267 | android:id="@+id/linel_myclass" | 270 | android:id="@+id/linel_myclass" |
| 268 | android:layout_width="match_parent" | 271 | android:layout_width="match_parent" |
| 269 | android:layout_height="wrap_content" | 272 | android:layout_height="wrap_content" |
| 270 | android:layout_marginTop="35dp" | 273 | android:layout_marginTop="35dp" |
| 271 | android:gravity="center_vertical" | 274 | android:gravity="center_vertical" |
| 272 | android:orientation="horizontal"> | 275 | android:orientation="horizontal"> |
| 273 | 276 | ||
| 274 | <ImageView | 277 | <ImageView |
| 275 | android:layout_width="0dp" | 278 | android:layout_width="0dp" |
| 276 | android:layout_height="wrap_content" | 279 | android:layout_height="wrap_content" |
| 277 | android:layout_weight="1" | 280 | android:layout_weight="1" |
| 278 | android:src="@mipmap/wodebanji" /> | 281 | android:src="@mipmap/wodebanji" /> |
| 279 | 282 | ||
| 280 | <TextView | 283 | <TextView |
| 281 | android:layout_width="0dp" | 284 | android:layout_width="0dp" |
| 282 | android:layout_height="wrap_content" | 285 | android:layout_height="wrap_content" |
| 283 | android:layout_weight="5" | 286 | android:layout_weight="5" |
| 284 | android:text="我的班级" | 287 | android:text="我的班级" |
| 285 | android:textSize="20sp" /> | 288 | android:textSize="20sp" /> |
| 286 | 289 | ||
| 287 | <ImageView | 290 | <ImageView |
| 288 | android:layout_width="0dp" | 291 | android:layout_width="0dp" |
| 289 | android:layout_height="wrap_content" | 292 | android:layout_height="wrap_content" |
| 290 | android:layout_weight="1" | 293 | android:layout_weight="1" |
| 291 | android:src="@mipmap/youjiantou" /> | 294 | android:src="@mipmap/youjiantou" /> |
| 292 | 295 | ||
| 293 | </LinearLayout> | 296 | </LinearLayout> |
| 294 | 297 | ||
| 295 | 298 | ||
| 296 | </LinearLayout> | 299 | </LinearLayout> |
| 297 | 300 | ||
| 298 | <LinearLayout | 301 | <LinearLayout |
| 299 | android:layout_width="match_parent" | 302 | android:layout_width="match_parent" |
| 300 | android:layout_height="match_parent" | 303 | android:layout_height="match_parent" |
| 301 | android:layout_marginTop="120dp" | 304 | android:layout_marginTop="120dp" |
| 302 | android:background="@mipmap/xiaoguanggao"> | 305 | android:background="@mipmap/xiaoguanggao"> |
| 303 | 306 | ||
| 304 | </LinearLayout> | 307 | </LinearLayout> |
| 305 | 308 | ||
| 306 | 309 | ||
| 307 | </LinearLayout> | 310 | </LinearLayout> |
| 308 | 311 | ||
| 309 | 312 | ||
| 310 | <View | 313 | <View |
| 311 | android:layout_width="0.7dp" | 314 | android:layout_width="0.7dp" |
| 312 | android:layout_height="match_parent" | 315 | android:layout_height="match_parent" |
| 313 | android:background="@color/cutoff_line"> | 316 | android:background="@color/cutoff_line"> |
| 314 | 317 | ||
| 315 | </View> | 318 | </View> |
| 316 | 319 | ||
| 317 | <LinearLayout | 320 | <LinearLayout |
| 318 | android:layout_width="0dp" | 321 | android:layout_width="0dp" |
| 319 | android:layout_height="match_parent" | 322 | android:layout_height="match_parent" |
| 320 | android:layout_weight="2.5" | 323 | android:layout_weight="2.5" |
| 321 | android:orientation="vertical"> | 324 | android:orientation="vertical"> |
| 322 | 325 | ||
| 323 | <LinearLayout | 326 | <LinearLayout |
| 324 | android:layout_width="match_parent" | 327 | android:layout_width="match_parent" |
| 325 | android:layout_height="wrap_content" | 328 | android:layout_height="wrap_content" |
| 326 | android:layout_margin="20dp" | 329 | android:layout_margin="20dp" |
| 327 | android:gravity="center_vertical" | 330 | android:gravity="center_vertical" |
| 328 | android:orientation="horizontal"> | 331 | android:orientation="horizontal"> |
| 329 | 332 | ||
| 330 | <View | 333 | <View |
| 331 | android:layout_width="5dp" | 334 | android:layout_width="5dp" |
| 332 | android:layout_height="20dp" | 335 | android:layout_height="20dp" |
| 333 | android:background="@color/login_text_blue"> | 336 | android:background="@color/login_text_blue"> |
| 334 | 337 | ||
| 335 | </View> | 338 | </View> |
| 336 | 339 | ||
| 337 | <TextView | 340 | <TextView |
| 338 | android:layout_width="wrap_content" | 341 | android:layout_width="wrap_content" |
| 339 | android:layout_height="wrap_content" | 342 | android:layout_height="wrap_content" |
| 340 | android:layout_marginLeft="5dp" | 343 | android:layout_marginLeft="5dp" |
| 341 | android:text="最近学习" | 344 | android:text="最近学习" |
| 342 | android:textSize="22sp" /> | 345 | android:textSize="22sp" /> |
| 343 | 346 | ||
| 344 | </LinearLayout> | 347 | </LinearLayout> |
| 345 | 348 | ||
| 346 | <LinearLayout | 349 | <LinearLayout |
| 347 | android:layout_width="match_parent" | 350 | android:layout_width="match_parent" |
| 348 | android:layout_height="wrap_content"> | 351 | android:layout_height="wrap_content"> |
| 349 | 352 | ||
| 350 | <TextView | 353 | <TextView |
| 351 | android:id="@+id/list_item_study" | 354 | android:id="@+id/list_item_study" |
| 352 | android:layout_width="match_parent" | 355 | android:layout_width="match_parent" |
| 353 | android:layout_height="100dp" | 356 | android:layout_height="100dp" |
| 354 | android:layout_marginLeft="20dp" | 357 | android:layout_marginLeft="20dp" |
| 355 | android:layout_marginTop="10dp" | 358 | android:layout_marginTop="10dp" |
| 356 | android:gravity="center" | 359 | android:gravity="center" |
| 357 | android:text="这里需要显示水平滑动的" /> | 360 | android:text="这里需要显示水平滑动的" /> |
| 358 | </LinearLayout> | 361 | </LinearLayout> |
| 359 | 362 | ||
| 360 | <View | 363 | <View |
| 361 | android:layout_width="match_parent" | 364 | android:layout_width="match_parent" |
| 362 | android:layout_height="0.7dp" | 365 | android:layout_height="0.7dp" |
| 363 | android:background="@color/cutoff_line"> | 366 | android:background="@color/cutoff_line"> |
| 364 | 367 | ||
| 365 | </View> | 368 | </View> |
| 366 | 369 | ||
| 367 | <LinearLayout | 370 | <LinearLayout |
| 368 | android:layout_width="match_parent" | 371 | android:layout_width="match_parent" |
| 369 | android:layout_height="wrap_content" | 372 | android:layout_height="wrap_content" |
| 370 | android:layout_margin="20dp" | 373 | android:layout_margin="20dp" |
| 371 | android:gravity="center_vertical" | 374 | android:gravity="center_vertical" |
| 372 | android:orientation="horizontal"> | 375 | android:orientation="horizontal"> |
| 373 | 376 | ||
| 374 | <View | 377 | <View |
| 375 | android:layout_width="5dp" | 378 | android:layout_width="5dp" |
| 376 | android:layout_height="20dp" | 379 | android:layout_height="20dp" |
| 377 | android:background="@color/login_text_blue"> | 380 | android:background="@color/login_text_blue"> |
| 378 | 381 | ||
| 379 | </View> | 382 | </View> |
| 380 | 383 | ||
| 381 | <TextView | 384 | <TextView |
| 382 | android:layout_width="0dp" | 385 | android:layout_width="0dp" |
| 383 | android:layout_height="wrap_content" | 386 | android:layout_height="wrap_content" |
| 384 | android:layout_marginLeft="5dp" | 387 | android:layout_marginLeft="5dp" |
| 385 | android:layout_weight="2" | 388 | android:layout_weight="2" |
| 386 | android:text="个人信息" | 389 | android:text="个人信息" |
| 387 | android:textSize="22sp" /> | 390 | android:textSize="22sp" /> |
| 388 | 391 | ||
| 389 | <TextView | 392 | <TextView |
| 390 | android:id="@+id/tv_edit_presoninfo" | 393 | android:id="@+id/tv_edit_presoninfo" |
| 391 | android:padding="5dp" | 394 | android:padding="5dp" |
| 392 | android:layout_width="0dp" | 395 | android:layout_width="0dp" |
| 393 | android:layout_height="wrap_content" | 396 | android:layout_height="wrap_content" |
| 394 | android:layout_marginLeft="10dp" | 397 | android:layout_marginLeft="10dp" |
| 395 | android:layout_weight="0.2" | 398 | android:layout_weight="0.2" |
| 396 | android:text="编辑" | 399 | android:text="编辑" |
| 397 | android:textSize="18sp" /> | 400 | android:textSize="18sp" /> |
| 398 | 401 | ||
| 399 | <ImageView | 402 | <ImageView |
| 400 | android:layout_width="0dp" | 403 | android:layout_width="0dp" |
| 401 | android:layout_height="wrap_content" | 404 | android:layout_height="wrap_content" |
| 402 | android:layout_weight="0.1" | 405 | android:layout_weight="0.1" |
| 403 | 406 | ||
| 404 | android:src="@mipmap/youjiantou" /> | 407 | android:src="@mipmap/youjiantou" /> |
| 405 | 408 | ||
| 406 | 409 | ||
| 407 | </LinearLayout> | 410 | </LinearLayout> |
| 408 | 411 | ||
| 409 | <LinearLayout | 412 | <LinearLayout |
| 410 | android:layout_width="match_parent" | 413 | android:layout_width="match_parent" |
| 411 | android:layout_height="wrap_content" | 414 | android:layout_height="wrap_content" |
| 412 | android:layout_marginLeft="50dp" | 415 | android:layout_marginLeft="50dp" |
| 413 | android:layout_marginTop="10dp" | 416 | android:layout_marginTop="10dp" |
| 414 | android:orientation="vertical"> | 417 | android:orientation="vertical"> |
| 415 | 418 | ||
| 416 | <LinearLayout | 419 | <LinearLayout |
| 417 | android:layout_width="match_parent" | 420 | android:layout_width="match_parent" |
| 418 | android:layout_height="wrap_content" | 421 | android:layout_height="wrap_content" |
| 419 | android:gravity="center_vertical" | 422 | android:gravity="center_vertical" |
| 420 | android:orientation="horizontal"> | 423 | android:orientation="horizontal"> |
| 421 | 424 | ||
| 422 | <TextView | 425 | <TextView |
| 423 | android:layout_width="0dp" | 426 | android:layout_width="0dp" |
| 424 | android:layout_height="wrap_content" | 427 | android:layout_height="wrap_content" |
| 425 | android:layout_weight="1" | 428 | android:layout_weight="1" |
| 426 | android:text="昵称" | 429 | android:text="昵称" |
| 427 | android:textSize="20sp" /> | 430 | android:textSize="20sp" /> |
| 428 | 431 | ||
| 429 | <TextView | 432 | <TextView |
| 430 | android:id="@+id/tv_username1" | 433 | android:id="@+id/tv_username1" |
| 431 | android:layout_width="0dp" | 434 | android:layout_width="0dp" |
| 432 | android:layout_height="wrap_content" | 435 | android:layout_height="wrap_content" |
| 433 | android:layout_weight="2" | 436 | android:layout_weight="2" |
| 434 | android:text="我的错题" | 437 | android:text="我的错题" |
| 435 | android:textSize="20sp" /> | 438 | android:textSize="20sp" /> |
| 436 | 439 | ||
| 437 | <TextView | 440 | <TextView |
| 438 | android:layout_width="1dp" | 441 | android:layout_width="1dp" |
| 439 | android:layout_height="wrap_content" | 442 | android:layout_height="wrap_content" |
| 440 | android:layout_weight="1" | 443 | android:layout_weight="1" |
| 441 | android:text="星座" | 444 | android:text="星座" |
| 442 | android:textSize="20sp" /> | 445 | android:textSize="20sp" /> |
| 443 | 446 | ||
| 444 | <TextView | 447 | <TextView |
| 445 | android:id="@+id/tv_mygad" | 448 | android:id="@+id/tv_mygad" |
| 446 | android:layout_width="0dp" | 449 | android:layout_width="0dp" |
| 447 | android:layout_height="wrap_content" | 450 | android:layout_height="wrap_content" |
| 448 | android:layout_weight="2" | 451 | android:layout_weight="2" |
| 449 | android:text="我的错题" | 452 | android:text="我的错题" |
| 450 | android:textSize="20sp" /> | 453 | android:textSize="20sp" /> |
| 451 | </LinearLayout> | 454 | </LinearLayout> |
| 452 | 455 | ||
| 453 | <LinearLayout | 456 | <LinearLayout |
| 454 | android:layout_width="match_parent" | 457 | android:layout_width="match_parent" |
| 455 | android:layout_height="wrap_content" | 458 | android:layout_height="wrap_content" |
| 456 | android:layout_marginTop="20dp" | 459 | android:layout_marginTop="20dp" |
| 457 | android:gravity="center_vertical" | 460 | android:gravity="center_vertical" |
| 458 | android:orientation="horizontal"> | 461 | android:orientation="horizontal"> |
| 459 | 462 | ||
| 460 | <TextView | 463 | <TextView |
| 461 | android:layout_width="0dp" | 464 | android:layout_width="0dp" |
| 462 | android:layout_height="wrap_content" | 465 | android:layout_height="wrap_content" |
| 463 | android:layout_weight="1" | 466 | android:layout_weight="1" |
| 464 | android:text="性别" | 467 | android:text="性别" |
| 465 | android:textSize="20sp" /> | 468 | android:textSize="20sp" /> |
| 466 | 469 | ||
| 467 | <TextView | 470 | <TextView |
| 468 | android:id="@+id/tv_sex" | 471 | android:id="@+id/tv_sex" |
| 469 | android:layout_width="0dp" | 472 | android:layout_width="0dp" |
| 470 | android:layout_height="wrap_content" | 473 | android:layout_height="wrap_content" |
| 471 | android:layout_weight="2" | 474 | android:layout_weight="2" |
| 472 | android:text="男" | 475 | android:text="男" |
| 473 | android:textSize="20sp" /> | 476 | android:textSize="20sp" /> |
| 474 | 477 | ||
| 475 | <TextView | 478 | <TextView |
| 476 | android:layout_width="1dp" | 479 | android:layout_width="1dp" |
| 477 | android:layout_height="wrap_content" | 480 | android:layout_height="wrap_content" |
| 478 | android:layout_weight="1" | 481 | android:layout_weight="1" |
| 479 | android:text="地区" | 482 | android:text="地区" |
| 480 | android:textSize="20sp" /> | 483 | android:textSize="20sp" /> |
| 481 | 484 | ||
| 482 | <TextView | 485 | <TextView |
| 483 | android:id="@+id/tv_useinfo_adress" | 486 | android:id="@+id/tv_useinfo_adress" |
| 484 | android:layout_width="0dp" | 487 | android:layout_width="0dp" |
| 485 | android:layout_height="wrap_content" | 488 | android:layout_height="wrap_content" |
| 486 | android:layout_weight="2" | 489 | android:layout_weight="2" |
| 487 | android:text="我的错题" | 490 | android:text="我的错题" |
| 488 | android:textSize="20sp" /> | 491 | android:textSize="20sp" /> |
| 489 | </LinearLayout> | 492 | </LinearLayout> |
| 490 | 493 | ||
| 491 | <LinearLayout | 494 | <LinearLayout |
| 492 | android:layout_width="match_parent" | 495 | android:layout_width="match_parent" |
| 493 | android:layout_height="wrap_content" | 496 | android:layout_height="wrap_content" |
| 494 | android:layout_marginTop="20dp" | 497 | android:layout_marginTop="20dp" |
| 495 | android:gravity="center_vertical" | 498 | android:gravity="center_vertical" |
| 496 | android:orientation="horizontal"> | 499 | android:orientation="horizontal"> |
| 497 | 500 | ||
| 498 | <TextView | 501 | <TextView |
| 499 | android:layout_width="0dp" | 502 | android:layout_width="0dp" |
| 500 | android:layout_height="wrap_content" | 503 | android:layout_height="wrap_content" |
| 501 | android:layout_weight="1" | 504 | android:layout_weight="1" |
| 502 | android:text="生日" | 505 | android:text="生日" |
| 503 | android:textSize="20sp" /> | 506 | android:textSize="20sp" /> |
| 504 | 507 | ||
| 505 | <TextView | 508 | <TextView |
| 506 | android:id="@+id/tv_useinfo_birthday" | 509 | android:id="@+id/tv_useinfo_birthday" |
| 507 | android:layout_width="0dp" | 510 | android:layout_width="0dp" |
| 508 | android:layout_height="wrap_content" | 511 | android:layout_height="wrap_content" |
| 509 | android:layout_weight="2" | 512 | android:layout_weight="2" |
| 510 | android:text="我的错题" | 513 | android:text="我的错题" |
| 511 | android:textSize="20sp" /> | 514 | android:textSize="20sp" /> |
| 512 | 515 | ||
| 513 | <TextView | 516 | <TextView |
| 514 | android:layout_width="1dp" | 517 | android:layout_width="1dp" |
| 515 | android:layout_height="wrap_content" | 518 | android:layout_height="wrap_content" |
| 516 | android:layout_weight="1" | 519 | android:layout_weight="1" |
| 517 | android:text="学校" | 520 | android:text="学校" |
| 518 | android:textSize="20sp" /> | 521 | android:textSize="20sp" /> |
| 519 | 522 | ||
| 520 | <TextView | 523 | <TextView |
| 521 | android:id="@+id/tv_useinfo_school" | 524 | android:id="@+id/tv_useinfo_school" |
| 522 | android:layout_width="0dp" | 525 | android:layout_width="0dp" |
| 523 | android:layout_height="wrap_content" | 526 | android:layout_height="wrap_content" |
| 524 | android:layout_weight="2" | 527 | android:layout_weight="2" |
| 525 | android:text="我的错题" | 528 | android:text="我的错题" |
| 526 | android:textSize="20sp" /> | 529 | android:textSize="20sp" /> |
| 527 | </LinearLayout> | 530 | </LinearLayout> |
| 528 | 531 | ||
| 529 | <LinearLayout | 532 | <LinearLayout |
| 530 | android:layout_width="match_parent" | 533 | android:layout_width="match_parent" |
| 531 | android:layout_height="wrap_content" | 534 | android:layout_height="wrap_content" |
| 532 | android:layout_marginTop="20dp" | 535 | android:layout_marginTop="20dp" |
| 533 | android:gravity="center_vertical" | 536 | android:gravity="center_vertical" |
| 534 | android:orientation="horizontal"> | 537 | android:orientation="horizontal"> |
| 535 | 538 | ||
| 536 | <TextView | 539 | <TextView |
| 537 | android:layout_width="0dp" | 540 | android:layout_width="0dp" |
| 538 | android:layout_height="wrap_content" | 541 | android:layout_height="wrap_content" |
| 539 | android:layout_weight="1" | 542 | android:layout_weight="1" |
| 540 | android:text="Q Q" | 543 | android:text="Q Q" |
| 541 | android:textSize="20sp" /> | 544 | android:textSize="20sp" /> |
| 542 | 545 | ||
| 543 | <TextView | 546 | <TextView |
| 544 | android:id="@+id/tv_useinfo_qq" | 547 | android:id="@+id/tv_useinfo_qq" |
| 545 | android:layout_width="0dp" | 548 | android:layout_width="0dp" |
| 546 | android:layout_height="wrap_content" | 549 | android:layout_height="wrap_content" |
| 547 | android:layout_weight="2" | 550 | android:layout_weight="2" |
| 548 | android:text="我的错题" | 551 | android:text="我的错题" |
| 549 | android:textSize="20sp" /> | 552 | android:textSize="20sp" /> |
| 550 | 553 | ||
| 551 | <TextView | 554 | <TextView |
| 552 | android:layout_width="1dp" | 555 | android:layout_width="1dp" |
| 553 | android:layout_height="wrap_content" | 556 | android:layout_height="wrap_content" |
| 554 | android:layout_weight="1" | 557 | android:layout_weight="1" |
| 555 | android:text="年级" | 558 | android:text="年级" |
| 556 | android:textSize="20sp" /> | 559 | android:textSize="20sp" /> |
| 557 | 560 | ||
| 558 | <TextView | 561 | <TextView |
| 559 | android:id="@+id/tv_useinfo_gender" | 562 | android:id="@+id/tv_useinfo_gender" |
| 560 | android:layout_width="0dp" | 563 | android:layout_width="0dp" |
| 561 | android:layout_height="wrap_content" | 564 | android:layout_height="wrap_content" |
| 562 | android:layout_weight="2" | 565 | android:layout_weight="2" |
| 563 | android:text="我的错题" | 566 | android:text="我的错题" |
| 564 | android:textSize="20sp" /> | 567 | android:textSize="20sp" /> |
| 565 | </LinearLayout> | 568 | </LinearLayout> |
| 566 | 569 | ||
| 567 | 570 | ||
| 568 | </LinearLayout> | 571 | </LinearLayout> |
| 569 | <View | 572 | <View |
| 570 | android:layout_width="match_parent" | 573 | android:layout_width="match_parent" |
| 571 | android:layout_height="0.7dp" | 574 | android:layout_height="0.7dp" |
| 572 | android:layout_marginTop="20dp" | 575 | android:layout_marginTop="20dp" |
| 573 | android:background="@color/cutoff_line"> | 576 | android:background="@color/cutoff_line"> |
| 574 | 577 | ||
| 575 | </View> | 578 | </View> |
| 576 | <LinearLayout | 579 | <LinearLayout |
| 577 | android:layout_width="match_parent" | 580 | android:layout_width="match_parent" |
| 578 | android:layout_height="wrap_content" | 581 | android:layout_height="wrap_content" |
| 579 | android:layout_margin="20dp" | 582 | android:layout_margin="20dp" |
| 580 | android:gravity="center_vertical" | 583 | android:gravity="center_vertical" |
| 581 | android:orientation="horizontal"> | 584 | android:orientation="horizontal"> |
| 582 | 585 | ||
| 583 | <View | 586 | <View |
| 584 | android:layout_width="5dp" | 587 | android:layout_width="5dp" |
| 585 | android:layout_height="20dp" | 588 | android:layout_height="20dp" |
| 586 | android:background="@color/login_text_blue"> | 589 | android:background="@color/login_text_blue"> |
| 587 | 590 | ||
| 588 | </View> | 591 | </View> |
| 589 | 592 | ||
| 590 | <TextView | 593 | <TextView |
| 591 | android:layout_width="wrap_content" | 594 | android:layout_width="wrap_content" |
| 592 | android:layout_height="wrap_content" | 595 | android:layout_height="wrap_content" |
| 593 | android:layout_marginLeft="5dp" | 596 | android:layout_marginLeft="5dp" |
| 594 | android:text="版本信息" | 597 | android:text="版本信息" |
| 595 | android:textSize="22sp" /> | 598 | android:textSize="22sp" /> |
| 596 | 599 | ||
| 597 | </LinearLayout> | 600 | </LinearLayout> |
| 598 | 601 | ||
| 599 | <LinearLayout | 602 | <LinearLayout |
| 600 | android:layout_width="match_parent" | 603 | android:layout_width="match_parent" |
| 601 | android:layout_height="wrap_content" | 604 | android:layout_height="wrap_content" |
| 602 | android:layout_marginTop="20dp"> | 605 | android:layout_marginTop="20dp"> |
| 603 | 606 | ||
| 604 | <TextView | 607 | <TextView |
| 605 | android:layout_width="match_parent" | 608 | android:layout_width="match_parent" |
| 606 | android:layout_height="100dp" | 609 | android:layout_height="100dp" |
| 607 | android:layout_marginLeft="20dp" | 610 | android:layout_marginLeft="20dp" |
| 608 | android:layout_marginTop="10dp" | 611 | android:layout_marginTop="10dp" |
| 609 | android:gravity="center" | 612 | android:gravity="center" |
| 610 | android:text="这里需要显示水平滑动的" /> | 613 | android:text="这里需要显示水平滑动的" /> |
| 611 | </LinearLayout> | 614 | </LinearLayout> |
| 612 | 615 | ||
| 613 | 616 | ||
| 614 | </LinearLayout> | 617 | </LinearLayout> |
| 615 | 618 | ||
| 616 | 619 | ||
| 617 | </LinearLayout> | 620 | </LinearLayout> |
| 618 | 621 | ||
| 619 | 622 | ||
| 620 | </LinearLayout> | 623 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/custom_adilog_cityslist.xml
| File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | android:layout_width="match_parent" | ||
| 4 | android:layout_height="match_parent" | ||
| 5 | android:orientation="vertical"> | ||
| 6 | |||
| 7 | <RelativeLayout | ||
| 8 | android:id="@+id/title" | ||
| 9 | android:layout_width="match_parent" | ||
| 10 | android:layout_height="wrap_content" | ||
| 11 | android:minHeight="70dp" > | ||
| 12 | |||
| 13 | <ImageView | ||
| 14 | android:id="@+id/cancel" | ||
| 15 | android:layout_width="wrap_content" | ||
| 16 | android:layout_height="wrap_content" | ||
| 17 | android:layout_centerVertical="true" | ||
| 18 | android:layout_alignParentRight="true" | ||
| 19 | android:padding="20dp" | ||
| 20 | android:src="@mipmap/cancel_fork" /> | ||
| 21 | |||
| 22 | <TextView | ||
| 23 | android:id="@+id/menu_title" | ||
| 24 | android:layout_width="wrap_content" | ||
| 25 | android:layout_height="wrap_content" | ||
| 26 | android:layout_centerInParent="true" | ||
| 27 | android:padding="20dp" | ||
| 28 | android:text="请选择城市" | ||
| 29 | android:textColor="@android:color/black" | ||
| 30 | android:textSize="22sp" /> | ||
| 31 | </RelativeLayout> | ||
| 32 | <ListView | ||
| 33 | android:id="@+id/listadapter" | ||
| 34 | android:layout_width="match_parent" | ||
| 35 | android:layout_height="400dp"> | ||
| 36 | |||
| 37 | </ListView> | ||
| 38 | </LinearLayout> | ||
| 39 |
PersonalCenter/app/src/main/res/layout/custom_adilog_countrylist.xml
| File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | android:layout_width="match_parent" | ||
| 4 | android:layout_height="match_parent" | ||
| 5 | android:orientation="vertical"> | ||
| 6 | |||
| 7 | <RelativeLayout | ||
| 8 | android:id="@+id/title" | ||
| 9 | android:layout_width="match_parent" | ||
| 10 | android:layout_height="wrap_content" | ||
| 11 | android:minHeight="70dp" > | ||
| 12 | |||
| 13 | <ImageView | ||
| 14 | android:id="@+id/cancel" | ||
| 15 | android:layout_width="wrap_content" | ||
| 16 | android:layout_height="wrap_content" | ||
| 17 | android:layout_centerVertical="true" | ||
| 18 | android:layout_alignParentRight="true" | ||
| 19 | android:padding="20dp" | ||
| 20 | android:src="@mipmap/cancel_fork" /> | ||
| 21 | |||
| 22 | <TextView | ||
| 23 | android:id="@+id/menu_title" | ||
| 24 | android:layout_width="wrap_content" | ||
| 25 | android:layout_height="wrap_content" | ||
| 26 | android:layout_centerInParent="true" | ||
| 27 | android:padding="20dp" | ||
| 28 | android:text="请选择地区" | ||
| 29 | android:textColor="@android:color/black" | ||
| 30 | android:textSize="22sp" /> | ||
| 31 | </RelativeLayout> | ||
| 32 | <ListView | ||
| 33 | android:id="@+id/listadapter" | ||
| 34 | android:layout_width="match_parent" | ||
| 35 | android:layout_height="400dp"> | ||
| 36 | |||
| 37 | </ListView> | ||
| 38 | </LinearLayout> | ||
| 39 |
PersonalCenter/app/src/main/res/layout/custom_adilog_lhead.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:minHeight="70dp" > | 11 | android:minHeight="70dp" > |
| 12 | 12 | ||
| 13 | <TextView | 13 | <TextView |
| 14 | android:id="@+id/menu_title" | 14 | android:id="@+id/menu_title" |
| 15 | android:layout_width="wrap_content" | 15 | android:layout_width="wrap_content" |
| 16 | android:layout_height="wrap_content" | 16 | android:layout_height="wrap_content" |
| 17 | android:layout_centerInParent="true" | 17 | android:layout_centerInParent="true" |
| 18 | android:padding="20dp" | 18 | android:padding="20dp" |
| 19 | android:text="个人头像" | 19 | android:text="个人头像" |
| 20 | android:textColor="@android:color/black" | 20 | android:textColor="@android:color/black" |
| 21 | android:textSize="22sp" /> | 21 | android:textSize="22sp" /> |
| 22 | </RelativeLayout> | 22 | </RelativeLayout> |
| 23 | <LinearLayout | 23 | <LinearLayout |
| 24 | android:layout_width="match_parent" | 24 | android:layout_width="match_parent" |
| 25 | android:layout_height="225dp" | 25 | android:layout_height="230dp" |
| 26 | android:layout_margin="20dp" | 26 | android:layout_margin="20dp" |
| 27 | android:orientation="vertical"> | 27 | android:orientation="vertical"> |
| 28 | <TextView | 28 | <TextView |
| 29 | android:layout_width="wrap_content" | 29 | android:layout_width="wrap_content" |
| 30 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
| 31 | android:layout_marginLeft="50dp" | 31 | android:layout_marginLeft="50dp" |
| 32 | android:textSize="18sp" | 32 | android:textSize="18sp" |
| 33 | android:text="默认头像"/> | 33 | android:text="默认头像"/> |
| 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:gravity="center" | 37 | android:gravity="center" |
| 38 | android:layout_marginTop="10dp" | 38 | android:layout_marginTop="10dp" |
| 39 | android:orientation="horizontal"> | 39 | android:orientation="horizontal"> |
| 40 | <ImageView | 40 | <ImageView |
| 41 | android:layout_width="wrap_content" | 41 | android:layout_width="wrap_content" |
| 42 | android:layout_height="wrap_content" | 42 | android:layout_height="wrap_content" |
| 43 | android:layout_margin="10dp" | 43 | android:layout_margin="10dp" |
| 44 | android:src="@mipmap/ic_launcher"/> | 44 | android:src="@mipmap/ic_launcher"/> |
| 45 | <ImageView | 45 | <ImageView |
| 46 | android:layout_width="wrap_content" | 46 | android:layout_width="wrap_content" |
| 47 | android:layout_height="wrap_content" | 47 | android:layout_height="wrap_content" |
| 48 | android:layout_margin="10dp" | 48 | android:layout_margin="10dp" |
| 49 | android:src="@mipmap/ic_launcher"/> | 49 | android:src="@mipmap/ic_launcher"/> |
| 50 | <ImageView | 50 | <ImageView |
| 51 | android:layout_width="wrap_content" | 51 | android:layout_width="wrap_content" |
| 52 | android:layout_height="wrap_content" | 52 | android:layout_height="wrap_content" |
| 53 | android:layout_margin="10dp" | 53 | android:layout_margin="10dp" |
| 54 | android:src="@mipmap/ic_launcher"/> | 54 | android:src="@mipmap/ic_launcher"/> |
| 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:layout_margin="10dp" | 58 | android:layout_margin="10dp" |
| 59 | android:src="@mipmap/ic_launcher"/> | 59 | android:src="@mipmap/ic_launcher"/> |
| 60 | 60 | ||
| 61 | </LinearLayout> | 61 | </LinearLayout> |
| 62 | <LinearLayout | 62 | <LinearLayout |
| 63 | android:layout_width="match_parent" | 63 | android:layout_width="match_parent" |
| 64 | android:layout_height="wrap_content" | 64 | android:layout_height="wrap_content" |
| 65 | android:gravity="center" | 65 | android:gravity="center" |
| 66 | android:layout_marginTop="10dp" | 66 | android:layout_marginTop="10dp" |
| 67 | android:orientation="horizontal"> | 67 | android:orientation="horizontal"> |
| 68 | <LinearLayout | 68 | <LinearLayout |
| 69 | android:id="@+id/take_pic" | ||
| 69 | android:layout_width="0dp" | 70 | android:layout_width="0dp" |
| 70 | android:layout_weight="1" | 71 | android:layout_weight="1" |
| 71 | android:gravity="center" | 72 | android:gravity="center" |
| 72 | android:layout_height="wrap_content"> | 73 | android:layout_height="wrap_content"> |
| 73 | <ImageView | 74 | <ImageView |
| 74 | android:layout_width="wrap_content" | 75 | android:layout_width="wrap_content" |
| 75 | android:layout_height="wrap_content" | 76 | android:layout_height="wrap_content" |
| 76 | android:layout_margin="10dp" | 77 | android:layout_margin="10dp" |
| 77 | android:src="@mipmap/paizhao"/> | 78 | android:src="@mipmap/paizhao"/> |
| 78 | <TextView | 79 | <TextView |
| 79 | android:layout_width="wrap_content" | 80 | android:layout_width="wrap_content" |
| 80 | android:layout_height="wrap_content" | 81 | android:layout_height="wrap_content" |
| 81 | android:layout_gravity="center_vertical" | 82 | android:layout_gravity="center_vertical" |
| 82 | android:textSize="18sp" | 83 | android:textSize="18sp" |
| 83 | android:text="拍一张"/> | 84 | android:text="拍一张"/> |
| 84 | 85 | ||
| 85 | </LinearLayout> | 86 | </LinearLayout> |
| 86 | <LinearLayout | 87 | <LinearLayout |
| 88 | android:id="@+id/xiangce" | ||
| 87 | android:layout_width="0dp" | 89 | android:layout_width="0dp" |
| 88 | android:layout_weight="1" | 90 | android:layout_weight="1" |
| 89 | android:gravity="center" | 91 | android:gravity="center" |
| 90 | android:layout_height="wrap_content"> | 92 | android:layout_height="wrap_content"> |
| 91 | <ImageView | 93 | <ImageView |
| 92 | android:layout_width="wrap_content" | 94 | android:layout_width="wrap_content" |
| 93 | android:layout_height="wrap_content" | 95 | android:layout_height="wrap_content" |
| 94 | android:layout_margin="10dp" | 96 | android:layout_margin="10dp" |
| 95 | android:src="@mipmap/xiangce"/> | 97 | android:src="@mipmap/xiangce"/> |
| 96 | <TextView | 98 | <TextView |
| 97 | android:layout_width="wrap_content" | 99 | android:layout_width="wrap_content" |
| 98 | android:layout_height="wrap_content" | 100 | android:layout_height="wrap_content" |
| 99 | android:layout_gravity="center_vertical" | 101 | android:layout_gravity="center_vertical" |
| 100 | android:textSize="18sp" | 102 | android:textSize="18sp" |
| 101 | android:text="相册"/> | 103 | android:text="相册"/> |
| 102 | 104 | ||
| 103 | 105 | ||
| 104 | </LinearLayout> | 106 | </LinearLayout> |
| 105 | 107 | ||
| 106 | 108 | ||
| 107 | </LinearLayout> | 109 | </LinearLayout> |
| 108 | <View | 110 | <View |
| 109 | android:layout_marginTop="10dp" | 111 | android:layout_marginTop="10dp" |
| 110 | android:layout_width="match_parent" | 112 | android:layout_width="match_parent" |
| 111 | android:background="@color/cutoff_line" | 113 | android:background="@color/cutoff_line" |
| 112 | android:layout_height="0.7dp"> | 114 | android:layout_height="0.7dp"> |
| 113 | 115 | ||
| 114 | </View> | 116 | </View> |
| 115 | <LinearLayout | 117 | <LinearLayout |
| 116 | android:layout_width="match_parent" | 118 | android:layout_width="match_parent" |
| 117 | android:layout_height="wrap_content" | 119 | android:layout_height="wrap_content" |
| 118 | android:gravity="center" | 120 | android:gravity="center" |
| 119 | android:orientation="horizontal"> | 121 | android:orientation="horizontal"> |
| 120 | 122 | ||
| 121 | <TextView | 123 | <TextView |
| 122 | android:id="@+id/canceltakephone" | 124 | android:id="@+id/canceltakephone" |
| 123 | android:layout_width="0dp" | 125 | android:layout_width="0dp" |
| 124 | android:layout_weight="1" | 126 | android:layout_weight="1" |
| 125 | android:layout_marginTop="10dp" | 127 | android:layout_marginTop="10dp" |
| 126 | android:layout_height="wrap_content" | 128 | android:layout_height="wrap_content" |
| 127 | android:gravity="center" | 129 | android:gravity="center" |
| 128 | android:textSize="18sp" | 130 | android:textSize="18sp" |
| 129 | android:text="取消"/> | 131 | android:text="取消"/> |
| 130 | <View | 132 | <View |
| 131 | android:layout_width="0.7dp" | 133 | android:layout_width="0.7dp" |
| 132 | android:layout_height="match_parent" | 134 | android:layout_height="match_parent" |
| 133 | android:background="@color/cutoff_line"> | 135 | android:background="@color/cutoff_line"> |
| 134 | 136 | ||
| 135 | </View> | 137 | </View> |
| 136 | 138 | ||
| 137 | <TextView | 139 | <TextView |
| 138 | android:id="@+id/oktakephone" | 140 | android:id="@+id/oktakephone" |
| 139 | android:layout_width="0dp" | 141 | android:layout_width="0dp" |
| 140 | android:layout_weight="1" | 142 | android:layout_weight="1" |
| 141 | android:layout_height="wrap_content" | 143 | android:layout_height="wrap_content" |
| 142 | android:layout_marginTop="10dp" | 144 | android:layout_marginTop="10dp" |
| 143 | android:gravity="center" | 145 | android:gravity="center" |
| 144 | android:textSize="18sp" | 146 | android:textSize="18sp" |
| 145 | android:text="确定"/> | 147 | android:text="确定"/> |
| 146 | 148 | ||
| 147 | </LinearLayout> | 149 | </LinearLayout> |
| 148 | 150 | ||
| 149 | </LinearLayout> | 151 | </LinearLayout> |
| 150 | </LinearLayout> | 152 | </LinearLayout> |
| 151 | 153 |