Commit 5f17f7d7de2db102857a9580ff65a0a6763fd8a0
1 parent
68ca27b89a
Exists in
master
修复账户问题
Showing
3 changed files
with
3 additions
and
1 deletions
Show diff stats
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.app.FragmentActivity; | 13 | import android.support.v4.app.FragmentActivity; |
| 14 | import android.support.v4.content.FileProvider; | 14 | import android.support.v4.content.FileProvider; |
| 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.util.Log; | 17 | import android.util.Log; |
| 18 | import android.view.KeyEvent; | 18 | import android.view.KeyEvent; |
| 19 | import android.view.View; | 19 | import android.view.View; |
| 20 | import android.widget.GridView; | 20 | import android.widget.GridView; |
| 21 | import android.widget.ImageView; | 21 | import android.widget.ImageView; |
| 22 | import android.widget.LinearLayout; | 22 | import android.widget.LinearLayout; |
| 23 | import android.widget.TextView; | 23 | import android.widget.TextView; |
| 24 | import android.widget.Toast; | 24 | import android.widget.Toast; |
| 25 | 25 | ||
| 26 | import com.facebook.drawee.backends.pipeline.Fresco; | 26 | import com.facebook.drawee.backends.pipeline.Fresco; |
| 27 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 27 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
| 28 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 28 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
| 29 | import com.facebook.drawee.generic.RoundingParams; | 29 | import com.facebook.drawee.generic.RoundingParams; |
| 30 | import com.facebook.drawee.interfaces.DraweeController; | 30 | import com.facebook.drawee.interfaces.DraweeController; |
| 31 | import com.facebook.drawee.view.SimpleDraweeView; | 31 | import com.facebook.drawee.view.SimpleDraweeView; |
| 32 | import com.google.gson.Gson; | 32 | import com.google.gson.Gson; |
| 33 | import com.hjx.personalcenter.R; | 33 | import com.hjx.personalcenter.R; |
| 34 | import com.hjx.personalcenter.adapter.MianGridAdapter; | 34 | import com.hjx.personalcenter.adapter.MianGridAdapter; |
| 35 | import com.hjx.personalcenter.adapter.VideoAdapter; | 35 | import com.hjx.personalcenter.adapter.VideoAdapter; |
| 36 | import com.hjx.personalcenter.customdialog.HeadDialog; | 36 | import com.hjx.personalcenter.customdialog.HeadDialog; |
| 37 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 37 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
| 38 | import com.hjx.personalcenter.db.Content; | 38 | import com.hjx.personalcenter.db.Content; |
| 39 | import com.hjx.personalcenter.db.SaveParam; | 39 | import com.hjx.personalcenter.db.SaveParam; |
| 40 | import com.hjx.personalcenter.http.HttpCode; | 40 | import com.hjx.personalcenter.http.HttpCode; |
| 41 | import com.hjx.personalcenter.http.HttpManager; | 41 | import com.hjx.personalcenter.http.HttpManager; |
| 42 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 42 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 43 | import com.hjx.personalcenter.model.DefautPublishInfo; | 43 | import com.hjx.personalcenter.model.DefautPublishInfo; |
| 44 | import com.hjx.personalcenter.model.PesonalInfo; | 44 | import com.hjx.personalcenter.model.PesonalInfo; |
| 45 | import com.hjx.personalcenter.model.SignInfo; | 45 | import com.hjx.personalcenter.model.SignInfo; |
| 46 | import com.hjx.personalcenter.model.VideoInfo; | 46 | import com.hjx.personalcenter.model.VideoInfo; |
| 47 | import com.hjx.personalcenter.update.UpdateChecker; | 47 | import com.hjx.personalcenter.update.UpdateChecker; |
| 48 | import com.hjx.personalcenter.util.AlertUtils; | 48 | import com.hjx.personalcenter.util.AlertUtils; |
| 49 | import com.hjx.personalcenter.util.BrithdayStar; | 49 | import com.hjx.personalcenter.util.BrithdayStar; |
| 50 | import com.hjx.personalcenter.util.CropUtils; | 50 | import com.hjx.personalcenter.util.CropUtils; |
| 51 | import com.hjx.personalcenter.util.DialogPermission; | 51 | import com.hjx.personalcenter.util.DialogPermission; |
| 52 | import com.hjx.personalcenter.util.FileUtil; | 52 | import com.hjx.personalcenter.util.FileUtil; |
| 53 | import com.hjx.personalcenter.util.GetDevicesUtil; | 53 | import com.hjx.personalcenter.util.GetDevicesUtil; |
| 54 | import com.hjx.personalcenter.util.PermissionUtil; | 54 | import com.hjx.personalcenter.util.PermissionUtil; |
| 55 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 55 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
| 56 | import com.mylhyl.circledialog.CircleDialog; | 56 | import com.mylhyl.circledialog.CircleDialog; |
| 57 | import com.mylhyl.circledialog.callback.ConfigInput; | 57 | import com.mylhyl.circledialog.callback.ConfigInput; |
| 58 | import com.mylhyl.circledialog.params.InputParams; | 58 | import com.mylhyl.circledialog.params.InputParams; |
| 59 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 59 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
| 60 | import com.zaaach.toprightmenu.MenuItem; | 60 | import com.zaaach.toprightmenu.MenuItem; |
| 61 | import com.zaaach.toprightmenu.TopRightMenu; | 61 | import com.zaaach.toprightmenu.TopRightMenu; |
| 62 | 62 | ||
| 63 | import org.json.JSONException; | 63 | import org.json.JSONException; |
| 64 | import org.json.JSONObject; | 64 | import org.json.JSONObject; |
| 65 | 65 | ||
| 66 | import java.io.File; | 66 | import java.io.File; |
| 67 | import java.io.UnsupportedEncodingException; | 67 | import java.io.UnsupportedEncodingException; |
| 68 | import java.util.ArrayList; | 68 | import java.util.ArrayList; |
| 69 | import java.util.List; | 69 | import java.util.List; |
| 70 | 70 | ||
| 71 | public class MainActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 71 | public class MainActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
| 72 | private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex, tv_edit_presoninfo; | 72 | private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex, tv_edit_presoninfo; |
| 73 | private TextView tv_sign, | 73 | private TextView tv_sign, |
| 74 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 74 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
| 75 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; | 75 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; |
| 76 | private TextView linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass, iv_look_card; | 76 | private TextView linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass, iv_look_card; |
| 77 | private TopRightMenu mTopRightMenu; | 77 | private TopRightMenu mTopRightMenu; |
| 78 | private LinearLayout view_novedeo; | 78 | private LinearLayout view_novedeo; |
| 79 | private View sssssssss; | 79 | private View sssssssss; |
| 80 | //水平滑动 | 80 | //水平滑动 |
| 81 | private RecyclerView mRecyclerView; | 81 | private RecyclerView mRecyclerView; |
| 82 | private GridView mRecyclerViewpublish; | 82 | private GridView mRecyclerViewpublish; |
| 83 | private VideoAdapter RecyclerViewadapter; | 83 | private VideoAdapter RecyclerViewadapter; |
| 84 | private MianGridAdapter RecyclerViewadapterpublish; | 84 | private MianGridAdapter RecyclerViewadapterpublish; |
| 85 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 85 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
| 86 | 86 | ||
| 87 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); | 87 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); |
| 88 | private boolean showIcon = false; | 88 | private boolean showIcon = false; |
| 89 | private boolean dimBg = false; | 89 | private boolean dimBg = false; |
| 90 | private boolean needAnim = true; | 90 | private boolean needAnim = true; |
| 91 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 91 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
| 92 | private static final int REQUEST_CODE_ALBUM = 2; | 92 | private static final int REQUEST_CODE_ALBUM = 2; |
| 93 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 93 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
| 94 | SimpleDraweeView mSimpleDraweeView; | 94 | SimpleDraweeView mSimpleDraweeView; |
| 95 | private File file; | 95 | private File file; |
| 96 | private Uri uri; | 96 | private Uri uri; |
| 97 | Handler handler = new Handler() { | 97 | Handler handler = new Handler() { |
| 98 | @Override | 98 | @Override |
| 99 | public void handleMessage(Message msg) { | 99 | public void handleMessage(Message msg) { |
| 100 | super.handleMessage(msg); | 100 | super.handleMessage(msg); |
| 101 | switch (msg.what) { | 101 | switch (msg.what) { |
| 102 | case HttpCode.GETINFO: | 102 | case HttpCode.GETINFO: |
| 103 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; | 103 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; |
| 104 | tv_username.setText(cardinfoBean.getNickName()); | 104 | tv_username.setText(cardinfoBean.getNickName()); |
| 105 | tv_username1.setText(cardinfoBean.getNickName()); | 105 | tv_username1.setText(cardinfoBean.getNickName()); |
| 106 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 106 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
| 107 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 107 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
| 108 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 108 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
| 109 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 109 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
| 110 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 110 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
| 111 | String sex = cardinfoBean.getGender(); | 111 | String sex = cardinfoBean.getGender(); |
| 112 | if ("0".equals(sex)) { | 112 | if ("0".equals(sex)) { |
| 113 | tv_sex.setText("男"); | 113 | tv_sex.setText("男"); |
| 114 | iv_sex.setImageResource(R.mipmap.men); | 114 | iv_sex.setImageResource(R.mipmap.men); |
| 115 | } else { | 115 | } else { |
| 116 | tv_sex.setText("女"); | 116 | tv_sex.setText("女"); |
| 117 | iv_sex.setImageResource(R.mipmap.women); | 117 | iv_sex.setImageResource(R.mipmap.women); |
| 118 | } | 118 | } |
| 119 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | 119 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); |
| 120 | //加载星座 | 120 | //加载星座 |
| 121 | BrithdayStar brithdayStar = new BrithdayStar(); | 121 | BrithdayStar brithdayStar = new BrithdayStar(); |
| 122 | if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) { | 122 | if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) { |
| 123 | tv_mygad.setText(""); | 123 | tv_mygad.setText(""); |
| 124 | } else { | 124 | } else { |
| 125 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); | 125 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); |
| 126 | tv_mygad.setText(xiongzuo); | 126 | tv_mygad.setText(xiongzuo); |
| 127 | } | 127 | } |
| 128 | //保存个人信息 | 128 | //保存个人信息 |
| 129 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName()); | 129 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName()); |
| 130 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName()); | 130 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName()); |
| 131 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName()); | 131 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName()); |
| 132 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday()); | 132 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday()); |
| 133 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString()); | 133 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString()); |
| 134 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq()); | 134 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq()); |
| 135 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName()); | 135 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName()); |
| 136 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress()); | 136 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress()); |
| 137 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId()); | 137 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId()); |
| 138 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait()); | 138 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait()); |
| 139 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId()); | 139 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId()); |
| 140 | String graderID = cardinfoBean.getGrade().getGradeId(); | 140 | String graderID = cardinfoBean.getGrade().getGradeId(); |
| 141 | Log.e("test", "nianji" + graderID); | 141 | Log.e("test", "nianji" + graderID); |
| 142 | try { | 142 | try { |
| 143 | long auserID = Long.parseLong(graderID); | 143 | long auserID = Long.parseLong(graderID); |
| 144 | String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | 144 | String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); |
| 145 | // if ((auserID < 8) && (ss == null)) { | 145 | // if ((auserID < 8) && (ss == null)) { |
| 146 | // Intent intentbroad = new Intent(); | 146 | // Intent intentbroad = new Intent(); |
| 147 | // intentbroad.putExtra("info", "小学"); | 147 | // intentbroad.putExtra("info", "小学"); |
| 148 | // //4、定义广播发送的action | 148 | // //4、定义广播发送的action |
| 149 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 149 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
| 150 | // //5、发送广播 | 150 | // //5、发送广播 |
| 151 | // sendBroadcast(intentbroad); | 151 | // sendBroadcast(intentbroad); |
| 152 | // Log.i("---", "发送完了"); | 152 | // Log.i("---", "发送完了"); |
| 153 | // } | 153 | // } |
| 154 | } catch (NumberFormatException e) { | 154 | } catch (NumberFormatException e) { |
| 155 | e.printStackTrace(); | 155 | e.printStackTrace(); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | 158 | ||
| 159 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); | 159 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); |
| 160 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 160 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
| 161 | //账户类型 | 161 | //账户类型 |
| 162 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 162 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
| 163 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 163 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
| 164 | 164 | ||
| 165 | try { | 165 | try { |
| 166 | Object auserID; | 166 | Object auserID; |
| 167 | int type; | 167 | int type; |
| 168 | int graderIDs = Integer.parseInt(graderID); | 168 | int graderIDs = Integer.parseInt(graderID); |
| 169 | if ("2".equals(accounts)) { | 169 | if ("2".equals(accounts)) { |
| 170 | type = Integer.parseInt(accounts); | 170 | type = Integer.parseInt(accounts); |
| 171 | auserID = childID; | 171 | auserID = childID; |
| 172 | } else { | 172 | } else { |
| 173 | type = Integer.parseInt(accounts); | 173 | type = Integer.parseInt(accounts); |
| 174 | auserID = Long.parseLong(userID); | 174 | auserID = Long.parseLong(userID); |
| 175 | } | 175 | } |
| 176 | //获取版本信息 | 176 | //获取版本信息 |
| 177 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); | 177 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); |
| 178 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); | 178 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); |
| 179 | 179 | ||
| 180 | } catch (NumberFormatException e) { | 180 | } catch (NumberFormatException e) { |
| 181 | e.printStackTrace(); | 181 | e.printStackTrace(); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | break; | 184 | break; |
| 185 | case HttpCode.SIGN: | 185 | case HttpCode.SIGN: |
| 186 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; | 186 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; |
| 187 | if (dataBean.getSignature() == null) { | 187 | if (dataBean.getSignature() == null) { |
| 188 | tv_sign.setText("你还未设置个性签名"); | 188 | tv_sign.setText("你还未设置个性签名"); |
| 189 | } else { | 189 | } else { |
| 190 | tv_sign.setText(dataBean.getSignature()); | 190 | tv_sign.setText(dataBean.getSignature()); |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | break; | 193 | break; |
| 194 | case HttpCode.PUBLISH_SUCESS: | 194 | case HttpCode.PUBLISH_SUCESS: |
| 195 | defautPublishInfos.clear(); | 195 | defautPublishInfos.clear(); |
| 196 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 196 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
| 197 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 197 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
| 198 | Gson gson = new Gson(); | 198 | Gson gson = new Gson(); |
| 199 | Log.e("test", "(List<DefautPublishInfo.DataBean>) msg.obj" + gson.toJson(msg.obj)); | 199 | Log.e("test", "(List<DefautPublishInfo.DataBean>) msg.obj" + gson.toJson(msg.obj)); |
| 200 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj)); | 200 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj)); |
| 201 | break; | 201 | break; |
| 202 | case HttpCode.GETVIDIO_SUCESS: | 202 | case HttpCode.GETVIDIO_SUCESS: |
| 203 | videoinfo.clear(); | 203 | videoinfo.clear(); |
| 204 | view_novedeo.setVisibility(View.GONE); | 204 | view_novedeo.setVisibility(View.GONE); |
| 205 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); | 205 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); |
| 206 | RecyclerViewadapter.notifyDataSetChanged(); | 206 | RecyclerViewadapter.notifyDataSetChanged(); |
| 207 | break; | 207 | break; |
| 208 | case HttpCode.SUCHCARDINFOONE: | 208 | case HttpCode.SUCHCARDINFOONE: |
| 209 | JSONObject jsonObject; | 209 | JSONObject jsonObject; |
| 210 | String status; | 210 | String status; |
| 211 | try { | 211 | try { |
| 212 | jsonObject = new JSONObject((String) msg.obj); | 212 | jsonObject = new JSONObject((String) msg.obj); |
| 213 | status = jsonObject.getString("status"); | 213 | status = jsonObject.getString("status"); |
| 214 | if (status.equals("1")) { | 214 | if (status.equals("1")) { |
| 215 | sssssssss.setVisibility(View.VISIBLE); | 215 | sssssssss.setVisibility(View.VISIBLE); |
| 216 | tv_yangji.setVisibility(View.INVISIBLE); | 216 | tv_yangji.setVisibility(View.INVISIBLE); |
| 217 | iv_look_card.setVisibility(View.VISIBLE); | 217 | iv_look_card.setVisibility(View.VISIBLE); |
| 218 | //客机没有保卡 | 218 | //客机没有保卡 |
| 219 | } else if (status.equals("2001")) { | 219 | } else if (status.equals("2001")) { |
| 220 | sssssssss.setVisibility(View.VISIBLE); | 220 | sssssssss.setVisibility(View.VISIBLE); |
| 221 | tv_yangji.setVisibility(View.INVISIBLE); | 221 | tv_yangji.setVisibility(View.INVISIBLE); |
| 222 | iv_look_card.setVisibility(View.VISIBLE); | 222 | iv_look_card.setVisibility(View.VISIBLE); |
| 223 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录"); | 223 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录"); |
| 224 | Intent settingintent = new Intent(); | 224 | Intent settingintent = new Intent(); |
| 225 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 225 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 226 | startActivity(settingintent); | 226 | startActivity(settingintent); |
| 227 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 227 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 228 | } else if (status.equals("2002")) {//样机 | 228 | } else if (status.equals("2002")) {//样机 |
| 229 | sssssssss.setVisibility(View.INVISIBLE); | 229 | sssssssss.setVisibility(View.INVISIBLE); |
| 230 | iv_look_card.setVisibility(View.INVISIBLE); | 230 | iv_look_card.setVisibility(View.INVISIBLE); |
| 231 | tv_yangji.setVisibility(View.VISIBLE); | 231 | tv_yangji.setVisibility(View.VISIBLE); |
| 232 | 232 | ||
| 233 | } else { | 233 | } else { |
| 234 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); | 234 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); |
| 235 | } | 235 | } |
| 236 | } catch (JSONException e) { | 236 | } catch (JSONException e) { |
| 237 | e.printStackTrace(); | 237 | e.printStackTrace(); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | 240 | ||
| 241 | } | 241 | } |
| 242 | } | 242 | } |
| 243 | }; | 243 | }; |
| 244 | 244 | ||
| 245 | @Override | 245 | @Override |
| 246 | protected void onCreate(Bundle savedInstanceState) { | 246 | protected void onCreate(Bundle savedInstanceState) { |
| 247 | super.onCreate(savedInstanceState); | 247 | super.onCreate(savedInstanceState); |
| 248 | Fresco.initialize(this); | 248 | Fresco.initialize(this); |
| 249 | setContentView(R.layout.activity_main); | 249 | setContentView(R.layout.activity_main); |
| 250 | SysApplication.getInstance().addActivity(this); | 250 | SysApplication.getInstance().addActivity(this); |
| 251 | initView(); | 251 | initView(); |
| 252 | initData(); | 252 | initData(); |
| 253 | initLister(); | 253 | initLister(); |
| 254 | updateVersion(); | 254 | updateVersion(); |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | //////版本更新 | 257 | //////版本更新 |
| 258 | private void updateVersion() { | 258 | private void updateVersion() { |
| 259 | UpdateChecker updateChecker = new UpdateChecker(this); | 259 | UpdateChecker updateChecker = new UpdateChecker(this); |
| 260 | updateChecker.checkForUpdates(); | 260 | updateChecker.checkForUpdates(); |
| 261 | 261 | ||
| 262 | 262 | ||
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | private void initView() { | 265 | private void initView() { |
| 266 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 266 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
| 267 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); | 267 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); |
| 268 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); | 268 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); |
| 269 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 269 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
| 270 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 270 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
| 271 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 271 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
| 272 | //头像 | 272 | //头像 |
| 273 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 273 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
| 274 | //初始化个人信息 | 274 | //初始化个人信息 |
| 275 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 275 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
| 276 | tv_username = (TextView) findViewById(R.id.tv_username); | 276 | tv_username = (TextView) findViewById(R.id.tv_username); |
| 277 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 277 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
| 278 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 278 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
| 279 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 279 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
| 280 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 280 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
| 281 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 281 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
| 282 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 282 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
| 283 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 283 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
| 284 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 284 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
| 285 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); | 285 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); |
| 286 | //跳转其他应用 | 286 | //跳转其他应用 |
| 287 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); | 287 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); |
| 288 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); | 288 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); |
| 289 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); | 289 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); |
| 290 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); | 290 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); |
| 291 | // | 291 | // |
| 292 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 292 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
| 293 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); | 293 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); |
| 294 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); | 294 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); |
| 295 | 295 | ||
| 296 | sssssssss = findViewById(R.id.sssssssss); | 296 | sssssssss = findViewById(R.id.sssssssss); |
| 297 | 297 | ||
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | 300 | ||
| 301 | private void initData() { | 301 | private void initData() { |
| 302 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 302 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
| 303 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 303 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 304 | uri = Uri.fromFile(file); | 304 | uri = Uri.fromFile(file); |
| 305 | } else { | 305 | } else { |
| 306 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 306 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
| 307 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 307 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
| 308 | } | 308 | } |
| 309 | //设置布局管理器 | 309 | //设置布局管理器 |
| 310 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 310 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
| 311 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); | 311 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); |
| 312 | 312 | ||
| 313 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); | 313 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); |
| 314 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); | 314 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); |
| 315 | 315 | ||
| 316 | mRecyclerView.setLayoutManager(linearLayoutManager); | 316 | mRecyclerView.setLayoutManager(linearLayoutManager); |
| 317 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); | 317 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); |
| 318 | 318 | ||
| 319 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); | 319 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); |
| 320 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); | 320 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); |
| 321 | 321 | ||
| 322 | //设置视频适配器 | 322 | //设置视频适配器 |
| 323 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); | 323 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); |
| 324 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this); | 324 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this); |
| 325 | 325 | ||
| 326 | //版本信息适配器 | 326 | //版本信息适配器 |
| 327 | mRecyclerView.setAdapter(RecyclerViewadapter); | 327 | mRecyclerView.setAdapter(RecyclerViewadapter); |
| 328 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | 328 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); |
| 329 | 329 | ||
| 330 | //判断保卡信息是否为样机 | 330 | //判断保卡信息是否为样机 |
| 331 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); | 331 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); |
| 332 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); | 332 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); |
| 333 | Log.d("test","yangji"+yangji); | 333 | Log.d("test","yangji"+yangji); |
| 334 | if ("1".equals(yangji)) { | 334 | if ("1".equals(yangji)) { |
| 335 | sssssssss.setVisibility(View.INVISIBLE); | 335 | sssssssss.setVisibility(View.INVISIBLE); |
| 336 | iv_look_card.setVisibility(View.INVISIBLE); | 336 | iv_look_card.setVisibility(View.INVISIBLE); |
| 337 | tv_yangji.setVisibility(View.VISIBLE); | 337 | tv_yangji.setVisibility(View.VISIBLE); |
| 338 | } else { | 338 | } else { |
| 339 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.YANGJI, "0"); | 339 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.YANGJI, "0"); |
| 340 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); | 340 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); |
| 341 | 341 | ||
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | 344 | ||
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | private void initLister() { | 347 | private void initLister() { |
| 348 | iv_imformatioan.setOnClickListener(this); | 348 | iv_imformatioan.setOnClickListener(this); |
| 349 | iv_look_card.setOnClickListener(this); | 349 | iv_look_card.setOnClickListener(this); |
| 350 | tv_edit_presoninfo.setOnClickListener(this); | 350 | tv_edit_presoninfo.setOnClickListener(this); |
| 351 | iv_setting.setOnClickListener(this); | 351 | iv_setting.setOnClickListener(this); |
| 352 | iv_sign.setOnClickListener(this); | 352 | iv_sign.setOnClickListener(this); |
| 353 | mSimpleDraweeView.setOnClickListener(this); | 353 | mSimpleDraweeView.setOnClickListener(this); |
| 354 | linel_mycuoti.setOnClickListener(this); | 354 | linel_mycuoti.setOnClickListener(this); |
| 355 | linel_mynote.setOnClickListener(this); | 355 | linel_mynote.setOnClickListener(this); |
| 356 | linel_mycollege.setOnClickListener(this); | 356 | linel_mycollege.setOnClickListener(this); |
| 357 | linel_myclass.setOnClickListener(this); | 357 | linel_myclass.setOnClickListener(this); |
| 358 | 358 | ||
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | @Override | 361 | @Override |
| 362 | public void onClick(View v) { | 362 | public void onClick(View v) { |
| 363 | switch (v.getId()) { | 363 | switch (v.getId()) { |
| 364 | case R.id.iv_imformatioan: | 364 | case R.id.iv_imformatioan: |
| 365 | Intent intent = new Intent(); | 365 | Intent intent = new Intent(); |
| 366 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 366 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
| 367 | startActivity(intent); | 367 | startActivity(intent); |
| 368 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 368 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 369 | break; | 369 | break; |
| 370 | case R.id.iv_look_card: | 370 | case R.id.iv_look_card: |
| 371 | Intent lookintent = new Intent(); | 371 | Intent lookintent = new Intent(); |
| 372 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 372 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
| 373 | startActivity(lookintent); | 373 | startActivity(lookintent); |
| 374 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 374 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 375 | break; | 375 | break; |
| 376 | case R.id.tv_edit_presoninfo: | 376 | case R.id.tv_edit_presoninfo: |
| 377 | Intent editintent = new Intent(); | 377 | Intent editintent = new Intent(); |
| 378 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 378 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
| 379 | startActivity(editintent); | 379 | startActivity(editintent); |
| 380 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 380 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 381 | break; | 381 | break; |
| 382 | case R.id.iv_head: | 382 | case R.id.iv_head: |
| 383 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 383 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
| 384 | break; | 384 | break; |
| 385 | case R.id.iv_setting: | 385 | case R.id.iv_setting: |
| 386 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 386 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
| 387 | List<MenuItem> menuItems = new ArrayList<>(); | 387 | List<MenuItem> menuItems = new ArrayList<>(); |
| 388 | menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户")); | 388 | menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户")); |
| 389 | menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理")); | 389 | menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理")); |
| 390 | mTopRightMenu | 390 | mTopRightMenu |
| 391 | .setHeight(150) //默认高度480 | 391 | .setHeight(150) //默认高度480 |
| 392 | .setWidth(180) //默认宽度wrap_content | 392 | .setWidth(180) //默认宽度wrap_content |
| 393 | .showIcon(showIcon) //显示菜单图标,默认为true | 393 | .showIcon(showIcon) //显示菜单图标,默认为true |
| 394 | .dimBackground(dimBg) //背景变暗,默认为true | 394 | .dimBackground(dimBg) //背景变暗,默认为true |
| 395 | .needAnimationStyle(needAnim) //显示动画,默认为true | 395 | .needAnimationStyle(needAnim) //显示动画,默认为true |
| 396 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 396 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
| 397 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 397 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
| 398 | @Override | 398 | @Override |
| 399 | public void onMenuItemClick(int position) { | 399 | public void onMenuItemClick(int position) { |
| 400 | switch (position) { | 400 | switch (position) { |
| 401 | case 0: | 401 | case 0: |
| 402 | new CircleDialog.Builder(MainActivity.this) | 402 | new CircleDialog.Builder(MainActivity.this) |
| 403 | .setCanceledOnTouchOutside(false) | 403 | .setCanceledOnTouchOutside(false) |
| 404 | .setWidth(0.4f) | 404 | .setWidth(0.4f) |
| 405 | .setCancelable(false) | 405 | .setCancelable(false) |
| 406 | .setText("您确定要退出,更换其他账号登录吗?") | 406 | .setText("您确定要退出,更换其他账号登录吗?") |
| 407 | .setNegative("取消", null) | 407 | .setNegative("取消", null) |
| 408 | .setPositive("确定", new View.OnClickListener() { | 408 | .setPositive("确定", new View.OnClickListener() { |
| 409 | @Override | 409 | @Override |
| 410 | public void onClick(View v) { | 410 | public void onClick(View v) { |
| 411 | //String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | 411 | //String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); |
| 412 | //int graderIDs = Integer.parseInt(graderID); | 412 | //int graderIDs = Integer.parseInt(graderID); |
| 413 | // if (graderIDs < 8) { | 413 | // if (graderIDs < 8) { |
| 414 | // Intent intentbroad = new Intent(); | 414 | // Intent intentbroad = new Intent(); |
| 415 | // intentbroad.putExtra("info", "小学"); | 415 | // intentbroad.putExtra("info", "小学"); |
| 416 | // //4、定义广播发送的action | 416 | // //4、定义广播发送的action |
| 417 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 417 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
| 418 | // //5、发送广播 | 418 | // //5、发送广播 |
| 419 | // sendBroadcast(intentbroad); | 419 | // sendBroadcast(intentbroad); |
| 420 | // Log.i("---", "发送完了"); | 420 | // Log.i("---", "发送完了"); |
| 421 | // } | 421 | // } |
| 422 | //清除数据 | 422 | //清除数据 |
| 423 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this,SaveParam.ACCOUNT,"1"); | ||
| 423 | SaveParam.getInstance().clearData(MainActivity.this); | 424 | SaveParam.getInstance().clearData(MainActivity.this); |
| 424 | Intent settingintent = new Intent(); | 425 | Intent settingintent = new Intent(); |
| 425 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 426 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 426 | startActivity(settingintent); | 427 | startActivity(settingintent); |
| 427 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 428 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 428 | finish(); | 429 | finish(); |
| 429 | } | 430 | } |
| 430 | }) | 431 | }) |
| 431 | .show(); | 432 | .show(); |
| 432 | break; | 433 | break; |
| 433 | case 1: | 434 | case 1: |
| 434 | Intent accontMintent = new Intent(); | 435 | Intent accontMintent = new Intent(); |
| 435 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 436 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
| 436 | startActivity(accontMintent); | 437 | startActivity(accontMintent); |
| 437 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 438 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 438 | break; | 439 | break; |
| 439 | } | 440 | } |
| 440 | } | 441 | } |
| 441 | }) | 442 | }) |
| 442 | .addMenuList(menuItems) | 443 | .addMenuList(menuItems) |
| 443 | .showAsDropDown(iv_setting, -120, 0); | 444 | .showAsDropDown(iv_setting, -120, 0); |
| 444 | break; | 445 | break; |
| 445 | case R.id.iv_sign: | 446 | case R.id.iv_sign: |
| 446 | new CircleDialog.Builder(this) | 447 | new CircleDialog.Builder(this) |
| 447 | .setCanceledOnTouchOutside(false) | 448 | .setCanceledOnTouchOutside(false) |
| 448 | .setCancelable(true) | 449 | .setCancelable(true) |
| 449 | .setTitle("个性签名") | 450 | .setTitle("个性签名") |
| 450 | .setInputHint("请输入个性签名") | 451 | .setInputHint("请输入个性签名") |
| 451 | .setWidth(0.4f) | 452 | .setWidth(0.4f) |
| 452 | .setInputHeight(80) | 453 | .setInputHeight(80) |
| 453 | .configInput(new ConfigInput() { | 454 | .configInput(new ConfigInput() { |
| 454 | @Override | 455 | @Override |
| 455 | public void onConfig(InputParams params) { | 456 | public void onConfig(InputParams params) { |
| 456 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 457 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
| 457 | } | 458 | } |
| 458 | }) | 459 | }) |
| 459 | .setNegative("取消", new View.OnClickListener() { | 460 | .setNegative("取消", new View.OnClickListener() { |
| 460 | @Override | 461 | @Override |
| 461 | public void onClick(View v) { | 462 | public void onClick(View v) { |
| 462 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 463 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
| 463 | } | 464 | } |
| 464 | }) | 465 | }) |
| 465 | .setPositiveInput("确定", new OnInputClickListener() { | 466 | .setPositiveInput("确定", new OnInputClickListener() { |
| 466 | @Override | 467 | @Override |
| 467 | public void onClick(String text, View v) { | 468 | public void onClick(String text, View v) { |
| 468 | if (text.equals("")) { | 469 | if (text.equals("")) { |
| 469 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 470 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
| 470 | } else { | 471 | } else { |
| 471 | try { | 472 | try { |
| 472 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 473 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
| 473 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 474 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
| 474 | String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 475 | String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
| 475 | Object id = null; | 476 | Object id = null; |
| 476 | long auserID = Long.parseLong(userID); | 477 | long auserID = Long.parseLong(userID); |
| 477 | int typeaccount1 = Integer.parseInt(typeaccount); | 478 | int typeaccount1 = Integer.parseInt(typeaccount); |
| 478 | if (typeaccount1 ==2){ | 479 | if (typeaccount1 ==2){ |
| 479 | id =childsID; | 480 | id =childsID; |
| 480 | }else { | 481 | }else { |
| 481 | id =auserID; | 482 | id =auserID; |
| 482 | } | 483 | } |
| 483 | HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text); | 484 | HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text); |
| 484 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 485 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
| 485 | } catch (NumberFormatException e) { | 486 | } catch (NumberFormatException e) { |
| 486 | e.printStackTrace(); | 487 | e.printStackTrace(); |
| 487 | } | 488 | } |
| 488 | 489 | ||
| 489 | tv_sign.setText(text); | 490 | tv_sign.setText(text); |
| 490 | } | 491 | } |
| 491 | 492 | ||
| 492 | } | 493 | } |
| 493 | }) | 494 | }) |
| 494 | .show(); | 495 | .show(); |
| 495 | break; | 496 | break; |
| 496 | case R.id.linel_mycuoti: | 497 | case R.id.linel_mycuoti: |
| 497 | AlertUtils.showToast(this, "未安装该应用 "); | 498 | AlertUtils.showToast(this, "未安装该应用 "); |
| 498 | break; | 499 | break; |
| 499 | case R.id.linel_mynote: | 500 | case R.id.linel_mynote: |
| 500 | AlertUtils.showToast(this, "未安装该应用 "); | 501 | AlertUtils.showToast(this, "未安装该应用 "); |
| 501 | break; | 502 | break; |
| 502 | case R.id.linel_mycollege: | 503 | case R.id.linel_mycollege: |
| 503 | AlertUtils.showToast(this, "未安装该应用 "); | 504 | AlertUtils.showToast(this, "未安装该应用 "); |
| 504 | break; | 505 | break; |
| 505 | case R.id.linel_myclass: | 506 | case R.id.linel_myclass: |
| 506 | AlertUtils.showToast(this, "未安装该应用 "); | 507 | AlertUtils.showToast(this, "未安装该应用 "); |
| 507 | break; | 508 | break; |
| 508 | } | 509 | } |
| 509 | 510 | ||
| 510 | } | 511 | } |
| 511 | 512 | ||
| 512 | @Override | 513 | @Override |
| 513 | protected void onPause() { | 514 | protected void onPause() { |
| 514 | super.onPause(); | 515 | super.onPause(); |
| 515 | } | 516 | } |
| 516 | 517 | ||
| 517 | @Override | 518 | @Override |
| 518 | protected void onResume() { | 519 | protected void onResume() { |
| 519 | super.onResume(); | 520 | super.onResume(); |
| 520 | Content.changegradeinfoflag = 0; | 521 | Content.changegradeinfoflag = 0; |
| 521 | Content.changeadressinfoflag = 0; | 522 | Content.changeadressinfoflag = 0; |
| 522 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 523 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 523 | //获取个性签名 | 524 | //获取个性签名 |
| 524 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 525 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 525 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 526 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
| 526 | 527 | ||
| 527 | try { | 528 | try { |
| 528 | Object auserID = 1; | 529 | Object auserID = 1; |
| 529 | long id = Long.parseLong(userID); | 530 | long id = Long.parseLong(userID); |
| 530 | int typeaccount1 = Integer.parseInt(typeaccount); | 531 | int typeaccount1 = Integer.parseInt(typeaccount); |
| 531 | //获取个人信息 | 532 | //获取个人信息 |
| 532 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler); | 533 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler); |
| 533 | if (typeaccount1 == 2) { | 534 | if (typeaccount1 == 2) { |
| 534 | auserID = childsID; | 535 | auserID = childsID; |
| 535 | } else { | 536 | } else { |
| 536 | auserID = id; | 537 | auserID = id; |
| 537 | } | 538 | } |
| 538 | Log.e("test","个性签名的ID"+auserID); | 539 | Log.e("test","个性签名的ID"+auserID); |
| 539 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); | 540 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); |
| 540 | //获取最近播放视频 | 541 | //获取最近播放视频 |
| 541 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); | 542 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); |
| 542 | 543 | ||
| 543 | } catch (NumberFormatException e) { | 544 | } catch (NumberFormatException e) { |
| 544 | e.printStackTrace(); | 545 | e.printStackTrace(); |
| 545 | } | 546 | } |
| 546 | 547 | ||
| 547 | } | 548 | } |
| 548 | 549 | ||
| 549 | //回调头像监听 | 550 | //回调头像监听 |
| 550 | @Override | 551 | @Override |
| 551 | public void heard(Context context, View v, int headpitiaon) { | 552 | public void heard(Context context, View v, int headpitiaon) { |
| 552 | String picUrl = ""; | 553 | String picUrl = ""; |
| 553 | String userID; | 554 | String userID; |
| 554 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 555 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 555 | if ("2".equals(typeaccount)) { | 556 | if ("2".equals(typeaccount)) { |
| 556 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 557 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
| 557 | } else { | 558 | } else { |
| 558 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 559 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 559 | } | 560 | } |
| 560 | switch (v.getId()) { | 561 | switch (v.getId()) { |
| 561 | //选择默认图片 | 562 | //选择默认图片 |
| 562 | case R.id.oktakephone: | 563 | case R.id.oktakephone: |
| 563 | if (headpitiaon == 1) { | 564 | if (headpitiaon == 1) { |
| 564 | mSimpleDraweeView.setImageDrawable(null); | 565 | mSimpleDraweeView.setImageDrawable(null); |
| 565 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 566 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
| 566 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/75f05c02-3dbc-44e3-aec9-a73eca60ca8b.png"; | 567 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/75f05c02-3dbc-44e3-aec9-a73eca60ca8b.png"; |
| 567 | try { | 568 | try { |
| 568 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 569 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 569 | } catch (UnsupportedEncodingException e) { | 570 | } catch (UnsupportedEncodingException e) { |
| 570 | e.printStackTrace(); | 571 | e.printStackTrace(); |
| 571 | } | 572 | } |
| 572 | } else if (headpitiaon == 2) { | 573 | } else if (headpitiaon == 2) { |
| 573 | mSimpleDraweeView.setImageDrawable(null); | 574 | mSimpleDraweeView.setImageDrawable(null); |
| 574 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 575 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
| 575 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/d102b0d8-435f-45a5-908f-ea43e02176d4.png"; | 576 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/d102b0d8-435f-45a5-908f-ea43e02176d4.png"; |
| 576 | try { | 577 | try { |
| 577 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 578 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 578 | } catch (UnsupportedEncodingException e) { | 579 | } catch (UnsupportedEncodingException e) { |
| 579 | e.printStackTrace(); | 580 | e.printStackTrace(); |
| 580 | } | 581 | } |
| 581 | } else if (headpitiaon == 3) { | 582 | } else if (headpitiaon == 3) { |
| 582 | mSimpleDraweeView.setImageDrawable(null); | 583 | mSimpleDraweeView.setImageDrawable(null); |
| 583 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 584 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
| 584 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/a623a8ba-5e56-4827-95d1-ffeb0d6874d5.png"; | 585 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/a623a8ba-5e56-4827-95d1-ffeb0d6874d5.png"; |
| 585 | try { | 586 | try { |
| 586 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 587 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 587 | } catch (UnsupportedEncodingException e) { | 588 | } catch (UnsupportedEncodingException e) { |
| 588 | e.printStackTrace(); | 589 | e.printStackTrace(); |
| 589 | } | 590 | } |
| 590 | } else if (headpitiaon == 4) { | 591 | } else if (headpitiaon == 4) { |
| 591 | mSimpleDraweeView.setImageDrawable(null); | 592 | mSimpleDraweeView.setImageDrawable(null); |
| 592 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 593 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
| 593 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/3d822736-a18d-47ae-b0b1-67752e027375.png"; | 594 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/3d822736-a18d-47ae-b0b1-67752e027375.png"; |
| 594 | try { | 595 | try { |
| 595 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 596 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
| 596 | } catch (UnsupportedEncodingException e) { | 597 | } catch (UnsupportedEncodingException e) { |
| 597 | e.printStackTrace(); | 598 | e.printStackTrace(); |
| 598 | } | 599 | } |
| 599 | } else { | 600 | } else { |
| 600 | mSimpleDraweeView.setImageDrawable(null); | 601 | mSimpleDraweeView.setImageDrawable(null); |
| 601 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); | 602 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); |
| 602 | ; | 603 | ; |
| 603 | } | 604 | } |
| 604 | 605 | ||
| 605 | break; | 606 | break; |
| 606 | case R.id.canceltakephone: | 607 | case R.id.canceltakephone: |
| 607 | 608 | ||
| 608 | break; | 609 | break; |
| 609 | //拍摄和相册 | 610 | //拍摄和相册 |
| 610 | case R.id.take_pic: | 611 | case R.id.take_pic: |
| 611 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 612 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
| 612 | uploadAvatarFromPhotoRequest(); | 613 | uploadAvatarFromPhotoRequest(); |
| 613 | } | 614 | } |
| 614 | break; | 615 | break; |
| 615 | case R.id.xiangce: | 616 | case R.id.xiangce: |
| 616 | uploadAvatarFromAlbumRequest(); | 617 | uploadAvatarFromAlbumRequest(); |
| 617 | break; | 618 | break; |
| 618 | 619 | ||
| 619 | } | 620 | } |
| 620 | 621 | ||
| 621 | } | 622 | } |
| 622 | 623 | ||
| 623 | //照相 | 624 | //照相 |
| 624 | private void uploadAvatarFromPhotoRequest() { | 625 | private void uploadAvatarFromPhotoRequest() { |
| 625 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 626 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
| 626 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 627 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 627 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 628 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
| 628 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 629 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
| 629 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 630 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
| 630 | } | 631 | } |
| 631 | 632 | ||
| 632 | //选择图库 | 633 | //选择图库 |
| 633 | private void uploadAvatarFromAlbumRequest() { | 634 | private void uploadAvatarFromAlbumRequest() { |
| 634 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 635 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
| 635 | photoPickerIntent.setType("image/*"); | 636 | photoPickerIntent.setType("image/*"); |
| 636 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 637 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
| 637 | } | 638 | } |
| 638 | 639 | ||
| 639 | //回掉 | 640 | //回掉 |
| 640 | @Override | 641 | @Override |
| 641 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 642 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 642 | super.onActivityResult(requestCode, resultCode, data); | 643 | super.onActivityResult(requestCode, resultCode, data); |
| 643 | if (resultCode != -1) { | 644 | if (resultCode != -1) { |
| 644 | return; | 645 | return; |
| 645 | } | 646 | } |
| 646 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 647 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
| 647 | Uri newUri; | 648 | Uri newUri; |
| 648 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 649 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 649 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 650 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
| 650 | } else { | 651 | } else { |
| 651 | newUri = data.getData(); | 652 | newUri = data.getData(); |
| 652 | } | 653 | } |
| 653 | if (newUri != null) { | 654 | if (newUri != null) { |
| 654 | startPhotoZoom(newUri); | 655 | startPhotoZoom(newUri); |
| 655 | } else { | 656 | } else { |
| 656 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 657 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
| 657 | } | 658 | } |
| 658 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 659 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
| 659 | //startPhotoZoom(uri); | 660 | //startPhotoZoom(uri); |
| 660 | uploadAvatarFromPhoto(); | 661 | uploadAvatarFromPhoto(); |
| 661 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 662 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
| 662 | uploadAvatarFromPhoto(); | 663 | uploadAvatarFromPhoto(); |
| 663 | } | 664 | } |
| 664 | } | 665 | } |
| 665 | 666 | ||
| 666 | private void uploadAvatarFromPhoto() { | 667 | private void uploadAvatarFromPhoto() { |
| 667 | compressAndUploadAvatar(file.getPath()); | 668 | compressAndUploadAvatar(file.getPath()); |
| 668 | 669 | ||
| 669 | } | 670 | } |
| 670 | 671 | ||
| 671 | private void compressAndUploadAvatar(String fileSrc) { | 672 | private void compressAndUploadAvatar(String fileSrc) { |
| 672 | 673 | ||
| 673 | 674 | ||
| 674 | //上传到服务器 | 675 | //上传到服务器 |
| 675 | 676 | ||
| 676 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 677 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
| 677 | String mimeType = "image/*"; | 678 | String mimeType = "image/*"; |
| 678 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 679 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
| 679 | //String fileName = cover.getName(); | 680 | //String fileName = cover.getName(); |
| 680 | String userID; | 681 | String userID; |
| 681 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 682 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
| 682 | if ("2".equals(typeaccount)) { | 683 | if ("2".equals(typeaccount)) { |
| 683 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 684 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
| 684 | } else { | 685 | } else { |
| 685 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 686 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
| 686 | } | 687 | } |
| 687 | 688 | ||
| 688 | //上传头像 | 689 | //上传头像 |
| 689 | 690 | ||
| 690 | try { | 691 | try { |
| 691 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc); | 692 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc); |
| 692 | } catch (UnsupportedEncodingException e) { | 693 | } catch (UnsupportedEncodingException e) { |
| 693 | e.printStackTrace(); | 694 | e.printStackTrace(); |
| 694 | } | 695 | } |
| 695 | 696 | ||
| 696 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 697 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
| 697 | GenericDraweeHierarchy hierarchy = builder | 698 | GenericDraweeHierarchy hierarchy = builder |
| 698 | .setDesiredAspectRatio(1f) | 699 | .setDesiredAspectRatio(1f) |
| 699 | .setFailureImage(R.mipmap.header_default) | 700 | .setFailureImage(R.mipmap.header_default) |
| 700 | //圆形头像 | 701 | //圆形头像 |
| 701 | .setRoundingParams(RoundingParams.asCircle()) | 702 | .setRoundingParams(RoundingParams.asCircle()) |
| 702 | .build(); | 703 | .build(); |
| 703 | 704 | ||
| 704 | //加载本地图片 | 705 | //加载本地图片 |
| 705 | Uri uri = Uri.fromFile(cover); | 706 | Uri uri = Uri.fromFile(cover); |
| 706 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 707 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
| 707 | .setOldController(mSimpleDraweeView.getController()) | 708 | .setOldController(mSimpleDraweeView.getController()) |
| 708 | .setUri(uri) | 709 | .setUri(uri) |
| 709 | .build(); | 710 | .build(); |
| 710 | mSimpleDraweeView.setHierarchy(hierarchy); | 711 | mSimpleDraweeView.setHierarchy(hierarchy); |
| 711 | mSimpleDraweeView.setController(controller); | 712 | mSimpleDraweeView.setController(controller); |
| 712 | 713 | ||
| 713 | } | 714 | } |
| 714 | 715 | ||
| 715 | public void startPhotoZoom(Uri uri) { | 716 | public void startPhotoZoom(Uri uri) { |
| 716 | Intent intent = new Intent("com.android.camera.action.CROP"); | 717 | Intent intent = new Intent("com.android.camera.action.CROP"); |
| 717 | intent.setDataAndType(uri, "image/*"); | 718 | intent.setDataAndType(uri, "image/*"); |
| 718 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 719 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 719 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 720 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
| 720 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 721 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
| 721 | intent.putExtra("aspectY", 1);// x:y=1:1 | 722 | intent.putExtra("aspectY", 1);// x:y=1:1 |
| 722 | // intent.putExtra("outputX", 400);//图片输出大小 | 723 | // intent.putExtra("outputX", 400);//图片输出大小 |
| 723 | // intent.putExtra("outputY", 400); | 724 | // intent.putExtra("outputY", 400); |
| 724 | intent.putExtra("output", Uri.fromFile(file)); | 725 | intent.putExtra("output", Uri.fromFile(file)); |
| 725 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 726 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
| 726 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 727 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
| 727 | } | 728 | } |
| 728 | 729 | ||
| 729 | @Override | 730 | @Override |
| 730 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 731 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
| 731 | switch (requestCode) { | 732 | switch (requestCode) { |
| 732 | 733 | ||
| 733 | case PermissionUtil.REQUEST_SHOWCAMERA: | 734 | case PermissionUtil.REQUEST_SHOWCAMERA: |
| 734 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 735 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
| 735 | // Permission Granted | 736 | // Permission Granted |
| 736 | uploadAvatarFromPhotoRequest(); | 737 | uploadAvatarFromPhotoRequest(); |
| 737 | 738 | ||
| 738 | } else { | 739 | } else { |
| 739 | if (!SharedPreferenceMark.getHasShowCamera()) { | 740 | if (!SharedPreferenceMark.getHasShowCamera()) { |
| 740 | SharedPreferenceMark.setHasShowCamera(true); | 741 | SharedPreferenceMark.setHasShowCamera(true); |
| 741 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 742 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
| 742 | 743 | ||
| 743 | } else { | 744 | } else { |
| 744 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 745 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
| 745 | .show(); | 746 | .show(); |
| 746 | } | 747 | } |
| 747 | } | 748 | } |
| 748 | break; | 749 | break; |
| 749 | default: | 750 | default: |
| 750 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 751 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 751 | } | 752 | } |
| 752 | } | 753 | } |
| 753 | 754 | ||
| 754 | 755 | ||
| 755 | private long exitTime = 0; | 756 | private long exitTime = 0; |
| 756 | 757 | ||
| 757 | @Override | 758 | @Override |
| 758 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 759 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| 759 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 760 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 760 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 761 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
| 761 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 762 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
| 762 | Toast.LENGTH_SHORT).show(); | 763 | Toast.LENGTH_SHORT).show(); |
| 763 | exitTime = System.currentTimeMillis(); | 764 | exitTime = System.currentTimeMillis(); |
| 764 | } else { | 765 | } else { |
| 765 | //SysApplication.getInstance().finishActivity(MainActivity.this); | 766 | //SysApplication.getInstance().finishActivity(MainActivity.this); |
| 766 | SysApplication.getInstance().exit(); | 767 | SysApplication.getInstance().exit(); |
| 767 | } | 768 | } |
| 768 | return false; | 769 | return false; |
| 769 | } | 770 | } |
| 770 | return super.onKeyDown(keyCode, event); | 771 | return super.onKeyDown(keyCode, event); |
| 771 | } | 772 | } |
| 772 | } | 773 | } |
| 773 | 774 |
PersonalCenter/app/src/main/res/layout/activity_account_management.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 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:background="@color/white" | ||
| 6 | android:orientation="vertical"> | 7 | android:orientation="vertical"> |
| 7 | 8 | ||
| 8 | <RelativeLayout | 9 | <RelativeLayout |
| 9 | android:id="@+id/title" | 10 | android:id="@+id/title" |
| 10 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 11 | android:layout_height="wrap_content" | 12 | android:layout_height="wrap_content" |
| 12 | android:background="@color/login_text_blue" | 13 | android:background="@color/login_text_blue" |
| 13 | android:minHeight="50dp"> | 14 | android:minHeight="50dp"> |
| 14 | 15 | ||
| 15 | <ImageView | 16 | <ImageView |
| 16 | android:id="@+id/cancel" | 17 | android:id="@+id/cancel" |
| 17 | android:layout_width="wrap_content" | 18 | android:layout_width="wrap_content" |
| 18 | android:layout_height="wrap_content" | 19 | android:layout_height="wrap_content" |
| 19 | android:layout_centerVertical="true" | 20 | android:layout_centerVertical="true" |
| 20 | android:paddingLeft="20dp" | 21 | android:paddingLeft="20dp" |
| 21 | android:paddingRight="20dp" | 22 | android:paddingRight="20dp" |
| 22 | android:src="@mipmap/title_back" /> | 23 | android:src="@mipmap/title_back" /> |
| 23 | 24 | ||
| 24 | <TextView | 25 | <TextView |
| 25 | android:id="@+id/menu_title" | 26 | android:id="@+id/menu_title" |
| 26 | android:layout_width="wrap_content" | 27 | android:layout_width="wrap_content" |
| 27 | android:layout_height="wrap_content" | 28 | android:layout_height="wrap_content" |
| 28 | android:layout_centerInParent="true" | 29 | android:layout_centerInParent="true" |
| 29 | android:text="@string/account_management" | 30 | android:text="@string/account_management" |
| 30 | android:textColor="@android:color/white" | 31 | android:textColor="@android:color/white" |
| 31 | android:textSize="22sp" /> | 32 | android:textSize="22sp" /> |
| 32 | </RelativeLayout> | 33 | </RelativeLayout> |
| 33 | 34 | ||
| 34 | <LinearLayout | 35 | <LinearLayout |
| 35 | android:layout_width="wrap_content" | 36 | android:layout_width="wrap_content" |
| 36 | android:layout_height="wrap_content" | 37 | android:layout_height="wrap_content" |
| 37 | android:layout_margin="20dp" | 38 | android:layout_margin="20dp" |
| 38 | android:gravity="center_vertical" | 39 | android:gravity="center_vertical" |
| 39 | android:orientation="horizontal"> | 40 | android:orientation="horizontal"> |
| 40 | 41 | ||
| 41 | <View | 42 | <View |
| 42 | android:layout_width="5dp" | 43 | android:layout_width="5dp" |
| 43 | android:layout_height="20dp" | 44 | android:layout_height="20dp" |
| 44 | android:background="@color/login_text_blue"> | 45 | android:background="@color/login_text_blue"> |
| 45 | 46 | ||
| 46 | </View> | 47 | </View> |
| 47 | 48 | ||
| 48 | <TextView | 49 | <TextView |
| 49 | android:layout_width="wrap_content" | 50 | android:layout_width="wrap_content" |
| 50 | android:layout_height="wrap_content" | 51 | android:layout_height="wrap_content" |
| 51 | android:layout_marginLeft="5dp" | 52 | android:layout_marginLeft="5dp" |
| 52 | android:text="账户安全" | 53 | android:text="账户安全" |
| 53 | android:textSize="22sp" /> | 54 | android:textSize="22sp" /> |
| 54 | 55 | ||
| 55 | </LinearLayout> | 56 | </LinearLayout> |
| 56 | 57 | ||
| 57 | <LinearLayout | 58 | <LinearLayout |
| 58 | android:layout_width="match_parent" | 59 | android:layout_width="match_parent" |
| 59 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
| 60 | android:layout_marginLeft="60dp" | 61 | android:layout_marginLeft="60dp" |
| 61 | android:orientation="vertical"> | 62 | android:orientation="vertical"> |
| 62 | 63 | ||
| 63 | <LinearLayout | 64 | <LinearLayout |
| 64 | android:layout_width="match_parent" | 65 | android:layout_width="match_parent" |
| 65 | android:layout_height="wrap_content"> | 66 | android:layout_height="wrap_content"> |
| 66 | 67 | ||
| 67 | 68 | ||
| 68 | <TextView | 69 | <TextView |
| 69 | android:layout_width="0dp" | 70 | android:layout_width="0dp" |
| 70 | android:layout_height="wrap_content" | 71 | android:layout_height="wrap_content" |
| 71 | android:layout_weight="1.5" | 72 | android:layout_weight="1.5" |
| 72 | android:text="当前绑定手机号" | 73 | android:text="当前绑定手机号" |
| 73 | android:textSize="22sp" /> | 74 | android:textSize="22sp" /> |
| 74 | 75 | ||
| 75 | <TextView | 76 | <TextView |
| 76 | android:id="@+id/cunt_username" | 77 | android:id="@+id/cunt_username" |
| 77 | android:layout_width="0dp" | 78 | android:layout_width="0dp" |
| 78 | android:layout_height="wrap_content" | 79 | android:layout_height="wrap_content" |
| 79 | android:layout_marginLeft="50dp" | 80 | android:layout_marginLeft="50dp" |
| 80 | android:layout_weight="6" | 81 | android:layout_weight="6" |
| 81 | android:text="" | 82 | android:text="" |
| 82 | android:textSize="22sp" /> | 83 | android:textSize="22sp" /> |
| 83 | 84 | ||
| 84 | <TextView | 85 | <TextView |
| 85 | android:id="@+id/changBangding" | 86 | android:id="@+id/changBangding" |
| 86 | android:layout_width="0dp" | 87 | android:layout_width="0dp" |
| 87 | android:layout_height="wrap_content" | 88 | android:layout_height="wrap_content" |
| 88 | android:layout_weight="1" | 89 | android:layout_weight="1" |
| 89 | android:text="更换绑定" | 90 | android:text="更换绑定" |
| 90 | android:gravity="center" | 91 | android:gravity="center" |
| 91 | android:textColor="@color/white" | 92 | android:textColor="@color/white" |
| 92 | android:background="@drawable/blue_btn_bg_pressed" | 93 | android:background="@drawable/blue_btn_bg_pressed" |
| 93 | android:textSize="22sp" /> | 94 | android:textSize="22sp" /> |
| 94 | 95 | ||
| 95 | <ImageView | 96 | <ImageView |
| 96 | android:layout_width="wrap_content" | 97 | android:layout_width="wrap_content" |
| 97 | android:layout_height="wrap_content" | 98 | android:layout_height="wrap_content" |
| 98 | android:layout_weight="0.1" | 99 | android:layout_weight="0.1" |
| 99 | android:padding="10dp" | 100 | android:padding="10dp" |
| 100 | android:src="@mipmap/youjiantou" /> | 101 | android:src="@mipmap/youjiantou" /> |
| 101 | </LinearLayout> | 102 | </LinearLayout> |
| 102 | 103 | ||
| 103 | <LinearLayout | 104 | <LinearLayout |
| 104 | android:layout_width="match_parent" | 105 | android:layout_width="match_parent" |
| 105 | android:layout_height="wrap_content" | 106 | android:layout_height="wrap_content" |
| 106 | android:layout_marginTop="30dp"> | 107 | android:layout_marginTop="30dp"> |
| 107 | 108 | ||
| 108 | 109 | ||
| 109 | <TextView | 110 | <TextView |
| 110 | android:layout_width="0dp" | 111 | android:layout_width="0dp" |
| 111 | android:layout_height="wrap_content" | 112 | android:layout_height="wrap_content" |
| 112 | android:layout_weight="1.5" | 113 | android:layout_weight="1.5" |
| 113 | android:text="登录密码" | 114 | android:text="登录密码" |
| 114 | android:textSize="22sp" /> | 115 | android:textSize="22sp" /> |
| 115 | 116 | ||
| 116 | <TextView | 117 | <TextView |
| 117 | android:layout_width="0dp" | 118 | android:layout_width="0dp" |
| 118 | android:layout_height="wrap_content" | 119 | android:layout_height="wrap_content" |
| 119 | android:layout_marginLeft="50dp" | 120 | android:layout_marginLeft="50dp" |
| 120 | android:layout_weight="6" | 121 | android:layout_weight="6" |
| 121 | android:text="已设置" | 122 | android:text="已设置" |
| 122 | android:textSize="22sp" /> | 123 | android:textSize="22sp" /> |
| 123 | 124 | ||
| 124 | <TextView | 125 | <TextView |
| 125 | android:id="@+id/changpassword" | 126 | android:id="@+id/changpassword" |
| 126 | android:layout_width="0dp" | 127 | android:layout_width="0dp" |
| 127 | android:layout_height="wrap_content" | 128 | android:layout_height="wrap_content" |
| 128 | android:layout_weight="1" | 129 | android:layout_weight="1" |
| 129 | android:text="修改密码" | 130 | android:text="修改密码" |
| 130 | android:gravity="center" | 131 | android:gravity="center" |
| 131 | android:textColor="@color/white" | 132 | android:textColor="@color/white" |
| 132 | android:background="@drawable/blue_btn_bg_pressed" | 133 | android:background="@drawable/blue_btn_bg_pressed" |
| 133 | android:textSize="22sp" /> | 134 | android:textSize="22sp" /> |
| 134 | 135 | ||
| 135 | <ImageView | 136 | <ImageView |
| 136 | android:layout_width="wrap_content" | 137 | android:layout_width="wrap_content" |
| 137 | android:layout_height="wrap_content" | 138 | android:layout_height="wrap_content" |
| 138 | android:layout_weight="0.1" | 139 | android:layout_weight="0.1" |
| 139 | android:padding="10dp" | 140 | android:padding="10dp" |
| 140 | android:src="@mipmap/youjiantou" /> | 141 | android:src="@mipmap/youjiantou" /> |
| 141 | </LinearLayout> | 142 | </LinearLayout> |
| 142 | 143 | ||
| 143 | </LinearLayout> | 144 | </LinearLayout> |
| 144 | 145 | ||
| 145 | <View | 146 | <View |
| 146 | android:layout_width="match_parent" | 147 | android:layout_width="match_parent" |
| 147 | android:layout_height="0.7dp" | 148 | android:layout_height="0.7dp" |
| 148 | android:layout_margin="20dp" | 149 | android:layout_margin="20dp" |
| 149 | android:background="#FF909090" /> | 150 | android:background="#FF909090" /> |
| 150 | 151 | ||
| 151 | <LinearLayout | 152 | <LinearLayout |
| 152 | android:layout_width="wrap_content" | 153 | android:layout_width="wrap_content" |
| 153 | android:layout_height="wrap_content" | 154 | android:layout_height="wrap_content" |
| 154 | android:layout_margin="20dp" | 155 | android:layout_margin="20dp" |
| 155 | android:gravity="center_vertical" | 156 | android:gravity="center_vertical" |
| 156 | android:orientation="horizontal"> | 157 | android:orientation="horizontal"> |
| 157 | 158 | ||
| 158 | <View | 159 | <View |
| 159 | android:layout_width="5dp" | 160 | android:layout_width="5dp" |
| 160 | android:layout_height="20dp" | 161 | android:layout_height="20dp" |
| 161 | android:background="@color/login_text_blue"> | 162 | android:background="@color/login_text_blue"> |
| 162 | 163 | ||
| 163 | </View> | 164 | </View> |
| 164 | 165 | ||
| 165 | <TextView | 166 | <TextView |
| 166 | android:layout_width="wrap_content" | 167 | android:layout_width="wrap_content" |
| 167 | android:layout_height="wrap_content" | 168 | android:layout_height="wrap_content" |
| 168 | android:layout_marginLeft="5dp" | 169 | android:layout_marginLeft="5dp" |
| 169 | android:text="子账户管理" | 170 | android:text="子账户管理" |
| 170 | android:textSize="22sp" /> | 171 | android:textSize="22sp" /> |
| 171 | 172 | ||
| 172 | </LinearLayout> | 173 | </LinearLayout> |
| 173 | 174 | ||
| 174 | <LinearLayout | 175 | <LinearLayout |
| 175 | android:layout_width="match_parent" | 176 | android:layout_width="match_parent" |
| 176 | android:layout_height="match_parent" | 177 | android:layout_height="match_parent" |
| 177 | android:layout_marginLeft="30dp" | 178 | android:layout_marginLeft="30dp" |
| 178 | android:orientation="vertical"> | 179 | android:orientation="vertical"> |
| 179 | 180 | ||
| 180 | <LinearLayout | 181 | <LinearLayout |
| 181 | android:layout_width="match_parent" | 182 | android:layout_width="match_parent" |
| 182 | android:layout_height="wrap_content"> | 183 | android:layout_height="wrap_content"> |
| 183 | 184 | ||
| 184 | <LinearLayout | 185 | <LinearLayout |
| 185 | android:layout_width="0dp" | 186 | android:layout_width="0dp" |
| 186 | android:layout_height="wrap_content" | 187 | android:layout_height="wrap_content" |
| 187 | android:layout_weight="1"> | 188 | android:layout_weight="1"> |
| 188 | 189 | ||
| 189 | <LinearLayout | 190 | <LinearLayout |
| 190 | android:id="@+id/ll_zhu_backgrangd" | 191 | android:id="@+id/ll_zhu_backgrangd" |
| 191 | android:layout_width="400dp" | 192 | android:layout_width="400dp" |
| 192 | android:layout_height="wrap_content" | 193 | android:layout_height="wrap_content" |
| 193 | android:layout_marginLeft="5dp" | 194 | android:layout_marginLeft="5dp" |
| 194 | android:background="@drawable/corcle_blue_bg" | 195 | android:background="@drawable/corcle_blue_bg" |
| 195 | android:orientation="vertical"> | 196 | android:orientation="vertical"> |
| 196 | 197 | ||
| 197 | <LinearLayout | 198 | <LinearLayout |
| 198 | android:layout_width="match_parent" | 199 | android:layout_width="match_parent" |
| 199 | android:layout_height="wrap_content" | 200 | android:layout_height="wrap_content" |
| 200 | android:background="@mipmap/bg_zhuzhanghu" | 201 | android:background="@mipmap/bg_zhuzhanghu" |
| 201 | android:orientation="horizontal"> | 202 | android:orientation="horizontal"> |
| 202 | 203 | ||
| 203 | <com.facebook.drawee.view.SimpleDraweeView | 204 | <com.facebook.drawee.view.SimpleDraweeView |
| 204 | android:id="@+id/tv_account_head" | 205 | android:id="@+id/tv_account_head" |
| 205 | android:layout_width="60dp" | 206 | android:layout_width="60dp" |
| 206 | android:layout_height="60dp" | 207 | android:layout_height="60dp" |
| 207 | android:layout_margin="10dp" | 208 | android:layout_margin="10dp" |
| 208 | fresco:placeholderImage="@mipmap/header_default" | 209 | fresco:placeholderImage="@mipmap/header_default" |
| 209 | fresco:placeholderImageScaleType="fitCenter" | 210 | fresco:placeholderImageScaleType="fitCenter" |
| 210 | fresco:roundAsCircle="true" /> | 211 | fresco:roundAsCircle="true" /> |
| 211 | 212 | ||
| 212 | <LinearLayout | 213 | <LinearLayout |
| 213 | android:layout_width="0dp" | 214 | android:layout_width="0dp" |
| 214 | android:layout_height="wrap_content" | 215 | android:layout_height="wrap_content" |
| 215 | android:layout_marginLeft="10dp" | 216 | android:layout_marginLeft="10dp" |
| 216 | android:layout_marginTop="10dp" | 217 | android:layout_marginTop="10dp" |
| 217 | android:layout_weight="1" | 218 | android:layout_weight="1" |
| 218 | android:orientation="vertical"> | 219 | android:orientation="vertical"> |
| 219 | 220 | ||
| 220 | <TextView | 221 | <TextView |
| 221 | android:id="@+id/tv_account_name" | 222 | android:id="@+id/tv_account_name" |
| 222 | android:layout_width="wrap_content" | 223 | android:layout_width="wrap_content" |
| 223 | android:layout_height="wrap_content" | 224 | android:layout_height="wrap_content" |
| 224 | android:text="" | 225 | android:text="" |
| 225 | android:textSize="18sp" /> | 226 | android:textSize="18sp" /> |
| 226 | 227 | ||
| 227 | <TextView | 228 | <TextView |
| 228 | android:id="@+id/tv_account_grade" | 229 | android:id="@+id/tv_account_grade" |
| 229 | android:layout_width="wrap_content" | 230 | android:layout_width="wrap_content" |
| 230 | android:layout_height="wrap_content" | 231 | android:layout_height="wrap_content" |
| 231 | android:text="" | 232 | android:text="" |
| 232 | android:textSize="18sp" /> | 233 | android:textSize="18sp" /> |
| 233 | 234 | ||
| 234 | <TextView | 235 | <TextView |
| 235 | android:id="@+id/tv_account_school" | 236 | android:id="@+id/tv_account_school" |
| 236 | android:layout_width="wrap_content" | 237 | android:layout_width="wrap_content" |
| 237 | android:layout_height="wrap_content" | 238 | android:layout_height="wrap_content" |
| 238 | android:text="" | 239 | android:text="" |
| 239 | android:textSize="18sp" /> | 240 | android:textSize="18sp" /> |
| 240 | 241 | ||
| 241 | <TextView | 242 | <TextView |
| 242 | android:id="@+id/tv_account_adress" | 243 | android:id="@+id/tv_account_adress" |
| 243 | android:layout_width="wrap_content" | 244 | android:layout_width="wrap_content" |
| 244 | android:layout_height="wrap_content" | 245 | android:layout_height="wrap_content" |
| 245 | android:text="" | 246 | android:text="" |
| 246 | android:textSize="18sp" /> | 247 | android:textSize="18sp" /> |
| 247 | 248 | ||
| 248 | 249 | ||
| 249 | </LinearLayout> | 250 | </LinearLayout> |
| 250 | 251 | ||
| 251 | <ImageView | 252 | <ImageView |
| 252 | android:id="@+id/iv_shiyongzhong" | 253 | android:id="@+id/iv_shiyongzhong" |
| 253 | android:layout_width="wrap_content" | 254 | android:layout_width="wrap_content" |
| 254 | android:layout_height="wrap_content" | 255 | android:layout_height="wrap_content" |
| 255 | android:layout_gravity="right" | 256 | android:layout_gravity="right" |
| 256 | android:layout_marginLeft="60dp" | 257 | android:layout_marginLeft="60dp" |
| 257 | android:src="@mipmap/shiyongzhong" | 258 | android:src="@mipmap/shiyongzhong" |
| 258 | android:visibility="gone" /> | 259 | android:visibility="gone" /> |
| 259 | 260 | ||
| 260 | </LinearLayout> | 261 | </LinearLayout> |
| 261 | 262 | ||
| 262 | <View | 263 | <View |
| 263 | android:layout_width="match_parent" | 264 | android:layout_width="match_parent" |
| 264 | android:layout_height="0.7dp" | 265 | android:layout_height="0.7dp" |
| 265 | android:layout_marginBottom="10dp" | 266 | android:layout_marginBottom="10dp" |
| 266 | android:background="@color/cutoff_line"> | 267 | android:background="@color/cutoff_line"> |
| 267 | 268 | ||
| 268 | </View> | 269 | </View> |
| 269 | 270 | ||
| 270 | <LinearLayout | 271 | <LinearLayout |
| 271 | android:layout_width="match_parent" | 272 | android:layout_width="match_parent" |
| 272 | android:layout_height="wrap_content" | 273 | android:layout_height="wrap_content" |
| 273 | android:layout_marginBottom="10dp" | 274 | android:layout_marginBottom="10dp" |
| 274 | android:orientation="horizontal"> | 275 | android:orientation="horizontal"> |
| 275 | 276 | ||
| 276 | <TextView | 277 | <TextView |
| 277 | android:id="@+id/change_zhu_account" | 278 | android:id="@+id/change_zhu_account" |
| 278 | android:layout_width="0dp" | 279 | android:layout_width="0dp" |
| 279 | android:layout_height="wrap_content" | 280 | android:layout_height="wrap_content" |
| 280 | android:layout_weight="1" | 281 | android:layout_weight="1" |
| 281 | android:gravity="center" | 282 | android:gravity="center" |
| 282 | android:text="切换主账户" | 283 | android:text="切换主账户" |
| 283 | android:textSize="18sp" /> | 284 | android:textSize="18sp" /> |
| 284 | 285 | ||
| 285 | 286 | ||
| 286 | </LinearLayout> | 287 | </LinearLayout> |
| 287 | 288 | ||
| 288 | </LinearLayout> | 289 | </LinearLayout> |
| 289 | 290 | ||
| 290 | 291 | ||
| 291 | </LinearLayout> | 292 | </LinearLayout> |
| 292 | 293 | ||
| 293 | <LinearLayout | 294 | <LinearLayout |
| 294 | android:layout_width="0dp" | 295 | android:layout_width="0dp" |
| 295 | android:layout_height="wrap_content" | 296 | android:layout_height="wrap_content" |
| 296 | android:layout_weight="1"> | 297 | android:layout_weight="1"> |
| 297 | 298 | ||
| 298 | </LinearLayout> | 299 | </LinearLayout> |
| 299 | 300 | ||
| 300 | <LinearLayout | 301 | <LinearLayout |
| 301 | android:layout_width="0dp" | 302 | android:layout_width="0dp" |
| 302 | android:layout_height="wrap_content" | 303 | android:layout_height="wrap_content" |
| 303 | android:layout_weight="1"> | 304 | android:layout_weight="1"> |
| 304 | 305 | ||
| 305 | </LinearLayout> | 306 | </LinearLayout> |
| 306 | </LinearLayout> | 307 | </LinearLayout> |
| 307 | 308 | ||
| 308 | <RelativeLayout | 309 | <RelativeLayout |
| 309 | android:layout_width="match_parent" | 310 | android:layout_width="match_parent" |
| 310 | android:layout_height="wrap_content" | 311 | android:layout_height="wrap_content" |
| 311 | android:layout_marginTop="20dp" | 312 | android:layout_marginTop="20dp" |
| 312 | android:orientation="horizontal"> | 313 | android:orientation="horizontal"> |
| 313 | 314 | ||
| 314 | <android.support.v7.widget.RecyclerView | 315 | <android.support.v7.widget.RecyclerView |
| 315 | android:id="@+id/id_recyclerview_horizontal" | 316 | android:id="@+id/id_recyclerview_horizontal" |
| 316 | android:layout_width="wrap_content" | 317 | android:layout_width="wrap_content" |
| 317 | android:layout_height="wrap_content" | 318 | android:layout_height="wrap_content" |
| 318 | android:layout_centerVertical="true" | 319 | android:layout_centerVertical="true" |
| 319 | android:scrollbars="none"> | 320 | android:scrollbars="none"> |
| 320 | 321 | ||
| 321 | </android.support.v7.widget.RecyclerView> | 322 | </android.support.v7.widget.RecyclerView> |
| 322 | 323 | ||
| 323 | 324 | ||
| 324 | 325 | ||
| 325 | </RelativeLayout> | 326 | </RelativeLayout> |
| 326 | 327 | ||
| 327 | </LinearLayout> | 328 | </LinearLayout> |
| 328 | 329 | ||
| 329 | 330 | ||
| 330 | </LinearLayout> | 331 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/custom_adilog_lhead.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
| 4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
| 5 | android:orientation="vertical"> | 5 | android:orientation="vertical"> |
| 6 | 6 | ||
| 7 | <RelativeLayout | 7 | <RelativeLayout |
| 8 | android:id="@+id/title" | 8 | android:id="@+id/title" |
| 9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
| 10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
| 11 | android:minHeight="70dp" > | 11 | android:minHeight="80dp" > |
| 12 | 12 | ||
| 13 | <TextView | 13 | <TextView |
| 14 | android:id="@+id/menu_title" | 14 | android:id="@+id/menu_title" |
| 15 | android:layout_width="wrap_content" | 15 | android:layout_width="wrap_content" |
| 16 | android:layout_height="wrap_content" | 16 | android:layout_height="wrap_content" |
| 17 | android:layout_centerInParent="true" | 17 | android:layout_centerInParent="true" |
| 18 | android:padding="20dp" | 18 | android:padding="20dp" |
| 19 | android:text="个人头像" | 19 | android:text="个人头像" |
| 20 | android:textColor="@android:color/black" | 20 | android:textColor="@android:color/black" |
| 21 | android:textSize="22sp" /> | 21 | android:textSize="22sp" /> |
| 22 | </RelativeLayout> | 22 | </RelativeLayout> |
| 23 | <LinearLayout | 23 | <LinearLayout |
| 24 | android:layout_width="match_parent" | 24 | android:layout_width="match_parent" |
| 25 | android:layout_height="260dp" | 25 | android:layout_height="260dp" |
| 26 | android:layout_margin="20dp" | 26 | android:layout_margin="20dp" |
| 27 | android:orientation="vertical"> | 27 | android:orientation="vertical"> |
| 28 | <TextView | 28 | <TextView |
| 29 | android:layout_width="wrap_content" | 29 | android:layout_width="wrap_content" |
| 30 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
| 31 | android:layout_marginLeft="50dp" | 31 | android:layout_marginLeft="50dp" |
| 32 | android:textSize="18sp" | 32 | android:textSize="18sp" |
| 33 | android:text="默认头像"/> | 33 | android:text="默认头像"/> |
| 34 | <RadioGroup | 34 | <RadioGroup |
| 35 | android:id="@+id/radiogroup_head" | 35 | android:id="@+id/radiogroup_head" |
| 36 | android:layout_width="match_parent" | 36 | android:layout_width="match_parent" |
| 37 | android:layout_height="wrap_content" | 37 | android:layout_height="wrap_content" |
| 38 | android:gravity="center" | 38 | android:gravity="center" |
| 39 | android:layout_marginTop="10dp" | 39 | android:layout_marginTop="10dp" |
| 40 | android:orientation="horizontal"> | 40 | android:orientation="horizontal"> |
| 41 | <RadioButton | 41 | <RadioButton |
| 42 | android:id="@+id/radio_head1" | 42 | android:id="@+id/radio_head1" |
| 43 | android:layout_width="wrap_content" | 43 | android:layout_width="wrap_content" |
| 44 | android:layout_height="wrap_content" | 44 | android:layout_height="wrap_content" |
| 45 | android:layout_margin="20dp" | 45 | android:layout_margin="20dp" |
| 46 | android:button="@drawable/radio_button" | 46 | android:button="@drawable/radio_button" |
| 47 | android:background="@mipmap/default_avatar1" /> | 47 | android:background="@mipmap/default_avatar1" /> |
| 48 | <RadioButton | 48 | <RadioButton |
| 49 | android:id="@+id/radio_head2" | 49 | android:id="@+id/radio_head2" |
| 50 | android:layout_width="wrap_content" | 50 | android:layout_width="wrap_content" |
| 51 | android:layout_height="wrap_content" | 51 | android:layout_height="wrap_content" |
| 52 | android:layout_margin="20dp" | 52 | android:layout_margin="20dp" |
| 53 | android:button="@drawable/radio_button" | 53 | android:button="@drawable/radio_button" |
| 54 | android:background="@mipmap/default_avatar2"/> | 54 | android:background="@mipmap/default_avatar2"/> |
| 55 | <RadioButton | 55 | <RadioButton |
| 56 | android:id="@+id/radio_head3" | 56 | android:id="@+id/radio_head3" |
| 57 | android:layout_width="wrap_content" | 57 | android:layout_width="wrap_content" |
| 58 | android:layout_height="wrap_content" | 58 | android:layout_height="wrap_content" |
| 59 | android:layout_margin="20dp" | 59 | android:layout_margin="20dp" |
| 60 | android:button="@drawable/radio_button" | 60 | android:button="@drawable/radio_button" |
| 61 | android:background="@mipmap/default_avatar3"/> | 61 | android:background="@mipmap/default_avatar3"/> |
| 62 | <RadioButton | 62 | <RadioButton |
| 63 | android:id="@+id/radio_head4" | 63 | android:id="@+id/radio_head4" |
| 64 | android:layout_width="wrap_content" | 64 | android:layout_width="wrap_content" |
| 65 | android:layout_height="wrap_content" | 65 | android:layout_height="wrap_content" |
| 66 | android:layout_margin="20dp" | 66 | android:layout_margin="20dp" |
| 67 | android:button="@drawable/radio_button" | 67 | android:button="@drawable/radio_button" |
| 68 | android:background="@mipmap/default_avatar4"/> | 68 | android:background="@mipmap/default_avatar4"/> |
| 69 | 69 | ||
| 70 | </RadioGroup> | 70 | </RadioGroup> |
| 71 | <LinearLayout | 71 | <LinearLayout |
| 72 | android:layout_width="match_parent" | 72 | android:layout_width="match_parent" |
| 73 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
| 74 | android:gravity="center" | 74 | android:gravity="center" |
| 75 | android:layout_marginTop="10dp" | 75 | android:layout_marginTop="10dp" |
| 76 | android:orientation="horizontal"> | 76 | android:orientation="horizontal"> |
| 77 | <LinearLayout | 77 | <LinearLayout |
| 78 | android:id="@+id/take_pic" | 78 | android:id="@+id/take_pic" |
| 79 | android:layout_width="0dp" | 79 | android:layout_width="0dp" |
| 80 | android:layout_weight="1" | 80 | android:layout_weight="1" |
| 81 | android:gravity="center" | 81 | android:gravity="center" |
| 82 | android:layout_height="wrap_content"> | 82 | android:layout_height="wrap_content"> |
| 83 | <ImageView | 83 | <ImageView |
| 84 | android:layout_width="wrap_content" | 84 | android:layout_width="wrap_content" |
| 85 | android:layout_height="wrap_content" | 85 | android:layout_height="wrap_content" |
| 86 | android:layout_margin="10dp" | 86 | android:layout_margin="10dp" |
| 87 | android:src="@mipmap/paizhao"/> | 87 | android:src="@mipmap/paizhao"/> |
| 88 | <TextView | 88 | <TextView |
| 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:layout_gravity="center_vertical" | 91 | android:layout_gravity="center_vertical" |
| 92 | android:textSize="18sp" | 92 | android:textSize="18sp" |
| 93 | android:text="拍一张"/> | 93 | android:text="拍一张"/> |
| 94 | 94 | ||
| 95 | </LinearLayout> | 95 | </LinearLayout> |
| 96 | <LinearLayout | 96 | <LinearLayout |
| 97 | android:id="@+id/xiangce" | 97 | android:id="@+id/xiangce" |
| 98 | android:layout_width="0dp" | 98 | android:layout_width="0dp" |
| 99 | android:layout_weight="1" | 99 | android:layout_weight="1" |
| 100 | android:gravity="center" | 100 | android:gravity="center" |
| 101 | android:layout_height="wrap_content"> | 101 | android:layout_height="wrap_content"> |
| 102 | <ImageView | 102 | <ImageView |
| 103 | android:layout_width="wrap_content" | 103 | android:layout_width="wrap_content" |
| 104 | android:layout_height="wrap_content" | 104 | android:layout_height="wrap_content" |
| 105 | android:layout_margin="10dp" | 105 | android:layout_margin="10dp" |
| 106 | android:src="@mipmap/xiangce"/> | 106 | android:src="@mipmap/xiangce"/> |
| 107 | <TextView | 107 | <TextView |
| 108 | android:layout_width="wrap_content" | 108 | android:layout_width="wrap_content" |
| 109 | android:layout_height="wrap_content" | 109 | android:layout_height="wrap_content" |
| 110 | android:layout_gravity="center_vertical" | 110 | android:layout_gravity="center_vertical" |
| 111 | android:textSize="18sp" | 111 | android:textSize="18sp" |
| 112 | android:text="相册"/> | 112 | android:text="相册"/> |
| 113 | 113 | ||
| 114 | 114 | ||
| 115 | </LinearLayout> | 115 | </LinearLayout> |
| 116 | 116 | ||
| 117 | 117 | ||
| 118 | </LinearLayout> | 118 | </LinearLayout> |
| 119 | <View | 119 | <View |
| 120 | android:layout_marginTop="10dp" | 120 | android:layout_marginTop="10dp" |
| 121 | android:layout_width="match_parent" | 121 | android:layout_width="match_parent" |
| 122 | android:background="@color/cutoff_line" | 122 | android:background="@color/cutoff_line" |
| 123 | android:layout_height="0.7dp"> | 123 | android:layout_height="0.7dp"> |
| 124 | 124 | ||
| 125 | </View> | 125 | </View> |
| 126 | <LinearLayout | 126 | <LinearLayout |
| 127 | android:layout_width="match_parent" | 127 | android:layout_width="match_parent" |
| 128 | android:layout_height="50dp" | 128 | android:layout_height="50dp" |
| 129 | android:gravity="center" | 129 | android:gravity="center" |
| 130 | android:orientation="horizontal"> | 130 | android:orientation="horizontal"> |
| 131 | 131 | ||
| 132 | <TextView | 132 | <TextView |
| 133 | android:id="@+id/canceltakephone" | 133 | android:id="@+id/canceltakephone" |
| 134 | android:layout_width="0dp" | 134 | android:layout_width="0dp" |
| 135 | android:layout_weight="1" | 135 | android:layout_weight="1" |
| 136 | android:layout_marginTop="10dp" | 136 | android:layout_marginTop="10dp" |
| 137 | android:layout_height="wrap_content" | 137 | android:layout_height="wrap_content" |
| 138 | android:gravity="center" | 138 | android:gravity="center" |
| 139 | android:textSize="18sp" | 139 | android:textSize="18sp" |
| 140 | android:text="取消"/> | 140 | android:text="取消"/> |
| 141 | <View | 141 | <View |
| 142 | android:layout_width="0.7dp" | 142 | android:layout_width="0.7dp" |
| 143 | android:layout_height="match_parent" | 143 | android:layout_height="match_parent" |
| 144 | android:background="@color/cutoff_line"> | 144 | android:background="@color/cutoff_line"> |
| 145 | 145 | ||
| 146 | </View> | 146 | </View> |
| 147 | 147 | ||
| 148 | <TextView | 148 | <TextView |
| 149 | android:id="@+id/oktakephone" | 149 | android:id="@+id/oktakephone" |
| 150 | android:layout_width="0dp" | 150 | android:layout_width="0dp" |
| 151 | android:layout_weight="1" | 151 | android:layout_weight="1" |
| 152 | android:layout_height="wrap_content" | 152 | android:layout_height="wrap_content" |
| 153 | android:layout_marginTop="10dp" | 153 | android:layout_marginTop="10dp" |
| 154 | android:gravity="center" | 154 | android:gravity="center" |
| 155 | android:textSize="18sp" | 155 | android:textSize="18sp" |
| 156 | android:text="确定"/> | 156 | android:text="确定"/> |
| 157 | 157 | ||
| 158 | </LinearLayout> | 158 | </LinearLayout> |
| 159 | 159 | ||
| 160 | </LinearLayout> | 160 | </LinearLayout> |
| 161 | </LinearLayout> | 161 | </LinearLayout> |
| 162 | 162 |