Esempio n. 1
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == RESULT_REQUEST_PICK_PHOTO) {
      if (resultCode == Activity.RESULT_OK) {
        try {
          ArrayList<ImageInfo> pickPhots = (ArrayList<ImageInfo>) data.getSerializableExtra("data");
          for (ImageInfo item : pickPhots) {
            Uri uri = Uri.parse(item.path);
            File outputFile = photoOperate.scal(uri);
            mData.add(new RepairFragment.PhotoData(outputFile));
          }
        } catch (Exception e) {
          UnoApplication.showToast("缩放图片失败");
          Logger.e(e.toString());
        }
        adapter.notifyDataSetChanged();
      }
    } else if (requestCode == RESULT_REQUEST_PHOTO) {
      if (resultCode == Activity.RESULT_OK) {
        try {
          File outputFile = photoOperate.scal(fileUri);
          mData.add(mData.size(), new RepairFragment.PhotoData(outputFile));
          adapter.notifyDataSetChanged();

        } catch (Exception e) {
          UnoApplication.showToast("缩放图片失败");
          Logger.e(e.toString());
        }
      }
    } else if (requestCode == RESULT_REQUEST_IMAGE) {
      if (resultCode == Activity.RESULT_OK) {
        ArrayList<String> delUris = data.getStringArrayListExtra("mDelUrls");
        for (String item : delUris) {
          for (int i = 0; i < mData.size(); ++i) {
            if (mData.get(i).uri.toString().equals(item)) {
              mData.remove(i);
            }
          }
          adapter.notifyDataSetChanged();
        }
      }
    } else {
      super.onActivityResult(requestCode, resultCode, data);
    }
  }
Esempio n. 2
0
 @Override
 public void onStop() {
   saveDraft();
   super.onStop();
 }
Esempio n. 3
0
 @Override
 public void notifyDataSetChanged() {
   super.notifyDataSetChanged();
   gridView.setVisibility(getCount() > 0 ? View.VISIBLE : View.GONE);
 }