org.telegram.ui.Cells.PhotoAttachPhotoCell Java Examples
The following examples show how to use
org.telegram.ui.Cells.PhotoAttachPhotoCell.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChatAttachAlert.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void updatePhotoAtIndex(int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { cell.getImageView().setOrientation(0, true); MediaController.PhotoEntry photoEntry = getPhotoEntryAtPosition(index); if (photoEntry == null) { return; } 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); if (photoEntry.isVideo) { cell.getImageView().setImage("vthumb://" + photoEntry.imageId + ":" + photoEntry.path, null, cell.getContext().getResources().getDrawable(R.drawable.nophotos)); } else { cell.getImageView().setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, null, cell.getContext().getResources().getDrawable(R.drawable.nophotos)); } } else { cell.getImageView().setImageResource(R.drawable.nophotos); } } }
Example #2
Source File: ChatAttachAlertPhotoLayout.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void updatePhotoAtIndex(int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { cell.getImageView().setOrientation(0, true); MediaController.PhotoEntry photoEntry = getPhotoEntryAtPosition(index); if (photoEntry == null) { return; } if (photoEntry.thumbPath != null) { cell.getImageView().setImage(photoEntry.thumbPath, null, Theme.chat_attachEmptyDrawable); } else if (photoEntry.path != null) { cell.getImageView().setOrientation(photoEntry.orientation, true); if (photoEntry.isVideo) { cell.getImageView().setImage("vthumb://" + photoEntry.imageId + ":" + photoEntry.path, null, Theme.chat_attachEmptyDrawable); } else { cell.getImageView().setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, null, Theme.chat_attachEmptyDrawable); } } else { cell.getImageView().setImageDrawable(Theme.chat_attachEmptyDrawable); } } }
Example #3
Source File: ChatAttachAlertPhotoLayout.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { int[] coords = new int[2]; cell.getImageView().getLocationInWindow(coords); if (Build.VERSION.SDK_INT < 26) { coords[0] -= parentAlert.getLeftInset(); } PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); object.viewX = coords[0]; object.viewY = coords[1]; object.parentView = gridView; object.imageReceiver = cell.getImageView().getImageReceiver(); object.thumb = object.imageReceiver.getBitmapSafe(); object.scale = cell.getScale(); cell.showCheck(false); return object; } return null; }
Example #4
Source File: PhotoPickerActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private PhotoAttachPhotoCell getCellForIndex(int index) { int count = listView.getChildCount(); for (int a = 0; a < count; a++) { View view = listView.getChildAt(a); if (view instanceof PhotoAttachPhotoCell) { PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view; int num = (Integer) cell.getTag(); if (selectedAlbum != null) { if (num < 0 || num >= selectedAlbum.photos.size()) { continue; } } else { if (num < 0 || num >= searchResult.size()) { continue; } } if (num == index) { return cell; } } } return null; }
Example #5
Source File: PhotoPickerActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { BackupImageView imageView = cell.getImageView(); int[] coords = new int[2]; imageView.getLocationInWindow(coords); PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); object.viewX = coords[0]; object.viewY = coords[1] - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight); object.parentView = listView; object.imageReceiver = imageView.getImageReceiver(); object.thumb = object.imageReceiver.getBitmapSafe(); object.scale = cell.getScale(); cell.showCheck(false); return object; } return null; }
Example #6
Source File: PhotoPickerActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { int count = listView.getChildCount(); for (int a = 0; a < count; a++) { View view = listView.getChildAt(a); if (view.getTag() == null) { continue; } PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view; int num = (Integer) view.getTag(); if (selectedAlbum != null) { if (num < 0 || num >= selectedAlbum.photos.size()) { continue; } } else { if (num < 0 || num >= searchResult.size()) { continue; } } if (num == index) { cell.showCheck(true); break; } } }
Example #7
Source File: PhotoPickerActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void updatePhotoAtIndex(int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { if (selectedAlbum != null) { BackupImageView imageView = cell.getImageView(); imageView.setOrientation(0, true); MediaController.PhotoEntry photoEntry = selectedAlbum.photos.get(index); if (photoEntry.thumbPath != null) { imageView.setImage(photoEntry.thumbPath, null, Theme.chat_attachEmptyDrawable); } else if (photoEntry.path != null) { imageView.setOrientation(photoEntry.orientation, true); if (photoEntry.isVideo) { imageView.setImage("vthumb://" + photoEntry.imageId + ":" + photoEntry.path, null, Theme.chat_attachEmptyDrawable); } else { imageView.setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, null, Theme.chat_attachEmptyDrawable); } } else { imageView.setImageDrawable(Theme.chat_attachEmptyDrawable); } } else { cell.setPhotoEntry(searchResult.get(index), true, false); } } }
Example #8
Source File: PhotoPickerActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void updatePhotoAtIndex(int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { if (selectedAlbum != null) { BackupImageView imageView = cell.getImageView(); imageView.setOrientation(0, true); MediaController.PhotoEntry photoEntry = selectedAlbum.photos.get(index); if (photoEntry.thumbPath != null) { imageView.setImage(photoEntry.thumbPath, null, Theme.chat_attachEmptyDrawable); } else if (photoEntry.path != null) { imageView.setOrientation(photoEntry.orientation, true); if (photoEntry.isVideo) { imageView.setImage("vthumb://" + photoEntry.imageId + ":" + photoEntry.path, null, Theme.chat_attachEmptyDrawable); } else { imageView.setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, null, Theme.chat_attachEmptyDrawable); } } else { imageView.setImageDrawable(Theme.chat_attachEmptyDrawable); } } else { cell.setPhotoEntry(searchResult.get(index), true, false); } } }
Example #9
Source File: PhotoPickerActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { BackupImageView imageView = cell.getImageView(); int[] coords = new int[2]; imageView.getLocationInWindow(coords); PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); object.viewX = coords[0]; object.viewY = coords[1] - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight); object.parentView = listView; object.imageReceiver = imageView.getImageReceiver(); object.thumb = object.imageReceiver.getBitmapSafe(); object.scale = cell.getScale(); cell.showCheck(false); return object; } return null; }
Example #10
Source File: ChatAttachAlert.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (!needCamera || !deviceHasGoodCamera || position != 0) { if (needCamera && deviceHasGoodCamera) { position--; } PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) holder.itemView; MediaController.PhotoEntry photoEntry = getPhotoEntryAtPosition(position); cell.setPhotoEntry(photoEntry, needCamera, position == getItemCount() - 1); if (baseFragment instanceof ChatActivity && maxSelectedPhotos < 0) { cell.setChecked(selectedPhotosOrder.indexOf(photoEntry.imageId), selectedPhotos.containsKey(photoEntry.imageId), false); } else { cell.setChecked(-1, selectedPhotos.containsKey(photoEntry.imageId), false); } cell.getImageView().setTag(position); cell.setTag(position); cell.setIsVertical(this == cameraAttachAdapter && cameraPhotoLayoutManager.getOrientation() == LinearLayoutManager.VERTICAL); } else if (needCamera && deviceHasGoodCamera && position == 0) { if (cameraView != null && cameraView.isInitied()) { holder.itemView.setVisibility(View.INVISIBLE); } else { holder.itemView.setVisibility(View.VISIBLE); } } }
Example #11
Source File: PhotoPickerActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { int count = listView.getChildCount(); for (int a = 0; a < count; a++) { View view = listView.getChildAt(a); if (view.getTag() == null) { continue; } PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view; int num = (Integer) view.getTag(); if (selectedAlbum != null) { if (num < 0 || num >= selectedAlbum.photos.size()) { continue; } } else { if (num < 0 || num >= searchResult.size()) { continue; } } if (num == index) { cell.showCheck(true); break; } } }
Example #12
Source File: PhotoPickerActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
private PhotoAttachPhotoCell getCellForIndex(int index) { int count = listView.getChildCount(); for (int a = 0; a < count; a++) { View view = listView.getChildAt(a); if (view instanceof PhotoAttachPhotoCell) { PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view; int num = (Integer) cell.getTag(); if (selectedAlbum != null) { if (num < 0 || num >= selectedAlbum.photos.size()) { continue; } } else { if (num < 0 || num >= searchResult.size()) { continue; } } if (num == index) { return cell; } } } return null; }
Example #13
Source File: ChatAttachAlertPhotoLayout.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { int[] coords = new int[2]; cell.getImageView().getLocationInWindow(coords); if (Build.VERSION.SDK_INT < 26) { coords[0] -= parentAlert.getLeftInset(); } PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); object.viewX = coords[0]; object.viewY = coords[1]; object.parentView = gridView; object.imageReceiver = cell.getImageView().getImageReceiver(); object.thumb = object.imageReceiver.getBitmapSafe(); object.scale = cell.getScale(); cell.showCheck(false); return object; } return null; }
Example #14
Source File: ChatAttachAlert.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void updatePhotoAtIndex(int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { cell.getImageView().setOrientation(0, true); MediaController.PhotoEntry photoEntry = getPhotoEntryAtPosition(index); if (photoEntry == null) { return; } 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); if (photoEntry.isVideo) { cell.getImageView().setImage("vthumb://" + photoEntry.imageId + ":" + photoEntry.path, null, cell.getContext().getResources().getDrawable(R.drawable.nophotos)); } else { cell.getImageView().setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, null, cell.getContext().getResources().getDrawable(R.drawable.nophotos)); } } else { cell.getImageView().setImageResource(R.drawable.nophotos); } } }
Example #15
Source File: ChatAttachAlert.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@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); if (Build.VERSION.SDK_INT < 26) { coords[0] -= getLeftInset(); } PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); object.viewX = coords[0]; object.viewY = coords[1]; object.parentView = attachPhotoRecyclerView; object.imageReceiver = cell.getImageView().getImageReceiver(); object.thumb = object.imageReceiver.getBitmapSafe(); object.scale = cell.getImageView().getScaleX(); cell.showCheck(false); return object; } return null; }
Example #16
Source File: ChatAttachAlert.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (!needCamera || !deviceHasGoodCamera || position != 0) { if (needCamera && deviceHasGoodCamera) { position--; } PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) holder.itemView; MediaController.PhotoEntry photoEntry = getPhotoEntryAtPosition(position); cell.setPhotoEntry(photoEntry, needCamera, position == getItemCount() - 1); if (baseFragment instanceof ChatActivity && maxSelectedPhotos < 0) { cell.setChecked(selectedPhotosOrder.indexOf(photoEntry.imageId), selectedPhotos.containsKey(photoEntry.imageId), false); } else { cell.setChecked(-1, selectedPhotos.containsKey(photoEntry.imageId), false); } cell.getImageView().setTag(position); cell.setTag(position); cell.setIsVertical(this == cameraAttachAdapter && cameraPhotoLayoutManager.getOrientation() == LinearLayoutManager.VERTICAL); } else if (needCamera && deviceHasGoodCamera && position == 0) { if (cameraView != null && cameraView.isInitied()) { holder.itemView.setVisibility(View.INVISIBLE); } else { holder.itemView.setVisibility(View.VISIBLE); } } }
Example #17
Source File: ChatAttachAlertPhotoLayout.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void updatePhotoAtIndex(int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { cell.getImageView().setOrientation(0, true); MediaController.PhotoEntry photoEntry = getPhotoEntryAtPosition(index); if (photoEntry == null) { return; } if (photoEntry.thumbPath != null) { cell.getImageView().setImage(photoEntry.thumbPath, null, Theme.chat_attachEmptyDrawable); } else if (photoEntry.path != null) { cell.getImageView().setOrientation(photoEntry.orientation, true); if (photoEntry.isVideo) { cell.getImageView().setImage("vthumb://" + photoEntry.imageId + ":" + photoEntry.path, null, Theme.chat_attachEmptyDrawable); } else { cell.getImageView().setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, null, Theme.chat_attachEmptyDrawable); } } else { cell.getImageView().setImageDrawable(Theme.chat_attachEmptyDrawable); } } }
Example #18
Source File: ChatAttachAlert.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@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); if (Build.VERSION.SDK_INT < 26) { coords[0] -= getLeftInset(); } PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); object.viewX = coords[0]; object.viewY = coords[1]; object.parentView = attachPhotoRecyclerView; object.imageReceiver = cell.getImageView().getImageReceiver(); object.thumb = object.imageReceiver.getBitmapSafe(); object.scale = cell.getImageView().getScaleX(); cell.showCheck(false); return object; } return null; }
Example #19
Source File: PhotoPickerActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void willHidePhotoViewer() { int count = listView.getChildCount(); for (int a = 0; a < count; a++) { View view = listView.getChildAt(a); if (view instanceof PhotoAttachPhotoCell) { PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view; cell.showCheck(true); } } }
Example #20
Source File: PhotoPickerActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { return cell.getImageView().getImageReceiver().getBitmapSafe(); } return null; }
Example #21
Source File: ChatAttachAlertPhotoLayout.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { return cell.getImageView().getImageReceiver().getBitmapSafe(); } return null; }
Example #22
Source File: ChatAttachAlertPhotoLayout.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { cell.showCheck(true); } }
Example #23
Source File: ChatAttachAlertPhotoLayout.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void willHidePhotoViewer() { int count = gridView.getChildCount(); for (int a = 0; a < count; a++) { View view = gridView.getChildAt(a); if (view instanceof PhotoAttachPhotoCell) { PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view; cell.showCheck(true); } } }
Example #24
Source File: ChatAttachAlertPhotoLayout.java From Telegram with GNU General Public License v2.0 | 5 votes |
private PhotoAttachPhotoCell getCellForIndex(int index) { int count = gridView.getChildCount(); for (int a = 0; a < count; a++) { View view = gridView.getChildAt(a); if (view instanceof PhotoAttachPhotoCell) { PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view; if ((Integer) cell.getImageView().getTag() == index) { return cell; } } } return null; }
Example #25
Source File: ChatAttachAlertPhotoLayout.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private PhotoAttachPhotoCell getCellForIndex(int index) { int count = gridView.getChildCount(); for (int a = 0; a < count; a++) { View view = gridView.getChildAt(a); if (view instanceof PhotoAttachPhotoCell) { PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view; if ((Integer) cell.getImageView().getTag() == index) { return cell; } } } return null; }
Example #26
Source File: ChatAttachAlertPhotoLayout.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void willHidePhotoViewer() { int count = gridView.getChildCount(); for (int a = 0; a < count; a++) { View view = gridView.getChildAt(a); if (view instanceof PhotoAttachPhotoCell) { PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view; cell.showCheck(true); } } }
Example #27
Source File: ChatAttachAlertPhotoLayout.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { cell.showCheck(true); } }
Example #28
Source File: ChatAttachAlertPhotoLayout.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { return cell.getImageView().getImageReceiver().getBitmapSafe(); } return null; }
Example #29
Source File: PhotoPickerActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void willHidePhotoViewer() { int count = listView.getChildCount(); for (int a = 0; a < count; a++) { View view = listView.getChildAt(a); if (view instanceof PhotoAttachPhotoCell) { PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view; cell.showCheck(true); } } }
Example #30
Source File: PhotoPickerActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { return cell.getImageView().getImageReceiver().getBitmapSafe(); } return null; }