本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_photoCachedSize方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_photoCachedSize方法的具体用法?Java TLRPC.TL_photoCachedSize怎么用?Java TLRPC.TL_photoCachedSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.TL_photoCachedSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setWallpaper
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setWallpaper(TLRPC.WallPaper wallpaper, int selectedBackground) {
if (wallpaper == null) {
imageView.setVisibility(INVISIBLE);
imageView2.setVisibility(VISIBLE);
selectionView.setVisibility(selectedBackground == -1 ? View.VISIBLE : INVISIBLE);
imageView2.setBackgroundColor(selectedBackground == -1 || selectedBackground == 1000001 ? 0x5a475866 : 0x5a000000);
} else {
imageView.setVisibility(VISIBLE);
imageView2.setVisibility(INVISIBLE);
selectionView.setVisibility(selectedBackground == wallpaper.id ? View.VISIBLE : INVISIBLE);
if (wallpaper instanceof TLRPC.TL_wallPaperSolid) {
imageView.setImageBitmap(null);
imageView.setBackgroundColor(0xff000000 | wallpaper.bg_color);
} else {
int side = AndroidUtilities.dp(100);
TLRPC.PhotoSize size = null;
for (int a = 0; a < wallpaper.sizes.size(); a++) {
TLRPC.PhotoSize obj = wallpaper.sizes.get(a);
if (obj == null) {
continue;
}
int currentSide = obj.w >= obj.h ? obj.w : obj.h;
if (size == null || side > 100 && size.location != null && size.location.dc_id == Integer.MIN_VALUE || obj instanceof TLRPC.TL_photoCachedSize || currentSide <= side) {
size = obj;
}
}
if (size != null && size.location != null) {
imageView.setImage(size.location, "100_100", (Drawable) null);
}
imageView.setBackgroundColor(0x5a475866);
}
}
}
示例2: sendSticker
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendSticker(TLRPC.Document document, long peer, MessageObject replyingMessageObject) {
if (document == null) {
return;
}
if ((int) peer == 0) {
int high_id = (int) (peer >> 32);
TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance().getEncryptedChat(high_id);
if (encryptedChat == null) {
return;
}
if (document.thumb instanceof TLRPC.TL_photoSize) {
File file = FileLoader.getPathToAttach(document.thumb, true);
if (file.exists()) {
try {
int len = (int) file.length();
byte[] arr = new byte[(int) file.length()];
RandomAccessFile reader = new RandomAccessFile(file, "r");
reader.readFully(arr);
TLRPC.TL_document newDocument = new TLRPC.TL_document();
newDocument.thumb = new TLRPC.TL_photoCachedSize();
newDocument.thumb.location = document.thumb.location;
newDocument.thumb.size = document.thumb.size;
newDocument.thumb.w = document.thumb.w;
newDocument.thumb.h = document.thumb.h;
newDocument.thumb.type = document.thumb.type;
newDocument.thumb.bytes = arr;
newDocument.id = document.id;
newDocument.access_hash = document.access_hash;
newDocument.date = document.date;
newDocument.mime_type = document.mime_type;
newDocument.size = document.size;
newDocument.dc_id = document.dc_id;
newDocument.attributes = document.attributes;
if (newDocument.mime_type == null) {
newDocument.mime_type = "";
}
document = newDocument;
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
}
}
SendMessagesHelper.getInstance().sendMessage((TLRPC.TL_document) document, null, null, peer, replyingMessageObject, null, null);
}