Commit 7b3114a64f8b15b12d0966dab19e03844237ce6e
1 parent
9d08c5be52
Exists in
master
版本信息的修改和完善
Showing
9 changed files
with
275 additions
and
215 deletions
Show diff stats
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangePresonalInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.v4.app.Fragment; | 4 | import android.support.v4.app.Fragment; |
5 | import android.support.v4.view.ViewPager; | 5 | import android.support.v4.view.ViewPager; |
6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v7.app.AppCompatActivity; |
7 | import android.view.View; | 7 | import android.view.View; |
8 | import android.widget.ImageView; | 8 | import android.widget.ImageView; |
9 | import android.widget.TextView; | 9 | import android.widget.TextView; |
10 | 10 | ||
11 | import com.hjx.personalcenter.R; | 11 | import com.hjx.personalcenter.R; |
12 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; | 12 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; |
13 | import com.hjx.personalcenter.fragment.PresonInfoFragment; | 13 | import com.hjx.personalcenter.fragment.PresonInfoFragment; |
14 | import com.hjx.personalcenter.fragment.VersionsInfoFragment; | 14 | import com.hjx.personalcenter.fragment.VersionsInfoFragment; |
15 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; | 15 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; |
16 | 16 | ||
17 | import java.util.ArrayList; | 17 | import java.util.ArrayList; |
18 | import java.util.Arrays; | 18 | import java.util.Arrays; |
19 | import java.util.List; | 19 | import java.util.List; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Created by h on 2017/8/12. | 22 | * Created by h on 2017/8/12. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | public class ChangePresonalInfoActivity extends AppCompatActivity implements View.OnClickListener { | 25 | public class ChangePresonalInfoActivity extends AppCompatActivity { |
26 | private ViewPager viewPager; | 26 | private ViewPager viewPager; |
27 | private SlidingTabLayout tableLayout; | 27 | private SlidingTabLayout tableLayout; |
28 | private TextView subsave; | 28 | private TextView subsave; |
29 | private ImageView cancel; | 29 | private ImageView cancel; |
30 | private List<Fragment> presoninfo; | 30 | private List<Fragment> presoninfo; |
31 | private LoginAndRegisterAdapter presoninfodapter; | 31 | private LoginAndRegisterAdapter presoninfodapter; |
32 | private List<String> title = Arrays.asList("个人信息", "版本信息"); | 32 | private List<String> title = Arrays.asList("个人信息", "版本信息"); |
33 | @Override | 33 | @Override |
34 | protected void onCreate(Bundle savedInstanceState) { | 34 | protected void onCreate(Bundle savedInstanceState) { |
35 | super.onCreate(savedInstanceState); | 35 | super.onCreate(savedInstanceState); |
36 | setContentView(R.layout.activity_change_preson_info); | 36 | setContentView(R.layout.activity_change_preson_info); |
37 | SysApplication.getInstance().addActivity(this); | 37 | SysApplication.getInstance().addActivity(this); |
38 | initView(); | 38 | initView(); |
39 | initData(); | 39 | initData(); |
40 | setLister(); | ||
41 | 40 | ||
42 | } | 41 | } |
43 | private void initView() { | 42 | private void initView() { |
44 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); | 43 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); |
45 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); | 44 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); |
46 | cancel = (ImageView) findViewById(R.id.cancel); | ||
47 | subsave = (TextView) findViewById(R.id.presonal_sub); | ||
48 | } | 45 | } |
49 | 46 | ||
50 | private void initData() { | 47 | private void initData() { |
51 | presoninfo = new ArrayList<>(); | 48 | presoninfo = new ArrayList<>(); |
52 | for (int i = 0; i < title.size(); i++) { | 49 | for (int i = 0; i < title.size(); i++) { |
53 | if (title.get(i).equals("个人信息")) { | 50 | if (title.get(i).equals("个人信息")) { |
54 | presoninfo.add(PresonInfoFragment.newInstance(i + 1)); | 51 | presoninfo.add(PresonInfoFragment.newInstance(i + 1)); |
55 | } else { | 52 | } else { |
56 | presoninfo.add(VersionsInfoFragment.newInstance(i + 1)); | 53 | presoninfo.add(VersionsInfoFragment.newInstance(i + 1)); |
57 | } | 54 | } |
58 | } | 55 | } |
59 | 56 | ||
60 | 57 | ||
61 | //设置Tab上的标题 | 58 | //设置Tab上的标题 |
62 | tableLayout.setData(title); | 59 | tableLayout.setData(title); |
63 | //设置关联的ViewPager | 60 | //设置关联的ViewPager |
64 | tableLayout.setViewPager(viewPager, 0); | 61 | tableLayout.setViewPager(viewPager, 0); |
65 | presoninfodapter = new LoginAndRegisterAdapter(presoninfo, getSupportFragmentManager()); | 62 | presoninfodapter = new LoginAndRegisterAdapter(presoninfo, getSupportFragmentManager()); |
66 | //给ViewPager设置适配器 | 63 | //给ViewPager设置适配器 |
67 | viewPager.setAdapter(presoninfodapter); | 64 | viewPager.setAdapter(presoninfodapter); |
68 | //设置滑动时数据不丢失 | 65 | //设置滑动时数据不丢失 |
69 | viewPager.setOffscreenPageLimit(1); | 66 | viewPager.setOffscreenPageLimit(1); |
70 | //将TabLayout和ViewPager关联起来。 | 67 | //将TabLayout和ViewPager关联起来。 |
71 | } | 68 | } |
72 | private void setLister() { | ||
73 | cancel.setOnClickListener(this); | ||
74 | subsave.setOnClickListener(this); | ||
75 | } | ||
76 | 69 | ||
77 | @Override | ||
78 | public void onClick(View v) { | ||
79 | switch (v.getId()){ | ||
80 | case R.id.presonal_sub: | ||
81 | break; | ||
82 | case R.id.cancel: | ||
83 | finish(); | ||
84 | break; | ||
85 | } | ||
86 | |||
87 | } | ||
88 | } | 70 | } |
89 | 71 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
8 | import android.util.Log; | ||
8 | import android.view.View; | 9 | import android.view.View; |
9 | import android.widget.AdapterView; | 10 | import android.widget.AdapterView; |
10 | import android.widget.Button; | 11 | import android.widget.Button; |
11 | import android.widget.GridView; | 12 | import android.widget.GridView; |
12 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
13 | import android.widget.TextView; | 14 | import android.widget.TextView; |
14 | import android.widget.Toast; | 15 | import android.widget.Toast; |
15 | 16 | ||
16 | import com.facebook.drawee.view.SimpleDraweeView; | 17 | import com.facebook.drawee.view.SimpleDraweeView; |
17 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.adapter.GridAdapter; | 19 | import com.hjx.personalcenter.adapter.GridAdapter; |
19 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 20 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
20 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 21 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
21 | import com.hjx.personalcenter.db.SaveParam; | 22 | import com.hjx.personalcenter.db.SaveParam; |
22 | import com.hjx.personalcenter.http.HttpCode; | 23 | import com.hjx.personalcenter.http.HttpCode; |
23 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
24 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
25 | import com.hjx.personalcenter.model.DefautPublishInfo; | 26 | import com.hjx.personalcenter.model.DefautPublishInfo; |
26 | import com.hjx.personalcenter.model.VersionInfo; | 27 | import com.hjx.personalcenter.model.VersionInfo; |
27 | import com.hjx.personalcenter.util.AlertUtils; | 28 | import com.hjx.personalcenter.util.AlertUtils; |
28 | 29 | ||
29 | import org.json.JSONException; | 30 | import org.json.JSONException; |
30 | import org.json.JSONObject; | 31 | import org.json.JSONObject; |
31 | 32 | ||
32 | import java.util.ArrayList; | 33 | import java.util.ArrayList; |
33 | import java.util.List; | 34 | import java.util.List; |
34 | 35 | ||
35 | /** | 36 | /** |
36 | * 选择教材 | 37 | * 选择教材 |
37 | * Created by h on 2017/8/10. | 38 | * Created by h on 2017/8/10. |
38 | */ | 39 | */ |
39 | 40 | ||
40 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { | 41 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { |
41 | private GridView gridView; | 42 | private GridView gridView; |
42 | private Button btn_ok; | 43 | private Button btn_ok; |
43 | private ImageView cancel; | 44 | private ImageView cancel; |
44 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 45 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
45 | private GridAdapter sim_adapter; | 46 | private GridAdapter sim_adapter; |
46 | private SimpleDraweeView simpleDraweeView; | 47 | private SimpleDraweeView simpleDraweeView; |
47 | private TextView publish; | 48 | private TextView publish; |
49 | private String chinese, math,english,physics,chemistry,history,geography,political,biology,science; | ||
48 | 50 | ||
49 | 51 | ||
50 | Handler handler = new Handler() { | 52 | Handler handler = new Handler() { |
51 | @Override | 53 | @Override |
52 | public void handleMessage(Message msg) { | 54 | public void handleMessage(Message msg) { |
53 | super.handleMessage(msg); | 55 | super.handleMessage(msg); |
54 | JSONObject jsonObject; | 56 | JSONObject jsonObject; |
55 | String status; | 57 | String status; |
56 | switch (msg.what) { | 58 | switch (msg.what) { |
57 | case HttpCode.CHECKCARD: | 59 | case HttpCode.CHECKCARD: |
58 | try { | 60 | try { |
59 | jsonObject = new JSONObject((String) msg.obj); | 61 | jsonObject = new JSONObject((String) msg.obj); |
60 | status = jsonObject.optString("status"); | 62 | status = jsonObject.optString("status"); |
61 | if (status.equals("1")) { | 63 | if (status.equals("1")) { |
62 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); | 64 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); |
63 | Intent intent = new Intent(); | 65 | Intent intent = new Intent(); |
64 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 66 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
65 | ChoiseTextBookActivity.this.startActivity(intent); | 67 | ChoiseTextBookActivity.this.startActivity(intent); |
66 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 68 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
67 | } else if (status.equals("2001")) { | 69 | } else if (status.equals("2001")) { |
68 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); | 70 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); |
69 | } | 71 | } |
70 | 72 | ||
71 | } catch (JSONException e) { | 73 | } catch (JSONException e) { |
72 | e.printStackTrace(); | 74 | e.printStackTrace(); |
73 | } | 75 | } |
74 | 76 | ||
75 | break; | 77 | break; |
76 | case HttpCode.PUBLISH_SUCESS: | 78 | case HttpCode.PUBLISH_SUCESS: |
77 | defautPublishInfos.clear(); | 79 | defautPublishInfos.clear(); |
78 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 80 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
79 | sim_adapter.notifyDataSetChanged(); | 81 | sim_adapter.notifyDataSetChanged(); |
82 | for (int i = 0; i < defautPublishInfos.size(); i++) { | ||
83 | String subject = defautPublishInfos.get(i).getSubject(); | ||
84 | if (subject.equals("语文")) { | ||
85 | chinese = defautPublishInfos.get(i).getPress(); | ||
86 | } else if (subject.equals("数学")) { | ||
87 | math = defautPublishInfos.get(i).getPress(); | ||
88 | } else if (subject.equals("英语")) { | ||
89 | english = defautPublishInfos.get(i).getPress(); | ||
90 | } else if (subject.equals("物理")) { | ||
91 | physics = defautPublishInfos.get(i).getPress(); | ||
92 | } else if (subject.equals("化学")) { | ||
93 | chemistry = defautPublishInfos.get(i).getPress(); | ||
94 | } else if (subject.equals("历史")) { | ||
95 | history = defautPublishInfos.get(i).getPress(); | ||
96 | } else if (subject.equals("地理")) { | ||
97 | geography = defautPublishInfos.get(i).getPress(); | ||
98 | } else if (subject.equals("政治")) { | ||
99 | political = defautPublishInfos.get(i).getPress(); | ||
100 | }else if (subject.equals("生物")) { | ||
101 | biology = defautPublishInfos.get(i).getPress(); | ||
102 | }else if (subject.equals("科学")) { | ||
103 | science = defautPublishInfos.get(i).getPress(); | ||
104 | } | ||
105 | } | ||
80 | break; | 106 | break; |
81 | case HttpCode.REGISTERINFO_SUCESS: | 107 | case HttpCode.REGISTERINFO_SUCESS: |
82 | try { | 108 | try { |
83 | jsonObject = new JSONObject((String) msg.obj); | 109 | jsonObject = new JSONObject((String) msg.obj); |
84 | String statusregister = jsonObject.optString("status"); | 110 | String statusregister = jsonObject.optString("status"); |
85 | if (statusregister.equals("1")) { | 111 | if (statusregister.equals("1")) { |
86 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); | 112 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); |
87 | String userID = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, "userId"); | 113 | String userID = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, "userId"); |
88 | try { | 114 | try { |
89 | if (userID == null) { | 115 | if (userID == null) { |
90 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 116 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
91 | 117 | ||
92 | } else { | 118 | } else { |
93 | long auserID = Long.parseLong(userID); | 119 | long auserID = Long.parseLong(userID); |
94 | //验证保卡信息 | 120 | //验证保卡信息 |
95 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, auserID, handler); | 121 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, auserID, handler); |
96 | } | 122 | } |
97 | 123 | ||
98 | } catch (NumberFormatException e) { | 124 | } catch (NumberFormatException e) { |
99 | e.printStackTrace(); | 125 | e.printStackTrace(); |
100 | } | 126 | } |
101 | 127 | ||
102 | } else { | 128 | } else { |
103 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); | 129 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); |
104 | } | 130 | } |
105 | } catch (JSONException e) { | 131 | } catch (JSONException e) { |
106 | e.printStackTrace(); | 132 | e.printStackTrace(); |
107 | } | 133 | } |
108 | 134 | ||
109 | 135 | ||
110 | break; | 136 | break; |
111 | 137 | ||
112 | } | 138 | } |
113 | 139 | ||
114 | } | 140 | } |
115 | }; | 141 | }; |
116 | 142 | ||
117 | @Override | 143 | @Override |
118 | protected void onCreate(Bundle savedInstanceState) { | 144 | protected void onCreate(Bundle savedInstanceState) { |
119 | super.onCreate(savedInstanceState); | 145 | super.onCreate(savedInstanceState); |
120 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 146 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
121 | String graderid = SaveParam.getInstance().getCustomizeParam(this, SaveParam.GRADENS); | 147 | String graderid = SaveParam.getInstance().getCustomizeParam(this, SaveParam.GRADENS); |
122 | try { | 148 | try { |
123 | long auserID = Long.parseLong(userID); | 149 | long auserID = Long.parseLong(userID); |
124 | int graderID = Integer.parseInt(graderid); | 150 | int graderID = Integer.parseInt(graderid); |
125 | //获取版本信息 | 151 | //获取版本信息 |
126 | HttpManager.getInstance().getpublishinfo(this, auserID, graderID, handler); | 152 | HttpManager.getInstance().getpublishinfo(this, auserID, graderID, handler); |
127 | 153 | ||
128 | } catch (NumberFormatException e) { | 154 | } catch (NumberFormatException e) { |
129 | e.printStackTrace(); | 155 | e.printStackTrace(); |
130 | } | 156 | } |
131 | setContentView(R.layout.activity_choisetextbook); | 157 | setContentView(R.layout.activity_choisetextbook); |
132 | SysApplication.getInstance().addActivity(this); | 158 | SysApplication.getInstance().addActivity(this); |
133 | initView(); | 159 | initView(); |
134 | initData(); | 160 | initData(); |
135 | initLister(); | 161 | initLister(); |
136 | } | 162 | } |
137 | 163 | ||
138 | private void initView() { | 164 | private void initView() { |
139 | gridView = (GridView) findViewById(R.id.grideview); | 165 | gridView = (GridView) findViewById(R.id.grideview); |
140 | cancel = (ImageView) findViewById(R.id.cancel); | 166 | cancel = (ImageView) findViewById(R.id.cancel); |
141 | btn_ok = (Button) findViewById(R.id.btn_ok); | 167 | btn_ok = (Button) findViewById(R.id.btn_ok); |
142 | } | 168 | } |
143 | 169 | ||
144 | private void initData() { | 170 | private void initData() { |
145 | sim_adapter = new GridAdapter(defautPublishInfos, this); | 171 | sim_adapter = new GridAdapter(defautPublishInfos, this); |
146 | //配置适配器 | 172 | //配置适配器 |
147 | gridView.setAdapter(sim_adapter); | 173 | gridView.setAdapter(sim_adapter); |
148 | 174 | ||
149 | } | 175 | } |
150 | 176 | ||
151 | private void initLister() { | 177 | private void initLister() { |
152 | btn_ok.setOnClickListener(this); | 178 | btn_ok.setOnClickListener(this); |
153 | cancel.setOnClickListener(this); | 179 | cancel.setOnClickListener(this); |
154 | gridView.setOnItemClickListener(this); | 180 | gridView.setOnItemClickListener(this); |
155 | 181 | ||
156 | } | 182 | } |
157 | 183 | ||
158 | @Override | 184 | @Override |
159 | public void onClick(View v) { | 185 | public void onClick(View v) { |
160 | switch (v.getId()) { | 186 | switch (v.getId()) { |
161 | case R.id.btn_ok: | 187 | case R.id.btn_ok: |
162 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 188 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
163 | String regionId = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); | 189 | String regionId = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); |
164 | String regionId1 = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CITYS); | 190 | String regionId1 = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CITYS); |
165 | if (regionId == null) { | 191 | if (regionId == null) { |
166 | regionId = regionId1; | 192 | regionId = regionId1; |
167 | } | 193 | } |
168 | String grade = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this, SaveParam.GRADENS); | 194 | String grade = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this, SaveParam.GRADENS); |
169 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); | 195 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); |
170 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.USERNAME); | 196 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.USERNAME); |
171 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADRESS); | 197 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADRESS); |
172 | String togoth = "人民教育出版社"; | ||
173 | 198 | ||
174 | try { | 199 | try { |
175 | if (userID == null) { | 200 | if (userID == null) { |
176 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 201 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
177 | 202 | ||
178 | } else { | 203 | } else { |
179 | Object schoolID; | 204 | Object schoolID; |
180 | long auserID = Long.parseLong(userID); | 205 | long auserID = Long.parseLong(userID); |
181 | int gradeID = Integer.parseInt(grade); | 206 | int gradeID = Integer.parseInt(grade); |
182 | long regionID = Long.parseLong(regionId); | 207 | long regionID = Long.parseLong(regionId); |
183 | if (schoolid == null) { | 208 | if (schoolid == null) { |
184 | schoolID = null; | 209 | schoolID = null; |
185 | } else { | 210 | } else { |
186 | schoolID = Long.parseLong(schoolid); | 211 | schoolID = Long.parseLong(schoolid); |
187 | } | 212 | } |
188 | 213 | ||
189 | //提交注册信息 | 214 | //提交注册信息 |
190 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, | 215 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, |
191 | name, gradeID, regionID, regeionname, schoolID, togoth, togoth, togoth, togoth | 216 | name, gradeID, regionID, regeionname, schoolID, math,english, chinese,physics,chemistry,history,geography,political,biology,science, handler); |
192 | , togoth, togoth, togoth, togoth, togoth, togoth, handler); | ||
193 | } | 217 | } |
194 | 218 | ||
195 | } catch (NumberFormatException e) { | 219 | } catch (NumberFormatException e) { |
196 | e.printStackTrace(); | 220 | e.printStackTrace(); |
197 | } | 221 | } |
198 | 222 | ||
199 | break; | 223 | break; |
200 | case R.id.cancel: | 224 | case R.id.cancel: |
201 | finish(); | 225 | finish(); |
202 | break; | 226 | break; |
203 | } | 227 | } |
204 | 228 | ||
205 | } | 229 | } |
206 | 230 | ||
207 | @Override | 231 | @Override |
208 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 232 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
209 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); | 233 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); |
210 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); | 234 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); |
211 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | 235 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); |
212 | publish = (TextView) view.findViewById(R.id.tv_publish); | 236 | publish = (TextView) view.findViewById(R.id.tv_publish); |
213 | 237 | ||
214 | } | 238 | } |
215 | 239 | ||
216 | @Override | 240 | @Override |
217 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | 241 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { |
218 | String imageurl = data.get(position).getPressCover(); | 242 | String imageurl = data.get(position).getPressCover(); |
219 | String publishs = data.get(position).getPressName(); | 243 | String publishs = data.get(position).getPressName(); |
220 | simpleDraweeView.setImageURI(imageurl); | 244 | simpleDraweeView.setImageURI(imageurl); |
221 | publish.setText(publishs); | 245 | publish.setText(publishs); |
246 | String subject = SaveParam.getInstance().getLoginParam(this, SaveParam.SUBJECT); | ||
247 | Log.e("test", "选择的科目" + subject); | ||
248 | if ("语文".equals(subject)) { | ||
249 | chinese = publishs; | ||
250 | } else if ("数学".equals(subject)) { | ||
251 | math = publishs; | ||
252 | }else if ("英语".equals(subject)) { | ||
253 | english = publishs; | ||
254 | }else if ("物理".equals(subject)) { | ||
255 | physics = publishs; | ||
256 | }else if ("化学".equals(subject)) { | ||
257 | chemistry = publishs; | ||
258 | }else if ("历史".equals(subject)) { | ||
259 | history = publishs; | ||
260 | }else if ("地理".equals(subject)) { | ||
261 | geography = publishs; | ||
262 | }else if ("政治".equals(subject)) { | ||
263 | political = publishs; | ||
264 | }else if ("生物".equals(subject)) { | ||
265 | biology = publishs; | ||
266 | }else if ("科学".equals(subject)) { | ||
267 | science = publishs; | ||
268 | } | ||
222 | 269 | ||
223 | } | 270 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.content.Context; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
6 | import android.net.Uri; | 6 | import android.net.Uri; |
7 | import android.os.Build; | 7 | import android.os.Build; |
8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
9 | import android.os.Handler; | 9 | import android.os.Handler; |
10 | import android.os.Message; | 10 | import android.os.Message; |
11 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
12 | import android.support.annotation.NonNull; | 12 | import android.support.annotation.NonNull; |
13 | import android.support.v4.content.FileProvider; | 13 | import android.support.v4.content.FileProvider; |
14 | import android.support.v7.app.AppCompatActivity; | 14 | import android.support.v7.app.AppCompatActivity; |
15 | import android.support.v7.widget.LinearLayoutManager; | 15 | import android.support.v7.widget.LinearLayoutManager; |
16 | import android.support.v7.widget.RecyclerView; | 16 | import android.support.v7.widget.RecyclerView; |
17 | import android.view.KeyEvent; | 17 | import android.view.KeyEvent; |
18 | import android.view.View; | 18 | import android.view.View; |
19 | import android.widget.ImageView; | 19 | import android.widget.ImageView; |
20 | import android.widget.LinearLayout; | 20 | import android.widget.LinearLayout; |
21 | import android.widget.TextView; | 21 | import android.widget.TextView; |
22 | import android.widget.Toast; | 22 | import android.widget.Toast; |
23 | 23 | ||
24 | import com.facebook.drawee.backends.pipeline.Fresco; | 24 | import com.facebook.drawee.backends.pipeline.Fresco; |
25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
27 | import com.facebook.drawee.generic.RoundingParams; | 27 | import com.facebook.drawee.generic.RoundingParams; |
28 | import com.facebook.drawee.interfaces.DraweeController; | 28 | import com.facebook.drawee.interfaces.DraweeController; |
29 | import com.facebook.drawee.view.SimpleDraweeView; | 29 | import com.facebook.drawee.view.SimpleDraweeView; |
30 | import com.hjx.personalcenter.R; | 30 | import com.hjx.personalcenter.R; |
31 | import com.hjx.personalcenter.adapter.GalleryAdapter; | 31 | import com.hjx.personalcenter.adapter.GalleryAdapter; |
32 | import com.hjx.personalcenter.adapter.VideoAdapter; | 32 | import com.hjx.personalcenter.adapter.VideoAdapter; |
33 | import com.hjx.personalcenter.customdialog.HeadDialog; | 33 | import com.hjx.personalcenter.customdialog.HeadDialog; |
34 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 34 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
35 | import com.hjx.personalcenter.db.SaveParam; | 35 | import com.hjx.personalcenter.db.SaveParam; |
36 | import com.hjx.personalcenter.http.HttpCode; | 36 | import com.hjx.personalcenter.http.HttpCode; |
37 | import com.hjx.personalcenter.http.HttpManager; | 37 | import com.hjx.personalcenter.http.HttpManager; |
38 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 38 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
39 | import com.hjx.personalcenter.model.DefautPublishInfo; | 39 | import com.hjx.personalcenter.model.DefautPublishInfo; |
40 | import com.hjx.personalcenter.model.PesonalInfo; | 40 | import com.hjx.personalcenter.model.PesonalInfo; |
41 | import com.hjx.personalcenter.model.SignInfo; | 41 | import com.hjx.personalcenter.model.SignInfo; |
42 | import com.hjx.personalcenter.model.VideoInfo; | 42 | import com.hjx.personalcenter.model.VideoInfo; |
43 | import com.hjx.personalcenter.update.UpdateChecker; | 43 | import com.hjx.personalcenter.update.UpdateChecker; |
44 | import com.hjx.personalcenter.util.AlertUtils; | 44 | import com.hjx.personalcenter.util.AlertUtils; |
45 | import com.hjx.personalcenter.util.CropUtils; | 45 | import com.hjx.personalcenter.util.CropUtils; |
46 | import com.hjx.personalcenter.util.DialogPermission; | 46 | import com.hjx.personalcenter.util.DialogPermission; |
47 | import com.hjx.personalcenter.util.FileUtil; | 47 | import com.hjx.personalcenter.util.FileUtil; |
48 | import com.hjx.personalcenter.util.PermissionUtil; | 48 | import com.hjx.personalcenter.util.PermissionUtil; |
49 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 49 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
50 | import com.mylhyl.circledialog.CircleDialog; | 50 | import com.mylhyl.circledialog.CircleDialog; |
51 | import com.mylhyl.circledialog.callback.ConfigInput; | 51 | import com.mylhyl.circledialog.callback.ConfigInput; |
52 | import com.mylhyl.circledialog.params.InputParams; | 52 | import com.mylhyl.circledialog.params.InputParams; |
53 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 53 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
54 | import com.zaaach.toprightmenu.MenuItem; | 54 | import com.zaaach.toprightmenu.MenuItem; |
55 | import com.zaaach.toprightmenu.TopRightMenu; | 55 | import com.zaaach.toprightmenu.TopRightMenu; |
56 | 56 | ||
57 | import java.io.File; | 57 | import java.io.File; |
58 | import java.io.UnsupportedEncodingException; | 58 | import java.io.UnsupportedEncodingException; |
59 | import java.util.ArrayList; | 59 | import java.util.ArrayList; |
60 | import java.util.List; | 60 | import java.util.List; |
61 | 61 | ||
62 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 62 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
63 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; | 63 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; |
64 | private TextView tv_edit_presoninfo, tv_sign, | 64 | private TextView tv_edit_presoninfo, tv_sign, |
65 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 65 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
66 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; | 66 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; |
67 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; | 67 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; |
68 | private TopRightMenu mTopRightMenu; | 68 | private TopRightMenu mTopRightMenu; |
69 | //水平滑动 | 69 | //水平滑动 |
70 | private RecyclerView mRecyclerView; | 70 | private RecyclerView mRecyclerView; |
71 | private RecyclerView mRecyclerViewpublish; | 71 | private RecyclerView mRecyclerViewpublish; |
72 | private VideoAdapter RecyclerViewadapter; | 72 | private VideoAdapter RecyclerViewadapter; |
73 | private GalleryAdapter RecyclerViewadapterpublish; | 73 | private GalleryAdapter RecyclerViewadapterpublish; |
74 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 74 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
75 | 75 | ||
76 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); | 76 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); |
77 | private boolean showIcon = true; | 77 | private boolean showIcon = true; |
78 | private boolean dimBg = true; | 78 | private boolean dimBg = true; |
79 | private boolean needAnim = true; | 79 | private boolean needAnim = true; |
80 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 80 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
81 | private static final int REQUEST_CODE_ALBUM = 2; | 81 | private static final int REQUEST_CODE_ALBUM = 2; |
82 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 82 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
83 | SimpleDraweeView mSimpleDraweeView; | 83 | SimpleDraweeView mSimpleDraweeView; |
84 | private File file; | 84 | private File file; |
85 | private Uri uri; | 85 | private Uri uri; |
86 | Handler handler = new Handler(){ | 86 | Handler handler = new Handler(){ |
87 | @Override | 87 | @Override |
88 | public void handleMessage(Message msg) { | 88 | public void handleMessage(Message msg) { |
89 | super.handleMessage(msg); | 89 | super.handleMessage(msg); |
90 | switch (msg.what){ | 90 | switch (msg.what){ |
91 | case HttpCode.GETINFO: | 91 | case HttpCode.GETINFO: |
92 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; | 92 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; |
93 | tv_username.setText(cardinfoBean.getNickName()); | 93 | tv_username.setText(cardinfoBean.getNickName()); |
94 | tv_username1.setText(cardinfoBean.getNickName()); | 94 | tv_username1.setText(cardinfoBean.getNickName()); |
95 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 95 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
96 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 96 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
97 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 97 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
98 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 98 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
99 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 99 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
100 | String sex = cardinfoBean.getGender(); | 100 | String sex = cardinfoBean.getGender(); |
101 | if ("0".equals(sex)){ | 101 | if ("0".equals(sex)){ |
102 | tv_sex.setText("男"); | 102 | tv_sex.setText("男"); |
103 | iv_sex.setImageResource(R.mipmap.men); | 103 | iv_sex.setImageResource(R.mipmap.men); |
104 | }else { | 104 | }else { |
105 | tv_sex.setText("女"); | 105 | tv_sex.setText("女"); |
106 | iv_sex.setImageResource(R.mipmap.women); | 106 | iv_sex.setImageResource(R.mipmap.women); |
107 | } | 107 | } |
108 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | 108 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); |
109 | String graderID =cardinfoBean.getGrade().getGradeId(); | 109 | String graderID =cardinfoBean.getGrade().getGradeId(); |
110 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); | 110 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); |
111 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.GRADENS, ""+graderID); | 111 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.GRADENS, ""+graderID); |
112 | try { | 112 | try { |
113 | long auserID = Long.parseLong(userID); | 113 | long auserID = Long.parseLong(userID); |
114 | int graderIDs =Integer.parseInt(graderID); | 114 | int graderIDs =Integer.parseInt(graderID); |
115 | //获取版本信息 | 115 | //获取版本信息 |
116 | HttpManager.getInstance().getpublishinfo(MainActivity.this,auserID,graderIDs,handler); | 116 | HttpManager.getInstance().getpublishinfo(MainActivity.this,auserID,graderIDs,handler); |
117 | 117 | ||
118 | } catch (NumberFormatException e) { | 118 | } catch (NumberFormatException e) { |
119 | e.printStackTrace(); | 119 | e.printStackTrace(); |
120 | } | 120 | } |
121 | 121 | ||
122 | break; | 122 | break; |
123 | case HttpCode.SIGN: | 123 | case HttpCode.SIGN: |
124 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; | 124 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; |
125 | if (dataBean.getSignature()==null){ | 125 | if (dataBean.getSignature()==null){ |
126 | tv_sign.setText("你还未设置个性签名"); | 126 | tv_sign.setText("你还未设置个性签名"); |
127 | }else { | 127 | }else { |
128 | tv_sign.setText(dataBean.getSignature()); | 128 | tv_sign.setText(dataBean.getSignature()); |
129 | } | 129 | } |
130 | 130 | ||
131 | break; | 131 | break; |
132 | case HttpCode.PUBLISH_SUCESS: | 132 | case HttpCode.PUBLISH_SUCESS: |
133 | defautPublishInfos.clear(); | 133 | defautPublishInfos.clear(); |
134 | defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); | 134 | defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); |
135 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 135 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
136 | break; | 136 | break; |
137 | case HttpCode.GETVIDIO_SUCESS: | 137 | case HttpCode.GETVIDIO_SUCESS: |
138 | videoinfo.clear(); | 138 | videoinfo.clear(); |
139 | videoinfo.addAll( (List<VideoInfo.DataBean>)msg.obj); | 139 | videoinfo.addAll( (List<VideoInfo.DataBean>)msg.obj); |
140 | RecyclerViewadapter.notifyDataSetChanged(); | 140 | RecyclerViewadapter.notifyDataSetChanged(); |
141 | break; | 141 | break; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | }; | 144 | }; |
145 | 145 | ||
146 | @Override | 146 | @Override |
147 | protected void onCreate(Bundle savedInstanceState) { | 147 | protected void onCreate(Bundle savedInstanceState) { |
148 | super.onCreate(savedInstanceState); | 148 | super.onCreate(savedInstanceState); |
149 | Fresco.initialize(this); | 149 | Fresco.initialize(this); |
150 | setContentView(R.layout.activity_main); | 150 | setContentView(R.layout.activity_main); |
151 | SysApplication.getInstance().addActivity(this); | 151 | SysApplication.getInstance().addActivity(this); |
152 | initView(); | 152 | initView(); |
153 | initData(); | 153 | initData(); |
154 | initLister(); | 154 | initLister(); |
155 | updateVersion(); | 155 | updateVersion(); |
156 | // String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 156 | // String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
157 | // Log.e("test","......."+devicenumber); | 157 | // Log.e("test","......."+devicenumber); |
158 | } | 158 | } |
159 | //////版本更新 | 159 | //////版本更新 |
160 | private void updateVersion() { | 160 | private void updateVersion() { |
161 | UpdateChecker updateChecker = new UpdateChecker(this); | 161 | UpdateChecker updateChecker = new UpdateChecker(this); |
162 | updateChecker.checkForUpdates(); | 162 | updateChecker.checkForUpdates(); |
163 | 163 | ||
164 | 164 | ||
165 | } | 165 | } |
166 | 166 | ||
167 | private void initView() { | 167 | private void initView() { |
168 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 168 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
169 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); | 169 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); |
170 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); | 170 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); |
171 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 171 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
172 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 172 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
173 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 173 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
174 | //头像 | 174 | //头像 |
175 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 175 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
176 | //初始化个人信息 | 176 | //初始化个人信息 |
177 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 177 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
178 | tv_username = (TextView) findViewById(R.id.tv_username); | 178 | tv_username = (TextView) findViewById(R.id.tv_username); |
179 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 179 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
180 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 180 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
181 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 181 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
182 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 182 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
183 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 183 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
184 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 184 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
185 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 185 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
186 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 186 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
187 | //跳转其他应用 | 187 | //跳转其他应用 |
188 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); | 188 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); |
189 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); | 189 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); |
190 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); | 190 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); |
191 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); | 191 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); |
192 | // | 192 | // |
193 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 193 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
194 | mRecyclerViewpublish =(RecyclerView) findViewById(R.id.id_recyclerview_pubish); | 194 | mRecyclerViewpublish =(RecyclerView) findViewById(R.id.id_recyclerview_pubish); |
195 | 195 | ||
196 | } | 196 | } |
197 | 197 | ||
198 | 198 | ||
199 | private void initData() { | 199 | private void initData() { |
200 | //设置布局管理器 | 200 | //设置布局管理器 |
201 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 201 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
202 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 202 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
203 | 203 | ||
204 | LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); | 204 | LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); |
205 | linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); | 205 | linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); |
206 | 206 | ||
207 | mRecyclerView.setLayoutManager(linearLayoutManager); | 207 | mRecyclerView.setLayoutManager(linearLayoutManager); |
208 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); | 208 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); |
209 | 209 | ||
210 | mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); | 210 | mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); |
211 | mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); | 211 | mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); |
212 | 212 | ||
213 | //设置视频适配器 | 213 | //设置视频适配器 |
214 | RecyclerViewadapter = new VideoAdapter(this,videoinfo); | 214 | RecyclerViewadapter = new VideoAdapter(this,videoinfo); |
215 | RecyclerViewadapterpublish= new GalleryAdapter(this,defautPublishInfos); | 215 | RecyclerViewadapterpublish= new GalleryAdapter(this,defautPublishInfos); |
216 | 216 | ||
217 | //版本信息适配器 | 217 | //版本信息适配器 |
218 | mRecyclerView.setAdapter(RecyclerViewadapter); | 218 | mRecyclerView.setAdapter(RecyclerViewadapter); |
219 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | 219 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); |
220 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 220 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
221 | //获取个性签名 | 221 | //获取个性签名 |
222 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 222 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
223 | try { | 223 | try { |
224 | long auserID = Long.parseLong(userID); | 224 | long auserID = Long.parseLong(userID); |
225 | int typeaccount1=Integer.parseInt(typeaccount); | 225 | int typeaccount1=Integer.parseInt(typeaccount); |
226 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,typeaccount1,handler); | 226 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,typeaccount1,handler); |
227 | 227 | ||
228 | } catch (NumberFormatException e) { | 228 | } catch (NumberFormatException e) { |
229 | e.printStackTrace(); | 229 | e.printStackTrace(); |
230 | } | 230 | } |
231 | 231 | ||
232 | //初始化图片 | 232 | //初始化图片 |
233 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 233 | // file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
234 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 234 | // if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
235 | uri = Uri.fromFile(file); | 235 | // uri = Uri.fromFile(file); |
236 | } else { | 236 | // } else { |
237 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 237 | // //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
238 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 238 | // uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
239 | } | 239 | // } |
240 | 240 | ||
241 | } | 241 | } |
242 | 242 | ||
243 | private void initLister() { | 243 | private void initLister() { |
244 | iv_imformatioan.setOnClickListener(this); | 244 | iv_imformatioan.setOnClickListener(this); |
245 | iv_look_card.setOnClickListener(this); | 245 | iv_look_card.setOnClickListener(this); |
246 | tv_edit_presoninfo.setOnClickListener(this); | 246 | tv_edit_presoninfo.setOnClickListener(this); |
247 | iv_setting.setOnClickListener(this); | 247 | iv_setting.setOnClickListener(this); |
248 | iv_sign.setOnClickListener(this); | 248 | iv_sign.setOnClickListener(this); |
249 | mSimpleDraweeView.setOnClickListener(this); | 249 | mSimpleDraweeView.setOnClickListener(this); |
250 | linel_mycuoti.setOnClickListener(this); | 250 | linel_mycuoti.setOnClickListener(this); |
251 | linel_mynote.setOnClickListener(this); | 251 | linel_mynote.setOnClickListener(this); |
252 | linel_mycollege.setOnClickListener(this); | 252 | linel_mycollege.setOnClickListener(this); |
253 | linel_myclass.setOnClickListener(this); | 253 | linel_myclass.setOnClickListener(this); |
254 | 254 | ||
255 | } | 255 | } |
256 | 256 | ||
257 | @Override | 257 | @Override |
258 | public void onClick(View v) { | 258 | public void onClick(View v) { |
259 | switch (v.getId()) { | 259 | switch (v.getId()) { |
260 | case R.id.iv_imformatioan: | 260 | case R.id.iv_imformatioan: |
261 | Intent intent = new Intent(); | 261 | Intent intent = new Intent(); |
262 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 262 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
263 | startActivity(intent); | 263 | startActivity(intent); |
264 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 264 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
265 | break; | 265 | break; |
266 | case R.id.iv_look_card: | 266 | case R.id.iv_look_card: |
267 | Intent lookintent = new Intent(); | 267 | Intent lookintent = new Intent(); |
268 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 268 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
269 | startActivity(lookintent); | 269 | startActivity(lookintent); |
270 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 270 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
271 | break; | 271 | break; |
272 | case R.id.tv_edit_presoninfo: | 272 | case R.id.tv_edit_presoninfo: |
273 | Intent editintent = new Intent(); | 273 | Intent editintent = new Intent(); |
274 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 274 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
275 | startActivity(editintent); | 275 | startActivity(editintent); |
276 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 276 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
277 | break; | 277 | break; |
278 | case R.id.iv_head: | 278 | case R.id.iv_head: |
279 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 279 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
280 | break; | 280 | break; |
281 | case R.id.iv_setting: | 281 | case R.id.iv_setting: |
282 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 282 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
283 | List<MenuItem> menuItems = new ArrayList<>(); | 283 | List<MenuItem> menuItems = new ArrayList<>(); |
284 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 284 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); |
285 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 285 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); |
286 | mTopRightMenu | 286 | mTopRightMenu |
287 | .setHeight(150) //默认高度480 | 287 | .setHeight(150) //默认高度480 |
288 | .setWidth(320) //默认宽度wrap_content | 288 | .setWidth(320) //默认宽度wrap_content |
289 | .showIcon(showIcon) //显示菜单图标,默认为true | 289 | .showIcon(showIcon) //显示菜单图标,默认为true |
290 | .dimBackground(dimBg) //背景变暗,默认为true | 290 | .dimBackground(dimBg) //背景变暗,默认为true |
291 | .needAnimationStyle(needAnim) //显示动画,默认为true | 291 | .needAnimationStyle(needAnim) //显示动画,默认为true |
292 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 292 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
293 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 293 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
294 | @Override | 294 | @Override |
295 | public void onMenuItemClick(int position) { | 295 | public void onMenuItemClick(int position) { |
296 | switch (position) { | 296 | switch (position) { |
297 | case 0: | 297 | case 0: |
298 | //清除数据 | 298 | //清除数据 |
299 | SaveParam.getInstance().clearData(MainActivity.this); | 299 | SaveParam.getInstance().clearData(MainActivity.this); |
300 | Intent settingintent = new Intent(); | 300 | Intent settingintent = new Intent(); |
301 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 301 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
302 | startActivity(settingintent); | 302 | startActivity(settingintent); |
303 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 303 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
304 | finish(); | 304 | finish(); |
305 | break; | 305 | break; |
306 | case 1: | 306 | case 1: |
307 | Intent accontMintent = new Intent(); | 307 | Intent accontMintent = new Intent(); |
308 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 308 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
309 | startActivity(accontMintent); | 309 | startActivity(accontMintent); |
310 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 310 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
311 | break; | 311 | break; |
312 | } | 312 | } |
313 | } | 313 | } |
314 | }) | 314 | }) |
315 | .addMenuList(menuItems) | 315 | .addMenuList(menuItems) |
316 | .showAsDropDown(iv_setting, -250, 0); | 316 | .showAsDropDown(iv_setting, -250, 0); |
317 | break; | 317 | break; |
318 | case R.id.iv_sign: | 318 | case R.id.iv_sign: |
319 | new CircleDialog.Builder(this) | 319 | new CircleDialog.Builder(this) |
320 | .setCanceledOnTouchOutside(false) | 320 | .setCanceledOnTouchOutside(false) |
321 | .setCancelable(true) | 321 | .setCancelable(true) |
322 | .setTitle("个性签名") | 322 | .setTitle("个性签名") |
323 | .setInputHint("请输入个性签名") | 323 | .setInputHint("请输入个性签名") |
324 | .setWidth(0.5f) | 324 | .setWidth(0.5f) |
325 | .configInput(new ConfigInput() { | 325 | .configInput(new ConfigInput() { |
326 | @Override | 326 | @Override |
327 | public void onConfig(InputParams params) { | 327 | public void onConfig(InputParams params) { |
328 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 328 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
329 | } | 329 | } |
330 | }) | 330 | }) |
331 | .setNegative("取消", null) | 331 | .setNegative("取消", null) |
332 | .setPositiveInput("确定", new OnInputClickListener() { | 332 | .setPositiveInput("确定", new OnInputClickListener() { |
333 | @Override | 333 | @Override |
334 | public void onClick(String text, View v) { | 334 | public void onClick(String text, View v) { |
335 | if (text.equals("")) { | 335 | if (text.equals("")) { |
336 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 336 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
337 | } else { | 337 | } else { |
338 | try { | 338 | try { |
339 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this,SaveParam.ACCOUNT); | 339 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this,SaveParam.ACCOUNT); |
340 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); | 340 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); |
341 | long auserID = Long.parseLong(userID); | 341 | long auserID = Long.parseLong(userID); |
342 | int typeaccount1=Integer.parseInt(typeaccount); | 342 | int typeaccount1=Integer.parseInt(typeaccount); |
343 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,typeaccount1,text); | 343 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,typeaccount1,text); |
344 | } catch (NumberFormatException e) { | 344 | } catch (NumberFormatException e) { |
345 | e.printStackTrace(); | 345 | e.printStackTrace(); |
346 | } | 346 | } |
347 | 347 | ||
348 | tv_sign.setText(text); | 348 | tv_sign.setText(text); |
349 | } | 349 | } |
350 | 350 | ||
351 | } | 351 | } |
352 | }) | 352 | }) |
353 | .show(); | 353 | .show(); |
354 | break; | 354 | break; |
355 | case R.id.linel_mycuoti: | 355 | case R.id.linel_mycuoti: |
356 | AlertUtils.showToast(this, "hhahahah "); | 356 | AlertUtils.showToast(this, "hhahahah "); |
357 | break; | 357 | break; |
358 | case R.id.linel_mynote: | 358 | case R.id.linel_mynote: |
359 | AlertUtils.showToast(this, "hhahahah "); | 359 | AlertUtils.showToast(this, "hhahahah "); |
360 | break; | 360 | break; |
361 | case R.id.linel_mycollege: | 361 | case R.id.linel_mycollege: |
362 | AlertUtils.showToast(this, "hhahahah "); | 362 | AlertUtils.showToast(this, "hhahahah "); |
363 | break; | 363 | break; |
364 | case R.id.linel_myclass: | 364 | case R.id.linel_myclass: |
365 | AlertUtils.showToast(this, "hhahahah "); | 365 | AlertUtils.showToast(this, "hhahahah "); |
366 | break; | 366 | break; |
367 | } | 367 | } |
368 | 368 | ||
369 | } | 369 | } |
370 | 370 | ||
371 | @Override | 371 | @Override |
372 | protected void onResume() { | 372 | protected void onResume() { |
373 | super.onResume(); | 373 | super.onResume(); |
374 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 374 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
375 | //账户类型 | 375 | //账户类型 |
376 | String accounts = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 376 | String accounts = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
377 | //加载个人信息 | 377 | //加载个人信息 |
378 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); | 378 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); |
379 | if (xiongzuo==null){ | 379 | if (xiongzuo==null){ |
380 | tv_mygad.setText(""); | 380 | tv_mygad.setText(""); |
381 | }else { | 381 | }else { |
382 | tv_mygad.setText(xiongzuo); | 382 | tv_mygad.setText(xiongzuo); |
383 | } | 383 | } |
384 | try { | 384 | try { |
385 | int graderID; | 385 | int graderID; |
386 | long auserID = Long.parseLong(userID); | 386 | long auserID = Long.parseLong(userID); |
387 | int typeaccount1=Integer.parseInt(accounts); | 387 | int typeaccount1=Integer.parseInt(accounts); |
388 | //获取最近播放视频 | 388 | //获取最近播放视频 |
389 | HttpManager.getInstance().getstuyvidioinfo(this,auserID,handler); | 389 | HttpManager.getInstance().getstuyvidioinfo(this,auserID,handler); |
390 | //获取个人信息 | 390 | //获取个人信息 |
391 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,typeaccount1,handler); | 391 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,typeaccount1,handler); |
392 | 392 | ||
393 | 393 | ||
394 | 394 | ||
395 | } catch (NumberFormatException e) { | 395 | } catch (NumberFormatException e) { |
396 | e.printStackTrace(); | 396 | e.printStackTrace(); |
397 | } | 397 | } |
398 | 398 | ||
399 | } | 399 | } |
400 | 400 | ||
401 | //回调头像监听 | 401 | //回调头像监听 |
402 | @Override | 402 | @Override |
403 | public void heard(Context context, View v,int headpitiaon) { | 403 | public void heard(Context context, View v,int headpitiaon) { |
404 | String picUrl = ""; | 404 | String picUrl = ""; |
405 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 405 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
406 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 406 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
407 | switch (v.getId()){ | 407 | switch (v.getId()){ |
408 | //选择默认图片 | 408 | //选择默认图片 |
409 | case R.id.oktakephone: | 409 | case R.id.oktakephone: |
410 | if (headpitiaon==1){ | 410 | if (headpitiaon==1){ |
411 | mSimpleDraweeView.setImageDrawable(null); | 411 | mSimpleDraweeView.setImageDrawable(null); |
412 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 412 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
413 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; | 413 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; |
414 | try { | 414 | try { |
415 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 415 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
416 | } catch (UnsupportedEncodingException e) { | 416 | } catch (UnsupportedEncodingException e) { |
417 | e.printStackTrace(); | 417 | e.printStackTrace(); |
418 | } | 418 | } |
419 | }else if (headpitiaon==2){ | 419 | }else if (headpitiaon==2){ |
420 | mSimpleDraweeView.setImageDrawable(null); | 420 | mSimpleDraweeView.setImageDrawable(null); |
421 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 421 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
422 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; | 422 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; |
423 | try { | 423 | try { |
424 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 424 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
425 | } catch (UnsupportedEncodingException e) { | 425 | } catch (UnsupportedEncodingException e) { |
426 | e.printStackTrace(); | 426 | e.printStackTrace(); |
427 | } | 427 | } |
428 | }else if (headpitiaon==3){ | 428 | }else if (headpitiaon==3){ |
429 | mSimpleDraweeView.setImageDrawable(null); | 429 | mSimpleDraweeView.setImageDrawable(null); |
430 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 430 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
431 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; | 431 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; |
432 | try { | 432 | try { |
433 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 433 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
434 | } catch (UnsupportedEncodingException e) { | 434 | } catch (UnsupportedEncodingException e) { |
435 | e.printStackTrace(); | 435 | e.printStackTrace(); |
436 | } | 436 | } |
437 | }else if (headpitiaon==4){ | 437 | }else if (headpitiaon==4){ |
438 | mSimpleDraweeView.setImageDrawable(null); | 438 | mSimpleDraweeView.setImageDrawable(null); |
439 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 439 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
440 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; | 440 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; |
441 | try { | 441 | try { |
442 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 442 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
443 | } catch (UnsupportedEncodingException e) { | 443 | } catch (UnsupportedEncodingException e) { |
444 | e.printStackTrace(); | 444 | e.printStackTrace(); |
445 | } | 445 | } |
446 | }else{ | 446 | }else{ |
447 | mSimpleDraweeView.setImageDrawable(null); | 447 | mSimpleDraweeView.setImageDrawable(null); |
448 | mSimpleDraweeView.setImageResource(R.mipmap.header_default);; | 448 | mSimpleDraweeView.setImageResource(R.mipmap.header_default);; |
449 | } | 449 | } |
450 | 450 | ||
451 | break; | 451 | break; |
452 | case R.id.canceltakephone: | 452 | case R.id.canceltakephone: |
453 | 453 | ||
454 | break; | 454 | break; |
455 | //拍摄和相册 | 455 | //拍摄和相册 |
456 | case R.id.take_pic: | 456 | case R.id.take_pic: |
457 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 457 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
458 | uploadAvatarFromPhotoRequest(); | 458 | uploadAvatarFromPhotoRequest(); |
459 | } | 459 | } |
460 | 460 | ||
461 | break; | 461 | break; |
462 | case R.id.xiangce: | 462 | case R.id.xiangce: |
463 | uploadAvatarFromAlbumRequest(); | 463 | uploadAvatarFromAlbumRequest(); |
464 | break; | 464 | break; |
465 | 465 | ||
466 | } | 466 | } |
467 | 467 | ||
468 | } | 468 | } |
469 | 469 | ||
470 | //照相 | 470 | //照相 |
471 | private void uploadAvatarFromPhotoRequest() { | 471 | private void uploadAvatarFromPhotoRequest() { |
472 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 472 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
473 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 473 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
474 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 474 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
475 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 475 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
476 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 476 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
477 | } | 477 | } |
478 | 478 | ||
479 | //选择图库 | 479 | //选择图库 |
480 | private void uploadAvatarFromAlbumRequest() { | 480 | private void uploadAvatarFromAlbumRequest() { |
481 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 481 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
482 | photoPickerIntent.setType("image/*"); | 482 | photoPickerIntent.setType("image/*"); |
483 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 483 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
484 | } | 484 | } |
485 | //回掉 | 485 | //回掉 |
486 | @Override | 486 | @Override |
487 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 487 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
488 | super.onActivityResult(requestCode, resultCode, data); | 488 | super.onActivityResult(requestCode, resultCode, data); |
489 | if (resultCode != -1) { | 489 | if (resultCode != -1) { |
490 | return; | 490 | return; |
491 | } | 491 | } |
492 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 492 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
493 | Uri newUri; | 493 | Uri newUri; |
494 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 494 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
495 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 495 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
496 | } else { | 496 | } else { |
497 | newUri = data.getData(); | 497 | newUri = data.getData(); |
498 | } | 498 | } |
499 | if (newUri != null) { | 499 | if (newUri != null) { |
500 | startPhotoZoom(newUri); | 500 | startPhotoZoom(newUri); |
501 | } else { | 501 | } else { |
502 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 502 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
503 | } | 503 | } |
504 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 504 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
505 | startPhotoZoom(uri); | 505 | startPhotoZoom(uri); |
506 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 506 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
507 | uploadAvatarFromPhoto(); | 507 | uploadAvatarFromPhoto(); |
508 | } | 508 | } |
509 | } | 509 | } |
510 | 510 | ||
511 | private void uploadAvatarFromPhoto() { | 511 | private void uploadAvatarFromPhoto() { |
512 | compressAndUploadAvatar(file.getPath()); | 512 | compressAndUploadAvatar(file.getPath()); |
513 | 513 | ||
514 | } | 514 | } |
515 | private void compressAndUploadAvatar(String fileSrc) { | 515 | private void compressAndUploadAvatar(String fileSrc) { |
516 | 516 | ||
517 | 517 | ||
518 | //上传到服务器 | 518 | //上传到服务器 |
519 | 519 | ||
520 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 520 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
521 | String mimeType = "image/*"; | 521 | String mimeType = "image/*"; |
522 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 522 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
523 | //String fileName = cover.getName(); | 523 | //String fileName = cover.getName(); |
524 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 524 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
525 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 525 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
526 | 526 | ||
527 | //上传头像 | 527 | //上传头像 |
528 | 528 | ||
529 | try { | 529 | try { |
530 | HttpManager.getInstance().header(this, userID,typeaccount,file.getPath()); | 530 | HttpManager.getInstance().header(this, userID,typeaccount,file.getPath()); |
531 | } catch (UnsupportedEncodingException e) { | 531 | } catch (UnsupportedEncodingException e) { |
532 | e.printStackTrace(); | 532 | e.printStackTrace(); |
533 | } | 533 | } |
534 | 534 | ||
535 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 535 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
536 | //Fresco设置圆形头像 | 536 | //Fresco设置圆形头像 |
537 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 537 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
538 | GenericDraweeHierarchy hierarchy = builder | 538 | GenericDraweeHierarchy hierarchy = builder |
539 | .setDesiredAspectRatio(1f) | 539 | .setDesiredAspectRatio(1f) |
540 | .setFailureImage(R.mipmap.blank) | 540 | .setFailureImage(R.mipmap.blank) |
541 | //圆形头像 | 541 | //圆形头像 |
542 | .setRoundingParams(RoundingParams.asCircle()) | 542 | .setRoundingParams(RoundingParams.asCircle()) |
543 | .build(); | 543 | .build(); |
544 | 544 | ||
545 | //加载本地图片 | 545 | //加载本地图片 |
546 | Uri uri = Uri.fromFile(cover); | 546 | Uri uri = Uri.fromFile(cover); |
547 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 547 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
548 | .setOldController(mSimpleDraweeView.getController()) | 548 | .setOldController(mSimpleDraweeView.getController()) |
549 | .setUri(uri) | 549 | .setUri(uri) |
550 | .build(); | 550 | .build(); |
551 | mSimpleDraweeView.setHierarchy(hierarchy); | 551 | mSimpleDraweeView.setHierarchy(hierarchy); |
552 | mSimpleDraweeView.setController(controller); | 552 | mSimpleDraweeView.setController(controller); |
553 | 553 | ||
554 | } | 554 | } |
555 | 555 | ||
556 | public void startPhotoZoom(Uri uri) { | 556 | public void startPhotoZoom(Uri uri) { |
557 | Intent intent = new Intent("com.android.camera.action.CROP"); | 557 | Intent intent = new Intent("com.android.camera.action.CROP"); |
558 | intent.setDataAndType(uri, "image/*"); | 558 | intent.setDataAndType(uri, "image/*"); |
559 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 559 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
560 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 560 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
561 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 561 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
562 | intent.putExtra("aspectY", 1);// x:y=1:1 | 562 | intent.putExtra("aspectY", 1);// x:y=1:1 |
563 | // intent.putExtra("outputX", 400);//图片输出大小 | 563 | // intent.putExtra("outputX", 400);//图片输出大小 |
564 | // intent.putExtra("outputY", 400); | 564 | // intent.putExtra("outputY", 400); |
565 | intent.putExtra("output", Uri.fromFile(file)); | 565 | intent.putExtra("output", Uri.fromFile(file)); |
566 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 566 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
567 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 567 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
568 | } | 568 | } |
569 | 569 | ||
570 | @Override | 570 | @Override |
571 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 571 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
572 | switch (requestCode) { | 572 | switch (requestCode) { |
573 | 573 | ||
574 | case PermissionUtil.REQUEST_SHOWCAMERA: | 574 | case PermissionUtil.REQUEST_SHOWCAMERA: |
575 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 575 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
576 | // Permission Granted | 576 | // Permission Granted |
577 | uploadAvatarFromPhotoRequest(); | 577 | uploadAvatarFromPhotoRequest(); |
578 | 578 | ||
579 | } else { | 579 | } else { |
580 | if (!SharedPreferenceMark.getHasShowCamera()) { | 580 | if (!SharedPreferenceMark.getHasShowCamera()) { |
581 | SharedPreferenceMark.setHasShowCamera(true); | 581 | SharedPreferenceMark.setHasShowCamera(true); |
582 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 582 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
583 | 583 | ||
584 | } else { | 584 | } else { |
585 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 585 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
586 | .show(); | 586 | .show(); |
587 | } | 587 | } |
588 | } | 588 | } |
589 | break; | 589 | break; |
590 | default: | 590 | default: |
591 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 591 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
592 | } | 592 | } |
593 | } | 593 | } |
594 | private long exitTime = 0; | 594 | private long exitTime = 0; |
595 | @Override | 595 | @Override |
596 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 596 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
597 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 597 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
598 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 598 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
599 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 599 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
600 | Toast.LENGTH_SHORT).show(); | 600 | Toast.LENGTH_SHORT).show(); |
601 | exitTime = System.currentTimeMillis(); | 601 | exitTime = System.currentTimeMillis(); |
602 | } else { | 602 | } else { |
603 | SysApplication.getInstance().exit(); | 603 | SysApplication.getInstance().exit(); |
604 | } | 604 | } |
605 | return false; | 605 | return false; |
606 | } | 606 | } |
607 | return super.onKeyDown(keyCode, event); | 607 | return super.onKeyDown(keyCode, event); |
608 | } | 608 | } |
609 | } | 609 | } |
610 | 610 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
1 | package com.hjx.personalcenter.db; | 1 | package com.hjx.personalcenter.db; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.content.SharedPreferences; | 5 | import android.content.SharedPreferences; |
6 | 6 | ||
7 | public class SaveParam { | 7 | public class SaveParam { |
8 | 8 | ||
9 | private static SaveParam instance; | 9 | private static SaveParam instance; |
10 | public static SaveParam getInstance(){ | 10 | public static SaveParam getInstance(){ |
11 | if (instance==null){ | 11 | if (instance==null){ |
12 | instance = new SaveParam(); | 12 | instance = new SaveParam(); |
13 | } | 13 | } |
14 | return instance; | 14 | return instance; |
15 | } | 15 | } |
16 | public static String CHILDSID = "childID";//子账号id | 16 | public static String CHILDSID = "childID";//子账号id |
17 | public static String CHILDSGRADENS = "childs";//子账号年级id | 17 | public static String CHILDSGRADENS = "childs";//子账号年级id |
18 | public static String GRADENS = "gradens";//年级id | 18 | public static String GRADENS = "gradens";//年级id |
19 | public static String SCHOOOlID = "schoolid";//学校id | 19 | public static String SCHOOOlID = "schoolid";//学校id |
20 | //个人信息 | 20 | //个人信息 |
21 | public static String USERNAME = "usernames";//昵称 | 21 | public static String USERNAME = "usernames";//昵称 |
22 | public static String ADRESS = "adress";//地址 | 22 | public static String ADRESS = "adress";//地址 |
23 | public static String GRADES = "gadens";//年级 | 23 | public static String GRADES = "gadens";//年级 |
24 | public static String SCHOOL = "school";//学校 | 24 | public static String SCHOOL = "school";//学校 |
25 | public static String CONSTELLATION = "constellations";//星座 | 25 | public static String CONSTELLATION = "constellations";//星座 |
26 | public static String HEADURL = "headurl";//星座 | 26 | public static String HEADURL = "headurl";//星座 |
27 | 27 | ||
28 | //电子保卡信息 | 28 | //电子保卡信息 |
29 | public static String CARDPHONE = "cardphone";//保卡手机号 | 29 | public static String CARDPHONE = "cardphone";//保卡手机号 |
30 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 | 30 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 |
31 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 | 31 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 |
32 | public static String SHOPTIME = "shoptime";//购买时间 | 32 | public static String SHOPTIME = "shoptime";//购买时间 |
33 | public static String SHOPADRESS = "shopadress";//购买地址 | 33 | public static String SHOPADRESS = "shopadress";//购买地址 |
34 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 | 34 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 |
35 | 35 | ||
36 | //省市区参数、 | 36 | //省市区参数、 |
37 | public static String PROVINCES = "provinces";//省 | 37 | public static String PROVINCES = "provinces";//省 |
38 | public static String CITYS = "citys";//市 | 38 | public static String CITYS = "citys";//市 |
39 | public static String COUNTRY = "country";//区 | 39 | public static String COUNTRY = "country";//区 |
40 | 40 | ||
41 | //账户管理 | 41 | //账户管理 |
42 | public static String ACCOUNT = "account";//账户类型 | 42 | public static String ACCOUNT = "account";//账户类型 |
43 | //科目信息 | 43 | //科目信息 |
44 | public static String SUBJECT = "subject"; | 44 | public static String SUBJECT = "subject"; |
45 | //科目出版社 | 45 | //科目出版社 |
46 | public static String CHINESE = "chinese"; | ||
47 | public static String MATH = "math"; | ||
48 | public static String ENGLISH = "english"; | ||
49 | public static String PHYSICS = "physics"; | ||
50 | public static String CHEMISTRY = "chemistry"; | ||
51 | public static String HISTORY = "history"; | ||
52 | public static String GEOGRAPHY = "geography"; | ||
53 | public static String POLITICAL = "political"; | ||
54 | public static String BIOLOGY = "biology"; | ||
55 | public static String SCIENCE = "science"; | ||
56 | //图片URL | 46 | //图片URL |
57 | public static String IMGURL = "imgurl"; | 47 | public static String IMGURL = "imgurl"; |
58 | //版本名称 | 48 | //版本名称 |
59 | public static String VERSION = "version"; | 49 | public static String VERSION = "version"; |
60 | 50 | ||
61 | 51 | ||
62 | public void saveLoginParam(Context context,String spname, String spstr) { | 52 | public void saveLoginParam(Context context,String spname, String spstr) { |
63 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 53 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
64 | Activity.MODE_PRIVATE); | 54 | Activity.MODE_PRIVATE); |
65 | 55 | ||
66 | sp.edit().putString(spname, spstr).commit(); | 56 | sp.edit().putString(spname, spstr).commit(); |
67 | } | 57 | } |
68 | 58 | ||
69 | 59 | ||
70 | public String getLoginParam(Context context,String spname) { | 60 | public String getLoginParam(Context context,String spname) { |
71 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 61 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
72 | Activity.MODE_PRIVATE); | 62 | Activity.MODE_PRIVATE); |
73 | String param = sp.getString(spname, null); | 63 | String param = sp.getString(spname, null); |
74 | return param; | 64 | return param; |
75 | } | 65 | } |
76 | public void clearData(Context context) { | 66 | public void clearData(Context context) { |
77 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 67 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
78 | Activity.MODE_PRIVATE); | 68 | Activity.MODE_PRIVATE); |
79 | sp.edit().clear().commit(); | 69 | sp.edit().clear().commit(); |
80 | } | 70 | } |
81 | 71 | ||
82 | public void saveCustomizeParam(Context context,String spname, String spstr) { | 72 | public void saveCustomizeParam(Context context,String spname, String spstr) { |
83 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 73 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
84 | Activity.MODE_PRIVATE); | 74 | Activity.MODE_PRIVATE); |
85 | 75 | ||
86 | sp.edit().putString(spname, spstr).commit(); | 76 | sp.edit().putString(spname, spstr).commit(); |
87 | 77 | ||
88 | } | 78 | } |
89 | 79 | ||
90 | public String getCustomizeParam(Context context,String spname) { | 80 | public String getCustomizeParam(Context context,String spname) { |
91 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 81 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
92 | Activity.MODE_PRIVATE); | 82 | Activity.MODE_PRIVATE); |
93 | String param = sp.getString(spname, null); | 83 | String param = sp.getString(spname, null); |
94 | return param; | 84 | return param; |
95 | } | 85 | } |
96 | 86 | ||
97 | public void clearCustomizeParam(Context context ){ | 87 | public void clearCustomizeParam(Context context ){ |
98 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 88 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
99 | Activity.MODE_PRIVATE); | 89 | Activity.MODE_PRIVATE); |
100 | sp.edit().clear().commit(); | 90 | sp.edit().clear().commit(); |
101 | } | 91 | } |
102 | } | 92 | } |
103 | 93 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
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.util.Log; | 9 | import android.util.Log; |
10 | import android.view.Gravity; | 10 | import android.view.Gravity; |
11 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
12 | import android.view.View; | 12 | import android.view.View; |
13 | import android.view.ViewGroup; | 13 | import android.view.ViewGroup; |
14 | import android.widget.AdapterView; | 14 | import android.widget.AdapterView; |
15 | import android.widget.EditText; | 15 | import android.widget.EditText; |
16 | import android.widget.ImageView; | 16 | import android.widget.ImageView; |
17 | import android.widget.TextView; | 17 | import android.widget.TextView; |
18 | 18 | ||
19 | import com.bigkoo.pickerview.TimePickerView; | 19 | import com.bigkoo.pickerview.TimePickerView; |
20 | import com.hjx.personalcenter.R; | 20 | import com.hjx.personalcenter.R; |
21 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 21 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
22 | import com.hjx.personalcenter.customdialog.CountryDialog; | 22 | import com.hjx.personalcenter.customdialog.CountryDialog; |
23 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 23 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
24 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 24 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
25 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 25 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
26 | import com.hjx.personalcenter.db.SaveParam; | 26 | import com.hjx.personalcenter.db.SaveParam; |
27 | import com.hjx.personalcenter.http.HttpManager; | 27 | import com.hjx.personalcenter.http.HttpManager; |
28 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 28 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
29 | import com.hjx.personalcenter.model.CityInfo; | 29 | import com.hjx.personalcenter.model.CityInfo; |
30 | import com.hjx.personalcenter.model.CountyInfo; | 30 | import com.hjx.personalcenter.model.CountyInfo; |
31 | import com.hjx.personalcenter.model.GradeInfo; | 31 | import com.hjx.personalcenter.model.GradeInfo; |
32 | import com.hjx.personalcenter.model.ProvinceInfo; | 32 | import com.hjx.personalcenter.model.ProvinceInfo; |
33 | import com.hjx.personalcenter.model.SchoolInfo; | 33 | import com.hjx.personalcenter.model.SchoolInfo; |
34 | import com.hjx.personalcenter.util.AlertUtils; | 34 | import com.hjx.personalcenter.util.AlertUtils; |
35 | import com.hjx.personalcenter.util.BrithdayStar; | 35 | import com.hjx.personalcenter.util.BrithdayStar; |
36 | import com.hjx.personalcenter.util.GetDevicesUtil; | 36 | import com.hjx.personalcenter.util.GetDevicesUtil; |
37 | import com.mylhyl.circledialog.CircleDialog; | 37 | import com.mylhyl.circledialog.CircleDialog; |
38 | import com.mylhyl.circledialog.callback.ConfigDialog; | 38 | import com.mylhyl.circledialog.callback.ConfigDialog; |
39 | import com.mylhyl.circledialog.params.DialogParams; | 39 | import com.mylhyl.circledialog.params.DialogParams; |
40 | 40 | ||
41 | import org.apache.http.util.TextUtils; | 41 | import org.apache.http.util.TextUtils; |
42 | 42 | ||
43 | import java.text.SimpleDateFormat; | 43 | import java.text.SimpleDateFormat; |
44 | import java.util.ArrayList; | 44 | import java.util.ArrayList; |
45 | import java.util.Date; | 45 | import java.util.Date; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Created by h on 2017/8/12. | 48 | * Created by h on 2017/8/12. |
49 | */ | 49 | */ |
50 | 50 | ||
51 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 51 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
52 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 52 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
53 | private View mView; | 53 | private View mView; |
54 | private int type; | 54 | private int type; |
55 | private TimePickerView pvTime; | 55 | private TimePickerView pvTime; |
56 | |||
56 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; | 57 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
57 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; | 58 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender, sub; |
58 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; | 59 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; |
59 | private ImageView my_adress,my_sex,my_bthday,my_grade,my_school; | 60 | private ImageView my_adress, my_sex, my_bthday, my_grade, my_school, ccancel; |
61 | |||
60 | 62 | ||
61 | public static PresonInfoFragment newInstance(int type) { | 63 | public static PresonInfoFragment newInstance(int type) { |
62 | PresonInfoFragment fragment = new PresonInfoFragment(); | 64 | PresonInfoFragment fragment = new PresonInfoFragment(); |
63 | Bundle bundle = new Bundle(); | 65 | Bundle bundle = new Bundle(); |
64 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 66 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
65 | fragment.setArguments(bundle); | 67 | fragment.setArguments(bundle); |
66 | return fragment; | 68 | return fragment; |
67 | 69 | ||
68 | } | 70 | } |
69 | 71 | ||
70 | @Override | 72 | @Override |
71 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 73 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
72 | if (mView == null) { | 74 | if (mView == null) { |
73 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 75 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
74 | initView(mView); | 76 | initView(mView); |
75 | initData(); | 77 | initData(); |
76 | setLister(); | 78 | setLister(); |
77 | initTimePicker(); | 79 | initTimePicker(); |
78 | 80 | ||
79 | 81 | ||
80 | } | 82 | } |
81 | return mView; | 83 | return mView; |
82 | } | 84 | } |
83 | 85 | ||
84 | //初始化 | 86 | //初始化 |
85 | private void initView(View mView) { | 87 | private void initView(View mView) { |
86 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 88 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
87 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 89 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
88 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 90 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
89 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 91 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
90 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 92 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
91 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 93 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
92 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 94 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
93 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 95 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
94 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); | 96 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); |
95 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); | 97 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); |
96 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); | 98 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); |
97 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); | 99 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); |
98 | my_school = (ImageView) mView.findViewById(R.id.my_school); | 100 | my_school = (ImageView) mView.findViewById(R.id.my_school); |
101 | sub = (TextView) mView.findViewById(R.id.presonal_sub); | ||
102 | ccancel = (ImageView) mView.findViewById(R.id.cancel); | ||
99 | 103 | ||
100 | 104 | ||
101 | } | 105 | } |
102 | 106 | ||
103 | private void initData() { | 107 | private void initData() { |
108 | |||
104 | } | 109 | } |
105 | 110 | ||
106 | private void setLister() { | 111 | private void setLister() { |
107 | tv_sex.setOnClickListener(this); | 112 | tv_sex.setOnClickListener(this); |
108 | tv_useinfo_adress.setOnClickListener(this); | 113 | tv_useinfo_adress.setOnClickListener(this); |
109 | tv_useinfo_birthday.setOnClickListener(this); | 114 | tv_useinfo_birthday.setOnClickListener(this); |
110 | tv_useinfo_school.setOnClickListener(this); | 115 | tv_useinfo_school.setOnClickListener(this); |
111 | tv_useinfo_gender.setOnClickListener(this); | 116 | tv_useinfo_gender.setOnClickListener(this); |
112 | my_adress.setOnClickListener(this); | 117 | my_adress.setOnClickListener(this); |
113 | my_sex.setOnClickListener(this); | 118 | my_sex.setOnClickListener(this); |
114 | my_bthday.setOnClickListener(this); | 119 | my_bthday.setOnClickListener(this); |
115 | my_grade.setOnClickListener(this); | 120 | my_grade.setOnClickListener(this); |
116 | my_school.setOnClickListener(this); | 121 | my_school.setOnClickListener(this); |
122 | sub.setOnClickListener(this); | ||
117 | } | 123 | } |
118 | 124 | ||
119 | @Override | 125 | @Override |
120 | public void onClick(View v) { | 126 | public void onClick(View v) { |
121 | String presonal1 = tv_username1.getText().toString().trim(); | 127 | String presonal1 = tv_username1.getText().toString().trim(); |
122 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | 128 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); |
123 | String presonal3 = tv_sex.getText().toString().trim(); | 129 | String presonal3 = tv_sex.getText().toString().trim(); |
124 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | 130 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); |
125 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | 131 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); |
126 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | 132 | String presonal6 = tv_useinfo_school.getText().toString().trim(); |
127 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | 133 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); |
128 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | 134 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); |
129 | switch (v.getId()) { | 135 | switch (v.getId()) { |
130 | case R.id.tv_sex: | 136 | case R.id.tv_sex: |
131 | case R.id.my_sex: | 137 | case R.id.my_sex: |
132 | final String[] items = {"男", "女"}; | 138 | final String[] items = {"男", "女"}; |
133 | new CircleDialog.Builder(getActivity()) | 139 | new CircleDialog.Builder(getActivity()) |
134 | .configDialog(new ConfigDialog() { | 140 | .configDialog(new ConfigDialog() { |
135 | @Override | 141 | @Override |
136 | public void onConfig(DialogParams params) { | 142 | public void onConfig(DialogParams params) { |
137 | //增加弹出动画 | 143 | //增加弹出动画 |
138 | params.gravity = Gravity.CENTER; | 144 | params.gravity = Gravity.CENTER; |
139 | } | 145 | } |
140 | }) | 146 | }) |
141 | .setTitle("请选择性别") | 147 | .setTitle("请选择性别") |
142 | .setWidth(0.5f) | 148 | .setWidth(0.5f) |
143 | .setItems(items, new AdapterView.OnItemClickListener() { | 149 | .setItems(items, new AdapterView.OnItemClickListener() { |
144 | @Override | 150 | @Override |
145 | public void onItemClick(AdapterView<?> parent, View view, int | 151 | public void onItemClick(AdapterView<?> parent, View view, int |
146 | position, long id) { | 152 | position, long id) { |
147 | switch (position) { | 153 | switch (position) { |
148 | case 0: | 154 | case 0: |
149 | tv_sex.setText("男"); | 155 | tv_sex.setText("男"); |
150 | break; | 156 | break; |
151 | case 1: | 157 | case 1: |
152 | tv_sex.setText("女"); | 158 | tv_sex.setText("女"); |
153 | break; | 159 | break; |
154 | } | 160 | } |
155 | 161 | ||
156 | } | 162 | } |
157 | }) | 163 | }) |
158 | .show(); | 164 | .show(); |
159 | break; | 165 | break; |
160 | case R.id.tv_useinfo_adress: | 166 | case R.id.tv_useinfo_adress: |
161 | case R.id.my_adress: | 167 | case R.id.my_adress: |
162 | tv_useinfo_school.setText(""); | 168 | tv_useinfo_school.setText(""); |
163 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); | 169 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
164 | break; | 170 | break; |
165 | case R.id.tv_useinfo_birthday: | 171 | case R.id.tv_useinfo_birthday: |
166 | case R.id.my_bthday: | 172 | case R.id.my_bthday: |
167 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 173 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
168 | break; | 174 | break; |
169 | case R.id.tv_useinfo_school: | 175 | case R.id.tv_useinfo_school: |
170 | case R.id.my_school: | 176 | case R.id.my_school: |
171 | if (TextUtils.isEmpty(presonal4) || | 177 | if (TextUtils.isEmpty(presonal4) || |
172 | TextUtils.isEmpty(presonal7)) { | 178 | TextUtils.isEmpty(presonal7)) { |
173 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | 179 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); |
174 | return; | 180 | return; |
175 | } else { | 181 | } else { |
176 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | 182 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); |
177 | } | 183 | } |
178 | 184 | ||
179 | 185 | ||
180 | break; | 186 | break; |
181 | case R.id.tv_useinfo_gender: | 187 | case R.id.tv_useinfo_gender: |
182 | case R.id.my_grade: | 188 | case R.id.my_grade: |
183 | tv_useinfo_school.setText(""); | 189 | tv_useinfo_school.setText(""); |
184 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); | 190 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
185 | break; | 191 | break; |
192 | case R.id.cancel: | ||
193 | getActivity().finish(); | ||
194 | break; | ||
186 | case R.id.presonal_sub: | 195 | case R.id.presonal_sub: |
187 | Log.e("test","你提交个人信息"); | 196 | Log.e("test", "你提交个人信息"); |
188 | if (TextUtils.isEmpty(presonal1) || | 197 | if (TextUtils.isEmpty(presonal1) || |
189 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || | 198 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || |
190 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || | 199 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || |
191 | TextUtils.isEmpty(presonal8)) { | 200 | TextUtils.isEmpty(presonal8)) { |
192 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); | 201 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
193 | return; | 202 | return; |
194 | } else { | 203 | } else { |
195 | 204 | ||
196 | int a = 0, b = 0; | 205 | int a = 0, b = 0; |
197 | int d = 1; | 206 | int d = 1; |
198 | Object schoolids; | 207 | Object schoolids; |
199 | Long f = null; | 208 | Long f = null; |
200 | //保存星座 | 209 | //保存星座 |
201 | BrithdayStar brithdayStar = new BrithdayStar(); | 210 | BrithdayStar brithdayStar = new BrithdayStar(); |
202 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | 211 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); |
203 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); | 212 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); |
204 | 213 | ||
205 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); | 214 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); |
206 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 215 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
207 | if (regionId == null) { | 216 | if (regionId == null) { |
208 | regionId = regionId1; | 217 | regionId = regionId1; |
209 | } | 218 | } |
210 | String grade = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); | 219 | String grade = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); |
211 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | 220 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); |
212 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 221 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
213 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 222 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
214 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | 223 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); |
215 | String changeinfo = null; | 224 | String changeinfo = null; |
216 | if ("男".equals(presonal3)) { | 225 | if ("男".equals(presonal3)) { |
217 | changeinfo = "male"; | 226 | changeinfo = "male"; |
227 | } else { | ||
228 | changeinfo = "female"; | ||
229 | } | ||
230 | try { | ||
231 | a = Integer.parseInt(regionId); | ||
232 | b = Integer.parseInt(grade); | ||
233 | if (TextUtils.isEmpty(presonal6)) { | ||
234 | schoolids = null; | ||
218 | } else { | 235 | } else { |
219 | changeinfo = "female"; | 236 | schoolids = Long.parseLong(schoolid); |
220 | } | ||
221 | try { | ||
222 | a = Integer.parseInt(regionId); | ||
223 | b = Integer.parseInt(grade); | ||
224 | if (TextUtils.isEmpty(presonal6)) { | ||
225 | schoolids = null; | ||
226 | } else { | ||
227 | schoolids = Long.parseLong(schoolid); | ||
228 | } | ||
229 | d = Integer.parseInt(type); | ||
230 | f = Long.parseLong(userID); | ||
231 | //提交个人信息 | ||
232 | HttpManager.getInstance().changepresonalinfo(getActivity(), | ||
233 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 + presonal2, devicenumber); | ||
234 | |||
235 | } catch (Exception e) { | ||
236 | e.printStackTrace(); | ||
237 | } | 237 | } |
238 | d = Integer.parseInt(type); | ||
239 | f = Long.parseLong(userID); | ||
240 | //提交个人信息 | ||
241 | HttpManager.getInstance().changepresonalinfo(getActivity(), | ||
242 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 + presonal2, devicenumber); | ||
243 | |||
244 | } catch (Exception e) { | ||
245 | e.printStackTrace(); | ||
246 | } | ||
238 | 247 | ||
239 | break; | 248 | break; |
249 | |||
240 | } | 250 | } |
241 | } | 251 | } |
242 | } | 252 | } |
243 | 253 | ||
244 | //自定义时间选择器 | 254 | //自定义时间选择器 |
245 | private void initTimePicker() { | 255 | private void initTimePicker() { |
246 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 256 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
247 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 257 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
248 | // Calendar selectedDate = Calendar.getInstance(); | 258 | // Calendar selectedDate = Calendar.getInstance(); |
249 | // Calendar startDate = Calendar.getInstance(); | 259 | // Calendar startDate = Calendar.getInstance(); |
250 | // startDate.set(1900, 1, 1); | 260 | // startDate.set(1900, 1, 1); |
251 | // Calendar endDate = Calendar.getInstance(); | 261 | // Calendar endDate = Calendar.getInstance(); |
252 | // endDate.set(2100, 1, 1); | 262 | // endDate.set(2100, 1, 1); |
253 | //时间选择器 | 263 | //时间选择器 |
254 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 264 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
255 | @Override | 265 | @Override |
256 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 266 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
257 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 267 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
258 | /*btn_Time.setText(getTime(date));*/ | 268 | /*btn_Time.setText(getTime(date));*/ |
259 | TextView btn = (TextView) v; | 269 | TextView btn = (TextView) v; |
260 | btn.setText(getTime(date)); | 270 | btn.setText(getTime(date)); |
261 | } | 271 | } |
262 | }) | 272 | }) |
263 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 273 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
264 | .setType(new boolean[]{true, true, true, false, false, false}) | 274 | .setType(new boolean[]{true, true, true, false, false, false}) |
265 | .setLabel("", "", "", "", "", "") | 275 | .setLabel("", "", "", "", "", "") |
266 | .isCenterLabel(false) | 276 | .isCenterLabel(false) |
267 | .setDividerColor(Color.DKGRAY) | 277 | .setDividerColor(Color.DKGRAY) |
268 | .setContentSize(21) | 278 | .setContentSize(21) |
269 | // .setDate(selectedDate) | 279 | // .setDate(selectedDate) |
270 | // .setRangDate(startDate, endDate) | 280 | // .setRangDate(startDate, endDate) |
271 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 281 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
272 | .setDecorView(null) | 282 | .setDecorView(null) |
273 | .setTitleText("出生日期") | 283 | .setTitleText("出生日期") |
274 | .setTitleSize(22) | 284 | .setTitleSize(22) |
275 | .setCancelColor(Color.GRAY) | 285 | .setCancelColor(Color.GRAY) |
276 | .setSubCalSize(22) | 286 | .setSubCalSize(22) |
277 | .setDividerColor(Color.GRAY) | 287 | .setDividerColor(Color.GRAY) |
278 | .setSubmitColor(Color.GRAY) | 288 | .setSubmitColor(Color.GRAY) |
279 | .build(); | 289 | .build(); |
280 | } | 290 | } |
281 | 291 | ||
282 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 292 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
283 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 293 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
284 | return format.format(date); | 294 | return format.format(date); |
285 | } | 295 | } |
286 | // | ||
287 | @Override | ||
288 | public void onAttach(Context context) { | ||
289 | super.onAttach(context); | ||
290 | View rootView = ((Activity)context).getWindow().getDecorView(); | ||
291 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | ||
292 | sub.setOnClickListener(this); | ||
293 | } | ||
294 | 296 | ||
295 | @Override | 297 | @Override |
296 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 298 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
297 | String regionName = data.get(position).getRegionName(); | 299 | String regionName = data.get(position).getRegionName(); |
298 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 300 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
299 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | 301 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); |
300 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | 302 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); |
301 | tv_useinfo_adress.setText(""); | 303 | tv_useinfo_adress.setText(""); |
302 | tv_useinfo_adress.setText(provice + regionName); | 304 | tv_useinfo_adress.setText(provice + regionName); |
303 | 305 | ||
304 | 306 | ||
305 | } | 307 | } |
306 | 308 | ||
307 | @Override | 309 | @Override |
308 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 310 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
309 | String regionName = data.get(position).getRegionName(); | 311 | String regionName = data.get(position).getRegionName(); |
310 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 312 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
311 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); | 313 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); |
312 | tv_useinfo_adress.setText(""); | 314 | tv_useinfo_adress.setText(""); |
313 | tv_useinfo_adress.setText(provices + citys + regionName); | 315 | tv_useinfo_adress.setText(provices + citys + regionName); |
314 | 316 | ||
315 | } | 317 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/VersionsInfoFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.app.Activity; | ||
4 | import android.content.Context; | ||
5 | import android.os.Bundle; | 3 | import android.os.Bundle; |
6 | import android.os.Handler; | 4 | import android.os.Handler; |
7 | import android.os.Message; | 5 | import android.os.Message; |
8 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
9 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
10 | import android.util.Log; | 8 | import android.util.Log; |
11 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
12 | import android.view.View; | 10 | import android.view.View; |
13 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
14 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
15 | import android.widget.GridView; | 13 | import android.widget.GridView; |
14 | import android.widget.ImageView; | ||
16 | import android.widget.TextView; | 15 | import android.widget.TextView; |
17 | 16 | ||
18 | import com.facebook.drawee.view.SimpleDraweeView; | 17 | import com.facebook.drawee.view.SimpleDraweeView; |
19 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
20 | import com.hjx.personalcenter.adapter.GridAdapter; | 19 | import com.hjx.personalcenter.adapter.GridAdapter; |
21 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 20 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
22 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
23 | import com.hjx.personalcenter.http.HttpCode; | 22 | import com.hjx.personalcenter.http.HttpCode; |
24 | import com.hjx.personalcenter.http.HttpManager; | 23 | import com.hjx.personalcenter.http.HttpManager; |
25 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 24 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
26 | import com.hjx.personalcenter.model.DefautPublishInfo; | 25 | import com.hjx.personalcenter.model.DefautPublishInfo; |
27 | import com.hjx.personalcenter.model.VersionInfo; | 26 | import com.hjx.personalcenter.model.VersionInfo; |
28 | 27 | ||
29 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
30 | import java.util.List; | 29 | import java.util.List; |
31 | 30 | ||
32 | /** | 31 | /** |
33 | * Created by h on 2017/8/12. | 32 | * Created by h on 2017/8/12. |
34 | */ | 33 | */ |
35 | 34 | ||
36 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener, DialogCallBack.VersionCallBack { | 35 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener, DialogCallBack.VersionCallBack { |
37 | private GridView gridView; | 36 | private GridView gridView; |
38 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 37 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
39 | private GridAdapter sim_adapter; | 38 | private GridAdapter sim_adapter; |
40 | private View mView; | 39 | private View mView; |
41 | private int type; | 40 | private int type; |
42 | private TextView publish; | 41 | private ImageView cances; |
42 | private TextView publish, sub; | ||
43 | private SimpleDraweeView simpleDraweeView; | 43 | private SimpleDraweeView simpleDraweeView; |
44 | public static String TABLAYOUT_FRAGMENT = "versionfragment"; | 44 | public static String TABLAYOUT_FRAGMENT = "versionfragment"; |
45 | 45 | ||
46 | private String chinese, math,english,physics,chemistry,history,geography,political,biology,science; | ||
46 | public static VersionsInfoFragment newInstance(int type) { | 47 | public static VersionsInfoFragment newInstance(int type) { |
47 | VersionsInfoFragment fragment = new VersionsInfoFragment(); | 48 | VersionsInfoFragment fragment = new VersionsInfoFragment(); |
48 | Bundle bundle = new Bundle(); | 49 | Bundle bundle = new Bundle(); |
49 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 50 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
50 | fragment.setArguments(bundle); | 51 | fragment.setArguments(bundle); |
51 | return fragment; | 52 | return fragment; |
52 | 53 | ||
53 | } | 54 | } |
54 | Handler handler = new Handler(){ | 55 | |
56 | Handler handler = new Handler() { | ||
55 | @Override | 57 | @Override |
56 | public void handleMessage(Message msg) { | 58 | public void handleMessage(Message msg) { |
57 | super.handleMessage(msg); | 59 | super.handleMessage(msg); |
58 | switch (msg.what){ | 60 | switch (msg.what) { |
59 | case HttpCode.PUBLISH_SUCESS: | 61 | case HttpCode.PUBLISH_SUCESS: |
60 | defautPublishInfos.clear(); | 62 | defautPublishInfos.clear(); |
61 | defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); | 63 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
62 | sim_adapter.notifyDataSetChanged(); | 64 | sim_adapter.notifyDataSetChanged(); |
65 | for (int i = 0; i < defautPublishInfos.size(); i++) { | ||
66 | String subject = defautPublishInfos.get(i).getSubject(); | ||
67 | if (subject.equals("语文")) { | ||
68 | chinese = defautPublishInfos.get(i).getPress(); | ||
69 | } else if (subject.equals("数学")) { | ||
70 | math = defautPublishInfos.get(i).getPress(); | ||
71 | } else if (subject.equals("英语")) { | ||
72 | english = defautPublishInfos.get(i).getPress(); | ||
73 | } else if (subject.equals("物理")) { | ||
74 | physics = defautPublishInfos.get(i).getPress(); | ||
75 | } else if (subject.equals("化学")) { | ||
76 | chemistry = defautPublishInfos.get(i).getPress(); | ||
77 | } else if (subject.equals("历史")) { | ||
78 | history = defautPublishInfos.get(i).getPress(); | ||
79 | } else if (subject.equals("地理")) { | ||
80 | geography = defautPublishInfos.get(i).getPress(); | ||
81 | } else if (subject.equals("政治")) { | ||
82 | political = defautPublishInfos.get(i).getPress(); | ||
83 | }else if (subject.equals("生物")) { | ||
84 | biology = defautPublishInfos.get(i).getPress(); | ||
85 | }else if (subject.equals("科学")) { | ||
86 | science = defautPublishInfos.get(i).getPress(); | ||
87 | } | ||
88 | } | ||
63 | break; | 89 | break; |
64 | } | 90 | } |
65 | } | 91 | } |
66 | }; | 92 | }; |
93 | |||
67 | @Override | 94 | @Override |
68 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 95 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
69 | if (mView == null) { | 96 | if (mView == null) { |
70 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); | 97 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); |
71 | String userID = SaveParam.getInstance().getLoginParam(getActivity(),"userId"); | 98 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
72 | String graderid = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.GRADENS); | 99 | String graderid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); |
73 | //子账户年级id | 100 | //子账户年级id |
74 | String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSGRADENS); | 101 | String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); |
75 | //账户类型 | 102 | //账户类型 |
76 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.ACCOUNT); | 103 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
77 | try { | 104 | try { |
78 | int graderID; | 105 | int graderID; |
79 | long auserID = Long.parseLong(userID); | 106 | long auserID = Long.parseLong(userID); |
80 | if ("2".equals(accounts)){ | 107 | if ("2".equals(accounts)) { |
81 | graderID = Integer.parseInt(graderidchilds); | 108 | graderID = Integer.parseInt(graderidchilds); |
82 | }else { | 109 | } else { |
83 | graderID = Integer.parseInt(graderid); | 110 | graderID = Integer.parseInt(graderid); |
84 | } | 111 | } |
85 | 112 | ||
86 | //获取版本信息 | 113 | //获取版本信息 |
87 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderID,handler); | 114 | HttpManager.getInstance().getpublishinfo(getActivity(), auserID, graderID, handler); |
88 | 115 | ||
89 | } catch (NumberFormatException e) { | 116 | } catch (NumberFormatException e) { |
90 | e.printStackTrace(); | 117 | e.printStackTrace(); |
91 | } | 118 | } |
92 | 119 | ||
93 | initView(mView); | 120 | initView(mView); |
94 | initData(); | 121 | initData(); |
95 | setLister(); | 122 | setLister(); |
96 | 123 | ||
97 | 124 | ||
98 | } | 125 | } |
99 | return mView; | 126 | return mView; |
100 | } | 127 | } |
128 | |||
101 | //初始化 | 129 | //初始化 |
102 | private void initView(View mView) { | 130 | private void initView(View mView) { |
103 | gridView =(GridView) mView.findViewById(R.id.grideview); | 131 | gridView = (GridView) mView.findViewById(R.id.grideview); |
132 | cances = (ImageView) mView.findViewById(R.id.cancel); | ||
133 | sub = (TextView) mView.findViewById(R.id.version_sub); | ||
104 | 134 | ||
105 | } | 135 | } |
136 | |||
106 | private void initData() { | 137 | private void initData() { |
107 | sim_adapter = new GridAdapter(defautPublishInfos,getActivity()); | 138 | sim_adapter = new GridAdapter(defautPublishInfos, getActivity()); |
108 | //配置适配器 | 139 | //配置适配器 |
109 | gridView.setAdapter(sim_adapter); | 140 | gridView.setAdapter(sim_adapter); |
110 | } | 141 | } |
111 | 142 | ||
112 | private void setLister() { | 143 | private void setLister() { |
113 | gridView.setOnItemClickListener(this); | 144 | gridView.setOnItemClickListener(this); |
145 | sub.setOnClickListener(this); | ||
114 | } | 146 | } |
115 | 147 | ||
116 | @Override | 148 | @Override |
117 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 149 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
118 | SaveParam.getInstance().saveLoginParam(getActivity(),SaveParam.SUBJECT,defautPublishInfos.get(position).getSubject()); | 150 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); |
119 | VerSionDialog.getInstance(this).show(getChildFragmentManager(), "VerSionDialog"); | 151 | VerSionDialog.getInstance(this).show(getChildFragmentManager(), "VerSionDialog"); |
120 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | 152 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); |
121 | publish = (TextView) view.findViewById(R.id.tv_publish); | 153 | publish = (TextView) view.findViewById(R.id.tv_publish); |
122 | 154 | ||
123 | } | 155 | } |
124 | 156 | ||
125 | @Override | ||
126 | public void onAttach(Context context) { | ||
127 | super.onAttach(context); | ||
128 | View rootView = ((Activity)context).getWindow().getDecorView(); | ||
129 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | ||
130 | sub.setOnClickListener(this); | ||
131 | } | ||
132 | |||
133 | |||
134 | 157 | ||
135 | @Override | 158 | @Override |
136 | public void onResume() { | 159 | public void onResume() { |
137 | super.onResume(); | 160 | super.onResume(); |
138 | 161 | ||
139 | } | 162 | } |
140 | 163 | ||
141 | @Override | 164 | @Override |
142 | public void onClick(View v) { | 165 | public void onClick(View v) { |
143 | switch (v.getId()){ | 166 | switch (v.getId()) { |
144 | case R.id.presonal_sub: | 167 | case R.id.version_sub: |
145 | Log.e("test","你提交版本信息"); | 168 | Log.e("test", "你提交版本信息"); |
146 | String userID = SaveParam.getInstance().getLoginParam(getActivity(),"userId"); | 169 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
147 | String chinese = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.CHINESE); | ||
148 | String math = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.MATH); | ||
149 | String english = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ENGLISH); | ||
150 | String physics = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.PHYSICS); | ||
151 | String chemistry = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.CHEMISTRY); | ||
152 | String history = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.HISTORY); | ||
153 | String geography = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.GEOGRAPHY); | ||
154 | String political = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.POLITICAL); | ||
155 | String biology = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.BIOLOGY); | ||
156 | String science = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.SCIENCE); | ||
157 | //子账户id | 170 | //子账户id |
158 | String childsidid = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSID); | 171 | String childsidid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSID); |
159 | //账户类型 | 172 | //账户类型 |
160 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.ACCOUNT); | 173 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
161 | try { | 174 | try { |
162 | String id = null; | 175 | String id = null; |
163 | //String piblish = "清华大学出版社"; | 176 | //String piblish = "清华大学出版社"; |
164 | if ("2".equals(accounts)){ | 177 | if ("2".equals(accounts)) { |
165 | id =childsidid; | 178 | id = childsidid; |
166 | }else { | 179 | } else { |
167 | id = userID; | 180 | id = userID; |
168 | } | 181 | } |
169 | |||
170 | //修改版本信息 | 182 | //修改版本信息 |
171 | HttpManager.getInstance().changepublishinfo(getActivity(),id,"人民教育出版社" | 183 | HttpManager.getInstance().changepublishinfo(getActivity(), id,math,english, chinese,physics,chemistry,history,geography,political,biology,science); |
172 | ,"人民教育出版社","人民教育出版社","人民教育出版社","人民教育出版社","人民教育出版社", | ||
173 | "人民教育出版社","人民教育出版社","人民教育出版社","人民教育出版社"); | ||
174 | 184 | ||
175 | } catch (NumberFormatException e) { | 185 | } catch (NumberFormatException e) { |
176 | e.printStackTrace(); | 186 | e.printStackTrace(); |
177 | } | 187 | } |
178 | 188 | ||
179 | 189 | ||
180 | 190 | break; | |
191 | case R.id.cancel: | ||
192 | getActivity().finish(); | ||
181 | break; | 193 | break; |
182 | } | 194 | } |
183 | 195 | ||
184 | } | 196 | } |
185 | 197 | ||
186 | @Override | 198 | @Override |
187 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | 199 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { |
188 | String imageurl = data.get(position).getPressCover(); | 200 | String imageurl = data.get(position).getPressCover(); |
189 | String publishs = data.get(position).getPressName(); | 201 | String publishs = data.get(position).getPressName(); |
202 | |||
190 | simpleDraweeView.setImageURI(imageurl); | 203 | simpleDraweeView.setImageURI(imageurl); |
191 | publish.setText(publishs); | 204 | publish.setText(publishs); |
192 | String subject = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.SUBJECT); | 205 | String subject = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SUBJECT); |
193 | Log.e("test","选择的科目"+subject); | 206 | Log.e("test", "选择的科目" + subject); |
194 | if ("语文".equals(subject)) { | 207 | if ("语文".equals(subject)) { |
PersonalCenter/app/src/main/res/layout/activity_change_preson_info.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:tools="http://schemas.android.com/tools" | 3 | xmlns:tools="http://schemas.android.com/tools" |
4 | android:id="@android:id/tabhost" | 4 | android:id="@android:id/tabhost" |
5 | android:layout_width="fill_parent" | 5 | android:layout_width="fill_parent" |
6 | android:layout_height="fill_parent" | 6 | android:layout_height="fill_parent" |
7 | android:background="@color/white" | 7 | android:background="@color/white" |
8 | tools:context="com.hjx.personalcenter.activity.LoginAndRegisterActivity"> | 8 | tools:context="com.hjx.personalcenter.activity.LoginAndRegisterActivity"> |
9 | <RelativeLayout | ||
10 | android:id="@+id/title" | ||
11 | android:layout_width="match_parent" | ||
12 | android:layout_height="50dp" | ||
13 | android:background="@color/login_text_blue"> | ||
14 | |||
15 | <ImageView | ||
16 | android:id="@+id/cancel" | ||
17 | android:layout_width="wrap_content" | ||
18 | android:layout_height="match_parent" | ||
19 | android:paddingLeft="20dp" | ||
20 | android:paddingRight="20dp" | ||
21 | android:src="@mipmap/title_back" /> | ||
22 | |||
23 | <TextView | ||
24 | android:id="@+id/menu_title" | ||
25 | android:layout_width="wrap_content" | ||
26 | android:layout_height="match_parent" | ||
27 | android:layout_centerInParent="true" | ||
28 | android:gravity="center_vertical" | ||
29 | android:text="@string/changge_preson" | ||
30 | android:textColor="@android:color/white" | ||
31 | android:textSize="22sp" /> | ||
32 | <TextView | ||
33 | android:id="@+id/presonal_sub" | ||
34 | android:layout_width="wrap_content" | ||
35 | android:layout_height="match_parent" | ||
36 | android:paddingLeft="20dp" | ||
37 | android:paddingRight="20dp" | ||
38 | android:gravity="center_vertical" | ||
39 | android:layout_alignParentRight="true" | ||
40 | android:text="保存" | ||
41 | android:textColor="@android:color/white" | ||
42 | android:textSize="22sp" /> | ||
43 | |||
44 | |||
45 | </RelativeLayout> | ||
46 | 9 | ||
47 | <LinearLayout | 10 | <LinearLayout |
48 | android:layout_width="wrap_content" | 11 | android:layout_width="wrap_content" |
49 | android:layout_height="wrap_content" | 12 | android:layout_height="wrap_content" |
50 | android:layout_marginTop="30dp" | 13 | android:layout_marginTop="30dp" |
51 | android:layout_below="@+id/title" | 14 | android:layout_below="@+id/title" |
52 | android:orientation="vertical"> | 15 | android:orientation="vertical"> |
53 | 16 | ||
54 | <com.hjx.personalcenter.thirdparty.SlidingTabLayout | 17 | <com.hjx.personalcenter.thirdparty.SlidingTabLayout |
55 | android:id="@+id/TabLayout_id" | 18 | android:id="@+id/TabLayout_id" |
56 | android:layout_gravity="center" | 19 | android:layout_gravity="center" |
57 | android:layout_width="wrap_content" | 20 | android:layout_width="wrap_content" |
58 | android:layout_height="50dp"> | 21 | android:layout_height="50dp"> |
59 | </com.hjx.personalcenter.thirdparty.SlidingTabLayout> | 22 | </com.hjx.personalcenter.thirdparty.SlidingTabLayout> |
60 | 23 | ||
61 | <android.support.v4.view.ViewPager | 24 | <android.support.v4.view.ViewPager |
62 | android:id="@+id/viewpager_login" | 25 | android:id="@+id/viewpager_login" |
63 | android:layout_width="match_parent" | 26 | android:layout_width="match_parent" |
64 | android:layout_height="match_parent" | 27 | android:layout_height="match_parent" |
65 | android:background="@color/white" /> | 28 | android:background="@color/white" /> |
66 | </LinearLayout> | 29 | </LinearLayout> |
67 | 30 | ||
68 | </RelativeLayout> | 31 | </RelativeLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_presonal_info.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | <RelativeLayout | ||
8 | android:id="@+id/title" | ||
9 | android:layout_width="match_parent" | ||
10 | android:layout_height="50dp" | ||
11 | android:background="@color/login_text_blue"> | ||
12 | |||
13 | <ImageView | ||
14 | android:id="@+id/cancel" | ||
15 | android:layout_width="wrap_content" | ||
16 | android:layout_height="match_parent" | ||
17 | android:paddingLeft="20dp" | ||
18 | android:paddingRight="20dp" | ||
19 | android:src="@mipmap/title_back" /> | ||
20 | |||
21 | <TextView | ||
22 | android:id="@+id/menu_title" | ||
23 | android:layout_width="wrap_content" | ||
24 | android:layout_height="match_parent" | ||
25 | android:layout_centerInParent="true" | ||
26 | android:gravity="center_vertical" | ||
27 | android:text="@string/changge_preson" | ||
28 | android:textColor="@android:color/white" | ||
29 | android:textSize="22sp" /> | ||
30 | <TextView | ||
31 | android:id="@+id/presonal_sub" | ||
32 | android:layout_width="wrap_content" | ||
33 | android:layout_height="match_parent" | ||
34 | android:paddingLeft="20dp" | ||
35 | android:paddingRight="20dp" | ||
36 | android:gravity="center_vertical" | ||
37 | android:layout_alignParentRight="true" | ||
38 | android:text="保存" | ||
39 | android:textColor="@android:color/white" | ||
40 | android:textSize="22sp" /> | ||
41 | |||
42 | |||
43 | </RelativeLayout> | ||
7 | 44 | ||
8 | 45 | ||
9 | <LinearLayout | 46 | <LinearLayout |
10 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
11 | android:layout_height="wrap_content" | 48 | android:layout_height="wrap_content" |
12 | android:layout_marginTop="80dp" | 49 | android:layout_marginTop="80dp" |
13 | android:orientation="horizontal"> | 50 | android:orientation="horizontal"> |
14 | 51 | ||
15 | <View | 52 | <View |
16 | android:layout_width="450dp" | 53 | android:layout_width="450dp" |
17 | android:layout_height="0.7dp" | 54 | android:layout_height="0.7dp" |
18 | android:layout_marginLeft="150dp" | 55 | android:layout_marginLeft="150dp" |
19 | android:background="@color/cutoff_line"> | 56 | android:background="@color/cutoff_line"> |
20 | 57 | ||
21 | </View> | 58 | </View> |
22 | 59 | ||
23 | <View | 60 | <View |
24 | android:layout_width="450dp" | 61 | android:layout_width="450dp" |
25 | android:layout_height="0.7dp" | 62 | android:layout_height="0.7dp" |
26 | android:layout_marginLeft="80dp" | 63 | android:layout_marginLeft="80dp" |
27 | android:background="@color/cutoff_line"> | 64 | android:background="@color/cutoff_line"> |
28 | 65 | ||
29 | </View> | 66 | </View> |
30 | 67 | ||
31 | 68 | ||
32 | </LinearLayout> | 69 | </LinearLayout> |
33 | 70 | ||
34 | <LinearLayout | 71 | <LinearLayout |
35 | android:layout_width="match_parent" | 72 | android:layout_width="match_parent" |
36 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
37 | android:layout_marginLeft="200dp" | 74 | android:layout_marginLeft="200dp" |
38 | android:gravity="center_vertical" | 75 | android:gravity="center_vertical" |
39 | android:orientation="horizontal"> | 76 | android:orientation="horizontal"> |
40 | 77 | ||
41 | <LinearLayout | 78 | <LinearLayout |
42 | android:layout_width="0dp" | 79 | android:layout_width="0dp" |
43 | android:layout_height="80dp" | 80 | android:layout_height="80dp" |
44 | android:layout_weight="1" | 81 | android:layout_weight="1" |
45 | android:gravity="center_vertical"> | 82 | android:gravity="center_vertical"> |
46 | 83 | ||
47 | <TextView | 84 | <TextView |
48 | android:layout_width="wrap_content" | 85 | android:layout_width="wrap_content" |
49 | android:layout_height="wrap_content" | 86 | android:layout_height="wrap_content" |
50 | android:text="昵称" | 87 | android:text="昵称" |
51 | android:textSize="22sp" /> | 88 | android:textSize="22sp" /> |
52 | 89 | ||
53 | <EditText | 90 | <EditText |
54 | android:id="@+id/tv_username1" | 91 | android:id="@+id/tv_username1" |
55 | android:layout_width="wrap_content" | 92 | android:layout_width="wrap_content" |
56 | android:layout_height="wrap_content" | 93 | android:layout_height="wrap_content" |
57 | android:layout_marginLeft="50dp" | 94 | android:layout_marginLeft="50dp" |
58 | android:textColor="@color/electronic_text" | 95 | android:textColor="@color/electronic_text" |
59 | android:background="@null" | 96 | android:background="@null" |
60 | android:hint="请输入12个以内的中文或英文字符" | 97 | android:hint="请输入12个以内的中文或英文字符" |
61 | android:textSize="22sp" /> | 98 | android:textSize="22sp" /> |
62 | 99 | ||
63 | </LinearLayout> | 100 | </LinearLayout> |
64 | 101 | ||
65 | <LinearLayout | 102 | <LinearLayout |
66 | android:layout_width="0dp" | 103 | android:layout_width="0dp" |
67 | android:layout_height="80dp" | 104 | android:layout_height="80dp" |
68 | android:layout_weight="1" | 105 | android:layout_weight="1" |
69 | android:gravity="center_vertical"> | 106 | android:gravity="center_vertical"> |
70 | 107 | ||
71 | <TextView | 108 | <TextView |
72 | android:layout_width="wrap_content" | 109 | android:layout_width="wrap_content" |
73 | android:layout_height="wrap_content" | 110 | android:layout_height="wrap_content" |
74 | android:text="地区" | 111 | android:text="地区" |
75 | android:textSize="22sp" /> | 112 | android:textSize="22sp" /> |
76 | 113 | ||
77 | <TextView | 114 | <TextView |
78 | android:id="@+id/tv_useinfo_adress" | 115 | android:id="@+id/tv_useinfo_adress" |
79 | android:layout_width="wrap_content" | 116 | android:layout_width="wrap_content" |
80 | android:layout_height="wrap_content" | 117 | android:layout_height="wrap_content" |
81 | android:layout_marginLeft="50dp" | 118 | android:layout_marginLeft="50dp" |
82 | android:hint="请选择" | 119 | android:hint="请选择" |
83 | android:textSize="22sp" /> | 120 | android:textSize="22sp" /> |
84 | 121 | ||
85 | <ImageView | 122 | <ImageView |
86 | android:id="@+id/my_adress" | 123 | android:id="@+id/my_adress" |
87 | android:padding="20dp" | 124 | android:padding="20dp" |
88 | android:layout_width="wrap_content" | 125 | android:layout_width="wrap_content" |
89 | android:layout_height="wrap_content" | 126 | android:layout_height="wrap_content" |
90 | android:layout_marginLeft="150dp" | 127 | android:layout_marginLeft="150dp" |
91 | android:src="@mipmap/xiajiantou"> | 128 | android:src="@mipmap/xiajiantou"> |
92 | 129 | ||
93 | </ImageView> | 130 | </ImageView> |
94 | </LinearLayout> | 131 | </LinearLayout> |
95 | 132 | ||
96 | </LinearLayout> | 133 | </LinearLayout> |
97 | 134 | ||
98 | <LinearLayout | 135 | <LinearLayout |
99 | android:layout_width="wrap_content" | 136 | android:layout_width="wrap_content" |
100 | android:layout_height="wrap_content" | 137 | android:layout_height="wrap_content" |
101 | android:orientation="horizontal"> | 138 | android:orientation="horizontal"> |
102 | 139 | ||
103 | <View | 140 | <View |
104 | android:layout_width="450dp" | 141 | android:layout_width="450dp" |
105 | android:layout_height="0.7dp" | 142 | android:layout_height="0.7dp" |
106 | android:layout_marginLeft="150dp" | 143 | android:layout_marginLeft="150dp" |
107 | android:background="@color/cutoff_line"> | 144 | android:background="@color/cutoff_line"> |
108 | 145 | ||
109 | </View> | 146 | </View> |
110 | 147 | ||
111 | <View | 148 | <View |
112 | android:layout_width="450dp" | 149 | android:layout_width="450dp" |
113 | android:layout_height="0.7dp" | 150 | android:layout_height="0.7dp" |
114 | android:layout_marginLeft="80dp" | 151 | android:layout_marginLeft="80dp" |
115 | android:background="@color/cutoff_line"> | 152 | android:background="@color/cutoff_line"> |
116 | 153 | ||
117 | </View> | 154 | </View> |
118 | 155 | ||
119 | 156 | ||
120 | </LinearLayout> | 157 | </LinearLayout> |
121 | 158 | ||
122 | <LinearLayout | 159 | <LinearLayout |
123 | android:layout_width="match_parent" | 160 | android:layout_width="match_parent" |
124 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
125 | android:layout_marginLeft="200dp" | 162 | android:layout_marginLeft="200dp" |
126 | android:gravity="center_vertical" | 163 | android:gravity="center_vertical" |
127 | android:orientation="horizontal"> | 164 | android:orientation="horizontal"> |
128 | 165 | ||
129 | <LinearLayout | 166 | <LinearLayout |
130 | android:layout_width="0dp" | 167 | android:layout_width="0dp" |
131 | android:layout_height="80dp" | 168 | android:layout_height="80dp" |
132 | android:layout_weight="1" | 169 | android:layout_weight="1" |
133 | android:gravity="center_vertical"> | 170 | android:gravity="center_vertical"> |
134 | 171 | ||
135 | <TextView | 172 | <TextView |
136 | android:layout_width="wrap_content" | 173 | android:layout_width="wrap_content" |
137 | android:layout_height="wrap_content" | 174 | android:layout_height="wrap_content" |
138 | android:text="性别" | 175 | android:text="性别" |
139 | android:textSize="22sp" /> | 176 | android:textSize="22sp" /> |
140 | 177 | ||
141 | <TextView | 178 | <TextView |
142 | android:id="@+id/tv_sex" | 179 | android:id="@+id/tv_sex" |
143 | android:layout_width="wrap_content" | 180 | android:layout_width="wrap_content" |
144 | android:layout_height="wrap_content" | 181 | android:layout_height="wrap_content" |
145 | android:layout_marginLeft="50dp" | 182 | android:layout_marginLeft="50dp" |
146 | android:hint="请选择" | 183 | android:hint="请选择" |
147 | android:textSize="22sp" /> | 184 | android:textSize="22sp" /> |
148 | 185 | ||
149 | <ImageView | 186 | <ImageView |
150 | android:id="@+id/my_sex" | 187 | android:id="@+id/my_sex" |
151 | android:padding="20dp" | 188 | android:padding="20dp" |
152 | android:layout_width="wrap_content" | 189 | android:layout_width="wrap_content" |
153 | android:layout_height="wrap_content" | 190 | android:layout_height="wrap_content" |
154 | android:layout_marginLeft="150dp" | 191 | android:layout_marginLeft="150dp" |
155 | android:src="@mipmap/xiajiantou"> | 192 | android:src="@mipmap/xiajiantou"> |
156 | 193 | ||
157 | </ImageView> | 194 | </ImageView> |
158 | 195 | ||
159 | 196 | ||
160 | </LinearLayout> | 197 | </LinearLayout> |
161 | 198 | ||
162 | <LinearLayout | 199 | <LinearLayout |
163 | android:layout_width="0dp" | 200 | android:layout_width="0dp" |
164 | android:layout_height="80dp" | 201 | android:layout_height="80dp" |
165 | android:layout_weight="1" | 202 | android:layout_weight="1" |
166 | android:gravity="center_vertical"> | 203 | android:gravity="center_vertical"> |
167 | 204 | ||
168 | <TextView | 205 | <TextView |
169 | android:layout_width="wrap_content" | 206 | android:layout_width="wrap_content" |
170 | android:layout_height="wrap_content" | 207 | android:layout_height="wrap_content" |
171 | android:text=" " | 208 | android:text=" " |
172 | android:textColor="@color/white" | 209 | android:textColor="@color/white" |
173 | android:textSize="22sp" /> | 210 | android:textSize="22sp" /> |
174 | 211 | ||
175 | <EditText | 212 | <EditText |
176 | android:id="@+id/tv_useinfo_adress1" | 213 | android:id="@+id/tv_useinfo_adress1" |
177 | android:layout_width="wrap_content" | 214 | android:layout_width="wrap_content" |
178 | android:layout_height="wrap_content" | 215 | android:layout_height="wrap_content" |
179 | android:layout_marginLeft="50dp" | 216 | android:layout_marginLeft="50dp" |
180 | android:textColor="@color/electronic_text" | 217 | android:textColor="@color/electronic_text" |
181 | android:background="@null" | 218 | android:background="@null" |
182 | android:hint="请输入详细地址" | 219 | android:hint="请输入详细地址" |
183 | android:textSize="22sp" /> | 220 | android:textSize="22sp" /> |
184 | 221 | ||
185 | </LinearLayout> | 222 | </LinearLayout> |
186 | 223 | ||
187 | </LinearLayout> | 224 | </LinearLayout> |
188 | 225 | ||
189 | <LinearLayout | 226 | <LinearLayout |
190 | android:layout_width="wrap_content" | 227 | android:layout_width="wrap_content" |
191 | android:layout_height="wrap_content" | 228 | android:layout_height="wrap_content" |
192 | 229 | ||
193 | android:orientation="horizontal"> | 230 | android:orientation="horizontal"> |
194 | 231 | ||
195 | <View | 232 | <View |
196 | android:layout_width="450dp" | 233 | android:layout_width="450dp" |
197 | android:layout_height="0.7dp" | 234 | android:layout_height="0.7dp" |
198 | android:layout_marginLeft="150dp" | 235 | android:layout_marginLeft="150dp" |
199 | android:background="@color/cutoff_line"> | 236 | android:background="@color/cutoff_line"> |
200 | 237 | ||
201 | </View> | 238 | </View> |
202 | 239 | ||
203 | <View | 240 | <View |
204 | android:layout_width="450dp" | 241 | android:layout_width="450dp" |
205 | android:layout_height="0.7dp" | 242 | android:layout_height="0.7dp" |
206 | android:layout_marginLeft="80dp" | 243 | android:layout_marginLeft="80dp" |
207 | android:background="@color/cutoff_line"> | 244 | android:background="@color/cutoff_line"> |
208 | 245 | ||
209 | </View> | 246 | </View> |
210 | 247 | ||
211 | 248 | ||
212 | </LinearLayout> | 249 | </LinearLayout> |
213 | 250 | ||
214 | <LinearLayout | 251 | <LinearLayout |
215 | android:layout_width="match_parent" | 252 | android:layout_width="match_parent" |
216 | android:layout_height="wrap_content" | 253 | android:layout_height="wrap_content" |
217 | android:layout_marginLeft="200dp" | 254 | android:layout_marginLeft="200dp" |
218 | android:gravity="center_vertical" | 255 | android:gravity="center_vertical" |
219 | android:orientation="horizontal"> | 256 | android:orientation="horizontal"> |
220 | 257 | ||
221 | 258 | ||
222 | <LinearLayout | 259 | <LinearLayout |
223 | android:layout_width="0dp" | 260 | android:layout_width="0dp" |
224 | android:layout_height="80dp" | 261 | android:layout_height="80dp" |
225 | android:layout_weight="1" | 262 | android:layout_weight="1" |
226 | android:gravity="center_vertical"> | 263 | android:gravity="center_vertical"> |
227 | 264 | ||
228 | <TextView | 265 | <TextView |
229 | android:layout_width="wrap_content" | 266 | android:layout_width="wrap_content" |
230 | android:layout_height="wrap_content" | 267 | android:layout_height="wrap_content" |
231 | android:text="生日" | 268 | android:text="生日" |
232 | android:textSize="22sp" /> | 269 | android:textSize="22sp" /> |
233 | 270 | ||
234 | <TextView | 271 | <TextView |
235 | android:id="@+id/tv_useinfo_birthday" | 272 | android:id="@+id/tv_useinfo_birthday" |
236 | android:layout_width="wrap_content" | 273 | android:layout_width="wrap_content" |
237 | android:layout_height="wrap_content" | 274 | android:layout_height="wrap_content" |
238 | android:layout_marginLeft="50dp" | 275 | android:layout_marginLeft="50dp" |
239 | android:hint="请选择" | 276 | android:hint="请选择" |
240 | android:textSize="22sp" /> | 277 | android:textSize="22sp" /> |
241 | 278 | ||
242 | <ImageView | 279 | <ImageView |
243 | android:id="@+id/my_bthday" | 280 | android:id="@+id/my_bthday" |
244 | android:padding="20dp" | 281 | android:padding="20dp" |
245 | android:layout_width="wrap_content" | 282 | android:layout_width="wrap_content" |
246 | android:layout_height="wrap_content" | 283 | android:layout_height="wrap_content" |
247 | android:layout_marginLeft="150dp" | 284 | android:layout_marginLeft="150dp" |
248 | android:src="@mipmap/xiajiantou"/> | 285 | android:src="@mipmap/xiajiantou"/> |
249 | </LinearLayout> | 286 | </LinearLayout> |
250 | <LinearLayout | 287 | <LinearLayout |
251 | android:layout_width="0dp" | 288 | android:layout_width="0dp" |
252 | android:layout_height="80dp" | 289 | android:layout_height="80dp" |
253 | android:layout_weight="1" | 290 | android:layout_weight="1" |
254 | android:gravity="center_vertical"> | 291 | android:gravity="center_vertical"> |
255 | 292 | ||
256 | <TextView | 293 | <TextView |
257 | android:layout_width="wrap_content" | 294 | android:layout_width="wrap_content" |
258 | android:layout_height="wrap_content" | 295 | android:layout_height="wrap_content" |
259 | android:text="年级" | 296 | android:text="年级" |
260 | android:textSize="22sp" /> | 297 | android:textSize="22sp" /> |
261 | 298 | ||
262 | <TextView | 299 | <TextView |
263 | android:id="@+id/tv_useinfo_gender" | 300 | android:id="@+id/tv_useinfo_gender" |
264 | android:layout_width="wrap_content" | 301 | android:layout_width="wrap_content" |
265 | android:layout_height="wrap_content" | 302 | android:layout_height="wrap_content" |
266 | android:layout_marginLeft="50dp" | 303 | android:layout_marginLeft="50dp" |
267 | android:hint="请选择" | 304 | android:hint="请选择" |
268 | android:textSize="22sp" /> | 305 | android:textSize="22sp" /> |
269 | 306 | ||
270 | <ImageView | 307 | <ImageView |
271 | android:id="@+id/my_grade" | 308 | android:id="@+id/my_grade" |
272 | android:padding="20dp" | 309 | android:padding="20dp" |
273 | android:layout_width="wrap_content" | 310 | android:layout_width="wrap_content" |
274 | android:layout_height="wrap_content" | 311 | android:layout_height="wrap_content" |
275 | android:layout_marginLeft="150dp" | 312 | android:layout_marginLeft="150dp" |
276 | android:src="@mipmap/xiajiantou"/> | 313 | android:src="@mipmap/xiajiantou"/> |
277 | </LinearLayout> | 314 | </LinearLayout> |
278 | 315 | ||
279 | </LinearLayout> | 316 | </LinearLayout> |
280 | 317 | ||
281 | <LinearLayout | 318 | <LinearLayout |
282 | android:layout_width="wrap_content" | 319 | android:layout_width="wrap_content" |
283 | android:layout_height="wrap_content" | 320 | android:layout_height="wrap_content" |
284 | 321 | ||
285 | android:orientation="horizontal"> | 322 | android:orientation="horizontal"> |
286 | 323 | ||
287 | <View | 324 | <View |
288 | android:layout_width="450dp" | 325 | android:layout_width="450dp" |
289 | android:layout_height="0.7dp" | 326 | android:layout_height="0.7dp" |
290 | android:layout_marginLeft="150dp" | 327 | android:layout_marginLeft="150dp" |
291 | android:background="@color/cutoff_line"> | 328 | android:background="@color/cutoff_line"> |
292 | 329 | ||
293 | </View> | 330 | </View> |
294 | 331 | ||
295 | <View | 332 | <View |
296 | android:layout_width="450dp" | 333 | android:layout_width="450dp" |
297 | android:layout_height="0.7dp" | 334 | android:layout_height="0.7dp" |
298 | android:layout_marginLeft="80dp" | 335 | android:layout_marginLeft="80dp" |
299 | android:background="@color/cutoff_line"> | 336 | android:background="@color/cutoff_line"> |
300 | 337 | ||
301 | </View> | 338 | </View> |
302 | 339 | ||
303 | 340 | ||
304 | </LinearLayout> | 341 | </LinearLayout> |
305 | 342 | ||
306 | <LinearLayout | 343 | <LinearLayout |
307 | android:layout_width="match_parent" | 344 | android:layout_width="match_parent" |
308 | android:layout_height="wrap_content" | 345 | android:layout_height="wrap_content" |
309 | android:layout_marginLeft="200dp" | 346 | android:layout_marginLeft="200dp" |
310 | android:gravity="center_vertical" | 347 | android:gravity="center_vertical" |
311 | android:orientation="horizontal"> | 348 | android:orientation="horizontal"> |
312 | 349 | ||
313 | <LinearLayout | 350 | <LinearLayout |
314 | android:id="@+id/lineL_buy_time" | 351 | android:id="@+id/lineL_buy_time" |
315 | android:layout_width="0dp" | 352 | android:layout_width="0dp" |
316 | android:layout_height="80dp" | 353 | android:layout_height="80dp" |
317 | android:layout_weight="1" | 354 | android:layout_weight="1" |
318 | android:gravity="center_vertical"> | 355 | android:gravity="center_vertical"> |
319 | 356 | ||
320 | <TextView | 357 | <TextView |
321 | android:layout_width="wrap_content" | 358 | android:layout_width="wrap_content" |
322 | android:layout_height="wrap_content" | 359 | android:layout_height="wrap_content" |
323 | android:text="Q Q" | 360 | android:text="Q Q" |
324 | android:textSize="22sp" /> | 361 | android:textSize="22sp" /> |
325 | 362 | ||
326 | <EditText | 363 | <EditText |
327 | android:id="@+id/tv_useinfo_qq" | 364 | android:id="@+id/tv_useinfo_qq" |
328 | android:layout_width="wrap_content" | 365 | android:layout_width="wrap_content" |
329 | android:layout_height="wrap_content" | 366 | android:layout_height="wrap_content" |
330 | android:layout_marginLeft="50dp" | 367 | android:layout_marginLeft="50dp" |
331 | android:background="@null" | 368 | android:background="@null" |
332 | android:textColor="@color/electronic_text" | 369 | android:textColor="@color/electronic_text" |
333 | android:hint="请输入" | 370 | android:hint="请输入" |
334 | android:textSize="22sp" /> | 371 | android:textSize="22sp" /> |
335 | 372 | ||
336 | </LinearLayout> | 373 | </LinearLayout> |
337 | 374 | ||
338 | <LinearLayout | 375 | <LinearLayout |
339 | android:layout_width="0dp" | 376 | android:layout_width="0dp" |
340 | android:layout_height="80dp" | 377 | android:layout_height="80dp" |
341 | android:layout_weight="1" | 378 | android:layout_weight="1" |
342 | 379 | ||
343 | android:gravity="center_vertical"> | 380 | android:gravity="center_vertical"> |
344 | 381 | ||
345 | <TextView | 382 | <TextView |
346 | android:layout_width="wrap_content" | 383 | android:layout_width="wrap_content" |
347 | android:layout_height="wrap_content" | 384 | android:layout_height="wrap_content" |
348 | android:text="学校" | 385 | android:text="学校" |
349 | android:textSize="22sp" /> | 386 | android:textSize="22sp" /> |
350 | 387 | ||
351 | <TextView | 388 | <TextView |
352 | android:id="@+id/tv_useinfo_school" | 389 | android:id="@+id/tv_useinfo_school" |
353 | android:layout_width="wrap_content" | 390 | android:layout_width="wrap_content" |
354 | android:layout_height="wrap_content" | 391 | android:layout_height="wrap_content" |
355 | android:layout_marginLeft="50dp" | 392 | android:layout_marginLeft="50dp" |
356 | android:hint="请选择" | 393 | android:hint="请选择" |
357 | android:textSize="22sp" /> | 394 | android:textSize="22sp" /> |
358 | 395 | ||
359 | <ImageView | 396 | <ImageView |
360 | android:id="@+id/my_school" | 397 | android:id="@+id/my_school" |
361 | android:padding="20dp" | 398 | android:padding="20dp" |
362 | android:layout_width="wrap_content" | 399 | android:layout_width="wrap_content" |
363 | android:layout_height="wrap_content" | 400 | android:layout_height="wrap_content" |
364 | android:layout_marginLeft="150dp" | 401 | android:layout_marginLeft="150dp" |
365 | android:src="@mipmap/xiajiantou"> | 402 | android:src="@mipmap/xiajiantou"> |
366 | 403 | ||
367 | </ImageView> | 404 | </ImageView> |
368 | </LinearLayout> | 405 | </LinearLayout> |
369 | 406 | ||
370 | </LinearLayout> | 407 | </LinearLayout> |
371 | 408 | ||
372 | <LinearLayout | 409 | <LinearLayout |
373 | android:layout_width="wrap_content" | 410 | android:layout_width="wrap_content" |
374 | android:layout_height="wrap_content" | 411 | android:layout_height="wrap_content" |
375 | android:orientation="horizontal"> | 412 | android:orientation="horizontal"> |
376 | 413 | ||
377 | <View | 414 | <View |
378 | android:layout_width="450dp" | 415 | android:layout_width="450dp" |
379 | android:layout_height="0.7dp" | 416 | android:layout_height="0.7dp" |
380 | android:layout_marginLeft="150dp" | 417 | android:layout_marginLeft="150dp" |
381 | android:background="@color/cutoff_line"> | 418 | android:background="@color/cutoff_line"> |
382 | 419 | ||
383 | </View> | 420 | </View> |
384 | 421 | ||
385 | <View | 422 | <View |
386 | android:layout_width="450dp" | 423 | android:layout_width="450dp" |
387 | android:layout_height="0.7dp" | 424 | android:layout_height="0.7dp" |
388 | android:layout_marginLeft="80dp" | 425 | android:layout_marginLeft="80dp" |
389 | android:background="@color/cutoff_line"> | 426 | android:background="@color/cutoff_line"> |
390 | 427 | ||
391 | </View> | 428 | </View> |
392 | 429 | ||
393 | 430 | ||
394 | </LinearLayout> | 431 | </LinearLayout> |
395 | 432 | ||
396 | </LinearLayout> | 433 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:orientation="vertical" android:layout_width="match_parent" | 3 | android:orientation="vertical" android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:background="@color/white"> | 5 | android:background="@color/white"> |
6 | <RelativeLayout | ||
7 | android:id="@+id/title" | ||
8 | android:layout_width="match_parent" | ||
9 | android:layout_height="50dp" | ||
10 | android:background="@color/login_text_blue"> | ||
11 | |||
12 | <ImageView | ||
13 | android:id="@+id/cancel" | ||
14 | android:layout_width="wrap_content" | ||
15 | android:layout_height="match_parent" | ||
16 | android:paddingLeft="20dp" | ||
17 | android:paddingRight="20dp" | ||
18 | android:src="@mipmap/title_back" /> | ||
19 | |||
20 | <TextView | ||
21 | android:id="@+id/menu_title" | ||
22 | android:layout_width="wrap_content" | ||
23 | android:layout_height="match_parent" | ||
24 | android:layout_centerInParent="true" | ||
25 | android:gravity="center_vertical" | ||
26 | android:text="修改版本信息" | ||
27 | android:textColor="@android:color/white" | ||
28 | android:textSize="22sp" /> | ||
29 | <TextView | ||
30 | android:id="@+id/version_sub" | ||
31 | android:layout_width="wrap_content" | ||
32 | android:layout_height="match_parent" | ||
33 | android:paddingLeft="20dp" | ||
34 | android:paddingRight="20dp" | ||
35 | android:gravity="center_vertical" | ||
36 | android:layout_alignParentRight="true" | ||
37 | android:text="保存" | ||
38 | android:textColor="@android:color/white" | ||
39 | android:textSize="22sp" /> | ||
40 | |||
41 | |||
42 | </RelativeLayout> | ||
6 | <GridView | 43 | <GridView |
7 | android:id="@+id/grideview" | 44 | android:id="@+id/grideview" |
8 | android:layout_margin="30dp" | 45 | android:layout_margin="30dp" |
9 | android:layout_width="match_parent" | 46 | android:layout_width="match_parent" |
10 | android:layout_height="wrap_content" | 47 | android:layout_height="wrap_content" |
11 | android:gravity="center_vertical" | 48 | android:gravity="center_vertical" |
12 | android:layout_below="@+id/title" | 49 | android:layout_below="@+id/title" |
13 | android:verticalSpacing="20dp" | 50 | android:verticalSpacing="20dp" |
14 | android:numColumns="5"> | 51 | android:numColumns="5"> |
15 | 52 | ||
16 | </GridView> | 53 | </GridView> |
17 | 54 | ||
18 | </RelativeLayout> | 55 | </RelativeLayout> |