Commit e93f210b0a757e5c10e6595fd72a2578e3dc2c79
1 parent
78458fa9f2
Exists in
master
个人信息获取,头像和拍照
Showing
26 changed files
with
859 additions
and
214 deletions
Show diff stats
PersonalCenter/.idea/misc.xml
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | <ConfirmationsSetting value="0" id="Add" /> |
38 | 38 | <ConfirmationsSetting value="0" id="Remove" /> |
39 | 39 | </component> |
40 | - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
40 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
41 | 41 | <output url="file://$PROJECT_DIR$/build/classes" /> |
42 | 42 | </component> |
43 | 43 | <component name="ProjectType"> | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangePresonalInfoActivity.java
... | ... | @@ -4,6 +4,7 @@ import android.os.Bundle; |
4 | 4 | import android.support.v4.app.Fragment; |
5 | 5 | import android.support.v4.view.ViewPager; |
6 | 6 | import android.support.v7.app.AppCompatActivity; |
7 | +import android.widget.TextView; | |
7 | 8 | |
8 | 9 | import com.hjx.personalcenter.R; |
9 | 10 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; |
... | ... | @@ -22,6 +23,7 @@ import java.util.List; |
22 | 23 | public class ChangePresonalInfoActivity extends AppCompatActivity { |
23 | 24 | private ViewPager viewPager; |
24 | 25 | private SlidingTabLayout tableLayout; |
26 | + private TextView subsave; | |
25 | 27 | private List<Fragment> presoninfo; |
26 | 28 | private LoginAndRegisterAdapter presoninfodapter; |
27 | 29 | private List<String> title = Arrays.asList("个人信息", "版本信息"); |
... | ... | @@ -37,6 +39,7 @@ public class ChangePresonalInfoActivity extends AppCompatActivity { |
37 | 39 | private void initView() { |
38 | 40 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); |
39 | 41 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); |
42 | + subsave = (TextView) findViewById(R.id.presonal_sub); | |
40 | 43 | } |
41 | 44 | |
42 | 45 | private void initData() { | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardLookInfoActivity.java
... | ... | @@ -16,10 +16,8 @@ import com.hjx.personalcenter.http.HttpCode; |
16 | 16 | import com.hjx.personalcenter.http.HttpManager; |
17 | 17 | import com.hjx.personalcenter.model.CardInfo; |
18 | 18 | import com.hjx.personalcenter.util.AlertUtils; |
19 | -import com.hjx.personalcenter.util.GetDevicesUtil; | |
20 | 19 | |
21 | -import org.json.JSONException; | |
22 | -import org.json.JSONObject; | |
20 | +import java.util.ArrayList; | |
23 | 21 | |
24 | 22 | /** |
25 | 23 | * Created by h on 2017/8/11. |
... | ... | @@ -29,31 +27,29 @@ public class ElectronicCardLookInfoActivity extends AppCompatActivity implements |
29 | 27 | private ImageView iv_last_step; |
30 | 28 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber, |
31 | 29 | shopadress,phone,tlePhone,tv_card_adress_change,tv_card_phone_change; |
30 | + private ArrayList<CardInfo.DataBean> data = new ArrayList<>(); | |
32 | 31 | |
33 | 32 | Handler handler = new Handler(){ |
34 | 33 | @Override |
35 | 34 | public void handleMessage(Message msg) { |
36 | 35 | super.handleMessage(msg); |
37 | - JSONObject jsonObject; | |
38 | - String status; | |
39 | 36 | switch (msg.what){ |
40 | 37 | |
41 | 38 | case HttpCode.SUCHCARDINFO: |
42 | - CardInfo cardInfo = new CardInfo(); | |
43 | - try { | |
44 | - jsonObject = new JSONObject( (String) msg.obj); | |
45 | - status = jsonObject.optString("status"); | |
46 | - if (status.equals("1")){ | |
47 | 39 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"显示电子保卡信息"); |
48 | - cardInfo.setCustomerName(jsonObject.optString("customerName")); | |
40 | + CardInfo.DataBean cardinfoBean =(CardInfo.DataBean)msg.obj; | |
41 | + //获取设备信息 | |
42 | + deviceModel.setText(cardinfoBean.getProductModel()); | |
43 | + deviceNumber.setText(cardinfoBean.getDeviceNumber()); | |
44 | + mac_adress.setText(cardinfoBean.getMacAddress()); | |
45 | + //获取保卡信息 | |
46 | + usename.setText(cardinfoBean.getCustomerName()); | |
47 | + customer_address.setText(cardinfoBean.getCustomerAddress()); | |
48 | + shoptime.setText(cardinfoBean.getBuyTime()); | |
49 | + shopadress.setText(cardinfoBean.getBuyAddress()); | |
50 | + tlePhone.setText(cardinfoBean.getAlterSaleCall()); | |
51 | + phone.setText(cardinfoBean.getMobilePhone()); | |
49 | 52 | |
50 | - }else { | |
51 | - AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"保卡信息查询失败"); | |
52 | - } | |
53 | - | |
54 | - } catch (JSONException e) { | |
55 | - e.printStackTrace(); | |
56 | - } | |
57 | 53 | |
58 | 54 | break; |
59 | 55 | |
... | ... | @@ -85,18 +81,25 @@ public class ElectronicCardLookInfoActivity extends AppCompatActivity implements |
85 | 81 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); |
86 | 82 | } |
87 | 83 | private void initData() { |
88 | - HttpManager.getInstance().getcardinfo(this,736,handler); | |
89 | - //获取设备信息 | |
90 | - deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | |
91 | - deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | |
92 | - mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | |
93 | - //获取保卡信息 | |
94 | - usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | |
95 | - customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | |
96 | - shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | |
97 | - shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | |
98 | - tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | |
99 | - phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | |
84 | + String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | |
85 | + try { | |
86 | + int a = Integer.parseInt(userID); | |
87 | + HttpManager.getInstance().getcardinfo(this,a,handler); | |
88 | + } catch (NumberFormatException e) { | |
89 | + e.printStackTrace(); | |
90 | + } | |
91 | + | |
92 | +// //获取设备信息 | |
93 | +// deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | |
94 | +// deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | |
95 | +// mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | |
96 | +// //获取保卡信息 | |
97 | +// usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | |
98 | +// customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | |
99 | +// shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | |
100 | +// shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | |
101 | +// tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | |
102 | +// phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | |
100 | 103 | |
101 | 104 | |
102 | 105 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
... | ... | @@ -2,19 +2,35 @@ package com.hjx.personalcenter.activity; |
2 | 2 | |
3 | 3 | import android.content.Context; |
4 | 4 | import android.content.Intent; |
5 | +import android.content.pm.PackageManager; | |
6 | +import android.net.Uri; | |
7 | +import android.os.Build; | |
5 | 8 | import android.os.Bundle; |
9 | +import android.provider.MediaStore; | |
10 | +import android.support.annotation.NonNull; | |
11 | +import android.support.v4.content.FileProvider; | |
6 | 12 | import android.support.v7.app.AppCompatActivity; |
7 | -import android.view.LayoutInflater; | |
8 | 13 | import android.view.View; |
9 | -import android.view.ViewGroup; | |
10 | 14 | import android.widget.ImageView; |
11 | 15 | import android.widget.LinearLayout; |
12 | 16 | import android.widget.TextView; |
17 | +import android.widget.Toast; | |
13 | 18 | |
19 | +import com.facebook.drawee.backends.pipeline.Fresco; | |
20 | +import com.facebook.drawee.generic.GenericDraweeHierarchy; | |
21 | +import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | |
22 | +import com.facebook.drawee.generic.RoundingParams; | |
23 | +import com.facebook.drawee.interfaces.DraweeController; | |
24 | +import com.facebook.drawee.view.SimpleDraweeView; | |
14 | 25 | import com.hjx.personalcenter.R; |
15 | 26 | import com.hjx.personalcenter.customdialog.HeadDialog; |
16 | 27 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
17 | 28 | import com.hjx.personalcenter.util.AlertUtils; |
29 | +import com.hjx.personalcenter.util.CropUtils; | |
30 | +import com.hjx.personalcenter.util.DialogPermission; | |
31 | +import com.hjx.personalcenter.util.FileUtil; | |
32 | +import com.hjx.personalcenter.util.PermissionUtil; | |
33 | +import com.hjx.personalcenter.util.SharedPreferenceMark; | |
18 | 34 | import com.mylhyl.circledialog.CircleDialog; |
19 | 35 | import com.mylhyl.circledialog.callback.ConfigInput; |
20 | 36 | import com.mylhyl.circledialog.params.InputParams; |
... | ... | @@ -22,12 +38,13 @@ import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
22 | 38 | import com.zaaach.toprightmenu.MenuItem; |
23 | 39 | import com.zaaach.toprightmenu.TopRightMenu; |
24 | 40 | |
41 | +import java.io.File; | |
25 | 42 | import java.util.ArrayList; |
26 | 43 | import java.util.List; |
27 | 44 | |
28 | 45 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
29 | - private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_head, iv_sex; | |
30 | - private TextView tv_edit_presoninfo, tv_sign, oktakephone, cancetakephone, | |
46 | + private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; | |
47 | + private TextView tv_edit_presoninfo, tv_sign, | |
31 | 48 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
32 | 49 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; |
33 | 50 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; |
... | ... | @@ -35,10 +52,17 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
35 | 52 | private boolean showIcon = true; |
36 | 53 | private boolean dimBg = true; |
37 | 54 | private boolean needAnim = true; |
55 | + private static final int REQUEST_CODE_TAKE_PHOTO = 1; | |
56 | + private static final int REQUEST_CODE_ALBUM = 2; | |
57 | + private static final int REQUEST_CODE_CROUP_PHOTO = 3; | |
58 | + SimpleDraweeView mSimpleDraweeView; | |
59 | + private File file; | |
60 | + private Uri uri; | |
38 | 61 | |
39 | 62 | @Override |
40 | 63 | protected void onCreate(Bundle savedInstanceState) { |
41 | 64 | super.onCreate(savedInstanceState); |
65 | + Fresco.initialize(this); | |
42 | 66 | setContentView(R.layout.activity_main); |
43 | 67 | initView(); |
44 | 68 | initData(); |
... | ... | @@ -53,7 +77,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
53 | 77 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
54 | 78 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
55 | 79 | //头像 |
56 | - iv_head = (ImageView) findViewById(R.id.iv_head); | |
80 | + mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | |
57 | 81 | //初始化个人信息 |
58 | 82 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
59 | 83 | tv_username = (TextView) findViewById(R.id.tv_username); |
... | ... | @@ -76,6 +100,15 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
76 | 100 | private void initData() { |
77 | 101 | //加载个人信息 |
78 | 102 | |
103 | + //初始化图片 | |
104 | + file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | |
105 | + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | |
106 | + uri = Uri.fromFile(file); | |
107 | + } else { | |
108 | + //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | |
109 | + uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | |
110 | + } | |
111 | + | |
79 | 112 | } |
80 | 113 | |
81 | 114 | private void initLister() { |
... | ... | @@ -84,7 +117,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
84 | 117 | tv_edit_presoninfo.setOnClickListener(this); |
85 | 118 | iv_setting.setOnClickListener(this); |
86 | 119 | iv_sign.setOnClickListener(this); |
87 | - iv_head.setOnClickListener(this); | |
120 | + mSimpleDraweeView.setOnClickListener(this); | |
88 | 121 | linel_mycuoti.setOnClickListener(this); |
89 | 122 | linel_mynote.setOnClickListener(this); |
90 | 123 | linel_mycollege.setOnClickListener(this); |
... | ... | @@ -190,24 +223,147 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
190 | 223 | case R.id.linel_myclass: |
191 | 224 | AlertUtils.showToast(this, "hhahahah "); |
192 | 225 | break; |
226 | + } | |
227 | + | |
228 | + } | |
229 | + //回调头像监听 | |
230 | + @Override | |
231 | + public void heard(Context context, View v) { | |
232 | + switch (v.getId()){ | |
233 | + //选择默认图片 | |
193 | 234 | case R.id.oktakephone: |
194 | - AlertUtils.showToast(this, "hhahahah "); | |
235 | + AlertUtils.showToast(this, "您选择了默认图片 "); | |
195 | 236 | break; |
196 | 237 | case R.id.canceltakephone: |
197 | - AlertUtils.showToast(this, "hhahahah "); | |
238 | + | |
239 | + break; | |
240 | + //拍摄和相册 | |
241 | + case R.id.take_pic: | |
242 | + if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | |
243 | + uploadAvatarFromPhotoRequest(); | |
244 | + } | |
245 | + | |
246 | + break; | |
247 | + case R.id.xiangce: | |
248 | + uploadAvatarFromAlbumRequest(); | |
198 | 249 | break; |
199 | 250 | |
200 | 251 | } |
201 | 252 | |
202 | 253 | } |
203 | 254 | |
255 | + //照相 | |
256 | + private void uploadAvatarFromPhotoRequest() { | |
257 | + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | |
258 | + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | |
259 | + intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | |
260 | + intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | |
261 | + startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | |
262 | + } | |
263 | + | |
264 | + //选择图库 | |
265 | + private void uploadAvatarFromAlbumRequest() { | |
266 | + Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | |
267 | + photoPickerIntent.setType("image/*"); | |
268 | + startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | |
269 | + } | |
270 | + //回掉 | |
204 | 271 | @Override |
205 | - public void provinceOnItemClick(Context context, LayoutInflater inflater, ViewGroup container) { | |
206 | - View mView = inflater.inflate(R.layout.custom_adilog_lhead, container, false); | |
207 | - oktakephone = (TextView) mView.findViewById(R.id.oktakephone); | |
208 | - cancetakephone = (TextView) mView.findViewById(R.id.canceltakephone); | |
209 | - oktakephone.setOnClickListener(this); | |
210 | - cancetakephone.setOnClickListener(this); | |
272 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
273 | + super.onActivityResult(requestCode, resultCode, data); | |
274 | + if (resultCode != -1) { | |
275 | + return; | |
276 | + } | |
277 | + if (requestCode == REQUEST_CODE_ALBUM && data != null) { | |
278 | + Uri newUri; | |
279 | + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | |
280 | + newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | |
281 | + } else { | |
282 | + newUri = data.getData(); | |
283 | + } | |
284 | + if (newUri != null) { | |
285 | + startPhotoZoom(newUri); | |
286 | + } else { | |
287 | + Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | |
288 | + } | |
289 | + } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | |
290 | + startPhotoZoom(uri); | |
291 | + } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | |
292 | + uploadAvatarFromPhoto(); | |
293 | + } | |
294 | + } | |
211 | 295 | |
296 | + private void uploadAvatarFromPhoto() { | |
297 | + compressAndUploadAvatar(file.getPath()); | |
298 | + | |
299 | + } | |
300 | + private void compressAndUploadAvatar(String fileSrc) { | |
301 | + | |
302 | + | |
303 | + //上传到服务器 | |
304 | + | |
305 | + final File cover = FileUtil.getSmallBitmap(this, fileSrc); | |
306 | + String mimeType = "image/*"; | |
307 | + //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | |
308 | + //String fileName = cover.getName(); | |
309 | + //HttpManager.getInstance().header(this, fileSrc); | |
310 | + //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | |
311 | + //Fresco设置圆形头像 | |
312 | + GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | |
313 | + GenericDraweeHierarchy hierarchy = builder | |
314 | + .setDesiredAspectRatio(1f) | |
315 | + .setFailureImage(R.mipmap.blank) | |
316 | + //圆形头像 | |
317 | + .setRoundingParams(RoundingParams.asCircle()) | |
318 | + .build(); | |
319 | + | |
320 | + //加载本地图片 | |
321 | + Uri uri = Uri.fromFile(cover); | |
322 | + DraweeController controller = Fresco.newDraweeControllerBuilder() | |
323 | + .setOldController(mSimpleDraweeView.getController()) | |
324 | + .setUri(uri) | |
325 | + .build(); | |
326 | + mSimpleDraweeView.setHierarchy(hierarchy); | |
327 | + mSimpleDraweeView.setController(controller); | |
328 | + | |
329 | + } | |
330 | + | |
331 | + public void startPhotoZoom(Uri uri) { | |
332 | + Intent intent = new Intent("com.android.camera.action.CROP"); | |
333 | + intent.setDataAndType(uri, "image/*"); | |
334 | + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | |
335 | + intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | |
336 | + intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | |
337 | + intent.putExtra("aspectY", 1);// x:y=1:1 | |
338 | +// intent.putExtra("outputX", 400);//图片输出大小 | |
339 | +// intent.putExtra("outputY", 400); | |
340 | + intent.putExtra("output", Uri.fromFile(file)); | |
341 | + intent.putExtra("outputFormat", "JPEG");// 返回格式 | |
342 | + startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | |
343 | + } | |
344 | + | |
345 | + @Override | |
346 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |
347 | + switch (requestCode) { | |
348 | + | |
349 | + case PermissionUtil.REQUEST_SHOWCAMERA: | |
350 | + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | |
351 | + // Permission Granted | |
352 | + uploadAvatarFromPhotoRequest(); | |
353 | + | |
354 | + } else { | |
355 | + if (!SharedPreferenceMark.getHasShowCamera()) { | |
356 | + SharedPreferenceMark.setHasShowCamera(true); | |
357 | + new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | |
358 | + | |
359 | + } else { | |
360 | + Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | |
361 | + .show(); | |
362 | + } | |
363 | + } | |
364 | + break; | |
365 | + default: | |
366 | + super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
367 | + } | |
212 | 368 | } |
213 | 369 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
... | ... | @@ -18,7 +18,6 @@ import com.hjx.personalcenter.customdialog.GradeListDialog; |
18 | 18 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
19 | 19 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
20 | 20 | import com.hjx.personalcenter.db.SaveParam; |
21 | -import com.hjx.personalcenter.http.HttpManager; | |
22 | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
23 | 22 | import com.hjx.personalcenter.util.AlertUtils; |
24 | 23 | |
... | ... | @@ -104,50 +103,52 @@ public class RegisterInfoActivity extends AppCompatActivity implements View.OnCl |
104 | 103 | |
105 | 104 | //选择地区 |
106 | 105 | private void choiseregion() { |
107 | - | |
108 | 106 | ProvinceListDialog.getInstance(this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
109 | 107 | |
110 | 108 | } |
111 | -//选择年级 | |
109 | + //选择年级 | |
112 | 110 | private void choisegrade() { |
113 | - HttpManager.getInstance().getgrade(RegisterInfoActivity.this); | |
114 | - GradeListDialog.getInstance().show(getSupportFragmentManager(), "GradeListDialog"); | |
111 | + GradeListDialog.getInstance(this).show(getSupportFragmentManager(), "GradeListDialog"); | |
115 | 112 | |
116 | 113 | } |
117 | 114 | //选择学校 |
118 | 115 | private void choiseschool() { |
119 | - SchoolListDialog.getInstance().show(getSupportFragmentManager(), "SchoolListDialog"); | |
116 | + SchoolListDialog.getInstance(this).show(getSupportFragmentManager(), "SchoolListDialog"); | |
120 | 117 | |
121 | 118 | } |
122 | 119 | |
123 | 120 | |
124 | 121 | @Override |
125 | 122 | public void provinceOnItemClick(AdapterView<?> parent, View view, int position, long id,int type) { |
123 | + View View = parent.getChildAt(position); | |
124 | + TextView Tv = (TextView)View.findViewById(R.id.list_items); | |
125 | + switch (type){ | |
126 | 126 | |
127 | - if (type==1){ | |
128 | - View gradeView = parent.getChildAt(position); | |
129 | - TextView gradeTv = (TextView)gradeView.findViewById(R.id.list_items); | |
130 | - SaveParam.getInstance().saveLoginParam(this,"sheng",gradeTv.getText().toString()); | |
131 | - CitysListDialog.getInstance(this).show(getSupportFragmentManager(), "CitysListDialog"); | |
132 | - } | |
133 | - | |
134 | - if (type==2){ | |
135 | - View gradeView = parent.getChildAt(position); | |
136 | - TextView gradeTv = (TextView)gradeView.findViewById(R.id.list_items); | |
137 | - SaveParam.getInstance().saveLoginParam(this,"shi",gradeTv.getText().toString()); | |
138 | - CountryDialog.getInstance(this).show(getSupportFragmentManager(), "CountryDialog"); | |
139 | - } | |
140 | - | |
141 | - if (type==3){ | |
142 | - View gradeView = parent.getChildAt(position); | |
143 | - TextView gradeTv = (TextView)gradeView.findViewById(R.id.list_items); | |
144 | - String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | |
145 | - String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | |
146 | - et_region.setText(provice+citys+gradeTv.getText().toString()); | |
127 | + case 1: | |
128 | + SaveParam.getInstance().saveLoginParam(this,"sheng",Tv.getText().toString()); | |
129 | + CitysListDialog.getInstance(this).show(getSupportFragmentManager(), "CitysListDialog"); | |
130 | + break; | |
131 | + case 2: | |
132 | + String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | |
133 | + SaveParam.getInstance().saveLoginParam(this,"shi",Tv.getText().toString()); | |
134 | + CountryDialog.getInstance(this).show(getSupportFragmentManager(), "CountryDialog"); | |
135 | + et_region.setText(""); | |
136 | + et_region.setText(provice+Tv.getText().toString()); | |
137 | + break; | |
138 | + case 3: | |
139 | + String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | |
140 | + String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | |
141 | + et_region.setText(""); | |
142 | + et_region.setText(provices+citys+Tv.getText().toString()); | |
143 | + break; | |
144 | + case 4: | |
145 | + et_school.setText(Tv.getText().toString()); | |
146 | + break; | |
147 | + case 5: | |
148 | + et_grade.setText(Tv.getText().toString()); | |
149 | + break; | |
147 | 150 | } |
148 | 151 | |
149 | - | |
150 | - | |
151 | 152 | } |
152 | 153 | @Override |
153 | 154 | public boolean onKeyUp(int keyCode, KeyEvent event) { | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/GrandeAdapter.java
... | ... | @@ -16,10 +16,10 @@ import java.util.ArrayList; |
16 | 16 | */ |
17 | 17 | |
18 | 18 | public class GrandeAdapter extends BaseAdapter{ |
19 | - ArrayList<GradeInfo.DataBean> objects; | |
19 | + ArrayList<GradeInfo.DataBean.ChildrenBean> objects; | |
20 | 20 | private Context context; |
21 | 21 | |
22 | - public GrandeAdapter(ArrayList<GradeInfo.DataBean> objects, Context context) { | |
22 | + public GrandeAdapter(ArrayList<GradeInfo.DataBean.ChildrenBean> objects, Context context) { | |
23 | 23 | this.objects = objects; |
24 | 24 | this.context = context; |
25 | 25 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CitysListDialog.java
... | ... | @@ -19,7 +19,6 @@ import com.hjx.personalcenter.http.HttpCode; |
19 | 19 | import com.hjx.personalcenter.http.HttpManager; |
20 | 20 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
21 | 21 | import com.hjx.personalcenter.model.CityInfo; |
22 | -import com.hjx.personalcenter.model.ProvinceInfo; | |
23 | 22 | import com.mylhyl.circledialog.BaseCircleDialog; |
24 | 23 | import com.mylhyl.circledialog.res.values.CircleDimen; |
25 | 24 | |
... | ... | @@ -65,7 +64,7 @@ public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnI |
65 | 64 | |
66 | 65 | @Override |
67 | 66 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
68 | - return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); | |
67 | + return inflater.inflate(R.layout.custom_adilog_cityslist, container, false); | |
69 | 68 | } |
70 | 69 | |
71 | 70 | @Override |
... | ... | @@ -77,7 +76,7 @@ public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnI |
77 | 76 | listView.setAdapter(listadapter); |
78 | 77 | listView.setOnItemClickListener(this); |
79 | 78 | try { |
80 | - int a = Integer.parseInt(citys); | |
79 | + long a = Long.parseLong(citys); | |
81 | 80 | HttpManager.getInstance().cityinfo(getActivity(),a,handler); |
82 | 81 | } catch (NumberFormatException e) { |
83 | 82 | e.printStackTrace(); | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CountryDialog.java
... | ... | @@ -13,13 +13,11 @@ import android.widget.AdapterView; |
13 | 13 | import android.widget.ListView; |
14 | 14 | |
15 | 15 | import com.hjx.personalcenter.R; |
16 | -import com.hjx.personalcenter.adapter.CitysAdapter; | |
17 | 16 | import com.hjx.personalcenter.adapter.CountryAdapter; |
18 | 17 | import com.hjx.personalcenter.db.SaveParam; |
19 | 18 | import com.hjx.personalcenter.http.HttpCode; |
20 | 19 | import com.hjx.personalcenter.http.HttpManager; |
21 | 20 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
22 | -import com.hjx.personalcenter.model.CityInfo; | |
23 | 21 | import com.hjx.personalcenter.model.CountyInfo; |
24 | 22 | import com.mylhyl.circledialog.BaseCircleDialog; |
25 | 23 | import com.mylhyl.circledialog.res.values.CircleDimen; |
... | ... | @@ -55,6 +53,7 @@ public class CountryDialog extends BaseCircleDialog implements AdapterView.OnIte |
55 | 53 | super.handleMessage(msg); |
56 | 54 | switch (msg.what){ |
57 | 55 | case HttpCode.COUNTRY: |
56 | + | |
58 | 57 | data.clear(); |
59 | 58 | data.addAll( (List<CountyInfo.CountiesBean>)msg.obj); |
60 | 59 | listadapter.notifyDataSetChanged(); |
... | ... | @@ -65,7 +64,7 @@ public class CountryDialog extends BaseCircleDialog implements AdapterView.OnIte |
65 | 64 | |
66 | 65 | @Override |
67 | 66 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
68 | - return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); | |
67 | + return inflater.inflate(R.layout.custom_adilog_countrylist, container, false); | |
69 | 68 | } |
70 | 69 | |
71 | 70 | @Override | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/GradeListDialog.java
... | ... | @@ -3,23 +3,27 @@ package com.hjx.personalcenter.customdialog; |
3 | 3 | import android.content.Context; |
4 | 4 | import android.graphics.Color; |
5 | 5 | import android.os.Bundle; |
6 | +import android.os.Handler; | |
7 | +import android.os.Message; | |
6 | 8 | import android.view.Gravity; |
7 | 9 | import android.view.LayoutInflater; |
8 | 10 | import android.view.View; |
9 | 11 | import android.view.ViewGroup; |
10 | 12 | import android.widget.AdapterView; |
11 | 13 | import android.widget.ListView; |
12 | -import android.widget.Toast; | |
13 | 14 | |
14 | 15 | import com.hjx.personalcenter.R; |
15 | 16 | import com.hjx.personalcenter.adapter.GrandeAdapter; |
16 | 17 | import com.hjx.personalcenter.db.SaveParam; |
18 | +import com.hjx.personalcenter.http.HttpCode; | |
17 | 19 | import com.hjx.personalcenter.http.HttpManager; |
20 | +import com.hjx.personalcenter.interfaces.DialogCallBack; | |
18 | 21 | import com.hjx.personalcenter.model.GradeInfo; |
19 | 22 | import com.mylhyl.circledialog.BaseCircleDialog; |
20 | 23 | import com.mylhyl.circledialog.res.values.CircleDimen; |
21 | 24 | |
22 | 25 | import java.util.ArrayList; |
26 | +import java.util.List; | |
23 | 27 | |
24 | 28 | /**自定义年级列表对话框 |
25 | 29 | * Created by h on 2017/8/10. |
... | ... | @@ -28,9 +32,13 @@ import java.util.ArrayList; |
28 | 32 | public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
29 | 33 | private GrandeAdapter listadapter; |
30 | 34 | private ListView listView; |
31 | - ArrayList<GradeInfo.DataBean> data = new ArrayList<>(); | |
32 | - public static GradeListDialog getInstance() { | |
33 | - GradeListDialog dialogFragment = new GradeListDialog(); | |
35 | + ArrayList<GradeInfo.DataBean.ChildrenBean> data = new ArrayList<>(); | |
36 | + private DialogCallBack.CallBack mCallBack; | |
37 | + public GradeListDialog(DialogCallBack.CallBack callBack) { | |
38 | + this.mCallBack = callBack; | |
39 | + } | |
40 | + public static GradeListDialog getInstance(DialogCallBack.CallBack callBack) { | |
41 | + GradeListDialog dialogFragment = new GradeListDialog(callBack); | |
34 | 42 | dialogFragment.setCanceledBack(true); |
35 | 43 | dialogFragment.setCanceledOnTouchOutside(true); |
36 | 44 | dialogFragment.setRadius(CircleDimen.RADIUS); |
... | ... | @@ -39,6 +47,19 @@ public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnI |
39 | 47 | dialogFragment.setBackgroundColor(Color.WHITE); |
40 | 48 | return dialogFragment; |
41 | 49 | } |
50 | + Handler handler = new Handler(){ | |
51 | + @Override | |
52 | + public void handleMessage(Message msg) { | |
53 | + super.handleMessage(msg); | |
54 | + switch (msg.what){ | |
55 | + case HttpCode.GRADER: | |
56 | + data.clear(); | |
57 | + data.addAll( (List<GradeInfo.DataBean.ChildrenBean>)msg.obj); | |
58 | + listadapter.notifyDataSetChanged(); | |
59 | + break; | |
60 | + } | |
61 | + } | |
62 | + }; | |
42 | 63 | @Override |
43 | 64 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
44 | 65 | |
... | ... | @@ -48,29 +69,20 @@ public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnI |
48 | 69 | public void onActivityCreated(Bundle savedInstanceState) { |
49 | 70 | super.onActivityCreated(savedInstanceState); |
50 | 71 | listView = (ListView) getView().findViewById(R.id.listadapter); |
51 | - String gradens = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | |
52 | - if (gradens != null) { | |
53 | - | |
54 | - for (int i = 0; i < gradens.split(",").length; i++) { | |
55 | - GradeInfo.DataBean dataBean = new GradeInfo.DataBean(); | |
56 | - dataBean.setName(gradens.split(",")[i]); | |
57 | - data.add(dataBean); | |
58 | - } | |
59 | - } else { | |
60 | - HttpManager.getInstance().getgrade(getActivity()); | |
61 | - } | |
62 | 72 | listadapter = new GrandeAdapter(data,getActivity()); |
63 | 73 | listView.setAdapter(listadapter); |
64 | 74 | listView.setOnItemClickListener(this); |
75 | + HttpManager.getInstance().getgrade(getActivity(),handler); | |
65 | 76 | |
66 | 77 | } |
67 | 78 | |
68 | 79 | @Override |
69 | 80 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
70 | 81 | |
71 | - Toast.makeText(getActivity(),"你点击了第"+position+"个",Toast.LENGTH_LONG).show(); | |
72 | - | |
82 | + SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.GRADENS, ""+data.get(position).getId()); | |
83 | + mCallBack.provinceOnItemClick(parent,view,position,id,5); | |
73 | 84 | dismiss(); |
74 | 85 | |
86 | + | |
75 | 87 | } |
76 | 88 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/HeadDialog.java
... | ... | @@ -2,10 +2,13 @@ package com.hjx.personalcenter.customdialog; |
2 | 2 | |
3 | 3 | import android.content.Context; |
4 | 4 | import android.graphics.Color; |
5 | +import android.os.Bundle; | |
5 | 6 | import android.view.Gravity; |
6 | 7 | import android.view.LayoutInflater; |
7 | 8 | import android.view.View; |
8 | 9 | import android.view.ViewGroup; |
10 | +import android.widget.LinearLayout; | |
11 | +import android.widget.TextView; | |
9 | 12 | |
10 | 13 | import com.hjx.personalcenter.R; |
11 | 14 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
... | ... | @@ -16,13 +19,16 @@ import com.mylhyl.circledialog.res.values.CircleDimen; |
16 | 19 | * Created by h on 2017/8/20. |
17 | 20 | */ |
18 | 21 | |
19 | -public class HeadDialog extends BaseCircleDialog { | |
22 | +public class HeadDialog extends BaseCircleDialog implements View.OnClickListener { | |
20 | 23 | private View mView; |
24 | + private TextView oktakephone, cancetakephone; | |
25 | + private LinearLayout take_pic,xiangce; | |
21 | 26 | private DialogCallBack.CallBackView mCallBack; |
22 | 27 | |
23 | 28 | public HeadDialog(DialogCallBack.CallBackView callBack) { |
24 | 29 | this.mCallBack = callBack; |
25 | 30 | } |
31 | + | |
26 | 32 | public static HeadDialog getInstance(DialogCallBack.CallBackView callBackview) { |
27 | 33 | HeadDialog dialogFragment = new HeadDialog(callBackview); |
28 | 34 | dialogFragment.setCanceledBack(true); |
... | ... | @@ -39,8 +45,28 @@ public class HeadDialog extends BaseCircleDialog { |
39 | 45 | |
40 | 46 | if (mView == null) { |
41 | 47 | mView = inflater.inflate(R.layout.custom_adilog_lhead, container, false); |
42 | - mCallBack.provinceOnItemClick(context,inflater,container); | |
43 | 48 | } |
44 | 49 | return mView; |
45 | 50 | } |
51 | + | |
52 | + @Override | |
53 | + public void onActivityCreated(Bundle savedInstanceState) { | |
54 | + super.onActivityCreated(savedInstanceState); | |
55 | + oktakephone = (TextView) mView.findViewById(R.id.oktakephone); | |
56 | + cancetakephone = (TextView) mView.findViewById(R.id.canceltakephone); | |
57 | + take_pic = (LinearLayout) mView.findViewById(R.id.take_pic); | |
58 | + xiangce = (LinearLayout) mView.findViewById(R.id.xiangce); | |
59 | + oktakephone.setOnClickListener(this); | |
60 | + cancetakephone.setOnClickListener(this); | |
61 | + take_pic.setOnClickListener(this); | |
62 | + xiangce.setOnClickListener(this); | |
63 | + | |
64 | + | |
65 | + } | |
66 | + | |
67 | + @Override | |
68 | + public void onClick(View v) { | |
69 | + mCallBack.heard(getActivity(), v); | |
70 | + dismiss(); | |
71 | + } | |
46 | 72 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/ProvinceListDialog.java
... | ... | @@ -13,7 +13,6 @@ import android.widget.AdapterView; |
13 | 13 | import android.widget.ListView; |
14 | 14 | |
15 | 15 | import com.hjx.personalcenter.R; |
16 | -import com.hjx.personalcenter.activity.RegisterInfoActivity; | |
17 | 16 | import com.hjx.personalcenter.adapter.ProvincesAdapter; |
18 | 17 | import com.hjx.personalcenter.db.SaveParam; |
19 | 18 | import com.hjx.personalcenter.http.HttpCode; |
... | ... | @@ -47,6 +46,7 @@ public class ProvinceListDialog extends BaseCircleDialog implements AdapterView. |
47 | 46 | data.clear(); |
48 | 47 | data.addAll( (List<ProvinceInfo.ProvincesBean>)msg.obj); |
49 | 48 | listadapter.notifyDataSetChanged(); |
49 | + | |
50 | 50 | break; |
51 | 51 | } |
52 | 52 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/SchoolListDialog.java
... | ... | @@ -16,13 +16,11 @@ import android.widget.EditText; |
16 | 16 | import android.widget.ListView; |
17 | 17 | |
18 | 18 | import com.hjx.personalcenter.R; |
19 | -import com.hjx.personalcenter.activity.RegisterInfoActivity; | |
20 | 19 | import com.hjx.personalcenter.adapter.SchoolAdapter; |
21 | 20 | import com.hjx.personalcenter.db.SaveParam; |
22 | 21 | import com.hjx.personalcenter.http.HttpCode; |
23 | 22 | import com.hjx.personalcenter.http.HttpManager; |
24 | 23 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
25 | -import com.hjx.personalcenter.model.CountyInfo; | |
26 | 24 | import com.hjx.personalcenter.model.SchoolInfo; |
27 | 25 | import com.mylhyl.circledialog.BaseCircleDialog; |
28 | 26 | import com.mylhyl.circledialog.res.values.CircleDimen; |
... | ... | @@ -34,21 +32,24 @@ import java.util.List; |
34 | 32 | * Created by h on 2017/8/21. |
35 | 33 | */ |
36 | 34 | |
37 | -public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener, View.OnClickListener { | |
35 | +public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | |
38 | 36 | private ListView school_list; |
39 | 37 | private EditText school_sech; |
40 | 38 | private SchoolAdapter listadapter; |
41 | 39 | private View mView; |
42 | 40 | boolean isFilter; |
43 | - private DialogCallBack.CallBackView mCallBack; | |
44 | 41 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); |
42 | + private DialogCallBack.CallBack mCallBack; | |
45 | 43 | |
46 | 44 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { |
47 | 45 | // this.mCallBack = callBack; |
48 | 46 | // } |
47 | + public SchoolListDialog(DialogCallBack.CallBack callBack) { | |
48 | + this.mCallBack = callBack; | |
49 | + } | |
49 | 50 | |
50 | - public static SchoolListDialog getInstance() { | |
51 | - SchoolListDialog dialogFragment = new SchoolListDialog(); | |
51 | + public static SchoolListDialog getInstance(DialogCallBack.CallBack mCallBack) { | |
52 | + SchoolListDialog dialogFragment = new SchoolListDialog(mCallBack); | |
52 | 53 | dialogFragment.setCanceledBack(true); |
53 | 54 | dialogFragment.setCanceledOnTouchOutside(true); |
54 | 55 | dialogFragment.setRadius(CircleDimen.RADIUS); |
... | ... | @@ -57,6 +58,7 @@ public class SchoolListDialog extends BaseCircleDialog implements AdapterView.On |
57 | 58 | dialogFragment.setBackgroundColor(Color.WHITE); |
58 | 59 | return dialogFragment; |
59 | 60 | } |
61 | + | |
60 | 62 | Handler handler = new Handler(){ |
61 | 63 | @Override |
62 | 64 | public void handleMessage(Message msg) { |
... | ... | @@ -70,6 +72,8 @@ public class SchoolListDialog extends BaseCircleDialog implements AdapterView.On |
70 | 72 | } |
71 | 73 | } |
72 | 74 | }; |
75 | + | |
76 | + | |
73 | 77 | @Override |
74 | 78 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
75 | 79 | |
... | ... | @@ -86,13 +90,14 @@ public class SchoolListDialog extends BaseCircleDialog implements AdapterView.On |
86 | 90 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); |
87 | 91 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); |
88 | 92 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
93 | + String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | |
89 | 94 | listadapter = new SchoolAdapter(data, getActivity()); |
90 | 95 | school_list.setAdapter(listadapter); |
91 | 96 | school_list.setOnItemClickListener(this); |
92 | - school_sech.setOnClickListener(this); | |
93 | 97 | try { |
94 | 98 | int a = Integer.parseInt(citys); |
95 | - HttpManager.getInstance().getschool(getActivity(),a,14,handler); | |
99 | + int b = Integer.parseInt(grade); | |
100 | + HttpManager.getInstance().getschool(getActivity(),130102,14,handler); | |
96 | 101 | } catch (NumberFormatException e) { |
97 | 102 | e.printStackTrace(); |
98 | 103 | } |
... | ... | @@ -122,12 +127,9 @@ public class SchoolListDialog extends BaseCircleDialog implements AdapterView.On |
122 | 127 | } |
123 | 128 | |
124 | 129 | @Override |
125 | - public void onClick(View v) { | |
126 | - | |
127 | - } | |
128 | - | |
129 | - @Override | |
130 | 130 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
131 | + mCallBack.provinceOnItemClick(parent,view,position,id,4); | |
132 | + dismiss(); | |
131 | 133 | |
132 | 134 | } |
133 | 135 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
1 | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | |
3 | +import android.app.Activity; | |
3 | 4 | import android.graphics.Color; |
4 | 5 | import android.os.Bundle; |
5 | 6 | import android.support.annotation.Nullable; |
6 | 7 | import android.support.v4.app.Fragment; |
8 | +import android.view.Gravity; | |
7 | 9 | import android.view.LayoutInflater; |
8 | 10 | import android.view.View; |
9 | 11 | import android.view.ViewGroup; |
12 | +import android.widget.AdapterView; | |
10 | 13 | import android.widget.EditText; |
11 | 14 | import android.widget.TextView; |
12 | 15 | |
13 | 16 | import com.bigkoo.pickerview.TimePickerView; |
14 | 17 | import com.hjx.personalcenter.R; |
15 | 18 | import com.hjx.personalcenter.util.AlertUtils; |
19 | +import com.mylhyl.circledialog.CircleDialog; | |
20 | +import com.mylhyl.circledialog.callback.ConfigButton; | |
21 | +import com.mylhyl.circledialog.callback.ConfigDialog; | |
22 | +import com.mylhyl.circledialog.params.ButtonParams; | |
23 | +import com.mylhyl.circledialog.params.DialogParams; | |
16 | 24 | |
17 | 25 | import java.text.SimpleDateFormat; |
18 | 26 | import java.util.Date; |
... | ... | @@ -78,19 +86,60 @@ public class PresonInfoFragment extends Fragment implements View.OnClickListener |
78 | 86 | public void onClick(View v) { |
79 | 87 | switch (v.getId()){ |
80 | 88 | case R.id.tv_sex: |
81 | - AlertUtils.showToast(getActivity(),"正在开发"); | |
89 | + final String[] items = {"男", "女"}; | |
90 | + new CircleDialog.Builder(getActivity()) | |
91 | + .configDialog(new ConfigDialog() { | |
92 | + @Override | |
93 | + public void onConfig(DialogParams params) { | |
94 | + //增加弹出动画 | |
95 | + params.gravity = Gravity.CENTER; | |
96 | + } | |
97 | + }) | |
98 | + .setTitle("请选择性别") | |
99 | + .setWidth(0.5f) | |
100 | + .setItems(items, new AdapterView.OnItemClickListener() { | |
101 | + @Override | |
102 | + public void onItemClick(AdapterView<?> parent, View view, int | |
103 | + position, long id) { | |
104 | + switch (position){ | |
105 | + case 0: | |
106 | + tv_sex.setText("男"); | |
107 | + break; | |
108 | + case 1: | |
109 | + tv_sex.setText("女"); | |
110 | + break; | |
111 | + } | |
112 | + | |
113 | + } | |
114 | + }) | |
115 | + .setNegative("取消", null) | |
116 | + .configNegative(new ConfigButton() { | |
117 | + @Override | |
118 | + public void onConfig(ButtonParams params) { | |
119 | + //取消按钮字体颜色 | |
120 | + params.textColor = Color.RED; | |
121 | + } | |
122 | + }) | |
123 | + .show(); | |
82 | 124 | break; |
83 | 125 | case R.id.tv_useinfo_adress: |
84 | - AlertUtils.showToast(getActivity(),"正在开发"); | |
126 | + //ProvinceListDialog.getInstance(getActivity()).show(getSupportFragmentManager(), "ProvinceListDialog"); | |
85 | 127 | break; |
86 | 128 | case R.id.tv_useinfo_birthday: |
87 | 129 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
88 | 130 | break; |
89 | 131 | case R.id.tv_useinfo_school: |
90 | - AlertUtils.showToast(getActivity(),"正在开发"); | |
132 | + //SchoolListDialog.getInstance(getActivity()).show(getSupportFragmentManager(), "SchoolListDialog"); | |
133 | + | |
91 | 134 | break; |
92 | 135 | case R.id.tv_useinfo_gender: |
93 | - AlertUtils.showToast(getActivity(),"正在开发"); | |
136 | + //GradeListDialog.getInstance(getActivity()).show(getSupportFragmentManager(), "GradeListDialog"); | |
137 | + break; | |
138 | + case R.id.presonal_sub: | |
139 | + AlertUtils.showToast(getActivity(),"你点击了提交"); | |
140 | + //保存星座 | |
141 | +// BrithdayStar brithdayStar = new BrithdayStar(); | |
142 | +// String s =brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | |
94 | 143 | break; |
95 | 144 | } |
96 | 145 | } |
... | ... | @@ -135,4 +184,12 @@ public class PresonInfoFragment extends Fragment implements View.OnClickListener |
135 | 184 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
136 | 185 | return format.format(date); |
137 | 186 | } |
187 | + | |
188 | + @Override | |
189 | + public void onAttach(Activity activity) { | |
190 | + super.onAttach(activity); | |
191 | + View rootView = activity.getWindow().getDecorView(); | |
192 | + TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | |
193 | + sub.setOnClickListener(this); | |
194 | + } | |
138 | 195 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
... | ... | @@ -20,6 +20,7 @@ import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
20 | 20 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
21 | 21 | import com.hjx.personalcenter.db.SaveParam; |
22 | 22 | import com.hjx.personalcenter.gson.GsonTool; |
23 | +import com.hjx.personalcenter.model.CardInfo; | |
23 | 24 | import com.hjx.personalcenter.model.CityInfo; |
24 | 25 | import com.hjx.personalcenter.model.CountyInfo; |
25 | 26 | import com.hjx.personalcenter.model.GradeInfo; |
... | ... | @@ -492,10 +493,12 @@ public class HttpManager { |
492 | 493 | @Override |
493 | 494 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
494 | 495 | closeProgress(); |
495 | - Log.e("test", "省" + new String(arg2)); | |
496 | + Log.e("test", "保卡信息" + new String(arg2)); | |
497 | + CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | |
498 | + CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | |
496 | 499 | Message msg = Message.obtain(); |
497 | 500 | msg.what = HttpCode.SUCHCARDINFO; |
498 | - msg.obj = new String(arg2); | |
501 | + msg.obj = schoolInfoBeanList; | |
499 | 502 | handler.sendMessage(msg); |
500 | 503 | } |
501 | 504 | |
... | ... | @@ -673,20 +676,22 @@ public class HttpManager { |
673 | 676 | } |
674 | 677 | |
675 | 678 | ///获取年级 |
676 | - public void getgrade(final Context mContext) { | |
679 | + public void getgrade(final Context mContext, final Handler handler) { | |
677 | 680 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
678 | 681 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
679 | 682 | @Override |
680 | 683 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
681 | 684 | Log.e("test", "年级" + new String(arg2)); |
682 | - GradeInfo gradensInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | |
683 | - StringBuffer sb = new StringBuffer(); | |
684 | - for (int i = 0; i < gradensInfo.getData().size(); i++) { | |
685 | - sb.append(gradensInfo.getData().get(i).getName() + ","); | |
686 | - | |
685 | + GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | |
686 | + List<GradeInfo.DataBean.ChildrenBean> gradeInfoBeanList = null; | |
687 | + for (int i = 0 ;i<3;i++) { | |
688 | + gradeInfoBeanList=(gradeInfo.getData().get(i).getChildren()); | |
687 | 689 | } |
688 | - Log.e("test", "年级" + sb.toString()); | |
689 | - SaveParam.getInstance().saveLoginParam(mContext, SaveParam.GRADENS, "" + sb.toString()); | |
690 | + | |
691 | + Message message = Message.obtain(); | |
692 | + message.what = HttpCode.GRADER; | |
693 | + message.obj = gradeInfoBeanList; | |
694 | + handler.sendMessage(message); | |
690 | 695 | |
691 | 696 | |
692 | 697 | } |
... | ... | @@ -809,7 +814,7 @@ public class HttpManager { |
809 | 814 | } |
810 | 815 | |
811 | 816 | //市级接口 |
812 | - public void cityinfo(final Context mContext, int regionId , final Handler handler) { | |
817 | + public void cityinfo(final Context mContext, long regionId , final Handler handler) { | |
813 | 818 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
814 | 819 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
815 | 820 | @Override | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/interfaces/DialogCallBack.java
1 | 1 | package com.hjx.personalcenter.interfaces; |
2 | 2 | |
3 | 3 | import android.content.Context; |
4 | -import android.view.LayoutInflater; | |
5 | 4 | import android.view.View; |
6 | -import android.view.ViewGroup; | |
7 | 5 | import android.widget.AdapterView; |
8 | 6 | |
9 | 7 | /** |
... | ... | @@ -11,10 +9,12 @@ import android.widget.AdapterView; |
11 | 9 | */ |
12 | 10 | |
13 | 11 | public class DialogCallBack { |
12 | + //对话框回调 | |
14 | 13 | public interface CallBack{ |
15 | 14 | void provinceOnItemClick(AdapterView<?> parent, View view, int position, long id,int type); |
16 | 15 | } |
16 | + //头像回调 | |
17 | 17 | public interface CallBackView{ |
18 | - void provinceOnItemClick(Context context, LayoutInflater inflater, ViewGroup container); | |
18 | + void heard(Context context,View v); | |
19 | 19 | } |
20 | 20 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/CardInfo.java
... | ... | @@ -7,107 +7,163 @@ package com.hjx.personalcenter.model; |
7 | 7 | public class CardInfo { |
8 | 8 | |
9 | 9 | /** |
10 | - * customerName : FuQiang | |
11 | - * createTime : 2017-08-01 13:21:00 | |
12 | - * mobilePhone : 13162530008 | |
13 | - * buyTime : 2017-08-01 12:23:50 | |
14 | - * productModel : GT-N7100 | |
15 | - * buyAddress : HaojixingZhengZhou | |
16 | - * customerAddress : HeNamZhengSheng | |
17 | - * alterSaleCall : 4022210201 | |
18 | - * macAddress : 00:22:F4:93:7A:B | |
19 | - | |
20 | - * deviceNumber : A909A90997011012 | |
10 | + * status : 1 | |
11 | + * pageSize : 1 | |
12 | + * data : {"customerName":"FuQiang","createTime":"2017-08-01 13:21:00","mobilePhone":"13162530008","buyTime":"2017-08-01 12:23:50","productModel":"GT-N7100","buyAddress":"HaojixingZhengZhou","customerAddress":"HeNamZhengSheng","alterSaleCall":"4022210201","macAddress":"00:22:F4:93:7A:B\n","deviceNumber":"A909A90997011012"} | |
13 | + * msg : success | |
14 | + * pageNum : 9 | |
21 | 15 | */ |
22 | 16 | |
23 | - private String customerName; | |
24 | - private String createTime; | |
25 | - private String mobilePhone; | |
26 | - private String buyTime; | |
27 | - private String productModel; | |
28 | - private String buyAddress; | |
29 | - private String customerAddress; | |
30 | - private String alterSaleCall; | |
31 | - private String macAddress; | |
32 | - private String deviceNumber; | |
33 | - | |
34 | - public String getCustomerName() { | |
35 | - return customerName; | |
36 | - } | |
17 | + private int status; | |
18 | + private int pageSize; | |
19 | + private DataBean data; | |
20 | + private String msg; | |
21 | + private int pageNum; | |
37 | 22 | |
38 | - public void setCustomerName(String customerName) { | |
39 | - this.customerName = customerName; | |
23 | + public int getStatus() { | |
24 | + return status; | |
40 | 25 | } |
41 | 26 | |
42 | - public String getCreateTime() { | |
43 | - return createTime; | |
27 | + public void setStatus(int status) { | |
28 | + this.status = status; | |
44 | 29 | } |
45 | 30 | |
46 | - public void setCreateTime(String createTime) { | |
47 | - this.createTime = createTime; | |
31 | + public int getPageSize() { | |
32 | + return pageSize; | |
48 | 33 | } |
49 | 34 | |
50 | - public String getMobilePhone() { | |
51 | - return mobilePhone; | |
35 | + public void setPageSize(int pageSize) { | |
36 | + this.pageSize = pageSize; | |
52 | 37 | } |
53 | 38 | |
54 | - public void setMobilePhone(String mobilePhone) { | |
55 | - this.mobilePhone = mobilePhone; | |
39 | + public DataBean getData() { | |
40 | + return data; | |
56 | 41 | } |
57 | 42 | |
58 | - public String getBuyTime() { | |
59 | - return buyTime; | |
43 | + public void setData(DataBean data) { | |
44 | + this.data = data; | |
60 | 45 | } |
61 | 46 | |
62 | - public void setBuyTime(String buyTime) { | |
63 | - this.buyTime = buyTime; | |
47 | + public String getMsg() { | |
48 | + return msg; | |
64 | 49 | } |
65 | 50 | |
66 | - public String getProductModel() { | |
67 | - return productModel; | |
51 | + public void setMsg(String msg) { | |
52 | + this.msg = msg; | |
68 | 53 | } |
69 | 54 | |
70 | - public void setProductModel(String productModel) { | |
71 | - this.productModel = productModel; | |
55 | + public int getPageNum() { | |
56 | + return pageNum; | |
72 | 57 | } |
73 | 58 | |
74 | - public String getBuyAddress() { | |
75 | - return buyAddress; | |
59 | + public void setPageNum(int pageNum) { | |
60 | + this.pageNum = pageNum; | |
76 | 61 | } |
77 | 62 | |
78 | - public void setBuyAddress(String buyAddress) { | |
79 | - this.buyAddress = buyAddress; | |
80 | - } | |
63 | + public static class DataBean { | |
64 | + /** | |
65 | + * customerName : FuQiang | |
66 | + * createTime : 2017-08-01 13:21:00 | |
67 | + * mobilePhone : 13162530008 | |
68 | + * buyTime : 2017-08-01 12:23:50 | |
69 | + * productModel : GT-N7100 | |
70 | + * buyAddress : HaojixingZhengZhou | |
71 | + * customerAddress : HeNamZhengSheng | |
72 | + * alterSaleCall : 4022210201 | |
73 | + * macAddress : 00:22:F4:93:7A:B | |
81 | 74 | |
82 | - public String getCustomerAddress() { | |
83 | - return customerAddress; | |
84 | - } | |
75 | + * deviceNumber : A909A90997011012 | |
76 | + */ | |
85 | 77 | |
86 | - public void setCustomerAddress(String customerAddress) { | |
87 | - this.customerAddress = customerAddress; | |
88 | - } | |
78 | + private String customerName; | |
79 | + private String createTime; | |
80 | + private String mobilePhone; | |
81 | + private String buyTime; | |
82 | + private String productModel; | |
83 | + private String buyAddress; | |
84 | + private String customerAddress; | |
85 | + private String alterSaleCall; | |
86 | + private String macAddress; | |
87 | + private String deviceNumber; | |
89 | 88 | |
90 | - public String getAlterSaleCall() { | |
91 | - return alterSaleCall; | |
92 | - } | |
89 | + public String getCustomerName() { | |
90 | + return customerName; | |
91 | + } | |
93 | 92 | |
94 | - public void setAlterSaleCall(String alterSaleCall) { | |
95 | - this.alterSaleCall = alterSaleCall; | |
96 | - } | |
93 | + public void setCustomerName(String customerName) { | |
94 | + this.customerName = customerName; | |
95 | + } | |
97 | 96 | |
98 | - public String getMacAddress() { | |
99 | - return macAddress; | |
100 | - } | |
97 | + public String getCreateTime() { | |
98 | + return createTime; | |
99 | + } | |
101 | 100 | |
102 | - public void setMacAddress(String macAddress) { | |
103 | - this.macAddress = macAddress; | |
104 | - } | |
101 | + public void setCreateTime(String createTime) { | |
102 | + this.createTime = createTime; | |
103 | + } | |
105 | 104 | |
106 | - public String getDeviceNumber() { | |
107 | - return deviceNumber; | |
108 | - } | |
105 | + public String getMobilePhone() { | |
106 | + return mobilePhone; | |
107 | + } | |
108 | + | |
109 | + public void setMobilePhone(String mobilePhone) { | |
110 | + this.mobilePhone = mobilePhone; | |
111 | + } | |
112 | + | |
113 | + public String getBuyTime() { | |
114 | + return buyTime; | |
115 | + } | |
116 | + | |
117 | + public void setBuyTime(String buyTime) { | |
118 | + this.buyTime = buyTime; | |
119 | + } | |
120 | + | |
121 | + public String getProductModel() { | |
122 | + return productModel; | |
123 | + } | |
124 | + | |
125 | + public void setProductModel(String productModel) { | |
126 | + this.productModel = productModel; | |
127 | + } | |
128 | + | |
129 | + public String getBuyAddress() { | |
130 | + return buyAddress; | |
131 | + } | |
132 | + | |
133 | + public void setBuyAddress(String buyAddress) { | |
134 | + this.buyAddress = buyAddress; | |
135 | + } | |
136 | + | |
137 | + public String getCustomerAddress() { | |
138 | + return customerAddress; | |
139 | + } | |
140 | + | |
141 | + public void setCustomerAddress(String customerAddress) { | |
142 | + this.customerAddress = customerAddress; | |
143 | + } | |
144 | + | |
145 | + public String getAlterSaleCall() { | |
146 | + return alterSaleCall; | |
147 | + } | |
109 | 148 | |
110 | - public void setDeviceNumber(String deviceNumber) { | |
111 | - this.deviceNumber = deviceNumber; | |
149 | + public void setAlterSaleCall(String alterSaleCall) { | |
150 | + this.alterSaleCall = alterSaleCall; | |
151 | + } | |
152 | + | |
153 | + public String getMacAddress() { | |
154 | + return macAddress; | |
155 | + } | |
156 | + | |
157 | + public void setMacAddress(String macAddress) { | |
158 | + this.macAddress = macAddress; | |
159 | + } | |
160 | + | |
161 | + public String getDeviceNumber() { | |
162 | + return deviceNumber; | |
163 | + } | |
164 | + | |
165 | + public void setDeviceNumber(String deviceNumber) { | |
166 | + this.deviceNumber = deviceNumber; | |
167 | + } | |
112 | 168 | } |
113 | 169 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/CityInfo.java
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/CountyInfo.java
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/PesonalInfo.java
... | ... | @@ -0,0 +1,218 @@ |
1 | +package com.hjx.personalcenter.model; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | + | |
5 | +/** | |
6 | + * Created by h on 2017/8/22. | |
7 | + */ | |
8 | + | |
9 | +public class PesonalInfo implements Serializable{ | |
10 | + | |
11 | + /** | |
12 | + * status : 1 | |
13 | + * pageSize : 0 | |
14 | + * data : {"region":{"regionName":"闵行区","regionId":"310112"},"nickName":"1688kkkkkkkkk","gender":"female","school":{"schoolId":"499705","schoolName":"上海五中"},"grade":{"gradeName":"初中六年级","gradeId":"9"},"birthday":"2017-09-12","qq":"1666600"} | |
15 | + * msg : success | |
16 | + * pageNum : 0 | |
17 | + */ | |
18 | + | |
19 | + private int status; | |
20 | + private int pageSize; | |
21 | + private DataBean data; | |
22 | + private String msg; | |
23 | + private int pageNum; | |
24 | + | |
25 | + public int getStatus() { | |
26 | + return status; | |
27 | + } | |
28 | + | |
29 | + public void setStatus(int status) { | |
30 | + this.status = status; | |
31 | + } | |
32 | + | |
33 | + public int getPageSize() { | |
34 | + return pageSize; | |
35 | + } | |
36 | + | |
37 | + public void setPageSize(int pageSize) { | |
38 | + this.pageSize = pageSize; | |
39 | + } | |
40 | + | |
41 | + public DataBean getData() { | |
42 | + return data; | |
43 | + } | |
44 | + | |
45 | + public void setData(DataBean data) { | |
46 | + this.data = data; | |
47 | + } | |
48 | + | |
49 | + public String getMsg() { | |
50 | + return msg; | |
51 | + } | |
52 | + | |
53 | + public void setMsg(String msg) { | |
54 | + this.msg = msg; | |
55 | + } | |
56 | + | |
57 | + public int getPageNum() { | |
58 | + return pageNum; | |
59 | + } | |
60 | + | |
61 | + public void setPageNum(int pageNum) { | |
62 | + this.pageNum = pageNum; | |
63 | + } | |
64 | + | |
65 | + public static class DataBean { | |
66 | + /** | |
67 | + * region : {"regionName":"闵行区","regionId":"310112"} | |
68 | + * nickName : 1688kkkkkkkkk | |
69 | + * gender : female | |
70 | + * school : {"schoolId":"499705","schoolName":"上海五中"} | |
71 | + * grade : {"gradeName":"初中六年级","gradeId":"9"} | |
72 | + * birthday : 2017-09-12 | |
73 | + * qq : 1666600 | |
74 | + */ | |
75 | + | |
76 | + private RegionBean region; | |
77 | + private String nickName; | |
78 | + private String gender; | |
79 | + private SchoolBean school; | |
80 | + private GradeBean grade; | |
81 | + private String birthday; | |
82 | + private String qq; | |
83 | + | |
84 | + public RegionBean getRegion() { | |
85 | + return region; | |
86 | + } | |
87 | + | |
88 | + public void setRegion(RegionBean region) { | |
89 | + this.region = region; | |
90 | + } | |
91 | + | |
92 | + public String getNickName() { | |
93 | + return nickName; | |
94 | + } | |
95 | + | |
96 | + public void setNickName(String nickName) { | |
97 | + this.nickName = nickName; | |
98 | + } | |
99 | + | |
100 | + public String getGender() { | |
101 | + return gender; | |
102 | + } | |
103 | + | |
104 | + public void setGender(String gender) { | |
105 | + this.gender = gender; | |
106 | + } | |
107 | + | |
108 | + public SchoolBean getSchool() { | |
109 | + return school; | |
110 | + } | |
111 | + | |
112 | + public void setSchool(SchoolBean school) { | |
113 | + this.school = school; | |
114 | + } | |
115 | + | |
116 | + public GradeBean getGrade() { | |
117 | + return grade; | |
118 | + } | |
119 | + | |
120 | + public void setGrade(GradeBean grade) { | |
121 | + this.grade = grade; | |
122 | + } | |
123 | + | |
124 | + public String getBirthday() { | |
125 | + return birthday; | |
126 | + } | |
127 | + | |
128 | + public void setBirthday(String birthday) { | |
129 | + this.birthday = birthday; | |
130 | + } | |
131 | + | |
132 | + public String getQq() { | |
133 | + return qq; | |
134 | + } | |
135 | + | |
136 | + public void setQq(String qq) { | |
137 | + this.qq = qq; | |
138 | + } | |
139 | + | |
140 | + public static class RegionBean { | |
141 | + /** | |
142 | + * regionName : 闵行区 | |
143 | + * regionId : 310112 | |
144 | + */ | |
145 | + | |
146 | + private String regionName; | |
147 | + private String regionId; | |
148 | + | |
149 | + public String getRegionName() { | |
150 | + return regionName; | |
151 | + } | |
152 | + | |
153 | + public void setRegionName(String regionName) { | |
154 | + this.regionName = regionName; | |
155 | + } | |
156 | + | |
157 | + public String getRegionId() { | |
158 | + return regionId; | |
159 | + } | |
160 | + | |
161 | + public void setRegionId(String regionId) { | |
162 | + this.regionId = regionId; | |
163 | + } | |
164 | + } | |
165 | + | |
166 | + public static class SchoolBean { | |
167 | + /** | |
168 | + * schoolId : 499705 | |
169 | + * schoolName : 上海五中 | |
170 | + */ | |
171 | + | |
172 | + private String schoolId; | |
173 | + private String schoolName; | |
174 | + | |
175 | + public String getSchoolId() { | |
176 | + return schoolId; | |
177 | + } | |
178 | + | |
179 | + public void setSchoolId(String schoolId) { | |
180 | + this.schoolId = schoolId; | |
181 | + } | |
182 | + | |
183 | + public String getSchoolName() { | |
184 | + return schoolName; | |
185 | + } | |
186 | + | |
187 | + public void setSchoolName(String schoolName) { | |
188 | + this.schoolName = schoolName; | |
189 | + } | |
190 | + } | |
191 | + | |
192 | + public static class GradeBean { | |
193 | + /** | |
194 | + * gradeName : 初中六年级 | |
195 | + * gradeId : 9 | |
196 | + */ | |
197 | + | |
198 | + private String gradeName; | |
199 | + private String gradeId; | |
200 | + | |
201 | + public String getGradeName() { | |
202 | + return gradeName; | |
203 | + } | |
204 | + | |
205 | + public void setGradeName(String gradeName) { | |
206 | + this.gradeName = gradeName; | |
207 | + } | |
208 | + | |
209 | + public String getGradeId() { | |
210 | + return gradeId; | |
211 | + } | |
212 | + | |
213 | + public void setGradeId(String gradeId) { | |
214 | + this.gradeId = gradeId; | |
215 | + } | |
216 | + } | |
217 | + } | |
218 | +} | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/BrithdayStar.java
... | ... | @@ -0,0 +1,25 @@ |
1 | +package com.hjx.personalcenter.util; | |
2 | + | |
3 | +/** | |
4 | + * Created by h on 2017/8/22. | |
5 | + */ | |
6 | + | |
7 | +public class BrithdayStar { | |
8 | + String[][] constellations = {{"摩羯座", "水瓶座"}, {"水瓶座", "双鱼座"}, {"双鱼座", "白羊座"}, {"白羊座", "金牛座"}, {"金牛座", "双子座"}, {"双子座", "巨蟹座"}, {"巨蟹座", "狮子座"}, | |
9 | + {"狮子座", "处女座"}, {"处女座", "天秤座"}, {"天秤座", "天蝎座"}, {"天蝎座", "射手座"}, {"射手座", "摩羯座"}}; | |
10 | + //星座分割时间 | |
11 | + int[] date = {20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22}; | |
12 | + //星座生成 传进是日期格式为: yyyy-mm-dd | |
13 | + public String getConstellations(String birthday) { | |
14 | + String become_constellation = null; | |
15 | + String[] data = birthday.split("-"); | |
16 | + int day = date[Integer.parseInt(data[1]) - 1]; | |
17 | + String[] cl1 = constellations[Integer.parseInt(data[1]) - 1]; | |
18 | + if (Integer.parseInt(data[2]) >= day) { | |
19 | + become_constellation =cl1[1]; | |
20 | + } else { | |
21 | + become_constellation=cl1[0]; | |
22 | + } | |
23 | + return become_constellation; | |
24 | + } | |
25 | +} | ... | ... |
PersonalCenter/app/src/main/res/layout/activity_change_preson_info.xml
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | android:textColor="@android:color/white" |
31 | 31 | android:textSize="22sp" /> |
32 | 32 | <TextView |
33 | - android:id="@+id/feedback_sub" | |
33 | + android:id="@+id/presonal_sub" | |
34 | 34 | android:layout_width="wrap_content" |
35 | 35 | android:layout_height="match_parent" |
36 | 36 | android:paddingLeft="20dp" | ... | ... |
PersonalCenter/app/src/main/res/layout/activity_main.xml
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | 3 | android:layout_width="match_parent" |
4 | 4 | android:layout_height="match_parent" |
5 | + xmlns:fresco="http://schemas.android.com/apk/res-auto" | |
5 | 6 | android:orientation="vertical"> |
6 | 7 | |
7 | 8 | <RelativeLayout |
... | ... | @@ -90,13 +91,15 @@ |
90 | 91 | android:padding="10dp" |
91 | 92 | android:layout_marginLeft="20dp" |
92 | 93 | android:src="@mipmap/card_icoc" /> |
93 | - | |
94 | - <ImageView | |
94 | + <com.facebook.drawee.view.SimpleDraweeView | |
95 | 95 | android:id="@+id/iv_head" |
96 | - android:layout_width="wrap_content" | |
97 | - android:layout_height="wrap_content" | |
96 | + android:layout_width="60dp" | |
97 | + android:layout_height="60dp" | |
98 | 98 | android:layout_marginLeft="60dp" |
99 | - android:src="@mipmap/header_default" /> | |
99 | + android:layout_gravity="center" | |
100 | + fresco:placeholderImage="@mipmap/header_default" | |
101 | + fresco:roundAsCircle="true" | |
102 | + fresco:placeholderImageScaleType="fitCenter" /> | |
100 | 103 | |
101 | 104 | <TextView |
102 | 105 | android:layout_width="wrap_content" | ... | ... |
PersonalCenter/app/src/main/res/layout/custom_adilog_cityslist.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> | ... | ... |
PersonalCenter/app/src/main/res/layout/custom_adilog_countrylist.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> | ... | ... |
PersonalCenter/app/src/main/res/layout/custom_adilog_lhead.xml
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | </RelativeLayout> |
23 | 23 | <LinearLayout |
24 | 24 | android:layout_width="match_parent" |
25 | - android:layout_height="225dp" | |
25 | + android:layout_height="230dp" | |
26 | 26 | android:layout_margin="20dp" |
27 | 27 | android:orientation="vertical"> |
28 | 28 | <TextView |
... | ... | @@ -66,6 +66,7 @@ |
66 | 66 | android:layout_marginTop="10dp" |
67 | 67 | android:orientation="horizontal"> |
68 | 68 | <LinearLayout |
69 | + android:id="@+id/take_pic" | |
69 | 70 | android:layout_width="0dp" |
70 | 71 | android:layout_weight="1" |
71 | 72 | android:gravity="center" |
... | ... | @@ -84,6 +85,7 @@ |
84 | 85 | |
85 | 86 | </LinearLayout> |
86 | 87 | <LinearLayout |
88 | + android:id="@+id/xiangce" | |
87 | 89 | android:layout_width="0dp" |
88 | 90 | android:layout_weight="1" |
89 | 91 | android:gravity="center" | ... | ... |