Commit a5bcfdbccfb3179d669fcce5cbc70f4c07f20908
1 parent
d40389f8d6
Exists in
master
版本信息处理
Showing
15 changed files
with
266 additions
and
101 deletions
Show diff stats
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
... | ... | @@ -5,48 +5,43 @@ import android.os.Bundle; |
5 | 5 | import android.os.Handler; |
6 | 6 | import android.os.Message; |
7 | 7 | import android.support.v7.app.AppCompatActivity; |
8 | +import android.util.Log; | |
8 | 9 | import android.view.View; |
10 | +import android.widget.AdapterView; | |
9 | 11 | import android.widget.Button; |
10 | 12 | import android.widget.GridView; |
11 | 13 | import android.widget.ImageView; |
12 | -import android.widget.SimpleAdapter; | |
13 | 14 | |
14 | 15 | import com.hjx.personalcenter.R; |
16 | +import com.hjx.personalcenter.adapter.GridAdapter; | |
15 | 17 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
18 | +import com.hjx.personalcenter.customdialog.VerSionDialog; | |
16 | 19 | import com.hjx.personalcenter.db.SaveParam; |
17 | 20 | import com.hjx.personalcenter.http.HttpCode; |
18 | 21 | import com.hjx.personalcenter.http.HttpManager; |
22 | +import com.hjx.personalcenter.interfaces.DialogCallBack; | |
23 | +import com.hjx.personalcenter.model.DefautPublishInfo; | |
24 | +import com.hjx.personalcenter.model.VersionInfo; | |
19 | 25 | import com.hjx.personalcenter.util.AlertUtils; |
20 | 26 | |
21 | 27 | import org.json.JSONException; |
22 | 28 | import org.json.JSONObject; |
23 | 29 | |
24 | 30 | import java.util.ArrayList; |
25 | -import java.util.HashMap; | |
26 | 31 | import java.util.List; |
27 | -import java.util.Map; | |
28 | 32 | |
29 | 33 | /** |
30 | 34 | * 选择教材 |
31 | 35 | * Created by h on 2017/8/10. |
32 | 36 | */ |
33 | 37 | |
34 | -public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener { | |
38 | +public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { | |
35 | 39 | private GridView gridView; |
36 | 40 | private Button btn_ok; |
37 | 41 | private ImageView cancel; |
38 | - private List<Map<String, Object>> data_list; | |
39 | - private SimpleAdapter sim_adapter; | |
40 | - // 图片封装为一个数组 | |
41 | - private int[] icon = {R.mipmap.ic_launcher, R.mipmap.ic_launcher, | |
42 | - R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, | |
43 | - R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, | |
44 | - R.mipmap.ic_launcher}; | |
45 | - private String[] subject = {"语文", "数学", "英语", "物理", "化学", "生物", "政治", | |
46 | - "历史", "地理"}; | |
47 | - private String[] publish = {"人民教育出版社", "人民教育出版社", "人民教育出版社", | |
48 | - "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社", | |
49 | - "人民教育出版社", "人民教育出版社"}; | |
42 | + private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | |
43 | + private GridAdapter sim_adapter; | |
44 | + | |
50 | 45 | |
51 | 46 | |
52 | 47 | Handler handler = new Handler() { |
... | ... | @@ -75,6 +70,11 @@ public class ChoiseTextBookActivity extends AppCompatActivity implements View.On |
75 | 70 | } |
76 | 71 | |
77 | 72 | break; |
73 | + case HttpCode.PUBLISH_SUCESS: | |
74 | + defautPublishInfos.clear(); | |
75 | + defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); | |
76 | + sim_adapter.notifyDataSetChanged(); | |
77 | + break; | |
78 | 78 | |
79 | 79 | } |
80 | 80 | |
... | ... | @@ -84,6 +84,17 @@ public class ChoiseTextBookActivity extends AppCompatActivity implements View.On |
84 | 84 | @Override |
85 | 85 | protected void onCreate(Bundle savedInstanceState) { |
86 | 86 | super.onCreate(savedInstanceState); |
87 | + String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | |
88 | + String graderid = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADENS); | |
89 | + try { | |
90 | + long auserID = Long.parseLong(userID); | |
91 | + int graderID = Integer.parseInt(graderid); | |
92 | + //获取个人信息 | |
93 | + HttpManager.getInstance().getpublishinfo(this,auserID,graderID,handler); | |
94 | + | |
95 | + } catch (NumberFormatException e) { | |
96 | + e.printStackTrace(); | |
97 | + } | |
87 | 98 | setContentView(R.layout.activity_choisetextbook); |
88 | 99 | initView(); |
89 | 100 | initData(); |
... | ... | @@ -97,11 +108,7 @@ public class ChoiseTextBookActivity extends AppCompatActivity implements View.On |
97 | 108 | } |
98 | 109 | |
99 | 110 | private void initData() { |
100 | - data_list = new ArrayList<Map<String, Object>>(); | |
101 | - getData(); | |
102 | - String[] from = {"image", "text", "text1"}; | |
103 | - int[] to = {R.id.image, R.id.text}; | |
104 | - sim_adapter = new SimpleAdapter(this, data_list, R.layout.activity_choisetextbook_items, from, to); | |
111 | + sim_adapter = new GridAdapter(defautPublishInfos,this); | |
105 | 112 | //配置适配器 |
106 | 113 | gridView.setAdapter(sim_adapter); |
107 | 114 | |
... | ... | @@ -110,22 +117,10 @@ public class ChoiseTextBookActivity extends AppCompatActivity implements View.On |
110 | 117 | private void initLister() { |
111 | 118 | btn_ok.setOnClickListener(this); |
112 | 119 | cancel.setOnClickListener(this); |
120 | + gridView.setOnItemClickListener(this); | |
113 | 121 | |
114 | 122 | } |
115 | 123 | |
116 | - public List<Map<String, Object>> getData() { | |
117 | - //cion和iconName的长度是相同的,这里任选其一都可以 | |
118 | - for (int i = 0; i < icon.length; i++) { | |
119 | - Map<String, Object> map = new HashMap<String, Object>(); | |
120 | - map.put("image", icon[i]); | |
121 | - map.put("text", subject[i]); | |
122 | - map.put("text1", publish[i]); | |
123 | - data_list.add(map); | |
124 | - } | |
125 | - | |
126 | - return data_list; | |
127 | - } | |
128 | - | |
129 | 124 | @Override |
130 | 125 | public void onClick(View v) { |
131 | 126 | switch (v.getId()) { |
... | ... | @@ -137,6 +132,9 @@ public class ChoiseTextBookActivity extends AppCompatActivity implements View.On |
137 | 132 | |
138 | 133 | } else { |
139 | 134 | long auserID = Long.parseLong(userID); |
135 | + //验证保卡信息 | |
136 | + HttpManager.getInstance().cardinfocheck(this, auserID, handler); | |
137 | + //提交注册信息 | |
140 | 138 | HttpManager.getInstance().cardinfocheck(this, auserID, handler); |
141 | 139 | } |
142 | 140 | |
... | ... | @@ -151,4 +149,20 @@ public class ChoiseTextBookActivity extends AppCompatActivity implements View.On |
151 | 149 | } |
152 | 150 | |
153 | 151 | } |
152 | + | |
153 | + @Override | |
154 | + public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | |
155 | + SaveParam.getInstance().saveLoginParam(this,SaveParam.VERSION,defautPublishInfos.get(position).getSubject()); | |
156 | + VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); | |
157 | + | |
158 | + | |
159 | + } | |
160 | + | |
161 | + @Override | |
162 | + public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | |
163 | + | |
164 | + Log.e("...........",""+data); | |
165 | + | |
166 | + | |
167 | + } | |
154 | 168 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MyApplication.java
... | ... | @@ -36,7 +36,7 @@ public class MyApplication extends Application { |
36 | 36 | CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false); |
37 | 37 | CrashHandler crashHandler = CrashHandler.getInstance(); |
38 | 38 | //生成错误日志,测试的时候得放开 |
39 | - crashHandler.init(getApplicationContext()); | |
39 | + //crashHandler.init(getApplicationContext()); | |
40 | 40 | crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { |
41 | 41 | |
42 | 42 | @Override | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
... | ... | @@ -138,7 +138,6 @@ public class RegisterInfoActivity extends AppCompatActivity implements View.OnCl |
138 | 138 | } |
139 | 139 | |
140 | 140 | } else { |
141 | - saveinfo(); | |
142 | 141 | Intent intent = new Intent(); |
143 | 142 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); |
144 | 143 | startActivity(intent); |
... | ... | @@ -157,18 +156,6 @@ public class RegisterInfoActivity extends AppCompatActivity implements View.OnCl |
157 | 156 | super.onResume(); |
158 | 157 | } |
159 | 158 | |
160 | - //保存个人信息 | |
161 | - private void saveinfo() { | |
162 | - String register1 = et_username.getText().toString().trim(); | |
163 | - String register2 = et_region.getText().toString().trim(); | |
164 | - String register3 = et_grade.getText().toString().trim(); | |
165 | - String register4 = et_school.getText().toString().trim(); | |
166 | - SaveParam.getInstance().saveLoginParam(this, SaveParam.USERNAME, register1); | |
167 | - SaveParam.getInstance().saveLoginParam(this, SaveParam.ADRESS, register2); | |
168 | - SaveParam.getInstance().saveLoginParam(this, SaveParam.GRADES, register3); | |
169 | - SaveParam.getInstance().saveLoginParam(this, SaveParam.SCHOOL, register4); | |
170 | - | |
171 | - } | |
172 | 159 | |
173 | 160 | //选择地区 |
174 | 161 | private void choiseregion() { | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/TheStartPageActivity.java
... | ... | @@ -7,6 +7,7 @@ import android.view.View; |
7 | 7 | import android.widget.Button; |
8 | 8 | |
9 | 9 | import com.hjx.personalcenter.R; |
10 | +import com.hjx.personalcenter.db.SaveParam; | |
10 | 11 | |
11 | 12 | /** |
12 | 13 | * Created by h on 2017/8/10. |
... | ... | @@ -38,6 +39,7 @@ public class TheStartPageActivity extends AppCompatActivity implements View.OnCl |
38 | 39 | public void onClick(View v) { |
39 | 40 | switch (v.getId()){ |
40 | 41 | case R.id.btn_start: |
42 | + SaveParam.getInstance().saveLoginParam(this, "login", "true"); | |
41 | 43 | Intent intent = new Intent(); |
42 | 44 | intent.setClass(TheStartPageActivity.this,MainActivity.class); |
43 | 45 | startActivity(intent); | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/GridAdapter.java
... | ... | @@ -17,10 +17,10 @@ import java.util.ArrayList; |
17 | 17 | */ |
18 | 18 | |
19 | 19 | public class GridAdapter extends BaseAdapter { |
20 | - private ArrayList<DefautPublishInfo> defautPublishInfo; | |
20 | + private ArrayList<DefautPublishInfo.DataBean> defautPublishInfo; | |
21 | 21 | private Context context; |
22 | 22 | |
23 | - public GridAdapter(ArrayList<DefautPublishInfo> defautPublishInfo, Context context) { | |
23 | + public GridAdapter(ArrayList<DefautPublishInfo.DataBean> defautPublishInfo, Context context) { | |
24 | 24 | this.defautPublishInfo = defautPublishInfo; |
25 | 25 | this.context = context; |
26 | 26 | } |
... | ... | @@ -52,9 +52,9 @@ public class GridAdapter extends BaseAdapter { |
52 | 52 | } else { |
53 | 53 | viewHolder = (ViewHolder) convertView.getTag(); |
54 | 54 | } |
55 | - viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(position).getImagurl()); | |
56 | - viewHolder.subject.setText(defautPublishInfo.get(position).getSubjuct()); | |
57 | - viewHolder.publish.setText(defautPublishInfo.get(position).getPublish()); | |
55 | + viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(position).getCover()); | |
56 | + viewHolder.subject.setText(defautPublishInfo.get(position).getSubject()); | |
57 | + viewHolder.publish.setText(defautPublishInfo.get(position).getPress()); | |
58 | 58 | return convertView; |
59 | 59 | } |
60 | 60 | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/VerSionDialog.java
... | ... | @@ -72,7 +72,7 @@ public class VerSionDialog extends BaseCircleDialog implements AdapterView.OnIte |
72 | 72 | |
73 | 73 | @Override |
74 | 74 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
75 | - return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); | |
75 | + return inflater.inflate(R.layout.custom_adilog_publishlist, container, false); | |
76 | 76 | } |
77 | 77 | |
78 | 78 | @Override |
... | ... | @@ -97,9 +97,7 @@ public class VerSionDialog extends BaseCircleDialog implements AdapterView.OnIte |
97 | 97 | |
98 | 98 | @Override |
99 | 99 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
100 | - //Toast.makeText(getActivity(), "你点击了第" + position + "个", Toast.LENGTH_LONG).show(); | |
101 | - //SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.PROVINCES, ""+data.get(position).getRegionId()); | |
102 | - mCallBack.versionOnItemClick(data,position,1); | |
100 | + mCallBack.versionOnItemClick(data,position,1100); | |
103 | 101 | dismiss(); |
104 | 102 | |
105 | 103 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/LoginFragment.java
... | ... | @@ -70,10 +70,10 @@ public class LoginFragment extends Fragment implements View.OnClickListener { |
70 | 70 | // |
71 | 71 | try { |
72 | 72 | long auserID = Long.parseLong(userId); |
73 | - //登录成功,保存登录数据并且获取个人信息 | |
74 | - HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, "true", userId); | |
75 | 73 | //检测注册信息是否完整 |
76 | 74 | HttpManager.getInstance().registerinfocheck(getActivity(),auserID,handler); |
75 | + //登录成功,保存登录数据并且获取个人信息 | |
76 | + HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, userId); | |
77 | 77 | |
78 | 78 | |
79 | 79 | |
... | ... | @@ -135,10 +135,12 @@ public class LoginFragment extends Fragment implements View.OnClickListener { |
135 | 135 | jsonObject = new JSONObject( (String) msg.obj); |
136 | 136 | status = jsonObject.optString("status"); |
137 | 137 | if (status.equals("1")){ |
138 | + SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); | |
138 | 139 | Intent intent = new Intent(); |
139 | 140 | intent.setClass(getActivity(), MainActivity.class); |
140 | 141 | getActivity().startActivity(intent); |
141 | 142 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
143 | + | |
142 | 144 | }else if(status.equals("2001")){ |
143 | 145 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); |
144 | 146 | }else{ | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/RegisterFragment.java
... | ... | @@ -74,7 +74,7 @@ public class RegisterFragment extends Fragment implements View.OnClickListener { |
74 | 74 | if (status.equals("100")) { |
75 | 75 | String usernameStr = phonenumber.getText().toString().trim(); |
76 | 76 | String passwordStr = password.getText().toString().trim(); |
77 | - HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,"true",userId); | |
77 | + HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,userId); | |
78 | 78 | AlertUtils.showToast(getActivity(), "注册成功!"); |
79 | 79 | Content.accountflag =1; |
80 | 80 | Intent intent = new Intent(); | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/VersionsInfoFragment.java
1 | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | |
3 | 3 | import android.os.Bundle; |
4 | +import android.os.Handler; | |
5 | +import android.os.Message; | |
4 | 6 | import android.support.annotation.Nullable; |
5 | 7 | import android.support.v4.app.Fragment; |
6 | 8 | import android.view.LayoutInflater; |
... | ... | @@ -13,10 +15,13 @@ import com.hjx.personalcenter.R; |
13 | 15 | import com.hjx.personalcenter.adapter.GridAdapter; |
14 | 16 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
15 | 17 | import com.hjx.personalcenter.db.SaveParam; |
18 | +import com.hjx.personalcenter.http.HttpCode; | |
19 | +import com.hjx.personalcenter.http.HttpManager; | |
16 | 20 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
17 | 21 | import com.hjx.personalcenter.model.DefautPublishInfo; |
18 | 22 | |
19 | 23 | import java.util.ArrayList; |
24 | +import java.util.List; | |
20 | 25 | |
21 | 26 | /** |
22 | 27 | * Created by h on 2017/8/12. |
... | ... | @@ -24,7 +29,7 @@ import java.util.ArrayList; |
24 | 29 | |
25 | 30 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener{ |
26 | 31 | private GridView gridView; |
27 | - private ArrayList<DefautPublishInfo> defautPublishInfos = new ArrayList<>(); | |
32 | + private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | |
28 | 33 | private GridAdapter sim_adapter; |
29 | 34 | private View mView; |
30 | 35 | private int type; |
... | ... | @@ -38,10 +43,36 @@ public class VersionsInfoFragment extends Fragment implements AdapterView.OnItem |
38 | 43 | return fragment; |
39 | 44 | |
40 | 45 | } |
46 | + Handler handler = new Handler(){ | |
47 | + @Override | |
48 | + public void handleMessage(Message msg) { | |
49 | + super.handleMessage(msg); | |
50 | + switch (msg.what){ | |
51 | + case HttpCode.PUBLISH_SUCESS: | |
52 | + defautPublishInfos.clear(); | |
53 | + defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); | |
54 | + sim_adapter.notifyDataSetChanged(); | |
55 | + break; | |
56 | + } | |
57 | + } | |
58 | + }; | |
41 | 59 | @Override |
42 | 60 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
43 | 61 | if (mView == null) { |
44 | 62 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); |
63 | + String userID = SaveParam.getInstance().getLoginParam(getActivity(),"userId"); | |
64 | + String graderid = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.GRADENS); | |
65 | + | |
66 | + try { | |
67 | + long auserID = Long.parseLong(userID); | |
68 | + int graderID = Integer.parseInt(graderid); | |
69 | + //获取版本信息 | |
70 | + HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderID,handler); | |
71 | + | |
72 | + } catch (NumberFormatException e) { | |
73 | + e.printStackTrace(); | |
74 | + } | |
75 | + | |
45 | 76 | initView(mView); |
46 | 77 | initData(); |
47 | 78 | setLister(); |
... | ... | @@ -56,21 +87,6 @@ public class VersionsInfoFragment extends Fragment implements AdapterView.OnItem |
56 | 87 | |
57 | 88 | } |
58 | 89 | private void initData() { |
59 | - DefautPublishInfo defautPublishInfo = new DefautPublishInfo(); | |
60 | - defautPublishInfo.setImagurl("http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"); | |
61 | - defautPublishInfo.setSubjuct("语文"); | |
62 | - defautPublishInfo.setPublish("人民教育出版社"); | |
63 | - DefautPublishInfo defautPublishInfo1 = new DefautPublishInfo(); | |
64 | - defautPublishInfo1.setImagurl("http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"); | |
65 | - defautPublishInfo1.setSubjuct("数学"); | |
66 | - defautPublishInfo1.setPublish("人民教育出版社"); | |
67 | - DefautPublishInfo defautPublishInfo2 = new DefautPublishInfo(); | |
68 | - defautPublishInfo2.setImagurl("http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"); | |
69 | - defautPublishInfo2.setSubjuct("英语"); | |
70 | - defautPublishInfo2.setPublish("人民教育出版社"); | |
71 | - defautPublishInfos.add(defautPublishInfo); | |
72 | - defautPublishInfos.add(defautPublishInfo1); | |
73 | - defautPublishInfos.add(defautPublishInfo2); | |
74 | 90 | sim_adapter = new GridAdapter(defautPublishInfos,getActivity()); |
75 | 91 | //配置适配器 |
76 | 92 | gridView.setAdapter(sim_adapter); |
... | ... | @@ -113,7 +129,7 @@ public class VersionsInfoFragment extends Fragment implements AdapterView.OnItem |
113 | 129 | break; |
114 | 130 | } |
115 | 131 | |
116 | - VerSionDialog.getInstance((DialogCallBack.VersionCallBack) this).show(getChildFragmentManager(), "VerSionDialog"); | |
132 | + VerSionDialog.getInstance((DialogCallBack.VersionCallBack)VersionsInfoFragment.this).show(getChildFragmentManager(), "VerSionDialog"); | |
117 | 133 | |
118 | 134 | } |
119 | 135 | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
... | ... | @@ -43,10 +43,12 @@ public class HttpCode { |
43 | 43 | public static final int CHILDS_SUCESS = 19; |
44 | 44 | //版本升级 |
45 | 45 | public static final int APPUPDATE_SUCESS = 20; |
46 | - //获取版本信息 | |
46 | + //获取出版社 | |
47 | 47 | public static final int VERSION_SUCESS = 22; |
48 | 48 | //注册信息是否完整 |
49 | 49 | public static final int REGISTER_SUCESS = 23; |
50 | + //获取默认版本信息 | |
51 | + public static final int PUBLISH_SUCESS = 24; | |
50 | 52 | |
51 | 53 | |
52 | 54 | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
... | ... | @@ -21,6 +21,7 @@ import com.hjx.personalcenter.model.CardInfo; |
21 | 21 | import com.hjx.personalcenter.model.ChildsInfo; |
22 | 22 | import com.hjx.personalcenter.model.CityInfo; |
23 | 23 | import com.hjx.personalcenter.model.CountyInfo; |
24 | +import com.hjx.personalcenter.model.DefautPublishInfo; | |
24 | 25 | import com.hjx.personalcenter.model.GradeInfo; |
25 | 26 | import com.hjx.personalcenter.model.PesonalInfo; |
26 | 27 | import com.hjx.personalcenter.model.ProvinceInfo; |
... | ... | @@ -250,11 +251,10 @@ public class HttpManager { |
250 | 251 | } |
251 | 252 | |
252 | 253 | //保存用户登录信息 |
253 | - public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { | |
254 | + public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { | |
254 | 255 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
255 | 256 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
256 | 257 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
257 | - SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); | |
258 | 258 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
259 | 259 | |
260 | 260 | |
... | ... | @@ -1143,7 +1143,7 @@ public class HttpManager { |
1143 | 1143 | @Override |
1144 | 1144 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1145 | 1145 | closeProgress(); |
1146 | - Log.e("test", "错误信息" + new String(arg2)); | |
1146 | + // Log.e("test", "错误信息" + new String(arg2)); | |
1147 | 1147 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1148 | 1148 | |
1149 | 1149 | } |
... | ... | @@ -1158,7 +1158,7 @@ public class HttpManager { |
1158 | 1158 | * @param pid appName |
1159 | 1159 | */ |
1160 | 1160 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
1161 | - mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否版本信息...", | |
1161 | + mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", | |
1162 | 1162 | false, true, null); |
1163 | 1163 | HttpClient.getInstance().setTimeout(5 * 1000); |
1164 | 1164 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
... | ... | @@ -1223,6 +1223,10 @@ public class HttpManager { |
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | |
1226 | + | |
1227 | + | |
1228 | + | |
1229 | + | |
1226 | 1230 | ///省级接口 |
1227 | 1231 | public void provices(final Context mContext, final Handler handler) { |
1228 | 1232 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
... | ... | @@ -1260,6 +1264,43 @@ public class HttpManager { |
1260 | 1264 | } |
1261 | 1265 | }); |
1262 | 1266 | } |
1267 | + //获取版本信息接口 | |
1268 | + public void getpublishinfo(final Context mContext, long userId,int gradeId, final Handler handler) { | |
1269 | + HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | |
1270 | + HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | |
1271 | + @Override | |
1272 | + public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | |
1273 | + Log.e("test", "获取版本信息接口" + new String(arg2)); | |
1274 | + try { | |
1275 | + JSONObject jsonObject = new JSONObject(new String(arg2)); | |
1276 | + int status = jsonObject.optInt("status"); | |
1277 | + if (status == 1) { | |
1278 | + Gson gson = new Gson(); | |
1279 | + DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); | |
1280 | + List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); | |
1281 | + Message message = Message.obtain(); | |
1282 | + message.what = HttpCode.PUBLISH_SUCESS; | |
1283 | + message.obj = defautPublishInfoBeanList; | |
1284 | + handler.sendMessage(message); | |
1285 | + | |
1286 | + } else { | |
1287 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
1288 | + | |
1289 | + } | |
1290 | + } catch (JSONException e) { | |
1291 | + e.printStackTrace(); | |
1292 | + } | |
1293 | + | |
1294 | + | |
1295 | + } | |
1296 | + | |
1297 | + @Override | |
1298 | + public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
1299 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
1300 | + } | |
1301 | + }); | |
1302 | + } | |
1303 | + | |
1263 | 1304 | |
1264 | 1305 | //市级接口 |
1265 | 1306 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
... | ... | @@ -40,6 +40,7 @@ public class HttpUrl { |
40 | 40 | public static String headerdefaultURL=GetDomain()+"/profile/picture/default";//默认头像上传 |
41 | 41 | public static String getversionURL=GetDomain()+"/press/list";//获取版本信息 |
42 | 42 | public static String isRegisterInfoCompleteURL=GetDomain()+"/register/extrainfo/check";//注册信息是否完整 |
43 | + public static String getpublishURL=GetDomain()+"/userPress/info";//获取版本信息 | |
43 | 44 | |
44 | 45 | |
45 | 46 | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/DefautPublishInfo.java
1 | 1 | package com.hjx.personalcenter.model; |
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | +import java.util.List; | |
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Created by h on 2017/9/12. |
7 | 8 | */ |
8 | 9 | |
9 | 10 | public class DefautPublishInfo implements Serializable{ |
10 | - private String imagurl; | |
11 | 11 | |
12 | - public String getImagurl() { | |
13 | - return imagurl; | |
12 | + /** | |
13 | + * status : 1 | |
14 | + * pageSize : 0 | |
15 | + * data : [{"cover":"","press":"北京出版社_北京教育出版社","subject":"语文"},{"cover":"","press":"北京出版社_北京教育出版社","subject":"数学"},{"cover":"","press":"北京出版社_北京教育出版社","subject":"英语"},{"cover":"","press":"人民教育出版社","subject":"物理"},{"cover":"","press":"人民教育出版社","subject":"化学"},{"cover":"","press":"人民教育出版社","subject":"历史"},{"cover":"","press":"人民教育出版社","subject":"地理"},{"cover":"","press":"人民教育出版社","subject":"政治"},{"cover":"","press":"人民教育出版社","subject":"生物"},{"cover":"","press":"人民教育出版社","subject":"科学"}] | |
16 | + * msg : success | |
17 | + * pageNum : 0 | |
18 | + */ | |
19 | + | |
20 | + private int status; | |
21 | + private int pageSize; | |
22 | + private String msg; | |
23 | + private int pageNum; | |
24 | + private List<DataBean> data; | |
25 | + | |
26 | + public void setStatus(int status) { | |
27 | + this.status = status; | |
28 | + } | |
29 | + | |
30 | + public void setPageSize(int pageSize) { | |
31 | + this.pageSize = pageSize; | |
32 | + } | |
33 | + | |
34 | + public void setMsg(String msg) { | |
35 | + this.msg = msg; | |
36 | + } | |
37 | + | |
38 | + public void setPageNum(int pageNum) { | |
39 | + this.pageNum = pageNum; | |
40 | + } | |
41 | + | |
42 | + public void setData(List<DataBean> data) { | |
43 | + this.data = data; | |
14 | 44 | } |
15 | 45 | |
16 | - public void setImagurl(String imagurl) { | |
17 | - this.imagurl = imagurl; | |
46 | + public int getStatus() { | |
47 | + return status; | |
18 | 48 | } |
19 | 49 | |
20 | - public String getSubjuct() { | |
21 | - return subjuct; | |
50 | + public int getPageSize() { | |
51 | + return pageSize; | |
22 | 52 | } |
23 | 53 | |
24 | - public void setSubjuct(String subjuct) { | |
25 | - this.subjuct = subjuct; | |
54 | + public String getMsg() { | |
55 | + return msg; | |
26 | 56 | } |
27 | 57 | |
28 | - public String getPublish() { | |
29 | - return publish; | |
58 | + public int getPageNum() { | |
59 | + return pageNum; | |
30 | 60 | } |
31 | 61 | |
32 | - public void setPublish(String publish) { | |
33 | - this.publish = publish; | |
62 | + public List<DataBean> getData() { | |
63 | + return data; | |
34 | 64 | } |
35 | 65 | |
36 | - private String subjuct; | |
37 | - private String publish; | |
66 | + public static class DataBean { | |
67 | + /** | |
68 | + * cover : | |
69 | + * press : 北京出版社_北京教育出版社 | |
70 | + * subject : 语文 | |
71 | + */ | |
72 | + | |
73 | + private String cover; | |
74 | + private String press; | |
75 | + private String subject; | |
76 | + | |
77 | + public void setCover(String cover) { | |
78 | + this.cover = cover; | |
79 | + } | |
80 | + | |
81 | + public void setPress(String press) { | |
82 | + this.press = press; | |
83 | + } | |
84 | + | |
85 | + public void setSubject(String subject) { | |
86 | + this.subject = subject; | |
87 | + } | |
88 | + | |
89 | + public String getCover() { | |
90 | + return cover; | |
91 | + } | |
92 | + | |
93 | + public String getPress() { | |
94 | + return press; | |
95 | + } | |
96 | + | |
97 | + public String getSubject() { | |
98 | + return subject; | |
99 | + } | |
100 | + } | |
38 | 101 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/CenterService.java
... | ... | @@ -69,7 +69,7 @@ public class CenterService extends BaseService { |
69 | 69 | @Override |
70 | 70 | public String getcardUser() throws RemoteException { |
71 | 71 | String results = null; |
72 | - CardInfo cardInfo = new CardInfo(); | |
72 | + // CardInfo cardInfo = new CardInfo(); | |
73 | 73 | CardInfo.DataBean dataBean = new CardInfo.DataBean(); |
74 | 74 | Gson gson = new Gson(); |
75 | 75 | |
... | ... | @@ -84,10 +84,11 @@ public class CenterService extends BaseService { |
84 | 84 | dataBean.setBuyAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPADRESS)); |
85 | 85 | dataBean.setAlterSaleCall(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTLEPHONE)); |
86 | 86 | dataBean.setMobilePhone(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CARDPHONE)); |
87 | - cardInfo.setData(dataBean); | |
88 | - results =gson.toJson(cardInfo); | |
89 | - | |
87 | + // cardInfo.setData(dataBean); | |
88 | + results =gson.toJson(dataBean); | |
89 | + Log.e("test","保卡信息"+results); | |
90 | 90 | return results; |
91 | + | |
91 | 92 | } |
92 | 93 | |
93 | 94 | @Override | ... | ... |
PersonalCenter/app/src/main/res/layout/custom_adilog_publishlist.xml
... | ... | @@ -0,0 +1,38 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + android:layout_width="match_parent" | |
4 | + android:layout_height="match_parent" | |
5 | + android:orientation="vertical"> | |
6 | + | |
7 | + <RelativeLayout | |
8 | + android:id="@+id/title" | |
9 | + android:layout_width="match_parent" | |
10 | + android:layout_height="wrap_content" | |
11 | + android:minHeight="70dp" > | |
12 | + | |
13 | + <ImageView | |
14 | + android:id="@+id/cancel" | |
15 | + android:layout_width="wrap_content" | |
16 | + android:layout_height="wrap_content" | |
17 | + android:layout_centerVertical="true" | |
18 | + android:layout_alignParentRight="true" | |
19 | + android:padding="20dp" | |
20 | + android:src="@mipmap/cancel_fork" /> | |
21 | + | |
22 | + <TextView | |
23 | + android:id="@+id/menu_title" | |
24 | + android:layout_width="wrap_content" | |
25 | + android:layout_height="wrap_content" | |
26 | + android:layout_centerInParent="true" | |
27 | + android:padding="20dp" | |
28 | + android:text="请选择出版社" | |
29 | + android:textColor="@android:color/black" | |
30 | + android:textSize="22sp" /> | |
31 | + </RelativeLayout> | |
32 | + <ListView | |
33 | + android:id="@+id/listadapter" | |
34 | + android:layout_width="match_parent" | |
35 | + android:layout_height="400dp"> | |
36 | + | |
37 | + </ListView> | |
38 | +</LinearLayout> | ... | ... |