當前位置: 首頁>>代碼示例>>Java>>正文


Java PhotoViewer類代碼示例

本文整理匯總了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();
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:18,代碼來源:PhotoAttachPhotoCell.java

示例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;
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:20,代碼來源:ChatAttachAlert.java

示例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;
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:27,代碼來源:takSettings.java

示例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);
    }
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:25,代碼來源:takSettings.java

示例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);
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:18,代碼來源:MediaController.java

示例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;
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:26,代碼來源:DrawerProfileCell.java

示例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;
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:19,代碼來源:ChatAttachAlert.java

示例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;
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:20,代碼來源:ChatAttachView.java

示例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);
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:19,代碼來源:MediaController.java

示例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;
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:20,代碼來源:ChatAttachAlert.java

示例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();
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:39,代碼來源:ChatActionCell.java

示例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;
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:36,代碼來源:AllMediaActivity.java

示例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);
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:14,代碼來源:MediaController.java

示例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();
    }
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:29,代碼來源:PhotoPaintView.java

示例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();
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:39,代碼來源:ChatActionCell.java


注:本文中的org.telegram.ui.PhotoViewer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。