当前位置: 首页>>代码示例>>Java>>正文


Java TLRPC类代码示例

本文整理汇总了Java中org.telegram.tgnet.TLRPC的典型用法代码示例。如果您正苦于以下问题:Java TLRPC类的具体用法?Java TLRPC怎么用?Java TLRPC使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TLRPC类属于org.telegram.tgnet包,在下文中一共展示了TLRPC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkAndUpdateAvatar

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public void checkAndUpdateAvatar() {
    TLRPC.FileLocation newPhoto = null;
    TLRPC.User user = parentFragment.getCurrentUser();
    TLRPC.Chat chat = parentFragment.getCurrentChat();
    if (user != null) {
        if (user.photo != null) {
            newPhoto = user.photo.photo_small;
        }
        avatarDrawable.setInfo(user);
    } else if (chat != null) {
        if (chat.photo != null) {
            newPhoto = chat.photo.photo_small;
        }
        avatarDrawable.setInfo(chat);
    }
    int radius = AndroidUtilities.dp(AndroidUtilities.getIntDef("chatHeaderAvatarRadius", 32));
    if (avatarImageView != null) {
        avatarImageView.setImage(newPhoto, "50_50", avatarDrawable);
        avatarImageView.setRoundRadius(radius);
    }
    //Chat header photo
    if(avatarDrawable != null)avatarDrawable.setRadius(radius);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:24,代码来源:ChatAvatarContainer.java

示例2: refreshCategory

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public void refreshCategory() {
    needRefreshCategory = false;

    SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
    int catId = sharedPreferences.getInt("selectedCat", -1);

    // TODO: 1/21/2017 The issue on category is fixed.
    MessagesController.getInstance().reset();
    TLRPC.TL_messages_dialogs dialogs = new TLRPC.TL_messages_dialogs();
    MessagesController.getInstance().processLoadedDialogs(dialogs, null, 0, 1, false, false, false);



    if (dialogsAdapter != null) {
        dialogsAdapter.notifyDataSetChanged();
    }
    if (!hideTabs) {
        updateTabs();
    }

}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:22,代码来源:DialogsActivity.java

示例3: calcFeaturedStickersHash

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
private static int calcFeaturedStickersHash(ArrayList<TLRPC.StickerSetCovered> sets) {
    long acc = 0;
    for (int a = 0; a < sets.size(); a++) {
        TLRPC.StickerSet set = sets.get(a).set;
        if (set.archived) {
            continue;
        }
        int high_id = (int) (set.id >> 32);
        int lower_id = (int) set.id;
        acc = ((acc * 20261) + 0x80000000L + high_id) % 0x80000000L;
        acc = ((acc * 20261) + 0x80000000L + lower_id) % 0x80000000L;
        if (unreadStickerSets.contains(set.id)) {
            acc = ((acc * 20261) + 0x80000000L + 1) % 0x80000000L;
        }
    }
    return (int) acc;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:18,代码来源:StickersQuery.java

示例4: openByUserNameasHidden

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public void openByUserNameasHidden(String username, final Activity activityContext) {
    TLRPC.User user = getInstance().getUser(username);
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = username;
    if (user == null) {
        ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
            @Override
            public void run(TLObject response, TLRPC.TL_error error) {
                if (error == null) {
                    TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                    MessagesController.getInstance().putUsers(res.users, false);
                    MessagesController.getInstance().putChats(res.chats, false);
                    MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, false, true);
                    if (res != null && res.users != null && res.chats.isEmpty() && !res.users.isEmpty()) {
                        MessageObject.blockMode = true;
                        MessageObject.spamBotId = (long) ((TLRPC.User) res.users.get(0)).id;
                        MessageObject.context = activityContext;
                        SendMessagesHelper.getInstance().sendMessage("/start", (long) ((TLRPC.User) res.users.get(0)).id, null, null, false, false, null, null, null);
                    }
                }
            }
        });
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:25,代码来源:MessagesController.java

示例5: onBindViewHolder

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    switch (holder.getItemViewType()) {
        case 0:
            TLRPC.Document sticker = cache.get(position);
            ((StickerEmojiCell) holder.itemView).setSticker(sticker, false);
            break;
        case 1:
            if (position == totalItems) {
                int row = (position - 1) / stickersPerRow;
                TLRPC.TL_messages_stickerSet pack = rowStartPack.get(row);
                if (pack == null) {
                    ((EmptyCell) holder.itemView).setHeight(1);
                } else {
                    int height = stickersGridView.getMeasuredHeight() - (int) Math.ceil(pack.documents.size() / (float) stickersPerRow) * AndroidUtilities.dp(82);
                    ((EmptyCell) holder.itemView).setHeight(height > 0 ? height : 1);
                }
            } else {
                ((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(82));
            }
            break;
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:24,代码来源:StickerMasksView.java

示例6: replaceWithLink

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public CharSequence replaceWithLink(CharSequence source, String param, ArrayList<Integer> uids, AbstractMap<Integer, TLRPC.User> usersDict) {
    int start = TextUtils.indexOf(source, param);
    if (start >= 0) {
        SpannableStringBuilder names = new SpannableStringBuilder("");
        for (int a = 0; a < uids.size(); a++) {
            TLRPC.User user = null;
            if (usersDict != null) {
                user = usersDict.get(uids.get(a));
            }
            if (user == null) {
                user = MessagesController.getInstance().getUser(uids.get(a));
            }
            if (user != null) {
                String name = UserObject.getUserName(user);
                start = names.length();
                if (names.length() != 0) {
                    names.append(", ");
                }
                names.append(name);
                names.setSpan(new URLSpanNoUnderlineBold("" + user.id), start, start + name.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }
        }
        return TextUtils.replace(source, new String[]{param}, new CharSequence[]{names});
    }
    return source;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:27,代码来源:MessageObject.java

示例7: setUser

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public void setUser(TLRPC.User user) {
    if (user == null) {
        nameTextView.setText("");
        usernameTextView.setText("");
        imageView.setImageDrawable(null);
        return;
    }
    avatarDrawable.setInfo(user);
    if (user.photo != null && user.photo.photo_small != null) {
        imageView.setImage(user.photo.photo_small, "50_50", avatarDrawable);
    } else {
        imageView.setImageDrawable(avatarDrawable);
    }
    nameTextView.setText(UserObject.getUserName(user));
    if (user.username != null) {
        usernameTextView.setText("@" + user.username);
    } else {
        usernameTextView.setText("");
    }
    imageView.setVisibility(VISIBLE);
    usernameTextView.setVisibility(VISIBLE);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:23,代码来源:MentionCell.java

示例8: getUsersInternal

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public void getUsersInternal(String usersToLoad, ArrayList<TLRPC.User> result) throws Exception {
    if (usersToLoad == null || usersToLoad.length() == 0 || result == null) {
        return;
    }
    SQLiteCursor cursor = database.queryFinalized(String.format(Locale.US, "SELECT data, status FROM users WHERE uid IN(%s)", usersToLoad));
    while (cursor.next()) {
        try {
            NativeByteBuffer data = cursor.byteBufferValue(0);
            if (data != null) {
                TLRPC.User user = TLRPC.User.TLdeserialize(data, data.readInt32(false), false);
                data.reuse();
                if (user != null) {
                    if (user.status != null) {
                        user.status.expires = cursor.intValue(1);
                    }
                    result.add(user);
                }
            }
        } catch (Exception e) {
            FileLog.e("tmessages", e);
        }
    }
    cursor.dispose();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:25,代码来源:MessagesStorage.java

示例9: ChannelUsersActivity

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public ChannelUsersActivity(Bundle args) {
    super(args);
    chatId = arguments.getInt("chat_id");
    type = arguments.getInt("type");
    TLRPC.Chat chat = MessagesController.getInstance().getChat(chatId);
    if (chat != null) {
        if (chat.creator) {
            isAdmin = true;
            isPublic = (chat.flags & TLRPC.CHAT_FLAG_IS_PUBLIC) != 0;
        }
        isMegagroup = chat.megagroup;
    }
    if (type == 0) {
        participantsStartRow = 0;
    } else if (type == 1) {
        participantsStartRow = isAdmin && isMegagroup ? 4 : 0;
    } else if (type == 2) {
        participantsStartRow = isAdmin ? (isPublic ? 2 : 3) : 0;
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:21,代码来源:ChannelUsersActivity.java

示例10: FileLoadOperation

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public FileLoadOperation(TLRPC.FileLocation photoLocation, String extension, int size) {
    if (photoLocation instanceof TLRPC.TL_fileEncryptedLocation) {
        location = new TLRPC.TL_inputEncryptedFileLocation();
        location.id = photoLocation.volume_id;
        location.volume_id = photoLocation.volume_id;
        location.access_hash = photoLocation.secret;
        location.local_id = photoLocation.local_id;
        iv = new byte[32];
        System.arraycopy(photoLocation.iv, 0, iv, 0, iv.length);
        key = photoLocation.key;
        datacenter_id = photoLocation.dc_id;
    } else if (photoLocation instanceof TLRPC.TL_fileLocation) {
        location = new TLRPC.TL_inputFileLocation();
        location.volume_id = photoLocation.volume_id;
        location.secret = photoLocation.secret;
        location.local_id = photoLocation.local_id;
        datacenter_id = photoLocation.dc_id;
    }
    totalBytesCount = size;
    ext = extension != null ? extension : "jpg";
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:22,代码来源:FileLoadOperation.java

示例11: sendBotStart

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public void sendBotStart(final TLRPC.User user, String botHash) {
    if (user == null) {
        return;
    }
    TLRPC.TL_messages_startBot req = new TLRPC.TL_messages_startBot();
    req.bot = getInputUser(user);
    req.peer = getInputPeer(user.id);
    req.start_param = botHash;
    req.random_id = Utilities.random.nextLong();
    ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
        @Override
        public void run(TLObject response, TLRPC.TL_error error) {
            if (error != null) {
                return;
            }
            processUpdates((TLRPC.Updates) response, false);
        }
    });
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:20,代码来源:MessagesController.java

示例12: getHeaderTitle

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
private String getHeaderTitle() {
    SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
    int value = themePrefs.getInt("chatsHeaderTitle", 0);
    String title = LocaleController.getString("AppName", R.string.AppName);
    TLRPC.User user = UserConfig.getCurrentUser();
    if (value == 1) {
        title = LocaleController.getString("ShortAppName", R.string.ShortAppName);
    } else if (value == 2) {
        if (user != null && (user.first_name != null || user.last_name != null)) {
            title = ContactsController.formatName(user.first_name, user.last_name);
        }
    } else if (value == 3) {
        if (user != null && user.username != null && user.username.length() != 0) {
            title = "@" + user.username;
        }
    } else if (value == 4) {
        title = "";
    }
    return title;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:21,代码来源:DialogsActivity.java

示例13: performLogout

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public void performLogout(boolean byUser) {
    SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE).edit();
    editor.clear().commit();
    editor = ApplicationLoader.applicationContext.getSharedPreferences("emoji", Activity.MODE_PRIVATE).edit();
    editor.putLong("lastGifLoadTime", 0).commit();
    editor = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).edit();
    editor.remove("gifhint").commit();

    if (byUser) {
        unregistedPush();
        TLRPC.TL_auth_logOut req = new TLRPC.TL_auth_logOut();
        ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
            @Override
            public void run(TLObject response, TLRPC.TL_error error) {
                ConnectionsManager.getInstance().cleanup();
            }
        });
    } else {
        ConnectionsManager.getInstance().cleanup();
    }
    UserConfig.clearConfig();
    NotificationCenter.getInstance().postNotificationName(NotificationCenter.appDidLogout);
    MessagesStorage.getInstance().cleanup(false);
    cleanup();
    ContactsController.getInstance().deleteAllAppAccounts();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:27,代码来源:MessagesController.java

示例14: setSticker

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
public void setSticker(TLRPC.Document document, int side) {
    if (document != null && document.thumb != null) {
        imageView.setImage(document.thumb.location, null, "webp", null);
    }
    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);
    }
    if (getBackground() != null) {
        getBackground().setAlpha(230);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:23,代码来源:StickerCell.java

示例15: isPhotoDataChanged

import org.telegram.tgnet.TLRPC; //导入依赖的package包/类
private boolean isPhotoDataChanged(MessageObject object) {
    if (object.type == 0 || object.type == 14) {
        return false;
    }
    if (object.type == 4) {
        if (currentUrl == null) {
            return true;
        }
        double lat = object.messageOwner.media.geo.lat;
        double lon = object.messageOwner.media.geo._long;
        String url = String.format(Locale.US, "https://maps.googleapis.com/maps/api/staticmap?center=%f,%f&zoom=15&size=100x100&maptype=roadmap&scale=%d&markers=color:red|size:mid|%f,%f&sensor=false", lat, lon, Math.min(2, (int) Math.ceil(density)), lat, lon);
        if (!url.equals(currentUrl)) {
            return true;
        }
    } else if (currentPhotoObject == null || currentPhotoObject.location instanceof TLRPC.TL_fileLocationUnavailable) {
        return true;
    } else if (currentMessageObject != null && photoNotSet) {
        File cacheFile = FileLoader.getPathToMessage(currentMessageObject.messageOwner);
        if (cacheFile.exists()) { //TODO
            return true;
        }
    }
    return false;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:25,代码来源:ChatMessageCell.java


注:本文中的org.telegram.tgnet.TLRPC类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。