Java Code Examples for org.telegram.ui.Components.BackupImageView#getLocationInWindow()

The following examples show how to use org.telegram.ui.Components.BackupImageView#getLocationInWindow() . 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: PhotoPickerActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@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 2
Source File: PhotoPickerActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@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 3
Source File: MediaActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
    if (messageObject == null || mediaPages[0].selectedType != 0) {
        return null;
    }
    int count = mediaPages[0].listView.getChildCount();

    for (int a = 0; a < count; a++) {
        View view = mediaPages[0].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] - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight);
                    object.parentView = mediaPages[0].listView;
                    object.imageReceiver = imageView.getImageReceiver();
                    object.thumb = object.imageReceiver.getBitmapSafe();
                    object.parentView.getLocationInWindow(coords);
                    object.clipTopAddition = AndroidUtilities.dp(40);
                    return object;
                }
            }
        }
    }
    return null;
}
 
Example 4
Source File: MediaActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
    if (messageObject == null || mediaPages[0].selectedType != 0) {
        return null;
    }
    int count = mediaPages[0].listView.getChildCount();

    for (int a = 0; a < count; a++) {
        View view = mediaPages[0].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] - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight);
                    object.parentView = mediaPages[0].listView;
                    object.imageReceiver = imageView.getImageReceiver();
                    object.thumb = object.imageReceiver.getBitmapSafe();
                    object.parentView.getLocationInWindow(coords);
                    object.clipTopAddition = AndroidUtilities.dp(40);
                    return object;
                }
            }
        }
    }
    return null;
}