Commit 0034c56ebb66415561545ee73297dc3ee5521b09
1 parent
522aba5124
Exists in
master
完善个人中心
Showing
11 changed files
with
115 additions
and
38 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/MainActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
| 6 | import android.net.Uri; | 6 | import android.net.Uri; |
| 7 | import android.os.Build; | 7 | import android.os.Build; |
| 8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
| 9 | import android.os.Handler; | 9 | import android.os.Handler; |
| 10 | import android.os.Message; | 10 | import android.os.Message; |
| 11 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
| 12 | import android.support.annotation.NonNull; | 12 | import android.support.annotation.NonNull; |
| 13 | import android.support.v4.content.FileProvider; | 13 | import android.support.v4.content.FileProvider; |
| 14 | import android.support.v7.app.AppCompatActivity; | 14 | import android.support.v7.app.AppCompatActivity; |
| 15 | import android.support.v7.widget.LinearLayoutManager; | 15 | import android.support.v7.widget.LinearLayoutManager; |
| 16 | import android.support.v7.widget.RecyclerView; | 16 | import android.support.v7.widget.RecyclerView; |
| 17 | import android.view.KeyEvent; | 17 | import android.view.KeyEvent; |
| 18 | import android.view.View; | 18 | import android.view.View; |
| 19 | import android.widget.ImageView; | 19 | import android.widget.ImageView; |
| 20 | import android.widget.LinearLayout; | 20 | import android.widget.LinearLayout; |
| 21 | import android.widget.TextView; | 21 | import android.widget.TextView; |
| 22 | import android.widget.Toast; | 22 | import android.widget.Toast; |
| 23 | 23 | ||
| 24 | import com.facebook.drawee.backends.pipeline.Fresco; | 24 | import com.facebook.drawee.backends.pipeline.Fresco; |
| 25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
| 26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
| 27 | import com.facebook.drawee.generic.RoundingParams; | 27 | import com.facebook.drawee.generic.RoundingParams; |
| 28 | import com.facebook.drawee.interfaces.DraweeController; | 28 | import com.facebook.drawee.interfaces.DraweeController; |
| 29 | import com.facebook.drawee.view.SimpleDraweeView; | 29 | import com.facebook.drawee.view.SimpleDraweeView; |
| 30 | import com.hjx.personalcenter.R; | 30 | import com.hjx.personalcenter.R; |
| 31 | import com.hjx.personalcenter.adapter.GalleryAdapter; | 31 | import com.hjx.personalcenter.adapter.GalleryAdapter; |
| 32 | import com.hjx.personalcenter.adapter.VideoAdapter; | 32 | import com.hjx.personalcenter.adapter.VideoAdapter; |
| 33 | import com.hjx.personalcenter.customdialog.HeadDialog; | 33 | import com.hjx.personalcenter.customdialog.HeadDialog; |
| 34 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 34 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
| 35 | import com.hjx.personalcenter.db.SaveParam; | 35 | import com.hjx.personalcenter.db.SaveParam; |
| 36 | import com.hjx.personalcenter.http.HttpCode; | 36 | import com.hjx.personalcenter.http.HttpCode; |
| 37 | import com.hjx.personalcenter.http.HttpManager; | 37 | import com.hjx.personalcenter.http.HttpManager; |
| 38 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 38 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 39 | import com.hjx.personalcenter.model.DefautPublishInfo; | 39 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 40 | import com.hjx.personalcenter.model.PesonalInfo; | 40 | import com.hjx.personalcenter.model.PesonalInfo; |
| 41 | import com.hjx.personalcenter.model.SignInfo; | 41 | import com.hjx.personalcenter.model.SignInfo; |
| 42 | import com.hjx.personalcenter.model.VideoInfo; | 42 | import com.hjx.personalcenter.model.VideoInfo; |
| 43 | import com.hjx.personalcenter.update.UpdateChecker; | 43 | import com.hjx.personalcenter.update.UpdateChecker; |
| 44 | import com.hjx.personalcenter.util.AlertUtils; | 44 | import com.hjx.personalcenter.util.AlertUtils; |
| 45 | import com.hjx.personalcenter.util.BrithdayStar; | ||
| 45 | import com.hjx.personalcenter.util.CropUtils; | 46 | import com.hjx.personalcenter.util.CropUtils; |
| 46 | import com.hjx.personalcenter.util.DialogPermission; | 47 | import com.hjx.personalcenter.util.DialogPermission; |
| 47 | import com.hjx.personalcenter.util.FileUtil; | 48 | import com.hjx.personalcenter.util.FileUtil; |
| 48 | import com.hjx.personalcenter.util.GetDevicesUtil; | 49 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 49 | import com.hjx.personalcenter.util.PermissionUtil; | 50 | import com.hjx.personalcenter.util.PermissionUtil; |
| 50 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 51 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
| 51 | import com.mylhyl.circledialog.CircleDialog; | 52 | import com.mylhyl.circledialog.CircleDialog; |
| 52 | import com.mylhyl.circledialog.callback.ConfigInput; | 53 | import com.mylhyl.circledialog.callback.ConfigInput; |
| 53 | import com.mylhyl.circledialog.params.InputParams; | 54 | import com.mylhyl.circledialog.params.InputParams; |
| 54 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 55 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
| 55 | import com.zaaach.toprightmenu.MenuItem; | 56 | import com.zaaach.toprightmenu.MenuItem; |
| 56 | import com.zaaach.toprightmenu.TopRightMenu; | 57 | import com.zaaach.toprightmenu.TopRightMenu; |
| 57 | 58 | ||
| 58 | import org.json.JSONException; | 59 | import org.json.JSONException; |
| 59 | import org.json.JSONObject; | 60 | import org.json.JSONObject; |
| 60 | 61 | ||
| 61 | import java.io.File; | 62 | import java.io.File; |
| 62 | import java.io.UnsupportedEncodingException; | 63 | import java.io.UnsupportedEncodingException; |
| 63 | import java.util.ArrayList; | 64 | import java.util.ArrayList; |
| 64 | import java.util.List; | 65 | import java.util.List; |
| 65 | 66 | ||
| 66 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 67 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
| 67 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; | 68 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; |
| 68 | private TextView tv_edit_presoninfo, tv_sign, | 69 | private TextView tv_edit_presoninfo, tv_sign, |
| 69 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 70 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
| 70 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; | 71 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; |
| 71 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; | 72 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; |
| 72 | private TopRightMenu mTopRightMenu; | 73 | private TopRightMenu mTopRightMenu; |
| 73 | //水平滑动 | 74 | //水平滑动 |
| 74 | private RecyclerView mRecyclerView; | 75 | private RecyclerView mRecyclerView; |
| 75 | private RecyclerView mRecyclerViewpublish; | 76 | private RecyclerView mRecyclerViewpublish; |
| 76 | private VideoAdapter RecyclerViewadapter; | 77 | private VideoAdapter RecyclerViewadapter; |
| 77 | private GalleryAdapter RecyclerViewadapterpublish; | 78 | private GalleryAdapter RecyclerViewadapterpublish; |
| 78 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 79 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
| 79 | 80 | ||
| 80 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); | 81 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); |
| 81 | private boolean showIcon = true; | 82 | private boolean showIcon = true; |
| 82 | private boolean dimBg = true; | 83 | private boolean dimBg = true; |
| 83 | private boolean needAnim = true; | 84 | private boolean needAnim = true; |
| 84 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 85 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
| 85 | private static final int REQUEST_CODE_ALBUM = 2; | 86 | private static final int REQUEST_CODE_ALBUM = 2; |
| 86 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 87 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
| 87 | SimpleDraweeView mSimpleDraweeView; | 88 | SimpleDraweeView mSimpleDraweeView; |
| 88 | private File file; | 89 | private File file; |
| 89 | private Uri uri; | 90 | private Uri uri; |
| 90 | Handler handler = new Handler() { | 91 | Handler handler = new Handler() { |
| 91 | @Override | 92 | @Override |
| 92 | public void handleMessage(Message msg) { | 93 | public void handleMessage(Message msg) { |
| 93 | super.handleMessage(msg); | 94 | super.handleMessage(msg); |
| 94 | switch (msg.what) { | 95 | switch (msg.what) { |
| 95 | case HttpCode.GETINFO: | 96 | case HttpCode.GETINFO: |
| 96 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; | 97 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; |
| 97 | tv_username.setText(cardinfoBean.getNickName()); | 98 | tv_username.setText(cardinfoBean.getNickName()); |
| 98 | tv_username1.setText(cardinfoBean.getNickName()); | 99 | tv_username1.setText(cardinfoBean.getNickName()); |
| 99 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 100 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
| 100 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 101 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
| 101 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 102 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
| 102 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 103 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
| 103 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 104 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
| 104 | String sex = cardinfoBean.getGender(); | 105 | String sex = cardinfoBean.getGender(); |
| 105 | if ("0".equals(sex)) { | 106 | if ("0".equals(sex)) { |
| 106 | tv_sex.setText("男"); | 107 | tv_sex.setText("男"); |
| 107 | iv_sex.setImageResource(R.mipmap.men); | 108 | iv_sex.setImageResource(R.mipmap.men); |
| 108 | } else { | 109 | } else { |
| 109 | tv_sex.setText("女"); | 110 | tv_sex.setText("女"); |
| 110 | iv_sex.setImageResource(R.mipmap.women); | 111 | iv_sex.setImageResource(R.mipmap.women); |
| 111 | } | 112 | } |
| 112 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | 113 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); |
| 114 | //加载星座 | ||
| 115 | BrithdayStar brithdayStar = new BrithdayStar(); | ||
| 116 | if (cardinfoBean.getBirthday() ==null||"".equals(cardinfoBean.getBirthday())) { | ||
| 117 | tv_mygad.setText(""); | ||
| 118 | } else { | ||
| 119 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); | ||
| 120 | tv_mygad.setText(xiongzuo); | ||
| 121 | } | ||
| 122 | //保存个人信息 | ||
| 123 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTUSERNAME,cardinfoBean.getNickName()); | ||
| 124 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTGRADES,cardinfoBean.getGrade().getGradeName()); | ||
| 125 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTSCHOOL,cardinfoBean.getSchool().getSchoolName()); | ||
| 126 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTCONSTELLATION,cardinfoBean.getBirthday()); | ||
| 127 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTSEX,tv_sex.getText().toString()); | ||
| 128 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTQQ,cardinfoBean.getQq()); | ||
| 129 | |||
| 113 | String graderID = cardinfoBean.getGrade().getGradeId(); | 130 | String graderID = cardinfoBean.getGrade().getGradeId(); |
| 114 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 131 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
| 115 | //账户类型 | 132 | //账户类型 |
| 116 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 133 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
| 117 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 134 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
| 118 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.GRADENS, "" + graderID); | 135 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.GRADENS, "" + graderID); |
| 119 | try { | 136 | try { |
| 120 | Object auserID; | 137 | Object auserID; |
| 121 | int type; | 138 | int type; |
| 122 | int graderIDs = Integer.parseInt(graderID); | 139 | int graderIDs = Integer.parseInt(graderID); |
| 123 | if ("2".equals(accounts)) { | 140 | if ("2".equals(accounts)) { |
| 124 | type = Integer.parseInt(accounts); | 141 | type = Integer.parseInt(accounts); |
| 125 | auserID = childID; | 142 | auserID = childID; |
| 126 | } else { | 143 | } else { |
| 127 | type = Integer.parseInt(accounts); | 144 | type = Integer.parseInt(accounts); |
| 128 | auserID = Long.parseLong(userID); | 145 | auserID = Long.parseLong(userID); |
| 129 | } | 146 | } |
| 130 | //获取版本信息 | 147 | //获取版本信息 |
| 131 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); | 148 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); |
| 132 | 149 | ||
| 133 | } catch (NumberFormatException e) { | 150 | } catch (NumberFormatException e) { |
| 134 | e.printStackTrace(); | 151 | e.printStackTrace(); |
| 135 | } | 152 | } |
| 136 | 153 | ||
| 137 | break; | 154 | break; |
| 138 | case HttpCode.SIGN: | 155 | case HttpCode.SIGN: |
| 139 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; | 156 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; |
| 140 | if (dataBean.getSignature() == null) { | 157 | if (dataBean.getSignature() == null) { |
| 141 | tv_sign.setText("你还未设置个性签名"); | 158 | tv_sign.setText("你还未设置个性签名"); |
| 142 | } else { | 159 | } else { |
| 143 | tv_sign.setText(dataBean.getSignature()); | 160 | tv_sign.setText(dataBean.getSignature()); |
| 144 | } | 161 | } |
| 145 | 162 | ||
| 146 | break; | 163 | break; |
| 147 | case HttpCode.PUBLISH_SUCESS: | 164 | case HttpCode.PUBLISH_SUCESS: |
| 148 | defautPublishInfos.clear(); | 165 | defautPublishInfos.clear(); |
| 149 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 166 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
| 150 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 167 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
| 151 | break; | 168 | break; |
| 152 | case HttpCode.GETVIDIO_SUCESS: | 169 | case HttpCode.GETVIDIO_SUCESS: |
| 153 | videoinfo.clear(); | 170 | videoinfo.clear(); |
| 154 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); | 171 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); |
| 155 | RecyclerViewadapter.notifyDataSetChanged(); | 172 | RecyclerViewadapter.notifyDataSetChanged(); |
| 156 | break; | 173 | break; |
| 157 | case HttpCode.SUCHCARDINFOONE: | 174 | case HttpCode.SUCHCARDINFOONE: |
| 158 | JSONObject jsonObject; | 175 | JSONObject jsonObject; |
| 159 | String status; | 176 | String status; |
| 160 | try { | 177 | try { |
| 161 | jsonObject = new JSONObject((String) msg.obj); | 178 | jsonObject = new JSONObject((String) msg.obj); |
| 162 | status = jsonObject.getString("status"); | 179 | status = jsonObject.getString("status"); |
| 163 | if (status.equals("1")) { | 180 | if (status.equals("1")) { |
| 164 | tv_yangji.setVisibility(View.GONE); | 181 | tv_yangji.setVisibility(View.GONE); |
| 165 | iv_look_card.setVisibility(View.VISIBLE); | 182 | iv_look_card.setVisibility(View.VISIBLE); |
| 166 | } else if (status.equals("2001")) { | 183 | } else if (status.equals("2001")) { |
| 167 | tv_yangji.setVisibility(View.GONE); | 184 | tv_yangji.setVisibility(View.GONE); |
| 168 | iv_look_card.setVisibility(View.VISIBLE); | 185 | iv_look_card.setVisibility(View.VISIBLE); |
| 169 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息,请重新登录"); | 186 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息,请重新登录"); |
| 170 | SaveParam.getInstance().clearData(MainActivity.this); | 187 | SaveParam.getInstance().clearData(MainActivity.this); |
| 171 | Intent settingintent = new Intent(); | 188 | Intent settingintent = new Intent(); |
| 172 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 189 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 173 | startActivity(settingintent); | 190 | startActivity(settingintent); |
| 174 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 191 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 175 | finish(); | 192 | finish(); |
| 176 | } else if (status.equals("2002")) { | 193 | } else if (status.equals("2002")) { |
| 177 | iv_look_card.setVisibility(View.GONE); | 194 | iv_look_card.setVisibility(View.GONE); |
| 178 | tv_yangji.setVisibility(View.VISIBLE); | 195 | tv_yangji.setVisibility(View.VISIBLE); |
| 179 | 196 | ||
| 180 | } else { | 197 | } else { |
| 181 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); | 198 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); |
| 182 | } | 199 | } |
| 183 | } catch (JSONException e) { | 200 | } catch (JSONException e) { |
| 184 | e.printStackTrace(); | 201 | e.printStackTrace(); |
| 185 | } | 202 | } |
| 186 | 203 | ||
| 187 | 204 | ||
| 188 | } | 205 | } |
| 189 | } | 206 | } |
| 190 | }; | 207 | }; |
| 191 | 208 | ||
| 192 | @Override | 209 | @Override |
| 193 | protected void onCreate(Bundle savedInstanceState) { | 210 | protected void onCreate(Bundle savedInstanceState) { |
| 194 | super.onCreate(savedInstanceState); | 211 | super.onCreate(savedInstanceState); |
| 195 | Fresco.initialize(this); | 212 | Fresco.initialize(this); |
| 196 | setContentView(R.layout.activity_main); | 213 | setContentView(R.layout.activity_main); |
| 197 | initView(); | 214 | initView(); |
| 198 | initData(); | 215 | initData(); |
| 199 | initLister(); | 216 | initLister(); |
| 200 | updateVersion(); | 217 | updateVersion(); |
| 201 | } | 218 | } |
| 202 | 219 | ||
| 203 | //////版本更新 | 220 | //////版本更新 |
| 204 | private void updateVersion() { | 221 | private void updateVersion() { |
| 205 | UpdateChecker updateChecker = new UpdateChecker(this); | 222 | UpdateChecker updateChecker = new UpdateChecker(this); |
| 206 | updateChecker.checkForUpdates(); | 223 | updateChecker.checkForUpdates(); |
| 207 | 224 | ||
| 208 | 225 | ||
| 209 | } | 226 | } |
| 210 | 227 | ||
| 211 | private void initView() { | 228 | private void initView() { |
| 212 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 229 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
| 213 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); | 230 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); |
| 214 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); | 231 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); |
| 215 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 232 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
| 216 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 233 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
| 217 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 234 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
| 218 | //头像 | 235 | //头像 |
| 219 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 236 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
| 220 | //初始化个人信息 | 237 | //初始化个人信息 |
| 221 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 238 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
| 222 | tv_username = (TextView) findViewById(R.id.tv_username); | 239 | tv_username = (TextView) findViewById(R.id.tv_username); |
| 223 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 240 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
| 224 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 241 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
| 225 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 242 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
| 226 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 243 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
| 227 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 244 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
| 228 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 245 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
| 229 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 246 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
| 230 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 247 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
| 231 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); | 248 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); |
| 232 | //跳转其他应用 | 249 | //跳转其他应用 |
| 233 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); | 250 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); |
| 234 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); | 251 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); |
| 235 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); | 252 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); |
| 236 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); | 253 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); |
| 237 | // | 254 | // |
| 238 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 255 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
| 239 | mRecyclerViewpublish = (RecyclerView) findViewById(R.id.id_recyclerview_pubish); | 256 | mRecyclerViewpublish = (RecyclerView) findViewById(R.id.id_recyclerview_pubish); |
| 240 | 257 | ||
| 241 | } | 258 | } |
| 242 | 259 | ||
| 243 | 260 | ||
| 244 | private void initData() { | 261 | private void initData() { |
| 245 | //设置布局管理器 | 262 | //设置布局管理器 |
| 246 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 263 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
| 247 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 264 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
| 248 | 265 | ||
| 249 | LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); | 266 | LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); |
| 250 | linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); | 267 | linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); |
| 251 | 268 | ||
| 252 | mRecyclerView.setLayoutManager(linearLayoutManager); | 269 | mRecyclerView.setLayoutManager(linearLayoutManager); |
| 253 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); | 270 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); |
| 254 | 271 | ||
| 255 | mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); | 272 | mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); |
| 256 | mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); | 273 | mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); |
| 257 | 274 | ||
| 258 | //设置视频适配器 | 275 | //设置视频适配器 |
| 259 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); | 276 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); |
| 260 | RecyclerViewadapterpublish = new GalleryAdapter(this, defautPublishInfos); | 277 | RecyclerViewadapterpublish = new GalleryAdapter(this, defautPublishInfos); |
| 261 | 278 | ||
| 262 | //版本信息适配器 | 279 | //版本信息适配器 |
| 263 | mRecyclerView.setAdapter(RecyclerViewadapter); | 280 | mRecyclerView.setAdapter(RecyclerViewadapter); |
| 264 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | 281 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); |
| 265 | //判断保卡信息是否为样机 | 282 | //判断保卡信息是否为样机 |
| 266 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); | 283 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); |
| 267 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); | 284 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); |
| 268 | if ("1".equals(yangji)) { | 285 | if ("1".equals(yangji)) { |
| 269 | iv_look_card.setVisibility(View.GONE); | 286 | iv_look_card.setVisibility(View.GONE); |
| 270 | tv_yangji.setVisibility(View.VISIBLE); | 287 | tv_yangji.setVisibility(View.VISIBLE); |
| 271 | } else { | 288 | } else { |
| 272 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); | 289 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); |
| 273 | 290 | ||
| 274 | } | 291 | } |
| 275 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 292 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 276 | //获取个性签名 | 293 | //获取个性签名 |
| 277 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 294 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 278 | try { | 295 | try { |
| 279 | long auserID = Long.parseLong(userID); | 296 | long auserID = Long.parseLong(userID); |
| 280 | int typeaccount1 = Integer.parseInt(typeaccount); | 297 | int typeaccount1 = Integer.parseInt(typeaccount); |
| 281 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); | 298 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); |
| 282 | 299 | ||
| 283 | } catch (NumberFormatException e) { | 300 | } catch (NumberFormatException e) { |
| 284 | e.printStackTrace(); | 301 | e.printStackTrace(); |
| 285 | } | 302 | } |
| 286 | 303 | ||
| 287 | //初始化图片 | 304 | //初始化图片 |
| 288 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 305 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
| 289 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 306 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 290 | uri = Uri.fromFile(file); | 307 | uri = Uri.fromFile(file); |
| 291 | } else { | 308 | } else { |
| 292 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 309 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
| 293 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 310 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
| 294 | } | 311 | } |
| 295 | 312 | ||
| 296 | } | 313 | } |
| 297 | 314 | ||
| 298 | private void initLister() { | 315 | private void initLister() { |
| 299 | iv_imformatioan.setOnClickListener(this); | 316 | iv_imformatioan.setOnClickListener(this); |
| 300 | iv_look_card.setOnClickListener(this); | 317 | iv_look_card.setOnClickListener(this); |
| 301 | tv_edit_presoninfo.setOnClickListener(this); | 318 | tv_edit_presoninfo.setOnClickListener(this); |
| 302 | iv_setting.setOnClickListener(this); | 319 | iv_setting.setOnClickListener(this); |
| 303 | iv_sign.setOnClickListener(this); | 320 | iv_sign.setOnClickListener(this); |
| 304 | mSimpleDraweeView.setOnClickListener(this); | 321 | mSimpleDraweeView.setOnClickListener(this); |
| 305 | linel_mycuoti.setOnClickListener(this); | 322 | linel_mycuoti.setOnClickListener(this); |
| 306 | linel_mynote.setOnClickListener(this); | 323 | linel_mynote.setOnClickListener(this); |
| 307 | linel_mycollege.setOnClickListener(this); | 324 | linel_mycollege.setOnClickListener(this); |
| 308 | linel_myclass.setOnClickListener(this); | 325 | linel_myclass.setOnClickListener(this); |
| 309 | 326 | ||
| 310 | } | 327 | } |
| 311 | 328 | ||
| 312 | @Override | 329 | @Override |
| 313 | public void onClick(View v) { | 330 | public void onClick(View v) { |
| 314 | switch (v.getId()) { | 331 | switch (v.getId()) { |
| 315 | case R.id.iv_imformatioan: | 332 | case R.id.iv_imformatioan: |
| 316 | Intent intent = new Intent(); | 333 | Intent intent = new Intent(); |
| 317 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 334 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
| 318 | startActivity(intent); | 335 | startActivity(intent); |
| 319 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 336 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 320 | break; | 337 | break; |
| 321 | case R.id.iv_look_card: | 338 | case R.id.iv_look_card: |
| 322 | Intent lookintent = new Intent(); | 339 | Intent lookintent = new Intent(); |
| 323 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 340 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
| 324 | startActivity(lookintent); | 341 | startActivity(lookintent); |
| 325 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 342 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 326 | break; | 343 | break; |
| 327 | case R.id.tv_edit_presoninfo: | 344 | case R.id.tv_edit_presoninfo: |
| 328 | Intent editintent = new Intent(); | 345 | Intent editintent = new Intent(); |
| 329 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 346 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
| 330 | startActivity(editintent); | 347 | startActivity(editintent); |
| 331 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 348 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 332 | break; | 349 | break; |
| 333 | case R.id.iv_head: | 350 | case R.id.iv_head: |
| 334 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 351 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
| 335 | break; | 352 | break; |
| 336 | case R.id.iv_setting: | 353 | case R.id.iv_setting: |
| 337 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 354 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
| 338 | List<MenuItem> menuItems = new ArrayList<>(); | 355 | List<MenuItem> menuItems = new ArrayList<>(); |
| 339 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 356 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); |
| 340 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 357 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); |
| 341 | mTopRightMenu | 358 | mTopRightMenu |
| 342 | .setHeight(150) //默认高度480 | 359 | .setHeight(150) //默认高度480 |
| 343 | .setWidth(320) //默认宽度wrap_content | 360 | .setWidth(320) //默认宽度wrap_content |
| 344 | .showIcon(showIcon) //显示菜单图标,默认为true | 361 | .showIcon(showIcon) //显示菜单图标,默认为true |
| 345 | .dimBackground(dimBg) //背景变暗,默认为true | 362 | .dimBackground(dimBg) //背景变暗,默认为true |
| 346 | .needAnimationStyle(needAnim) //显示动画,默认为true | 363 | .needAnimationStyle(needAnim) //显示动画,默认为true |
| 347 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 364 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
| 348 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 365 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
| 349 | @Override | 366 | @Override |
| 350 | public void onMenuItemClick(int position) { | 367 | public void onMenuItemClick(int position) { |
| 351 | switch (position) { | 368 | switch (position) { |
| 352 | case 0: | 369 | case 0: |
| 353 | new CircleDialog.Builder(MainActivity.this) | 370 | new CircleDialog.Builder(MainActivity.this) |
| 354 | .setCanceledOnTouchOutside(false) | 371 | .setCanceledOnTouchOutside(false) |
| 355 | .setWidth(0.4f) | 372 | .setWidth(0.4f) |
| 356 | .setCancelable(false) | 373 | .setCancelable(false) |
| 357 | .setText("您确定要退出,更换其他账号登录吗?") | 374 | .setText("您确定要退出,更换其他账号登录吗?") |
| 358 | .setNegative("取消", null) | 375 | .setNegative("取消", null) |
| 359 | .setPositive("确定", new View.OnClickListener() { | 376 | .setPositive("确定", new View.OnClickListener() { |
| 360 | @Override | 377 | @Override |
| 361 | public void onClick(View v) { | 378 | public void onClick(View v) { |
| 362 | //清除数据 | 379 | //清除数据 |
| 363 | SaveParam.getInstance().clearData(MainActivity.this); | 380 | SaveParam.getInstance().clearData(MainActivity.this); |
| 364 | Intent settingintent = new Intent(); | 381 | Intent settingintent = new Intent(); |
| 365 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 382 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 366 | startActivity(settingintent); | 383 | startActivity(settingintent); |
| 367 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 384 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 368 | finish(); | 385 | finish(); |
| 369 | } | 386 | } |
| 370 | }) | 387 | }) |
| 371 | .show(); | 388 | .show(); |
| 372 | break; | 389 | break; |
| 373 | case 1: | 390 | case 1: |
| 374 | Intent accontMintent = new Intent(); | 391 | Intent accontMintent = new Intent(); |
| 375 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 392 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
| 376 | startActivity(accontMintent); | 393 | startActivity(accontMintent); |
| 377 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 394 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 378 | break; | 395 | break; |
| 379 | } | 396 | } |
| 380 | } | 397 | } |
| 381 | }) | 398 | }) |
| 382 | .addMenuList(menuItems) | 399 | .addMenuList(menuItems) |
| 383 | .showAsDropDown(iv_setting, -250, 0); | 400 | .showAsDropDown(iv_setting, -250, 0); |
| 384 | break; | 401 | break; |
| 385 | case R.id.iv_sign: | 402 | case R.id.iv_sign: |
| 386 | new CircleDialog.Builder(this) | 403 | new CircleDialog.Builder(this) |
| 387 | .setCanceledOnTouchOutside(false) | 404 | .setCanceledOnTouchOutside(false) |
| 388 | .setCancelable(true) | 405 | .setCancelable(true) |
| 389 | .setTitle("个性签名") | 406 | .setTitle("个性签名") |
| 390 | .setInputHint("请输入个性签名") | 407 | .setInputHint("请输入个性签名") |
| 391 | .setWidth(0.5f) | 408 | .setWidth(0.5f) |
| 392 | .configInput(new ConfigInput() { | 409 | .configInput(new ConfigInput() { |
| 393 | @Override | 410 | @Override |
| 394 | public void onConfig(InputParams params) { | 411 | public void onConfig(InputParams params) { |
| 395 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 412 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
| 396 | } | 413 | } |
| 397 | }) | 414 | }) |
| 398 | .setNegative("取消", null) | 415 | .setNegative("取消", null) |
| 399 | .setPositiveInput("确定", new OnInputClickListener() { | 416 | .setPositiveInput("确定", new OnInputClickListener() { |
| 400 | @Override | 417 | @Override |
| 401 | public void onClick(String text, View v) { | 418 | public void onClick(String text, View v) { |
| 402 | if (text.equals("")) { | 419 | if (text.equals("")) { |
| 403 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 420 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
| 404 | } else { | 421 | } else { |
| 405 | try { | 422 | try { |
| 406 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 423 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
| 407 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 424 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
| 408 | long auserID = Long.parseLong(userID); | 425 | long auserID = Long.parseLong(userID); |
| 409 | int typeaccount1 = Integer.parseInt(typeaccount); | 426 | int typeaccount1 = Integer.parseInt(typeaccount); |
| 410 | HttpManager.getInstance().changsignature(MainActivity.this, auserID, typeaccount1, text); | 427 | HttpManager.getInstance().changsignature(MainActivity.this, auserID, typeaccount1, text); |
| 411 | } catch (NumberFormatException e) { | 428 | } catch (NumberFormatException e) { |
| 412 | e.printStackTrace(); | 429 | e.printStackTrace(); |
| 413 | } | 430 | } |
| 414 | 431 | ||
| 415 | tv_sign.setText(text); | 432 | tv_sign.setText(text); |
| 416 | } | 433 | } |
| 417 | 434 | ||
| 418 | } | 435 | } |
| 419 | }) | 436 | }) |
| 420 | .show(); | 437 | .show(); |
| 421 | break; | 438 | break; |
| 422 | case R.id.linel_mycuoti: | 439 | case R.id.linel_mycuoti: |
| 423 | AlertUtils.showToast(this, "我的错题 "); | 440 | AlertUtils.showToast(this, "我的错题 "); |
| 424 | break; | 441 | break; |
| 425 | case R.id.linel_mynote: | 442 | case R.id.linel_mynote: |
| 426 | AlertUtils.showToast(this, "我的笔记 "); | 443 | AlertUtils.showToast(this, "我的笔记 "); |
| 427 | break; | 444 | break; |
| 428 | case R.id.linel_mycollege: | 445 | case R.id.linel_mycollege: |
| 429 | AlertUtils.showToast(this, "我的收藏 "); | 446 | AlertUtils.showToast(this, "我的收藏 "); |
| 430 | break; | 447 | break; |
| 431 | case R.id.linel_myclass: | 448 | case R.id.linel_myclass: |
| 432 | AlertUtils.showToast(this, "我的班级 "); | 449 | AlertUtils.showToast(this, "我的班级 "); |
| 433 | break; | 450 | break; |
| 434 | } | 451 | } |
| 435 | 452 | ||
| 436 | } | 453 | } |
| 437 | 454 | ||
| 438 | @Override | 455 | @Override |
| 439 | protected void onPause() { | 456 | protected void onPause() { |
| 440 | super.onPause(); | 457 | super.onPause(); |
| 441 | } | 458 | } |
| 442 | 459 | ||
| 443 | @Override | 460 | @Override |
| 444 | protected void onResume() { | 461 | protected void onResume() { |
| 445 | super.onResume(); | 462 | super.onResume(); |
| 446 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 463 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 447 | //账户类型 | 464 | //账户类型 |
| 448 | String accounts = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 465 | String accounts = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 449 | //加载个人信息 | ||
| 450 | String xiongzuo = SaveParam.getInstance().getLoginParam(this, SaveParam.CONSTELLATION); | ||
| 451 | if (xiongzuo == null) { | ||
| 452 | tv_mygad.setText(""); | ||
| 453 | } else { | ||
| 454 | tv_mygad.setText(xiongzuo); | ||
| 455 | } | ||
| 456 | try { | 466 | try { |
| 457 | int graderID; | 467 | int graderID; |
| 458 | long auserID = Long.parseLong(userID); | 468 | long auserID = Long.parseLong(userID); |
| 459 | int typeaccount1 = Integer.parseInt(accounts); | 469 | int typeaccount1 = Integer.parseInt(accounts); |
| 460 | //获取最近播放视频 | 470 | //获取最近播放视频 |
| 461 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); | 471 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); |
| 462 | //获取个人信息 | 472 | //获取个人信息 |
| 463 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, auserID, typeaccount1, handler); | 473 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, auserID, typeaccount1, handler); |
| 464 | 474 | ||
| 465 | 475 | ||
| 466 | } catch (NumberFormatException e) { | 476 | } catch (NumberFormatException e) { |
| 467 | e.printStackTrace(); | 477 | e.printStackTrace(); |
| 468 | } | 478 | } |
| 469 | 479 | ||
| 470 | } | 480 | } |
| 471 | 481 | ||
| 472 | //回调头像监听 | 482 | //回调头像监听 |
| 473 | @Override | 483 | @Override |
| 474 | public void heard(Context context, View v, int headpitiaon) { | 484 | public void heard(Context context, View v, int headpitiaon) { |
| 475 | String picUrl = ""; | 485 | String picUrl = ""; |
| 476 | String userID; | 486 | String userID; |
| 477 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 487 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 478 | if ("2".equals(typeaccount)) { | 488 | if ("2".equals(typeaccount)) { |
| 479 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 489 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
| 480 | } else { | 490 | } else { |
| 481 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 491 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 482 | } | 492 | } |
| 483 | switch (v.getId()) { | 493 | switch (v.getId()) { |
| 484 | //选择默认图片 | 494 | //选择默认图片 |
| 485 | case R.id.oktakephone: | 495 | case R.id.oktakephone: |
| 486 | if (headpitiaon == 1) { | 496 | if (headpitiaon == 1) { |
| 487 | mSimpleDraweeView.setImageDrawable(null); | 497 | mSimpleDraweeView.setImageDrawable(null); |
| 488 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 498 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
| 489 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; | 499 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; |
| 490 | try { | 500 | try { |
| 491 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 501 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 492 | } catch (UnsupportedEncodingException e) { | 502 | } catch (UnsupportedEncodingException e) { |
| 493 | e.printStackTrace(); | 503 | e.printStackTrace(); |
| 494 | } | 504 | } |
| 495 | } else if (headpitiaon == 2) { | 505 | } else if (headpitiaon == 2) { |
| 496 | mSimpleDraweeView.setImageDrawable(null); | 506 | mSimpleDraweeView.setImageDrawable(null); |
| 497 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 507 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
| 498 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; | 508 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; |
| 499 | try { | 509 | try { |
| 500 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 510 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 501 | } catch (UnsupportedEncodingException e) { | 511 | } catch (UnsupportedEncodingException e) { |
| 502 | e.printStackTrace(); | 512 | e.printStackTrace(); |
| 503 | } | 513 | } |
| 504 | } else if (headpitiaon == 3) { | 514 | } else if (headpitiaon == 3) { |
| 505 | mSimpleDraweeView.setImageDrawable(null); | 515 | mSimpleDraweeView.setImageDrawable(null); |
| 506 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 516 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
| 507 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; | 517 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; |
| 508 | try { | 518 | try { |
| 509 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 519 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 510 | } catch (UnsupportedEncodingException e) { | 520 | } catch (UnsupportedEncodingException e) { |
| 511 | e.printStackTrace(); | 521 | e.printStackTrace(); |
| 512 | } | 522 | } |
| 513 | } else if (headpitiaon == 4) { | 523 | } else if (headpitiaon == 4) { |
| 514 | mSimpleDraweeView.setImageDrawable(null); | 524 | mSimpleDraweeView.setImageDrawable(null); |
| 515 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 525 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
| 516 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; | 526 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; |
| 517 | try { | 527 | try { |
| 518 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 528 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 519 | } catch (UnsupportedEncodingException e) { | 529 | } catch (UnsupportedEncodingException e) { |
| 520 | e.printStackTrace(); | 530 | e.printStackTrace(); |
| 521 | } | 531 | } |
| 522 | } else { | 532 | } else { |
| 523 | mSimpleDraweeView.setImageDrawable(null); | 533 | mSimpleDraweeView.setImageDrawable(null); |
| 524 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); | 534 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); |
| 525 | ; | 535 | ; |
| 526 | } | 536 | } |
| 527 | 537 | ||
| 528 | break; | 538 | break; |
| 529 | case R.id.canceltakephone: | 539 | case R.id.canceltakephone: |
| 530 | 540 | ||
| 531 | break; | 541 | break; |
| 532 | //拍摄和相册 | 542 | //拍摄和相册 |
| 533 | case R.id.take_pic: | 543 | case R.id.take_pic: |
| 534 | android.util.Log.e("TAG", "....."); | 544 | android.util.Log.e("TAG", "....."); |
| 535 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 545 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
| 536 | uploadAvatarFromPhotoRequest(); | 546 | uploadAvatarFromPhotoRequest(); |
| 537 | } | 547 | } |
| 538 | break; | 548 | break; |
| 539 | case R.id.xiangce: | 549 | case R.id.xiangce: |
| 540 | uploadAvatarFromAlbumRequest(); | 550 | uploadAvatarFromAlbumRequest(); |
| 541 | break; | 551 | break; |
| 542 | 552 | ||
| 543 | } | 553 | } |
| 544 | 554 | ||
| 545 | } | 555 | } |
| 546 | 556 | ||
| 547 | //照相 | 557 | //照相 |
| 548 | private void uploadAvatarFromPhotoRequest() { | 558 | private void uploadAvatarFromPhotoRequest() { |
| 549 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 559 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
| 550 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 560 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 551 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 561 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
| 552 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 562 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
| 553 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 563 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
| 554 | } | 564 | } |
| 555 | 565 | ||
| 556 | //选择图库 | 566 | //选择图库 |
| 557 | private void uploadAvatarFromAlbumRequest() { | 567 | private void uploadAvatarFromAlbumRequest() { |
| 558 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 568 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
| 559 | photoPickerIntent.setType("image/*"); | 569 | photoPickerIntent.setType("image/*"); |
| 560 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 570 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
| 561 | } | 571 | } |
| 562 | 572 | ||
| 563 | //回掉 | 573 | //回掉 |
| 564 | @Override | 574 | @Override |
| 565 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 575 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 566 | super.onActivityResult(requestCode, resultCode, data); | 576 | super.onActivityResult(requestCode, resultCode, data); |
| 567 | if (resultCode != -1) { | 577 | if (resultCode != -1) { |
| 568 | return; | 578 | return; |
| 569 | } | 579 | } |
| 570 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 580 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
| 571 | Uri newUri; | 581 | Uri newUri; |
| 572 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 582 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 573 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 583 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
| 574 | } else { | 584 | } else { |
| 575 | newUri = data.getData(); | 585 | newUri = data.getData(); |
| 576 | } | 586 | } |
| 577 | if (newUri != null) { | 587 | if (newUri != null) { |
| 578 | startPhotoZoom(newUri); | 588 | startPhotoZoom(newUri); |
| 579 | } else { | 589 | } else { |
| 580 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 590 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
| 581 | } | 591 | } |
| 582 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 592 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
| 583 | startPhotoZoom(uri); | 593 | startPhotoZoom(uri); |
| 584 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 594 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
| 585 | uploadAvatarFromPhoto(); | 595 | uploadAvatarFromPhoto(); |
| 586 | } | 596 | } |
| 587 | } | 597 | } |
| 588 | 598 | ||
| 589 | private void uploadAvatarFromPhoto() { | 599 | private void uploadAvatarFromPhoto() { |
| 590 | compressAndUploadAvatar(file.getPath()); | 600 | compressAndUploadAvatar(file.getPath()); |
| 591 | 601 | ||
| 592 | } | 602 | } |
| 593 | 603 | ||
| 594 | private void compressAndUploadAvatar(String fileSrc) { | 604 | private void compressAndUploadAvatar(String fileSrc) { |
| 595 | 605 | ||
| 596 | 606 | ||
| 597 | //上传到服务器 | 607 | //上传到服务器 |
| 598 | 608 | ||
| 599 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 609 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
| 600 | String mimeType = "image/*"; | 610 | String mimeType = "image/*"; |
| 601 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 611 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
| 602 | //String fileName = cover.getName(); | 612 | //String fileName = cover.getName(); |
| 603 | String userID; | 613 | String userID; |
| 604 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 614 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 605 | if ("2".equals(typeaccount)) { | 615 | if ("2".equals(typeaccount)) { |
| 606 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 616 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
| 607 | } else { | 617 | } else { |
| 608 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 618 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 609 | } | 619 | } |
| 610 | 620 | ||
| 611 | //上传头像 | 621 | //上传头像 |
| 612 | 622 | ||
| 613 | try { | 623 | try { |
| 614 | HttpManager.getInstance().header(this, userID, typeaccount, file.getPath()); | 624 | HttpManager.getInstance().header(this, userID, typeaccount, file.getPath()); |
| 615 | } catch (UnsupportedEncodingException e) { | 625 | } catch (UnsupportedEncodingException e) { |
| 616 | e.printStackTrace(); | 626 | e.printStackTrace(); |
| 617 | } | 627 | } |
| 618 | 628 | ||
| 619 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 629 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
| 620 | //Fresco设置圆形头像 | 630 | //Fresco设置圆形头像 |
| 621 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 631 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
| 622 | GenericDraweeHierarchy hierarchy = builder | 632 | GenericDraweeHierarchy hierarchy = builder |
| 623 | .setDesiredAspectRatio(1f) | 633 | .setDesiredAspectRatio(1f) |
| 624 | .setFailureImage(R.mipmap.blank) | 634 | .setFailureImage(R.mipmap.blank) |
| 625 | //圆形头像 | 635 | //圆形头像 |
| 626 | .setRoundingParams(RoundingParams.asCircle()) | 636 | .setRoundingParams(RoundingParams.asCircle()) |
| 627 | .build(); | 637 | .build(); |
| 628 | 638 | ||
| 629 | //加载本地图片 | 639 | //加载本地图片 |
| 630 | Uri uri = Uri.fromFile(cover); | 640 | Uri uri = Uri.fromFile(cover); |
| 631 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 641 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
| 632 | .setOldController(mSimpleDraweeView.getController()) | 642 | .setOldController(mSimpleDraweeView.getController()) |
| 633 | .setUri(uri) | 643 | .setUri(uri) |
| 634 | .build(); | 644 | .build(); |
| 635 | mSimpleDraweeView.setHierarchy(hierarchy); | 645 | mSimpleDraweeView.setHierarchy(hierarchy); |
| 636 | mSimpleDraweeView.setController(controller); | 646 | mSimpleDraweeView.setController(controller); |
| 637 | 647 | ||
| 638 | } | 648 | } |
| 639 | 649 | ||
| 640 | public void startPhotoZoom(Uri uri) { | 650 | public void startPhotoZoom(Uri uri) { |
| 641 | Intent intent = new Intent("com.android.camera.action.CROP"); | 651 | Intent intent = new Intent("com.android.camera.action.CROP"); |
| 642 | intent.setDataAndType(uri, "image/*"); | 652 | intent.setDataAndType(uri, "image/*"); |
| 643 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 653 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 644 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 654 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
| 645 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 655 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
| 646 | intent.putExtra("aspectY", 1);// x:y=1:1 | 656 | intent.putExtra("aspectY", 1);// x:y=1:1 |
| 647 | // intent.putExtra("outputX", 400);//图片输出大小 | 657 | // intent.putExtra("outputX", 400);//图片输出大小 |
| 648 | // intent.putExtra("outputY", 400); | 658 | // intent.putExtra("outputY", 400); |
| 649 | intent.putExtra("output", Uri.fromFile(file)); | 659 | intent.putExtra("output", Uri.fromFile(file)); |
| 650 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 660 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
| 651 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 661 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
| 652 | } | 662 | } |
| 653 | 663 | ||
| 654 | @Override | 664 | @Override |
| 655 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 665 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
| 656 | switch (requestCode) { | 666 | switch (requestCode) { |
| 657 | 667 | ||
| 658 | case PermissionUtil.REQUEST_SHOWCAMERA: | 668 | case PermissionUtil.REQUEST_SHOWCAMERA: |
| 659 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 669 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
| 660 | // Permission Granted | 670 | // Permission Granted |
| 661 | uploadAvatarFromPhotoRequest(); | 671 | uploadAvatarFromPhotoRequest(); |
| 662 | 672 | ||
| 663 | } else { | 673 | } else { |
| 664 | if (!SharedPreferenceMark.getHasShowCamera()) { | 674 | if (!SharedPreferenceMark.getHasShowCamera()) { |
| 665 | SharedPreferenceMark.setHasShowCamera(true); | 675 | SharedPreferenceMark.setHasShowCamera(true); |
| 666 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 676 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
| 667 | 677 | ||
| 668 | } else { | 678 | } else { |
| 669 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 679 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
| 670 | .show(); | 680 | .show(); |
| 671 | } | 681 | } |
| 672 | } | 682 | } |
| 673 | break; | 683 | break; |
| 674 | default: | 684 | default: |
| 675 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 685 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 676 | } | 686 | } |
| 677 | } | 687 | } |
| 678 | 688 | ||
| 679 | private long exitTime = 0; | 689 | private long exitTime = 0; |
| 680 | 690 | ||
| 681 | @Override | 691 | @Override |
| 682 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 692 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| 683 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 693 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 684 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 694 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
| 685 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 695 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
| 686 | Toast.LENGTH_SHORT).show(); | 696 | Toast.LENGTH_SHORT).show(); |
| 687 | exitTime = System.currentTimeMillis(); | 697 | exitTime = System.currentTimeMillis(); |
| 688 | } else { | 698 | } else { |
| 689 | moveTaskToBack(false);//应用退到后台 | 699 | moveTaskToBack(false);//应用退到后台 |
| 690 | System.exit(0); | 700 | System.exit(0); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
| 6 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
| 7 | import android.view.KeyEvent; | 7 | import android.view.KeyEvent; |
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.widget.Button; | 9 | import android.widget.Button; |
| 10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
| 11 | import android.widget.TextView; | 11 | import android.widget.TextView; |
| 12 | 12 | ||
| 13 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
| 14 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 14 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
| 15 | import com.hjx.personalcenter.customdialog.CountryDialog; | 15 | import com.hjx.personalcenter.customdialog.CountryDialog; |
| 16 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 16 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
| 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
| 19 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
| 20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
| 21 | import com.hjx.personalcenter.http.HttpManager; | 21 | import com.hjx.personalcenter.http.HttpManager; |
| 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 23 | import com.hjx.personalcenter.model.CityInfo; | 23 | import com.hjx.personalcenter.model.CityInfo; |
| 24 | import com.hjx.personalcenter.model.CountyInfo; | 24 | import com.hjx.personalcenter.model.CountyInfo; |
| 25 | import com.hjx.personalcenter.model.GradeInfo; | 25 | import com.hjx.personalcenter.model.GradeInfo; |
| 26 | import com.hjx.personalcenter.model.ProvinceInfo; | 26 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 27 | import com.hjx.personalcenter.model.SchoolInfo; | 27 | import com.hjx.personalcenter.model.SchoolInfo; |
| 28 | import com.hjx.personalcenter.util.AlertUtils; | 28 | import com.hjx.personalcenter.util.AlertUtils; |
| 29 | import com.hjx.personalcenter.util.GetDevicesUtil; | 29 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 30 | 30 | ||
| 31 | import java.util.ArrayList; | 31 | import java.util.ArrayList; |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | * 填写注册信息 熊巍 | 34 | * 填写注册信息 熊巍 |
| 35 | * Created by h on 2017/8/9. | 35 | * Created by h on 2017/8/9. |
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 38 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
| 39 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 39 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
| 40 | private EditText et_username; | 40 | private EditText et_username; |
| 41 | private TextView et_region, et_grade, et_school; | 41 | private TextView et_region, et_grade, et_school; |
| 42 | private Button btn_ok; | 42 | private Button btn_ok; |
| 43 | 43 | ||
| 44 | @Override | 44 | @Override |
| 45 | protected void onCreate(Bundle savedInstanceState) { | 45 | protected void onCreate(Bundle savedInstanceState) { |
| 46 | super.onCreate(savedInstanceState); | 46 | super.onCreate(savedInstanceState); |
| 47 | setContentView(R.layout.activity_registerinfo); | 47 | setContentView(R.layout.activity_registerinfo); |
| 48 | SysApplication.getInstance().addActivity(this); | 48 | SysApplication.getInstance().addActivity(this); |
| 49 | 49 | ||
| 50 | initView(); | 50 | initView(); |
| 51 | initData(); | 51 | initData(); |
| 52 | initLister(); | 52 | initLister(); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | private void initView() { | 55 | private void initView() { |
| 56 | et_username = (EditText) findViewById(R.id.et_username); | 56 | et_username = (EditText) findViewById(R.id.et_username); |
| 57 | et_region = (TextView) findViewById(R.id.et_region); | 57 | et_region = (TextView) findViewById(R.id.et_region); |
| 58 | et_grade = (TextView) findViewById(R.id.et_grade); | 58 | et_grade = (TextView) findViewById(R.id.et_grade); |
| 59 | et_school = (TextView) findViewById(R.id.et_school); | 59 | et_school = (TextView) findViewById(R.id.et_school); |
| 60 | btn_ok = (Button) findViewById(R.id.btn_ok); | 60 | btn_ok = (Button) findViewById(R.id.btn_ok); |
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | private void initData() { | 65 | private void initData() { |
| 66 | if (Content.accountflag == 2) { | 66 | if (Content.accountflag == 2) { |
| 67 | btn_ok.setText("提交"); | 67 | btn_ok.setText("提交"); |
| 68 | 68 | ||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | private void initLister() { | 73 | private void initLister() { |
| 74 | et_region.setOnClickListener(this); | 74 | et_region.setOnClickListener(this); |
| 75 | et_grade.setOnClickListener(this); | 75 | et_grade.setOnClickListener(this); |
| 76 | et_school.setOnClickListener(this); | 76 | et_school.setOnClickListener(this); |
| 77 | btn_ok.setOnClickListener(this); | 77 | btn_ok.setOnClickListener(this); |
| 78 | 78 | ||
| 79 | 79 | ||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | @Override | 82 | @Override |
| 83 | public void onClick(View v) { | 83 | public void onClick(View v) { |
| 84 | String register1 = et_username.getText().toString().trim(); | 84 | String register1 = et_username.getText().toString().trim(); |
| 85 | String register2 = et_region.getText().toString().trim(); | 85 | String register2 = et_region.getText().toString().trim(); |
| 86 | String register3 = et_grade.getText().toString().trim(); | 86 | String register3 = et_grade.getText().toString().trim(); |
| 87 | String register4 = et_school.getText().toString().trim(); | 87 | String register4 = et_school.getText().toString().trim(); |
| 88 | switch (v.getId()) { | 88 | switch (v.getId()) { |
| 89 | case R.id.et_region: | 89 | case R.id.et_region: |
| 90 | et_school.setText(""); | 90 | et_school.setText(""); |
| 91 | choiseregion(); | 91 | choiseregion(); |
| 92 | break; | 92 | break; |
| 93 | case R.id.et_grade: | 93 | case R.id.et_grade: |
| 94 | et_school.setText(""); | 94 | et_school.setText(""); |
| 95 | choisegrade(); | 95 | choisegrade(); |
| 96 | break; | 96 | break; |
| 97 | case R.id.et_school: | 97 | case R.id.et_school: |
| 98 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { | 98 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
| 99 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); | 99 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); |
| 100 | return; | 100 | return; |
| 101 | } else { | 101 | } else { |
| 102 | choiseschool(); | 102 | choiseschool(); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | break; | 105 | break; |
| 106 | case R.id.btn_ok: | 106 | case R.id.btn_ok: |
| 107 | if (TextUtils.isEmpty(register1) || | 107 | if (TextUtils.isEmpty(register1) || |
| 108 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { | 108 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
| 109 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | 109 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
| 110 | return; | 110 | return; |
| 111 | } else { | 111 | } else { |
| 112 | String register5 = et_username.getText().toString().trim(); | 112 | String register5 = et_username.getText().toString().trim(); |
| 113 | String register6 = et_region.getText().toString().trim(); | 113 | String register6 = et_region.getText().toString().trim(); |
| 114 | String register7 = et_grade.getText().toString().trim(); | 114 | String register7 = et_grade.getText().toString().trim(); |
| 115 | String register8 = et_school.getText().toString().trim(); | 115 | String register8 = et_school.getText().toString().trim(); |
| 116 | String grade; | ||
| 116 | if (Content.accountflag == 2) { | 117 | if (Content.accountflag == 2) { |
| 118 | String accounts = SaveParam.getInstance().getCustomizeParam(RegisterInfoActivity.this,SaveParam.ACCOUNT); | ||
| 117 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 119 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 118 | String grade = SaveParam.getInstance().getCustomizeParam(this, SaveParam.GRADENS); | 120 | if ("2".equals(accounts)){ |
| 121 | grade = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSGRADENS); | ||
| 122 | }else { | ||
| 123 | grade = SaveParam.getInstance().getCustomizeParam(this, SaveParam.GRADENS); | ||
| 124 | } | ||
| 125 | |||
| 119 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); | 126 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); |
| 120 | String regionId = SaveParam.getInstance().getsaveCityParam(this, SaveParam.COUNTRY); | 127 | String regionId = SaveParam.getInstance().getsaveCityParam(this, SaveParam.COUNTRY); |
| 121 | String regionId1 = SaveParam.getInstance().getsaveCityParam(this, SaveParam.CITYS); | 128 | String regionId1 = SaveParam.getInstance().getsaveCityParam(this, SaveParam.CITYS); |
| 122 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 129 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
| 123 | if (regionId == null) { | 130 | if (regionId == null) { |
| 124 | regionId = regionId1; | 131 | regionId = regionId1; |
| 125 | } | 132 | } |
| 126 | 133 | ||
| 127 | try { | 134 | try { |
| 128 | Object schoolss; | 135 | Object schoolss; |
| 129 | long auserID = Long.parseLong(userID); | 136 | long auserID = Long.parseLong(userID); |
| 130 | long grades = Long.parseLong(grade); | 137 | long grades = Long.parseLong(grade); |
| 131 | if (TextUtils.isEmpty(register8)) { | 138 | if (TextUtils.isEmpty(register8)) { |
| 132 | schoolss = null; | 139 | schoolss = null; |
| 133 | } else { | 140 | } else { |
| 134 | schoolss = Long.parseLong(School); | 141 | schoolss = Long.parseLong(School); |
| 135 | } | 142 | } |
| 136 | long regionIds = Long.parseLong(regionId); | 143 | long regionIds = Long.parseLong(regionId); |
| 137 | HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this, auserID, "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png", | 144 | HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this, auserID, "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png", |
| 138 | register5, grades, schoolss, regionIds, devicenumber, register6); | 145 | register5, grades, schoolss, regionIds, devicenumber, register6); |
| 139 | 146 | ||
| 140 | } catch (NumberFormatException e) { | 147 | } catch (NumberFormatException e) { |
| 141 | e.printStackTrace(); | 148 | e.printStackTrace(); |
| 142 | } | 149 | } |
| 143 | 150 | ||
| 144 | } else { | 151 | } else { |
| 145 | savedata(); | 152 | savedata(); |
| 146 | Intent intent = new Intent(); | 153 | Intent intent = new Intent(); |
| 147 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); | 154 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); |
| 148 | startActivity(intent); | 155 | startActivity(intent); |
| 149 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 156 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 150 | } | 157 | } |
| 151 | 158 | ||
| 152 | } | 159 | } |
| 153 | 160 | ||
| 154 | break; | 161 | break; |
| 155 | } | 162 | } |
| 156 | 163 | ||
| 157 | } | 164 | } |
| 158 | 165 | ||
| 159 | private void savedata() { | 166 | private void savedata() { |
| 160 | String register9 = et_username.getText().toString().trim(); | 167 | String register9 = et_username.getText().toString().trim(); |
| 161 | String register10 = et_region.getText().toString().trim(); | 168 | String register10 = et_region.getText().toString().trim(); |
| 162 | String register11 = et_grade.getText().toString().trim(); | 169 | String register11 = et_grade.getText().toString().trim(); |
| 163 | String register12 = et_school.getText().toString().trim(); | 170 | String register12 = et_school.getText().toString().trim(); |
| 164 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register9); | 171 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register9); |
| 165 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register10); | 172 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register10); |
| 166 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register11); | 173 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register11); |
| 167 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register12); | 174 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register12); |
| 168 | 175 | ||
| 169 | } | 176 | } |
| 170 | 177 | ||
| 171 | @Override | 178 | @Override |
| 172 | protected void onResume() { | 179 | protected void onResume() { |
| 173 | super.onResume(); | 180 | super.onResume(); |
| 174 | } | 181 | } |
| 175 | 182 | ||
| 176 | 183 | ||
| 177 | //选择地区 | 184 | //选择地区 |
| 178 | private void choiseregion() { | 185 | private void choiseregion() { |
| 179 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 186 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
| 180 | 187 | ||
| 181 | } | 188 | } |
| 182 | 189 | ||
| 183 | //选择年级 | 190 | //选择年级 |
| 184 | private void choisegrade() { | 191 | private void choisegrade() { |
| 185 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); | 192 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); |
| 186 | 193 | ||
| 187 | } | 194 | } |
| 188 | 195 | ||
| 189 | //选择学校 | 196 | //选择学校 |
| 190 | private void choiseschool() { | 197 | private void choiseschool() { |
| 191 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); | 198 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); |
| 192 | 199 | ||
| 193 | } | 200 | } |
| 194 | 201 | ||
| 195 | 202 | ||
| 196 | @Override | 203 | @Override |
| 197 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 204 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
| 198 | String regionName = data.get(position).getRegionName(); | 205 | String regionName = data.get(position).getRegionName(); |
| 199 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); | 206 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); |
| 200 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 207 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
| 201 | et_region.setText(""); | 208 | et_region.setText(""); |
| 202 | et_region.setText(regionName); | 209 | et_region.setText(regionName); |
| 203 | 210 | ||
| 204 | } | 211 | } |
| 205 | 212 | ||
| 206 | @Override | 213 | @Override |
| 207 | public boolean onKeyUp(int keyCode, KeyEvent event) { | 214 | public boolean onKeyUp(int keyCode, KeyEvent event) { |
| 208 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 215 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 209 | finish(); | 216 | finish(); |
| 210 | 217 | ||
| 211 | } | 218 | } |
| 212 | return super.onKeyUp(keyCode, event); | 219 | return super.onKeyUp(keyCode, event); |
| 213 | } | 220 | } |
| 214 | 221 | ||
| 215 | @Override | 222 | @Override |
| 216 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 223 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
| 217 | String regionName = data.get(position).getName(); | 224 | String regionName = data.get(position).getName(); |
| 218 | et_grade.setText(regionName); | 225 | et_grade.setText(regionName); |
| 219 | 226 | ||
| 220 | } | 227 | } |
| 221 | 228 | ||
| 222 | @Override | 229 | @Override |
| 223 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 230 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
| 224 | String regionName = data.get(position).getRegionName(); | 231 | String regionName = data.get(position).getRegionName(); |
| 225 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); | 232 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); |
| 226 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); | 233 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); |
| 227 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 234 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
| 228 | et_region.setText(""); | 235 | et_region.setText(""); |
| 229 | et_region.setText(provice + regionName); | 236 | et_region.setText(provice + regionName); |
| 230 | 237 | ||
| 231 | } | 238 | } |
| 232 | 239 | ||
| 233 | @Override | 240 | @Override |
| 234 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 241 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
| 235 | String regionName = data.get(position).getRegionName(); | 242 | String regionName = data.get(position).getRegionName(); |
| 236 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); | 243 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); |
| 237 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); | 244 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); |
| 238 | et_region.setText(""); | 245 | et_region.setText(""); |
| 239 | et_region.setText(provices + citys + regionName); | 246 | et_region.setText(provices + citys + regionName); |
| 240 | 247 | ||
| 241 | } | 248 | } |
| 242 | 249 | ||
| 243 | @Override | 250 | @Override |
| 244 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 251 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
| 245 | String regionName = data.get(position).getSchoolName(); | 252 | String regionName = data.get(position).getSchoolName(); |
| 246 | et_school.setText(regionName); | 253 | et_school.setText(regionName); |
| 247 | 254 | ||
| 248 | } | 255 | } |
| 249 | } | 256 | } |
| 250 | 257 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
| 1 | package com.hjx.personalcenter.db; | 1 | package com.hjx.personalcenter.db; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.content.SharedPreferences; | 5 | import android.content.SharedPreferences; |
| 6 | 6 | ||
| 7 | public class SaveParam { | 7 | public class SaveParam { |
| 8 | 8 | ||
| 9 | private static SaveParam instance; | 9 | private static SaveParam instance; |
| 10 | public static SaveParam getInstance(){ | 10 | public static SaveParam getInstance(){ |
| 11 | if (instance==null){ | 11 | if (instance==null){ |
| 12 | instance = new SaveParam(); | 12 | instance = new SaveParam(); |
| 13 | } | 13 | } |
| 14 | return instance; | 14 | return instance; |
| 15 | } | 15 | } |
| 16 | public static String CHILDSID = "childID";//子账号id | 16 | public static String CHILDSID = "childID";//子账号id |
| 17 | public static String CHILDSGRADENS = "childs";//子账号年级id | 17 | public static String CHILDSGRADENS = "childs";//子账号年级id |
| 18 | public static String GRADENS = "gradens";//年级id | 18 | public static String GRADENS = "gradens";//年级id |
| 19 | public static String SCHOOOlID = "schoolid";//学校id | 19 | public static String SCHOOOlID = "schoolid";//学校id |
| 20 | //个人信息 | 20 | //个人信息 |
| 21 | public static String USERNAME = "usernames";//昵称 | 21 | public static String USERNAME = "usernames";//昵称 |
| 22 | public static String ADRESS = "adress";//地址 | 22 | public static String ADRESS = "adress";//地址 |
| 23 | public static String GRADES = "gadens";//年级 | 23 | public static String GRADES = "gadens";//年级 |
| 24 | public static String SCHOOL = "school";//学校 | 24 | public static String SCHOOL = "school";//学校 |
| 25 | public static String CONSTELLATION = "constellations";//星座 | 25 | public static String CONSTELLATION = "constellations";//星座 |
| 26 | public static String HEADURL = "headurl";//星座 | 26 | public static String HEADURL = "headurl";//头像 |
| 27 | |||
| 28 | //用户个人信息 | ||
| 29 | public static String ACCOUNTUSERNAME = "accountusernames";//昵称 | ||
| 30 | public static String ACCOUNTADRESS = "accountadress";//地址 | ||
| 31 | public static String ACCOUNTGRADES = "accountgadens";//年级 | ||
| 32 | public static String ACCOUNTSCHOOL = "accountschool";//学校 | ||
| 33 | public static String ACCOUNTCONSTELLATION = "accountbthday";//生日 | ||
| 34 | public static String ACCOUNTSEX = "accountsex";//性别 | ||
| 35 | public static String ACCOUNTQQ= "accountqq";//qq | ||
| 36 | public static String ACCOUNTXINGZUO = "accountxingzuo";//详细地址 | ||
| 27 | 37 | ||
| 28 | //电子保卡信息 | 38 | //电子保卡信息 |
| 29 | public static String CARDPHONE = "cardphone";//保卡手机号 | 39 | public static String CARDPHONE = "cardphone";//保卡手机号 |
| 30 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 | 40 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 |
| 31 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 | 41 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 |
| 32 | public static String SHOPTIME = "shoptime";//购买时间 | 42 | public static String SHOPTIME = "shoptime";//购买时间 |
| 33 | public static String SHOPADRESS = "shopadress";//购买地址 | 43 | public static String SHOPADRESS = "shopadress";//购买地址 |
| 34 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 | 44 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 |
| 35 | 45 | ||
| 36 | //省市区参数、 | 46 | //省市区参数、 |
| 37 | public static String PROVINCES = "provinces";//省 | 47 | public static String PROVINCES = "provinces";//省 |
| 38 | public static String CITYS = "citys";//市 | 48 | public static String CITYS = "citys";//市 |
| 39 | public static String COUNTRY = "country";//区 | 49 | public static String COUNTRY = "country";//区 |
| 40 | 50 | ||
| 41 | //账户管理 | 51 | //账户管理 |
| 42 | public static String ACCOUNT = "account";//账户类型 | 52 | public static String ACCOUNT = "account";//账户类型 |
| 43 | //科目信息 | 53 | //科目信息 |
| 44 | public static String SUBJECT = "subject"; | 54 | public static String SUBJECT = "subject"; |
| 45 | //样机 | 55 | //样机 |
| 46 | public static String YANGJI = "yangji"; | 56 | public static String YANGJI = "yangji"; |
| 47 | //图片URL | 57 | //图片URL |
| 48 | public static String IMGURL = "imgurl"; | 58 | public static String IMGURL = "imgurl"; |
| 49 | //版本名称 | 59 | //版本名称 |
| 50 | public static String VERSION = "version"; | 60 | public static String VERSION = "version"; |
| 51 | 61 | ||
| 52 | 62 | ||
| 53 | public void saveLoginParam(Context context,String spname, String spstr) { | 63 | public void saveLoginParam(Context context,String spname, String spstr) { |
| 54 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 64 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 55 | Activity.MODE_PRIVATE); | 65 | Activity.MODE_PRIVATE); |
| 56 | 66 | ||
| 57 | sp.edit().putString(spname, spstr).commit(); | 67 | sp.edit().putString(spname, spstr).commit(); |
| 58 | } | 68 | } |
| 59 | 69 | ||
| 60 | 70 | ||
| 61 | public String getLoginParam(Context context,String spname) { | 71 | public String getLoginParam(Context context,String spname) { |
| 62 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 72 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 63 | Activity.MODE_PRIVATE); | 73 | Activity.MODE_PRIVATE); |
| 64 | String param = sp.getString(spname, null); | 74 | String param = sp.getString(spname, null); |
| 65 | return param; | 75 | return param; |
| 66 | } | 76 | } |
| 67 | public void clearData(Context context) { | 77 | public void clearData(Context context) { |
| 68 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 78 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
| 69 | Activity.MODE_PRIVATE); | 79 | Activity.MODE_PRIVATE); |
| 70 | sp.edit().clear().commit(); | 80 | sp.edit().clear().commit(); |
| 71 | } | 81 | } |
| 72 | 82 | ||
| 73 | public void saveCustomizeParam(Context context,String spname, String spstr) { | 83 | public void saveCustomizeParam(Context context,String spname, String spstr) { |
| 74 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 84 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 75 | Activity.MODE_PRIVATE); | 85 | Activity.MODE_PRIVATE); |
| 76 | 86 | ||
| 77 | sp.edit().putString(spname, spstr).commit(); | 87 | sp.edit().putString(spname, spstr).commit(); |
| 78 | 88 | ||
| 79 | } | 89 | } |
| 80 | 90 | ||
| 81 | public String getCustomizeParam(Context context,String spname) { | 91 | public String getCustomizeParam(Context context,String spname) { |
| 82 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 92 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 83 | Activity.MODE_PRIVATE); | 93 | Activity.MODE_PRIVATE); |
| 84 | String param = sp.getString(spname, null); | 94 | String param = sp.getString(spname, null); |
| 85 | return param; | 95 | return param; |
| 86 | } | 96 | } |
| 87 | 97 | ||
| 88 | public void clearCustomizeParam(Context context ){ | 98 | public void clearCustomizeParam(Context context ){ |
| 89 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 99 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
| 90 | Activity.MODE_PRIVATE); | 100 | Activity.MODE_PRIVATE); |
| 91 | sp.edit().clear().commit(); | 101 | sp.edit().clear().commit(); |
| 92 | } | 102 | } |
| 93 | public void saveCityParam(Context context,String spname, String spstr) { | 103 | public void saveCityParam(Context context,String spname, String spstr) { |
| 94 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 104 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
| 95 | Activity.MODE_PRIVATE); | 105 | Activity.MODE_PRIVATE); |
| 96 | 106 | ||
| 97 | sp.edit().putString(spname, spstr).commit(); | 107 | sp.edit().putString(spname, spstr).commit(); |
| 98 | 108 | ||
| 99 | } | 109 | } |
| 100 | 110 | ||
| 101 | public String getsaveCityParam(Context context,String spname) { | 111 | public String getsaveCityParam(Context context,String spname) { |
| 102 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 112 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
| 103 | Activity.MODE_PRIVATE); | 113 | Activity.MODE_PRIVATE); |
| 104 | String param = sp.getString(spname, null); | 114 | String param = sp.getString(spname, null); |
| 105 | return param; | 115 | return param; |
| 106 | } | 116 | } |
| 107 | 117 | ||
| 108 | public void clearsaveCityParam(Context context ){ | 118 | public void clearsaveCityParam(Context context ){ |
| 109 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 119 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
| 110 | Activity.MODE_PRIVATE); | 120 | Activity.MODE_PRIVATE); |
| 111 | sp.edit().clear().commit(); | 121 | sp.edit().clear().commit(); |
| 112 | } | 122 | } |
| 113 | } | 123 | } |
| 114 | 124 |
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.graphics.Color; | 3 | import android.graphics.Color; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.support.annotation.Nullable; | 5 | import android.support.annotation.Nullable; |
| 6 | import android.support.v4.app.Fragment; | 6 | import android.support.v4.app.Fragment; |
| 7 | import android.support.v4.view.ViewPager; | 7 | import android.support.v4.view.ViewPager; |
| 8 | import android.util.Log; | 8 | import android.util.Log; |
| 9 | import android.view.Gravity; | 9 | import android.view.Gravity; |
| 10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
| 11 | import android.view.View; | 11 | import android.view.View; |
| 12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
| 13 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
| 14 | import android.widget.EditText; | 14 | import android.widget.EditText; |
| 15 | import android.widget.ImageView; | 15 | import android.widget.ImageView; |
| 16 | import android.widget.LinearLayout; | 16 | import android.widget.LinearLayout; |
| 17 | import android.widget.TextView; | 17 | import android.widget.TextView; |
| 18 | 18 | ||
| 19 | import com.bigkoo.pickerview.TimePickerView; | 19 | import com.bigkoo.pickerview.TimePickerView; |
| 20 | import com.hjx.personalcenter.R; | 20 | import com.hjx.personalcenter.R; |
| 21 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; | 21 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; |
| 22 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 22 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
| 23 | import com.hjx.personalcenter.customdialog.CountryDialog; | 23 | import com.hjx.personalcenter.customdialog.CountryDialog; |
| 24 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 24 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
| 25 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 25 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 26 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 26 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
| 27 | import com.hjx.personalcenter.db.SaveParam; | 27 | import com.hjx.personalcenter.db.SaveParam; |
| 28 | import com.hjx.personalcenter.http.HttpManager; | 28 | import com.hjx.personalcenter.http.HttpManager; |
| 29 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 29 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 30 | import com.hjx.personalcenter.model.CityInfo; | 30 | import com.hjx.personalcenter.model.CityInfo; |
| 31 | import com.hjx.personalcenter.model.CountyInfo; | 31 | import com.hjx.personalcenter.model.CountyInfo; |
| 32 | import com.hjx.personalcenter.model.GradeInfo; | 32 | import com.hjx.personalcenter.model.GradeInfo; |
| 33 | import com.hjx.personalcenter.model.ProvinceInfo; | 33 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 34 | import com.hjx.personalcenter.model.SchoolInfo; | 34 | import com.hjx.personalcenter.model.SchoolInfo; |
| 35 | import com.hjx.personalcenter.util.AlertUtils; | 35 | import com.hjx.personalcenter.util.AlertUtils; |
| 36 | import com.hjx.personalcenter.util.BrithdayStar; | ||
| 37 | import com.hjx.personalcenter.util.GetDevicesUtil; | 36 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 38 | import com.mylhyl.circledialog.CircleDialog; | 37 | import com.mylhyl.circledialog.CircleDialog; |
| 39 | import com.mylhyl.circledialog.callback.ConfigDialog; | 38 | import com.mylhyl.circledialog.callback.ConfigDialog; |
| 40 | import com.mylhyl.circledialog.params.DialogParams; | 39 | import com.mylhyl.circledialog.params.DialogParams; |
| 41 | 40 | ||
| 42 | import org.apache.http.util.TextUtils; | 41 | import org.apache.http.util.TextUtils; |
| 43 | 42 | ||
| 44 | import java.text.SimpleDateFormat; | 43 | import java.text.SimpleDateFormat; |
| 45 | import java.util.ArrayList; | 44 | import java.util.ArrayList; |
| 46 | import java.util.Date; | 45 | import java.util.Date; |
| 47 | 46 | ||
| 48 | /** | 47 | /** |
| 49 | * Created by h on 2017/8/12. | 48 | * Created by h on 2017/8/12. |
| 50 | */ | 49 | */ |
| 51 | 50 | ||
| 52 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 51 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
| 53 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 52 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
| 54 | private View mView; | 53 | private View mView; |
| 55 | private int type; | 54 | private int type; |
| 56 | private TimePickerView pvTime; | 55 | private TimePickerView pvTime; |
| 57 | private LinearLayout tv_version; | 56 | private LinearLayout tv_version; |
| 58 | 57 | ||
| 59 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; | 58 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
| 60 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender, sub; | 59 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender, sub; |
| 61 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; | 60 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; |
| 62 | private ImageView my_adress, my_sex, my_bthday, my_grade, my_school, ccancel; | 61 | private ImageView my_adress, my_sex, my_bthday, my_grade, my_school, ccancel; |
| 63 | 62 | ||
| 64 | 63 | ||
| 65 | public static PresonInfoFragment newInstance(int type) { | 64 | public static PresonInfoFragment newInstance(int type) { |
| 66 | PresonInfoFragment fragment = new PresonInfoFragment(); | 65 | PresonInfoFragment fragment = new PresonInfoFragment(); |
| 67 | Bundle bundle = new Bundle(); | 66 | Bundle bundle = new Bundle(); |
| 68 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 67 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
| 69 | fragment.setArguments(bundle); | 68 | fragment.setArguments(bundle); |
| 70 | return fragment; | 69 | return fragment; |
| 71 | 70 | ||
| 72 | } | 71 | } |
| 73 | 72 | ||
| 74 | @Override | 73 | @Override |
| 75 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 74 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 76 | if (mView == null) { | 75 | if (mView == null) { |
| 77 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 76 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
| 78 | initView(mView); | 77 | initView(mView); |
| 79 | initData(); | 78 | initData(); |
| 80 | setLister(); | 79 | setLister(); |
| 81 | initTimePicker(); | 80 | initTimePicker(); |
| 82 | 81 | ||
| 83 | 82 | ||
| 84 | } | 83 | } |
| 85 | return mView; | 84 | return mView; |
| 86 | } | 85 | } |
| 87 | 86 | ||
| 88 | //初始化 | 87 | //初始化 |
| 89 | private void initView(View mView) { | 88 | private void initView(View mView) { |
| 90 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 89 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
| 91 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 90 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
| 92 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 91 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
| 93 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 92 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
| 94 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 93 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
| 95 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 94 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
| 96 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 95 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
| 97 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 96 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
| 98 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); | 97 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); |
| 99 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); | 98 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); |
| 100 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); | 99 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); |
| 101 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); | 100 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); |
| 102 | my_school = (ImageView) mView.findViewById(R.id.my_school); | 101 | my_school = (ImageView) mView.findViewById(R.id.my_school); |
| 103 | sub = (TextView) mView.findViewById(R.id.presonal_sub); | 102 | sub = (TextView) mView.findViewById(R.id.presonal_sub); |
| 104 | ccancel = (ImageView) mView.findViewById(R.id.cancel); | 103 | ccancel = (ImageView) mView.findViewById(R.id.cancel); |
| 105 | tv_version = (LinearLayout) mView.findViewById(R.id.tv_version); | 104 | tv_version = (LinearLayout) mView.findViewById(R.id.tv_version); |
| 106 | 105 | ||
| 107 | 106 | ||
| 108 | } | 107 | } |
| 109 | 108 | ||
| 110 | private void initData() { | 109 | private void initData() { |
| 110 | //初始化个人信息 | ||
| 111 | String name = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTUSERNAME); | ||
| 112 | String adress1 = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTADRESS); | ||
| 113 | String adress2 = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTXINGZUO); | ||
| 114 | String sex = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTSEX); | ||
| 115 | String bithday = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTCONSTELLATION); | ||
| 116 | String qq = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTQQ); | ||
| 117 | String grader = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTGRADES); | ||
| 118 | String school = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTSCHOOL); | ||
| 119 | tv_username1.setText(name); | ||
| 120 | tv_useinfo_qq.setText(qq); | ||
| 121 | tv_sex.setText(sex); | ||
| 122 | tv_useinfo_birthday.setText(bithday); | ||
| 123 | tv_useinfo_gender.setText(grader); | ||
| 124 | tv_useinfo_school.setText(school); | ||
| 125 | tv_useinfo_adress1.setText(adress2); | ||
| 126 | tv_useinfo_adress.setText(adress1); | ||
| 127 | |||
| 128 | |||
| 129 | |||
| 111 | 130 | ||
| 112 | } | 131 | } |
| 113 | 132 | ||
| 114 | private void setLister() { | 133 | private void setLister() { |
| 115 | tv_sex.setOnClickListener(this); | 134 | tv_sex.setOnClickListener(this); |
| 116 | tv_useinfo_adress.setOnClickListener(this); | 135 | tv_useinfo_adress.setOnClickListener(this); |
| 117 | tv_useinfo_birthday.setOnClickListener(this); | 136 | tv_useinfo_birthday.setOnClickListener(this); |
| 118 | tv_useinfo_school.setOnClickListener(this); | 137 | tv_useinfo_school.setOnClickListener(this); |
| 119 | tv_useinfo_gender.setOnClickListener(this); | 138 | tv_useinfo_gender.setOnClickListener(this); |
| 120 | my_adress.setOnClickListener(this); | 139 | my_adress.setOnClickListener(this); |
| 121 | my_sex.setOnClickListener(this); | 140 | my_sex.setOnClickListener(this); |
| 122 | my_bthday.setOnClickListener(this); | 141 | my_bthday.setOnClickListener(this); |
| 123 | my_grade.setOnClickListener(this); | 142 | my_grade.setOnClickListener(this); |
| 124 | my_school.setOnClickListener(this); | 143 | my_school.setOnClickListener(this); |
| 125 | sub.setOnClickListener(this); | 144 | sub.setOnClickListener(this); |
| 126 | tv_version.setOnClickListener(this); | 145 | tv_version.setOnClickListener(this); |
| 146 | ccancel.setOnClickListener(this); | ||
| 127 | } | 147 | } |
| 128 | 148 | ||
| 129 | @Override | 149 | @Override |
| 130 | public void onClick(View v) { | 150 | public void onClick(View v) { |
| 131 | String presonal1 = tv_username1.getText().toString().trim(); | 151 | String presonal1 = tv_username1.getText().toString().trim(); |
| 132 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | 152 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); |
| 133 | String presonal3 = tv_sex.getText().toString().trim(); | 153 | String presonal3 = tv_sex.getText().toString().trim(); |
| 134 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | 154 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); |
| 135 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | 155 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); |
| 136 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | 156 | String presonal6 = tv_useinfo_school.getText().toString().trim(); |
| 137 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | 157 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); |
| 138 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | 158 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); |
| 139 | switch (v.getId()) { | 159 | switch (v.getId()) { |
| 140 | case R.id.tv_sex: | 160 | case R.id.tv_sex: |
| 141 | case R.id.my_sex: | 161 | case R.id.my_sex: |
| 142 | final String[] items = {"男", "女"}; | 162 | final String[] items = {"男", "女"}; |
| 143 | new CircleDialog.Builder(getActivity()) | 163 | new CircleDialog.Builder(getActivity()) |
| 144 | .configDialog(new ConfigDialog() { | 164 | .configDialog(new ConfigDialog() { |
| 145 | @Override | 165 | @Override |
| 146 | public void onConfig(DialogParams params) { | 166 | public void onConfig(DialogParams params) { |
| 147 | //增加弹出动画 | 167 | //增加弹出动画 |
| 148 | params.gravity = Gravity.CENTER; | 168 | params.gravity = Gravity.CENTER; |
| 149 | } | 169 | } |
| 150 | }) | 170 | }) |
| 151 | .setTitle("请选择性别") | 171 | .setTitle("请选择性别") |
| 152 | .setWidth(0.5f) | 172 | .setWidth(0.5f) |
| 153 | .setItems(items, new AdapterView.OnItemClickListener() { | 173 | .setItems(items, new AdapterView.OnItemClickListener() { |
| 154 | @Override | 174 | @Override |
| 155 | public void onItemClick(AdapterView<?> parent, View view, int | 175 | public void onItemClick(AdapterView<?> parent, View view, int |
| 156 | position, long id) { | 176 | position, long id) { |
| 157 | switch (position) { | 177 | switch (position) { |
| 158 | case 0: | 178 | case 0: |
| 159 | tv_sex.setText("男"); | 179 | tv_sex.setText("男"); |
| 160 | break; | 180 | break; |
| 161 | case 1: | 181 | case 1: |
| 162 | tv_sex.setText("女"); | 182 | tv_sex.setText("女"); |
| 163 | break; | 183 | break; |
| 164 | } | 184 | } |
| 165 | 185 | ||
| 166 | } | 186 | } |
| 167 | }) | 187 | }) |
| 168 | .show(); | 188 | .show(); |
| 169 | break; | 189 | break; |
| 170 | case R.id.tv_useinfo_adress: | 190 | case R.id.tv_useinfo_adress: |
| 171 | case R.id.my_adress: | 191 | case R.id.my_adress: |
| 172 | tv_useinfo_school.setText(""); | 192 | tv_useinfo_school.setText(""); |
| 173 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); | 193 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
| 174 | break; | 194 | break; |
| 175 | case R.id.tv_useinfo_birthday: | 195 | case R.id.tv_useinfo_birthday: |
| 176 | case R.id.my_bthday: | 196 | case R.id.my_bthday: |
| 177 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 197 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
| 178 | break; | 198 | break; |
| 179 | case R.id.tv_useinfo_school: | 199 | case R.id.tv_useinfo_school: |
| 180 | case R.id.my_school: | 200 | case R.id.my_school: |
| 181 | if (TextUtils.isEmpty(presonal4) || | 201 | if (TextUtils.isEmpty(presonal4) || |
| 182 | TextUtils.isEmpty(presonal7)) { | 202 | TextUtils.isEmpty(presonal7)) { |
| 183 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | 203 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); |
| 184 | return; | 204 | return; |
| 185 | } else { | 205 | } else { |
| 186 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | 206 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); |
| 187 | } | 207 | } |
| 188 | 208 | ||
| 189 | 209 | ||
| 190 | break; | 210 | break; |
| 191 | case R.id.tv_useinfo_gender: | 211 | case R.id.tv_useinfo_gender: |
| 192 | case R.id.my_grade: | 212 | case R.id.my_grade: |
| 193 | tv_useinfo_school.setText(""); | 213 | tv_useinfo_school.setText(""); |
| 194 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); | 214 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
| 195 | break; | 215 | break; |
| 196 | case R.id.cancel: | 216 | case R.id.cancel: |
| 197 | getActivity().finish(); | 217 | getActivity().finish(); |
| 198 | break; | 218 | break; |
| 199 | case R.id.tv_version: | 219 | case R.id.tv_version: |
| 200 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); | 220 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); |
| 201 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { | 221 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { |
| 202 | @Override | 222 | @Override |
| 203 | public void gotoFragment(ViewPager viewPager) { | 223 | public void gotoFragment(ViewPager viewPager) { |
| 204 | //fragment传递数据 | 224 | //fragment传递数据 |
| 205 | viewPager.setCurrentItem(1); | 225 | viewPager.setCurrentItem(1); |
| 206 | } | 226 | } |
| 207 | }); | 227 | }); |
| 208 | mainActivity.forSkip(); | 228 | mainActivity.forSkip(); |
| 209 | break; | 229 | break; |
| 210 | case R.id.presonal_sub: | 230 | case R.id.presonal_sub: |
| 211 | Log.e("test", "你提交个人信息"); | 231 | Log.e("test", "你提交个人信息"); |
| 212 | if (TextUtils.isEmpty(presonal1) || | 232 | if (TextUtils.isEmpty(presonal1) || |
| 213 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || | 233 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || |
| 214 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || | 234 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || |
| 215 | TextUtils.isEmpty(presonal8)) { | 235 | TextUtils.isEmpty(presonal8)) { |
| 216 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); | 236 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
| 217 | return; | 237 | return; |
| 218 | } else { | 238 | } else { |
| 219 | |||
| 220 | int a = 0, b = 0; | 239 | int a = 0, b = 0; |
| 221 | int d = 1; | 240 | int d = 1; |
| 222 | Object schoolids; | 241 | Object schoolids; |
| 223 | Long f = null; | 242 | Long f = null; |
| 224 | //保存星座 | 243 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.ACCOUNTADRESS,presonal4); |
| 225 | BrithdayStar brithdayStar = new BrithdayStar(); | 244 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.ACCOUNTXINGZUO,presonal2); |
| 226 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | ||
| 227 | SaveParam.getInstance().saveCustomizeParam(getActivity(), SaveParam.CONSTELLATION, s); | ||
| 228 | |||
| 229 | String regionId = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.COUNTRY); | 245 | String regionId = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.COUNTRY); |
| 230 | String regionId1 = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); | 246 | String regionId1 = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); |
| 231 | if (regionId == null) { | 247 | if (regionId == null) { |
| 232 | regionId = regionId1; | 248 | regionId = regionId1; |
| 233 | } | 249 | } |
| 234 | String grade = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); | 250 | String grade = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); |
| 235 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | 251 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); |
| 236 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 252 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
| 237 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 253 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
| 238 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | 254 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); |
| 239 | String changeinfo = null; | 255 | String changeinfo = null; |
| 240 | if ("男".equals(presonal3)) { | 256 | if ("男".equals(presonal3)) { |
| 241 | changeinfo = "male"; | 257 | changeinfo = "male"; |
| 242 | } else { | 258 | } else { |
| 243 | changeinfo = "female"; | 259 | changeinfo = "female"; |
| 244 | } | 260 | } |
| 245 | try { | 261 | try { |
| 246 | a = Integer.parseInt(regionId); | 262 | a = Integer.parseInt(regionId); |
| 247 | b = Integer.parseInt(grade); | 263 | b = Integer.parseInt(grade); |
| 248 | if (TextUtils.isEmpty(presonal6)) { | 264 | if (TextUtils.isEmpty(presonal6)) { |
| 249 | schoolids = null; | 265 | schoolids = null; |
| 250 | } else { | 266 | } else { |
| 251 | schoolids = Long.parseLong(schoolid); | 267 | schoolids = Long.parseLong(schoolid); |
| 252 | } | 268 | } |
| 253 | d = Integer.parseInt(type); | 269 | d = Integer.parseInt(type); |
| 254 | f = Long.parseLong(userID); | 270 | f = Long.parseLong(userID); |
| 255 | //提交个人信息 | 271 | //提交个人信息 |
| 256 | HttpManager.getInstance().changepresonalinfo(getActivity(), | 272 | HttpManager.getInstance().changepresonalinfo(getActivity(), |
| 257 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 + presonal2, devicenumber); | 273 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 + presonal2, devicenumber); |
| 258 | 274 | ||
| 259 | } catch (Exception e) { | 275 | } catch (Exception e) { |
| 260 | e.printStackTrace(); | 276 | e.printStackTrace(); |
| 261 | } | 277 | } |
| 262 | 278 | ||
| 263 | break; | 279 | break; |
| 264 | 280 | ||
| 265 | } | 281 | } |
| 266 | } | 282 | } |
| 267 | } | 283 | } |
| 268 | 284 | ||
| 269 | //自定义时间选择器 | 285 | //自定义时间选择器 |
| 270 | private void initTimePicker() { | 286 | private void initTimePicker() { |
| 271 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 287 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
| 272 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 288 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
| 273 | // Calendar selectedDate = Calendar.getInstance(); | 289 | // Calendar selectedDate = Calendar.getInstance(); |
| 274 | // Calendar startDate = Calendar.getInstance(); | 290 | // Calendar startDate = Calendar.getInstance(); |
| 275 | // startDate.set(1900, 1, 1); | 291 | // startDate.set(1900, 1, 1); |
| 276 | // Calendar endDate = Calendar.getInstance(); | 292 | // Calendar endDate = Calendar.getInstance(); |
| 277 | // endDate.set(2100, 1, 1); | 293 | // endDate.set(2100, 1, 1); |
| 278 | //时间选择器 | 294 | //时间选择器 |
| 279 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 295 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
| 280 | @Override | 296 | @Override |
| 281 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 297 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
| 282 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 298 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
| 283 | /*btn_Time.setText(getTime(date));*/ | 299 | /*btn_Time.setText(getTime(date));*/ |
| 284 | TextView btn = (TextView) v; | 300 | TextView btn = (TextView) v; |
| 285 | btn.setText(getTime(date)); | 301 | btn.setText(getTime(date)); |
| 286 | } | 302 | } |
| 287 | }) | 303 | }) |
| 288 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 304 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
| 289 | .setType(new boolean[]{true, true, true, false, false, false}) | 305 | .setType(new boolean[]{true, true, true, false, false, false}) |
| 290 | .setLabel("", "", "", "", "", "") | 306 | .setLabel("", "", "", "", "", "") |
| 291 | .isCenterLabel(false) | 307 | .isCenterLabel(false) |
| 292 | .setDividerColor(Color.DKGRAY) | 308 | .setDividerColor(Color.DKGRAY) |
| 293 | .setContentSize(21) | 309 | .setContentSize(21) |
| 294 | // .setDate(selectedDate) | 310 | // .setDate(selectedDate) |
| 295 | // .setRangDate(startDate, endDate) | 311 | // .setRangDate(startDate, endDate) |
| 296 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 312 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
| 297 | .setDecorView(null) | 313 | .setDecorView(null) |
| 298 | .setTitleText("出生日期") | 314 | .setTitleText("出生日期") |
| 299 | .setTitleSize(22) | 315 | .setTitleSize(22) |
| 300 | .setCancelColor(Color.GRAY) | 316 | .setCancelColor(Color.GRAY) |
| 301 | .setSubCalSize(22) | 317 | .setSubCalSize(22) |
| 302 | .setDividerColor(Color.GRAY) | 318 | .setDividerColor(Color.GRAY) |
| 303 | .setSubmitColor(Color.GRAY) | 319 | .setSubmitColor(Color.GRAY) |
| 304 | .build(); | 320 | .build(); |
| 305 | } | 321 | } |
| 306 | 322 | ||
| 307 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 323 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
| 308 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 324 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| 309 | return format.format(date); | 325 | return format.format(date); |
| 310 | } | 326 | } |
| 311 | 327 | ||
| 312 | @Override | 328 | @Override |
| 313 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 329 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
| 314 | String regionName = data.get(position).getRegionName(); | 330 | String regionName = data.get(position).getRegionName(); |
| 315 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 331 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
| 316 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | 332 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); |
| 317 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | 333 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); |
| 318 | tv_useinfo_adress.setText(""); | 334 | tv_useinfo_adress.setText(""); |
| 319 | tv_useinfo_adress.setText(provice + regionName); | 335 | tv_useinfo_adress.setText(provice + regionName); |
| 320 | 336 | ||
| 321 | 337 | ||
| 322 | } | 338 | } |
| 323 | 339 | ||
| 324 | @Override | 340 | @Override |
| 325 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 341 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
| 326 | String regionName = data.get(position).getRegionName(); | 342 | String regionName = data.get(position).getRegionName(); |
| 327 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 343 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
| 328 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); | 344 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); |
| 329 | tv_useinfo_adress.setText(""); | 345 | tv_useinfo_adress.setText(""); |
| 330 | tv_useinfo_adress.setText(provices + citys + regionName); | 346 | tv_useinfo_adress.setText(provices + citys + regionName); |
| 331 | 347 | ||
| 332 | } | 348 | } |
| 333 | 349 | ||
| 334 | @Override | 350 | @Override |
| 335 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 351 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
| 336 | String regionName = data.get(position).getName(); | 352 | String regionName = data.get(position).getName(); |
| 337 | tv_useinfo_gender.setText(regionName); | 353 | tv_useinfo_gender.setText(regionName); |
| 338 | } | 354 | } |
| 339 | 355 | ||
| 340 | @Override | 356 | @Override |
| 341 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 357 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
| 342 | String regionName = data.get(position).getRegionName(); | 358 | String regionName = data.get(position).getRegionName(); |
| 343 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); | 359 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); |
| 344 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); | 360 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); |
| 345 | tv_useinfo_adress.setText(""); | 361 | tv_useinfo_adress.setText(""); |
| 346 | tv_useinfo_adress.setText(regionName); | 362 | tv_useinfo_adress.setText(regionName); |
| 347 | } | 363 | } |
| 348 | 364 | ||
| 349 | @Override | 365 | @Override |
| 350 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 366 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
| 351 | String regionName = data.get(position).getSchoolName(); | 367 | String regionName = data.get(position).getSchoolName(); |
| 352 | tv_useinfo_school.setText(regionName); | 368 | tv_useinfo_school.setText(regionName); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/VersionsInfoFragment.java
| 1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
| 2 | 2 | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | import android.os.Handler; | 4 | import android.os.Handler; |
| 5 | import android.os.Message; | 5 | import android.os.Message; |
| 6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
| 8 | import android.support.v4.view.ViewPager; | 8 | import android.support.v4.view.ViewPager; |
| 9 | import android.util.Log; | 9 | import android.util.Log; |
| 10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
| 11 | import android.view.View; | 11 | import android.view.View; |
| 12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
| 13 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
| 14 | import android.widget.GridView; | 14 | import android.widget.GridView; |
| 15 | import android.widget.ImageView; | 15 | import android.widget.ImageView; |
| 16 | import android.widget.LinearLayout; | 16 | import android.widget.LinearLayout; |
| 17 | import android.widget.TextView; | 17 | import android.widget.TextView; |
| 18 | 18 | ||
| 19 | import com.facebook.drawee.view.SimpleDraweeView; | 19 | import com.facebook.drawee.view.SimpleDraweeView; |
| 20 | import com.hjx.personalcenter.R; | 20 | import com.hjx.personalcenter.R; |
| 21 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; | 21 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; |
| 22 | import com.hjx.personalcenter.adapter.GridAdapter; | 22 | import com.hjx.personalcenter.adapter.GridAdapter; |
| 23 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 23 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
| 24 | import com.hjx.personalcenter.db.SaveParam; | 24 | import com.hjx.personalcenter.db.SaveParam; |
| 25 | import com.hjx.personalcenter.http.HttpCode; | 25 | import com.hjx.personalcenter.http.HttpCode; |
| 26 | import com.hjx.personalcenter.http.HttpManager; | 26 | import com.hjx.personalcenter.http.HttpManager; |
| 27 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 27 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 28 | import com.hjx.personalcenter.model.DefautPublishInfo; | 28 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 29 | import com.hjx.personalcenter.model.VersionInfo; | 29 | import com.hjx.personalcenter.model.VersionInfo; |
| 30 | 30 | ||
| 31 | import java.util.ArrayList; | 31 | import java.util.ArrayList; |
| 32 | import java.util.List; | 32 | import java.util.List; |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| 35 | * Created by h on 2017/8/12. | 35 | * Created by h on 2017/8/12. |
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener, DialogCallBack.VersionCallBack { | 38 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener, DialogCallBack.VersionCallBack { |
| 39 | private GridView gridView; | 39 | private GridView gridView; |
| 40 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 40 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
| 41 | private GridAdapter sim_adapter; | 41 | private GridAdapter sim_adapter; |
| 42 | private View mView; | 42 | private View mView; |
| 43 | private int type; | 43 | private int type; |
| 44 | private ImageView cances; | 44 | private ImageView cances; |
| 45 | private LinearLayout tv_presons; | 45 | private LinearLayout tv_presons; |
| 46 | private TextView publish, sub; | 46 | private TextView publish, sub; |
| 47 | private SimpleDraweeView simpleDraweeView; | 47 | private SimpleDraweeView simpleDraweeView; |
| 48 | public static String TABLAYOUT_FRAGMENT = "versionfragment"; | 48 | public static String TABLAYOUT_FRAGMENT = "versionfragment"; |
| 49 | 49 | ||
| 50 | private String chinese, math,english,physics,chemistry,history,geography,political,biology,science; | 50 | private String chinese, math,english,physics,chemistry,history,geography,political,biology,science; |
| 51 | public static VersionsInfoFragment newInstance(int type) { | 51 | public static VersionsInfoFragment newInstance(int type) { |
| 52 | VersionsInfoFragment fragment = new VersionsInfoFragment(); | 52 | VersionsInfoFragment fragment = new VersionsInfoFragment(); |
| 53 | Bundle bundle = new Bundle(); | 53 | Bundle bundle = new Bundle(); |
| 54 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 54 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
| 55 | fragment.setArguments(bundle); | 55 | fragment.setArguments(bundle); |
| 56 | return fragment; | 56 | return fragment; |
| 57 | 57 | ||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | Handler handler = new Handler() { | 60 | Handler handler = new Handler() { |
| 61 | @Override | 61 | @Override |
| 62 | public void handleMessage(Message msg) { | 62 | public void handleMessage(Message msg) { |
| 63 | super.handleMessage(msg); | 63 | super.handleMessage(msg); |
| 64 | switch (msg.what) { | 64 | switch (msg.what) { |
| 65 | case HttpCode.PUBLISH_SUCESS: | 65 | case HttpCode.PUBLISH_SUCESS: |
| 66 | defautPublishInfos.clear(); | 66 | defautPublishInfos.clear(); |
| 67 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 67 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
| 68 | sim_adapter.notifyDataSetChanged(); | 68 | sim_adapter.notifyDataSetChanged(); |
| 69 | for (int i = 0; i < defautPublishInfos.size(); i++) { | 69 | for (int i = 0; i < defautPublishInfos.size(); i++) { |
| 70 | String subject = defautPublishInfos.get(i).getSubject(); | 70 | String subject = defautPublishInfos.get(i).getSubject(); |
| 71 | if (subject.equals("语文")) { | 71 | if (subject.equals("语文")) { |
| 72 | chinese = defautPublishInfos.get(i).getPress(); | 72 | chinese = defautPublishInfos.get(i).getPress(); |
| 73 | } else if (subject.equals("数学")) { | 73 | } else if (subject.equals("数学")) { |
| 74 | math = defautPublishInfos.get(i).getPress(); | 74 | math = defautPublishInfos.get(i).getPress(); |
| 75 | } else if (subject.equals("英语")) { | 75 | } else if (subject.equals("英语")) { |
| 76 | english = defautPublishInfos.get(i).getPress(); | 76 | english = defautPublishInfos.get(i).getPress(); |
| 77 | } else if (subject.equals("物理")) { | 77 | } else if (subject.equals("物理")) { |
| 78 | physics = defautPublishInfos.get(i).getPress(); | 78 | physics = defautPublishInfos.get(i).getPress(); |
| 79 | } else if (subject.equals("化学")) { | 79 | } else if (subject.equals("化学")) { |
| 80 | chemistry = defautPublishInfos.get(i).getPress(); | 80 | chemistry = defautPublishInfos.get(i).getPress(); |
| 81 | } else if (subject.equals("历史")) { | 81 | } else if (subject.equals("历史")) { |
| 82 | history = defautPublishInfos.get(i).getPress(); | 82 | history = defautPublishInfos.get(i).getPress(); |
| 83 | } else if (subject.equals("地理")) { | 83 | } else if (subject.equals("地理")) { |
| 84 | geography = defautPublishInfos.get(i).getPress(); | 84 | geography = defautPublishInfos.get(i).getPress(); |
| 85 | } else if (subject.equals("政治")) { | 85 | } else if (subject.equals("政治")) { |
| 86 | political = defautPublishInfos.get(i).getPress(); | 86 | political = defautPublishInfos.get(i).getPress(); |
| 87 | }else if (subject.equals("生物")) { | 87 | }else if (subject.equals("生物")) { |
| 88 | biology = defautPublishInfos.get(i).getPress(); | 88 | biology = defautPublishInfos.get(i).getPress(); |
| 89 | }else if (subject.equals("科学")) { | 89 | }else if (subject.equals("科学")) { |
| 90 | science = defautPublishInfos.get(i).getPress(); | 90 | science = defautPublishInfos.get(i).getPress(); |
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | break; | 93 | break; |
| 94 | } | 94 | } |
| 95 | } | 95 | } |
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | @Override | 98 | @Override |
| 99 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 99 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 100 | if (mView == null) { | 100 | if (mView == null) { |
| 101 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); | 101 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); |
| 102 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 102 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
| 103 | String graderid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); | 103 | String graderid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); |
| 104 | //子账户年级id | 104 | //子账户年级id |
| 105 | String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); | 105 | String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); |
| 106 | //账户类型 | 106 | //账户类型 |
| 107 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 107 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
| 108 | String childID = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSID); | 108 | String childID = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSID); |
| 109 | try { | 109 | try { |
| 110 | Object auserID; | 110 | Object auserID; |
| 111 | int type; | 111 | int type; |
| 112 | int graderIDs =Integer.parseInt(graderid); | 112 | int graderIDs =Integer.parseInt(graderid); |
| 113 | if ("2".equals(accounts)){ | 113 | if ("2".equals(accounts)){ |
| 114 | type=Integer.parseInt(accounts); | 114 | type=Integer.parseInt(accounts); |
| 115 | auserID =childID; | 115 | auserID =childID; |
| 116 | }else { | 116 | }else { |
| 117 | type =Integer.parseInt(accounts); | 117 | type =Integer.parseInt(accounts); |
| 118 | auserID =Long.parseLong(userID); | 118 | auserID =Long.parseLong(userID); |
| 119 | } | 119 | } |
| 120 | //获取版本信息 | 120 | //获取版本信息 |
| 121 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderIDs,type,handler); | 121 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderIDs,type,handler); |
| 122 | 122 | ||
| 123 | } catch (NumberFormatException e) { | 123 | } catch (NumberFormatException e) { |
| 124 | e.printStackTrace(); | 124 | e.printStackTrace(); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | initView(mView); | 127 | initView(mView); |
| 128 | initData(); | 128 | initData(); |
| 129 | setLister(); | 129 | setLister(); |
| 130 | 130 | ||
| 131 | 131 | ||
| 132 | } | 132 | } |
| 133 | return mView; | 133 | return mView; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | //初始化 | 136 | //初始化 |
| 137 | private void initView(View mView) { | 137 | private void initView(View mView) { |
| 138 | gridView = (GridView) mView.findViewById(R.id.grideview); | 138 | gridView = (GridView) mView.findViewById(R.id.grideview); |
| 139 | cances = (ImageView) mView.findViewById(R.id.cancel); | 139 | cances = (ImageView) mView.findViewById(R.id.cancel); |
| 140 | sub = (TextView) mView.findViewById(R.id.version_sub); | 140 | sub = (TextView) mView.findViewById(R.id.version_sub); |
| 141 | tv_presons = (LinearLayout) mView.findViewById(R.id.tv_presons); | 141 | tv_presons = (LinearLayout) mView.findViewById(R.id.tv_presons); |
| 142 | 142 | ||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | private void initData() { | 145 | private void initData() { |
| 146 | sim_adapter = new GridAdapter(defautPublishInfos, getActivity()); | 146 | sim_adapter = new GridAdapter(defautPublishInfos, getActivity()); |
| 147 | //配置适配器 | 147 | //配置适配器 |
| 148 | gridView.setAdapter(sim_adapter); | 148 | gridView.setAdapter(sim_adapter); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | private void setLister() { | 151 | private void setLister() { |
| 152 | gridView.setOnItemClickListener(this); | 152 | gridView.setOnItemClickListener(this); |
| 153 | sub.setOnClickListener(this); | 153 | sub.setOnClickListener(this); |
| 154 | tv_presons.setOnClickListener(this); | 154 | tv_presons.setOnClickListener(this); |
| 155 | cances.setOnClickListener(this); | ||
| 155 | } | 156 | } |
| 156 | 157 | ||
| 157 | @Override | 158 | @Override |
| 158 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 159 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
| 159 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); | 160 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); |
| 160 | VerSionDialog.getInstance(this).show(getChildFragmentManager(), "VerSionDialog"); | 161 | VerSionDialog.getInstance(this).show(getChildFragmentManager(), "VerSionDialog"); |
| 161 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | 162 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); |
| 162 | publish = (TextView) view.findViewById(R.id.tv_publish); | 163 | publish = (TextView) view.findViewById(R.id.tv_publish); |
| 163 | 164 | ||
| 164 | } | 165 | } |
| 165 | 166 | ||
| 166 | 167 | ||
| 167 | @Override | 168 | @Override |
| 168 | public void onResume() { | 169 | public void onResume() { |
| 169 | super.onResume(); | 170 | super.onResume(); |
| 170 | 171 | ||
| 171 | } | 172 | } |
| 172 | 173 | ||
| 173 | @Override | 174 | @Override |
| 174 | public void onClick(View v) { | 175 | public void onClick(View v) { |
| 175 | switch (v.getId()) { | 176 | switch (v.getId()) { |
| 176 | case R.id.version_sub: | 177 | case R.id.version_sub: |
| 177 | Log.e("test", "你提交版本信息"); | 178 | Log.e("test", "你提交版本信息"); |
| 178 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 179 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
| 179 | //子账户id | 180 | //子账户id |
| 180 | String childsidid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSID); | 181 | String childsidid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSID); |
| 181 | //账户类型 | 182 | //账户类型 |
| 182 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 183 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
| 183 | try { | 184 | try { |
| 184 | String id = null; | 185 | String id = null; |
| 185 | //String piblish = "清华大学出版社"; | 186 | //String piblish = "清华大学出版社"; |
| 186 | if ("2".equals(accounts)) { | 187 | if ("2".equals(accounts)) { |
| 187 | id = childsidid; | 188 | id = childsidid; |
| 188 | } else { | 189 | } else { |
| 189 | id = userID; | 190 | id = userID; |
| 190 | } | 191 | } |
| 191 | //修改版本信息 | 192 | //修改版本信息 |
| 192 | HttpManager.getInstance().changepublishinfo(getActivity(), id,chinese,math,english,physics,chemistry,history,geography,political,biology,science); | 193 | HttpManager.getInstance().changepublishinfo(getActivity(), id,chinese,math,english,physics,chemistry,history,geography,political,biology,science); |
| 193 | 194 | ||
| 194 | } catch (NumberFormatException e) { | 195 | } catch (NumberFormatException e) { |
| 195 | e.printStackTrace(); | 196 | e.printStackTrace(); |
| 196 | } | 197 | } |
| 197 | 198 | ||
| 198 | 199 | ||
| 199 | break; | 200 | break; |
| 200 | case R.id.tv_presons: | 201 | case R.id.tv_presons: |
| 201 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); | 202 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); |
| 202 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { | 203 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { |
| 203 | @Override | 204 | @Override |
| 204 | public void gotoFragment(ViewPager viewPager) { | 205 | public void gotoFragment(ViewPager viewPager) { |
| 205 | //fragment传递数据 | 206 | //fragment传递数据 |
| 206 | viewPager.setCurrentItem(0); | 207 | viewPager.setCurrentItem(0); |
| 207 | } | 208 | } |
| 208 | }); | 209 | }); |
| 209 | mainActivity.forSkip(); | 210 | mainActivity.forSkip(); |
| 210 | break; | 211 | break; |
| 211 | 212 | ||
| 212 | case R.id.cancel: | 213 | case R.id.cancel: |
| 213 | getActivity().finish(); | 214 | getActivity().finish(); |
| 214 | break; | 215 | break; |
| 215 | } | 216 | } |
| 216 | 217 | ||
| 217 | } | 218 | } |
| 218 | 219 | ||
| 219 | @Override | 220 | @Override |
| 220 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | 221 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { |
| 221 | String imageurl = data.get(position).getPressCover(); | 222 | String imageurl = data.get(position).getPressCover(); |
| 222 | String publishs = data.get(position).getPressName(); | 223 | String publishs = data.get(position).getPressName(); |
| 223 | 224 | ||
| 224 | simpleDraweeView.setImageURI(imageurl); | 225 | simpleDraweeView.setImageURI(imageurl); |
| 225 | publish.setText(publishs); | 226 | publish.setText(publishs); |
| 226 | String subject = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SUBJECT); | 227 | String subject = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SUBJECT); |
| 227 | Log.e("test", "选择的科目" + subject); | 228 | Log.e("test", "选择的科目" + subject); |
| 228 | if ("语文".equals(subject)) { | 229 | if ("语文".equals(subject)) { |
| 229 | chinese = publishs; | 230 | chinese = publishs; |
| 230 | } else if ("数学".equals(subject)) { | 231 | } else if ("数学".equals(subject)) { |
| 231 | math = publishs; | 232 | math = publishs; |
| 232 | }else if ("英语".equals(subject)) { | 233 | }else if ("英语".equals(subject)) { |
| 233 | english = publishs; | 234 | english = publishs; |
| 234 | }else if ("物理".equals(subject)) { | 235 | }else if ("物理".equals(subject)) { |
| 235 | physics = publishs; | 236 | physics = publishs; |
| 236 | }else if ("化学".equals(subject)) { | 237 | }else if ("化学".equals(subject)) { |
| 237 | chemistry = publishs; | 238 | chemistry = publishs; |
| 238 | }else if ("历史".equals(subject)) { | 239 | }else if ("历史".equals(subject)) { |
| 239 | history = publishs; | 240 | history = publishs; |
| 240 | }else if ("地理".equals(subject)) { | 241 | }else if ("地理".equals(subject)) { |
| 241 | geography = publishs; | 242 | geography = publishs; |
| 242 | }else if ("政治".equals(subject)) { | 243 | }else if ("政治".equals(subject)) { |
| 243 | political = publishs; | 244 | political = publishs; |
| 244 | }else if ("生物".equals(subject)) { | 245 | }else if ("生物".equals(subject)) { |
| 245 | biology = publishs; | 246 | biology = publishs; |
| 246 | }else if ("科学".equals(subject)) { | 247 | }else if ("科学".equals(subject)) { |
| 247 | science = publishs; | 248 | science = publishs; |
| 248 | } | 249 | } |
| 249 | 250 | ||
| 250 | } | 251 | } |
| 251 | } | 252 | } |
| 252 | 253 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
| 1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.app.ProgressDialog; | 4 | import android.app.ProgressDialog; |
| 5 | import android.content.Context; | 5 | import android.content.Context; |
| 6 | import android.content.Intent; | 6 | import android.content.Intent; |
| 7 | import android.os.Handler; | 7 | import android.os.Handler; |
| 8 | import android.os.Message; | 8 | import android.os.Message; |
| 9 | import android.util.Log; | 9 | import android.util.Log; |
| 10 | import android.view.KeyEvent; | 10 | import android.view.KeyEvent; |
| 11 | import android.widget.Toast; | 11 | import android.widget.Toast; |
| 12 | 12 | ||
| 13 | import com.google.gson.Gson; | 13 | import com.google.gson.Gson; |
| 14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
| 15 | import com.hjx.personalcenter.activity.BangDingCode; | 15 | import com.hjx.personalcenter.activity.BangDingCode; |
| 16 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 16 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
| 17 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 17 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
| 18 | import com.hjx.personalcenter.db.Content; | 18 | import com.hjx.personalcenter.db.Content; |
| 19 | import com.hjx.personalcenter.db.SaveParam; | 19 | import com.hjx.personalcenter.db.SaveParam; |
| 20 | import com.hjx.personalcenter.gson.GsonTool; | 20 | import com.hjx.personalcenter.gson.GsonTool; |
| 21 | import com.hjx.personalcenter.model.AppVersion; | 21 | import com.hjx.personalcenter.model.AppVersion; |
| 22 | import com.hjx.personalcenter.model.CardInfo; | 22 | import com.hjx.personalcenter.model.CardInfo; |
| 23 | import com.hjx.personalcenter.model.ChildsInfo; | 23 | import com.hjx.personalcenter.model.ChildsInfo; |
| 24 | import com.hjx.personalcenter.model.CityInfo; | 24 | import com.hjx.personalcenter.model.CityInfo; |
| 25 | import com.hjx.personalcenter.model.CountyInfo; | 25 | import com.hjx.personalcenter.model.CountyInfo; |
| 26 | import com.hjx.personalcenter.model.DefautPublishInfo; | 26 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 27 | import com.hjx.personalcenter.model.GradeInfo; | 27 | import com.hjx.personalcenter.model.GradeInfo; |
| 28 | import com.hjx.personalcenter.model.PesonalInfo; | 28 | import com.hjx.personalcenter.model.PesonalInfo; |
| 29 | import com.hjx.personalcenter.model.ProvinceInfo; | 29 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 30 | import com.hjx.personalcenter.model.SchoolInfo; | 30 | import com.hjx.personalcenter.model.SchoolInfo; |
| 31 | import com.hjx.personalcenter.model.SignInfo; | 31 | import com.hjx.personalcenter.model.SignInfo; |
| 32 | import com.hjx.personalcenter.model.VersionInfo; | 32 | import com.hjx.personalcenter.model.VersionInfo; |
| 33 | import com.hjx.personalcenter.model.VideoInfo; | 33 | import com.hjx.personalcenter.model.VideoInfo; |
| 34 | import com.hjx.personalcenter.util.AlertUtils; | 34 | import com.hjx.personalcenter.util.AlertUtils; |
| 35 | import com.hjx.personalcenter.util.DialogPermission; | 35 | import com.hjx.personalcenter.util.DialogPermission; |
| 36 | import com.loopj.android.http.AsyncHttpResponseHandler; | 36 | import com.loopj.android.http.AsyncHttpResponseHandler; |
| 37 | import com.loopj.android.http.JsonHttpResponseHandler; | 37 | import com.loopj.android.http.JsonHttpResponseHandler; |
| 38 | import com.loopj.android.http.RequestParams; | 38 | import com.loopj.android.http.RequestParams; |
| 39 | 39 | ||
| 40 | import org.apache.http.Header; | 40 | import org.apache.http.Header; |
| 41 | import org.apache.http.entity.ByteArrayEntity; | 41 | import org.apache.http.entity.ByteArrayEntity; |
| 42 | import org.apache.http.message.BasicHeader; | 42 | import org.apache.http.message.BasicHeader; |
| 43 | import org.apache.http.protocol.HTTP; | 43 | import org.apache.http.protocol.HTTP; |
| 44 | import org.json.JSONException; | 44 | import org.json.JSONException; |
| 45 | import org.json.JSONObject; | 45 | import org.json.JSONObject; |
| 46 | 46 | ||
| 47 | import java.io.File; | 47 | import java.io.File; |
| 48 | import java.io.FileNotFoundException; | 48 | import java.io.FileNotFoundException; |
| 49 | import java.io.UnsupportedEncodingException; | 49 | import java.io.UnsupportedEncodingException; |
| 50 | import java.util.ArrayList; | 50 | import java.util.ArrayList; |
| 51 | import java.util.List; | 51 | import java.util.List; |
| 52 | 52 | ||
| 53 | public class HttpManager { | 53 | public class HttpManager { |
| 54 | private static HttpManager instance; | 54 | private static HttpManager instance; |
| 55 | private ProgressDialog mProgress = null; | 55 | private ProgressDialog mProgress = null; |
| 56 | 56 | ||
| 57 | public static HttpManager getInstance() { | 57 | public static HttpManager getInstance() { |
| 58 | if (instance == null) { | 58 | if (instance == null) { |
| 59 | instance = new HttpManager(); | 59 | instance = new HttpManager(); |
| 60 | } | 60 | } |
| 61 | return instance; | 61 | return instance; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | //登录接口 | 65 | //登录接口 |
| 66 | 66 | ||
| 67 | public void login(final String username, final String password, final Context mContext, final Handler handler) { | 67 | public void login(final String username, final String password, final Context mContext, final Handler handler) { |
| 68 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 68 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
| 69 | true, true, null); | 69 | true, true, null); |
| 70 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 70 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 71 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 71 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
| 72 | @Override | 72 | @Override |
| 73 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 73 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 74 | closeProgress(); | 74 | closeProgress(); |
| 75 | Message msg = Message.obtain(); | 75 | Message msg = Message.obtain(); |
| 76 | msg.what = HttpCode.LOGIN_SUCESS; | 76 | msg.what = HttpCode.LOGIN_SUCESS; |
| 77 | msg.obj = new String(arg2); | 77 | msg.obj = new String(arg2); |
| 78 | handler.sendMessage(msg); | 78 | handler.sendMessage(msg); |
| 79 | 79 | ||
| 80 | 80 | ||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | @Override | 83 | @Override |
| 84 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 84 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 85 | closeProgress(); | 85 | closeProgress(); |
| 86 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 86 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 87 | } | 87 | } |
| 88 | }); | 88 | }); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | //注册接口 | 91 | //注册接口 |
| 92 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 92 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
| 93 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 93 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
| 94 | false, true, null); | 94 | false, true, null); |
| 95 | JSONObject jsonObject = new JSONObject(); | 95 | JSONObject jsonObject = new JSONObject(); |
| 96 | ByteArrayEntity entity = null; | 96 | ByteArrayEntity entity = null; |
| 97 | try { | 97 | try { |
| 98 | jsonObject.put(HttpKey.USERNAME, username); | 98 | jsonObject.put(HttpKey.USERNAME, username); |
| 99 | jsonObject.put(HttpKey.PASSWORD, password); | 99 | jsonObject.put(HttpKey.PASSWORD, password); |
| 100 | jsonObject.put(HttpKey.SMSCODE, smscode); | 100 | jsonObject.put(HttpKey.SMSCODE, smscode); |
| 101 | jsonObject.put(HttpKey.SOURCE, source); | 101 | jsonObject.put(HttpKey.SOURCE, source); |
| 102 | Log.e("test", "jsonObject" + jsonObject); | 102 | Log.e("test", "jsonObject" + jsonObject); |
| 103 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 103 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
| 104 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 104 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
| 105 | } catch (JSONException e) { | 105 | } catch (JSONException e) { |
| 106 | e.printStackTrace(); | 106 | e.printStackTrace(); |
| 107 | } catch (UnsupportedEncodingException e) { | 107 | } catch (UnsupportedEncodingException e) { |
| 108 | e.printStackTrace(); | 108 | e.printStackTrace(); |
| 109 | } | 109 | } |
| 110 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 110 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 111 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 111 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
| 112 | @Override | 112 | @Override |
| 113 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 113 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 114 | super.onSuccess(statusCode, headers, response); | 114 | super.onSuccess(statusCode, headers, response); |
| 115 | closeProgress(); | 115 | closeProgress(); |
| 116 | Log.e("test", "onSuccess" + response); | 116 | Log.e("test", "onSuccess" + response); |
| 117 | Message msg = Message.obtain(); | 117 | Message msg = Message.obtain(); |
| 118 | msg.what = HttpCode.REGISTERED_SUCESS; | 118 | msg.what = HttpCode.REGISTERED_SUCESS; |
| 119 | msg.obj = response; | 119 | msg.obj = response; |
| 120 | handler.sendMessage(msg); | 120 | handler.sendMessage(msg); |
| 121 | 121 | ||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | @Override | 124 | @Override |
| 125 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 125 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 126 | super.onFailure(statusCode, headers, throwable, errorResponse); | 126 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 127 | closeProgress(); | 127 | closeProgress(); |
| 128 | Log.e("test", "onFailure" + errorResponse); | 128 | Log.e("test", "onFailure" + errorResponse); |
| 129 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 129 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | }); | 132 | }); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | //注册验证码 | 135 | //注册验证码 |
| 136 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 136 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
| 137 | RequestParams params = new RequestParams(); | 137 | RequestParams params = new RequestParams(); |
| 138 | params.put(HttpKey.TYPE, type); | 138 | params.put(HttpKey.TYPE, type); |
| 139 | params.put(HttpKey.MOBIL, mobile); | 139 | params.put(HttpKey.MOBIL, mobile); |
| 140 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 140 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 141 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 141 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
| 142 | 142 | ||
| 143 | @Override | 143 | @Override |
| 144 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 144 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 145 | Log.e("test", "onSuccess-----" + response); | 145 | Log.e("test", "onSuccess-----" + response); |
| 146 | Message msg = Message.obtain(); | 146 | Message msg = Message.obtain(); |
| 147 | msg.what = HttpCode.AUTHCODE_SUCESS; | 147 | msg.what = HttpCode.AUTHCODE_SUCESS; |
| 148 | msg.obj = response; | 148 | msg.obj = response; |
| 149 | handler.sendMessage(msg); | 149 | handler.sendMessage(msg); |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | @Override | 152 | @Override |
| 153 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 153 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 154 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 154 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 155 | } | 155 | } |
| 156 | }); | 156 | }); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | 159 | ||
| 160 | //手机号是否注册 | 160 | //手机号是否注册 |
| 161 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 161 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
| 162 | RequestParams params = new RequestParams(); | 162 | RequestParams params = new RequestParams(); |
| 163 | params.put(HttpKey.USERNAME, mobile); | 163 | params.put(HttpKey.USERNAME, mobile); |
| 164 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 164 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
| 165 | @Override | 165 | @Override |
| 166 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 166 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 167 | Log.e("test", "isregistered" + response.toString()); | 167 | Log.e("test", "isregistered" + response.toString()); |
| 168 | Message msg = Message.obtain(); | 168 | Message msg = Message.obtain(); |
| 169 | msg.what = HttpCode.IS_REFISTER; | 169 | msg.what = HttpCode.IS_REFISTER; |
| 170 | msg.obj = response; | 170 | msg.obj = response; |
| 171 | handler.sendMessage(msg); | 171 | handler.sendMessage(msg); |
| 172 | 172 | ||
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | @Override | 175 | @Override |
| 176 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 176 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 177 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 177 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 178 | 178 | ||
| 179 | } | 179 | } |
| 180 | }); | 180 | }); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | //修改密码 | 183 | //修改密码 |
| 184 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 184 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
| 185 | mProgress = DialogPermission.showProgress(context, null, "正在修改密码...", | ||
| 186 | false, true, null); | ||
| 185 | RequestParams params = new RequestParams(); | 187 | RequestParams params = new RequestParams(); |
| 186 | params.put(HttpKey.USERNAME, username); | 188 | params.put(HttpKey.USERNAME, username); |
| 187 | params.put(HttpKey.OLDPASS, old_pwd1); | 189 | params.put(HttpKey.OLDPASS, old_pwd1); |
| 188 | params.put(HttpKey.NEWPASS, newpassword3); | 190 | params.put(HttpKey.NEWPASS, newpassword3); |
| 189 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 191 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 190 | HttpClient.getInstance().setTimeout(10 * 1000); | 192 | HttpClient.getInstance().setTimeout(10 * 1000); |
| 191 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 193 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
| 192 | @Override | 194 | @Override |
| 193 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 195 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 196 | closeProgress(); | ||
| 194 | try { | 197 | try { |
| 195 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 198 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 196 | String status = jsonObject.optString("status"); | 199 | String status = jsonObject.optString("status"); |
| 197 | if (status.equals("100")) { | 200 | if (status.equals("100")) { |
| 198 | Log.e("test", "onSuccess" + new String(bytes)); | 201 | Log.e("test", "onSuccess" + new String(bytes)); |
| 199 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 202 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 200 | SaveParam.getInstance().clearData((Activity) context); | 203 | SaveParam.getInstance().clearData((Activity) context); |
| 201 | Intent intent = new Intent(); | 204 | Intent intent = new Intent(); |
| 202 | intent.setClass(context, LoginAndRegisterActivity.class); | 205 | intent.setClass(context, LoginAndRegisterActivity.class); |
| 203 | ((Activity) context).startActivity(intent); | 206 | ((Activity) context).startActivity(intent); |
| 204 | ((Activity) context).finish(); | 207 | ((Activity) context).finish(); |
| 205 | } else { | 208 | } else { |
| 206 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 209 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
| 207 | } | 210 | } |
| 208 | } catch (JSONException e) { | 211 | } catch (JSONException e) { |
| 209 | e.printStackTrace(); | 212 | e.printStackTrace(); |
| 210 | } | 213 | } |
| 211 | } | 214 | } |
| 212 | 215 | ||
| 213 | @Override | 216 | @Override |
| 214 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 217 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 218 | closeProgress(); | ||
| 215 | Log.e("test", "onFailure" + new String(bytes)); | 219 | Log.e("test", "onFailure" + new String(bytes)); |
| 216 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 220 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 217 | } | 221 | } |
| 218 | }); | 222 | }); |
| 219 | 223 | ||
| 220 | } | 224 | } |
| 221 | 225 | ||
| 222 | //忘记密码 | 226 | //忘记密码 |
| 223 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 227 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
| 224 | RequestParams params = new RequestParams(); | 228 | RequestParams params = new RequestParams(); |
| 225 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 229 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
| 226 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 230 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
| 227 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 231 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
| 228 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 232 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 229 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 233 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
| 230 | @Override | 234 | @Override |
| 231 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 235 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 232 | try { | 236 | try { |
| 233 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 237 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 234 | String status = jsonObject.optString("status"); | 238 | String status = jsonObject.optString("status"); |
| 235 | if (status.equals("100")) { | 239 | if (status.equals("100")) { |
| 236 | Log.e("test", "onSuccess" + new String(bytes)); | 240 | Log.e("test", "onSuccess" + new String(bytes)); |
| 237 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 241 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 238 | ((Activity) context).finish(); | 242 | ((Activity) context).finish(); |
| 239 | } else { | 243 | } else { |
| 240 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 244 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
| 241 | } | 245 | } |
| 242 | } catch (JSONException e) { | 246 | } catch (JSONException e) { |
| 243 | e.printStackTrace(); | 247 | e.printStackTrace(); |
| 244 | } | 248 | } |
| 245 | } | 249 | } |
| 246 | 250 | ||
| 247 | @Override | 251 | @Override |
| 248 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 252 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 249 | Log.e("test", "onFailure" + new String(bytes)); | 253 | Log.e("test", "onFailure" + new String(bytes)); |
| 250 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 254 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 251 | } | 255 | } |
| 252 | }); | 256 | }); |
| 253 | 257 | ||
| 254 | } | 258 | } |
| 255 | 259 | ||
| 256 | //保存用户登录信息 | 260 | //保存用户登录信息 |
| 257 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { | 261 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { |
| 258 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 262 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
| 259 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 263 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
| 260 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 264 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
| 261 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 265 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
| 262 | 266 | ||
| 263 | 267 | ||
| 264 | } | 268 | } |
| 265 | 269 | ||
| 266 | //提交保卡信息 | 270 | //提交保卡信息 |
| 267 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 271 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
| 268 | String buyAddress, String buyTime, String alterSaleCall, | 272 | String buyAddress, String buyTime, String alterSaleCall, |
| 269 | String productModel, String deviceNumber, String macAddress, | 273 | String productModel, String deviceNumber, String macAddress, |
| 270 | String mobilePhone) { | 274 | String mobilePhone) { |
| 271 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 275 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
| 272 | false, true, null); | 276 | false, true, null); |
| 273 | RequestParams params = new RequestParams(); | 277 | RequestParams params = new RequestParams(); |
| 274 | 278 | ||
| 275 | params.put(HttpKey.USEID, userId); | 279 | params.put(HttpKey.USEID, userId); |
| 276 | params.put(HttpKey.CUSTOMENAME, customerName); | 280 | params.put(HttpKey.CUSTOMENAME, customerName); |
| 277 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 281 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
| 278 | params.put(HttpKey.BUYADREES, buyAddress); | 282 | params.put(HttpKey.BUYADREES, buyAddress); |
| 279 | params.put(HttpKey.BUYTIME, buyTime); | 283 | params.put(HttpKey.BUYTIME, buyTime); |
| 280 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 284 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
| 281 | params.put(HttpKey.PRODUCTMODEL, productModel); | 285 | params.put(HttpKey.PRODUCTMODEL, productModel); |
| 282 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 286 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
| 283 | params.put(HttpKey.MACADRESS, macAddress); | 287 | params.put(HttpKey.MACADRESS, macAddress); |
| 284 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 288 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
| 285 | 289 | ||
| 286 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 290 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 287 | 291 | ||
| 288 | Log.e("test", "params" + params); | 292 | Log.e("test", "params" + params); |
| 289 | HttpClient.getInstance().setTimeout(5 * 1000); | 293 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 290 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 294 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
| 291 | @Override | 295 | @Override |
| 292 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 296 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 293 | JSONObject jsonObject = null; | 297 | JSONObject jsonObject = null; |
| 294 | closeProgress(); | 298 | closeProgress(); |
| 295 | try { | 299 | try { |
| 296 | jsonObject = new JSONObject(new String(bytes)); | 300 | jsonObject = new JSONObject(new String(bytes)); |
| 297 | String status = jsonObject.optString("status"); | 301 | String status = jsonObject.optString("status"); |
| 298 | if (status.equals("1")) { | 302 | if (status.equals("1")) { |
| 299 | Log.e("test", "onSuccess" + jsonObject); | 303 | Log.e("test", "onSuccess" + jsonObject); |
| 300 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 304 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
| 301 | if (Content.cardintentflag == 1) { | 305 | if (Content.cardintentflag == 1) { |
| 302 | Intent intent = new Intent(); | 306 | Intent intent = new Intent(); |
| 303 | intent.setClass((Activity) context, TheStartPageActivity.class); | 307 | intent.setClass((Activity) context, TheStartPageActivity.class); |
| 304 | ((Activity) context).startActivity(intent); | 308 | ((Activity) context).startActivity(intent); |
| 305 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 309 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 306 | ((Activity) context).finish(); | 310 | ((Activity) context).finish(); |
| 307 | } else if (Content.cardintentflag == 2) { | 311 | } else if (Content.cardintentflag == 2) { |
| 308 | Intent intent = new Intent(); | 312 | Intent intent = new Intent(); |
| 309 | intent.setClass((Activity) context, BangDingCode.class); | 313 | intent.setClass((Activity) context, BangDingCode.class); |
| 310 | ((Activity) context).startActivity(intent); | 314 | ((Activity) context).startActivity(intent); |
| 311 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 315 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 312 | ((Activity) context).finish(); | 316 | ((Activity) context).finish(); |
| 313 | 317 | ||
| 314 | } | 318 | } |
| 315 | 319 | ||
| 316 | 320 | ||
| 317 | } else { | 321 | } else { |
| 318 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 322 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
| 319 | } | 323 | } |
| 320 | } catch (JSONException e) { | 324 | } catch (JSONException e) { |
| 321 | e.printStackTrace(); | 325 | e.printStackTrace(); |
| 322 | } | 326 | } |
| 323 | 327 | ||
| 324 | 328 | ||
| 325 | } | 329 | } |
| 326 | 330 | ||
| 327 | @Override | 331 | @Override |
| 328 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 332 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 329 | Log.e("test", "onFailure" + (throwable)); | 333 | Log.e("test", "onFailure" + (throwable)); |
| 330 | closeProgress(); | 334 | closeProgress(); |
| 331 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 335 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 332 | 336 | ||
| 333 | } | 337 | } |
| 334 | }); | 338 | }); |
| 335 | 339 | ||
| 336 | } | 340 | } |
| 337 | 341 | ||
| 338 | //获取保卡信息 | 342 | //获取保卡信息 |
| 339 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { | 343 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { |
| 340 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 344 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
| 341 | false, true, null); | 345 | false, true, null); |
| 342 | HttpClient.getInstance().setTimeout(5 * 1000); | 346 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 343 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 347 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 344 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 348 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 345 | @Override | 349 | @Override |
| 346 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 350 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 347 | closeProgress(); | 351 | closeProgress(); |
| 348 | Log.e("test", "保卡信息" + new String(arg2)); | 352 | Log.e("test", "保卡信息" + new String(arg2)); |
| 349 | try { | 353 | try { |
| 350 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 354 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 351 | int status = jsonObject.optInt("status"); | 355 | int status = jsonObject.optInt("status"); |
| 352 | if (status == 1) { | 356 | if (status == 1) { |
| 353 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 357 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
| 354 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 358 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
| 355 | Message msg = Message.obtain(); | 359 | Message msg = Message.obtain(); |
| 356 | msg.what = HttpCode.SUCHCARDINFO; | 360 | msg.what = HttpCode.SUCHCARDINFO; |
| 357 | msg.obj = schoolInfoBeanList; | 361 | msg.obj = schoolInfoBeanList; |
| 358 | handler.sendMessage(msg); | 362 | handler.sendMessage(msg); |
| 359 | 363 | ||
| 360 | 364 | ||
| 361 | } else { | 365 | } else { |
| 362 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 366 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 363 | 367 | ||
| 364 | } | 368 | } |
| 365 | } catch (JSONException e) { | 369 | } catch (JSONException e) { |
| 366 | e.printStackTrace(); | 370 | e.printStackTrace(); |
| 367 | } | 371 | } |
| 368 | 372 | ||
| 369 | } | 373 | } |
| 370 | 374 | ||
| 371 | @Override | 375 | @Override |
| 372 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 376 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 373 | closeProgress(); | 377 | closeProgress(); |
| 374 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 378 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 375 | } | 379 | } |
| 376 | }); | 380 | }); |
| 377 | } | 381 | } |
| 378 | 382 | ||
| 379 | //获取是否为样机信息 | 383 | //获取是否为样机信息 |
| 380 | public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { | 384 | public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { |
| 381 | HttpClient.getInstance().setTimeout(5 * 1000); | 385 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 382 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 386 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 383 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 387 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 384 | @Override | 388 | @Override |
| 385 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 389 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 386 | closeProgress(); | 390 | closeProgress(); |
| 387 | Log.e("test", "保卡信息" + new String(arg2)); | 391 | Log.e("test", "保卡信息" + new String(arg2)); |
| 388 | Message msg = Message.obtain(); | 392 | Message msg = Message.obtain(); |
| 389 | msg.what = HttpCode.SUCHCARDINFOONE; | 393 | msg.what = HttpCode.SUCHCARDINFOONE; |
| 390 | msg.obj = new String(arg2); | 394 | msg.obj = new String(arg2); |
| 391 | handler.sendMessage(msg); | 395 | handler.sendMessage(msg); |
| 392 | 396 | ||
| 393 | } | 397 | } |
| 394 | 398 | ||
| 395 | @Override | 399 | @Override |
| 396 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 400 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 397 | closeProgress(); | 401 | closeProgress(); |
| 398 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 402 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 399 | } | 403 | } |
| 400 | }); | 404 | }); |
| 401 | } | 405 | } |
| 402 | 406 | ||
| 403 | //修改账户电话 | 407 | //修改账户电话 |
| 404 | public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { | 408 | public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { |
| 405 | RequestParams params = new RequestParams(); | 409 | RequestParams params = new RequestParams(); |
| 406 | params.put("userId", userId); | 410 | params.put("userId", userId); |
| 407 | params.put("username", username); | 411 | params.put("username", username); |
| 408 | params.put("authCode", authCode); | 412 | params.put("authCode", authCode); |
| 409 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 413 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 410 | HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { | 414 | HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { |
| 411 | @Override | 415 | @Override |
| 412 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 416 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 413 | try { | 417 | try { |
| 414 | Log.e("test", "保卡信息" + new String(bytes)); | 418 | Log.e("test", "保卡信息" + new String(bytes)); |
| 415 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 419 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 416 | String status = jsonObject.optString("status"); | 420 | String status = jsonObject.optString("status"); |
| 417 | if (status.equals("1")) { | 421 | if (status.equals("1")) { |
| 418 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 422 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 419 | SaveParam.getInstance().saveLoginParam(mContext, "username", username); | 423 | SaveParam.getInstance().saveLoginParam(mContext, "username", username); |
| 420 | ((Activity) mContext).finish(); | 424 | ((Activity) mContext).finish(); |
| 421 | } else if (status.equals("1001")) { | 425 | } else if (status.equals("1001")) { |
| 422 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 426 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 423 | } | 427 | } |
| 424 | else if (status.equals("1006")) { | 428 | else if (status.equals("1006")) { |
| 425 | AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); | 429 | AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); |
| 426 | } else { | 430 | } else { |
| 427 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 431 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 428 | } | 432 | } |
| 429 | } catch (JSONException e) { | 433 | } catch (JSONException e) { |
| 430 | e.printStackTrace(); | 434 | e.printStackTrace(); |
| 431 | } | 435 | } |
| 432 | } | 436 | } |
| 433 | 437 | ||
| 434 | @Override | 438 | @Override |
| 435 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 439 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 436 | Log.e("test", "onFailure" + new String(bytes)); | 440 | Log.e("test", "onFailure" + new String(bytes)); |
| 437 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 441 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 438 | } | 442 | } |
| 439 | }); | 443 | }); |
| 440 | } | 444 | } |
| 441 | 445 | ||
| 442 | //修改保卡信息电话 | 446 | //修改保卡信息电话 |
| 443 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { | 447 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { |
| 444 | RequestParams params = new RequestParams(); | 448 | RequestParams params = new RequestParams(); |
| 445 | params.put("userId", userId); | 449 | params.put("userId", userId); |
| 446 | params.put("customerPhone", customerPhone); | 450 | params.put("customerPhone", customerPhone); |
| 447 | params.put("authCode", authCode); | 451 | params.put("authCode", authCode); |
| 448 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 452 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 449 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 453 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 450 | @Override | 454 | @Override |
| 451 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 455 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 452 | try { | 456 | try { |
| 453 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 457 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 454 | String status = jsonObject.optString("status"); | 458 | String status = jsonObject.optString("status"); |
| 455 | if (status.equals("1")) { | 459 | if (status.equals("1")) { |
| 456 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 460 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 457 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 461 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
| 458 | ((Activity) mContext).finish(); | 462 | ((Activity) mContext).finish(); |
| 459 | } else if (status.equals("1001")) { | 463 | } else if (status.equals("1001")) { |
| 460 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 464 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 461 | } else { | 465 | } else { |
| 462 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 466 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 463 | } | 467 | } |
| 464 | } catch (JSONException e) { | 468 | } catch (JSONException e) { |
| 465 | e.printStackTrace(); | 469 | e.printStackTrace(); |
| 466 | } | 470 | } |
| 467 | } | 471 | } |
| 468 | 472 | ||
| 469 | @Override | 473 | @Override |
| 470 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 474 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 471 | Log.e("test", "onFailure" + new String(bytes)); | 475 | Log.e("test", "onFailure" + new String(bytes)); |
| 472 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 476 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 473 | } | 477 | } |
| 474 | }); | 478 | }); |
| 475 | } | 479 | } |
| 476 | 480 | ||
| 477 | //修改保卡信息地址 | 481 | //修改保卡信息地址 |
| 478 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { | 482 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { |
| 479 | RequestParams params = new RequestParams(); | 483 | RequestParams params = new RequestParams(); |
| 480 | params.put("userId", userId); | 484 | params.put("userId", userId); |
| 481 | params.put("customerPhone", customerPhone); | 485 | params.put("customerPhone", customerPhone); |
| 482 | params.put("authCode", authCode); | 486 | params.put("authCode", authCode); |
| 483 | params.put("customerAddress", customerAddress); | 487 | params.put("customerAddress", customerAddress); |
| 484 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 488 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 485 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 489 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 486 | @Override | 490 | @Override |
| 487 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 491 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 488 | try { | 492 | try { |
| 489 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 493 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 490 | String status = jsonObject.optString("status"); | 494 | String status = jsonObject.optString("status"); |
| 491 | if (status.equals("1")) { | 495 | if (status.equals("1")) { |
| 492 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); | 496 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); |
| 493 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 497 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
| 494 | ((Activity) mContext).finish(); | 498 | ((Activity) mContext).finish(); |
| 495 | } else { | 499 | } else { |
| 496 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 500 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 497 | } | 501 | } |
| 498 | } catch (JSONException e) { | 502 | } catch (JSONException e) { |
| 499 | e.printStackTrace(); | 503 | e.printStackTrace(); |
| 500 | } | 504 | } |
| 501 | } | 505 | } |
| 502 | 506 | ||
| 503 | @Override | 507 | @Override |
| 504 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 508 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 505 | Log.e("test", "onFailure" + new String(bytes)); | 509 | Log.e("test", "onFailure" + new String(bytes)); |
| 506 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 510 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 507 | } | 511 | } |
| 508 | }); | 512 | }); |
| 509 | } | 513 | } |
| 510 | 514 | ||
| 511 | //验证是否保卡信息 | 515 | //验证是否保卡信息 |
| 512 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { | 516 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { |
| 513 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 517 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
| 514 | false, true, null); | 518 | false, true, null); |
| 515 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 519 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 516 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 520 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 517 | @Override | 521 | @Override |
| 518 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 522 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 519 | Log.e("test", "验证保卡" + new String(arg2)); | 523 | Log.e("test", "验证保卡" + new String(arg2)); |
| 520 | closeProgress(); | 524 | closeProgress(); |
| 521 | Message msg = Message.obtain(); | 525 | Message msg = Message.obtain(); |
| 522 | msg.what = HttpCode.CHECKCARD; | 526 | msg.what = HttpCode.CHECKCARD; |
| 523 | msg.obj = new String(arg2); | 527 | msg.obj = new String(arg2); |
| 524 | handler.sendMessage(msg); | 528 | handler.sendMessage(msg); |
| 525 | 529 | ||
| 526 | 530 | ||
| 527 | } | 531 | } |
| 528 | 532 | ||
| 529 | @Override | 533 | @Override |
| 530 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 534 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 531 | closeProgress(); | 535 | closeProgress(); |
| 532 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 536 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 533 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 537 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
| 534 | } | 538 | } |
| 535 | }); | 539 | }); |
| 536 | } | 540 | } |
| 537 | 541 | ||
| 538 | ///获取年级 | 542 | ///获取年级 |
| 539 | public void getgrade(final Context mContext, final Handler handler) { | 543 | public void getgrade(final Context mContext, final Handler handler) { |
| 540 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 544 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 541 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 545 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
| 542 | @Override | 546 | @Override |
| 543 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 547 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 544 | Log.e("test", "年级" + new String(arg2)); | 548 | Log.e("test", "年级" + new String(arg2)); |
| 545 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 549 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
| 546 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 550 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
| 547 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 551 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
| 548 | String name = gradeInfo.getData().get(i).getName(); | 552 | String name = gradeInfo.getData().get(i).getName(); |
| 549 | int id = gradeInfo.getData().get(i).getId(); | 553 | int id = gradeInfo.getData().get(i).getId(); |
| 550 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 554 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
| 551 | for (int j = 0; j < gradeinfoList.size(); j++) { | 555 | for (int j = 0; j < gradeinfoList.size(); j++) { |
| 552 | String secondname = gradeinfoList.get(j).getName(); | 556 | String secondname = gradeinfoList.get(j).getName(); |
| 553 | int secondid = gradeinfoList.get(j).getId(); | 557 | int secondid = gradeinfoList.get(j).getId(); |
| 554 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 558 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
| 555 | dataBean.setName(secondname); | 559 | dataBean.setName(secondname); |
| 556 | dataBean.setId(secondid); | 560 | dataBean.setId(secondid); |
| 557 | gradeInfoLists.add(dataBean); | 561 | gradeInfoLists.add(dataBean); |
| 558 | } | 562 | } |
| 559 | 563 | ||
| 560 | } | 564 | } |
| 561 | 565 | ||
| 562 | Message message = Message.obtain(); | 566 | Message message = Message.obtain(); |
| 563 | message.what = HttpCode.GRADER; | 567 | message.what = HttpCode.GRADER; |
| 564 | message.obj = gradeInfoLists; | 568 | message.obj = gradeInfoLists; |
| 565 | handler.sendMessage(message); | 569 | handler.sendMessage(message); |
| 566 | 570 | ||
| 567 | 571 | ||
| 568 | } | 572 | } |
| 569 | 573 | ||
| 570 | @Override | 574 | @Override |
| 571 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 575 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 572 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 576 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 573 | } | 577 | } |
| 574 | }); | 578 | }); |
| 575 | } | 579 | } |
| 576 | 580 | ||
| 577 | /** | 581 | /** |
| 578 | * 获取学校 | 582 | * 获取学校 |
| 579 | * | 583 | * |
| 580 | * @param mContext | 584 | * @param mContext |
| 581 | * @param regionId | 585 | * @param regionId |
| 582 | * @param gradeId | 586 | * @param gradeId |
| 583 | * @param handler | 587 | * @param handler |
| 584 | */ | 588 | */ |
| 585 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 589 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
| 586 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 590 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 587 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 591 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
| 588 | @Override | 592 | @Override |
| 589 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 593 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 590 | Log.e("test", "学校" + new String(arg2)); | 594 | Log.e("test", "学校" + new String(arg2)); |
| 591 | try { | 595 | try { |
| 592 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 596 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 593 | int status = jsonObject.optInt("status"); | 597 | int status = jsonObject.optInt("status"); |
| 594 | if (status == 1) { | 598 | if (status == 1) { |
| 595 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 599 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
| 596 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 600 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
| 597 | Message message = Message.obtain(); | 601 | Message message = Message.obtain(); |
| 598 | message.what = HttpCode.SCHOOL; | 602 | message.what = HttpCode.SCHOOL; |
| 599 | message.obj = schoolInfoBeanList; | 603 | message.obj = schoolInfoBeanList; |
| 600 | handler.sendMessage(message); | 604 | handler.sendMessage(message); |
| 601 | 605 | ||
| 602 | 606 | ||
| 603 | } else { | 607 | } else { |
| 604 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 608 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 605 | 609 | ||
| 606 | } | 610 | } |
| 607 | } catch (JSONException e) { | 611 | } catch (JSONException e) { |
| 608 | e.printStackTrace(); | 612 | e.printStackTrace(); |
| 609 | } | 613 | } |
| 610 | 614 | ||
| 611 | } | 615 | } |
| 612 | 616 | ||
| 613 | @Override | 617 | @Override |
| 614 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 618 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 615 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 619 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 616 | } | 620 | } |
| 617 | }); | 621 | }); |
| 618 | } | 622 | } |
| 619 | 623 | ||
| 620 | 624 | ||
| 621 | /** | 625 | /** |
| 622 | * 获取个人信息 | 626 | * 获取个人信息 |
| 623 | * | 627 | * |
| 624 | * @param mContext | 628 | * @param mContext |
| 625 | * @param userId | 629 | * @param userId |
| 626 | * @param handler | 630 | * @param handler |
| 627 | */ | 631 | */ |
| 628 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { | 632 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
| 629 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 633 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
| 630 | // false, true, null); | 634 | // false, true, null); |
| 631 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 635 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 632 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 636 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
| 633 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 637 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 634 | @Override | 638 | @Override |
| 635 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 639 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 636 | closeProgress(); | 640 | closeProgress(); |
| 637 | Log.e("test", "个人信息" + new String(arg2)); | 641 | Log.e("test", "个人信息" + new String(arg2)); |
| 638 | try { | 642 | try { |
| 639 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 643 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 640 | int status = jsonObject.optInt("status"); | 644 | int status = jsonObject.optInt("status"); |
| 641 | if (status == 1) { | 645 | if (status == 1) { |
| 642 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 646 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
| 643 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 647 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
| 644 | Message message = Message.obtain(); | 648 | Message message = Message.obtain(); |
| 645 | message.what = HttpCode.GETINFO; | 649 | message.what = HttpCode.GETINFO; |
| 646 | message.obj = pesonalInfoBeanList; | 650 | message.obj = pesonalInfoBeanList; |
| 647 | handler.sendMessage(message); | 651 | handler.sendMessage(message); |
| 648 | 652 | ||
| 649 | 653 | ||
| 650 | } else { | 654 | } else { |
| 651 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 655 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 652 | 656 | ||
| 653 | } | 657 | } |
| 654 | } catch (JSONException e) { | 658 | } catch (JSONException e) { |
| 655 | e.printStackTrace(); | 659 | e.printStackTrace(); |
| 656 | } | 660 | } |
| 657 | 661 | ||
| 658 | 662 | ||
| 659 | } | 663 | } |
| 660 | 664 | ||
| 661 | @Override | 665 | @Override |
| 662 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 666 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 663 | closeProgress(); | 667 | closeProgress(); |
| 664 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 668 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 665 | } | 669 | } |
| 666 | }); | 670 | }); |
| 667 | } | 671 | } |
| 668 | 672 | ||
| 669 | //修改个人信息 | 673 | //修改个人信息 |
| 670 | public void changepresonalinfo(final Context mContext, Long id, int type | 674 | public void changepresonalinfo(final Context mContext, Long id, int type |
| 671 | , String name, String birthday, int gradeId, long regionId, | 675 | , String name, String birthday, int gradeId, long regionId, |
| 672 | Object schoolId, String qq, String gender | 676 | Object schoolId, String qq, String gender |
| 673 | , String regionName, String devicenumber) throws UnsupportedEncodingException { | 677 | , String regionName, String devicenumber) throws UnsupportedEncodingException { |
| 674 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 678 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
| 675 | false, true, null); | 679 | false, true, null); |
| 676 | RequestParams params = new RequestParams(); | 680 | RequestParams params = new RequestParams(); |
| 677 | 681 | ||
| 678 | params.put(HttpKey.USEID, id); | 682 | params.put(HttpKey.USEID, id); |
| 679 | params.put(HttpKey.TYPE, type); | 683 | params.put(HttpKey.TYPE, type); |
| 680 | params.put(HttpKey.NAME, name); | 684 | params.put(HttpKey.NAME, name); |
| 681 | params.put(HttpKey.BIRDays, birthday); | 685 | params.put(HttpKey.BIRDays, birthday); |
| 682 | params.put(HttpKey.GRADE, gradeId); | 686 | params.put(HttpKey.GRADE, gradeId); |
| 683 | params.put(HttpKey.REGION, regionId); | 687 | params.put(HttpKey.REGION, regionId); |
| 684 | params.put(HttpKey.SCHOOL, schoolId); | 688 | params.put(HttpKey.SCHOOL, schoolId); |
| 685 | params.put(HttpKey.QQ, qq); | 689 | params.put(HttpKey.QQ, qq); |
| 686 | params.put(HttpKey.GENDER, gender); | 690 | params.put(HttpKey.GENDER, gender); |
| 687 | params.put(HttpKey.REGIONNAME, regionName); | 691 | params.put(HttpKey.REGIONNAME, regionName); |
| 688 | params.put(HttpKey.DEVINUMBER, devicenumber); | 692 | params.put(HttpKey.DEVINUMBER, devicenumber); |
| 689 | Log.e("test", "个人信息" + params); | 693 | Log.e("test", "个人信息" + params); |
| 690 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 694 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 691 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { | 695 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { |
| 692 | @Override | 696 | @Override |
| 693 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 697 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 694 | super.onSuccess(statusCode, headers, response); | 698 | super.onSuccess(statusCode, headers, response); |
| 695 | closeProgress(); | 699 | closeProgress(); |
| 696 | String status = response.optString("status"); | 700 | String status = response.optString("status"); |
| 697 | if (status.equals("1")) { | 701 | if (status.equals("1")) { |
| 698 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 702 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
| 699 | ((Activity) mContext).finish(); | 703 | ((Activity) mContext).finish(); |
| 700 | } else { | 704 | } else { |
| 701 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 705 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
| 702 | } | 706 | } |
| 703 | 707 | ||
| 704 | } | 708 | } |
| 705 | 709 | ||
| 706 | @Override | 710 | @Override |
| 707 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 711 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 708 | super.onFailure(statusCode, headers, throwable, errorResponse); | 712 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 709 | closeProgress(); | 713 | closeProgress(); |
| 710 | Log.e("test", "onFailure" + errorResponse); | 714 | Log.e("test", "onFailure" + errorResponse); |
| 711 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 715 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 712 | } | 716 | } |
| 713 | 717 | ||
| 714 | }); | 718 | }); |
| 715 | } | 719 | } |
| 716 | 720 | ||
| 717 | //提交注册信息 | 721 | //提交注册信息 |
| 718 | public void subregisterinfo(final Context mContext, Long userId | 722 | public void subregisterinfo(final Context mContext, Long userId |
| 719 | , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese, | 723 | , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese, |
| 720 | String math, String english, String physics, String chemistry, | 724 | String math, String english, String physics, String chemistry, |
| 721 | String history, String geography, String political, String biology, String science, final Handler handler) { | 725 | String history, String geography, String political, String biology, String science, final Handler handler) { |
| 722 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 726 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
| 723 | false, true, null); | 727 | false, true, null); |
| 724 | RequestParams params = new RequestParams(); | 728 | RequestParams params = new RequestParams(); |
| 725 | 729 | ||
| 726 | params.put(HttpKey.USEID, userId); | 730 | params.put(HttpKey.USEID, userId); |
| 727 | params.put(HttpKey.NAME, name); | 731 | params.put(HttpKey.NAME, name); |
| 728 | params.put(HttpKey.GRADE, gradeId); | 732 | params.put(HttpKey.GRADE, gradeId); |
| 729 | params.put(HttpKey.REGION, regionId); | 733 | params.put(HttpKey.REGION, regionId); |
| 730 | params.put(HttpKey.SCHOOL, schoolId); | 734 | params.put(HttpKey.SCHOOL, schoolId); |
| 731 | params.put(HttpKey.REGIONNAME, regionName); | 735 | params.put(HttpKey.REGIONNAME, regionName); |
| 732 | params.put(HttpKey.MATH, math); | 736 | params.put(HttpKey.MATH, math); |
| 733 | params.put(HttpKey.ENGLISH, english); | 737 | params.put(HttpKey.ENGLISH, english); |
| 734 | params.put(HttpKey.PHYSICES, physics); | 738 | params.put(HttpKey.PHYSICES, physics); |
| 735 | params.put(HttpKey.CHEMISTRY, chemistry); | 739 | params.put(HttpKey.CHEMISTRY, chemistry); |
| 736 | params.put(HttpKey.HISTIRY, history); | 740 | params.put(HttpKey.HISTIRY, history); |
| 737 | params.put(HttpKey.GEOGRAPHY, geography); | 741 | params.put(HttpKey.GEOGRAPHY, geography); |
| 738 | params.put(HttpKey.POLITICAL, political); | 742 | params.put(HttpKey.POLITICAL, political); |
| 739 | params.put(HttpKey.BIOLOGY, biology); | 743 | params.put(HttpKey.BIOLOGY, biology); |
| 740 | params.put(HttpKey.SCIENCE, science); | 744 | params.put(HttpKey.SCIENCE, science); |
| 741 | 745 | ||
| 742 | Log.e("test", "注册信息" + params); | 746 | Log.e("test", "注册信息" + params); |
| 743 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 747 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 744 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { | 748 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { |
| 745 | @Override | 749 | @Override |
| 746 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 750 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 747 | super.onSuccess(statusCode, headers, response); | 751 | super.onSuccess(statusCode, headers, response); |
| 748 | closeProgress(); | 752 | closeProgress(); |
| 749 | Message message = Message.obtain(); | 753 | Message message = Message.obtain(); |
| 750 | message.what = HttpCode.REGISTERINFO_SUCESS; | 754 | message.what = HttpCode.REGISTERINFO_SUCESS; |
| 751 | message.obj = new String(String.valueOf(response)); | 755 | message.obj = new String(String.valueOf(response)); |
| 752 | handler.sendMessage(message); | 756 | handler.sendMessage(message); |
| 753 | 757 | ||
| 754 | } | 758 | } |
| 755 | 759 | ||
| 756 | @Override | 760 | @Override |
| 757 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 761 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 758 | super.onFailure(statusCode, headers, throwable, errorResponse); | 762 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 759 | closeProgress(); | 763 | closeProgress(); |
| 760 | Log.e("test", "onFailure" + errorResponse); | 764 | Log.e("test", "onFailure" + errorResponse); |
| 761 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 765 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 762 | } | 766 | } |
| 763 | 767 | ||
| 764 | }); | 768 | }); |
| 765 | } | 769 | } |
| 766 | 770 | ||
| 767 | //修改版本信息 | 771 | //修改版本信息 |
| 768 | public void changepublishinfo(final Context mContext, String userId, String chinese, | 772 | public void changepublishinfo(final Context mContext, String userId, String chinese, |
| 769 | String math, String english, String physics, String chemistry, | 773 | String math, String english, String physics, String chemistry, |
| 770 | String history, String geography, String political, String biology, String science) { | 774 | String history, String geography, String political, String biology, String science) { |
| 771 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 775 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
| 772 | false, true, null); | 776 | false, true, null); |
| 773 | RequestParams params = new RequestParams(); | 777 | RequestParams params = new RequestParams(); |
| 774 | params.put(HttpKey.USEID, userId); | 778 | params.put(HttpKey.USEID, userId); |
| 775 | params.put(HttpKey.CHINESE, chinese); | 779 | params.put(HttpKey.CHINESE, chinese); |
| 776 | params.put(HttpKey.MATH, math); | 780 | params.put(HttpKey.MATH, math); |
| 777 | params.put(HttpKey.ENGLISH, english); | 781 | params.put(HttpKey.ENGLISH, english); |
| 778 | params.put(HttpKey.PHYSICES, physics); | 782 | params.put(HttpKey.PHYSICES, physics); |
| 779 | params.put(HttpKey.CHEMISTRY, chemistry); | 783 | params.put(HttpKey.CHEMISTRY, chemistry); |
| 780 | params.put(HttpKey.HISTIRY, history); | 784 | params.put(HttpKey.HISTIRY, history); |
| 781 | params.put(HttpKey.GEOGRAPHY, geography); | 785 | params.put(HttpKey.GEOGRAPHY, geography); |
| 782 | params.put(HttpKey.POLITICAL, political); | 786 | params.put(HttpKey.POLITICAL, political); |
| 783 | params.put(HttpKey.BIOLOGY, biology); | 787 | params.put(HttpKey.BIOLOGY, biology); |
| 784 | params.put(HttpKey.SCIENCE, science); | 788 | params.put(HttpKey.SCIENCE, science); |
| 785 | 789 | ||
| 786 | Log.e("test", "版本信息信息" + params); | 790 | Log.e("test", "版本信息信息" + params); |
| 787 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 791 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 788 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { | 792 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { |
| 789 | @Override | 793 | @Override |
| 790 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 794 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 791 | super.onSuccess(statusCode, headers, response); | 795 | super.onSuccess(statusCode, headers, response); |
| 792 | closeProgress(); | 796 | closeProgress(); |
| 793 | String status = response.optString("status"); | 797 | String status = response.optString("status"); |
| 794 | if (status.equals("1")) { | 798 | if (status.equals("1")) { |
| 795 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); | 799 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); |
| 796 | ((Activity) mContext).finish(); | 800 | ((Activity) mContext).finish(); |
| 797 | } else { | 801 | } else { |
| 798 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 802 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 799 | } | 803 | } |
| 800 | 804 | ||
| 801 | } | 805 | } |
| 802 | 806 | ||
| 803 | @Override | 807 | @Override |
| 804 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 808 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 805 | super.onFailure(statusCode, headers, throwable, errorResponse); | 809 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 806 | closeProgress(); | 810 | closeProgress(); |
| 807 | Log.e("test", "onFailure" + errorResponse); | 811 | Log.e("test", "onFailure" + errorResponse); |
| 808 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 812 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 809 | } | 813 | } |
| 810 | 814 | ||
| 811 | }); | 815 | }); |
| 812 | } | 816 | } |
| 813 | 817 | ||
| 814 | //修改个性签名 | 818 | //修改个性签名 |
| 815 | public void changsignature(final Context mContext, long userId, int type, final String signature) { | 819 | public void changsignature(final Context mContext, long userId, int type, final String signature) { |
| 816 | RequestParams params = new RequestParams(); | 820 | RequestParams params = new RequestParams(); |
| 817 | params.put("userId", userId); | 821 | params.put("userId", userId); |
| 818 | params.put("type", type); | 822 | params.put("type", type); |
| 819 | params.put("signature", signature); | 823 | params.put("signature", signature); |
| 820 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 824 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 821 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 825 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
| 822 | @Override | 826 | @Override |
| 823 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 827 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 824 | try { | 828 | try { |
| 825 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 829 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 826 | String status = jsonObject.optString("status"); | 830 | String status = jsonObject.optString("status"); |
| 827 | if (status.equals("1")) { | 831 | if (status.equals("1")) { |
| 828 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 832 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
| 829 | } else { | 833 | } else { |
| 830 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 834 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 831 | } | 835 | } |
| 832 | } catch (JSONException e) { | 836 | } catch (JSONException e) { |
| 833 | e.printStackTrace(); | 837 | e.printStackTrace(); |
| 834 | } | 838 | } |
| 835 | } | 839 | } |
| 836 | 840 | ||
| 837 | @Override | 841 | @Override |
| 838 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 842 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 839 | //Log.e("test", "onFailure" + new String(bytes)); | 843 | //Log.e("test", "onFailure" + new String(bytes)); |
| 840 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 844 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 841 | } | 845 | } |
| 842 | }); | 846 | }); |
| 843 | } | 847 | } |
| 844 | 848 | ||
| 845 | /** | 849 | /** |
| 846 | * 获取个性签名 | 850 | * 获取个性签名 |
| 847 | * | 851 | * |
| 848 | * @param mContext | 852 | * @param mContext |
| 849 | * @param userId | 853 | * @param userId |
| 850 | * @param handler | 854 | * @param handler |
| 851 | */ | 855 | */ |
| 852 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { | 856 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { |
| 853 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 857 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 854 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 858 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 855 | @Override | 859 | @Override |
| 856 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 860 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 857 | Log.e("test", "个性签名" + new String(arg2)); | 861 | Log.e("test", "个性签名" + new String(arg2)); |
| 858 | try { | 862 | try { |
| 859 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 863 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 860 | int status = jsonObject.optInt("status"); | 864 | int status = jsonObject.optInt("status"); |
| 861 | if (status == 1) { | 865 | if (status == 1) { |
| 862 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 866 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
| 863 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 867 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
| 864 | Message message = Message.obtain(); | 868 | Message message = Message.obtain(); |
| 865 | message.what = HttpCode.SIGN; | 869 | message.what = HttpCode.SIGN; |
| 866 | message.obj = signInfoBeanList; | 870 | message.obj = signInfoBeanList; |
| 867 | handler.sendMessage(message); | 871 | handler.sendMessage(message); |
| 868 | 872 | ||
| 869 | 873 | ||
| 870 | } else if (status == 1000) { | 874 | } else if (status == 1000) { |
| 871 | //AlertUtils.showToast(mContext, "您还没有签名哦"); | 875 | //AlertUtils.showToast(mContext, "您还没有签名哦"); |
| 872 | 876 | ||
| 873 | } else { | 877 | } else { |
| 874 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 878 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 875 | } | 879 | } |
| 876 | } catch (JSONException e) { | 880 | } catch (JSONException e) { |
| 877 | e.printStackTrace(); | 881 | e.printStackTrace(); |
| 878 | } | 882 | } |
| 879 | 883 | ||
| 880 | 884 | ||
| 881 | } | 885 | } |
| 882 | 886 | ||
| 883 | @Override | 887 | @Override |
| 884 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 888 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 885 | //Log.e("test", "失败原因" + arg3); | 889 | //Log.e("test", "失败原因" + arg3); |
| 886 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 890 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 887 | } | 891 | } |
| 888 | }); | 892 | }); |
| 889 | } | 893 | } |
| 890 | 894 | ||
| 891 | /** | 895 | /** |
| 892 | * 用户反馈 | 896 | * 用户反馈 |
| 893 | * | 897 | * |
| 894 | * @param mContext | 898 | * @param mContext |
| 895 | * @param userId | 899 | * @param userId |
| 896 | * @param content | 900 | * @param content |
| 897 | * @param contact | 901 | * @param contact |
| 898 | * @param imgs | 902 | * @param imgs |
| 899 | * @param feedtype | 903 | * @param feedtype |
| 900 | * @throws UnsupportedEncodingException | 904 | * @throws UnsupportedEncodingException |
| 901 | */ | 905 | */ |
| 902 | public void feedback(final Context mContext, String userId, String content, | 906 | public void feedback(final Context mContext, String userId, String content, |
| 903 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { | 907 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { |
| 904 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 908 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
| 905 | false, true, null); | 909 | false, true, null); |
| 906 | File file = new File(imgs); | 910 | File file = new File(imgs); |
| 907 | RequestParams params = new RequestParams(); | 911 | RequestParams params = new RequestParams(); |
| 908 | try { | 912 | try { |
| 909 | params.put("userId", userId); | 913 | params.put("userId", userId); |
| 910 | params.put("content", content); | 914 | params.put("content", content); |
| 911 | params.put("contact", contact); | 915 | params.put("contact", contact); |
| 912 | if (file.exists() && file.length() > 0) { | 916 | if (file.exists() && file.length() > 0) { |
| 913 | params.put("imgs", file); | 917 | params.put("imgs", file); |
| 914 | } | 918 | } |
| 915 | params.put("feedtype", feedtype); | 919 | params.put("feedtype", feedtype); |
| 916 | } catch (FileNotFoundException e) { | 920 | } catch (FileNotFoundException e) { |
| 917 | e.printStackTrace(); | 921 | e.printStackTrace(); |
| 918 | } | 922 | } |
| 919 | Log.e("test", "onSuccess" + params); | 923 | Log.e("test", "onSuccess" + params); |
| 920 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { | 924 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { |
| 921 | @Override | 925 | @Override |
| 922 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 926 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 923 | closeProgress(); | 927 | closeProgress(); |
| 924 | Log.e("test", "onSuccess" + new String(bytes)); | 928 | Log.e("test", "onSuccess" + new String(bytes)); |
| 925 | try { | 929 | try { |
| 926 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 930 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 927 | String status = jsonObject.optString("status"); | 931 | String status = jsonObject.optString("status"); |
| 928 | if (status.equals("1")) { | 932 | if (status.equals("1")) { |
| 929 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); | 933 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); |
| 930 | ((Activity) mContext).finish(); | 934 | ((Activity) mContext).finish(); |
| 931 | } else { | 935 | } else { |
| 932 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 936 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 933 | } | 937 | } |
| 934 | } catch (JSONException e) { | 938 | } catch (JSONException e) { |
| 935 | e.printStackTrace(); | 939 | e.printStackTrace(); |
| 936 | } | 940 | } |
| 937 | } | 941 | } |
| 938 | 942 | ||
| 939 | @Override | 943 | @Override |
| 940 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 944 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 941 | closeProgress(); | 945 | closeProgress(); |
| 942 | //Log.e("test", "错误信息" + new String(bytes)); | 946 | //Log.e("test", "错误信息" + new String(bytes)); |
| 943 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 947 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 944 | 948 | ||
| 945 | } | 949 | } |
| 946 | }); | 950 | }); |
| 947 | 951 | ||
| 948 | } | 952 | } |
| 949 | 953 | ||
| 950 | /** | 954 | /** |
| 951 | * 查询子账户信息 | 955 | * 查询子账户信息 |
| 952 | * | 956 | * |
| 953 | * @param mContext | 957 | * @param mContext |
| 954 | * @param userId | 958 | * @param userId |
| 955 | * @param handler | 959 | * @param handler |
| 956 | */ | 960 | */ |
| 957 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { | 961 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { |
| 958 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", | 962 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", |
| 959 | false, true, null); | 963 | false, true, null); |
| 960 | 964 | ||
| 961 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); | 965 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); |
| 962 | HttpClient.getInstance().setTimeout(5 * 1000); | 966 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 963 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 967 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 964 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 968 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
| 965 | @Override | 969 | @Override |
| 966 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 970 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 967 | closeProgress(); | 971 | closeProgress(); |
| 968 | Log.e("test", "子账户信息" + new String(arg2)); | 972 | Log.e("test", "子账户信息" + new String(arg2)); |
| 969 | try { | 973 | try { |
| 970 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 974 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 971 | int status = jsonObject.optInt("status"); | 975 | int status = jsonObject.optInt("status"); |
| 972 | if (status == 1) { | 976 | if (status == 1) { |
| 973 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 977 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
| 974 | Log.e("test", "子账户信息" + childsInfo); | 978 | Log.e("test", "子账户信息" + childsInfo); |
| 975 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 979 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
| 976 | Log.e("test", "子账户信息" + schoolInfoBeanList); | 980 | Log.e("test", "子账户信息" + schoolInfoBeanList); |
| 977 | Message msg = Message.obtain(); | 981 | Message msg = Message.obtain(); |
| 978 | msg.what = HttpCode.CHILDS_SUCESS; | 982 | msg.what = HttpCode.CHILDS_SUCESS; |
| 979 | msg.obj = schoolInfoBeanList; | 983 | msg.obj = schoolInfoBeanList; |
| 980 | handler.sendMessage(msg); | 984 | handler.sendMessage(msg); |
| 981 | 985 | ||
| 982 | } else { | 986 | } else { |
| 983 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 987 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
| 984 | 988 | ||
| 985 | } | 989 | } |
| 986 | } catch (JSONException e) { | 990 | } catch (JSONException e) { |
| 987 | e.printStackTrace(); | 991 | e.printStackTrace(); |
| 988 | 992 | ||
| 989 | } | 993 | } |
| 990 | 994 | ||
| 991 | } | 995 | } |
| 992 | 996 | ||
| 993 | @Override | 997 | @Override |
| 994 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 998 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 995 | closeProgress(); | 999 | closeProgress(); |
| 996 | // Log.e("test", "错误信息" + new String(arg2)); | 1000 | // Log.e("test", "错误信息" + new String(arg2)); |
| 997 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1001 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 998 | } | 1002 | } |
| 999 | }); | 1003 | }); |
| 1000 | 1004 | ||
| 1001 | } | 1005 | } |
| 1002 | 1006 | ||
| 1003 | /** | 1007 | /** |
| 1004 | * 删除子账户信息 | 1008 | * 删除子账户信息 |
| 1005 | * | 1009 | * |
| 1006 | * @param mContext | 1010 | * @param mContext |
| 1007 | * @param subAccountId | 1011 | * @param subAccountId |
| 1008 | */ | 1012 | */ |
| 1009 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { | 1013 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { |
| 1010 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 1014 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
| 1011 | false, true, null); | 1015 | false, true, null); |
| 1012 | HttpClient.getInstance().setTimeout(5 * 1000); | 1016 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1013 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1017 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1014 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 1018 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
| 1015 | @Override | 1019 | @Override |
| 1016 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1020 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1017 | closeProgress(); | 1021 | closeProgress(); |
| 1018 | Log.e("test", "子账户信息" + new String(arg2)); | 1022 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1019 | try { | 1023 | try { |
| 1020 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1024 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1021 | int status = jsonObject.optInt("status"); | 1025 | int status = jsonObject.optInt("status"); |
| 1022 | if (status == 1) { | 1026 | if (status == 1) { |
| 1023 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 1027 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
| 1024 | ((Activity) mContext).finish(); | 1028 | ((Activity) mContext).finish(); |
| 1025 | } else { | 1029 | } else { |
| 1026 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 1030 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
| 1027 | 1031 | ||
| 1028 | } | 1032 | } |
| 1029 | } catch (JSONException e) { | 1033 | } catch (JSONException e) { |
| 1030 | e.printStackTrace(); | 1034 | e.printStackTrace(); |
| 1031 | } | 1035 | } |
| 1032 | 1036 | ||
| 1033 | } | 1037 | } |
| 1034 | 1038 | ||
| 1035 | @Override | 1039 | @Override |
| 1036 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1040 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1037 | closeProgress(); | 1041 | closeProgress(); |
| 1038 | Log.e("test", "错误信息" + new String(arg2)); | 1042 | Log.e("test", "错误信息" + new String(arg2)); |
| 1039 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1043 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1040 | } | 1044 | } |
| 1041 | }); | 1045 | }); |
| 1042 | 1046 | ||
| 1043 | } | 1047 | } |
| 1044 | 1048 | ||
| 1045 | /** | 1049 | /** |
| 1046 | * 添加子账户信息 | 1050 | * 添加子账户信息 |
| 1047 | */ | 1051 | */ |
| 1048 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 1052 | public void addchildAccountinfo(final Context mContext, long parentId, String image, |
| 1049 | String name, final Long grade, Object school, Long region | 1053 | String name, final Long grade, Object school, Long region |
| 1050 | , String deviceNumber, String regionName) { | 1054 | , String deviceNumber, String regionName) { |
| 1051 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 1055 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
| 1052 | false, true, null); | 1056 | false, true, null); |
| 1053 | RequestParams params = new RequestParams(); | 1057 | RequestParams params = new RequestParams(); |
| 1054 | 1058 | ||
| 1055 | params.put(HttpKey.PARENTID, parentId); | 1059 | params.put(HttpKey.PARENTID, parentId); |
| 1056 | params.put(HttpKey.IMAGE, image); | 1060 | params.put(HttpKey.IMAGE, image); |
| 1057 | params.put(HttpKey.NAME, name); | 1061 | params.put(HttpKey.NAME, name); |
| 1058 | params.put(HttpKey.GRADE, grade); | 1062 | params.put(HttpKey.GRADE, grade); |
| 1059 | params.put(HttpKey.SCHOOL, school); | 1063 | params.put(HttpKey.SCHOOL, school); |
| 1060 | params.put(HttpKey.REGION, region); | 1064 | params.put(HttpKey.REGION, region); |
| 1061 | params.put(HttpKey.DEVINUMBER, deviceNumber); | 1065 | params.put(HttpKey.DEVINUMBER, deviceNumber); |
| 1062 | params.put(HttpKey.REGIONNAME, regionName); | 1066 | params.put(HttpKey.REGIONNAME, regionName); |
| 1063 | 1067 | ||
| 1064 | Log.e("test", "子账户信息" + params); | 1068 | Log.e("test", "子账户信息" + params); |
| 1065 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1069 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 1066 | HttpClient.getInstance().setTimeout(5 * 1000); | 1070 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1067 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1071 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1068 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 1072 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
| 1069 | @Override | 1073 | @Override |
| 1070 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1074 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1071 | closeProgress(); | 1075 | closeProgress(); |
| 1072 | 1076 | ||
| 1073 | Log.e("test", "子账户信息" + new String(arg2)); | 1077 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1074 | try { | 1078 | try { |
| 1075 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1079 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1076 | int status = jsonObject.optInt("status"); | 1080 | int status = jsonObject.optInt("status"); |
| 1077 | if (status == 1) { | 1081 | if (status == 1) { |
| 1078 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1082 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
| 1079 | ((Activity) mContext).finish(); | 1083 | ((Activity) mContext).finish(); |
| 1080 | } else { | 1084 | } else { |
| 1081 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1085 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
| 1082 | 1086 | ||
| 1083 | } | 1087 | } |
| 1084 | } catch (JSONException e) { | 1088 | } catch (JSONException e) { |
| 1085 | e.printStackTrace(); | 1089 | e.printStackTrace(); |
| 1086 | } | 1090 | } |
| 1087 | 1091 | ||
| 1088 | } | 1092 | } |
| 1089 | 1093 | ||
| 1090 | @Override | 1094 | @Override |
| 1091 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1095 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1092 | closeProgress(); | 1096 | closeProgress(); |
| 1093 | Log.e("test", "错误信息" + new String(arg2)); | 1097 | Log.e("test", "错误信息" + new String(arg2)); |
| 1094 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1098 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1095 | } | 1099 | } |
| 1096 | }); | 1100 | }); |
| 1097 | 1101 | ||
| 1098 | } | 1102 | } |
| 1099 | 1103 | ||
| 1100 | /** | 1104 | /** |
| 1101 | * 切换子账户信息 | 1105 | * 切换子账户信息 |
| 1102 | * | 1106 | * |
| 1103 | * @param mContext | 1107 | * @param mContext |
| 1104 | * @param subAccountId | 1108 | * @param subAccountId |
| 1105 | */ | 1109 | */ |
| 1106 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId | 1110 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId |
| 1107 | , String deviceNumber, int type) { | 1111 | , String deviceNumber, int type) { |
| 1108 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1112 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
| 1109 | false, true, null); | 1113 | false, true, null); |
| 1110 | HttpClient.getInstance().setTimeout(5 * 1000); | 1114 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1111 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1115 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1112 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId | 1116 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId |
| 1113 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { | 1117 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1114 | @Override | 1118 | @Override |
| 1115 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1119 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1116 | closeProgress(); | 1120 | closeProgress(); |
| 1117 | Log.e("test", "子账户信息" + new String(arg2)); | 1121 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1118 | try { | 1122 | try { |
| 1119 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1123 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1120 | int status = jsonObject.optInt("status"); | 1124 | int status = jsonObject.optInt("status"); |
| 1121 | if (status == 1) { | 1125 | if (status == 1) { |
| 1122 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1126 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
| 1123 | ((Activity) mContext).finish(); | 1127 | ((Activity) mContext).finish(); |
| 1124 | 1128 | ||
| 1125 | } else { | 1129 | } else { |
| 1126 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1130 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
| 1127 | 1131 | ||
| 1128 | } | 1132 | } |
| 1129 | } catch (JSONException e) { | 1133 | } catch (JSONException e) { |
| 1130 | e.printStackTrace(); | 1134 | e.printStackTrace(); |
| 1131 | } | 1135 | } |
| 1132 | 1136 | ||
| 1133 | } | 1137 | } |
| 1134 | 1138 | ||
| 1135 | @Override | 1139 | @Override |
| 1136 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1140 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1137 | closeProgress(); | 1141 | closeProgress(); |
| 1138 | Log.e("test", "错误信息" + new String(arg2)); | 1142 | Log.e("test", "错误信息" + new String(arg2)); |
| 1139 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1143 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1140 | } | 1144 | } |
| 1141 | }); | 1145 | }); |
| 1142 | 1146 | ||
| 1143 | } | 1147 | } |
| 1144 | 1148 | ||
| 1145 | /** | 1149 | /** |
| 1146 | * 切换主账户信息 | 1150 | * 切换主账户信息 |
| 1147 | * | 1151 | * |
| 1148 | * @param mContext | 1152 | * @param mContext |
| 1149 | * @param type | 1153 | * @param type |
| 1150 | */ | 1154 | */ |
| 1151 | public void Accountinfo(final Context mContext, long userId | 1155 | public void Accountinfo(final Context mContext, long userId |
| 1152 | , String deviceNumber, int type) { | 1156 | , String deviceNumber, int type) { |
| 1153 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", | 1157 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", |
| 1154 | false, true, null); | 1158 | false, true, null); |
| 1155 | HttpClient.getInstance().setTimeout(5 * 1000); | 1159 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1156 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1160 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1157 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber | 1161 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber |
| 1158 | + "&type=" + type, new AsyncHttpResponseHandler() { | 1162 | + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1159 | @Override | 1163 | @Override |
| 1160 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1164 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1161 | closeProgress(); | 1165 | closeProgress(); |
| 1162 | Log.e("test", "子账户信息" + new String(arg2)); | 1166 | Log.e("test", "子账户信息" + new String(arg2)); |
| 1163 | try { | 1167 | try { |
| 1164 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1168 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1165 | int status = jsonObject.optInt("status"); | 1169 | int status = jsonObject.optInt("status"); |
| 1166 | if (status == 1) { | 1170 | if (status == 1) { |
| 1167 | AlertUtils.showToast(mContext, "主账号切换成功!"); | 1171 | AlertUtils.showToast(mContext, "主账号切换成功!"); |
| 1168 | ((Activity) mContext).finish(); | 1172 | ((Activity) mContext).finish(); |
| 1169 | 1173 | ||
| 1170 | } else { | 1174 | } else { |
| 1171 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); | 1175 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); |
| 1172 | 1176 | ||
| 1173 | } | 1177 | } |
| 1174 | } catch (JSONException e) { | 1178 | } catch (JSONException e) { |
| 1175 | e.printStackTrace(); | 1179 | e.printStackTrace(); |
| 1176 | } | 1180 | } |
| 1177 | 1181 | ||
| 1178 | } | 1182 | } |
| 1179 | 1183 | ||
| 1180 | @Override | 1184 | @Override |
| 1181 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1185 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1182 | closeProgress(); | 1186 | closeProgress(); |
| 1183 | Log.e("test", "错误信息" + new String(arg2)); | 1187 | Log.e("test", "错误信息" + new String(arg2)); |
| 1184 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1188 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1185 | } | 1189 | } |
| 1186 | }); | 1190 | }); |
| 1187 | 1191 | ||
| 1188 | } | 1192 | } |
| 1189 | 1193 | ||
| 1190 | /** | 1194 | /** |
| 1191 | * 头像拍张 | 1195 | * 头像拍张 |
| 1192 | * | 1196 | * |
| 1193 | * @param mContext | 1197 | * @param mContext |
| 1194 | * @param userId | 1198 | * @param userId |
| 1195 | * @param img | 1199 | * @param img |
| 1196 | * @throws UnsupportedEncodingException | 1200 | * @throws UnsupportedEncodingException |
| 1197 | */ | 1201 | */ |
| 1198 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { | 1202 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { |
| 1199 | File file = new File(img); | 1203 | File file = new File(img); |
| 1200 | if (file.exists() && file.length() > 0) { | 1204 | if (file.exists() && file.length() > 0) { |
| 1201 | RequestParams params = new RequestParams(); | 1205 | RequestParams params = new RequestParams(); |
| 1202 | try { | 1206 | try { |
| 1203 | params.put("userId", userId); | 1207 | params.put("userId", userId); |
| 1204 | params.put("type", type); | 1208 | params.put("type", type); |
| 1205 | params.put("img", file); | 1209 | params.put("img", file); |
| 1206 | } catch (FileNotFoundException e) { | 1210 | } catch (FileNotFoundException e) { |
| 1207 | e.printStackTrace(); | 1211 | e.printStackTrace(); |
| 1208 | } | 1212 | } |
| 1209 | Log.e("test", "params" + params); | 1213 | Log.e("test", "params" + params); |
| 1210 | HttpClient.getInstance().setTimeout(5 * 1000); | 1214 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1211 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { | 1215 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { |
| 1212 | @Override | 1216 | @Override |
| 1213 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1217 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 1214 | Log.e("test", "onSuccess" + new String(bytes)); | 1218 | Log.e("test", "onSuccess" + new String(bytes)); |
| 1215 | try { | 1219 | try { |
| 1216 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1220 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 1217 | String status = jsonObject.optString("status"); | 1221 | String status = jsonObject.optString("status"); |
| 1218 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); | 1222 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); |
| 1219 | String imagUrl = jsonObject1.optString("imgUrl"); | 1223 | String imagUrl = jsonObject1.optString("imgUrl"); |
| 1220 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); | 1224 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); |
| 1221 | if (status.equals("1")) { | 1225 | if (status.equals("1")) { |
| 1222 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1226 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
| 1223 | } else { | 1227 | } else { |
| 1224 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1228 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 1225 | } | 1229 | } |
| 1226 | } catch (JSONException e) { | 1230 | } catch (JSONException e) { |
| 1227 | e.printStackTrace(); | 1231 | e.printStackTrace(); |
| 1228 | } | 1232 | } |
| 1229 | } | 1233 | } |
| 1230 | 1234 | ||
| 1231 | @Override | 1235 | @Override |
| 1232 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1236 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 1233 | closeProgress(); | 1237 | closeProgress(); |
| 1234 | Log.e("test", "错误信息" + new String(bytes)); | 1238 | Log.e("test", "错误信息" + new String(bytes)); |
| 1235 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1239 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1236 | 1240 | ||
| 1237 | } | 1241 | } |
| 1238 | }); | 1242 | }); |
| 1239 | } else { | 1243 | } else { |
| 1240 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 1244 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); |
| 1241 | } | 1245 | } |
| 1242 | } | 1246 | } |
| 1243 | 1247 | ||
| 1244 | /** | 1248 | /** |
| 1245 | * 头像默认 | 1249 | * 头像默认 |
| 1246 | * | 1250 | * |
| 1247 | * @param mContext | 1251 | * @param mContext |
| 1248 | * @param userId | 1252 | * @param userId |
| 1249 | * @param | 1253 | * @param |
| 1250 | * @throws UnsupportedEncodingException | 1254 | * @throws UnsupportedEncodingException |
| 1251 | */ | 1255 | */ |
| 1252 | public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { | 1256 | public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { |
| 1253 | RequestParams params = new RequestParams(); | 1257 | RequestParams params = new RequestParams(); |
| 1254 | params.put("userId", userId); | 1258 | params.put("userId", userId); |
| 1255 | params.put("type", type); | 1259 | params.put("type", type); |
| 1256 | params.put("defaultImg", defaultImg); | 1260 | params.put("defaultImg", defaultImg); |
| 1257 | Log.e("test", "params" + params); | 1261 | Log.e("test", "params" + params); |
| 1258 | HttpClient.getInstance().setTimeout(5 * 1000); | 1262 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1259 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { | 1263 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { |
| 1260 | @Override | 1264 | @Override |
| 1261 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1265 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 1262 | Log.e("test", "onSuccess" + new String(bytes)); | 1266 | Log.e("test", "onSuccess" + new String(bytes)); |
| 1263 | try { | 1267 | try { |
| 1264 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1268 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 1265 | String status = jsonObject.optString("status"); | 1269 | String status = jsonObject.optString("status"); |
| 1266 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); | 1270 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); |
| 1267 | String imagUrl = jsonObject1.optString("imgUrl"); | 1271 | String imagUrl = jsonObject1.optString("imgUrl"); |
| 1268 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); | 1272 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); |
| 1269 | if (status.equals("1")) { | 1273 | if (status.equals("1")) { |
| 1270 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1274 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
| 1271 | } else { | 1275 | } else { |
| 1272 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1276 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
| 1273 | } | 1277 | } |
| 1274 | } catch (JSONException e) { | 1278 | } catch (JSONException e) { |
| 1275 | e.printStackTrace(); | 1279 | e.printStackTrace(); |
| 1276 | } | 1280 | } |
| 1277 | } | 1281 | } |
| 1278 | 1282 | ||
| 1279 | @Override | 1283 | @Override |
| 1280 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1284 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 1281 | closeProgress(); | 1285 | closeProgress(); |
| 1282 | Log.e("test", "错误信息" + new String(bytes)); | 1286 | Log.e("test", "错误信息" + new String(bytes)); |
| 1283 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1287 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1284 | 1288 | ||
| 1285 | } | 1289 | } |
| 1286 | }); | 1290 | }); |
| 1287 | } | 1291 | } |
| 1288 | 1292 | ||
| 1289 | /** | 1293 | /** |
| 1290 | * 检查注册信息是否完整 | 1294 | * 检查注册信息是否完整 |
| 1291 | * | 1295 | * |
| 1292 | * @param mContext | 1296 | * @param mContext |
| 1293 | * @param userId | 1297 | * @param userId |
| 1294 | */ | 1298 | */ |
| 1295 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { | 1299 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { |
| 1296 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", | 1300 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", |
| 1297 | false, true, null); | 1301 | false, true, null); |
| 1298 | HttpClient.getInstance().setTimeout(5 * 1000); | 1302 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1299 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1303 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1300 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1304 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 1301 | @Override | 1305 | @Override |
| 1302 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1306 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1303 | closeProgress(); | 1307 | closeProgress(); |
| 1304 | Log.e("test", "注册信息" + new String(arg2)); | 1308 | Log.e("test", "注册信息" + new String(arg2)); |
| 1305 | Message msg = Message.obtain(); | 1309 | Message msg = Message.obtain(); |
| 1306 | msg.what = HttpCode.REGISTER_SUCESS; | 1310 | msg.what = HttpCode.REGISTER_SUCESS; |
| 1307 | msg.obj = new String(arg2); | 1311 | msg.obj = new String(arg2); |
| 1308 | handler.sendMessage(msg); | 1312 | handler.sendMessage(msg); |
| 1309 | 1313 | ||
| 1310 | } | 1314 | } |
| 1311 | 1315 | ||
| 1312 | @Override | 1316 | @Override |
| 1313 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1317 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1314 | closeProgress(); | 1318 | closeProgress(); |
| 1315 | // Log.e("test", "错误信息" + new String(arg2)); | 1319 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1316 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1320 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1317 | 1321 | ||
| 1318 | } | 1322 | } |
| 1319 | }); | 1323 | }); |
| 1320 | 1324 | ||
| 1321 | } | 1325 | } |
| 1322 | 1326 | ||
| 1323 | /** | 1327 | /** |
| 1324 | * 获取最近学习视频 | 1328 | * 获取最近学习视频 |
| 1325 | * | 1329 | * |
| 1326 | * @param mContext | 1330 | * @param mContext |
| 1327 | * @param userId | 1331 | * @param userId |
| 1328 | */ | 1332 | */ |
| 1329 | public void getstuyvidioinfo(final Context mContext, long userId, final Handler handler) { | 1333 | public void getstuyvidioinfo(final Context mContext, long userId, final Handler handler) { |
| 1330 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", | 1334 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", |
| 1331 | false, true, null); | 1335 | false, true, null); |
| 1332 | HttpClient.getInstance().setTimeout(5 * 1000); | 1336 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1333 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1337 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1334 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1338 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 1335 | @Override | 1339 | @Override |
| 1336 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1340 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1337 | closeProgress(); | 1341 | closeProgress(); |
| 1338 | Log.e("test", "近学习视频" + new String(arg2)); | 1342 | Log.e("test", "近学习视频" + new String(arg2)); |
| 1339 | try { | 1343 | try { |
| 1340 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1344 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1341 | int status = jsonObject.optInt("status"); | 1345 | int status = jsonObject.optInt("status"); |
| 1342 | if (status == 1) { | 1346 | if (status == 1) { |
| 1343 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 | 1347 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 |
| 1344 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); | 1348 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); |
| 1345 | Message msg = Message.obtain(); | 1349 | Message msg = Message.obtain(); |
| 1346 | msg.what = HttpCode.GETVIDIO_SUCESS; | 1350 | msg.what = HttpCode.GETVIDIO_SUCESS; |
| 1347 | msg.obj = schoolInfoBeanList; | 1351 | msg.obj = schoolInfoBeanList; |
| 1348 | handler.sendMessage(msg); | 1352 | handler.sendMessage(msg); |
| 1349 | 1353 | ||
| 1350 | } else { | 1354 | } else { |
| 1351 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 1355 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
| 1352 | 1356 | ||
| 1353 | } | 1357 | } |
| 1354 | } catch (JSONException e) { | 1358 | } catch (JSONException e) { |
| 1355 | e.printStackTrace(); | 1359 | e.printStackTrace(); |
| 1356 | 1360 | ||
| 1357 | } | 1361 | } |
| 1358 | 1362 | ||
| 1359 | } | 1363 | } |
| 1360 | 1364 | ||
| 1361 | @Override | 1365 | @Override |
| 1362 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1366 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1363 | closeProgress(); | 1367 | closeProgress(); |
| 1364 | // Log.e("test", "错误信息" + new String(arg2)); | 1368 | // Log.e("test", "错误信息" + new String(arg2)); |
| 1365 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1369 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1366 | 1370 | ||
| 1367 | } | 1371 | } |
| 1368 | }); | 1372 | }); |
| 1369 | 1373 | ||
| 1370 | } | 1374 | } |
| 1371 | 1375 | ||
| 1372 | 1376 | ||
| 1373 | /** | 1377 | /** |
| 1374 | * 系统升级 | 1378 | * 系统升级 |
| 1375 | * | 1379 | * |
| 1376 | * @param mContext | 1380 | * @param mContext |
| 1377 | * @param pid appName | 1381 | * @param pid appName |
| 1378 | */ | 1382 | */ |
| 1379 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1383 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
| 1380 | mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", | 1384 | mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", |
| 1381 | false, true, null); | 1385 | false, true, null); |
| 1382 | HttpClient.getInstance().setTimeout(5 * 1000); | 1386 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 1383 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1387 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1384 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1388 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
| 1385 | @Override | 1389 | @Override |
| 1386 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1390 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1387 | closeProgress(); | 1391 | closeProgress(); |
| 1388 | Log.e("test", "版本升级信息" + new String(arg2)); | 1392 | Log.e("test", "版本升级信息" + new String(arg2)); |
| 1389 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 | 1393 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 |
| 1390 | Message msg = Message.obtain(); | 1394 | Message msg = Message.obtain(); |
| 1391 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1395 | msg.what = HttpCode.APPUPDATE_SUCESS; |
| 1392 | msg.obj = appVersion; | 1396 | msg.obj = appVersion; |
| 1393 | handler.sendMessage(msg); | 1397 | handler.sendMessage(msg); |
| 1394 | 1398 | ||
| 1395 | 1399 | ||
| 1396 | } | 1400 | } |
| 1397 | 1401 | ||
| 1398 | @Override | 1402 | @Override |
| 1399 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1403 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1400 | closeProgress(); | 1404 | closeProgress(); |
| 1401 | Log.e("test", "错误信息" + new String(arg2)); | 1405 | Log.e("test", "错误信息" + new String(arg2)); |
| 1402 | } | 1406 | } |
| 1403 | }); | 1407 | }); |
| 1404 | 1408 | ||
| 1405 | } | 1409 | } |
| 1406 | 1410 | ||
| 1407 | //版本信息 | 1411 | //版本信息 |
| 1408 | public void versioninfo(final Context mContext, String subjectName, final Handler handler) { | 1412 | public void versioninfo(final Context mContext, String subjectName, final Handler handler) { |
| 1409 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1413 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1410 | HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { | 1414 | HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { |
| 1411 | @Override | 1415 | @Override |
| 1412 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1416 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1413 | Log.e("test", "版本信息" + new String(arg2)); | 1417 | Log.e("test", "版本信息" + new String(arg2)); |
| 1414 | try { | 1418 | try { |
| 1415 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1419 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1416 | int status = jsonObject.optInt("status"); | 1420 | int status = jsonObject.optInt("status"); |
| 1417 | if (status == 1) { | 1421 | if (status == 1) { |
| 1418 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 | 1422 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 |
| 1419 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); | 1423 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); |
| 1420 | Message message = Message.obtain(); | 1424 | Message message = Message.obtain(); |
| 1421 | message.what = HttpCode.VERSION_SUCESS; | 1425 | message.what = HttpCode.VERSION_SUCESS; |
| 1422 | message.obj = versionInfoList; | 1426 | message.obj = versionInfoList; |
| 1423 | handler.sendMessage(message); | 1427 | handler.sendMessage(message); |
| 1424 | 1428 | ||
| 1425 | } else if (status == 1000) { | 1429 | } else if (status == 1000) { |
| 1426 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); | 1430 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); |
| 1427 | 1431 | ||
| 1428 | } else { | 1432 | } else { |
| 1429 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1433 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1430 | } | 1434 | } |
| 1431 | } catch (JSONException e) { | 1435 | } catch (JSONException e) { |
| 1432 | e.printStackTrace(); | 1436 | e.printStackTrace(); |
| 1433 | } | 1437 | } |
| 1434 | 1438 | ||
| 1435 | 1439 | ||
| 1436 | } | 1440 | } |
| 1437 | 1441 | ||
| 1438 | @Override | 1442 | @Override |
| 1439 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1443 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1440 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1444 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1441 | } | 1445 | } |
| 1442 | }); | 1446 | }); |
| 1443 | } | 1447 | } |
| 1444 | 1448 | ||
| 1445 | 1449 | ||
| 1446 | ///省级接口 | 1450 | ///省级接口 |
| 1447 | public void provices(final Context mContext, final Handler handler) { | 1451 | public void provices(final Context mContext, final Handler handler) { |
| 1448 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1452 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1449 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1453 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
| 1450 | @Override | 1454 | @Override |
| 1451 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1455 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1452 | Log.e("test", "省" + new String(arg2)); | 1456 | Log.e("test", "省" + new String(arg2)); |
| 1453 | try { | 1457 | try { |
| 1454 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1458 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1455 | int status = jsonObject.optInt("status"); | 1459 | int status = jsonObject.optInt("status"); |
| 1456 | if (status == 100) { | 1460 | if (status == 100) { |
| 1457 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1461 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
| 1458 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1462 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
| 1459 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1463 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
| 1460 | Message message = Message.obtain(); | 1464 | Message message = Message.obtain(); |
| 1461 | message.what = HttpCode.PROVICES; | 1465 | message.what = HttpCode.PROVICES; |
| 1462 | message.obj = provincesBeanList; | 1466 | message.obj = provincesBeanList; |
| 1463 | handler.sendMessage(message); | 1467 | handler.sendMessage(message); |
| 1464 | 1468 | ||
| 1465 | 1469 | ||
| 1466 | } else { | 1470 | } else { |
| 1467 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1471 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1468 | 1472 | ||
| 1469 | } | 1473 | } |
| 1470 | } catch (JSONException e) { | 1474 | } catch (JSONException e) { |
| 1471 | e.printStackTrace(); | 1475 | e.printStackTrace(); |
| 1472 | } | 1476 | } |
| 1473 | 1477 | ||
| 1474 | 1478 | ||
| 1475 | } | 1479 | } |
| 1476 | 1480 | ||
| 1477 | @Override | 1481 | @Override |
| 1478 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1482 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1479 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1483 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1480 | } | 1484 | } |
| 1481 | }); | 1485 | }); |
| 1482 | } | 1486 | } |
| 1483 | 1487 | ||
| 1484 | //获取版本信息接口 | 1488 | //获取版本信息接口 |
| 1485 | public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { | 1489 | public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { |
| 1486 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1490 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1487 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { | 1491 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { |
| 1488 | @Override | 1492 | @Override |
| 1489 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1493 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1490 | Log.e("test", "获取版本信息接口" + new String(arg2)); | 1494 | Log.e("test", "获取版本信息接口" + new String(arg2)); |
| 1491 | try { | 1495 | try { |
| 1492 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1496 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1493 | int status = jsonObject.optInt("status"); | 1497 | int status = jsonObject.optInt("status"); |
| 1494 | if (status == 1) { | 1498 | if (status == 1) { |
| 1495 | Gson gson = new Gson(); | 1499 | Gson gson = new Gson(); |
| 1496 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); | 1500 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); |
| 1497 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); | 1501 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); |
| 1498 | Message message = Message.obtain(); | 1502 | Message message = Message.obtain(); |
| 1499 | message.what = HttpCode.PUBLISH_SUCESS; | 1503 | message.what = HttpCode.PUBLISH_SUCESS; |
| 1500 | message.obj = defautPublishInfoBeanList; | 1504 | message.obj = defautPublishInfoBeanList; |
| 1501 | handler.sendMessage(message); | 1505 | handler.sendMessage(message); |
| 1502 | 1506 | ||
| 1503 | } else { | 1507 | } else { |
| 1504 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1508 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1505 | 1509 | ||
| 1506 | } | 1510 | } |
| 1507 | } catch (JSONException e) { | 1511 | } catch (JSONException e) { |
| 1508 | e.printStackTrace(); | 1512 | e.printStackTrace(); |
| 1509 | } | 1513 | } |
| 1510 | 1514 | ||
| 1511 | 1515 | ||
| 1512 | } | 1516 | } |
| 1513 | 1517 | ||
| 1514 | @Override | 1518 | @Override |
| 1515 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1519 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1516 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1520 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1517 | } | 1521 | } |
| 1518 | }); | 1522 | }); |
| 1519 | } | 1523 | } |
| 1520 | 1524 | ||
| 1521 | 1525 | ||
| 1522 | //市级接口 | 1526 | //市级接口 |
| 1523 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1527 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
| 1524 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1528 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1525 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1529 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
| 1526 | @Override | 1530 | @Override |
| 1527 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1531 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1528 | Log.e("test", "市" + new String(arg2)); | 1532 | Log.e("test", "市" + new String(arg2)); |
| 1529 | try { | 1533 | try { |
| 1530 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1534 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1531 | int status = jsonObject.optInt("status"); | 1535 | int status = jsonObject.optInt("status"); |
| 1532 | if (status == 100) { | 1536 | if (status == 100) { |
| 1533 | Gson gson = new Gson(); | 1537 | Gson gson = new Gson(); |
| 1534 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1538 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
| 1535 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1539 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
| 1536 | Message message = Message.obtain(); | 1540 | Message message = Message.obtain(); |
| 1537 | message.what = HttpCode.CITYS; | 1541 | message.what = HttpCode.CITYS; |
| 1538 | message.obj = cityInfoBeanList; | 1542 | message.obj = cityInfoBeanList; |
| 1539 | handler.sendMessage(message); | 1543 | handler.sendMessage(message); |
| 1540 | 1544 | ||
| 1541 | } else { | 1545 | } else { |
| 1542 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1546 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1543 | 1547 | ||
| 1544 | } | 1548 | } |
| 1545 | } catch (JSONException e) { | 1549 | } catch (JSONException e) { |
| 1546 | e.printStackTrace(); | 1550 | e.printStackTrace(); |
| 1547 | } | 1551 | } |
| 1548 | 1552 | ||
| 1549 | 1553 | ||
| 1550 | } | 1554 | } |
| 1551 | 1555 | ||
| 1552 | @Override | 1556 | @Override |
| 1553 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1557 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1554 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1558 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1555 | } | 1559 | } |
| 1556 | }); | 1560 | }); |
| 1557 | } | 1561 | } |
| 1558 | 1562 | ||
| 1559 | //区县级接口 | 1563 | //区县级接口 |
| 1560 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1564 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
| 1561 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1565 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1562 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1566 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
| 1563 | @Override | 1567 | @Override |
| 1564 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1568 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1565 | Log.e("test", "区" + new String(arg2)); | 1569 | Log.e("test", "区" + new String(arg2)); |
| 1566 | try { | 1570 | try { |
| 1567 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1571 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
| 1568 | int status = jsonObject.optInt("status"); | 1572 | int status = jsonObject.optInt("status"); |
| 1569 | if (status == 100) { | 1573 | if (status == 100) { |
| 1570 | Gson gson = new Gson(); | 1574 | Gson gson = new Gson(); |
| 1571 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1575 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
| 1572 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1576 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
| 1573 | Message message = Message.obtain(); | 1577 | Message message = Message.obtain(); |
| 1574 | message.what = HttpCode.COUNTRY; | 1578 | message.what = HttpCode.COUNTRY; |
| 1575 | message.obj = countyInfoInfoBeanList; | 1579 | message.obj = countyInfoInfoBeanList; |
| 1576 | handler.sendMessage(message); | 1580 | handler.sendMessage(message); |
| 1577 | } else { | 1581 | } else { |
| 1578 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1582 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
| 1579 | 1583 | ||
| 1580 | } | 1584 | } |
| 1581 | } catch (JSONException e) { | 1585 | } catch (JSONException e) { |
| 1582 | e.printStackTrace(); | 1586 | e.printStackTrace(); |
| 1583 | } | 1587 | } |
| 1584 | 1588 | ||
| 1585 | 1589 | ||
| 1586 | } | 1590 | } |
| 1587 | 1591 | ||
| 1588 | @Override | 1592 | @Override |
| 1589 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1593 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1590 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1594 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
| 1591 | } | 1595 | } |
| 1592 | }); | 1596 | }); |
| 1593 | } | 1597 | } |
| 1594 | 1598 | ||
| 1595 | 1599 | ||
| 1596 | private void closeProgress() { | 1600 | private void closeProgress() { |
| 1597 | try { | 1601 | try { |
| 1598 | if (mProgress != null) { | 1602 | if (mProgress != null) { |
| 1599 | mProgress.dismiss(); | 1603 | mProgress.dismiss(); |
| 1600 | mProgress = null; | 1604 | mProgress = null; |
| 1601 | } | 1605 | } |
| 1602 | } catch (Exception e) { | 1606 | } catch (Exception e) { |
| 1603 | e.printStackTrace(); | 1607 | e.printStackTrace(); |
| 1604 | } | 1608 | } |
| 1605 | } | 1609 | } |
| 1606 | 1610 | ||
| 1607 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 1611 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| 1608 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 1612 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 1609 | 1613 | ||
| 1610 | HttpManager.getInstance().closeProgress(); | 1614 | HttpManager.getInstance().closeProgress(); |
| 1611 | } | 1615 | } |
| 1612 | 1616 | ||
| 1613 | return false; | 1617 | return false; |
| 1614 | 1618 | ||
| 1615 | } | 1619 | } |
| 1616 | 1620 | ||
| 1617 | } | 1621 | } |
| 1618 | 1622 |
PersonalCenter/app/src/main/res/layout/activity_changepsword.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 | 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:background="#ffffffff" | 5 | android:background="#ffffffff" |
| 6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 7 | 7 | ||
| 8 | <RelativeLayout | 8 | <RelativeLayout |
| 9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
| 10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
| 12 | android:background="@color/login_text_blue" | 12 | android:background="@color/login_text_blue" |
| 13 | android:minHeight="50dp"> | 13 | android:minHeight="50dp"> |
| 14 | 14 | ||
| 15 | <ImageView | 15 | <ImageView |
| 16 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
| 17 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
| 18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
| 19 | android:layout_centerVertical="true" | 19 | android:layout_centerVertical="true" |
| 20 | android:paddingLeft="20dp" | 20 | android:paddingLeft="20dp" |
| 21 | android:paddingRight="20dp" | 21 | android:paddingRight="20dp" |
| 22 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
| 23 | 23 | ||
| 24 | <TextView | 24 | <TextView |
| 25 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
| 26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
| 27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
| 28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
| 29 | android:text="@string/string_menu_title" | 29 | android:text="修改密码" |
| 30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
| 31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
| 32 | </RelativeLayout> | 32 | </RelativeLayout> |
| 33 | 33 | ||
| 34 | <RelativeLayout | 34 | <RelativeLayout |
| 35 | android:layout_width="match_parent" | 35 | android:layout_width="match_parent" |
| 36 | android:layout_height="match_parent" | 36 | android:layout_height="match_parent" |
| 37 | android:layout_below="@id/title" | 37 | android:layout_below="@id/title" |
| 38 | android:background="#ffffffff" | 38 | android:background="#ffffffff" |
| 39 | android:orientation="vertical" | 39 | android:orientation="vertical" |
| 40 | android:paddingLeft="250dp" | 40 | android:paddingLeft="250dp" |
| 41 | android:paddingRight="250dp"> | 41 | android:paddingRight="250dp"> |
| 42 | 42 | ||
| 43 | <RelativeLayout | 43 | <RelativeLayout |
| 44 | android:id="@+id/pwd_rl" | 44 | android:id="@+id/pwd_rl" |
| 45 | android:layout_width="match_parent" | 45 | android:layout_width="match_parent" |
| 46 | android:layout_height="wrap_content" | 46 | android:layout_height="wrap_content" |
| 47 | android:layout_marginTop="100dp"> | 47 | android:layout_marginTop="100dp"> |
| 48 | 48 | ||
| 49 | <EditText | 49 | <EditText |
| 50 | android:id="@+id/et_oldpassword" | 50 | android:id="@+id/et_oldpassword" |
| 51 | style="@style/login_register_edit_style" | 51 | style="@style/login_register_edit_style" |
| 52 | android:hint="输入原密码" | 52 | android:hint="输入原密码" |
| 53 | android:inputType="textPassword" /> | 53 | android:inputType="textPassword" /> |
| 54 | |||
| 55 | </RelativeLayout> | ||
| 56 | |||
| 57 | |||
| 58 | <TextView | ||
| 59 | android:id="@+id/oldpassword_error_hint" | ||
| 60 | style="@style/registererrhint_style" | ||
| 61 | android:layout_below="@id/pwd_rl" /> | ||
| 62 | <RelativeLayout | ||
| 63 | android:id="@+id/et_newpassworda" | ||
| 64 | android:layout_width="match_parent" | ||
| 65 | android:layout_below="@id/pwd_rl" | ||
| 66 | android:layout_marginTop="30dp" | ||
| 67 | android:layout_height="wrap_content"> | ||
| 68 | <EditText | ||
| 69 | android:id="@+id/et_newpassword" | ||
| 70 | style="@style/login_register_edit_style" | ||
| 71 | android:hint="密码为英文和数字组成,最少8位" | ||
| 72 | android:inputType="textPassword" /> | ||
| 54 | <ImageView | 73 | <ImageView |
| 55 | android:id="@+id/iv_pwd_change" | 74 | android:id="@+id/iv_pwd_change" |
| 56 | android:padding="10dp" | 75 | android:padding="10dp" |
| 57 | android:layout_marginRight="10dp" | ||
| 58 | android:layout_marginLeft="10dp" | ||
| 59 | android:layout_width="40dp" | 76 | android:layout_width="40dp" |
| 77 | android:layout_marginRight="10dp" | ||
| 60 | android:layout_height="wrap_content" | 78 | android:layout_height="wrap_content" |
| 61 | android:layout_alignParentRight="true" | 79 | android:layout_alignParentRight="true" |
| 62 | android:layout_centerVertical="true" | 80 | android:layout_centerVertical="true" |
| 63 | android:src="@mipmap/pwd_hide" /> | 81 | android:src="@mipmap/pwd_hide" /> |
| 82 | |||
| 64 | </RelativeLayout> | 83 | </RelativeLayout> |
| 65 | 84 | ||
| 66 | <TextView | ||
| 67 | android:id="@+id/oldpassword_error_hint" | ||
| 68 | style="@style/registererrhint_style" | ||
| 69 | android:layout_below="@id/pwd_rl" /> | ||
| 70 | 85 | ||
| 71 | <EditText | ||
| 72 | android:id="@+id/et_newpassword" | ||
| 73 | style="@style/login_register_edit_style" | ||
| 74 | android:layout_below="@id/pwd_rl" | ||
| 75 | android:layout_marginTop="30dp" | ||
| 76 | android:hint="密码为英文和数字组成,最少8位" | ||
| 77 | android:inputType="textPassword" /> | ||
| 78 | 86 | ||
| 79 | <TextView | 87 | <TextView |
| 80 | android:id="@+id/newpassword_error_hint" | 88 | android:id="@+id/newpassword_error_hint" |
| 81 | style="@style/registererrhint_style" | 89 | style="@style/registererrhint_style" |
| 82 | android:layout_below="@id/et_newpassword" /> | 90 | android:layout_below="@id/et_newpassworda" /> |
| 83 | 91 | ||
| 84 | <EditText | 92 | <EditText |
| 85 | android:id="@+id/et_again_newpassword" | 93 | android:id="@+id/et_again_newpassword" |
| 86 | style="@style/login_register_edit_style" | 94 | style="@style/login_register_edit_style" |
| 87 | android:layout_below="@id/et_newpassword" | 95 | android:layout_below="@id/et_newpassworda" |
| 88 | android:layout_marginTop="30dp" | 96 | android:layout_marginTop="30dp" |
| 89 | android:hint="再次输入新密码" | 97 | android:hint="再次输入新密码" |
| 90 | android:inputType="textPassword" /> | 98 | android:inputType="textPassword" /> |
| 91 | 99 | ||
| 92 | <TextView | 100 | <TextView |
PersonalCenter/app/src/main/res/layout/activity_main.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
| 4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
| 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 7 | 7 | ||
| 8 | <RelativeLayout | 8 | <RelativeLayout |
| 9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
| 10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 11 | android:layout_height="50dp" | 11 | android:layout_height="50dp" |
| 12 | android:background="@color/login_text_blue"> | 12 | android:background="@color/login_text_blue"> |
| 13 | 13 | ||
| 14 | <ImageView | 14 | <ImageView |
| 15 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
| 16 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
| 17 | android:layout_height="match_parent" | 17 | android:layout_height="match_parent" |
| 18 | android:paddingLeft="20dp" | 18 | android:paddingLeft="20dp" |
| 19 | android:paddingRight="20dp" | 19 | android:paddingRight="20dp" |
| 20 | android:visibility="gone" | 20 | android:visibility="gone" |
| 21 | android:src="@mipmap/title_back" /> | 21 | android:src="@mipmap/title_back" /> |
| 22 | 22 | ||
| 23 | <TextView | 23 | <TextView |
| 24 | android:id="@+id/menu_title" | 24 | android:id="@+id/menu_title" |
| 25 | android:layout_width="wrap_content" | 25 | android:layout_width="wrap_content" |
| 26 | android:layout_height="match_parent" | 26 | android:layout_height="match_parent" |
| 27 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
| 28 | android:gravity="center_vertical" | 28 | android:gravity="center_vertical" |
| 29 | android:text="@string/titel_preson" | 29 | android:text="@string/titel_preson" |
| 30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
| 31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
| 32 | 32 | ||
| 33 | <ImageView | 33 | <ImageView |
| 34 | android:id="@+id/iv_setting" | 34 | android:id="@+id/iv_setting" |
| 35 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
| 36 | android:layout_height="match_parent" | 36 | android:layout_height="match_parent" |
| 37 | android:layout_marginRight="10dp" | 37 | android:layout_marginRight="10dp" |
| 38 | android:layout_toLeftOf="@+id/iv_skin" | 38 | android:layout_toLeftOf="@+id/iv_skin" |
| 39 | android:gravity="center_vertical" | 39 | android:gravity="center_vertical" |
| 40 | android:padding="10dp" | 40 | android:padding="10dp" |
| 41 | android:src="@mipmap/shezhi" | 41 | android:src="@mipmap/shezhi" |
| 42 | android:textColor="@android:color/white" | 42 | android:textColor="@android:color/white" |
| 43 | android:textSize="22sp" /> | 43 | android:textSize="22sp" /> |
| 44 | 44 | ||
| 45 | <ImageView | 45 | <ImageView |
| 46 | android:id="@+id/iv_skin" | 46 | android:id="@+id/iv_skin" |
| 47 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
| 48 | android:layout_height="match_parent" | 48 | android:layout_height="match_parent" |
| 49 | android:layout_marginRight="10dp" | 49 | android:layout_marginRight="10dp" |
| 50 | android:layout_toLeftOf="@+id/iv_imformatioan" | 50 | android:layout_toLeftOf="@+id/iv_imformatioan" |
| 51 | android:gravity="center_vertical" | 51 | android:gravity="center_vertical" |
| 52 | android:padding="10dp" | 52 | android:padding="10dp" |
| 53 | android:src="@mipmap/pifu" | 53 | android:src="@mipmap/pifu" |
| 54 | android:textColor="@android:color/white" | 54 | android:textColor="@android:color/white" |
| 55 | android:textSize="22sp" /> | 55 | android:textSize="22sp" /> |
| 56 | 56 | ||
| 57 | <ImageView | 57 | <ImageView |
| 58 | android:id="@+id/iv_imformatioan" | 58 | android:id="@+id/iv_imformatioan" |
| 59 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
| 60 | android:layout_height="match_parent" | 60 | android:layout_height="match_parent" |
| 61 | android:layout_alignParentRight="true" | 61 | android:layout_alignParentRight="true" |
| 62 | android:layout_marginRight="10dp" | 62 | android:layout_marginRight="10dp" |
| 63 | android:gravity="center_vertical" | 63 | android:gravity="center_vertical" |
| 64 | android:padding="10dp" | 64 | android:padding="10dp" |
| 65 | android:src="@mipmap/fankui" | 65 | android:src="@mipmap/fankui" |
| 66 | android:textColor="@android:color/white" | 66 | android:textColor="@android:color/white" |
| 67 | android:textSize="22sp" /> | 67 | android:textSize="22sp" /> |
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | </RelativeLayout> | 70 | </RelativeLayout> |
| 71 | 71 | ||
| 72 | <LinearLayout | 72 | <LinearLayout |
| 73 | android:layout_width="match_parent" | 73 | android:layout_width="match_parent" |
| 74 | android:layout_height="match_parent"> | 74 | android:layout_height="match_parent"> |
| 75 | 75 | ||
| 76 | <LinearLayout | 76 | <LinearLayout |
| 77 | android:layout_width="0dp" | 77 | android:layout_width="0dp" |
| 78 | android:layout_height="match_parent" | 78 | android:layout_height="match_parent" |
| 79 | android:layout_weight="1" | 79 | android:layout_weight="1" |
| 80 | android:orientation="vertical"> | 80 | android:orientation="vertical"> |
| 81 | 81 | ||
| 82 | <LinearLayout | 82 | <LinearLayout |
| 83 | android:layout_width="match_parent" | 83 | android:layout_width="match_parent" |
| 84 | android:layout_height="wrap_content" | 84 | android:layout_height="wrap_content" |
| 85 | android:layout_marginTop="20dp" | 85 | android:layout_marginTop="20dp" |
| 86 | android:orientation="horizontal"> | 86 | android:orientation="horizontal"> |
| 87 | <ImageView | 87 | <ImageView |
| 88 | android:id="@+id/iv_look_card" | 88 | android:id="@+id/iv_look_card" |
| 89 | android:layout_width="wrap_content" | 89 | android:layout_width="wrap_content" |
| 90 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
| 91 | android:padding="10dp" | 91 | android:padding="10dp" |
| 92 | android:layout_marginLeft="20dp" | 92 | android:layout_marginLeft="20dp" |
| 93 | android:src="@mipmap/card_icoc" /> | 93 | android:src="@mipmap/card_icoc" /> |
| 94 | <com.facebook.drawee.view.SimpleDraweeView | 94 | <com.facebook.drawee.view.SimpleDraweeView |
| 95 | android:id="@+id/iv_head" | 95 | android:id="@+id/iv_head" |
| 96 | android:layout_width="60dp" | 96 | android:layout_width="60dp" |
| 97 | android:layout_height="60dp" | 97 | android:layout_height="60dp" |
| 98 | android:layout_marginLeft="60dp" | 98 | android:layout_marginLeft="60dp" |
| 99 | android:layout_gravity="center" | 99 | android:layout_gravity="center" |
| 100 | fresco:placeholderImage="@mipmap/header_default" | 100 | fresco:placeholderImage="@mipmap/header_default" |
| 101 | fresco:roundAsCircle="true" | 101 | fresco:roundAsCircle="true" |
| 102 | fresco:placeholderImageScaleType="fitCenter" /> | 102 | fresco:placeholderImageScaleType="fitCenter" /> |
| 103 | 103 | ||
| 104 | <TextView | 104 | <TextView |
| 105 | android:layout_width="wrap_content" | 105 | android:layout_width="wrap_content" |
| 106 | android:layout_height="wrap_content" | 106 | android:layout_height="wrap_content" |
| 107 | android:layout_marginLeft="18dp" | 107 | android:layout_marginLeft="18dp" |
| 108 | android:layout_marginTop="20dp" | 108 | android:layout_marginTop="20dp" |
| 109 | android:background="@drawable/corcle_blue_bg" | 109 | android:background="@drawable/corcle_blue_bg" |
| 110 | android:paddingLeft="5dp" | 110 | android:paddingLeft="5dp" |
| 111 | android:paddingRight="5dp" | 111 | android:paddingRight="5dp" |
| 112 | android:gravity="center_vertical" | 112 | android:gravity="center_vertical" |
| 113 | android:text="签到" | 113 | android:text="签到" |
| 114 | android:textColor="@color/login_text_blue" | 114 | android:textColor="@color/login_text_blue" |
| 115 | android:textSize="18sp" /> | 115 | android:textSize="18sp" /> |
| 116 | 116 | ||
| 117 | </LinearLayout> | 117 | </LinearLayout> |
| 118 | 118 | ||
| 119 | <LinearLayout | 119 | <LinearLayout |
| 120 | android:layout_width="match_parent" | 120 | android:layout_width="match_parent" |
| 121 | android:layout_height="wrap_content" | 121 | android:layout_height="wrap_content" |
| 122 | android:layout_marginLeft="20dp" | 122 | android:layout_marginLeft="20dp" |
| 123 | android:layout_marginTop="20dp" | 123 | android:layout_marginTop="20dp" |
| 124 | android:orientation="horizontal"> | 124 | android:orientation="horizontal"> |
| 125 | 125 | ||
| 126 | <TextView | 126 | <TextView |
| 127 | android:id="@+id/tv_username" | 127 | android:id="@+id/tv_username" |
| 128 | android:layout_width="wrap_content" | 128 | android:layout_width="wrap_content" |
| 129 | android:layout_height="wrap_content" | 129 | android:layout_height="wrap_content" |
| 130 | android:text="" | 130 | android:text="" |
| 131 | android:textSize="20dp" /> | 131 | android:textSize="20dp" /> |
| 132 | <TextView | 132 | <TextView |
| 133 | android:id="@+id/tv_yangji" | 133 | android:id="@+id/tv_yangji" |
| 134 | android:layout_marginLeft="5dp" | 134 | android:layout_marginLeft="5dp" |
| 135 | android:layout_width="wrap_content" | 135 | android:layout_width="wrap_content" |
| 136 | android:layout_height="wrap_content" | 136 | android:layout_height="wrap_content" |
| 137 | android:text="(样机)" | 137 | android:text="(样机)" |
| 138 | android:textSize="20dp" | 138 | android:textSize="20dp" |
| 139 | android:visibility="gone"/> | 139 | android:visibility="gone"/> |
| 140 | 140 | ||
| 141 | <ImageView | 141 | <ImageView |
| 142 | android:id="@+id/iv_sex" | 142 | android:id="@+id/iv_sex" |
| 143 | android:layout_width="wrap_content" | 143 | android:layout_width="wrap_content" |
| 144 | android:layout_height="wrap_content" | 144 | android:layout_height="wrap_content" |
| 145 | android:layout_gravity="center_vertical" | 145 | android:layout_gravity="center_vertical" |
| 146 | android:layout_marginLeft="50dp" | 146 | android:layout_marginLeft="50dp" |
| 147 | android:src="@mipmap/men" /> | 147 | android:src="@mipmap/men" /> |
| 148 | 148 | ||
| 149 | </LinearLayout> | 149 | </LinearLayout> |
| 150 | 150 | ||
| 151 | <LinearLayout | 151 | <LinearLayout |
| 152 | android:layout_width="match_parent" | 152 | android:layout_width="match_parent" |
| 153 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
| 154 | android:layout_marginLeft="20dp" | 154 | android:layout_marginLeft="20dp" |
| 155 | android:layout_marginTop="20dp" | 155 | android:layout_marginTop="20dp" |
| 156 | android:gravity="center" | 156 | android:gravity="center" |
| 157 | android:orientation="horizontal"> | 157 | android:orientation="horizontal"> |
| 158 | 158 | ||
| 159 | <TextView | 159 | <TextView |
| 160 | android:id="@+id/tv_sign" | 160 | android:id="@+id/tv_sign" |
| 161 | android:layout_width="0dp" | 161 | android:layout_width="0dp" |
| 162 | android:layout_height="wrap_content" | 162 | android:layout_height="wrap_content" |
| 163 | android:layout_weight="5" | 163 | android:layout_weight="5" |
| 164 | android:hint="请输入个性签名" | 164 | android:hint="请输入个性签名" |
| 165 | android:maxLines="3" | 165 | android:maxLines="3" |
| 166 | android:ellipsize="end" | 166 | android:ellipsize="end" |
| 167 | android:textSize="18sp" /> | 167 | android:textSize="18sp" /> |
| 168 | 168 | ||
| 169 | <ImageView | 169 | <ImageView |
| 170 | android:id="@+id/iv_sign" | 170 | android:id="@+id/iv_sign" |
| 171 | android:layout_width="0dp" | 171 | android:layout_width="0dp" |
| 172 | android:layout_height="wrap_content" | 172 | android:layout_height="wrap_content" |
| 173 | android:layout_weight="1" | 173 | android:layout_weight="1" |
| 174 | android:padding="10dp" | 174 | android:padding="10dp" |
| 175 | android:src="@mipmap/pencil" /> | 175 | android:src="@mipmap/pencil" /> |
| 176 | 176 | ||
| 177 | 177 | ||
| 178 | </LinearLayout> | 178 | </LinearLayout> |
| 179 | 179 | ||
| 180 | <View | 180 | <View |
| 181 | android:layout_width="match_parent" | 181 | android:layout_width="match_parent" |
| 182 | android:layout_height="0.7dp" | 182 | android:layout_height="0.7dp" |
| 183 | android:layout_marginTop="20dp" | 183 | android:layout_marginTop="20dp" |
| 184 | android:background="@color/cutoff_line"> | 184 | android:background="@color/cutoff_line"> |
| 185 | 185 | ||
| 186 | </View> | 186 | </View> |
| 187 | 187 | ||
| 188 | <LinearLayout | 188 | <LinearLayout |
| 189 | android:id="@+id/linel_mycuoti" | 189 | android:id="@+id/linel_mycuoti" |
| 190 | android:layout_width="match_parent" | 190 | android:layout_width="match_parent" |
| 191 | android:layout_height="wrap_content" | 191 | android:layout_height="wrap_content" |
| 192 | android:layout_marginTop="30dp" | 192 | android:layout_marginTop="30dp" |
| 193 | android:orientation="vertical"> | 193 | android:orientation="vertical"> |
| 194 | 194 | ||
| 195 | <LinearLayout | 195 | <LinearLayout |
| 196 | android:layout_width="match_parent" | 196 | android:layout_width="match_parent" |
| 197 | android:layout_height="wrap_content" | 197 | android:layout_height="wrap_content" |
| 198 | android:gravity="center_vertical" | 198 | android:gravity="center_vertical" |
| 199 | android:orientation="horizontal"> | 199 | android:orientation="horizontal"> |
| 200 | 200 | ||
| 201 | <ImageView | 201 | <ImageView |
| 202 | android:layout_width="0dp" | 202 | android:layout_width="0dp" |
| 203 | android:layout_height="wrap_content" | 203 | android:layout_height="wrap_content" |
| 204 | android:layout_weight="1" | 204 | android:layout_weight="1" |
| 205 | android:src="@mipmap/wodecuoti" /> | 205 | android:src="@mipmap/wodecuoti" /> |
| 206 | 206 | ||
| 207 | <TextView | 207 | <TextView |
| 208 | android:layout_width="0dp" | 208 | android:layout_width="0dp" |
| 209 | android:layout_height="wrap_content" | 209 | android:layout_height="wrap_content" |
| 210 | android:layout_weight="5" | 210 | android:layout_weight="5" |
| 211 | android:text="我的错题" | 211 | android:text="我的错题" |
| 212 | android:textSize="20sp" /> | 212 | android:textSize="20sp" /> |
| 213 | 213 | ||
| 214 | <ImageView | 214 | <ImageView |
| 215 | android:layout_width="0dp" | 215 | android:layout_width="0dp" |
| 216 | android:layout_height="wrap_content" | 216 | android:layout_height="wrap_content" |
| 217 | android:layout_weight="1" | 217 | android:layout_weight="1" |
| 218 | android:src="@mipmap/youjiantou" /> | 218 | android:src="@mipmap/youjiantou" /> |
| 219 | 219 | ||
| 220 | </LinearLayout> | 220 | </LinearLayout> |
| 221 | 221 | ||
| 222 | <LinearLayout | 222 | <LinearLayout |
| 223 | android:id="@+id/linel_mynote" | 223 | android:id="@+id/linel_mynote" |
| 224 | android:layout_width="match_parent" | 224 | android:layout_width="match_parent" |
| 225 | android:layout_height="wrap_content" | 225 | android:layout_height="wrap_content" |
| 226 | android:layout_marginTop="35dp" | 226 | android:layout_marginTop="35dp" |
| 227 | android:gravity="center_vertical" | 227 | android:gravity="center_vertical" |
| 228 | android:orientation="horizontal"> | 228 | android:orientation="horizontal"> |
| 229 | 229 | ||
| 230 | <ImageView | 230 | <ImageView |
| 231 | android:layout_width="0dp" | 231 | android:layout_width="0dp" |
| 232 | android:layout_height="wrap_content" | 232 | android:layout_height="wrap_content" |
| 233 | android:layout_weight="1" | 233 | android:layout_weight="1" |
| 234 | android:src="@mipmap/wodebiji" /> | 234 | android:src="@mipmap/wodebiji" /> |
| 235 | 235 | ||
| 236 | <TextView | 236 | <TextView |
| 237 | android:layout_width="0dp" | 237 | android:layout_width="0dp" |
| 238 | android:layout_height="wrap_content" | 238 | android:layout_height="wrap_content" |
| 239 | android:layout_weight="5" | 239 | android:layout_weight="5" |
| 240 | android:text="我的笔记" | 240 | android:text="我的笔记" |
| 241 | android:textSize="20sp" /> | 241 | android:textSize="20sp" /> |
| 242 | 242 | ||
| 243 | <ImageView | 243 | <ImageView |
| 244 | android:layout_width="0dp" | 244 | android:layout_width="0dp" |
| 245 | android:layout_height="wrap_content" | 245 | android:layout_height="wrap_content" |
| 246 | android:layout_weight="1" | 246 | android:layout_weight="1" |
| 247 | android:src="@mipmap/youjiantou" /> | 247 | android:src="@mipmap/youjiantou" /> |
| 248 | 248 | ||
| 249 | </LinearLayout> | 249 | </LinearLayout> |
| 250 | 250 | ||
| 251 | <LinearLayout | 251 | <LinearLayout |
| 252 | android:id="@+id/linel_mycollege" | 252 | android:id="@+id/linel_mycollege" |
| 253 | android:layout_width="match_parent" | 253 | android:layout_width="match_parent" |
| 254 | android:layout_height="wrap_content" | 254 | android:layout_height="wrap_content" |
| 255 | android:layout_marginTop="35dp" | 255 | android:layout_marginTop="35dp" |
| 256 | android:gravity="center_vertical" | 256 | android:gravity="center_vertical" |
| 257 | android:orientation="horizontal"> | 257 | android:orientation="horizontal"> |
| 258 | 258 | ||
| 259 | <ImageView | 259 | <ImageView |
| 260 | android:layout_width="0dp" | 260 | android:layout_width="0dp" |
| 261 | android:layout_height="wrap_content" | 261 | android:layout_height="wrap_content" |
| 262 | android:layout_weight="1" | 262 | android:layout_weight="1" |
| 263 | android:src="@mipmap/wodeshoucang" /> | 263 | android:src="@mipmap/wodeshoucang" /> |
| 264 | 264 | ||
| 265 | <TextView | 265 | <TextView |
| 266 | android:layout_width="0dp" | 266 | android:layout_width="0dp" |
| 267 | android:layout_height="wrap_content" | 267 | android:layout_height="wrap_content" |
| 268 | android:layout_weight="5" | 268 | android:layout_weight="5" |
| 269 | android:text="我的收藏" | 269 | android:text="我的收藏" |
| 270 | android:textSize="20sp" /> | 270 | android:textSize="20sp" /> |
| 271 | 271 | ||
| 272 | <ImageView | 272 | <ImageView |
| 273 | android:layout_width="0dp" | 273 | android:layout_width="0dp" |
| 274 | android:layout_height="wrap_content" | 274 | android:layout_height="wrap_content" |
| 275 | android:layout_weight="1" | 275 | android:layout_weight="1" |
| 276 | android:src="@mipmap/youjiantou" /> | 276 | android:src="@mipmap/youjiantou" /> |
| 277 | 277 | ||
| 278 | </LinearLayout> | 278 | </LinearLayout> |
| 279 | 279 | ||
| 280 | <LinearLayout | 280 | <LinearLayout |
| 281 | android:id="@+id/linel_myclass" | 281 | android:id="@+id/linel_myclass" |
| 282 | android:layout_width="match_parent" | 282 | android:layout_width="match_parent" |
| 283 | android:layout_height="wrap_content" | 283 | android:layout_height="wrap_content" |
| 284 | android:layout_marginTop="35dp" | 284 | android:layout_marginTop="35dp" |
| 285 | android:gravity="center_vertical" | 285 | android:gravity="center_vertical" |
| 286 | android:orientation="horizontal"> | 286 | android:orientation="horizontal"> |
| 287 | 287 | ||
| 288 | <ImageView | 288 | <ImageView |
| 289 | android:layout_width="0dp" | 289 | android:layout_width="0dp" |
| 290 | android:layout_height="wrap_content" | 290 | android:layout_height="wrap_content" |
| 291 | android:layout_weight="1" | 291 | android:layout_weight="1" |
| 292 | android:src="@mipmap/wodebanji" /> | 292 | android:src="@mipmap/wodebanji" /> |
| 293 | 293 | ||
| 294 | <TextView | 294 | <TextView |
| 295 | android:layout_width="0dp" | 295 | android:layout_width="0dp" |
| 296 | android:layout_height="wrap_content" | 296 | android:layout_height="wrap_content" |
| 297 | android:layout_weight="5" | 297 | android:layout_weight="5" |
| 298 | android:text="我的班级" | 298 | android:text="我的班级" |
| 299 | android:textSize="20sp" /> | 299 | android:textSize="20sp" /> |
| 300 | 300 | ||
| 301 | <ImageView | 301 | <ImageView |
| 302 | android:layout_width="0dp" | 302 | android:layout_width="0dp" |
| 303 | android:layout_height="wrap_content" | 303 | android:layout_height="wrap_content" |
| 304 | android:layout_weight="1" | 304 | android:layout_weight="1" |
| 305 | android:src="@mipmap/youjiantou" /> | 305 | android:src="@mipmap/youjiantou" /> |
| 306 | 306 | ||
| 307 | </LinearLayout> | 307 | </LinearLayout> |
| 308 | 308 | ||
| 309 | 309 | ||
| 310 | </LinearLayout> | 310 | </LinearLayout> |
| 311 | 311 | ||
| 312 | <LinearLayout | 312 | <LinearLayout |
| 313 | android:layout_width="match_parent" | 313 | android:layout_width="match_parent" |
| 314 | android:layout_height="match_parent" | 314 | android:layout_height="match_parent" |
| 315 | android:layout_marginTop="120dp" | 315 | android:layout_marginTop="120dp" |
| 316 | android:background="@mipmap/xiaoguanggao"> | 316 | android:background="@mipmap/xiaoguanggao"> |
| 317 | 317 | ||
| 318 | </LinearLayout> | 318 | </LinearLayout> |
| 319 | 319 | ||
| 320 | 320 | ||
| 321 | </LinearLayout> | 321 | </LinearLayout> |
| 322 | 322 | ||
| 323 | 323 | ||
| 324 | <View | 324 | <View |
| 325 | android:layout_width="0.7dp" | 325 | android:layout_width="0.7dp" |
| 326 | android:layout_height="match_parent" | 326 | android:layout_height="match_parent" |
| 327 | android:background="@color/cutoff_line"> | 327 | android:background="@color/cutoff_line"> |
| 328 | 328 | ||
| 329 | </View> | 329 | </View> |
| 330 | 330 | ||
| 331 | <LinearLayout | 331 | <LinearLayout |
| 332 | android:layout_width="0dp" | 332 | android:layout_width="0dp" |
| 333 | android:layout_height="match_parent" | 333 | android:layout_height="match_parent" |
| 334 | android:layout_weight="2.5" | 334 | android:layout_weight="2.5" |
| 335 | android:orientation="vertical"> | 335 | android:orientation="vertical"> |
| 336 | 336 | ||
| 337 | <LinearLayout | 337 | <LinearLayout |
| 338 | android:layout_width="match_parent" | 338 | android:layout_width="match_parent" |
| 339 | android:layout_height="wrap_content" | 339 | android:layout_height="wrap_content" |
| 340 | android:layout_margin="20dp" | 340 | android:layout_margin="20dp" |
| 341 | android:gravity="center_vertical" | 341 | android:gravity="center_vertical" |
| 342 | android:orientation="horizontal"> | 342 | android:orientation="horizontal"> |
| 343 | 343 | ||
| 344 | <View | 344 | <View |
| 345 | android:layout_width="5dp" | 345 | android:layout_width="5dp" |
| 346 | android:layout_height="20dp" | 346 | android:layout_height="20dp" |
| 347 | android:background="@color/login_text_blue"> | 347 | android:background="@color/login_text_blue"> |
| 348 | 348 | ||
| 349 | </View> | 349 | </View> |
| 350 | 350 | ||
| 351 | <TextView | 351 | <TextView |
| 352 | android:layout_width="wrap_content" | 352 | android:layout_width="wrap_content" |
| 353 | android:layout_height="wrap_content" | 353 | android:layout_height="wrap_content" |
| 354 | android:layout_marginLeft="5dp" | 354 | android:layout_marginLeft="5dp" |
| 355 | android:text="最近学习" | 355 | android:text="最近学习" |
| 356 | android:textSize="22sp" /> | 356 | android:textSize="22sp" /> |
| 357 | 357 | ||
| 358 | </LinearLayout> | 358 | </LinearLayout> |
| 359 | 359 | ||
| 360 | <LinearLayout | 360 | <LinearLayout |
| 361 | android:layout_width="wrap_content" | 361 | android:layout_width="wrap_content" |
| 362 | android:layout_height="wrap_content"> | 362 | android:layout_height="wrap_content"> |
| 363 | 363 | ||
| 364 | <android.support.v7.widget.RecyclerView | 364 | <android.support.v7.widget.RecyclerView |
| 365 | android:id="@+id/id_recyclerview_horizontal" | 365 | android:id="@+id/id_recyclerview_horizontal" |
| 366 | android:layout_width="wrap_content" | 366 | android:layout_width="wrap_content" |
| 367 | android:layout_height="wrap_content" | 367 | android:layout_height="wrap_content" |
| 368 | android:layout_centerVertical="true" | 368 | android:layout_centerVertical="true" |
| 369 | android:scrollbars="none" /> | 369 | android:scrollbars="none" /> |
| 370 | </LinearLayout> | 370 | </LinearLayout> |
| 371 | 371 | ||
| 372 | <View | 372 | <View |
| 373 | android:layout_width="match_parent" | 373 | android:layout_width="match_parent" |
| 374 | android:layout_height="0.7dp" | 374 | android:layout_height="0.7dp" |
| 375 | android:layout_marginTop="10dp" | 375 | android:layout_marginTop="10dp" |
| 376 | android:background="@color/cutoff_line"> | 376 | android:background="@color/cutoff_line"> |
| 377 | 377 | ||
| 378 | </View> | 378 | </View> |
| 379 | 379 | ||
| 380 | <LinearLayout | 380 | <LinearLayout |
| 381 | android:layout_width="match_parent" | 381 | android:layout_width="match_parent" |
| 382 | android:layout_height="wrap_content" | 382 | android:layout_height="wrap_content" |
| 383 | android:layout_margin="10dp" | 383 | android:layout_margin="10dp" |
| 384 | android:gravity="center_vertical" | 384 | android:gravity="center_vertical" |
| 385 | android:orientation="horizontal"> | 385 | android:orientation="horizontal"> |
| 386 | 386 | ||
| 387 | <View | 387 | <View |
| 388 | android:layout_width="5dp" | 388 | android:layout_width="5dp" |
| 389 | android:layout_height="20dp" | 389 | android:layout_height="20dp" |
| 390 | android:background="@color/login_text_blue"> | 390 | android:background="@color/login_text_blue"> |
| 391 | 391 | ||
| 392 | </View> | 392 | </View> |
| 393 | 393 | ||
| 394 | <TextView | 394 | <TextView |
| 395 | android:layout_width="0dp" | 395 | android:layout_width="0dp" |
| 396 | android:layout_height="wrap_content" | 396 | android:layout_height="wrap_content" |
| 397 | android:layout_marginLeft="5dp" | 397 | android:layout_marginLeft="5dp" |
| 398 | android:layout_weight="5" | 398 | android:layout_weight="5" |
| 399 | android:text="个人信息" | 399 | android:text="个人信息" |
| 400 | android:textSize="22sp" /> | 400 | android:textSize="22sp" /> |
| 401 | 401 | ||
| 402 | <TextView | 402 | <TextView |
| 403 | android:id="@+id/tv_edit_presoninfo" | 403 | android:id="@+id/tv_edit_presoninfo" |
| 404 | android:padding="5dp" | 404 | android:padding="5dp" |
| 405 | android:layout_width="0dp" | 405 | android:layout_width="0dp" |
| 406 | android:layout_height="wrap_content" | 406 | android:layout_height="wrap_content" |
| 407 | android:layout_marginLeft="10dp" | 407 | android:layout_marginLeft="10dp" |
| 408 | android:layout_weight="0.4" | 408 | android:layout_weight="0.4" |
| 409 | android:text="编辑" | 409 | android:text="编辑" |
| 410 | android:textSize="18sp" /> | 410 | android:textSize="18sp" /> |
| 411 | 411 | ||
| 412 | <ImageView | 412 | <ImageView |
| 413 | android:layout_width="0dp" | 413 | android:layout_width="0dp" |
| 414 | android:layout_height="wrap_content" | 414 | android:layout_height="wrap_content" |
| 415 | android:layout_weight="0.1" | 415 | android:layout_weight="0.1" |
| 416 | android:src="@mipmap/youjiantou" /> | 416 | android:src="@mipmap/youjiantou" /> |
| 417 | 417 | ||
| 418 | 418 | ||
| 419 | </LinearLayout> | 419 | </LinearLayout> |
| 420 | 420 | ||
| 421 | <LinearLayout | 421 | <LinearLayout |
| 422 | android:layout_width="match_parent" | 422 | android:layout_width="match_parent" |
| 423 | android:layout_height="wrap_content" | 423 | android:layout_height="wrap_content" |
| 424 | android:layout_marginLeft="50dp" | 424 | android:layout_marginLeft="50dp" |
| 425 | android:orientation="vertical"> | 425 | android:orientation="vertical"> |
| 426 | 426 | ||
| 427 | <LinearLayout | 427 | <LinearLayout |
| 428 | android:layout_width="match_parent" | 428 | android:layout_width="match_parent" |
| 429 | android:layout_height="wrap_content" | 429 | android:layout_height="wrap_content" |
| 430 | android:gravity="center_vertical" | 430 | android:gravity="center_vertical" |
| 431 | android:orientation="horizontal"> | 431 | android:orientation="horizontal"> |
| 432 | 432 | ||
| 433 | <TextView | 433 | <TextView |
| 434 | android:layout_width="0dp" | 434 | android:layout_width="0dp" |
| 435 | android:layout_height="wrap_content" | 435 | android:layout_height="wrap_content" |
| 436 | android:layout_weight="1" | 436 | android:layout_weight="1" |
| 437 | android:text="昵称" | 437 | android:text="昵称" |
| 438 | android:textSize="20sp" /> | 438 | android:textSize="20sp" /> |
| 439 | 439 | ||
| 440 | <TextView | 440 | <TextView |
| 441 | android:id="@+id/tv_username1" | 441 | android:id="@+id/tv_username1" |
| 442 | android:layout_width="0dp" | 442 | android:layout_width="0dp" |
| 443 | android:layout_height="wrap_content" | 443 | android:layout_height="wrap_content" |
| 444 | android:layout_weight="2" | 444 | android:layout_weight="2" |
| 445 | android:hint="未填写" | 445 | android:hint="未填写" |
| 446 | android:textSize="20sp" /> | 446 | android:textSize="20sp" /> |
| 447 | 447 | ||
| 448 | <TextView | 448 | <TextView |
| 449 | android:layout_width="1dp" | 449 | android:layout_width="1dp" |
| 450 | android:layout_height="wrap_content" | 450 | android:layout_height="wrap_content" |
| 451 | android:layout_weight="1" | 451 | android:layout_weight="1" |
| 452 | android:text="星座" | 452 | android:text="星座" |
| 453 | android:textSize="20sp" /> | 453 | android:textSize="20sp" /> |
| 454 | 454 | ||
| 455 | <TextView | 455 | <TextView |
| 456 | android:id="@+id/tv_mygad" | 456 | android:id="@+id/tv_mygad" |
| 457 | android:layout_width="0dp" | 457 | android:layout_width="0dp" |
| 458 | android:layout_height="wrap_content" | 458 | android:layout_height="wrap_content" |
| 459 | android:layout_weight="2" | 459 | android:layout_weight="2" |
| 460 | android:hint="未填写" | 460 | android:hint="未填写" |
| 461 | android:textSize="20sp" /> | 461 | android:textSize="20sp" /> |
| 462 | </LinearLayout> | 462 | </LinearLayout> |
| 463 | 463 | ||
| 464 | <LinearLayout | 464 | <LinearLayout |
| 465 | android:layout_width="match_parent" | 465 | android:layout_width="match_parent" |
| 466 | android:layout_height="wrap_content" | 466 | android:layout_height="wrap_content" |
| 467 | android:layout_marginTop="15dp" | 467 | android:layout_marginTop="15dp" |
| 468 | android:gravity="center_vertical" | 468 | android:gravity="center_vertical" |
| 469 | android:orientation="horizontal"> | 469 | android:orientation="horizontal"> |
| 470 | 470 | ||
| 471 | <TextView | 471 | <TextView |
| 472 | android:layout_width="0dp" | 472 | android:layout_width="0dp" |
| 473 | android:layout_height="wrap_content" | 473 | android:layout_height="wrap_content" |
| 474 | android:layout_weight="1" | 474 | android:layout_weight="1" |
| 475 | android:text="性别" | 475 | android:text="性别" |
| 476 | android:textSize="20sp" /> | 476 | android:textSize="20sp" /> |
| 477 | 477 | ||
| 478 | <TextView | 478 | <TextView |
| 479 | android:id="@+id/tv_sex" | 479 | android:id="@+id/tv_sex" |
| 480 | android:layout_width="0dp" | 480 | android:layout_width="0dp" |
| 481 | android:layout_height="wrap_content" | 481 | android:layout_height="wrap_content" |
| 482 | android:layout_weight="2" | 482 | android:layout_weight="2" |
| 483 | android:hint="未填写" | 483 | android:hint="未填写" |
| 484 | android:textSize="20sp" /> | 484 | android:textSize="20sp" /> |
| 485 | 485 | ||
| 486 | <TextView | 486 | <TextView |
| 487 | android:layout_width="1dp" | 487 | android:layout_width="1dp" |
| 488 | android:layout_height="wrap_content" | 488 | android:layout_height="wrap_content" |
| 489 | android:layout_weight="1" | 489 | android:layout_weight="1" |
| 490 | android:text="地区" | 490 | android:text="地区" |
| 491 | android:textSize="20sp" /> | 491 | android:textSize="20sp" /> |
| 492 | 492 | ||
| 493 | <TextView | 493 | <TextView |
| 494 | android:id="@+id/tv_useinfo_adress" | 494 | android:id="@+id/tv_useinfo_adress" |
| 495 | android:layout_width="0dp" | 495 | android:layout_width="0dp" |
| 496 | android:layout_height="wrap_content" | 496 | android:layout_height="wrap_content" |
| 497 | android:layout_weight="2" | 497 | android:layout_weight="2" |
| 498 | android:hint="未填写" | 498 | android:hint="未填写" |
| 499 | android:maxLines="2" | ||
| 500 | android:ellipsize="end" | ||
| 499 | android:textSize="20sp" /> | 501 | android:textSize="20sp" /> |
| 500 | </LinearLayout> | 502 | </LinearLayout> |
| 501 | 503 | ||
| 502 | <LinearLayout | 504 | <LinearLayout |
| 503 | android:layout_width="match_parent" | 505 | android:layout_width="match_parent" |
| 504 | android:layout_height="wrap_content" | 506 | android:layout_height="wrap_content" |
| 505 | android:layout_marginTop="15dp" | 507 | android:layout_marginTop="15dp" |
| 506 | android:gravity="center_vertical" | 508 | android:gravity="center_vertical" |
| 507 | android:orientation="horizontal"> | 509 | android:orientation="horizontal"> |
| 508 | 510 | ||
| 509 | <TextView | 511 | <TextView |
| 510 | android:layout_width="0dp" | 512 | android:layout_width="0dp" |
| 511 | android:layout_height="wrap_content" | 513 | android:layout_height="wrap_content" |
| 512 | android:layout_weight="1" | 514 | android:layout_weight="1" |
| 513 | android:text="生日" | 515 | android:text="生日" |
| 514 | android:textSize="20sp" /> | 516 | android:textSize="20sp" /> |
| 515 | 517 | ||
| 516 | <TextView | 518 | <TextView |
| 517 | android:id="@+id/tv_useinfo_birthday" | 519 | android:id="@+id/tv_useinfo_birthday" |
| 518 | android:layout_width="0dp" | 520 | android:layout_width="0dp" |
| 519 | android:layout_height="wrap_content" | 521 | android:layout_height="wrap_content" |
| 520 | android:layout_weight="2" | 522 | android:layout_weight="2" |
| 521 | android:hint="未填写" | 523 | android:hint="未填写" |
| 522 | android:textSize="20sp" /> | 524 | android:textSize="20sp" /> |
| 523 | 525 | ||
| 524 | <TextView | 526 | <TextView |
| 525 | android:layout_width="1dp" | 527 | android:layout_width="1dp" |
| 526 | android:layout_height="wrap_content" | 528 | android:layout_height="wrap_content" |
| 527 | android:layout_weight="1" | 529 | android:layout_weight="1" |
| 528 | android:text="学校" | 530 | android:text="学校" |
| 529 | android:textSize="20sp" /> | 531 | android:textSize="20sp" /> |
| 530 | 532 | ||
| 531 | <TextView | 533 | <TextView |
| 532 | android:id="@+id/tv_useinfo_school" | 534 | android:id="@+id/tv_useinfo_school" |
| 533 | android:layout_width="0dp" | 535 | android:layout_width="0dp" |
| 534 | android:layout_height="wrap_content" | 536 | android:layout_height="wrap_content" |
| 535 | android:layout_weight="2" | 537 | android:layout_weight="2" |
| 536 | android:hint="未填写" | 538 | android:hint="未填写" |
| 537 | android:textSize="20sp" /> | 539 | android:textSize="20sp" /> |
| 538 | </LinearLayout> | 540 | </LinearLayout> |
| 539 | 541 | ||
| 540 | <LinearLayout | 542 | <LinearLayout |
| 541 | android:layout_width="match_parent" | 543 | android:layout_width="match_parent" |
| 542 | android:layout_height="wrap_content" | 544 | android:layout_height="wrap_content" |
| 543 | android:layout_marginTop="15dp" | 545 | android:layout_marginTop="15dp" |
| 544 | android:gravity="center_vertical" | 546 | android:gravity="center_vertical" |
| 545 | android:orientation="horizontal"> | 547 | android:orientation="horizontal"> |
| 546 | 548 | ||
| 547 | <TextView | 549 | <TextView |
| 548 | android:layout_width="0dp" | 550 | android:layout_width="0dp" |
| 549 | android:layout_height="wrap_content" | 551 | android:layout_height="wrap_content" |
| 550 | android:layout_weight="1" | 552 | android:layout_weight="1" |
| 551 | android:text=" Q Q" | 553 | android:text=" Q Q" |
| 552 | android:textSize="20sp" /> | 554 | android:textSize="20sp" /> |
| 553 | 555 | ||
| 554 | <TextView | 556 | <TextView |
| 555 | android:id="@+id/tv_useinfo_qq" | 557 | android:id="@+id/tv_useinfo_qq" |
| 556 | android:layout_width="0dp" | 558 | android:layout_width="0dp" |
| 557 | android:layout_height="wrap_content" | 559 | android:layout_height="wrap_content" |
| 558 | android:layout_weight="2" | 560 | android:layout_weight="2" |
| 559 | android:hint="未填写" | 561 | android:hint="未填写" |
| 560 | android:textSize="20sp" /> | 562 | android:textSize="20sp" /> |
| 561 | 563 | ||
| 562 | <TextView | 564 | <TextView |
| 563 | android:layout_width="1dp" | 565 | android:layout_width="1dp" |
| 564 | android:layout_height="wrap_content" | 566 | android:layout_height="wrap_content" |
| 565 | android:layout_weight="1" | 567 | android:layout_weight="1" |
| 566 | android:text="年级" | 568 | android:text="年级" |
| 567 | android:textSize="20sp" /> | 569 | android:textSize="20sp" /> |
| 568 | 570 | ||
| 569 | <TextView | 571 | <TextView |
| 570 | android:id="@+id/tv_useinfo_gender" | 572 | android:id="@+id/tv_useinfo_gender" |
| 571 | android:layout_width="0dp" | 573 | android:layout_width="0dp" |
| 572 | android:layout_height="wrap_content" | 574 | android:layout_height="wrap_content" |
| 573 | android:layout_weight="2" | 575 | android:layout_weight="2" |
| 574 | android:hint="未填写" | 576 | android:hint="未填写" |
| 575 | android:textSize="20sp" /> | 577 | android:textSize="20sp" /> |
| 576 | </LinearLayout> | 578 | </LinearLayout> |
| 577 | 579 | ||
| 578 | 580 | ||
| 579 | </LinearLayout> | 581 | </LinearLayout> |
| 580 | <View | 582 | <View |
| 581 | android:layout_width="match_parent" | 583 | android:layout_width="match_parent" |
| 582 | android:layout_height="0.7dp" | 584 | android:layout_height="0.7dp" |
| 583 | android:layout_marginTop="20dp" | 585 | android:layout_marginTop="20dp" |
| 584 | android:background="@color/cutoff_line"> | 586 | android:background="@color/cutoff_line"> |
| 585 | 587 | ||
| 586 | </View> | 588 | </View> |
| 587 | <LinearLayout | 589 | <LinearLayout |
| 588 | android:layout_width="match_parent" | 590 | android:layout_width="match_parent" |
| 589 | android:layout_height="wrap_content" | 591 | android:layout_height="wrap_content" |
| 590 | android:layout_margin="10dp" | 592 | android:layout_margin="10dp" |
| 591 | android:gravity="center_vertical" | 593 | android:gravity="center_vertical" |
| 592 | android:orientation="horizontal"> | 594 | android:orientation="horizontal"> |
| 593 | 595 | ||
| 594 | <View | 596 | <View |
| 595 | android:layout_width="5dp" | 597 | android:layout_width="5dp" |
| 596 | android:layout_height="20dp" | 598 | android:layout_height="20dp" |
| 597 | android:background="@color/login_text_blue"> | 599 | android:background="@color/login_text_blue"> |
| 598 | 600 | ||
| 599 | </View> | 601 | </View> |
| 600 | 602 | ||
| 601 | <TextView | 603 | <TextView |
| 602 | android:layout_width="wrap_content" | 604 | android:layout_width="wrap_content" |
| 603 | android:layout_height="wrap_content" | 605 | android:layout_height="wrap_content" |
| 604 | android:layout_marginLeft="5dp" | 606 | android:layout_marginLeft="5dp" |
| 605 | android:text="版本信息" | 607 | android:text="版本信息" |
| 606 | android:textSize="22sp" /> | 608 | android:textSize="22sp" /> |
| 607 | 609 | ||
| 608 | </LinearLayout> | 610 | </LinearLayout> |
| 609 | 611 | ||
| 610 | <LinearLayout | 612 | <LinearLayout |
| 611 | android:layout_width="match_parent" | 613 | android:layout_width="match_parent" |
| 612 | android:layout_height="wrap_content" | 614 | android:layout_height="wrap_content" |
| 613 | android:layout_marginTop="10dp"> | 615 | android:layout_marginTop="10dp"> |
| 614 | <android.support.v7.widget.RecyclerView | 616 | <android.support.v7.widget.RecyclerView |
| 615 | android:id="@+id/id_recyclerview_pubish" | 617 | android:id="@+id/id_recyclerview_pubish" |
| 616 | android:layout_width="match_parent" | 618 | android:layout_width="match_parent" |
| 617 | android:layout_height="match_parent" | 619 | android:layout_height="match_parent" |
| 618 | android:layout_centerVertical="true" | 620 | android:layout_centerVertical="true" |
| 619 | android:scrollbars="none" /> | 621 | android:scrollbars="none" /> |
| 620 | 622 | ||
| 621 | 623 | ||
| 622 | </LinearLayout> | 624 | </LinearLayout> |
| 623 | 625 | ||
| 624 | 626 | ||
| 625 | </LinearLayout> | 627 | </LinearLayout> |
| 626 | 628 | ||
| 627 | 629 | ||
| 628 | </LinearLayout> | 630 | </LinearLayout> |
| 629 | 631 | ||
| 630 | 632 | ||
| 631 | </LinearLayout> | 633 | </LinearLayout> |
| 632 | 634 |
PersonalCenter/app/src/main/res/layout/fragment_changge_presonal_info.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
| 6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 7 | <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="50dp" | 10 | android:layout_height="50dp" |
| 11 | android:background="@color/login_text_blue"> | 11 | android:background="@color/login_text_blue"> |
| 12 | 12 | ||
| 13 | <ImageView | 13 | <ImageView |
| 14 | android:id="@+id/cancel" | 14 | android:id="@+id/cancel" |
| 15 | android:layout_width="wrap_content" | 15 | android:layout_width="wrap_content" |
| 16 | android:layout_height="match_parent" | 16 | android:layout_height="match_parent" |
| 17 | android:paddingLeft="20dp" | 17 | android:paddingLeft="20dp" |
| 18 | android:paddingRight="20dp" | 18 | android:paddingRight="20dp" |
| 19 | android:src="@mipmap/title_back" /> | 19 | android:src="@mipmap/title_back" /> |
| 20 | 20 | ||
| 21 | <TextView | 21 | <TextView |
| 22 | android:id="@+id/menu_title" | 22 | android:id="@+id/menu_title" |
| 23 | android:layout_width="wrap_content" | 23 | android:layout_width="wrap_content" |
| 24 | android:layout_height="match_parent" | 24 | android:layout_height="match_parent" |
| 25 | android:layout_centerInParent="true" | 25 | android:layout_centerInParent="true" |
| 26 | android:gravity="center_vertical" | 26 | android:gravity="center_vertical" |
| 27 | android:text="@string/changge_preson" | 27 | android:text="@string/changge_preson" |
| 28 | android:textColor="@android:color/white" | 28 | android:textColor="@android:color/white" |
| 29 | android:textSize="22sp" /> | 29 | android:textSize="22sp" /> |
| 30 | <TextView | 30 | <TextView |
| 31 | android:id="@+id/presonal_sub" | 31 | android:id="@+id/presonal_sub" |
| 32 | android:layout_width="wrap_content" | 32 | android:layout_width="wrap_content" |
| 33 | android:layout_height="match_parent" | 33 | android:layout_height="match_parent" |
| 34 | android:paddingLeft="20dp" | 34 | android:paddingLeft="20dp" |
| 35 | android:paddingRight="20dp" | 35 | android:paddingRight="20dp" |
| 36 | android:gravity="center_vertical" | 36 | android:gravity="center_vertical" |
| 37 | android:layout_alignParentRight="true" | 37 | android:layout_alignParentRight="true" |
| 38 | android:text="保存" | 38 | android:text="保存" |
| 39 | android:textColor="@android:color/white" | 39 | android:textColor="@android:color/white" |
| 40 | android:textSize="22sp" /> | 40 | android:textSize="22sp" /> |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | </RelativeLayout> | 43 | </RelativeLayout> |
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | <LinearLayout | 46 | <LinearLayout |
| 47 | android:layout_width="match_parent" | 47 | android:layout_width="match_parent" |
| 48 | android:layout_height="wrap_content" | 48 | android:layout_height="wrap_content" |
| 49 | android:layout_marginTop="50dp" | 49 | android:layout_marginTop="50dp" |
| 50 | android:orientation="horizontal"> | 50 | android:orientation="horizontal"> |
| 51 | <LinearLayout | 51 | <LinearLayout |
| 52 | android:layout_width="0dp" | 52 | android:layout_width="0dp" |
| 53 | android:layout_weight="1" | 53 | android:layout_weight="1" |
| 54 | android:gravity="center" | 54 | android:gravity="right" |
| 55 | android:layout_marginRight="50dp" | ||
| 56 | android:orientation="vertical" | ||
| 55 | android:layout_height="match_parent"> | 57 | android:layout_height="match_parent"> |
| 56 | <TextView | 58 | <TextView |
| 57 | android:id="@+id/tv_presonal" | 59 | android:id="@+id/tv_presonal" |
| 58 | android:layout_width="wrap_content" | 60 | android:layout_width="wrap_content" |
| 59 | android:layout_height="wrap_content" | 61 | android:layout_height="wrap_content" |
| 60 | android:textSize="22sp" | 62 | android:textSize="22sp" |
| 61 | android:textColor="@color/login_edittext_pressed" | 63 | android:textColor="@color/login_edittext_pressed" |
| 62 | android:text="个人信息"/> | 64 | android:text="个人信息"/> |
| 65 | <View | ||
| 66 | android:layout_width="90dp" | ||
| 67 | android:layout_height="3dp" | ||
| 68 | android:layout_marginTop="5dp" | ||
| 69 | android:background="@color/login_edittext_pressed" | ||
| 70 | /> | ||
| 71 | |||
| 63 | 72 | ||
| 64 | </LinearLayout> | 73 | </LinearLayout> |
| 65 | <LinearLayout | 74 | <LinearLayout |
| 66 | android:id="@+id/tv_version" | 75 | android:id="@+id/tv_version" |
| 67 | android:layout_width="0dp" | 76 | android:layout_width="0dp" |
| 68 | android:layout_weight="1" | 77 | android:layout_weight="1" |
| 69 | android:gravity="center" | 78 | android:gravity="left" |
| 79 | android:layout_marginLeft="50dp" | ||
| 70 | android:layout_height="match_parent"> | 80 | android:layout_height="match_parent"> |
| 71 | <TextView | 81 | <TextView |
| 72 | android:textSize="22sp" | 82 | android:textSize="22sp" |
| 73 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
| 74 | android:layout_height="wrap_content" | 84 | android:layout_height="wrap_content" |
| 75 | android:text="版本信息"/> | 85 | android:text="版本信息"/> |
| 76 | 86 | ||
| 77 | </LinearLayout> | 87 | </LinearLayout> |
| 78 | 88 | ||
| 79 | </LinearLayout> | 89 | </LinearLayout> |
| 80 | 90 | ||
| 81 | 91 | ||
| 82 | <LinearLayout | 92 | <LinearLayout |
| 83 | android:layout_width="wrap_content" | 93 | android:layout_width="wrap_content" |
| 84 | android:layout_height="wrap_content" | 94 | android:layout_height="wrap_content" |
| 85 | android:layout_marginTop="80dp" | 95 | android:layout_marginTop="80dp" |
| 86 | android:orientation="horizontal"> | 96 | android:orientation="horizontal"> |
| 87 | 97 | ||
| 88 | <View | 98 | <View |
| 89 | android:layout_width="450dp" | 99 | android:layout_width="450dp" |
| 90 | android:layout_height="0.7dp" | 100 | android:layout_height="0.7dp" |
| 91 | android:layout_marginLeft="150dp" | 101 | android:layout_marginLeft="150dp" |
| 92 | android:background="@color/cutoff_line"> | 102 | android:background="@color/cutoff_line"> |
| 93 | 103 | ||
| 94 | </View> | 104 | </View> |
| 95 | 105 | ||
| 96 | <View | 106 | <View |
| 97 | android:layout_width="450dp" | 107 | android:layout_width="450dp" |
| 98 | android:layout_height="0.7dp" | 108 | android:layout_height="0.7dp" |
| 99 | android:layout_marginLeft="80dp" | 109 | android:layout_marginLeft="80dp" |
| 100 | android:background="@color/cutoff_line"> | 110 | android:background="@color/cutoff_line"> |
| 101 | 111 | ||
| 102 | </View> | 112 | </View> |
| 103 | 113 | ||
| 104 | 114 | ||
| 105 | </LinearLayout> | 115 | </LinearLayout> |
| 106 | 116 | ||
| 107 | <LinearLayout | 117 | <LinearLayout |
| 108 | android:layout_width="match_parent" | 118 | android:layout_width="match_parent" |
| 109 | android:layout_height="wrap_content" | 119 | android:layout_height="wrap_content" |
| 110 | android:layout_marginLeft="200dp" | 120 | android:layout_marginLeft="200dp" |
| 111 | android:gravity="center_vertical" | 121 | android:gravity="center_vertical" |
| 112 | android:orientation="horizontal"> | 122 | android:orientation="horizontal"> |
| 113 | 123 | ||
| 114 | <LinearLayout | 124 | <LinearLayout |
| 115 | android:layout_width="0dp" | 125 | android:layout_width="0dp" |
| 116 | android:layout_height="80dp" | 126 | android:layout_height="80dp" |
| 117 | android:layout_weight="1" | 127 | android:layout_weight="1" |
| 118 | android:gravity="center_vertical"> | 128 | android:gravity="center_vertical"> |
| 119 | 129 | ||
| 120 | <TextView | 130 | <TextView |
| 121 | android:layout_width="wrap_content" | 131 | android:layout_width="wrap_content" |
| 122 | android:layout_height="wrap_content" | 132 | android:layout_height="wrap_content" |
| 123 | android:text="昵称" | 133 | android:text="昵称" |
| 124 | android:textSize="22sp" /> | 134 | android:textSize="22sp" /> |
| 125 | 135 | ||
| 126 | <EditText | 136 | <EditText |
| 127 | android:id="@+id/tv_username1" | 137 | android:id="@+id/tv_username1" |
| 128 | android:layout_width="wrap_content" | 138 | android:layout_width="wrap_content" |
| 129 | android:layout_height="wrap_content" | 139 | android:layout_height="wrap_content" |
| 130 | android:layout_marginLeft="50dp" | 140 | android:layout_marginLeft="50dp" |
| 131 | android:textColor="@color/electronic_text" | 141 | android:textColor="@color/electronic_text" |
| 132 | android:background="@null" | 142 | android:background="@null" |
| 133 | android:hint="请输入12个以内的中文或英文字符" | 143 | android:hint="请输入12个以内的中文或英文字符" |
| 134 | android:textSize="22sp" /> | 144 | android:textSize="22sp" /> |
| 135 | 145 | ||
| 136 | </LinearLayout> | 146 | </LinearLayout> |
| 137 | 147 | ||
| 138 | <LinearLayout | 148 | <LinearLayout |
| 139 | android:layout_width="0dp" | 149 | android:layout_width="0dp" |
| 140 | android:layout_height="80dp" | 150 | android:layout_height="80dp" |
| 141 | android:layout_weight="1" | 151 | android:layout_weight="1" |
| 142 | android:gravity="center_vertical"> | 152 | android:gravity="center_vertical"> |
| 143 | 153 | ||
| 144 | <TextView | 154 | <TextView |
| 145 | android:layout_width="wrap_content" | 155 | android:layout_width="wrap_content" |
| 146 | android:layout_height="wrap_content" | 156 | android:layout_height="wrap_content" |
| 147 | android:text="地区" | 157 | android:text="地区" |
| 148 | android:textSize="22sp" /> | 158 | android:textSize="22sp" /> |
| 149 | 159 | ||
| 150 | <TextView | 160 | <TextView |
| 151 | android:id="@+id/tv_useinfo_adress" | 161 | android:id="@+id/tv_useinfo_adress" |
| 152 | android:layout_width="wrap_content" | 162 | android:layout_width="wrap_content" |
| 153 | android:layout_height="wrap_content" | 163 | android:layout_height="wrap_content" |
| 154 | android:layout_marginLeft="50dp" | 164 | android:layout_marginLeft="50dp" |
| 155 | android:hint="请选择" | 165 | android:hint="请选择" |
| 156 | android:textSize="22sp" /> | 166 | android:textSize="22sp" /> |
| 157 | 167 | ||
| 158 | <ImageView | 168 | <ImageView |
| 159 | android:id="@+id/my_adress" | 169 | android:id="@+id/my_adress" |
| 160 | android:padding="20dp" | 170 | android:padding="20dp" |
| 161 | android:layout_width="wrap_content" | 171 | android:layout_width="wrap_content" |
| 162 | android:layout_height="wrap_content" | 172 | android:layout_height="wrap_content" |
| 163 | android:layout_marginLeft="150dp" | 173 | android:layout_marginLeft="150dp" |
| 164 | android:src="@mipmap/xiajiantou"> | 174 | android:src="@mipmap/xiajiantou"> |
| 165 | 175 | ||
| 166 | </ImageView> | 176 | </ImageView> |
| 167 | </LinearLayout> | 177 | </LinearLayout> |
| 168 | 178 | ||
| 169 | </LinearLayout> | 179 | </LinearLayout> |
| 170 | 180 | ||
| 171 | <LinearLayout | 181 | <LinearLayout |
| 172 | android:layout_width="wrap_content" | 182 | android:layout_width="wrap_content" |
| 173 | android:layout_height="wrap_content" | 183 | android:layout_height="wrap_content" |
| 174 | android:orientation="horizontal"> | 184 | android:orientation="horizontal"> |
| 175 | 185 | ||
| 176 | <View | 186 | <View |
| 177 | android:layout_width="450dp" | 187 | android:layout_width="450dp" |
| 178 | android:layout_height="0.7dp" | 188 | android:layout_height="0.7dp" |
| 179 | android:layout_marginLeft="150dp" | 189 | android:layout_marginLeft="150dp" |
| 180 | android:background="@color/cutoff_line"> | 190 | android:background="@color/cutoff_line"> |
| 181 | 191 | ||
| 182 | </View> | 192 | </View> |
| 183 | 193 | ||
| 184 | <View | 194 | <View |
| 185 | android:layout_width="450dp" | 195 | android:layout_width="450dp" |
| 186 | android:layout_height="0.7dp" | 196 | android:layout_height="0.7dp" |
| 187 | android:layout_marginLeft="80dp" | 197 | android:layout_marginLeft="80dp" |
| 188 | android:background="@color/cutoff_line"> | 198 | android:background="@color/cutoff_line"> |
| 189 | 199 | ||
| 190 | </View> | 200 | </View> |
| 191 | 201 | ||
| 192 | 202 | ||
| 193 | </LinearLayout> | 203 | </LinearLayout> |
| 194 | 204 | ||
| 195 | <LinearLayout | 205 | <LinearLayout |
| 196 | android:layout_width="match_parent" | 206 | android:layout_width="match_parent" |
| 197 | android:layout_height="wrap_content" | 207 | android:layout_height="wrap_content" |
| 198 | android:layout_marginLeft="200dp" | 208 | android:layout_marginLeft="200dp" |
| 199 | android:gravity="center_vertical" | 209 | android:gravity="center_vertical" |
| 200 | android:orientation="horizontal"> | 210 | android:orientation="horizontal"> |
| 201 | 211 | ||
| 202 | <LinearLayout | 212 | <LinearLayout |
| 203 | android:layout_width="0dp" | 213 | android:layout_width="0dp" |
| 204 | android:layout_height="80dp" | 214 | android:layout_height="80dp" |
| 205 | android:layout_weight="1" | 215 | android:layout_weight="1" |
| 206 | android:gravity="center_vertical"> | 216 | android:gravity="center_vertical"> |
| 207 | 217 | ||
| 208 | <TextView | 218 | <TextView |
| 209 | android:layout_width="wrap_content" | 219 | android:layout_width="wrap_content" |
| 210 | android:layout_height="wrap_content" | 220 | android:layout_height="wrap_content" |
| 211 | android:text="性别" | 221 | android:text="性别" |
| 212 | android:textSize="22sp" /> | 222 | android:textSize="22sp" /> |
| 213 | 223 | ||
| 214 | <TextView | 224 | <TextView |
| 215 | android:id="@+id/tv_sex" | 225 | android:id="@+id/tv_sex" |
| 216 | android:layout_width="wrap_content" | 226 | android:layout_width="wrap_content" |
| 217 | android:layout_height="wrap_content" | 227 | android:layout_height="wrap_content" |
| 218 | android:layout_marginLeft="50dp" | 228 | android:layout_marginLeft="50dp" |
| 219 | android:hint="请选择" | 229 | android:hint="请选择" |
| 220 | android:textSize="22sp" /> | 230 | android:textSize="22sp" /> |
| 221 | 231 | ||
| 222 | <ImageView | 232 | <ImageView |
| 223 | android:id="@+id/my_sex" | 233 | android:id="@+id/my_sex" |
| 224 | android:padding="20dp" | 234 | android:padding="20dp" |
| 225 | android:layout_width="wrap_content" | 235 | android:layout_width="wrap_content" |
| 226 | android:layout_height="wrap_content" | 236 | android:layout_height="wrap_content" |
| 227 | android:layout_marginLeft="150dp" | 237 | android:layout_marginLeft="150dp" |
| 228 | android:src="@mipmap/xiajiantou"> | 238 | android:src="@mipmap/xiajiantou"> |
| 229 | 239 | ||
| 230 | </ImageView> | 240 | </ImageView> |
| 231 | 241 | ||
| 232 | 242 | ||
| 233 | </LinearLayout> | 243 | </LinearLayout> |
| 234 | 244 | ||
| 235 | <LinearLayout | 245 | <LinearLayout |
| 236 | android:layout_width="0dp" | 246 | android:layout_width="0dp" |
| 237 | android:layout_height="80dp" | 247 | android:layout_height="80dp" |
| 238 | android:layout_weight="1" | 248 | android:layout_weight="1" |
| 239 | android:gravity="center_vertical"> | 249 | android:gravity="center_vertical"> |
| 240 | 250 | ||
| 241 | <TextView | 251 | <TextView |
| 242 | android:layout_width="wrap_content" | 252 | android:layout_width="wrap_content" |
| 243 | android:layout_height="wrap_content" | 253 | android:layout_height="wrap_content" |
| 244 | android:text=" " | 254 | android:text=" " |
| 245 | android:textColor="@color/white" | 255 | android:textColor="@color/white" |
| 246 | android:textSize="22sp" /> | 256 | android:textSize="22sp" /> |
| 247 | 257 | ||
| 248 | <EditText | 258 | <EditText |
| 249 | android:id="@+id/tv_useinfo_adress1" | 259 | android:id="@+id/tv_useinfo_adress1" |
| 250 | android:layout_width="wrap_content" | 260 | android:layout_width="wrap_content" |
| 251 | android:layout_height="wrap_content" | 261 | android:layout_height="wrap_content" |
| 252 | android:layout_marginLeft="50dp" | 262 | android:layout_marginLeft="50dp" |
| 253 | android:textColor="@color/electronic_text" | 263 | android:textColor="@color/electronic_text" |
| 254 | android:background="@null" | 264 | android:background="@null" |
| 255 | android:hint="请输入详细地址" | 265 | android:hint="请输入详细地址" |
| 256 | android:textSize="22sp" /> | 266 | android:textSize="22sp" /> |
| 257 | 267 | ||
| 258 | </LinearLayout> | 268 | </LinearLayout> |
| 259 | 269 | ||
| 260 | </LinearLayout> | 270 | </LinearLayout> |
| 261 | 271 | ||
| 262 | <LinearLayout | 272 | <LinearLayout |
| 263 | android:layout_width="wrap_content" | 273 | android:layout_width="wrap_content" |
| 264 | android:layout_height="wrap_content" | 274 | android:layout_height="wrap_content" |
| 265 | 275 | ||
| 266 | android:orientation="horizontal"> | 276 | android:orientation="horizontal"> |
| 267 | 277 | ||
| 268 | <View | 278 | <View |
| 269 | android:layout_width="450dp" | 279 | android:layout_width="450dp" |
| 270 | android:layout_height="0.7dp" | 280 | android:layout_height="0.7dp" |
| 271 | android:layout_marginLeft="150dp" | 281 | android:layout_marginLeft="150dp" |
| 272 | android:background="@color/cutoff_line"> | 282 | android:background="@color/cutoff_line"> |
| 273 | 283 | ||
| 274 | </View> | 284 | </View> |
| 275 | 285 | ||
| 276 | <View | 286 | <View |
| 277 | android:layout_width="450dp" | 287 | android:layout_width="450dp" |
| 278 | android:layout_height="0.7dp" | 288 | android:layout_height="0.7dp" |
| 279 | android:layout_marginLeft="80dp" | 289 | android:layout_marginLeft="80dp" |
| 280 | android:background="@color/cutoff_line"> | 290 | android:background="@color/cutoff_line"> |
| 281 | 291 | ||
| 282 | </View> | 292 | </View> |
| 283 | 293 | ||
| 284 | 294 | ||
| 285 | </LinearLayout> | 295 | </LinearLayout> |
| 286 | 296 | ||
| 287 | <LinearLayout | 297 | <LinearLayout |
| 288 | android:layout_width="match_parent" | 298 | android:layout_width="match_parent" |
| 289 | android:layout_height="wrap_content" | 299 | android:layout_height="wrap_content" |
| 290 | android:layout_marginLeft="200dp" | 300 | android:layout_marginLeft="200dp" |
| 291 | android:gravity="center_vertical" | 301 | android:gravity="center_vertical" |
| 292 | android:orientation="horizontal"> | 302 | android:orientation="horizontal"> |
| 293 | 303 | ||
| 294 | 304 | ||
| 295 | <LinearLayout | 305 | <LinearLayout |
| 296 | android:layout_width="0dp" | 306 | android:layout_width="0dp" |
| 297 | android:layout_height="80dp" | 307 | android:layout_height="80dp" |
| 298 | android:layout_weight="1" | 308 | android:layout_weight="1" |
| 299 | android:gravity="center_vertical"> | 309 | android:gravity="center_vertical"> |
| 300 | 310 | ||
| 301 | <TextView | 311 | <TextView |
| 302 | android:layout_width="wrap_content" | 312 | android:layout_width="wrap_content" |
| 303 | android:layout_height="wrap_content" | 313 | android:layout_height="wrap_content" |
| 304 | android:text="生日" | 314 | android:text="生日" |
| 305 | android:textSize="22sp" /> | 315 | android:textSize="22sp" /> |
| 306 | 316 | ||
| 307 | <TextView | 317 | <TextView |
| 308 | android:id="@+id/tv_useinfo_birthday" | 318 | android:id="@+id/tv_useinfo_birthday" |
| 309 | android:layout_width="wrap_content" | 319 | android:layout_width="wrap_content" |
| 310 | android:layout_height="wrap_content" | 320 | android:layout_height="wrap_content" |
| 311 | android:layout_marginLeft="50dp" | 321 | android:layout_marginLeft="50dp" |
| 312 | android:hint="请选择" | 322 | android:hint="请选择" |
| 313 | android:textSize="22sp" /> | 323 | android:textSize="22sp" /> |
| 314 | 324 | ||
| 315 | <ImageView | 325 | <ImageView |
| 316 | android:id="@+id/my_bthday" | 326 | android:id="@+id/my_bthday" |
| 317 | android:padding="20dp" | 327 | android:padding="20dp" |
| 318 | android:layout_width="wrap_content" | 328 | android:layout_width="wrap_content" |
| 319 | android:layout_height="wrap_content" | 329 | android:layout_height="wrap_content" |
| 320 | android:layout_marginLeft="150dp" | 330 | android:layout_marginLeft="150dp" |
| 321 | android:src="@mipmap/xiajiantou"/> | 331 | android:src="@mipmap/xiajiantou"/> |
| 322 | </LinearLayout> | 332 | </LinearLayout> |
| 323 | <LinearLayout | 333 | <LinearLayout |
| 324 | android:layout_width="0dp" | 334 | android:layout_width="0dp" |
| 325 | android:layout_height="80dp" | 335 | android:layout_height="80dp" |
| 326 | android:layout_weight="1" | 336 | android:layout_weight="1" |
| 327 | android:gravity="center_vertical"> | 337 | android:gravity="center_vertical"> |
| 328 | 338 | ||
| 329 | <TextView | 339 | <TextView |
| 330 | android:layout_width="wrap_content" | 340 | android:layout_width="wrap_content" |
| 331 | android:layout_height="wrap_content" | 341 | android:layout_height="wrap_content" |
| 332 | android:text="年级" | 342 | android:text="年级" |
| 333 | android:textSize="22sp" /> | 343 | android:textSize="22sp" /> |
| 334 | 344 | ||
| 335 | <TextView | 345 | <TextView |
| 336 | android:id="@+id/tv_useinfo_gender" | 346 | android:id="@+id/tv_useinfo_gender" |
| 337 | android:layout_width="wrap_content" | 347 | android:layout_width="wrap_content" |
| 338 | android:layout_height="wrap_content" | 348 | android:layout_height="wrap_content" |
| 339 | android:layout_marginLeft="50dp" | 349 | android:layout_marginLeft="50dp" |
| 340 | android:hint="请选择" | 350 | android:hint="请选择" |
| 341 | android:textSize="22sp" /> | 351 | android:textSize="22sp" /> |
| 342 | 352 | ||
| 343 | <ImageView | 353 | <ImageView |
| 344 | android:id="@+id/my_grade" | 354 | android:id="@+id/my_grade" |
| 345 | android:padding="20dp" | 355 | android:padding="20dp" |
| 346 | android:layout_width="wrap_content" | 356 | android:layout_width="wrap_content" |
| 347 | android:layout_height="wrap_content" | 357 | android:layout_height="wrap_content" |
| 348 | android:layout_marginLeft="150dp" | 358 | android:layout_marginLeft="150dp" |
| 349 | android:src="@mipmap/xiajiantou"/> | 359 | android:src="@mipmap/xiajiantou"/> |
| 350 | </LinearLayout> | 360 | </LinearLayout> |
| 351 | 361 | ||
| 352 | </LinearLayout> | 362 | </LinearLayout> |
| 353 | 363 | ||
| 354 | <LinearLayout | 364 | <LinearLayout |
| 355 | android:layout_width="wrap_content" | 365 | android:layout_width="wrap_content" |
| 356 | android:layout_height="wrap_content" | 366 | android:layout_height="wrap_content" |
| 357 | 367 | ||
| 358 | android:orientation="horizontal"> | 368 | android:orientation="horizontal"> |
| 359 | 369 | ||
| 360 | <View | 370 | <View |
| 361 | android:layout_width="450dp" | 371 | android:layout_width="450dp" |
| 362 | android:layout_height="0.7dp" | 372 | android:layout_height="0.7dp" |
| 363 | android:layout_marginLeft="150dp" | 373 | android:layout_marginLeft="150dp" |
| 364 | android:background="@color/cutoff_line"> | 374 | android:background="@color/cutoff_line"> |
| 365 | 375 | ||
| 366 | </View> | 376 | </View> |
| 367 | 377 | ||
| 368 | <View | 378 | <View |
| 369 | android:layout_width="450dp" | 379 | android:layout_width="450dp" |
| 370 | android:layout_height="0.7dp" | 380 | android:layout_height="0.7dp" |
| 371 | android:layout_marginLeft="80dp" | 381 | android:layout_marginLeft="80dp" |
| 372 | android:background="@color/cutoff_line"> | 382 | android:background="@color/cutoff_line"> |
| 373 | 383 | ||
| 374 | </View> | 384 | </View> |
| 375 | 385 | ||
| 376 | 386 | ||
| 377 | </LinearLayout> | 387 | </LinearLayout> |
| 378 | 388 | ||
| 379 | <LinearLayout | 389 | <LinearLayout |
| 380 | android:layout_width="match_parent" | 390 | android:layout_width="match_parent" |
| 381 | android:layout_height="wrap_content" | 391 | android:layout_height="wrap_content" |
| 382 | android:layout_marginLeft="200dp" | 392 | android:layout_marginLeft="200dp" |
| 383 | android:gravity="center_vertical" | 393 | android:gravity="center_vertical" |
| 384 | android:orientation="horizontal"> | 394 | android:orientation="horizontal"> |
| 385 | 395 | ||
| 386 | <LinearLayout | 396 | <LinearLayout |
| 387 | android:id="@+id/lineL_buy_time" | 397 | android:id="@+id/lineL_buy_time" |
| 388 | android:layout_width="0dp" | 398 | android:layout_width="0dp" |
| 389 | android:layout_height="80dp" | 399 | android:layout_height="80dp" |
| 390 | android:layout_weight="1" | 400 | android:layout_weight="1" |
| 391 | android:gravity="center_vertical"> | 401 | android:gravity="center_vertical"> |
| 392 | 402 | ||
| 393 | <TextView | 403 | <TextView |
| 394 | android:layout_width="wrap_content" | 404 | android:layout_width="wrap_content" |
| 395 | android:layout_height="wrap_content" | 405 | android:layout_height="wrap_content" |
| 396 | android:text="Q Q" | 406 | android:text="Q Q" |
| 397 | android:textSize="22sp" /> | 407 | android:textSize="22sp" /> |
| 398 | 408 | ||
| 399 | <EditText | 409 | <EditText |
| 400 | android:id="@+id/tv_useinfo_qq" | 410 | android:id="@+id/tv_useinfo_qq" |
| 401 | android:layout_width="wrap_content" | 411 | android:layout_width="wrap_content" |
| 402 | android:layout_height="wrap_content" | 412 | android:layout_height="wrap_content" |
| 403 | android:layout_marginLeft="50dp" | 413 | android:layout_marginLeft="50dp" |
| 404 | android:background="@null" | 414 | android:background="@null" |
| 405 | android:textColor="@color/electronic_text" | 415 | android:textColor="@color/electronic_text" |
| 406 | android:hint="请输入" | 416 | android:hint="请输入" |
| 407 | android:textSize="22sp" /> | 417 | android:textSize="22sp" /> |
| 408 | 418 | ||
| 409 | </LinearLayout> | 419 | </LinearLayout> |
| 410 | 420 | ||
| 411 | <LinearLayout | 421 | <LinearLayout |
| 412 | android:layout_width="0dp" | 422 | android:layout_width="0dp" |
| 413 | android:layout_height="80dp" | 423 | android:layout_height="80dp" |
| 414 | android:layout_weight="1" | 424 | android:layout_weight="1" |
| 415 | 425 | ||
| 416 | android:gravity="center_vertical"> | 426 | android:gravity="center_vertical"> |
| 417 | 427 | ||
| 418 | <TextView | 428 | <TextView |
| 419 | android:layout_width="wrap_content" | 429 | android:layout_width="wrap_content" |
| 420 | android:layout_height="wrap_content" | 430 | android:layout_height="wrap_content" |
| 421 | android:text="学校" | 431 | android:text="学校" |
| 422 | android:textSize="22sp" /> | 432 | android:textSize="22sp" /> |
| 423 | 433 | ||
| 424 | <TextView | 434 | <TextView |
| 425 | android:id="@+id/tv_useinfo_school" | 435 | android:id="@+id/tv_useinfo_school" |
| 426 | android:layout_width="wrap_content" | 436 | android:layout_width="wrap_content" |
| 427 | android:layout_height="wrap_content" | 437 | android:layout_height="wrap_content" |
| 428 | android:layout_marginLeft="50dp" | 438 | android:layout_marginLeft="50dp" |
| 429 | android:hint="请选择" | 439 | android:hint="请选择" |
| 430 | android:textSize="22sp" /> | 440 | android:textSize="22sp" /> |
| 431 | 441 | ||
| 432 | <ImageView | 442 | <ImageView |
| 433 | android:id="@+id/my_school" | 443 | android:id="@+id/my_school" |
| 434 | android:padding="20dp" | 444 | android:padding="20dp" |
| 435 | android:layout_width="wrap_content" | 445 | android:layout_width="wrap_content" |
| 436 | android:layout_height="wrap_content" | 446 | android:layout_height="wrap_content" |
| 437 | android:layout_marginLeft="150dp" | 447 | android:layout_marginLeft="150dp" |
| 438 | android:src="@mipmap/xiajiantou"> | 448 | android:src="@mipmap/xiajiantou"> |
| 439 | 449 | ||
| 440 | </ImageView> | 450 | </ImageView> |
| 441 | </LinearLayout> | 451 | </LinearLayout> |
| 442 | 452 | ||
| 443 | </LinearLayout> | 453 | </LinearLayout> |
| 444 | 454 | ||
| 445 | <LinearLayout | 455 | <LinearLayout |
| 446 | android:layout_width="wrap_content" | 456 | android:layout_width="wrap_content" |
| 447 | android:layout_height="wrap_content" | 457 | android:layout_height="wrap_content" |
| 448 | android:orientation="horizontal"> | 458 | android:orientation="horizontal"> |
| 449 | 459 | ||
| 450 | <View | 460 | <View |
| 451 | android:layout_width="450dp" | 461 | android:layout_width="450dp" |
| 452 | android:layout_height="0.7dp" | 462 | android:layout_height="0.7dp" |
| 453 | android:layout_marginLeft="150dp" | 463 | android:layout_marginLeft="150dp" |
| 454 | android:background="@color/cutoff_line"> | 464 | android:background="@color/cutoff_line"> |
| 455 | 465 | ||
| 456 | </View> | 466 | </View> |
| 457 | 467 | ||
| 458 | <View | 468 | <View |
| 459 | android:layout_width="450dp" | 469 | android:layout_width="450dp" |
| 460 | android:layout_height="0.7dp" | 470 | android:layout_height="0.7dp" |
| 461 | android:layout_marginLeft="80dp" | 471 | android:layout_marginLeft="80dp" |
| 462 | android:background="@color/cutoff_line"> | 472 | android:background="@color/cutoff_line"> |
| 463 | 473 | ||
| 464 | </View> | 474 | </View> |
| 465 | 475 | ||
| 466 | 476 | ||
| 467 | </LinearLayout> | 477 | </LinearLayout> |
| 468 | 478 | ||
| 469 | </LinearLayout> | 479 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_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 | android:orientation="vertical" android:layout_width="match_parent" | 3 | android:orientation="vertical" android:layout_width="match_parent" |
| 4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
| 5 | android:background="@color/white"> | 5 | android:background="@color/white"> |
| 6 | <RelativeLayout | 6 | <RelativeLayout |
| 7 | android:id="@+id/title" | 7 | android:id="@+id/title" |
| 8 | android:layout_width="match_parent" | 8 | android:layout_width="match_parent" |
| 9 | android:layout_height="50dp" | 9 | android:layout_height="50dp" |
| 10 | android:background="@color/login_text_blue"> | 10 | android:background="@color/login_text_blue"> |
| 11 | 11 | ||
| 12 | <ImageView | 12 | <ImageView |
| 13 | android:id="@+id/cancel" | 13 | android:id="@+id/cancel" |
| 14 | android:layout_width="wrap_content" | 14 | android:layout_width="wrap_content" |
| 15 | android:layout_height="match_parent" | 15 | android:layout_height="match_parent" |
| 16 | android:paddingLeft="20dp" | 16 | android:paddingLeft="20dp" |
| 17 | android:paddingRight="20dp" | 17 | android:paddingRight="20dp" |
| 18 | android:src="@mipmap/title_back" /> | 18 | android:src="@mipmap/title_back" /> |
| 19 | 19 | ||
| 20 | <TextView | 20 | <TextView |
| 21 | android:id="@+id/menu_title" | 21 | android:id="@+id/menu_title" |
| 22 | android:layout_width="wrap_content" | 22 | android:layout_width="wrap_content" |
| 23 | android:layout_height="match_parent" | 23 | android:layout_height="match_parent" |
| 24 | android:layout_centerInParent="true" | 24 | android:layout_centerInParent="true" |
| 25 | android:gravity="center_vertical" | 25 | android:gravity="center_vertical" |
| 26 | android:text="修改版本信息" | 26 | android:text="修改版本信息" |
| 27 | android:textColor="@android:color/white" | 27 | android:textColor="@android:color/white" |
| 28 | android:textSize="22sp" /> | 28 | android:textSize="22sp" /> |
| 29 | <TextView | 29 | <TextView |
| 30 | android:id="@+id/version_sub" | 30 | android:id="@+id/version_sub" |
| 31 | android:layout_width="wrap_content" | 31 | android:layout_width="wrap_content" |
| 32 | android:layout_height="match_parent" | 32 | android:layout_height="match_parent" |
| 33 | android:paddingLeft="20dp" | 33 | android:paddingLeft="20dp" |
| 34 | android:paddingRight="20dp" | 34 | android:paddingRight="20dp" |
| 35 | android:gravity="center_vertical" | 35 | android:gravity="center_vertical" |
| 36 | android:layout_alignParentRight="true" | 36 | android:layout_alignParentRight="true" |
| 37 | android:text="保存" | 37 | android:text="保存" |
| 38 | android:textColor="@android:color/white" | 38 | android:textColor="@android:color/white" |
| 39 | android:textSize="22sp" /> | 39 | android:textSize="22sp" /> |
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | </RelativeLayout> | 42 | </RelativeLayout> |
| 43 | <LinearLayout | 43 | <LinearLayout |
| 44 | android:id="@+id/tiles" | 44 | android:id="@+id/tiles" |
| 45 | android:layout_width="match_parent" | 45 | android:layout_width="match_parent" |
| 46 | android:layout_height="wrap_content" | 46 | android:layout_height="wrap_content" |
| 47 | android:layout_below="@+id/title" | 47 | android:layout_below="@+id/title" |
| 48 | android:layout_marginTop="50dp" | 48 | android:layout_marginTop="50dp" |
| 49 | android:orientation="horizontal"> | 49 | android:orientation="horizontal"> |
| 50 | <LinearLayout | 50 | <LinearLayout |
| 51 | android:id="@+id/tv_presons" | 51 | android:id="@+id/tv_presons" |
| 52 | android:layout_width="0dp" | 52 | android:layout_width="0dp" |
| 53 | android:layout_weight="1" | 53 | android:layout_weight="1" |
| 54 | android:gravity="center" | 54 | android:gravity="right" |
| 55 | android:layout_marginRight="50dp" | ||
| 55 | android:layout_height="match_parent"> | 56 | android:layout_height="match_parent"> |
| 56 | <TextView | 57 | <TextView |
| 57 | android:id="@+id/tv_presonal" | 58 | android:id="@+id/tv_presonal" |
| 58 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
| 59 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
| 60 | android:textSize="22sp" | 61 | android:textSize="22sp" |
| 61 | android:text="个人信息"/> | 62 | android:text="个人信息"/> |
| 62 | 63 | ||
| 63 | </LinearLayout> | 64 | </LinearLayout> |
| 64 | <LinearLayout | 65 | <LinearLayout |
| 65 | android:layout_width="0dp" | 66 | android:layout_width="0dp" |
| 66 | android:layout_weight="1" | 67 | android:layout_weight="1" |
| 67 | android:gravity="center" | 68 | android:gravity="left" |
| 69 | android:layout_marginLeft="50dp" | ||
| 70 | android:orientation="vertical" | ||
| 68 | android:layout_height="match_parent"> | 71 | android:layout_height="match_parent"> |
| 69 | <TextView | 72 | <TextView |
| 70 | android:textSize="22sp" | 73 | android:textSize="22sp" |
| 71 | android:layout_width="wrap_content" | 74 | android:layout_width="wrap_content" |
| 72 | android:layout_height="wrap_content" | 75 | android:layout_height="wrap_content" |
| 73 | android:textColor="@color/login_edittext_pressed" | 76 | android:textColor="@color/login_edittext_pressed" |
| 74 | android:text="版本信息"/> | 77 | android:text="版本信息"/> |
| 78 | <View | ||
| 79 | android:layout_marginTop="5dp" | ||
| 80 | android:layout_width="90dp" | ||
| 81 | android:layout_height="3dp" | ||
| 82 | android:background="@color/login_edittext_pressed" | ||
| 83 | /> | ||
| 75 | 84 | ||
| 76 | </LinearLayout> | 85 | </LinearLayout> |
| 77 | 86 | ||
| 78 | </LinearLayout> | 87 | </LinearLayout> |
| 79 | <GridView | 88 | <GridView |
| 80 | android:id="@+id/grideview" | 89 | android:id="@+id/grideview" |
| 81 | android:layout_margin="30dp" | 90 | android:layout_margin="40dp" |
| 82 | android:layout_width="match_parent" | 91 | android:layout_width="match_parent" |
| 83 | android:layout_height="wrap_content" | 92 | android:layout_height="wrap_content" |
| 84 | android:gravity="center_vertical" | 93 | android:gravity="center_vertical" |
| 85 | android:layout_below="@+id/tiles" | 94 | android:layout_below="@+id/tiles" |
| 86 | android:verticalSpacing="20dp" | 95 | android:verticalSpacing="20dp" |
| 87 | android:numColumns="5"> | 96 | android:numColumns="5"> |
| 88 | 97 | ||
| 89 | </GridView> | 98 | </GridView> |
| 90 | 99 | ||
| 91 | </RelativeLayout> | 100 | </RelativeLayout> |