本文整理汇总了Java中org.telegram.ui.PhotoViewer类的典型用法代码示例。如果您正苦于以下问题:Java PhotoViewer类的具体用法?Java PhotoViewer怎么用?Java PhotoViewer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PhotoViewer类属于org.telegram.ui包,在下文中一共展示了PhotoViewer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPhotoEntry
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
public void setPhotoEntry(MediaController.PhotoEntry entry, boolean last) {
pressed = false;
photoEntry = entry;
isLast = last;
if (photoEntry.thumbPath != null) {
imageView.setImage(photoEntry.thumbPath, null, getResources().getDrawable(R.drawable.nophotos));
} else if (photoEntry.path != null) {
imageView.setOrientation(photoEntry.orientation, true);
imageView.setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, null, getResources().getDrawable(R.drawable.nophotos));
} else {
imageView.setImageResource(R.drawable.nophotos);
}
boolean showing = PhotoViewer.getInstance().isShowingImage(photoEntry.path);
imageView.getImageReceiver().setVisible(!showing, true);
checkBox.setVisibility(showing ? View.INVISIBLE : View.VISIBLE);
requestLayout();
}
示例2: getPlaceForPhoto
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
@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 = cell.getImageView().getScaleX();
object.clipBottomAddition = (Build.VERSION.SDK_INT >= 21 ? 0 : -AndroidUtilities.statusBarHeight);
cell.getCheckBox().setVisibility(View.GONE);
return object;
}
return null;
}
示例3: getPlaceForPhoto
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
@Override
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
if (fileLocation == null) {
return null;
}
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
if (user != null && user.photo != null && user.photo.photo_big != null) {
TLRPC.FileLocation photoBig = user.photo.photo_big;
if (photoBig.local_id == fileLocation.local_id && photoBig.volume_id == fileLocation.volume_id && photoBig.dc_id == fileLocation.dc_id) {
int coords[] = new int[2];
avatarImage.getLocationInWindow(coords);
PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject();
object.viewX = coords[0];
object.viewY = coords[1] - AndroidUtilities.statusBarHeight;
object.parentView = avatarImage;
object.imageReceiver = avatarImage.getImageReceiver();
object.dialogId = UserConfig.getClientUserId();
object.thumb = object.imageReceiver.getBitmap();
object.size = -1;
object.radius = avatarImage.getImageReceiver().getRoundRadius();
object.scale = ViewProxy.getScaleX(avatarImage);
return object;
}
}
return null;
}
示例4: updateUserData
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
private void updateUserData() {
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
TLRPC.FileLocation photo = null;
TLRPC.FileLocation photoBig = null;
if (user.photo != null) {
photo = user.photo.photo_small;
photoBig = user.photo.photo_big;
}
AvatarDrawable avatarDrawable = new AvatarDrawable(user, true);
//avatarDrawable.setColor(Theme.ACTION_BAR_MAIN_AVATAR_COLOR);
avatarDrawable.setColor(AndroidUtilities.getIntDef("prefAvatarColor", AndroidUtilities.getIntDarkerColor("themeColor", 0x10)));
int radius = AndroidUtilities.dp(AndroidUtilities.getIntDef("prefAvatarRadius", 32));
avatarImage.getImageReceiver().setRoundRadius(radius);
avatarDrawable.setRadius(radius);
if (avatarImage != null) {
avatarImage.setImage(photo, "50_50", avatarDrawable);
avatarImage.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
nameTextView.setText(UserObject.getUserName(user));
onlineTextView.setText(LocaleController.getString("Online", R.string.Online));
avatarImage.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
}
}
示例5: broadcastNewPhotos
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
private static void broadcastNewPhotos(final int guid, final ArrayList<AlbumEntry> albumsSorted, final Integer cameraAlbumIdFinal, final ArrayList<AlbumEntry> videoAlbumsSorted, final Integer cameraAlbumVideoIdFinal, final AlbumEntry allPhotosAlbumFinal, int delay) {
if (broadcastPhotosRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(broadcastPhotosRunnable);
}
AndroidUtilities.runOnUIThread(broadcastPhotosRunnable = new Runnable() {
@Override
public void run() {
if (PhotoViewer.getInstance().isVisible()) {
broadcastNewPhotos(guid, albumsSorted, cameraAlbumIdFinal, videoAlbumsSorted, cameraAlbumVideoIdFinal, allPhotosAlbumFinal, 1000);
return;
}
broadcastPhotosRunnable = null;
allPhotosAlbumEntry = allPhotosAlbumFinal;
NotificationCenter.getInstance().postNotificationName(NotificationCenter.albumsDidLoaded, guid, albumsSorted, cameraAlbumIdFinal, videoAlbumsSorted, cameraAlbumVideoIdFinal);
}
}, delay);
}
示例6: getPlaceForPhoto
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
@Override
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
if (fileLocation == null) {
return null;
}
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
if (user != null && user.photo != null && user.photo.photo_big != null) {
TLRPC.FileLocation photoBig = user.photo.photo_big;
if (photoBig.local_id == fileLocation.local_id && photoBig.volume_id == fileLocation.volume_id && photoBig.dc_id == fileLocation.dc_id) {
int coords[] = new int[2];
avatarImageView.getLocationInWindow(coords);
PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject();
object.viewX = coords[0];
object.viewY = coords[1] - AndroidUtilities.statusBarHeight;
object.parentView = avatarImageView;
object.imageReceiver = avatarImageView.getImageReceiver();
object.dialogId = UserConfig.getClientUserId();
object.thumb = object.imageReceiver.getBitmap();
object.size = -1;
object.radius = avatarImageView.getImageReceiver().getRoundRadius();
return object;
}
}
return null;
}
示例7: getPlaceForPhoto
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
@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];
object.parentView = attachPhotoRecyclerView;
object.imageReceiver = cell.getImageView().getImageReceiver();
object.thumb = object.imageReceiver.getBitmap();
object.scale = cell.getImageView().getScaleX();
cell.getCheckBox().setVisibility(View.GONE);
return object;
}
return null;
}
示例8: getPlaceForPhoto
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
@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;
}
示例9: broadcastNewPhotos
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
private static void broadcastNewPhotos(final int guid, final ArrayList<AlbumEntry> mediaAlbumsSorted, final ArrayList<AlbumEntry> photoAlbumsSorted, final Integer cameraAlbumIdFinal, final AlbumEntry allMediaAlbumFinal, final AlbumEntry allPhotosAlbumFinal, int delay) {
if (broadcastPhotosRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(broadcastPhotosRunnable);
}
AndroidUtilities.runOnUIThread(broadcastPhotosRunnable = new Runnable() {
@Override
public void run() {
if (PhotoViewer.getInstance().isVisible()) {
broadcastNewPhotos(guid, mediaAlbumsSorted, photoAlbumsSorted, cameraAlbumIdFinal, allMediaAlbumFinal, allPhotosAlbumFinal, 1000);
return;
}
broadcastPhotosRunnable = null;
allPhotosAlbumEntry = allPhotosAlbumFinal;
allMediaAlbumEntry = allMediaAlbumFinal;
NotificationCenter.getInstance().postNotificationName(NotificationCenter.albumsDidLoaded, guid, mediaAlbumsSorted, photoAlbumsSorted, cameraAlbumIdFinal);
}
}, delay);
}
示例10: getPlaceForPhoto
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
@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);
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.getBitmap();
object.scale = cell.getImageView().getScaleX();
cell.showCheck(false);
return object;
}
return null;
}
示例11: setMessageObject
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
public void setMessageObject(MessageObject messageObject) {
if (currentMessageObject == messageObject && (hasReplyMessage || messageObject.replyMessageObject == null)) {
return;
}
currentMessageObject = messageObject;
hasReplyMessage = messageObject.replyMessageObject != null;
previousWidth = 0;
if (currentMessageObject.type == 11) {
int id = 0;
if (messageObject.messageOwner.to_id != null) {
if (messageObject.messageOwner.to_id.chat_id != 0) {
id = messageObject.messageOwner.to_id.chat_id;
} else if (messageObject.messageOwner.to_id.channel_id != 0) {
id = messageObject.messageOwner.to_id.channel_id;
} else {
id = messageObject.messageOwner.to_id.user_id;
if (id == UserConfig.getClientUserId()) {
id = messageObject.messageOwner.from_id;
}
}
}
avatarDrawable.setInfo(id, null, null, false);
if (currentMessageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) {
imageReceiver.setImage(currentMessageObject.messageOwner.action.newUserPhoto.photo_small, "50_50", avatarDrawable, null, false);
} else {
TLRPC.PhotoSize photo = FileLoader.getClosestPhotoSizeWithSize(currentMessageObject.photoThumbs, AndroidUtilities.dp(64));
if (photo != null) {
imageReceiver.setImage(photo.location, "50_50", avatarDrawable, null, false);
} else {
imageReceiver.setImageBitmap(avatarDrawable);
}
}
imageReceiver.setVisible(!PhotoViewer.getInstance().isShowingImage(currentMessageObject), false);
} else {
imageReceiver.setImageBitmap((Bitmap)null);
}
requestLayout();
}
示例12: getPlaceForPhoto
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
@Override
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
if (messageObject == null || listView == null || selectedMode != 0) {
return null;
}
int count = listView.getChildCount();
for (int a = 0; a < count; a++) {
View view = listView.getChildAt(a);
if (view instanceof SharedPhotoVideoCell) {
SharedPhotoVideoCell cell = (SharedPhotoVideoCell) view;
for (int i = 0; i < 6; i++) {
MessageObject message = cell.getMessageObject(i);
if (message == null) {
break;
}
BackupImageView imageView = cell.getImageView(i);
if (message.getId() == messageObject.getId()) {
int coords[] = new int[2];
imageView.getLocationInWindow(coords);
PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject();
object.viewX = coords[0];
object.viewY = coords[1] - AndroidUtilities.statusBarHeight;
object.parentView = listView;
object.imageReceiver = imageView.getImageReceiver();
object.thumb = object.imageReceiver.getBitmap();
object.parentView.getLocationInWindow(coords);
object.clipTopAddition = AndroidUtilities.dp(40);
return object;
}
}
}
}
return null;
}
示例13: scheduleReloadRunnable
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
private void scheduleReloadRunnable() {
AndroidUtilities.runOnUIThread(refreshGalleryRunnable = new Runnable() {
@Override
public void run() {
if (PhotoViewer.getInstance().isVisible()) {
scheduleReloadRunnable();
return;
}
refreshGalleryRunnable = null;
loadGalleryPhotosAlbums(0);
}
}, 2000);
}
示例14: maybeShowDismissalAlert
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
public void maybeShowDismissalAlert(PhotoViewer photoViewer, Activity parentActivity, final Runnable okRunnable) {
if (editingText) {
closeTextEnter(false);
return;
} else if (pickingSticker) {
closeStickersView();
return;
}
if (hasChanges()) {
if (parentActivity == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
builder.setMessage(LocaleController.getString("DiscardChanges", R.string.DiscardChanges));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
okRunnable.run();
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
photoViewer.showAlertDialog(builder);
} else {
okRunnable.run();
}
}
示例15: setMessageObject
import org.telegram.ui.PhotoViewer; //导入依赖的package包/类
public void setMessageObject(MessageObject messageObject) {
if (currentMessageObject == messageObject && (hasReplyMessage || messageObject.replyMessageObject == null)) {
return;
}
currentMessageObject = messageObject;
hasReplyMessage = messageObject.replyMessageObject != null;
previousWidth = 0;
if (currentMessageObject.type == 11) {
int id = 0;
if (messageObject.messageOwner.to_id != null) {
if (messageObject.messageOwner.to_id.chat_id != 0) {
id = messageObject.messageOwner.to_id.chat_id;
} else if (messageObject.messageOwner.to_id.channel_id != 0) {
id = messageObject.messageOwner.to_id.channel_id;
} else {
id = messageObject.messageOwner.to_id.user_id;
if (id == UserConfig.getClientUserId()) {
id = messageObject.messageOwner.from_id;
}
}
}
avatarDrawable.setInfo(id, null, null, false);
if (currentMessageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) {
imageReceiver.setImage(currentMessageObject.messageOwner.action.newUserPhoto.photo_small, "50_50", avatarDrawable, null, 0);
} else {
TLRPC.PhotoSize photo = FileLoader.getClosestPhotoSizeWithSize(currentMessageObject.photoThumbs, AndroidUtilities.dp(64));
if (photo != null) {
imageReceiver.setImage(photo.location, "50_50", avatarDrawable, null, 0);
} else {
imageReceiver.setImageBitmap(avatarDrawable);
}
}
imageReceiver.setVisible(!PhotoViewer.getInstance().isShowingImage(currentMessageObject), false);
} else {
imageReceiver.setImageBitmap((Bitmap) null);
}
requestLayout();
}