mirror of https://github.com/NekoX-Dev/NekoX.git
Allow opening large (> 512px) stickers in media viewer
(cherry picked from commit 014b6a28bcec8255ae5ffde9da8fcf86e5695bb4)
This commit is contained in:
parent
2dd69697cb
commit
368ab7ab8b
|
@ -1716,7 +1716,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
imagePressed = true;
|
imagePressed = true;
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
} else if (!currentMessageObject.isAnyKindOfSticker() || currentMessageObject.getInputStickerSet() != null || currentMessageObject.isAnimatedEmoji() || currentMessageObject.isDice()) {
|
} else if (!currentMessageObject.isAnyKindOfSticker() || currentMessageObject.getInputStickerSet() != null || currentMessageObject.isAnimatedEmoji() || currentMessageObject.isDice() || currentMessageObject.getInputStickerSet() == null && currentMessageObject.isSticker()) {
|
||||||
if (x >= photoImage.getImageX() && x <= photoImage.getImageX() + photoImage.getImageWidth() && y >= photoImage.getImageY() && y <= photoImage.getImageY() + photoImage.getImageHeight()) {
|
if (x >= photoImage.getImageX() && x <= photoImage.getImageX() + photoImage.getImageWidth() && y >= photoImage.getImageY() && y <= photoImage.getImageY() + photoImage.getImageHeight()) {
|
||||||
imagePressed = true;
|
imagePressed = true;
|
||||||
result = true;
|
result = true;
|
||||||
|
|
|
@ -22499,6 +22499,27 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (message.type == MessageObject.TYPE_STICKER || message.type == MessageObject.TYPE_ANIMATED_STICKER) {
|
} else if (message.type == MessageObject.TYPE_STICKER || message.type == MessageObject.TYPE_ANIMATED_STICKER) {
|
||||||
|
// In case we have a .webp file that is displayed as a sticker, but
|
||||||
|
// that doesn't fit in 512x512, we assume it may be a regular large
|
||||||
|
// .webp image and we allow to open it in media viewer.
|
||||||
|
// Inspired by https://github.com/telegramdesktop/tdesktop/commit/baccec623d45dbfd1132d5f808192f0f3ad87647
|
||||||
|
if (message.getInputStickerSet() == null) {
|
||||||
|
int photoHeight = 0;
|
||||||
|
int photoWidth = 0;
|
||||||
|
TLRPC.Document document = message.getDocument();
|
||||||
|
for (int a = 0, N = document.attributes.size(); a < N; a++) {
|
||||||
|
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
|
||||||
|
if (attribute instanceof TLRPC.TL_documentAttributeImageSize) {
|
||||||
|
photoWidth = attribute.w;
|
||||||
|
photoHeight = attribute.h;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (photoWidth > 512 || photoHeight > 512) {
|
||||||
|
openPhotoViewerForMessage(cell, message);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
StickersAlert alert = new StickersAlert(getParentActivity(), ChatActivity.this, message.getInputStickerSet(), null, bottomOverlayChat.getVisibility() != View.VISIBLE && (currentChat == null || ChatObject.canSendStickers(currentChat)) ? chatActivityEnterView : null);
|
StickersAlert alert = new StickersAlert(getParentActivity(), ChatActivity.this, message.getInputStickerSet(), null, bottomOverlayChat.getVisibility() != View.VISIBLE && (currentChat == null || ChatObject.canSendStickers(currentChat)) ? chatActivityEnterView : null);
|
||||||
alert.setCalcMandatoryInsets(isKeyboardVisible());
|
alert.setCalcMandatoryInsets(isKeyboardVisible());
|
||||||
showDialog(alert);
|
showDialog(alert);
|
||||||
|
|
Loading…
Reference in New Issue