Exemplo n.º 1
0
 @Override
 public Bitmap getThumbForPhoto(
     MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
   PhotoAttachPhotoCell cell = getCellForIndex(index);
   if (cell != null) {
     return cell.getImageView().getImageReceiver().getBitmap();
   }
   return null;
 }
Exemplo n.º 2
0
 @Override
 public PhotoViewer.PlaceProviderObject getPlaceForPhoto(
     MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
   PhotoAttachPhotoCell cell = getCellForIndex(index);
   if (cell != null) {
     int coords[] = new int[2];
     cell.getImageView().getLocationInWindow(coords);
     PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject();
     object.viewX = coords[0];
     object.viewY =
         coords[1] - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
     object.parentView = attachPhotoRecyclerView;
     object.imageReceiver = cell.getImageView().getImageReceiver();
     object.thumb = object.imageReceiver.getBitmap();
     object.scale = ViewProxy.getScaleX(cell.getImageView());
     object.clipBottomAddition =
         (Build.VERSION.SDK_INT >= 21 ? 0 : -AndroidUtilities.statusBarHeight);
     cell.getCheckBox().setVisibility(View.GONE);
     return object;
   }
   return null;
 }
Exemplo n.º 3
0
 @Override
 public void updatePhotoAtIndex(int index) {
   PhotoAttachPhotoCell cell = getCellForIndex(index);
   if (cell != null) {
     cell.getImageView().setOrientation(0, true);
     MediaController.PhotoEntry photoEntry = MediaController.allPhotosAlbumEntry.photos.get(index);
     if (photoEntry.thumbPath != null) {
       cell.getImageView()
           .setImage(
               photoEntry.thumbPath,
               null,
               cell.getContext().getResources().getDrawable(R.drawable.nophotos));
     } else if (photoEntry.path != null) {
       cell.getImageView().setOrientation(photoEntry.orientation, true);
       cell.getImageView()
           .setImage(
               "thumb://" + photoEntry.imageId + ":" + photoEntry.path,
               null,
               cell.getContext().getResources().getDrawable(R.drawable.nophotos));
     } else {
       cell.getImageView().setImageResource(R.drawable.nophotos);
     }
   }
 }
Exemplo n.º 4
0
 private PhotoAttachPhotoCell getCellForIndex(int index) {
   int count = attachPhotoRecyclerView.getChildCount();
   for (int a = 0; a < count; a++) {
     View view = attachPhotoRecyclerView.getChildAt(a);
     if (view instanceof PhotoAttachPhotoCell) {
       PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view;
       int num = (Integer) cell.getImageView().getTag();
       if (num < 0 || num >= MediaController.allPhotosAlbumEntry.photos.size()) {
         continue;
       }
       if (num == index) {
         return cell;
       }
     }
   }
   return null;
 }