Java Code Examples for org.telegram.messenger.MessageObject#canAutoplayAnimatedSticker()
The following examples show how to use
org.telegram.messenger.MessageObject#canAutoplayAnimatedSticker() .
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: StickerCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void setSticker(TLRPC.Document document, Object parent, int side) { parentObject = parent; if (document != null) { TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90); if (MessageObject.canAutoplayAnimatedSticker(document)) { if (thumb != null) { imageView.setImage(ImageLocation.getForDocument(document), "80_80", ImageLocation.getForDocument(thumb, document), null, 0, parentObject); } else { imageView.setImage(ImageLocation.getForDocument(document), "80_80", null, null, parentObject); } } else { imageView.setImage(ImageLocation.getForDocument(thumb, document), null, "webp", null, parentObject); } } sticker = document; if (side == -1) { setBackgroundResource(R.drawable.stickers_back_left); setPadding(AndroidUtilities.dp(7), 0, 0, 0); } else if (side == 0) { setBackgroundResource(R.drawable.stickers_back_center); setPadding(0, 0, 0, 0); } else if (side == 1) { setBackgroundResource(R.drawable.stickers_back_right); setPadding(0, 0, AndroidUtilities.dp(7), 0); } else if (side == 2) { setBackgroundResource(R.drawable.stickers_back_all); setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0); } Drawable background = getBackground(); if (background != null) { background.setAlpha(230); background.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel), PorterDuff.Mode.MULTIPLY)); } }
Example 2
Source File: StickerCell.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void setSticker(TLRPC.Document document, Object parent, int side) { parentObject = parent; if (document != null) { TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90); if (MessageObject.canAutoplayAnimatedSticker(document)) { if (thumb != null) { imageView.setImage(ImageLocation.getForDocument(document), "80_80", ImageLocation.getForDocument(thumb, document), null, 0, parentObject); } else { imageView.setImage(ImageLocation.getForDocument(document), "80_80", null, null, parentObject); } } else { imageView.setImage(ImageLocation.getForDocument(thumb, document), null, "webp", null, parentObject); } } sticker = document; if (side == -1) { setBackgroundResource(R.drawable.stickers_back_left); setPadding(AndroidUtilities.dp(7), 0, 0, 0); } else if (side == 0) { setBackgroundResource(R.drawable.stickers_back_center); setPadding(0, 0, 0, 0); } else if (side == 1) { setBackgroundResource(R.drawable.stickers_back_right); setPadding(0, 0, AndroidUtilities.dp(7), 0); } else if (side == 2) { setBackgroundResource(R.drawable.stickers_back_all); setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0); } Drawable background = getBackground(); if (background != null) { background.setAlpha(230); background.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel), PorterDuff.Mode.MULTIPLY)); } }
Example 3
Source File: StickerEmojiCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public void setSticker(TLRPC.Document document, Object parent, String emoji, boolean showEmoji) { if (document != null) { sticker = document; parentObject = parent; TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90); if (MessageObject.canAutoplayAnimatedSticker(document)) { if (thumb != null) { imageView.setImage(ImageLocation.getForDocument(document), "80_80", ImageLocation.getForDocument(thumb, document), null, 0, parentObject); } else { imageView.setImage(ImageLocation.getForDocument(document), "80_80", null, null, parentObject); } } else { if (thumb != null) { imageView.setImage(ImageLocation.getForDocument(thumb, document), null, "webp", null, parentObject); } else { imageView.setImage(ImageLocation.getForDocument(document), null, "webp", null, parentObject); } } if (emoji != null) { emojiTextView.setText(Emoji.replaceEmoji(emoji, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); emojiTextView.setVisibility(VISIBLE); } else if (showEmoji) { boolean set = false; for (int a = 0; a < document.attributes.size(); a++) { TLRPC.DocumentAttribute attribute = document.attributes.get(a); if (attribute instanceof TLRPC.TL_documentAttributeSticker) { if (attribute.alt != null && attribute.alt.length() > 0) { emojiTextView.setText(Emoji.replaceEmoji(attribute.alt, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); set = true; } break; } } if (!set) { emojiTextView.setText(Emoji.replaceEmoji(MediaDataController.getInstance(currentAccount).getEmojiForSticker(sticker.id), emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); } emojiTextView.setVisibility(VISIBLE); } else { emojiTextView.setVisibility(INVISIBLE); } } }
Example 4
Source File: StickerEmojiCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public void setSticker(TLRPC.Document document, Object parent, String emoji, boolean showEmoji) { if (document != null) { sticker = document; parentObject = parent; TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90); if (MessageObject.canAutoplayAnimatedSticker(document)) { if (thumb != null) { imageView.setImage(ImageLocation.getForDocument(document), "80_80", ImageLocation.getForDocument(thumb, document), null, 0, parentObject); } else { imageView.setImage(ImageLocation.getForDocument(document), "80_80", null, null, parentObject); } } else { if (thumb != null) { imageView.setImage(ImageLocation.getForDocument(thumb, document), null, "webp", null, parentObject); } else { imageView.setImage(ImageLocation.getForDocument(document), null, "webp", null, parentObject); } } if (emoji != null) { emojiTextView.setText(Emoji.replaceEmoji(emoji, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); emojiTextView.setVisibility(VISIBLE); } else if (showEmoji) { boolean set = false; for (int a = 0; a < document.attributes.size(); a++) { TLRPC.DocumentAttribute attribute = document.attributes.get(a); if (attribute instanceof TLRPC.TL_documentAttributeSticker) { if (attribute.alt != null && attribute.alt.length() > 0) { emojiTextView.setText(Emoji.replaceEmoji(attribute.alt, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); set = true; } break; } } if (!set) { emojiTextView.setText(Emoji.replaceEmoji(MediaDataController.getInstance(currentAccount).getEmojiForSticker(sticker.id), emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); } emojiTextView.setVisibility(VISIBLE); } else { emojiTextView.setVisibility(INVISIBLE); } } }