Commit 68ca27b89a3a99540c8f1810a41cbb8484caa9d7
1 parent
94850fa261
Exists in
master
解决保卡问题 完善个人中心
Showing
15 changed files
with
44 additions
and
57 deletions
Show diff stats
PersonalCenter/.idea/misc.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <project version="4"> | 2 | <project version="4"> |
3 | <component name="EntryPointsManager"> | ||
4 | <entry_points version="2.0" /> | ||
5 | </component> | ||
6 | <component name="NullableNotNullManager"> | 3 | <component name="NullableNotNullManager"> |
7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> | 4 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> |
8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> | 5 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> |
9 | <option name="myNullables"> | 6 | <option name="myNullables"> |
10 | <value> | 7 | <value> |
11 | <list size="4"> | 8 | <list size="4"> |
12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | 9 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> |
13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | 10 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> |
14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | 11 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> |
15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | 12 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> |
16 | </list> | 13 | </list> |
17 | </value> | 14 | </value> |
18 | </option> | 15 | </option> |
19 | <option name="myNotNulls"> | 16 | <option name="myNotNulls"> |
20 | <value> | 17 | <value> |
21 | <list size="4"> | 18 | <list size="4"> |
22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | 19 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> |
23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | 20 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> |
24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | 21 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> |
25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | 22 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> |
26 | </list> | 23 | </list> |
27 | </value> | 24 | </value> |
28 | </option> | 25 | </option> |
29 | </component> | 26 | </component> |
30 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> | 27 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
31 | <OptionsSetting value="true" id="Add" /> | ||
32 | <OptionsSetting value="true" id="Remove" /> | ||
33 | <OptionsSetting value="true" id="Checkout" /> | ||
34 | <OptionsSetting value="true" id="Update" /> | ||
35 | <OptionsSetting value="true" id="Status" /> | ||
36 | <OptionsSetting value="true" id="Edit" /> | ||
37 | <ConfirmationsSetting value="0" id="Add" /> | ||
38 | <ConfirmationsSetting value="0" id="Remove" /> | ||
39 | </component> | ||
40 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||
41 | <output url="file://$PROJECT_DIR$/build/classes" /> | 28 | <output url="file://$PROJECT_DIR$/build/classes" /> |
42 | </component> | 29 | </component> |
43 | <component name="ProjectType"> | 30 | <component name="ProjectType"> |
44 | <option name="id" value="Android" /> | 31 | <option name="id" value="Android" /> |
45 | </component> | 32 | </component> |
46 | </project> | 33 | </project> |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.content.Context; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
6 | import android.net.Uri; | 6 | import android.net.Uri; |
7 | import android.os.Build; | 7 | import android.os.Build; |
8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
9 | import android.os.Handler; | 9 | import android.os.Handler; |
10 | import android.os.Message; | 10 | import android.os.Message; |
11 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
12 | import android.support.annotation.NonNull; | 12 | import android.support.annotation.NonNull; |
13 | import android.support.v4.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 | //水平滑动 | 80 | //水平滑动 |
80 | private RecyclerView mRecyclerView; | 81 | private RecyclerView mRecyclerView; |
81 | private GridView mRecyclerViewpublish; | 82 | private GridView mRecyclerViewpublish; |
82 | private VideoAdapter RecyclerViewadapter; | 83 | private VideoAdapter RecyclerViewadapter; |
83 | private MianGridAdapter RecyclerViewadapterpublish; | 84 | private MianGridAdapter RecyclerViewadapterpublish; |
84 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 85 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
85 | 86 | ||
86 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); | 87 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); |
87 | private boolean showIcon = false; | 88 | private boolean showIcon = false; |
88 | private boolean dimBg = false; | 89 | private boolean dimBg = false; |
89 | private boolean needAnim = true; | 90 | private boolean needAnim = true; |
90 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 91 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
91 | private static final int REQUEST_CODE_ALBUM = 2; | 92 | private static final int REQUEST_CODE_ALBUM = 2; |
92 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 93 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
93 | SimpleDraweeView mSimpleDraweeView; | 94 | SimpleDraweeView mSimpleDraweeView; |
94 | private File file; | 95 | private File file; |
95 | private Uri uri; | 96 | private Uri uri; |
96 | Handler handler = new Handler() { | 97 | Handler handler = new Handler() { |
97 | @Override | 98 | @Override |
98 | public void handleMessage(Message msg) { | 99 | public void handleMessage(Message msg) { |
99 | super.handleMessage(msg); | 100 | super.handleMessage(msg); |
100 | switch (msg.what) { | 101 | switch (msg.what) { |
101 | case HttpCode.GETINFO: | 102 | case HttpCode.GETINFO: |
102 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; | 103 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; |
103 | tv_username.setText(cardinfoBean.getNickName()); | 104 | tv_username.setText(cardinfoBean.getNickName()); |
104 | tv_username1.setText(cardinfoBean.getNickName()); | 105 | tv_username1.setText(cardinfoBean.getNickName()); |
105 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 106 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
106 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 107 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
107 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 108 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
108 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 109 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
109 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 110 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
110 | String sex = cardinfoBean.getGender(); | 111 | String sex = cardinfoBean.getGender(); |
111 | if ("0".equals(sex)) { | 112 | if ("0".equals(sex)) { |
112 | tv_sex.setText("男"); | 113 | tv_sex.setText("男"); |
113 | iv_sex.setImageResource(R.mipmap.men); | 114 | iv_sex.setImageResource(R.mipmap.men); |
114 | } else { | 115 | } else { |
115 | tv_sex.setText("女"); | 116 | tv_sex.setText("女"); |
116 | iv_sex.setImageResource(R.mipmap.women); | 117 | iv_sex.setImageResource(R.mipmap.women); |
117 | } | 118 | } |
118 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | 119 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); |
119 | //加载星座 | 120 | //加载星座 |
120 | BrithdayStar brithdayStar = new BrithdayStar(); | 121 | BrithdayStar brithdayStar = new BrithdayStar(); |
121 | if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) { | 122 | if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) { |
122 | tv_mygad.setText(""); | 123 | tv_mygad.setText(""); |
123 | } else { | 124 | } else { |
124 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); | 125 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); |
125 | tv_mygad.setText(xiongzuo); | 126 | tv_mygad.setText(xiongzuo); |
126 | } | 127 | } |
127 | //保存个人信息 | 128 | //保存个人信息 |
128 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName()); | 129 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName()); |
129 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName()); | 130 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName()); |
130 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName()); | 131 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName()); |
131 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday()); | 132 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday()); |
132 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString()); | 133 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString()); |
133 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq()); | 134 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq()); |
134 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName()); | 135 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName()); |
135 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress()); | 136 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress()); |
136 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId()); | 137 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId()); |
137 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait()); | 138 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait()); |
138 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId()); | 139 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId()); |
139 | String graderID = cardinfoBean.getGrade().getGradeId(); | 140 | String graderID = cardinfoBean.getGrade().getGradeId(); |
140 | Log.e("test", "nianji" + graderID); | 141 | Log.e("test", "nianji" + graderID); |
141 | try { | 142 | try { |
142 | long auserID = Long.parseLong(graderID); | 143 | long auserID = Long.parseLong(graderID); |
143 | String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | 144 | String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); |
144 | // if ((auserID < 8) && (ss == null)) { | 145 | // if ((auserID < 8) && (ss == null)) { |
145 | // Intent intentbroad = new Intent(); | 146 | // Intent intentbroad = new Intent(); |
146 | // intentbroad.putExtra("info", "小学"); | 147 | // intentbroad.putExtra("info", "小学"); |
147 | // //4、定义广播发送的action | 148 | // //4、定义广播发送的action |
148 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 149 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
149 | // //5、发送广播 | 150 | // //5、发送广播 |
150 | // sendBroadcast(intentbroad); | 151 | // sendBroadcast(intentbroad); |
151 | // Log.i("---", "发送完了"); | 152 | // Log.i("---", "发送完了"); |
152 | // } | 153 | // } |
153 | } catch (NumberFormatException e) { | 154 | } catch (NumberFormatException e) { |
154 | e.printStackTrace(); | 155 | e.printStackTrace(); |
155 | } | 156 | } |
156 | 157 | ||
157 | 158 | ||
158 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); | 159 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); |
159 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 160 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
160 | //账户类型 | 161 | //账户类型 |
161 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 162 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
162 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 163 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
163 | 164 | ||
164 | try { | 165 | try { |
165 | Object auserID; | 166 | Object auserID; |
166 | int type; | 167 | int type; |
167 | int graderIDs = Integer.parseInt(graderID); | 168 | int graderIDs = Integer.parseInt(graderID); |
168 | if ("2".equals(accounts)) { | 169 | if ("2".equals(accounts)) { |
169 | type = Integer.parseInt(accounts); | 170 | type = Integer.parseInt(accounts); |
170 | auserID = childID; | 171 | auserID = childID; |
171 | } else { | 172 | } else { |
172 | type = Integer.parseInt(accounts); | 173 | type = Integer.parseInt(accounts); |
173 | auserID = Long.parseLong(userID); | 174 | auserID = Long.parseLong(userID); |
174 | } | 175 | } |
175 | //获取版本信息 | 176 | //获取版本信息 |
176 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); | 177 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); |
177 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); | 178 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); |
178 | 179 | ||
179 | } catch (NumberFormatException e) { | 180 | } catch (NumberFormatException e) { |
180 | e.printStackTrace(); | 181 | e.printStackTrace(); |
181 | } | 182 | } |
182 | 183 | ||
183 | break; | 184 | break; |
184 | case HttpCode.SIGN: | 185 | case HttpCode.SIGN: |
185 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; | 186 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; |
186 | if (dataBean.getSignature() == null) { | 187 | if (dataBean.getSignature() == null) { |
187 | tv_sign.setText("你还未设置个性签名"); | 188 | tv_sign.setText("你还未设置个性签名"); |
188 | } else { | 189 | } else { |
189 | tv_sign.setText(dataBean.getSignature()); | 190 | tv_sign.setText(dataBean.getSignature()); |
190 | } | 191 | } |
191 | 192 | ||
192 | break; | 193 | break; |
193 | case HttpCode.PUBLISH_SUCESS: | 194 | case HttpCode.PUBLISH_SUCESS: |
194 | defautPublishInfos.clear(); | 195 | defautPublishInfos.clear(); |
195 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 196 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
196 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 197 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
197 | Gson gson = new Gson(); | 198 | Gson gson = new Gson(); |
198 | 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)); |
199 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj)); | 200 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj)); |
200 | break; | 201 | break; |
201 | case HttpCode.GETVIDIO_SUCESS: | 202 | case HttpCode.GETVIDIO_SUCESS: |
202 | videoinfo.clear(); | 203 | videoinfo.clear(); |
203 | view_novedeo.setVisibility(View.GONE); | 204 | view_novedeo.setVisibility(View.GONE); |
204 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); | 205 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); |
205 | RecyclerViewadapter.notifyDataSetChanged(); | 206 | RecyclerViewadapter.notifyDataSetChanged(); |
206 | break; | 207 | break; |
207 | case HttpCode.SUCHCARDINFOONE: | 208 | case HttpCode.SUCHCARDINFOONE: |
208 | JSONObject jsonObject; | 209 | JSONObject jsonObject; |
209 | String status; | 210 | String status; |
210 | try { | 211 | try { |
211 | jsonObject = new JSONObject((String) msg.obj); | 212 | jsonObject = new JSONObject((String) msg.obj); |
212 | status = jsonObject.getString("status"); | 213 | status = jsonObject.getString("status"); |
213 | if (status.equals("1")) { | 214 | if (status.equals("1")) { |
214 | tv_yangji.setVisibility(View.GONE); | 215 | sssssssss.setVisibility(View.VISIBLE); |
216 | tv_yangji.setVisibility(View.INVISIBLE); | ||
215 | iv_look_card.setVisibility(View.VISIBLE); | 217 | iv_look_card.setVisibility(View.VISIBLE); |
218 | //客机没有保卡 | ||
216 | } else if (status.equals("2001")) { | 219 | } else if (status.equals("2001")) { |
217 | tv_yangji.setVisibility(View.GONE); | 220 | sssssssss.setVisibility(View.VISIBLE); |
221 | tv_yangji.setVisibility(View.INVISIBLE); | ||
218 | iv_look_card.setVisibility(View.VISIBLE); | 222 | iv_look_card.setVisibility(View.VISIBLE); |
219 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录"); | 223 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录"); |
220 | SaveParam.getInstance().clearData(MainActivity.this); | ||
221 | Intent settingintent = new Intent(); | 224 | Intent settingintent = new Intent(); |
222 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 225 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
223 | startActivity(settingintent); | 226 | startActivity(settingintent); |
224 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 227 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
225 | finish(); | 228 | } else if (status.equals("2002")) {//样机 |
226 | } else if (status.equals("2002")) { | 229 | sssssssss.setVisibility(View.INVISIBLE); |
227 | iv_look_card.setVisibility(View.GONE); | 230 | iv_look_card.setVisibility(View.INVISIBLE); |
228 | tv_yangji.setVisibility(View.VISIBLE); | 231 | tv_yangji.setVisibility(View.VISIBLE); |
229 | 232 | ||
230 | } else { | 233 | } else { |
231 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); | 234 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); |
232 | } | 235 | } |
233 | } catch (JSONException e) { | 236 | } catch (JSONException e) { |
234 | e.printStackTrace(); | 237 | e.printStackTrace(); |
235 | } | 238 | } |
236 | 239 | ||
237 | 240 | ||
238 | } | 241 | } |
239 | } | 242 | } |
240 | }; | 243 | }; |
241 | 244 | ||
242 | @Override | 245 | @Override |
243 | protected void onCreate(Bundle savedInstanceState) { | 246 | protected void onCreate(Bundle savedInstanceState) { |
244 | super.onCreate(savedInstanceState); | 247 | super.onCreate(savedInstanceState); |
245 | Fresco.initialize(this); | 248 | Fresco.initialize(this); |
246 | setContentView(R.layout.activity_main); | 249 | setContentView(R.layout.activity_main); |
247 | SysApplication.getInstance().addActivity(this); | 250 | SysApplication.getInstance().addActivity(this); |
248 | initView(); | 251 | initView(); |
249 | initData(); | 252 | initData(); |
250 | initLister(); | 253 | initLister(); |
251 | updateVersion(); | 254 | updateVersion(); |
252 | } | 255 | } |
253 | 256 | ||
254 | //////版本更新 | 257 | //////版本更新 |
255 | private void updateVersion() { | 258 | private void updateVersion() { |
256 | UpdateChecker updateChecker = new UpdateChecker(this); | 259 | UpdateChecker updateChecker = new UpdateChecker(this); |
257 | updateChecker.checkForUpdates(); | 260 | updateChecker.checkForUpdates(); |
258 | 261 | ||
259 | 262 | ||
260 | } | 263 | } |
261 | 264 | ||
262 | private void initView() { | 265 | private void initView() { |
263 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 266 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
264 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); | 267 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); |
265 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); | 268 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); |
266 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 269 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
267 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 270 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
268 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 271 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
269 | //头像 | 272 | //头像 |
270 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 273 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
271 | //初始化个人信息 | 274 | //初始化个人信息 |
272 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 275 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
273 | tv_username = (TextView) findViewById(R.id.tv_username); | 276 | tv_username = (TextView) findViewById(R.id.tv_username); |
274 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 277 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
275 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 278 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
276 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 279 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
277 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 280 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
278 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 281 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
279 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 282 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
280 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 283 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
281 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 284 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
282 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); | 285 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); |
283 | //跳转其他应用 | 286 | //跳转其他应用 |
284 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); | 287 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); |
285 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); | 288 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); |
286 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); | 289 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); |
287 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); | 290 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); |
288 | // | 291 | // |
289 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 292 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
290 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); | 293 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); |
291 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); | 294 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); |
292 | 295 | ||
296 | sssssssss = findViewById(R.id.sssssssss); | ||
297 | |||
293 | } | 298 | } |
294 | 299 | ||
295 | 300 | ||
296 | private void initData() { | 301 | private void initData() { |
297 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 302 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
298 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 303 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
299 | uri = Uri.fromFile(file); | 304 | uri = Uri.fromFile(file); |
300 | } else { | 305 | } else { |
301 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 306 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
302 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 307 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
303 | } | 308 | } |
304 | //设置布局管理器 | 309 | //设置布局管理器 |
305 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 310 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
306 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); | 311 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); |
307 | 312 | ||
308 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); | 313 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); |
309 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); | 314 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); |
310 | 315 | ||
311 | mRecyclerView.setLayoutManager(linearLayoutManager); | 316 | mRecyclerView.setLayoutManager(linearLayoutManager); |
312 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); | 317 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); |
313 | 318 | ||
314 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); | 319 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); |
315 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); | 320 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); |
316 | 321 | ||
317 | //设置视频适配器 | 322 | //设置视频适配器 |
318 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); | 323 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); |
319 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this); | 324 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this); |
320 | 325 | ||
321 | //版本信息适配器 | 326 | //版本信息适配器 |
322 | mRecyclerView.setAdapter(RecyclerViewadapter); | 327 | mRecyclerView.setAdapter(RecyclerViewadapter); |
323 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | 328 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); |
324 | 329 | ||
325 | //判断保卡信息是否为样机 | 330 | //判断保卡信息是否为样机 |
326 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); | 331 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); |
327 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); | 332 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); |
333 | Log.d("test","yangji"+yangji); | ||
328 | if ("1".equals(yangji)) { | 334 | if ("1".equals(yangji)) { |
329 | iv_look_card.setVisibility(View.GONE); | 335 | sssssssss.setVisibility(View.INVISIBLE); |
336 | iv_look_card.setVisibility(View.INVISIBLE); | ||
330 | tv_yangji.setVisibility(View.VISIBLE); | 337 | tv_yangji.setVisibility(View.VISIBLE); |
331 | } else { | 338 | } else { |
339 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.YANGJI, "0"); | ||
332 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); | 340 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); |
333 | 341 | ||
334 | } | 342 | } |
335 | 343 | ||
336 | 344 | ||
337 | } | 345 | } |
338 | 346 | ||
339 | private void initLister() { | 347 | private void initLister() { |
340 | iv_imformatioan.setOnClickListener(this); | 348 | iv_imformatioan.setOnClickListener(this); |
341 | iv_look_card.setOnClickListener(this); | 349 | iv_look_card.setOnClickListener(this); |
342 | tv_edit_presoninfo.setOnClickListener(this); | 350 | tv_edit_presoninfo.setOnClickListener(this); |
343 | iv_setting.setOnClickListener(this); | 351 | iv_setting.setOnClickListener(this); |
344 | iv_sign.setOnClickListener(this); | 352 | iv_sign.setOnClickListener(this); |
345 | mSimpleDraweeView.setOnClickListener(this); | 353 | mSimpleDraweeView.setOnClickListener(this); |
346 | linel_mycuoti.setOnClickListener(this); | 354 | linel_mycuoti.setOnClickListener(this); |
347 | linel_mynote.setOnClickListener(this); | 355 | linel_mynote.setOnClickListener(this); |
348 | linel_mycollege.setOnClickListener(this); | 356 | linel_mycollege.setOnClickListener(this); |
349 | linel_myclass.setOnClickListener(this); | 357 | linel_myclass.setOnClickListener(this); |
350 | 358 | ||
351 | } | 359 | } |
352 | 360 | ||
353 | @Override | 361 | @Override |
354 | public void onClick(View v) { | 362 | public void onClick(View v) { |
355 | switch (v.getId()) { | 363 | switch (v.getId()) { |
356 | case R.id.iv_imformatioan: | 364 | case R.id.iv_imformatioan: |
357 | Intent intent = new Intent(); | 365 | Intent intent = new Intent(); |
358 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 366 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
359 | startActivity(intent); | 367 | startActivity(intent); |
360 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 368 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
361 | break; | 369 | break; |
362 | case R.id.iv_look_card: | 370 | case R.id.iv_look_card: |
363 | Intent lookintent = new Intent(); | 371 | Intent lookintent = new Intent(); |
364 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 372 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
365 | startActivity(lookintent); | 373 | startActivity(lookintent); |
366 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 374 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
367 | break; | 375 | break; |
368 | case R.id.tv_edit_presoninfo: | 376 | case R.id.tv_edit_presoninfo: |
369 | Intent editintent = new Intent(); | 377 | Intent editintent = new Intent(); |
370 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 378 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
371 | startActivity(editintent); | 379 | startActivity(editintent); |
372 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 380 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
373 | break; | 381 | break; |
374 | case R.id.iv_head: | 382 | case R.id.iv_head: |
375 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 383 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
376 | break; | 384 | break; |
377 | case R.id.iv_setting: | 385 | case R.id.iv_setting: |
378 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 386 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
379 | List<MenuItem> menuItems = new ArrayList<>(); | 387 | List<MenuItem> menuItems = new ArrayList<>(); |
380 | menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户")); | 388 | menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户")); |
381 | menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理")); | 389 | menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理")); |
382 | mTopRightMenu | 390 | mTopRightMenu |
383 | .setHeight(150) //默认高度480 | 391 | .setHeight(150) //默认高度480 |
384 | .setWidth(180) //默认宽度wrap_content | 392 | .setWidth(180) //默认宽度wrap_content |
385 | .showIcon(showIcon) //显示菜单图标,默认为true | 393 | .showIcon(showIcon) //显示菜单图标,默认为true |
386 | .dimBackground(dimBg) //背景变暗,默认为true | 394 | .dimBackground(dimBg) //背景变暗,默认为true |
387 | .needAnimationStyle(needAnim) //显示动画,默认为true | 395 | .needAnimationStyle(needAnim) //显示动画,默认为true |
388 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 396 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
389 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 397 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
390 | @Override | 398 | @Override |
391 | public void onMenuItemClick(int position) { | 399 | public void onMenuItemClick(int position) { |
392 | switch (position) { | 400 | switch (position) { |
393 | case 0: | 401 | case 0: |
394 | new CircleDialog.Builder(MainActivity.this) | 402 | new CircleDialog.Builder(MainActivity.this) |
395 | .setCanceledOnTouchOutside(false) | 403 | .setCanceledOnTouchOutside(false) |
396 | .setWidth(0.4f) | 404 | .setWidth(0.4f) |
397 | .setCancelable(false) | 405 | .setCancelable(false) |
398 | .setText("您确定要退出,更换其他账号登录吗?") | 406 | .setText("您确定要退出,更换其他账号登录吗?") |
399 | .setNegative("取消", null) | 407 | .setNegative("取消", null) |
400 | .setPositive("确定", new View.OnClickListener() { | 408 | .setPositive("确定", new View.OnClickListener() { |
401 | @Override | 409 | @Override |
402 | public void onClick(View v) { | 410 | public void onClick(View v) { |
403 | String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | 411 | //String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); |
404 | int graderIDs = Integer.parseInt(graderID); | 412 | //int graderIDs = Integer.parseInt(graderID); |
405 | // if (graderIDs < 8) { | 413 | // if (graderIDs < 8) { |
406 | // Intent intentbroad = new Intent(); | 414 | // Intent intentbroad = new Intent(); |
407 | // intentbroad.putExtra("info", "小学"); | 415 | // intentbroad.putExtra("info", "小学"); |
408 | // //4、定义广播发送的action | 416 | // //4、定义广播发送的action |
409 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 417 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
410 | // //5、发送广播 | 418 | // //5、发送广播 |
411 | // sendBroadcast(intentbroad); | 419 | // sendBroadcast(intentbroad); |
412 | // Log.i("---", "发送完了"); | 420 | // Log.i("---", "发送完了"); |
413 | // } | 421 | // } |
414 | //清除数据 | 422 | //清除数据 |
415 | SaveParam.getInstance().clearData(MainActivity.this); | 423 | SaveParam.getInstance().clearData(MainActivity.this); |
416 | Intent settingintent = new Intent(); | 424 | Intent settingintent = new Intent(); |
417 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 425 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
418 | startActivity(settingintent); | 426 | startActivity(settingintent); |
419 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 427 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
420 | finish(); | 428 | finish(); |
421 | } | 429 | } |
422 | }) | 430 | }) |
423 | .show(); | 431 | .show(); |
424 | break; | 432 | break; |
425 | case 1: | 433 | case 1: |
426 | Intent accontMintent = new Intent(); | 434 | Intent accontMintent = new Intent(); |
427 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 435 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
428 | startActivity(accontMintent); | 436 | startActivity(accontMintent); |
429 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 437 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
430 | break; | 438 | break; |
431 | } | 439 | } |
432 | } | 440 | } |
433 | }) | 441 | }) |
434 | .addMenuList(menuItems) | 442 | .addMenuList(menuItems) |
435 | .showAsDropDown(iv_setting, -120, 0); | 443 | .showAsDropDown(iv_setting, -120, 0); |
436 | break; | 444 | break; |
437 | case R.id.iv_sign: | 445 | case R.id.iv_sign: |
438 | new CircleDialog.Builder(this) | 446 | new CircleDialog.Builder(this) |
439 | .setCanceledOnTouchOutside(false) | 447 | .setCanceledOnTouchOutside(false) |
440 | .setCancelable(true) | 448 | .setCancelable(true) |
441 | .setTitle("个性签名") | 449 | .setTitle("个性签名") |
442 | .setInputHint("请输入个性签名") | 450 | .setInputHint("请输入个性签名") |
443 | .setWidth(0.5f) | 451 | .setWidth(0.4f) |
452 | .setInputHeight(80) | ||
444 | .configInput(new ConfigInput() { | 453 | .configInput(new ConfigInput() { |
445 | @Override | 454 | @Override |
446 | public void onConfig(InputParams params) { | 455 | public void onConfig(InputParams params) { |
447 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 456 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
448 | } | 457 | } |
449 | }) | 458 | }) |
450 | .setNegative("取消", new View.OnClickListener() { | 459 | .setNegative("取消", new View.OnClickListener() { |
451 | @Override | 460 | @Override |
452 | public void onClick(View v) { | 461 | public void onClick(View v) { |
453 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 462 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
454 | } | 463 | } |
455 | }) | 464 | }) |
456 | .setPositiveInput("确定", new OnInputClickListener() { | 465 | .setPositiveInput("确定", new OnInputClickListener() { |
457 | @Override | 466 | @Override |
458 | public void onClick(String text, View v) { | 467 | public void onClick(String text, View v) { |
459 | if (text.equals("")) { | 468 | if (text.equals("")) { |
460 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 469 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
461 | } else { | 470 | } else { |
462 | try { | 471 | try { |
463 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 472 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
464 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 473 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
465 | String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 474 | String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
466 | Object id = null; | 475 | Object id = null; |
467 | long auserID = Long.parseLong(userID); | 476 | long auserID = Long.parseLong(userID); |
468 | int typeaccount1 = Integer.parseInt(typeaccount); | 477 | int typeaccount1 = Integer.parseInt(typeaccount); |
469 | if (typeaccount1 ==2){ | 478 | if (typeaccount1 ==2){ |
470 | id =childsID; | 479 | id =childsID; |
471 | }else { | 480 | }else { |
472 | id =auserID; | 481 | id =auserID; |
473 | } | 482 | } |
474 | HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text); | 483 | HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text); |
475 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 484 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
476 | } catch (NumberFormatException e) { | 485 | } catch (NumberFormatException e) { |
477 | e.printStackTrace(); | 486 | e.printStackTrace(); |
478 | } | 487 | } |
479 | 488 | ||
480 | tv_sign.setText(text); | 489 | tv_sign.setText(text); |
481 | } | 490 | } |
482 | 491 | ||
483 | } | 492 | } |
484 | }) | 493 | }) |
485 | .show(); | 494 | .show(); |
486 | break; | 495 | break; |
487 | case R.id.linel_mycuoti: | 496 | case R.id.linel_mycuoti: |
488 | // Intent intentbroad = new Intent(); | 497 | AlertUtils.showToast(this, "未安装该应用 "); |
489 | // //intentbroad.putExtra("info","小学"); | ||
490 | // //4、定义广播发送的action | ||
491 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | ||
492 | // //5、发送广播 | ||
493 | // sendBroadcast(intentbroad); | ||
494 | // Log.i("---", "发送完了"); | ||
495 | break; | 498 | break; |
496 | case R.id.linel_mynote: | 499 | case R.id.linel_mynote: |
497 | // Intent intentbroad1 = new Intent(); | 500 | AlertUtils.showToast(this, "未安装该应用 "); |
498 | // //intentbroad1.putExtra("info","中学"); | ||
499 | // //4、定义广播发送的action | ||
500 | // intentbroad1.setAction("com.ozing.launcher.SWITCH_GRADE"); | ||
501 | // //5、发送广播 | ||
502 | // sendBroadcast(intentbroad1); | ||
503 | // Log.i("---", "发送完了"); | ||
504 | break; | 501 | break; |
505 | case R.id.linel_mycollege: | 502 | case R.id.linel_mycollege: |
506 | AlertUtils.showToast(this, "我的收藏 "); | 503 | AlertUtils.showToast(this, "未安装该应用 "); |
507 | break; | 504 | break; |
508 | case R.id.linel_myclass: | 505 | case R.id.linel_myclass: |
509 | AlertUtils.showToast(this, "我的班级 "); | 506 | AlertUtils.showToast(this, "未安装该应用 "); |
510 | break; | 507 | break; |
511 | } | 508 | } |
512 | 509 | ||
513 | } | 510 | } |
514 | 511 | ||
515 | @Override | 512 | @Override |
516 | protected void onPause() { | 513 | protected void onPause() { |
517 | super.onPause(); | 514 | super.onPause(); |
518 | } | 515 | } |
519 | 516 | ||
520 | @Override | 517 | @Override |
521 | protected void onResume() { | 518 | protected void onResume() { |
522 | super.onResume(); | 519 | super.onResume(); |
523 | Content.changegradeinfoflag = 0; | 520 | Content.changegradeinfoflag = 0; |
524 | Content.changeadressinfoflag = 0; | 521 | Content.changeadressinfoflag = 0; |
525 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 522 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
526 | //获取个性签名 | 523 | //获取个性签名 |
527 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 524 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
528 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 525 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
529 | 526 | ||
530 | try { | 527 | try { |
531 | Object auserID = 1; | 528 | Object auserID = 1; |
532 | long id = Long.parseLong(userID); | 529 | long id = Long.parseLong(userID); |
533 | int typeaccount1 = Integer.parseInt(typeaccount); | 530 | int typeaccount1 = Integer.parseInt(typeaccount); |
534 | //获取个人信息 | 531 | //获取个人信息 |
535 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler); | 532 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler); |
536 | if (typeaccount1 == 2) { | 533 | if (typeaccount1 == 2) { |
537 | auserID = childsID; | 534 | auserID = childsID; |
538 | } else { | 535 | } else { |
539 | auserID = id; | 536 | auserID = id; |
540 | } | 537 | } |
541 | Log.e("test","个性签名的ID"+auserID); | 538 | Log.e("test","个性签名的ID"+auserID); |
542 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); | 539 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); |
543 | //获取最近播放视频 | 540 | //获取最近播放视频 |
544 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); | 541 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); |
545 | 542 | ||
546 | } catch (NumberFormatException e) { | 543 | } catch (NumberFormatException e) { |
547 | e.printStackTrace(); | 544 | e.printStackTrace(); |
548 | } | 545 | } |
549 | 546 | ||
550 | } | 547 | } |
551 | 548 | ||
552 | //回调头像监听 | 549 | //回调头像监听 |
553 | @Override | 550 | @Override |
554 | public void heard(Context context, View v, int headpitiaon) { | 551 | public void heard(Context context, View v, int headpitiaon) { |
555 | String picUrl = ""; | 552 | String picUrl = ""; |
556 | String userID; | 553 | String userID; |
557 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 554 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
558 | if ("2".equals(typeaccount)) { | 555 | if ("2".equals(typeaccount)) { |
559 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 556 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
560 | } else { | 557 | } else { |
561 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 558 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
562 | } | 559 | } |
563 | switch (v.getId()) { | 560 | switch (v.getId()) { |
564 | //选择默认图片 | 561 | //选择默认图片 |
565 | case R.id.oktakephone: | 562 | case R.id.oktakephone: |
566 | if (headpitiaon == 1) { | 563 | if (headpitiaon == 1) { |
567 | mSimpleDraweeView.setImageDrawable(null); | 564 | mSimpleDraweeView.setImageDrawable(null); |
568 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 565 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
569 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; | 566 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/75f05c02-3dbc-44e3-aec9-a73eca60ca8b.png"; |
570 | try { | 567 | try { |
571 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 568 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
572 | } catch (UnsupportedEncodingException e) { | 569 | } catch (UnsupportedEncodingException e) { |
573 | e.printStackTrace(); | 570 | e.printStackTrace(); |
574 | } | 571 | } |
575 | } else if (headpitiaon == 2) { | 572 | } else if (headpitiaon == 2) { |
576 | mSimpleDraweeView.setImageDrawable(null); | 573 | mSimpleDraweeView.setImageDrawable(null); |
577 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 574 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
578 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; | 575 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/d102b0d8-435f-45a5-908f-ea43e02176d4.png"; |
579 | try { | 576 | try { |
580 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 577 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
581 | } catch (UnsupportedEncodingException e) { | 578 | } catch (UnsupportedEncodingException e) { |
582 | e.printStackTrace(); | 579 | e.printStackTrace(); |
583 | } | 580 | } |
584 | } else if (headpitiaon == 3) { | 581 | } else if (headpitiaon == 3) { |
585 | mSimpleDraweeView.setImageDrawable(null); | 582 | mSimpleDraweeView.setImageDrawable(null); |
586 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 583 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
587 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; | 584 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/a623a8ba-5e56-4827-95d1-ffeb0d6874d5.png"; |
588 | try { | 585 | try { |
589 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 586 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
590 | } catch (UnsupportedEncodingException e) { | 587 | } catch (UnsupportedEncodingException e) { |
591 | e.printStackTrace(); | 588 | e.printStackTrace(); |
592 | } | 589 | } |
593 | } else if (headpitiaon == 4) { | 590 | } else if (headpitiaon == 4) { |
594 | mSimpleDraweeView.setImageDrawable(null); | 591 | mSimpleDraweeView.setImageDrawable(null); |
595 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 592 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
596 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; | 593 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2018-01-25/3d822736-a18d-47ae-b0b1-67752e027375.png"; |
597 | try { | 594 | try { |
598 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 595 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
599 | } catch (UnsupportedEncodingException e) { | 596 | } catch (UnsupportedEncodingException e) { |
600 | e.printStackTrace(); | 597 | e.printStackTrace(); |
601 | } | 598 | } |
602 | } else { | 599 | } else { |
603 | mSimpleDraweeView.setImageDrawable(null); | 600 | mSimpleDraweeView.setImageDrawable(null); |
604 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); | 601 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); |
605 | ; | 602 | ; |
606 | } | 603 | } |
607 | 604 | ||
608 | break; | 605 | break; |
609 | case R.id.canceltakephone: | 606 | case R.id.canceltakephone: |
610 | 607 | ||
611 | break; | 608 | break; |
612 | //拍摄和相册 | 609 | //拍摄和相册 |
613 | case R.id.take_pic: | 610 | case R.id.take_pic: |
614 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 611 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
615 | uploadAvatarFromPhotoRequest(); | 612 | uploadAvatarFromPhotoRequest(); |
616 | } | 613 | } |
617 | break; | 614 | break; |
618 | case R.id.xiangce: | 615 | case R.id.xiangce: |
619 | uploadAvatarFromAlbumRequest(); | 616 | uploadAvatarFromAlbumRequest(); |
620 | break; | 617 | break; |
621 | 618 | ||
622 | } | 619 | } |
623 | 620 | ||
624 | } | 621 | } |
625 | 622 | ||
626 | //照相 | 623 | //照相 |
627 | private void uploadAvatarFromPhotoRequest() { | 624 | private void uploadAvatarFromPhotoRequest() { |
628 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 625 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
629 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 626 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
630 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 627 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
631 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 628 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
632 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 629 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
633 | } | 630 | } |
634 | 631 | ||
635 | //选择图库 | 632 | //选择图库 |
636 | private void uploadAvatarFromAlbumRequest() { | 633 | private void uploadAvatarFromAlbumRequest() { |
637 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 634 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
638 | photoPickerIntent.setType("image/*"); | 635 | photoPickerIntent.setType("image/*"); |
639 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 636 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
640 | } | 637 | } |
641 | 638 | ||
642 | //回掉 | 639 | //回掉 |
643 | @Override | 640 | @Override |
644 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 641 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
645 | super.onActivityResult(requestCode, resultCode, data); | 642 | super.onActivityResult(requestCode, resultCode, data); |
646 | if (resultCode != -1) { | 643 | if (resultCode != -1) { |
647 | return; | 644 | return; |
648 | } | 645 | } |
649 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 646 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
650 | Uri newUri; | 647 | Uri newUri; |
651 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 648 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
652 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 649 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
653 | } else { | 650 | } else { |
654 | newUri = data.getData(); | 651 | newUri = data.getData(); |
655 | } | 652 | } |
656 | if (newUri != null) { | 653 | if (newUri != null) { |
657 | startPhotoZoom(newUri); | 654 | startPhotoZoom(newUri); |
658 | } else { | 655 | } else { |
659 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 656 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
660 | } | 657 | } |
661 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 658 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
662 | //startPhotoZoom(uri); | 659 | //startPhotoZoom(uri); |
663 | uploadAvatarFromPhoto(); | 660 | uploadAvatarFromPhoto(); |
664 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 661 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
665 | uploadAvatarFromPhoto(); | 662 | uploadAvatarFromPhoto(); |
666 | } | 663 | } |
667 | } | 664 | } |
668 | 665 | ||
669 | private void uploadAvatarFromPhoto() { | 666 | private void uploadAvatarFromPhoto() { |
670 | compressAndUploadAvatar(file.getPath()); | 667 | compressAndUploadAvatar(file.getPath()); |
671 | 668 | ||
672 | } | 669 | } |
673 | 670 | ||
674 | private void compressAndUploadAvatar(String fileSrc) { | 671 | private void compressAndUploadAvatar(String fileSrc) { |
675 | 672 | ||
676 | 673 | ||
677 | //上传到服务器 | 674 | //上传到服务器 |
678 | 675 | ||
679 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 676 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
680 | String mimeType = "image/*"; | 677 | String mimeType = "image/*"; |
681 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 678 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
682 | //String fileName = cover.getName(); | 679 | //String fileName = cover.getName(); |
683 | String userID; | 680 | String userID; |
684 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 681 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
685 | if ("2".equals(typeaccount)) { | 682 | if ("2".equals(typeaccount)) { |
686 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 683 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
687 | } else { | 684 | } else { |
688 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 685 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
689 | } | 686 | } |
690 | 687 | ||
691 | //上传头像 | 688 | //上传头像 |
692 | 689 | ||
693 | try { | 690 | try { |
694 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc); | 691 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc); |
695 | } catch (UnsupportedEncodingException e) { | 692 | } catch (UnsupportedEncodingException e) { |
696 | e.printStackTrace(); | 693 | e.printStackTrace(); |
697 | } | 694 | } |
698 | 695 | ||
699 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 696 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
700 | GenericDraweeHierarchy hierarchy = builder | 697 | GenericDraweeHierarchy hierarchy = builder |
701 | .setDesiredAspectRatio(1f) | 698 | .setDesiredAspectRatio(1f) |
702 | .setFailureImage(R.mipmap.header_default) | 699 | .setFailureImage(R.mipmap.header_default) |
703 | //圆形头像 | 700 | //圆形头像 |
704 | .setRoundingParams(RoundingParams.asCircle()) | 701 | .setRoundingParams(RoundingParams.asCircle()) |
705 | .build(); | 702 | .build(); |
706 | 703 | ||
707 | //加载本地图片 | 704 | //加载本地图片 |
708 | Uri uri = Uri.fromFile(cover); | 705 | Uri uri = Uri.fromFile(cover); |
709 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 706 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
710 | .setOldController(mSimpleDraweeView.getController()) | 707 | .setOldController(mSimpleDraweeView.getController()) |
711 | .setUri(uri) | 708 | .setUri(uri) |
712 | .build(); | 709 | .build(); |
713 | mSimpleDraweeView.setHierarchy(hierarchy); | 710 | mSimpleDraweeView.setHierarchy(hierarchy); |
714 | mSimpleDraweeView.setController(controller); | 711 | mSimpleDraweeView.setController(controller); |
715 | 712 | ||
716 | } | 713 | } |
717 | 714 | ||
718 | public void startPhotoZoom(Uri uri) { | 715 | public void startPhotoZoom(Uri uri) { |
719 | Intent intent = new Intent("com.android.camera.action.CROP"); | 716 | Intent intent = new Intent("com.android.camera.action.CROP"); |
720 | intent.setDataAndType(uri, "image/*"); | 717 | intent.setDataAndType(uri, "image/*"); |
721 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 718 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
722 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 719 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
723 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 720 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
724 | intent.putExtra("aspectY", 1);// x:y=1:1 | 721 | intent.putExtra("aspectY", 1);// x:y=1:1 |
725 | // intent.putExtra("outputX", 400);//图片输出大小 | 722 | // intent.putExtra("outputX", 400);//图片输出大小 |
726 | // intent.putExtra("outputY", 400); | 723 | // intent.putExtra("outputY", 400); |
727 | intent.putExtra("output", Uri.fromFile(file)); | 724 | intent.putExtra("output", Uri.fromFile(file)); |
728 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 725 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
729 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 726 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
730 | } | 727 | } |
731 | 728 | ||
732 | @Override | 729 | @Override |
733 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 730 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
734 | switch (requestCode) { | 731 | switch (requestCode) { |
735 | 732 | ||
736 | case PermissionUtil.REQUEST_SHOWCAMERA: | 733 | case PermissionUtil.REQUEST_SHOWCAMERA: |
737 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 734 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
738 | // Permission Granted | 735 | // Permission Granted |
739 | uploadAvatarFromPhotoRequest(); | 736 | uploadAvatarFromPhotoRequest(); |
740 | 737 | ||
741 | } else { | 738 | } else { |
742 | if (!SharedPreferenceMark.getHasShowCamera()) { | 739 | if (!SharedPreferenceMark.getHasShowCamera()) { |
743 | SharedPreferenceMark.setHasShowCamera(true); | 740 | SharedPreferenceMark.setHasShowCamera(true); |
744 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 741 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
745 | 742 | ||
746 | } else { | 743 | } else { |
747 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 744 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
748 | .show(); | 745 | .show(); |
749 | } | 746 | } |
750 | } | 747 | } |
751 | break; | 748 | break; |
752 | default: | 749 | default: |
753 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 750 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
754 | } | 751 | } |
755 | } | 752 | } |
756 | 753 | ||
757 | 754 | ||
758 | private long exitTime = 0; | 755 | private long exitTime = 0; |
759 | 756 | ||
760 | @Override | 757 | @Override |
761 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 758 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
762 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 759 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
763 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 760 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
764 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 761 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
765 | Toast.LENGTH_SHORT).show(); | 762 | Toast.LENGTH_SHORT).show(); |
766 | exitTime = System.currentTimeMillis(); | 763 | exitTime = System.currentTimeMillis(); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/LoginFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
8 | import android.support.v4.app.Fragment; | 8 | import android.support.v4.app.Fragment; |
9 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
13 | import android.widget.Button; | 13 | import android.widget.Button; |
14 | import android.widget.EditText; | 14 | import android.widget.EditText; |
15 | import android.widget.TextView; | 15 | import android.widget.TextView; |
16 | import android.widget.Toast; | 16 | import android.widget.Toast; |
17 | 17 | ||
18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; | 19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; |
20 | import com.hjx.personalcenter.activity.MainActivity; | 20 | import com.hjx.personalcenter.activity.MainActivity; |
21 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | 21 | import com.hjx.personalcenter.activity.RegisterInfoActivity; |
22 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 22 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
23 | import com.hjx.personalcenter.db.Content; | 23 | import com.hjx.personalcenter.db.Content; |
24 | import com.hjx.personalcenter.db.SaveParam; | 24 | import com.hjx.personalcenter.db.SaveParam; |
25 | import com.hjx.personalcenter.http.HttpCode; | 25 | import com.hjx.personalcenter.http.HttpCode; |
26 | import com.hjx.personalcenter.http.HttpManager; | 26 | import com.hjx.personalcenter.http.HttpManager; |
27 | import com.hjx.personalcenter.util.AlertUtils; | 27 | import com.hjx.personalcenter.util.AlertUtils; |
28 | import com.hjx.personalcenter.util.GetDevicesUtil; | 28 | import com.hjx.personalcenter.util.GetDevicesUtil; |
29 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 29 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
30 | 30 | ||
31 | import org.json.JSONException; | 31 | import org.json.JSONException; |
32 | import org.json.JSONObject; | 32 | import org.json.JSONObject; |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * 登录 | 35 | * 登录 |
36 | * Created by h on 2017/8/8. | 36 | * Created by h on 2017/8/8. |
37 | */ | 37 | */ |
38 | 38 | ||
39 | public class LoginFragment extends Fragment implements View.OnClickListener { | 39 | public class LoginFragment extends Fragment implements View.OnClickListener { |
40 | private View mView; | 40 | private View mView; |
41 | private int type; | 41 | private int type; |
42 | private TextView tv_forget_pwd; | 42 | private TextView tv_forget_pwd; |
43 | private Button btn_login; | 43 | private Button btn_login; |
44 | private EditText phonenumber, login_pwwd; | 44 | private EditText phonenumber, login_pwwd; |
45 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 45 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
46 | Intent intent = new Intent(); | 46 | Intent intent = new Intent(); |
47 | 47 | ||
48 | public static LoginFragment newInstance(int type) { | 48 | public static LoginFragment newInstance(int type) { |
49 | LoginFragment fragment = new LoginFragment(); | 49 | LoginFragment fragment = new LoginFragment(); |
50 | Bundle bundle = new Bundle(); | 50 | Bundle bundle = new Bundle(); |
51 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 51 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
52 | fragment.setArguments(bundle); | 52 | fragment.setArguments(bundle); |
53 | return fragment; | 53 | return fragment; |
54 | 54 | ||
55 | } | 55 | } |
56 | 56 | ||
57 | Handler handler = new Handler() { | 57 | Handler handler = new Handler() { |
58 | @Override | 58 | @Override |
59 | public void handleMessage(Message msg) { | 59 | public void handleMessage(Message msg) { |
60 | super.handleMessage(msg); | 60 | super.handleMessage(msg); |
61 | 61 | ||
62 | switch (msg.what) { | 62 | switch (msg.what) { |
63 | case HttpCode.LOGIN_SUCESS: | 63 | case HttpCode.LOGIN_SUCESS: |
64 | JSONObject jsonObject; | 64 | JSONObject jsonObject; |
65 | String status; | 65 | String status; |
66 | try { | 66 | try { |
67 | jsonObject = new JSONObject((String) msg.obj); | 67 | jsonObject = new JSONObject((String) msg.obj); |
68 | status = jsonObject.getString("status"); | 68 | status = jsonObject.getString("status"); |
69 | if (status.equals("100")) { | 69 | if (status.equals("100")) { |
70 | String access_token = jsonObject.getString("access_token"); | 70 | String access_token = jsonObject.getString("access_token"); |
71 | String userId = jsonObject.getString("userId"); | 71 | String userId = jsonObject.getString("userId"); |
72 | final String name = phonenumber.getText().toString().trim(); | 72 | final String name = phonenumber.getText().toString().trim(); |
73 | final String pwd = login_pwwd.getText().toString().trim(); | 73 | final String pwd = login_pwwd.getText().toString().trim(); |
74 | // | 74 | // |
75 | try { | 75 | try { |
76 | long auserID = Long.parseLong(userId); | 76 | long auserID = Long.parseLong(userId); |
77 | //检测注册信息是否完整 | 77 | //检测注册信息是否完整 |
78 | HttpManager.getInstance().registerinfocheck(getActivity(), auserID, handler); | 78 | HttpManager.getInstance().registerinfocheck(getActivity(), auserID, handler); |
79 | //登录成功,保存登录数据并且获取个人信息 | 79 | //登录成功,保存登录数据并且获取个人信息 |
80 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, userId); | 80 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, userId); |
81 | 81 | ||
82 | 82 | ||
83 | } catch (NumberFormatException e) { | 83 | } catch (NumberFormatException e) { |
84 | e.printStackTrace(); | 84 | e.printStackTrace(); |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | } else if (status.equals("200")) { | 88 | } else if (status.equals("200")) { |
89 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); | 89 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); |
90 | return; | 90 | return; |
91 | } else if (status.equals("204")) { | 91 | } else if (status.equals("204")) { |
92 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); | 92 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); |
93 | } else { | 93 | } else { |
94 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); | 94 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); |
95 | 95 | ||
96 | 96 | ||
97 | } | 97 | } |
98 | } catch (JSONException e) { | 98 | } catch (JSONException e) { |
99 | e.printStackTrace(); | 99 | e.printStackTrace(); |
100 | } | 100 | } |
101 | break; | 101 | break; |
102 | case HttpCode.REGISTER_SUCESS: | 102 | case HttpCode.REGISTER_SUCESS: |
103 | try { | 103 | try { |
104 | jsonObject = new JSONObject((String) msg.obj); | 104 | jsonObject = new JSONObject((String) msg.obj); |
105 | status = jsonObject.optString("status"); | 105 | status = jsonObject.optString("status"); |
106 | JSONObject isregisterinfo = (JSONObject) jsonObject.opt("data"); | 106 | JSONObject isregisterinfo = (JSONObject) jsonObject.opt("data"); |
107 | boolean isRegisterInfoComplete = isregisterinfo.optBoolean("isRegisterInfoComplete"); | 107 | boolean isRegisterInfoComplete = isregisterinfo.optBoolean("isRegisterInfoComplete"); |
108 | if (status.equals("1")) { | 108 | if (status.equals("1")) { |
109 | if (!isRegisterInfoComplete) { | 109 | if (!isRegisterInfoComplete) { |
110 | Content.accountflag = 1; | 110 | Content.accountflag = 1; |
111 | Intent intent = new Intent(); | 111 | Intent intent = new Intent(); |
112 | intent.setClass(getActivity(), RegisterInfoActivity.class); | 112 | intent.setClass(getActivity(), RegisterInfoActivity.class); |
113 | getActivity().startActivity(intent); | 113 | getActivity().startActivity(intent); |
114 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 114 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
115 | } else { | 115 | } else { |
116 | String deviceNumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | 116 | String deviceNumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); |
117 | //是否填写保卡 | 117 | //是否填写保卡 |
118 | HttpManager.getInstance().cardinfocheck(getActivity(), deviceNumber, handler); | 118 | HttpManager.getInstance().cardinfocheck(getActivity(), deviceNumber, handler); |
119 | 119 | ||
120 | 120 | ||
121 | } | 121 | } |
122 | 122 | ||
123 | } else { | 123 | } else { |
124 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | 124 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); |
125 | } | 125 | } |
126 | 126 | ||
127 | } catch (JSONException e) { | 127 | } catch (JSONException e) { |
128 | e.printStackTrace(); | 128 | e.printStackTrace(); |
129 | } | 129 | } |
130 | 130 | ||
131 | break; | 131 | break; |
132 | case HttpCode.CHECKCARD: | 132 | case HttpCode.CHECKCARD: |
133 | try { | 133 | try { |
134 | jsonObject = new JSONObject((String) msg.obj); | 134 | jsonObject = new JSONObject((String) msg.obj); |
135 | status = jsonObject.optString("status"); | 135 | status = jsonObject.optString("status"); |
136 | if (status.equals("1")) { | 136 | if (status.equals("1")) { |
137 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); | 137 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); |
138 | Intent intent = new Intent(); | 138 | Intent intent = new Intent(); |
139 | intent.setClass(getActivity(), MainActivity.class); | 139 | intent.setClass(getActivity(), MainActivity.class); |
140 | getActivity().startActivity(intent); | 140 | getActivity().startActivity(intent); |
141 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 141 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
142 | getActivity().finish(); | 142 | getActivity().finish(); |
143 | 143 | ||
144 | } else if (status.equals("2002")) { | 144 | } else if (status.equals("2002")) { |
145 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.YANGJI, "1"); | 145 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.YANGJI, "1"); |
146 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); | 146 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); |
147 | Intent intent = new Intent(); | 147 | Intent intent = new Intent(); |
148 | intent.setClass(getActivity(), MainActivity.class); | 148 | intent.setClass(getActivity(), MainActivity.class); |
149 | getActivity().startActivity(intent); | 149 | getActivity().startActivity(intent); |
150 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 150 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
151 | } else if (status.equals("2001")) { | 151 | } else if (status.equals("2001")) { |
152 | SaveParam.getInstance().saveCustomizeParam(getActivity(),SaveParam.CARDPHONE,""); | ||
152 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); | 153 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); |
153 | } else { | 154 | } else { |
154 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | 155 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); |
155 | } | 156 | } |
156 | 157 | ||
157 | } catch (JSONException e) { | 158 | } catch (JSONException e) { |
158 | e.printStackTrace(); | 159 | e.printStackTrace(); |
159 | } | 160 | } |
160 | 161 | ||
161 | break; | 162 | break; |
162 | } | 163 | } |
163 | } | 164 | } |
164 | }; | 165 | }; |
165 | 166 | ||
166 | @Override | 167 | @Override |
167 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 168 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
168 | if (mView == null) { | 169 | if (mView == null) { |
169 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); | 170 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); |
170 | initView(mView); | 171 | initView(mView); |
171 | initData(); | 172 | initData(); |
172 | setLister(); | 173 | setLister(); |
173 | |||
174 | |||
175 | } | 174 | } |
176 | return mView; | 175 | return mView; |
177 | } | 176 | } |
178 | 177 | ||
179 | //初始化 | 178 | //初始化 |
180 | private void initView(View mView) { | 179 | private void initView(View mView) { |
181 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); | 180 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); |
182 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); | 181 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); |
183 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); | 182 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); |
184 | btn_login = (Button) mView.findViewById(R.id.btn_login); | 183 | btn_login = (Button) mView.findViewById(R.id.btn_login); |
185 | 184 | ||
186 | } | 185 | } |
187 | 186 | ||
188 | private void initData() { | 187 | private void initData() { |
189 | } | 188 | } |
190 | 189 | ||
191 | private void setLister() { | 190 | private void setLister() { |
192 | tv_forget_pwd.setOnClickListener(this); | 191 | tv_forget_pwd.setOnClickListener(this); |
193 | btn_login.setOnClickListener(this); | 192 | btn_login.setOnClickListener(this); |
194 | } | 193 | } |
195 | 194 | ||
196 | 195 | ||
197 | @Override | 196 | @Override |
198 | public void onClick(View v) { | 197 | public void onClick(View v) { |
199 | switch (v.getId()) { | 198 | switch (v.getId()) { |
200 | case R.id.tv_forget_pwd: | 199 | case R.id.tv_forget_pwd: |
201 | intent.setClass(getActivity(), ForgotPasswordActivity.class); | 200 | intent.setClass(getActivity(), ForgotPasswordActivity.class); |
202 | startActivity(intent); | 201 | startActivity(intent); |
203 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 202 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
204 | break; | 203 | break; |
205 | case R.id.btn_login: | 204 | case R.id.btn_login: |
206 | login(); | 205 | login(); |
207 | break; | 206 | break; |
208 | } | 207 | } |
209 | 208 | ||
210 | } | 209 | } |
211 | 210 | ||
212 | private void login() { | 211 | private void login() { |
213 | final String name = phonenumber.getText().toString().trim(); | 212 | final String name = phonenumber.getText().toString().trim(); |
214 | final String pwd = login_pwwd.getText().toString().trim(); | 213 | final String pwd = login_pwwd.getText().toString().trim(); |
215 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { | 214 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { |
216 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); | 215 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); |
217 | return; | 216 | return; |
218 | } else if (!PhoneNumCheckUtils.isPhone(name)) { | 217 | } else if (!PhoneNumCheckUtils.isPhone(name)) { |
219 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); | 218 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); |
220 | } else { | 219 | } else { |
221 | //登录接口 | 220 | //登录接口 |
222 | HttpManager.getInstance().login(name, pwd, getActivity(), handler); | 221 | HttpManager.getInstance().login(name, pwd, getActivity(), handler); |
223 | } | 222 | } |
224 | 223 | ||
225 | 224 | ||
226 | } | 225 | } |
227 | } | 226 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/UserInfoModer.java
1 | package com.hjx.personalcenter.model; | 1 | package com.hjx.personalcenter.model; |
2 | 2 | ||
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Created by h on 2017/11/23. | 6 | * Created by h on 2017/11/23. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | public class UserInfoModer implements Serializable { | 9 | public class UserInfoModer implements Serializable { |
10 | private String nickName; | 10 | private String nickName; |
11 | private String gender; | 11 | private String gender; |
12 | private String address; | 12 | private String address; |
13 | private String portrait; | 13 | private String portrait; |
14 | private String school; | 14 | private String school; |
15 | private String grade; | 15 | private String grade; |
16 | private String gradeid; | 16 | private String gradeid; |
17 | private String birthday; | ||
18 | private String qq; | ||
19 | private String isprototype; | ||
17 | 20 | ||
18 | public String getIsprototype() { | 21 | public String getIsprototype() { |
19 | return isprototype; | 22 | return isprototype; |
20 | } | 23 | } |
21 | 24 | ||
22 | public void setIsprototype(String isprototype) { | 25 | public void setIsprototype(String isprototype) { |
23 | this.isprototype = isprototype; | 26 | this.isprototype = isprototype; |
24 | } | 27 | } |
25 | |||
26 | private String isprototype; | ||
27 | |||
28 | public String getGradeid() { | 28 | public String getGradeid() { |
29 | return gradeid; | 29 | return gradeid; |
30 | } | 30 | } |
31 | |||
32 | public void setGradeid(String gradeid) { | 31 | public void setGradeid(String gradeid) { |
33 | this.gradeid = gradeid; | 32 | this.gradeid = gradeid; |
34 | } | 33 | } |
35 | 34 | ||
36 | private String birthday; | ||
37 | private String qq; | ||
38 | |||
39 | public String getNickName() { | 35 | public String getNickName() { |
40 | return nickName; | 36 | return nickName; |
41 | } | 37 | } |
42 | 38 | ||
43 | public void setNickName(String nickName) { | 39 | public void setNickName(String nickName) { |
44 | this.nickName = nickName; | 40 | this.nickName = nickName; |
45 | } | 41 | } |
46 | 42 | ||
47 | public String getGender() { | 43 | public String getGender() { |
48 | return gender; | 44 | return gender; |
49 | } | 45 | } |
50 | 46 | ||
51 | public void setGender(String gender) { | 47 | public void setGender(String gender) { |
52 | this.gender = gender; | 48 | this.gender = gender; |
53 | } | 49 | } |
54 | 50 | ||
55 | public String getAddress() { | 51 | public String getAddress() { |
56 | return address; | 52 | return address; |
57 | } | 53 | } |
58 | 54 | ||
59 | public void setAddress(String address) { | 55 | public void setAddress(String address) { |
60 | this.address = address; | 56 | this.address = address; |
61 | } | 57 | } |
62 | 58 | ||
63 | public String getPortrait() { | 59 | public String getPortrait() { |
64 | return portrait; | 60 | return portrait; |
65 | } | 61 | } |
66 | 62 | ||
67 | public void setPortrait(String portrait) { | 63 | public void setPortrait(String portrait) { |
68 | this.portrait = portrait; | 64 | this.portrait = portrait; |
69 | } | 65 | } |
70 | 66 | ||
71 | public String getSchool() { | 67 | public String getSchool() { |
72 | return school; | 68 | return school; |
73 | } | 69 | } |
74 | 70 | ||
75 | public void setSchool(String school) { | 71 | public void setSchool(String school) { |
76 | this.school = school; | 72 | this.school = school; |
77 | } | 73 | } |
78 | 74 | ||
79 | public String getGrade() { | 75 | public String getGrade() { |
80 | return grade; | 76 | return grade; |
81 | } | 77 | } |
82 | 78 | ||
83 | public void setGrade(String grade) { | 79 | public void setGrade(String grade) { |
84 | this.grade = grade; | 80 | this.grade = grade; |
85 | } | 81 | } |
86 | 82 | ||
87 | public String getBirthday() { | 83 | public String getBirthday() { |
88 | return birthday; | 84 | return birthday; |
89 | } | 85 | } |
90 | 86 | ||
91 | public void setBirthday(String birthday) { | 87 | public void setBirthday(String birthday) { |
92 | this.birthday = birthday; | 88 | this.birthday = birthday; |
93 | } | 89 | } |
94 | 90 | ||
95 | public String getQq() { | 91 | public String getQq() { |
96 | return qq; | 92 | return qq; |
97 | } | 93 | } |
98 | 94 | ||
99 | public void setQq(String qq) { | 95 | public void setQq(String qq) { |
100 | this.qq = qq; | 96 | this.qq = qq; |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/CenterService.java
1 | package com.hjx.personalcenter.service; | 1 | package com.hjx.personalcenter.service; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.IBinder; | 4 | import android.os.IBinder; |
5 | import android.os.RemoteException; | 5 | import android.os.RemoteException; |
6 | 6 | ||
7 | import com.google.gson.Gson; | 7 | import com.google.gson.Gson; |
8 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 8 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
9 | import com.hjx.personalcenter.db.SaveParam; | 9 | import com.hjx.personalcenter.db.SaveParam; |
10 | import com.hjx.personalcenter.model.CardInfo; | 10 | import com.hjx.personalcenter.model.CardInfo; |
11 | import com.hjx.personalcenter.model.LoginInfo; | 11 | import com.hjx.personalcenter.model.LoginInfo; |
12 | import com.hjx.personalcenter.model.UserInfoModer; | 12 | import com.hjx.personalcenter.model.UserInfoModer; |
13 | import com.hjx.personalcenter.util.GetDevicesUtil; | 13 | import com.hjx.personalcenter.util.GetDevicesUtil; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Created by h on 2017/9/1. | 16 | * Created by h on 2017/9/1. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | public class CenterService extends BaseService { | 19 | public class CenterService extends BaseService { |
20 | enum ACTIVITY_ACTION{ | 20 | enum ACTIVITY_ACTION{ |
21 | userinfo_activity | 21 | userinfo_activity |
22 | } | 22 | } |
23 | public CenterService(){ | 23 | public CenterService(){ |
24 | 24 | ||
25 | } | 25 | } |
26 | IPresonalInterface.Stub binder = new IPresonalInterface.Stub() { | 26 | IPresonalInterface.Stub binder = new IPresonalInterface.Stub() { |
27 | @Override | 27 | @Override |
28 | public String sayHello() throws RemoteException { | 28 | public String sayHello() throws RemoteException { |
29 | return "这是测试AIDL的方法"; | 29 | return "这是测试AIDL的方法"; |
30 | } | 30 | } |
31 | 31 | ||
32 | @Override | 32 | @Override |
33 | public String viewPage(String action) throws RemoteException { | 33 | public String viewPage(String action) throws RemoteException { |
34 | String result = null; | 34 | String result = null; |
35 | if(action.equals(ACTIVITY_ACTION.userinfo_activity.toString())){ | 35 | if(action.equals(ACTIVITY_ACTION.userinfo_activity.toString())){ |
36 | //登录界面 | 36 | //登录界面 |
37 | Intent intent = new Intent(); | 37 | Intent intent = new Intent(); |
38 | intent.setClass(CenterService.this, LoginAndRegisterActivity.class); | 38 | intent.setClass(CenterService.this, LoginAndRegisterActivity.class); |
39 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 39 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
40 | startActivity(intent); | 40 | startActivity(intent); |
41 | result= "跳转成功"; | 41 | result= "跳转成功"; |
42 | } | 42 | } |
43 | 43 | ||
44 | return result; | 44 | return result; |
45 | } | 45 | } |
46 | 46 | ||
47 | @Override | 47 | @Override |
48 | public String getSimpleUser() throws RemoteException { | 48 | public String getSimpleUser() throws RemoteException { |
49 | String logininfo = null; | 49 | String logininfo = null; |
50 | Gson gson = new Gson(); | 50 | Gson gson = new Gson(); |
51 | LoginInfo loginInfo = new LoginInfo(); | 51 | LoginInfo loginInfo = new LoginInfo(); |
52 | String islogin = SaveParam.getInstance().getLoginParam(getApplication(),"login"); | 52 | String islogin = SaveParam.getInstance().getLoginParam(getApplication(),"login"); |
53 | //子账户id | 53 | //子账户id |
54 | String childsidid = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CHILDSID); | 54 | String childsidid = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CHILDSID); |
55 | //账户类型 | 55 | //账户类型 |
56 | String accounts = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ACCOUNT); | 56 | String accounts = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ACCOUNT); |
57 | if ("true".equals(islogin)){ | 57 | if ("true".equals(islogin)){ |
58 | loginInfo.setUsername(SaveParam.getInstance().getLoginParam(getApplication(), "username")); | 58 | loginInfo.setUsername(SaveParam.getInstance().getLoginParam(getApplication(), "username")); |
59 | loginInfo.setPassword(SaveParam.getInstance().getLoginParam(getApplication(), "password")); | 59 | loginInfo.setPassword(SaveParam.getInstance().getLoginParam(getApplication(), "password")); |
60 | loginInfo.setAccess_token(SaveParam.getInstance().getLoginParam(getApplication(), "access_token")); | 60 | loginInfo.setAccess_token(SaveParam.getInstance().getLoginParam(getApplication(), "access_token")); |
61 | loginInfo.setLoginStatus(SaveParam.getInstance().getLoginParam(getApplication(), "login")); | 61 | loginInfo.setLoginStatus(SaveParam.getInstance().getLoginParam(getApplication(), "login")); |
62 | 62 | ||
63 | if ("2".equals(accounts)){ | 63 | if ("2".equals(accounts)){ |
64 | loginInfo.setUserId(childsidid); | 64 | loginInfo.setUserId(childsidid); |
65 | }else { | 65 | }else { |
66 | loginInfo.setUserId(SaveParam.getInstance().getLoginParam(getApplication(), "userId")); | 66 | loginInfo.setUserId(SaveParam.getInstance().getLoginParam(getApplication(), "userId")); |
67 | } | 67 | } |
68 | 68 | ||
69 | logininfo =gson.toJson(loginInfo); | 69 | logininfo =gson.toJson(loginInfo); |
70 | 70 | ||
71 | //Log.e("test","登录信息"+logininfo); | 71 | //Log.e("test","登录信息"+logininfo); |
72 | 72 | ||
73 | } | 73 | } |
74 | 74 | ||
75 | return logininfo; | 75 | return logininfo; |
76 | } | 76 | } |
77 | //保卡信息 | 77 | //保卡信息 |
78 | @Override | 78 | @Override |
79 | public String getcardUser() throws RemoteException { | 79 | public String getcardUser() throws RemoteException { |
80 | String results = null; | 80 | String results = null; |
81 | // CardInfo cardInfo = new CardInfo(); | 81 | // CardInfo cardInfo = new CardInfo(); |
82 | CardInfo.DataBean dataBean = new CardInfo.DataBean(); | 82 | CardInfo.DataBean dataBean = new CardInfo.DataBean(); |
83 | Gson gson = new Gson(); | 83 | Gson gson = new Gson(); |
84 | 84 | ||
85 | //获取设备信息 | 85 | //获取设备信息 |
86 | dataBean.setProductModel(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceModel()); | 86 | dataBean.setProductModel(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceModel()); |
87 | dataBean.setDeviceNumber(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceNumber()); | 87 | dataBean.setDeviceNumber(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceNumber()); |
88 | dataBean.setMacAddress(GetDevicesUtil.getDevicesInfo(getApplication()).getMac()); | 88 | dataBean.setMacAddress(GetDevicesUtil.getDevicesInfo(getApplication()).getMac()); |
89 | //获取保卡信息 | 89 | //获取保卡信息 |
90 | dataBean.setCustomerName(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CUNSTEMNAME)); | 90 | dataBean.setCustomerName(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CUNSTEMNAME)); |
91 | dataBean.setCustomerAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ADRESSCUNSTEM)); | 91 | dataBean.setCustomerAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ADRESSCUNSTEM)); |
92 | dataBean.setBuyTime(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTIME)); | 92 | dataBean.setBuyTime(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTIME)); |
93 | dataBean.setBuyAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPADRESS)); | 93 | dataBean.setBuyAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPADRESS)); |
94 | dataBean.setAlterSaleCall(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTLEPHONE)); | 94 | dataBean.setAlterSaleCall(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTLEPHONE)); |
95 | dataBean.setMobilePhone(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CARDPHONE)); | 95 | dataBean.setMobilePhone(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CARDPHONE)); |
96 | // cardInfo.setData(dataBean); | 96 | // cardInfo.setData(dataBean); |
97 | results =gson.toJson(dataBean); | 97 | |
98 | //Log.e("test","保卡信息"+results); | 98 | //Log.e("test","保卡信息"+results); |
99 | String yangji = SaveParam.getInstance().getLoginParam(getApplication(), SaveParam.YANGJI); | ||
100 | if ("1".equals(yangji)) { | ||
101 | results = null; | ||
102 | } else { | ||
103 | results = gson.toJson(dataBean); | ||
104 | } | ||
105 | |||
99 | return results; | 106 | return results; |
100 | 107 | ||
101 | } | 108 | } |
102 | 109 | ||
103 | @Override | 110 | @Override |
104 | public String getUserInfo() throws RemoteException { | 111 | public String getUserInfo() throws RemoteException { |
105 | String userinfo = null; | 112 | String userinfo = null; |
106 | Gson gson = new Gson(); | 113 | Gson gson = new Gson(); |
107 | UserInfoModer userInfoModer = new UserInfoModer(); | 114 | UserInfoModer userInfoModer = new UserInfoModer(); |
108 | userInfoModer.setNickName(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTUSERNAME)); | 115 | userInfoModer.setNickName(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTUSERNAME)); |
109 | userInfoModer.setGrade(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTGRADES)); | 116 | userInfoModer.setGrade(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTGRADES)); |
110 | userInfoModer.setSchool(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSCHOOL)); | 117 | userInfoModer.setSchool(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSCHOOL)); |
111 | userInfoModer.setBirthday(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTCONSTELLATION)); | 118 | userInfoModer.setBirthday(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTCONSTELLATION)); |
112 | userInfoModer.setGender(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSEX)); | 119 | userInfoModer.setGender(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSEX)); |
113 | userInfoModer.setQq(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTQQ)); | 120 | userInfoModer.setQq(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTQQ)); |
114 | userInfoModer.setAddress(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTXINGZUO)); | 121 | userInfoModer.setAddress(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTXINGZUO)); |
115 | userInfoModer.setPortrait(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.PORTAIT)); | 122 | userInfoModer.setPortrait(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.PORTAIT)); |
116 | userInfoModer.setGradeid(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.GRADENS)); | 123 | userInfoModer.setGradeid(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.GRADENS)); |
117 | userInfoModer.setIsprototype(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ISYANGJI)); | 124 | userInfoModer.setIsprototype(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.YANGJI)); |
118 | userinfo = gson.toJson(userInfoModer); | 125 | userinfo = gson.toJson(userInfoModer); |
119 | return userinfo; | 126 | return userinfo; |
120 | } | 127 | } |
121 | 128 | ||
122 | @Override | 129 | @Override |
123 | public String logout() throws RemoteException { | 130 | public String logout() throws RemoteException { |
124 | String visoninfo = SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.VERSIONINTEFACE); | 131 | String visoninfo = SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.VERSIONINTEFACE); |
125 | return visoninfo; | 132 | return visoninfo; |
126 | } | 133 | } |
127 | 134 | ||
128 | @Override | 135 | @Override |
129 | public String validateToken() throws RemoteException { | 136 | public String validateToken() throws RemoteException { |
130 | return null; | 137 | return null; |
131 | } | 138 | } |
132 | 139 | ||
133 | @Override | 140 | @Override |
134 | public String getDeviceID() throws RemoteException { | 141 | public String getDeviceID() throws RemoteException { |
135 | return null; | 142 | return null; |
136 | } | 143 | } |
137 | 144 | ||
138 | @Override | 145 | @Override |
139 | public String getChildsInfo() throws RemoteException { | 146 | public String getChildsInfo() throws RemoteException { |
140 | return null; | 147 | return null; |
141 | } | 148 | } |
142 | }; | 149 | }; |
143 | 150 | ||
144 | @Override | 151 | @Override |
145 | public IBinder onBind(Intent intent) { | 152 | public IBinder onBind(Intent intent) { |
146 | return binder; | 153 | return binder; |
147 | } | 154 | } |
148 | 155 | ||
149 | @Override | 156 | @Override |
150 | public void onDestroy() { | 157 | public void onDestroy() { |
151 | super.onDestroy(); | 158 | super.onDestroy(); |
152 | } | 159 | } |
153 | } | 160 | } |
154 | 161 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/AlertUtils.java
1 | package com.hjx.personalcenter.util; | 1 | package com.hjx.personalcenter.util; |
2 | 2 | ||
3 | 3 | ||
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.widget.Toast; | 5 | import android.widget.Toast; |
6 | 6 | ||
7 | public class AlertUtils { | 7 | public class AlertUtils { |
8 | public static void showToast(Context context, String msg) { | 8 | public static void showToast(Context context, String msg) { |
9 | Toast.makeText(context, msg, Toast.LENGTH_LONG).show(); | 9 | Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); |
10 | } | 10 | } |
11 | } | 11 | } |
12 | 12 |
PersonalCenter/app/src/main/res/layout/activity_main.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
6 | android:background="@color/white" | 6 | android:background="@color/white" |
7 | android:orientation="vertical"> | 7 | android:orientation="vertical"> |
8 | 8 | ||
9 | <RelativeLayout | 9 | <RelativeLayout |
10 | android:id="@+id/title" | 10 | android:id="@+id/title" |
11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
12 | android:layout_height="50dp" | 12 | android:layout_height="50dp" |
13 | android:background="@color/login_text_blue"> | 13 | android:background="@color/login_text_blue"> |
14 | 14 | ||
15 | <ImageView | 15 | <ImageView |
16 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
17 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
18 | android:layout_height="match_parent" | 18 | android:layout_height="match_parent" |
19 | android:paddingLeft="20dp" | 19 | android:paddingLeft="20dp" |
20 | android:paddingRight="20dp" | 20 | android:paddingRight="20dp" |
21 | android:visibility="gone" | 21 | android:visibility="gone" |
22 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
23 | 23 | ||
24 | <TextView | 24 | <TextView |
25 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
27 | android:layout_height="match_parent" | 27 | android:layout_height="match_parent" |
28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
29 | android:gravity="center_vertical" | 29 | android:gravity="center_vertical" |
30 | android:text="@string/titel_preson" | 30 | android:text="@string/titel_preson" |
31 | android:textColor="@android:color/white" | 31 | android:textColor="@android:color/white" |
32 | android:textSize="22sp" /> | 32 | android:textSize="22sp" /> |
33 | 33 | ||
34 | <ImageView | 34 | <ImageView |
35 | android:id="@+id/iv_setting" | 35 | android:id="@+id/iv_setting" |
36 | android:layout_width="wrap_content" | 36 | android:layout_width="wrap_content" |
37 | android:layout_height="match_parent" | 37 | android:layout_height="match_parent" |
38 | android:layout_marginRight="10dp" | 38 | android:layout_marginRight="10dp" |
39 | android:layout_toLeftOf="@+id/iv_skin" | 39 | android:layout_toLeftOf="@+id/iv_skin" |
40 | android:gravity="center_vertical" | 40 | android:gravity="center_vertical" |
41 | android:padding="10dp" | 41 | android:padding="10dp" |
42 | android:src="@mipmap/shezhi1" | 42 | android:src="@mipmap/shezhi1" |
43 | android:textColor="@android:color/white" | 43 | android:textColor="@android:color/white" |
44 | android:textSize="22sp" /> | 44 | android:textSize="22sp" /> |
45 | 45 | ||
46 | <ImageView | 46 | <ImageView |
47 | android:id="@+id/iv_skin" | 47 | android:id="@+id/iv_skin" |
48 | android:layout_width="wrap_content" | 48 | android:layout_width="wrap_content" |
49 | android:layout_height="match_parent" | 49 | android:layout_height="match_parent" |
50 | android:layout_marginRight="10dp" | 50 | android:layout_marginRight="10dp" |
51 | android:layout_toLeftOf="@+id/iv_imformatioan" | 51 | android:layout_toLeftOf="@+id/iv_imformatioan" |
52 | android:gravity="center_vertical" | 52 | android:gravity="center_vertical" |
53 | android:padding="10dp" | 53 | android:padding="10dp" |
54 | android:src="@mipmap/pifu" | 54 | android:src="@mipmap/pifu" |
55 | android:textColor="@android:color/white" | 55 | android:textColor="@android:color/white" |
56 | android:visibility="gone" | 56 | android:visibility="gone" |
57 | android:textSize="22sp" /> | 57 | android:textSize="22sp" /> |
58 | 58 | ||
59 | <ImageView | 59 | <ImageView |
60 | android:id="@+id/iv_imformatioan" | 60 | android:id="@+id/iv_imformatioan" |
61 | android:layout_width="wrap_content" | 61 | android:layout_width="wrap_content" |
62 | android:layout_height="match_parent" | 62 | android:layout_height="match_parent" |
63 | android:layout_alignParentRight="true" | 63 | android:layout_alignParentRight="true" |
64 | android:layout_marginRight="10dp" | 64 | android:layout_marginRight="10dp" |
65 | android:gravity="center_vertical" | 65 | android:gravity="center_vertical" |
66 | android:padding="10dp" | 66 | android:padding="10dp" |
67 | android:src="@mipmap/fankui1" | 67 | android:src="@mipmap/fankui1" |
68 | android:textColor="@android:color/white" | 68 | android:textColor="@android:color/white" |
69 | android:textSize="22sp" /> | 69 | android:textSize="22sp" /> |
70 | 70 | ||
71 | 71 | ||
72 | </RelativeLayout> | 72 | </RelativeLayout> |
73 | 73 | ||
74 | <LinearLayout | 74 | <LinearLayout |
75 | android:layout_width="match_parent" | 75 | android:layout_width="match_parent" |
76 | android:layout_height="match_parent"> | 76 | android:layout_height="match_parent"> |
77 | 77 | ||
78 | <LinearLayout | 78 | <LinearLayout |
79 | android:layout_width="0dp" | 79 | android:layout_width="0dp" |
80 | android:layout_height="match_parent" | 80 | android:layout_height="match_parent" |
81 | android:layout_weight="1.5" | 81 | android:layout_weight="1.5" |
82 | android:orientation="vertical"> | 82 | android:orientation="vertical"> |
83 | <RelativeLayout | 83 | <RelativeLayout |
84 | android:layout_width="wrap_content" | 84 | android:layout_width="wrap_content" |
85 | android:layout_height="250sp" | 85 | android:layout_height="250sp" |
86 | android:background="@mipmap/head_bg"> | 86 | android:background="@mipmap/head_bg"> |
87 | 87 | ||
88 | <LinearLayout | 88 | <LinearLayout |
89 | android:id="@+id/ssss" | 89 | android:id="@+id/ssss" |
90 | android:layout_width="match_parent" | 90 | android:layout_width="match_parent" |
91 | android:layout_height="wrap_content" | 91 | android:layout_height="wrap_content" |
92 | android:layout_marginTop="28dp" | 92 | android:layout_marginTop="28dp" |
93 | android:gravity="center" | 93 | android:gravity="center" |
94 | android:orientation="horizontal"> | 94 | android:orientation="horizontal"> |
95 | <com.facebook.drawee.view.SimpleDraweeView | 95 | <com.facebook.drawee.view.SimpleDraweeView |
96 | android:id="@+id/iv_head" | 96 | android:id="@+id/iv_head" |
97 | android:layout_width="65dp" | 97 | android:layout_width="65dp" |
98 | android:layout_height="65dp" | 98 | android:layout_height="65dp" |
99 | fresco:placeholderImage="@mipmap/header_default" | 99 | fresco:placeholderImage="@mipmap/header_default" |
100 | fresco:roundAsCircle="true" | 100 | fresco:roundAsCircle="true" |
101 | fresco:placeholderImageScaleType="fitCenter" /> | 101 | fresco:placeholderImageScaleType="fitCenter" /> |
102 | 102 | ||
103 | <TextView | 103 | <TextView |
104 | android:layout_width="wrap_content" | 104 | android:layout_width="wrap_content" |
105 | android:layout_height="wrap_content" | 105 | android:layout_height="wrap_content" |
106 | android:layout_marginLeft="18dp" | 106 | android:layout_marginLeft="18dp" |
107 | android:layout_marginTop="20dp" | 107 | android:layout_marginTop="20dp" |
108 | android:background="@drawable/corcle_blue_bg" | 108 | android:background="@drawable/corcle_blue_bg" |
109 | android:paddingLeft="5dp" | 109 | android:paddingLeft="5dp" |
110 | android:paddingRight="5dp" | 110 | android:paddingRight="5dp" |
111 | android:gravity="center_vertical" | 111 | android:gravity="center_vertical" |
112 | android:text="签到" | 112 | android:text="签到" |
113 | android:textColor="@color/login_text_blue" | 113 | android:textColor="@color/login_text_blue" |
114 | android:visibility="gone" | 114 | android:visibility="gone" |
115 | android:textSize="18sp" /> | 115 | android:textSize="18sp" /> |
116 | 116 | ||
117 | </LinearLayout> | 117 | </LinearLayout> |
118 | 118 | ||
119 | <LinearLayout | 119 | <LinearLayout |
120 | android:id="@+id/sssssss" | 120 | android:id="@+id/sssssss" |
121 | android:layout_width="match_parent" | 121 | android:layout_width="match_parent" |
122 | android:layout_height="wrap_content" | 122 | android:layout_height="wrap_content" |
123 | android:layout_marginLeft="20dp" | 123 | android:layout_marginLeft="20dp" |
124 | android:layout_below="@id/ssss" | 124 | android:layout_below="@id/ssss" |
125 | android:layout_marginTop="20dp" | 125 | android:layout_marginTop="20dp" |
126 | android:gravity="center" | 126 | android:gravity="center" |
127 | android:orientation="horizontal"> | 127 | android:orientation="horizontal"> |
128 | 128 | ||
129 | <TextView | 129 | <TextView |
130 | android:id="@+id/tv_username" | 130 | android:id="@+id/tv_username" |
131 | android:layout_width="wrap_content" | 131 | android:layout_width="wrap_content" |
132 | android:layout_height="wrap_content" | 132 | android:layout_height="wrap_content" |
133 | android:text="" | 133 | android:text="" |
134 | android:textSize="20sp" /> | 134 | android:textSize="20sp" /> |
135 | <TextView | 135 | <TextView |
136 | android:id="@+id/tv_yangji" | 136 | android:id="@+id/tv_yangji" |
137 | android:layout_marginLeft="5dp" | 137 | android:layout_marginLeft="5dp" |
138 | android:layout_width="wrap_content" | 138 | android:layout_width="wrap_content" |
139 | android:layout_height="wrap_content" | 139 | android:layout_height="wrap_content" |
140 | android:text="(样机)" | 140 | android:text="(样机)" |
141 | android:textSize="20dp" | 141 | android:textSize="20dp" |
142 | android:visibility="gone"/> | 142 | android:visibility="gone"/> |
143 | 143 | ||
144 | <ImageView | 144 | <ImageView |
145 | android:id="@+id/iv_sex" | 145 | android:id="@+id/iv_sex" |
146 | android:layout_width="wrap_content" | 146 | android:layout_width="wrap_content" |
147 | android:layout_height="wrap_content" | 147 | android:layout_height="wrap_content" |
148 | android:layout_gravity="center_vertical" | 148 | android:layout_gravity="center_vertical" |
149 | android:layout_marginLeft="5dp" | 149 | android:layout_marginLeft="5dp" |
150 | android:src="@mipmap/men" /> | 150 | android:src="@mipmap/men" /> |
151 | 151 | ||
152 | </LinearLayout> | 152 | </LinearLayout> |
153 | 153 | ||
154 | <LinearLayout | 154 | <LinearLayout |
155 | android:layout_below="@id/sssssss" | 155 | android:layout_below="@id/sssssss" |
156 | android:layout_width="match_parent" | 156 | android:layout_width="match_parent" |
157 | android:layout_height="wrap_content" | 157 | android:layout_height="wrap_content" |
158 | android:layout_marginLeft="20dp" | 158 | android:layout_marginLeft="20dp" |
159 | android:layout_marginTop="10dp" | 159 | android:layout_marginTop="10dp" |
160 | android:gravity="center" | 160 | android:gravity="center" |
161 | android:orientation="horizontal"> | 161 | android:orientation="horizontal"> |
162 | 162 | ||
163 | <TextView | 163 | <TextView |
164 | android:id="@+id/tv_sign" | 164 | android:id="@+id/tv_sign" |
165 | android:layout_height="wrap_content" | 165 | android:layout_height="wrap_content" |
166 | android:layout_width="wrap_content" | 166 | android:layout_width="wrap_content" |
167 | android:hint="请输入个性签名" | 167 | android:hint="请输入个性签名" |
168 | android:maxLines="3" | 168 | android:maxLines="3" |
169 | android:maxLength="40" | 169 | android:maxLength="40" |
170 | android:ellipsize="end" | 170 | android:ellipsize="end" |
171 | android:textSize="16sp" /> | 171 | android:textSize="16sp" /> |
172 | 172 | ||
173 | <ImageView | 173 | <ImageView |
174 | android:id="@+id/iv_sign" | 174 | android:id="@+id/iv_sign" |
175 | android:layout_width="wrap_content" | 175 | android:layout_width="wrap_content" |
176 | android:layout_height="wrap_content" | 176 | android:layout_height="wrap_content" |
177 | android:padding="10dp" | 177 | android:padding="10dp" |
178 | android:src="@mipmap/qianming" /> | 178 | android:src="@mipmap/qianming" /> |
179 | 179 | ||
180 | 180 | ||
181 | </LinearLayout> | 181 | </LinearLayout> |
182 | </RelativeLayout> | 182 | </RelativeLayout> |
183 | <View | 183 | <View |
184 | android:layout_width="match_parent" | 184 | android:layout_width="match_parent" |
185 | android:layout_height="0.7dp" | 185 | android:layout_height="0.7dp" |
186 | android:background="@color/cutoff_line"> | 186 | android:background="@color/cutoff_line"> |
187 | 187 | ||
188 | </View> | 188 | </View> |
189 | 189 | ||
190 | <LinearLayout | 190 | <LinearLayout |
191 | android:layout_width="match_parent" | 191 | android:layout_width="match_parent" |
192 | android:layout_height="wrap_content" | 192 | android:layout_height="wrap_content" |
193 | android:orientation="vertical"> | 193 | android:orientation="vertical"> |
194 | 194 | ||
195 | <LinearLayout | 195 | <LinearLayout |
196 | android:layout_width="match_parent" | 196 | android:layout_width="match_parent" |
197 | android:layout_height="wrap_content" | 197 | android:layout_height="wrap_content" |
198 | android:gravity="center_vertical" | 198 | android:gravity="center_vertical" |
199 | android:orientation="horizontal"> | 199 | android:orientation="horizontal"> |
200 | 200 | ||
201 | <ImageView | 201 | <ImageView |
202 | android:layout_width="0dp" | 202 | android:layout_width="0dp" |
203 | android:layout_height="wrap_content" | 203 | android:layout_height="wrap_content" |
204 | android:layout_weight="1" | 204 | android:layout_weight="1" |
205 | android:paddingTop="20dp" | 205 | android:paddingTop="20dp" |
206 | android:paddingBottom="20dp" | 206 | android:paddingBottom="20dp" |
207 | android:src="@mipmap/wodecuoti1" /> | 207 | android:src="@mipmap/wodecuoti1" /> |
208 | 208 | ||
209 | <TextView | 209 | <TextView |
210 | android:id="@+id/linel_mycuoti" | 210 | android:id="@+id/linel_mycuoti" |
211 | android:layout_width="0dp" | 211 | android:layout_width="0dp" |
212 | android:layout_height="wrap_content" | 212 | android:layout_height="wrap_content" |
213 | android:layout_weight="1" | 213 | android:layout_weight="1" |
214 | android:paddingTop="20dp" | 214 | android:paddingTop="20dp" |
215 | android:paddingBottom="20dp" | 215 | android:paddingBottom="20dp" |
216 | android:text="我的错题" | 216 | android:text="我的错题" |
217 | android:textSize="20sp" /> | 217 | android:textSize="20sp" /> |
218 | <View | 218 | <View |
219 | android:layout_width="1dp" | 219 | android:layout_width="1dp" |
220 | android:layout_height="match_parent" | 220 | android:layout_height="match_parent" |
221 | android:background="@color/cutoff_line"> | 221 | android:background="@color/cutoff_line"> |
222 | 222 | ||
223 | </View> | 223 | </View> |
224 | 224 | ||
225 | <ImageView | 225 | <ImageView |
226 | android:layout_width="0dp" | 226 | android:layout_width="0dp" |
227 | android:layout_height="wrap_content" | 227 | android:layout_height="wrap_content" |
228 | android:layout_weight="1" | 228 | android:layout_weight="1" |
229 | android:paddingTop="20dp" | 229 | android:paddingTop="20dp" |
230 | android:paddingBottom="20dp" | 230 | android:paddingBottom="20dp" |
231 | android:src="@mipmap/wodebiji1" /> | 231 | android:src="@mipmap/wodebiji1" /> |
232 | <TextView | 232 | <TextView |
233 | android:id="@+id/linel_mynote" | 233 | android:id="@+id/linel_mynote" |
234 | android:layout_width="0dp" | 234 | android:layout_width="0dp" |
235 | android:layout_height="wrap_content" | 235 | android:layout_height="wrap_content" |
236 | android:layout_weight="1" | 236 | android:layout_weight="1" |
237 | android:paddingTop="20dp" | 237 | android:paddingTop="20dp" |
238 | android:paddingBottom="20dp" | 238 | android:paddingBottom="20dp" |
239 | android:text="我的笔记" | 239 | android:text="我的笔记" |
240 | android:textSize="20sp" /> | 240 | android:textSize="20sp" /> |
241 | 241 | ||
242 | </LinearLayout> | 242 | </LinearLayout> |
243 | <View | 243 | <View |
244 | android:layout_width="match_parent" | 244 | android:layout_width="match_parent" |
245 | android:layout_height="1dp" | 245 | android:layout_height="1dp" |
246 | android:background="@color/cutoff_line"> | 246 | android:background="@color/cutoff_line"> |
247 | 247 | ||
248 | </View> | 248 | </View> |
249 | <LinearLayout | 249 | <LinearLayout |
250 | android:layout_width="match_parent" | 250 | android:layout_width="match_parent" |
251 | android:layout_height="wrap_content" | 251 | android:layout_height="wrap_content" |
252 | android:gravity="center_vertical" | 252 | android:gravity="center_vertical" |
253 | android:orientation="horizontal"> | 253 | android:orientation="horizontal"> |
254 | 254 | ||
255 | <ImageView | 255 | <ImageView |
256 | android:layout_width="0dp" | 256 | android:layout_width="0dp" |
257 | android:layout_height="wrap_content" | 257 | android:layout_height="wrap_content" |
258 | android:layout_weight="1" | 258 | android:layout_weight="1" |
259 | android:paddingTop="20dp" | 259 | android:paddingTop="20dp" |
260 | android:paddingBottom="20dp" | 260 | android:paddingBottom="20dp" |
261 | android:src="@mipmap/wodeshoucang" /> | 261 | android:src="@mipmap/wodeshoucang" /> |
262 | 262 | ||
263 | <TextView | 263 | <TextView |
264 | android:id="@+id/linel_mycollege" | 264 | android:id="@+id/linel_mycollege" |
265 | android:layout_width="0dp" | 265 | android:layout_width="0dp" |
266 | android:layout_height="wrap_content" | 266 | android:layout_height="wrap_content" |
267 | android:layout_weight="1" | 267 | android:layout_weight="1" |
268 | android:paddingTop="20dp" | 268 | android:paddingTop="20dp" |
269 | android:paddingBottom="20dp" | 269 | android:paddingBottom="20dp" |
270 | android:text="我的收藏" | 270 | android:text="我的收藏" |
271 | android:textSize="20sp" /> | 271 | android:textSize="20sp" /> |
272 | <View | 272 | <View |
273 | android:layout_width="1dp" | 273 | android:layout_width="1dp" |
274 | android:layout_height="match_parent" | 274 | android:layout_height="match_parent" |
275 | android:background="@color/cutoff_line"> | 275 | android:background="@color/cutoff_line"> |
276 | 276 | ||
277 | </View> | 277 | </View> |
278 | 278 | ||
279 | <ImageView | 279 | <ImageView |
280 | android:layout_width="0dp" | 280 | android:layout_width="0dp" |
281 | android:layout_height="wrap_content" | 281 | android:layout_height="wrap_content" |
282 | android:layout_weight="1" | 282 | android:layout_weight="1" |
283 | android:paddingTop="20dp" | 283 | android:paddingTop="20dp" |
284 | android:paddingBottom="20dp" | 284 | android:paddingBottom="20dp" |
285 | android:src="@mipmap/wodebanji1" /> | 285 | android:src="@mipmap/wodebanji1" /> |
286 | <TextView | 286 | <TextView |
287 | android:id="@+id/linel_myclass" | 287 | android:id="@+id/linel_myclass" |
288 | android:layout_width="0dp" | 288 | android:layout_width="0dp" |
289 | android:layout_height="wrap_content" | 289 | android:layout_height="wrap_content" |
290 | android:layout_weight="1" | 290 | android:layout_weight="1" |
291 | android:text="我的班级" | 291 | android:text="我的生词" |
292 | android:paddingTop="20dp" | 292 | android:paddingTop="20dp" |
293 | android:paddingBottom="20dp" | 293 | android:paddingBottom="20dp" |
294 | android:textSize="20sp" /> | 294 | android:textSize="20sp" /> |
295 | 295 | ||
296 | </LinearLayout> | 296 | </LinearLayout> |
297 | 297 | ||
298 | <View | 298 | <View |
299 | android:layout_width="match_parent" | 299 | android:layout_width="match_parent" |
300 | android:layout_height="0.7dp" | 300 | android:layout_height="0.7dp" |
301 | android:background="@color/cutoff_line"> | 301 | android:background="@color/cutoff_line"> |
302 | 302 | ||
303 | </View> | 303 | </View> |
304 | 304 | ||
305 | </LinearLayout> | 305 | </LinearLayout> |
306 | <TextView | 306 | <TextView |
307 | android:id="@+id/iv_look_card" | 307 | android:id="@+id/iv_look_card" |
308 | android:layout_width="wrap_content" | 308 | android:layout_width="wrap_content" |
309 | android:layout_height="wrap_content" | 309 | android:layout_height="wrap_content" |
310 | android:paddingTop="10dp" | 310 | android:paddingTop="10dp" |
311 | android:paddingLeft="10dp" | 311 | android:paddingLeft="10dp" |
312 | android:paddingRight="10dp" | 312 | android:paddingRight="10dp" |
313 | android:layout_gravity="center" | 313 | android:layout_gravity="center" |
314 | android:layout_marginTop="120dp" | 314 | android:layout_marginTop="120dp" |
315 | android:textColor="@color/login_text_blue" | 315 | android:textColor="@color/login_text_blue" |
316 | android:text="好记星电子产品保修卡" /> | 316 | android:text="好记星电子产品保修卡" /> |
317 | <View | 317 | <View |
318 | android:id="@+id/sssssssss" | ||
318 | android:layout_width="135dp" | 319 | android:layout_width="135dp" |
319 | android:layout_marginTop="2dp" | 320 | android:layout_marginTop="2dp" |
320 | android:layout_gravity="center" | 321 | android:layout_gravity="center" |
321 | android:background="@color/login_text_blue" | 322 | android:background="@color/login_text_blue" |
322 | android:layout_height="0.7dp"> | 323 | android:layout_height="0.7dp"> |
323 | 324 | ||
324 | </View> | 325 | </View> |
325 | 326 | ||
326 | <LinearLayout | 327 | <LinearLayout |
327 | android:layout_marginTop="10dp" | 328 | android:layout_marginTop="10dp" |
328 | android:layout_width="match_parent" | 329 | android:layout_width="match_parent" |
329 | android:layout_height="100dp" | 330 | android:layout_height="100dp" |
330 | android:gravity="bottom" | 331 | android:gravity="bottom" |
331 | android:background="@mipmap/xiaoguanggao"> | 332 | android:background="@mipmap/xiaoguanggao"> |
332 | 333 | ||
333 | </LinearLayout> | 334 | </LinearLayout> |
334 | 335 | ||
335 | 336 | ||
336 | </LinearLayout> | 337 | </LinearLayout> |
337 | 338 | ||
338 | 339 | ||
339 | <View | 340 | <View |
340 | android:layout_width="0.7dp" | 341 | android:layout_width="0.7dp" |
341 | android:layout_height="match_parent" | 342 | android:layout_height="match_parent" |
342 | android:background="@color/cutoff_line"> | 343 | android:background="@color/cutoff_line"> |
343 | 344 | ||
344 | </View> | 345 | </View> |
345 | 346 | ||
346 | <LinearLayout | 347 | <LinearLayout |
347 | android:layout_width="0dp" | 348 | android:layout_width="0dp" |
348 | android:layout_height="match_parent" | 349 | android:layout_height="match_parent" |
349 | android:layout_weight="2.5" | 350 | android:layout_weight="2.5" |
350 | android:orientation="vertical"> | 351 | android:orientation="vertical"> |
351 | 352 | ||
352 | <LinearLayout | 353 | <LinearLayout |
353 | android:layout_width="match_parent" | 354 | android:layout_width="match_parent" |
354 | android:layout_height="wrap_content" | 355 | android:layout_height="wrap_content" |
355 | android:layout_margin="10dp" | 356 | android:layout_margin="10dp" |
356 | android:gravity="center_vertical" | 357 | android:gravity="center_vertical" |
357 | android:orientation="horizontal"> | 358 | android:orientation="horizontal"> |
358 | 359 | ||
359 | <View | 360 | <View |
360 | android:layout_width="5dp" | 361 | android:layout_width="5dp" |
361 | android:layout_height="20dp" | 362 | android:layout_height="20dp" |
362 | android:background="@color/login_text_blue"> | 363 | android:background="@color/login_text_blue"> |
363 | 364 | ||
364 | </View> | 365 | </View> |
365 | 366 | ||
366 | <TextView | 367 | <TextView |
367 | android:layout_width="0dp" | 368 | android:layout_width="0dp" |
368 | android:layout_height="wrap_content" | 369 | android:layout_height="wrap_content" |
369 | android:layout_marginLeft="5dp" | 370 | android:layout_marginLeft="5dp" |
370 | android:layout_weight="5" | 371 | android:layout_weight="5" |
371 | android:text="个人信息" | 372 | android:text="个人信息" |
372 | android:textSize="22sp" /> | 373 | android:textSize="22sp" /> |
373 | 374 | ||
374 | <TextView | 375 | <TextView |
375 | android:layout_width="0dp" | 376 | android:layout_width="0dp" |
376 | android:layout_height="wrap_content" | 377 | android:layout_height="wrap_content" |
377 | android:layout_marginLeft="10dp" | 378 | android:layout_marginLeft="10dp" |
378 | android:layout_weight="0.1" | 379 | android:layout_weight="0.1" |
379 | android:text="" | 380 | android:text="" |
380 | android:textSize="18sp" /> | 381 | android:textSize="18sp" /> |
381 | 382 | ||
382 | <ImageView | 383 | <ImageView |
383 | android:id="@+id/tv_edit_presoninfo" | 384 | android:id="@+id/tv_edit_presoninfo" |
384 | android:padding="10dp" | 385 | android:padding="10dp" |
385 | android:layout_width="0dp" | 386 | android:layout_width="0dp" |
386 | android:layout_height="wrap_content" | 387 | android:layout_height="wrap_content" |
387 | android:layout_weight="0.4" | 388 | android:layout_weight="0.4" |
388 | android:src="@mipmap/gerenxinxibianji" /> | 389 | android:src="@mipmap/gerenxinxibianji" /> |
389 | 390 | ||
390 | 391 | ||
391 | </LinearLayout> | 392 | </LinearLayout> |
392 | 393 | ||
393 | <LinearLayout | 394 | <LinearLayout |
394 | android:layout_width="match_parent" | 395 | android:layout_width="match_parent" |
395 | android:layout_height="wrap_content" | 396 | android:layout_height="wrap_content" |
396 | android:layout_marginLeft="50dp" | 397 | android:layout_marginLeft="50dp" |
397 | android:orientation="vertical"> | 398 | android:orientation="vertical"> |
398 | 399 | ||
399 | <LinearLayout | 400 | <LinearLayout |
400 | android:layout_width="match_parent" | 401 | android:layout_width="match_parent" |
401 | android:layout_height="wrap_content" | 402 | android:layout_height="wrap_content" |
402 | android:gravity="center_vertical" | 403 | android:gravity="center_vertical" |
403 | android:orientation="horizontal"> | 404 | android:orientation="horizontal"> |
404 | 405 | ||
405 | <TextView | 406 | <TextView |
406 | android:layout_width="0dp" | 407 | android:layout_width="0dp" |
407 | android:layout_height="wrap_content" | 408 | android:layout_height="wrap_content" |
408 | android:textColor="@color/login_edittext_hint" | 409 | android:textColor="@color/login_edittext_hint" |
409 | android:layout_weight="1" | 410 | android:layout_weight="1" |
410 | android:text="昵称" | 411 | android:text="昵称" |
411 | android:textSize="20sp" /> | 412 | android:textSize="20sp" /> |
412 | 413 | ||
413 | <TextView | 414 | <TextView |
414 | android:id="@+id/tv_username1" | 415 | android:id="@+id/tv_username1" |
415 | android:layout_width="0dp" | 416 | android:layout_width="0dp" |
416 | android:layout_height="wrap_content" | 417 | android:layout_height="wrap_content" |
417 | android:layout_weight="2" | 418 | android:layout_weight="2" |
418 | android:hint="未填写" | 419 | android:hint="未填写" |
419 | android:textSize="20sp" /> | 420 | android:textSize="20sp" /> |
420 | 421 | ||
421 | <TextView | 422 | <TextView |
422 | android:layout_width="1dp" | 423 | android:layout_width="1dp" |
423 | android:layout_height="wrap_content" | 424 | android:layout_height="wrap_content" |
424 | android:layout_weight="1" | 425 | android:layout_weight="1" |
425 | android:textColor="@color/login_edittext_hint" | 426 | android:textColor="@color/login_edittext_hint" |
426 | android:text="星座" | 427 | android:text="星座" |
427 | android:textSize="20sp" /> | 428 | android:textSize="20sp" /> |
428 | 429 | ||
429 | <TextView | 430 | <TextView |
430 | android:id="@+id/tv_mygad" | 431 | android:id="@+id/tv_mygad" |
431 | android:layout_width="0dp" | 432 | android:layout_width="0dp" |
432 | android:layout_height="wrap_content" | 433 | android:layout_height="wrap_content" |
433 | android:layout_weight="2" | 434 | android:layout_weight="2" |
434 | android:hint="未填写" | 435 | android:hint="未填写" |
435 | android:textSize="20sp" /> | 436 | android:textSize="20sp" /> |
436 | </LinearLayout> | 437 | </LinearLayout> |
437 | 438 | ||
438 | <LinearLayout | 439 | <LinearLayout |
439 | android:layout_width="match_parent" | 440 | android:layout_width="match_parent" |
440 | android:layout_height="wrap_content" | 441 | android:layout_height="wrap_content" |
441 | android:layout_marginTop="15dp" | 442 | android:layout_marginTop="15dp" |
442 | android:gravity="center_vertical" | 443 | android:gravity="center_vertical" |
443 | android:orientation="horizontal"> | 444 | android:orientation="horizontal"> |
444 | 445 | ||
445 | <TextView | 446 | <TextView |
446 | android:layout_width="0dp" | 447 | android:layout_width="0dp" |
447 | android:layout_height="wrap_content" | 448 | android:layout_height="wrap_content" |
448 | android:textColor="@color/login_edittext_hint" | 449 | android:textColor="@color/login_edittext_hint" |
449 | android:layout_weight="1" | 450 | android:layout_weight="1" |
450 | android:text="性别" | 451 | android:text="性别" |
451 | android:textSize="20sp" /> | 452 | android:textSize="20sp" /> |
452 | 453 | ||
453 | <TextView | 454 | <TextView |
454 | android:id="@+id/tv_sex" | 455 | android:id="@+id/tv_sex" |
455 | android:layout_width="0dp" | 456 | android:layout_width="0dp" |
456 | android:layout_height="wrap_content" | 457 | android:layout_height="wrap_content" |
457 | android:layout_weight="2" | 458 | android:layout_weight="2" |
458 | android:hint="未填写" | 459 | android:hint="未填写" |
459 | android:textSize="20sp" /> | 460 | android:textSize="20sp" /> |
460 | 461 | ||
461 | <TextView | 462 | <TextView |
462 | android:layout_width="1dp" | 463 | android:layout_width="1dp" |
463 | android:layout_height="wrap_content" | 464 | android:layout_height="wrap_content" |
464 | android:textColor="@color/login_edittext_hint" | 465 | android:textColor="@color/login_edittext_hint" |
465 | android:layout_weight="1" | 466 | android:layout_weight="1" |
466 | android:text="地区" | 467 | android:text="地区" |
467 | android:textSize="20sp" /> | 468 | android:textSize="20sp" /> |
468 | 469 | ||
469 | <TextView | 470 | <TextView |
470 | android:id="@+id/tv_useinfo_adress" | 471 | android:id="@+id/tv_useinfo_adress" |
471 | android:layout_width="0dp" | 472 | android:layout_width="0dp" |
472 | android:layout_height="wrap_content" | 473 | android:layout_height="wrap_content" |
473 | android:layout_weight="2" | 474 | android:layout_weight="2" |
474 | android:hint="未填写" | 475 | android:hint="未填写" |
475 | android:maxLines="2" | 476 | android:maxLines="2" |
476 | android:ellipsize="end" | 477 | android:ellipsize="end" |
477 | android:textSize="20sp" /> | 478 | android:textSize="20sp" /> |
478 | </LinearLayout> | 479 | </LinearLayout> |
479 | 480 | ||
480 | <LinearLayout | 481 | <LinearLayout |
481 | android:layout_width="match_parent" | 482 | android:layout_width="match_parent" |
482 | android:layout_height="wrap_content" | 483 | android:layout_height="wrap_content" |
483 | android:layout_marginTop="15dp" | 484 | android:layout_marginTop="15dp" |
484 | android:gravity="center_vertical" | 485 | android:gravity="center_vertical" |
485 | android:orientation="horizontal"> | 486 | android:orientation="horizontal"> |
486 | 487 | ||
487 | <TextView | 488 | <TextView |
488 | android:layout_width="0dp" | 489 | android:layout_width="0dp" |
489 | android:layout_height="wrap_content" | 490 | android:layout_height="wrap_content" |
490 | android:layout_weight="1" | 491 | android:layout_weight="1" |
491 | android:text="生日" | 492 | android:text="生日" |
492 | android:textColor="@color/login_edittext_hint" | 493 | android:textColor="@color/login_edittext_hint" |
493 | 494 | ||
494 | android:textSize="20sp" /> | 495 | android:textSize="20sp" /> |
495 | 496 | ||
496 | <TextView | 497 | <TextView |
497 | android:id="@+id/tv_useinfo_birthday" | 498 | android:id="@+id/tv_useinfo_birthday" |
498 | android:layout_width="0dp" | 499 | android:layout_width="0dp" |
499 | android:layout_height="wrap_content" | 500 | android:layout_height="wrap_content" |
500 | android:layout_weight="2" | 501 | android:layout_weight="2" |
501 | android:hint="未填写" | 502 | android:hint="未填写" |
502 | android:textSize="20sp" /> | 503 | android:textSize="20sp" /> |
503 | 504 | ||
504 | <TextView | 505 | <TextView |
505 | android:layout_width="1dp" | 506 | android:layout_width="1dp" |
506 | android:layout_height="wrap_content" | 507 | android:layout_height="wrap_content" |
507 | android:layout_weight="1" | 508 | android:layout_weight="1" |
508 | android:textColor="@color/login_edittext_hint" | 509 | android:textColor="@color/login_edittext_hint" |
509 | 510 | ||
510 | android:text="学校" | 511 | android:text="学校" |
511 | android:textSize="20sp" /> | 512 | android:textSize="20sp" /> |
512 | 513 | ||
513 | <TextView | 514 | <TextView |
514 | android:id="@+id/tv_useinfo_school" | 515 | android:id="@+id/tv_useinfo_school" |
515 | android:layout_width="0dp" | 516 | android:layout_width="0dp" |
516 | android:layout_height="wrap_content" | 517 | android:layout_height="wrap_content" |
517 | android:layout_weight="2" | 518 | android:layout_weight="2" |
518 | android:hint="未填写" | 519 | android:hint="未填写" |
519 | android:textSize="20sp" /> | 520 | android:textSize="20sp" /> |
520 | </LinearLayout> | 521 | </LinearLayout> |
521 | 522 | ||
522 | <LinearLayout | 523 | <LinearLayout |
523 | android:layout_width="match_parent" | 524 | android:layout_width="match_parent" |
524 | android:layout_height="wrap_content" | 525 | android:layout_height="wrap_content" |
525 | android:layout_marginTop="15dp" | 526 | android:layout_marginTop="15dp" |
526 | android:gravity="center_vertical" | 527 | android:gravity="center_vertical" |
527 | android:orientation="horizontal"> | 528 | android:orientation="horizontal"> |
528 | 529 | ||
529 | <TextView | 530 | <TextView |
530 | android:layout_width="0dp" | 531 | android:layout_width="0dp" |
531 | android:layout_height="wrap_content" | 532 | android:layout_height="wrap_content" |
532 | android:layout_weight="1" | 533 | android:layout_weight="1" |
533 | android:textColor="@color/login_edittext_hint" | 534 | android:textColor="@color/login_edittext_hint" |
534 | android:text=" Q Q" | 535 | android:text=" Q Q" |
535 | android:textSize="20sp" /> | 536 | android:textSize="20sp" /> |
536 | 537 | ||
537 | <TextView | 538 | <TextView |
538 | android:id="@+id/tv_useinfo_qq" | 539 | android:id="@+id/tv_useinfo_qq" |
539 | android:layout_width="0dp" | 540 | android:layout_width="0dp" |
540 | android:layout_height="wrap_content" | 541 | android:layout_height="wrap_content" |
541 | android:layout_weight="2" | 542 | android:layout_weight="2" |
542 | android:hint="未填写" | 543 | android:hint="未填写" |
543 | android:textSize="20sp" /> | 544 | android:textSize="20sp" /> |
544 | 545 | ||
545 | <TextView | 546 | <TextView |
546 | android:layout_width="1dp" | 547 | android:layout_width="1dp" |
547 | android:layout_height="wrap_content" | 548 | android:layout_height="wrap_content" |
548 | android:layout_weight="1" | 549 | android:layout_weight="1" |
549 | android:text="年级" | 550 | android:text="年级" |
550 | android:textColor="@color/login_edittext_hint" | 551 | android:textColor="@color/login_edittext_hint" |
551 | 552 | ||
552 | android:textSize="20sp" /> | 553 | android:textSize="20sp" /> |
553 | 554 | ||
554 | <TextView | 555 | <TextView |
555 | android:id="@+id/tv_useinfo_gender" | 556 | android:id="@+id/tv_useinfo_gender" |
556 | android:layout_width="0dp" | 557 | android:layout_width="0dp" |
557 | android:layout_height="wrap_content" | 558 | android:layout_height="wrap_content" |
558 | android:layout_weight="2" | 559 | android:layout_weight="2" |
559 | android:hint="未填写" | 560 | android:hint="未填写" |
560 | android:textSize="20sp" /> | 561 | android:textSize="20sp" /> |
561 | </LinearLayout> | 562 | </LinearLayout> |
562 | 563 | ||
563 | 564 | ||
564 | </LinearLayout> | 565 | </LinearLayout> |
565 | <View | 566 | <View |
566 | android:layout_width="match_parent" | 567 | android:layout_width="match_parent" |
567 | android:layout_height="0.7dp" | 568 | android:layout_height="0.7dp" |
568 | android:layout_marginTop="40dp" | 569 | android:layout_marginTop="40dp" |
569 | android:background="@color/cutoff_line"> | 570 | android:background="@color/cutoff_line"> |
570 | 571 | ||
571 | </View> | 572 | </View> |
572 | <LinearLayout | 573 | <LinearLayout |
573 | android:layout_width="match_parent" | 574 | android:layout_width="match_parent" |
574 | android:layout_height="wrap_content" | 575 | android:layout_height="wrap_content" |
575 | android:layout_margin="10dp" | 576 | android:layout_margin="10dp" |
576 | android:gravity="center_vertical" | 577 | android:gravity="center_vertical" |
577 | android:orientation="horizontal"> | 578 | android:orientation="horizontal"> |
578 | 579 | ||
579 | <View | 580 | <View |
580 | android:layout_width="5dp" | 581 | android:layout_width="5dp" |
581 | android:layout_height="20dp" | 582 | android:layout_height="20dp" |
582 | android:layout_marginTop="10dp" | 583 | android:layout_marginTop="10dp" |
583 | android:background="@color/login_text_blue"> | 584 | android:background="@color/login_text_blue"> |
584 | 585 | ||
585 | </View> | 586 | </View> |
586 | 587 | ||
587 | <TextView | 588 | <TextView |
588 | android:layout_width="wrap_content" | 589 | android:layout_width="wrap_content" |
589 | android:layout_height="wrap_content" | 590 | android:layout_height="wrap_content" |
590 | android:layout_marginTop="10dp" | 591 | android:layout_marginTop="10dp" |
591 | android:layout_marginLeft="5dp" | 592 | android:layout_marginLeft="5dp" |
592 | android:text="版本信息" | 593 | android:text="版本信息" |
593 | android:textSize="22sp" /> | 594 | android:textSize="22sp" /> |
594 | 595 | ||
595 | </LinearLayout> | 596 | </LinearLayout> |
596 | 597 | ||
597 | <LinearLayout | 598 | <LinearLayout |
598 | android:layout_width="wrap_content" | 599 | android:layout_width="wrap_content" |
599 | android:layout_height="wrap_content" | 600 | android:layout_height="wrap_content" |
600 | android:orientation="vertical" | 601 | android:orientation="vertical" |
601 | android:gravity="center"> | 602 | android:gravity="center"> |
602 | 603 | ||
603 | 604 | ||
604 | <GridView | 605 | <GridView |
605 | android:id="@+id/id_recyclerview_pubish" | 606 | android:id="@+id/id_recyclerview_pubish" |
606 | android:layout_margin="3dp" | 607 | android:layout_margin="3dp" |
607 | android:layout_width="match_parent" | 608 | android:layout_width="match_parent" |
608 | android:layout_height="wrap_content" | 609 | android:layout_height="wrap_content" |
609 | android:gravity="center_vertical" | 610 | android:gravity="center_vertical" |
610 | android:verticalSpacing="20dp" | 611 | android:verticalSpacing="20dp" |
611 | android:numColumns="5"> | 612 | android:numColumns="5"> |
612 | 613 | ||
613 | </GridView> | 614 | </GridView> |
614 | 615 | ||
615 | 616 | ||
616 | </LinearLayout> | 617 | </LinearLayout> |
617 | 618 | ||
618 | 619 | ||
619 | </LinearLayout> | 620 | </LinearLayout> |
620 | <LinearLayout | 621 | <LinearLayout |
621 | android:layout_width="0dp" | 622 | android:layout_width="0dp" |
622 | android:layout_height="match_parent" | 623 | android:layout_height="match_parent" |
623 | android:layout_weight="1" | 624 | android:layout_weight="1" |
624 | android:background="@color/bgstudy_laout" | 625 | android:background="@color/bgstudy_laout" |
625 | android:orientation="vertical"> | 626 | android:orientation="vertical"> |
626 | <LinearLayout | 627 | <LinearLayout |
627 | android:layout_width="match_parent" | 628 | android:layout_width="match_parent" |
628 | android:layout_height="wrap_content" | 629 | android:layout_height="wrap_content" |
629 | android:layout_margin="20dp" | 630 | android:layout_margin="20dp" |
630 | android:gravity="center_vertical" | 631 | android:gravity="center_vertical" |
631 | android:orientation="horizontal"> | 632 | android:orientation="horizontal"> |
632 | 633 | ||
633 | <View | 634 | <View |
634 | android:layout_width="5dp" | 635 | android:layout_width="5dp" |
635 | android:layout_height="20dp" | 636 | android:layout_height="20dp" |
636 | android:background="@color/login_text_blue"> | 637 | android:background="@color/login_text_blue"> |
637 | 638 | ||
638 | </View> | 639 | </View> |
639 | 640 | ||
640 | <TextView | 641 | <TextView |
641 | android:layout_width="wrap_content" | 642 | android:layout_width="wrap_content" |
642 | android:layout_height="wrap_content" | 643 | android:layout_height="wrap_content" |
643 | android:layout_marginLeft="5dp" | 644 | android:layout_marginLeft="5dp" |
644 | android:text="最近学习" | 645 | android:text="最近学习" |
645 | android:textSize="22sp" /> | 646 | android:textSize="22sp" /> |
646 | 647 | ||
647 | </LinearLayout> | 648 | </LinearLayout> |
648 | 649 | ||
649 | <LinearLayout | 650 | <LinearLayout |
650 | android:layout_width="match_parent" | 651 | android:layout_width="match_parent" |
651 | android:layout_height="match_parent" | 652 | android:layout_height="match_parent" |
652 | android:gravity="center" | 653 | android:gravity="center" |
653 | android:orientation="vertical" | 654 | android:orientation="vertical" |
654 | > | 655 | > |
655 | <LinearLayout | 656 | <LinearLayout |
656 | android:id="@+id/view_novedeo" | 657 | android:id="@+id/view_novedeo" |
657 | android:layout_width="match_parent" | 658 | android:layout_width="match_parent" |
658 | android:layout_height="match_parent" | 659 | android:layout_height="match_parent" |
659 | android:gravity="center" | 660 | android:gravity="center" |
660 | android:orientation="vertical"> | 661 | android:orientation="vertical"> |
661 | <ImageView | 662 | <ImageView |
662 | android:layout_width="wrap_content" | 663 | android:layout_width="wrap_content" |
663 | android:layout_height="wrap_content" | 664 | android:layout_height="wrap_content" |
664 | android:src="@mipmap/nostudy"/> | 665 | android:src="@mipmap/nostudy"/> |
665 | <TextView | 666 | <TextView |
666 | android:layout_width="wrap_content" | 667 | android:layout_width="wrap_content" |
667 | android:layout_height="wrap_content" | 668 | android:layout_height="wrap_content" |
668 | android:layout_marginTop="20dp" | 669 | android:layout_marginTop="20dp" |
669 | android:text="小主人最近还没有学习哦" | 670 | android:text="小主人最近还没有学习哦" |
670 | android:textSize="14sp" /> | 671 | android:textSize="14sp" /> |
671 | <TextView | 672 | <TextView |
672 | android:layout_width="wrap_content" | 673 | android:layout_width="wrap_content" |
673 | android:layout_height="wrap_content" | 674 | android:layout_height="wrap_content" |
674 | android:text="快去学习吧" | 675 | android:text="快去学习吧" |
675 | android:textSize="14sp" /> | 676 | android:textSize="14sp" /> |
676 | </LinearLayout> | 677 | </LinearLayout> |
677 | <android.support.v7.widget.RecyclerView | 678 | <android.support.v7.widget.RecyclerView |
678 | android:id="@+id/id_recyclerview_horizontal" | 679 | android:id="@+id/id_recyclerview_horizontal" |
679 | android:layout_width="wrap_content" | 680 | android:layout_width="wrap_content" |
680 | android:layout_height="wrap_content" | 681 | android:layout_height="wrap_content" |
681 | android:layout_gravity="top" | 682 | android:layout_gravity="top" |
682 | android:scrollbars="none" /> | 683 | android:scrollbars="none" /> |
683 | </LinearLayout> | 684 | </LinearLayout> |
684 | 685 | ||
685 | </LinearLayout> | 686 | </LinearLayout> |
686 | 687 | ||
687 | 688 | ||
688 | </LinearLayout> | 689 | </LinearLayout> |
689 | 690 | ||
690 | 691 | ||
691 | </LinearLayout> | 692 | </LinearLayout> |
692 | 693 |
PersonalCenter/app/src/main/res/mipmap-hdpi/default_avatar1.png
18 KB
PersonalCenter/app/src/main/res/mipmap-hdpi/default_avatar2.png
26.6 KB
PersonalCenter/app/src/main/res/mipmap-hdpi/default_avatar3.png
24.9 KB
PersonalCenter/app/src/main/res/mipmap-hdpi/default_avatar4.png
17.9 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/default_avatar1.png
30.4 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/default_avatar2.png
34.5 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/default_avatar3.png
39.5 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/default_avatar4.png
38.3 KB