@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (resultCode == RESULT_CANCELED) { return; } else if (resultCode == RESULT_OK) { switch (requestCode) { case CODE_GALLERY_REQUEST: Uri galleryUri = intent.getData(); cropRawPhoto(galleryUri); break; case CODE_CAMERA_REQUEST: cropRawPhoto(mHeadIconUri); break; case CODE_RESULT_REQUEST: if (mHeadIconUri != null) { Bitmap photo = null; try { photo = Media.getBitmap(getContentResolver(), mHeadIconUri); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if (photo != null) { // 同时将图片上传到七牛服务器 uploadImgFile(photo); } } break; default: break; } } }
public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case CODE_UPLOAD_SUCCESS: dismissLoadingDialog(); if (mImageLoader != null) { mImageLoader.loadData(mHeadPicSTR, mHeadImageView); } break; case CODE_UPLOAD_FIAL: dismissLoadingDialog(); Toast.makeText( YellowpagePersonalInfoActivity.this, getString(R.string.putao_personal_data_upload_icon_fail), Toast.LENGTH_SHORT) .show(); break; case CODE_SHOW_WHEEL_CITY_DIALOG: showWheelCityDialog(); case CODE_INIT_BASIC_USER_DATA: dismissLoadingDialog(); initBasicInfoData(); default: break; } }
@Override protected void onPause() { super.onPause(); // 在onpause里面做数据保存操作,只要个人中心界面不可见,就进行数据保存。保存主要分为两个方面:1.保存到数据库 // 2.上传到服务器。当然了每次有信息修改的时候才会做保存,所以需要设置开关 if (mChangeFlag) { saveUserBasicInfo(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.putao_personal_data_layout); mHeadIconUri = Uri.fromFile(new File(getExternalCacheDir(), IMAGE_FILE_NAME)); mImageLoader = new ImageLoaderFactory(this).getStatusAvatarLoader(); mPersonInfoDB = Config.getDatabaseHelper().getPersonInfoDB(); mCityListDB = Config.getDatabaseHelper().getCityListDB(); initView(); }
@Override protected void onDestroy() { super.onDestroy(); }
@Override protected void onResume() { super.onResume(); updateBasicInfoData(); initCommonInfoData(); }