Example #1
0
 private void goPage(HomePhotoInfo homePhotoInfo) {
   if (Constant.isSDCardPresent) {
     if (homePhotoInfo.getType() == HomePhotoInfo.EVENT_PIC) {
       CameraGalleryActivity_.intent(this).eventOrPhoto(HomePhotoInfo.EVENT_PIC).start();
     } else {
       CameraGalleryActivity_.intent(this).eventOrPhoto(HomePhotoInfo.NORMAL_PIC).start();
     }
   } else {
     showToastSafe(getResources().getString(R.string.idcard_loss));
   }
 }
Example #2
0
 public void onEventBackgroundThread(EventOrPhotoRemovedNotificationEvent event) {
   Logger.e(TAG, "删除event 或者  photo了 param :" + event.getParam());
   Logger.e(TAG, "list :" + homePhotoInfos.toString());
   if (!TextUtils.isEmpty(event.getParam())) {
     String jsonStr = event.getParam().replace("[", "").replace("]", "");
     FileRemovedInfo removedInfo = GsonUtils.fromJson(jsonStr, FileRemovedInfo.class);
     String thumbName = removedInfo.getFilename();
     if (thumbName.endsWith("A.MP4")) {
       thumbName = thumbName.replace("A.MP4", "T.JPG");
     } else if (thumbName.endsWith("A.JPG")) {
       thumbName = thumbName.replace("A.JPG", "T.JPG");
     }
     if (homePhotoInfos != null && homePhotoInfos.size() > 0) {
       for (HomePhotoInfo info : homePhotoInfos) {
         if (info.getOrginalName().equals(thumbName)) {
           remoevdHomeInfos.add(info);
         }
       }
       Logger.e(TAG, "removedHomeInfos :" + remoevdHomeInfos.toString());
       homePhotoInfos.removeAll(remoevdHomeInfos);
       remoevdHomeInfos.clear();
     }
   }
 }
Example #3
0
  @UiThread
  void showPhoto() {
    if (homePhotoInfos.size() > 0) {
      showOrHideTip(false);
    } else {
      showOrHideTip(true);
      return;
    }
    needRefreshPhoto(homePhotoInfos.size());
    if (homePhotoInfos.size() == 1) {
      HomePhotoInfo hPI1 = homePhotoInfos.get(0);
      Glide.with(this)
          .load(hPI1.getPath())
          .placeholder(R.drawable.img_default)
          .crossFade()
          .into(iv_first);
      tv_first_text.setText(hPI1.getName());
      if (hPI1.getType() == HomePhotoInfo.EVENT_PIC) {
        iv_first_icon.setVisibility(View.VISIBLE);
      } else {
        iv_first_icon.setVisibility(View.GONE);
      }

    } else if (homePhotoInfos.size() == 2) {
      HomePhotoInfo hPI1 = homePhotoInfos.get(0);
      HomePhotoInfo hPI2 = homePhotoInfos.get(1);
      Glide.with(this)
          .load(hPI1.getPath())
          .placeholder(R.drawable.img_default)
          .crossFade()
          .into(iv_first);
      Glide.with(this)
          .load(hPI2.getPath())
          .placeholder(R.drawable.img_default)
          .crossFade()
          .into(iv_two);
      tv_first_text.setText(hPI1.getName());
      tv_two_text.setText(hPI2.getName());
      if (hPI1.getType() == HomePhotoInfo.EVENT_PIC) {
        iv_first_icon.setVisibility(View.VISIBLE);
      } else {
        iv_first_icon.setVisibility(View.GONE);
      }
      if (hPI2.getType() == HomePhotoInfo.EVENT_PIC) {
        iv_two_icon.setVisibility(View.VISIBLE);
      } else {
        iv_two_icon.setVisibility(View.GONE);
      }
    } else if (homePhotoInfos.size() >= 3) {
      HomePhotoInfo hPI1 = homePhotoInfos.get(0);
      HomePhotoInfo hPI2 = homePhotoInfos.get(1);
      HomePhotoInfo hPI3 = homePhotoInfos.get(2);
      Glide.with(this)
          .load(hPI1.getPath())
          .placeholder(R.drawable.img_default)
          .crossFade()
          .into(iv_first);
      Glide.with(this)
          .load(hPI2.getPath())
          .placeholder(R.drawable.img_default)
          .crossFade()
          .into(iv_two);
      Glide.with(this)
          .load(hPI3.getPath())
          .placeholder(R.drawable.img_default)
          .crossFade()
          .into(iv_three);
      tv_first_text.setText(hPI1.getName());
      tv_two_text.setText(hPI2.getName());
      tv_three_text.setText(hPI3.getName());
      if (hPI1.getType() == HomePhotoInfo.EVENT_PIC) {
        iv_first_icon.setVisibility(View.VISIBLE);
      } else {
        iv_first_icon.setVisibility(View.GONE);
      }
      if (hPI2.getType() == HomePhotoInfo.EVENT_PIC) {
        iv_two_icon.setVisibility(View.VISIBLE);
      } else {
        iv_two_icon.setVisibility(View.GONE);
      }
      if (hPI3.getType() == HomePhotoInfo.EVENT_PIC) {
        iv_three_icon.setVisibility(View.VISIBLE);
      } else {
        iv_three_icon.setVisibility(View.GONE);
      }
    }
  }