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


Java TLRPC.TL_inputMessagesFilterPhotoVideo方法代码示例

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


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

示例1: loadMedia

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static void loadMedia(final long uid, final int offset, final int count, final int max_id, final int type, final boolean fromCache, final int classGuid) {
    final boolean isChannel = (int) uid < 0 && ChatObject.isChannel(-(int) uid);

    int lower_part = (int)uid;
    if (fromCache || lower_part == 0) {
        loadMediaDatabase(uid, offset, count, max_id, type, classGuid, isChannel);
    } else {
        TLRPC.TL_messages_search req = new TLRPC.TL_messages_search();
        req.offset = offset;
        req.limit = count + 1;
        req.max_id = max_id;
        if (type == MEDIA_PHOTOVIDEO) {
            req.filter = new TLRPC.TL_inputMessagesFilterPhotoVideo();
        } else if (type == MEDIA_FILE) {
            req.filter = new TLRPC.TL_inputMessagesFilterDocument();
        } else if (type == MEDIA_AUDIO) {
            req.filter = new TLRPC.TL_inputMessagesFilterVoice();
        } else if (type == MEDIA_URL) {
            req.filter = new TLRPC.TL_inputMessagesFilterUrl();
        } else if (type == MEDIA_MUSIC) {
            req.filter = new TLRPC.TL_inputMessagesFilterMusic();
        }
        req.q = "";
        req.peer = MessagesController.getInputPeer(lower_part);
        if (req.peer == null) {
            return;
        }
        int reqId = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
            @Override
            public void run(TLObject response, TLRPC.TL_error error) {
                if (error == null) {
                    final TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
                    boolean topReached;
                    if (res.messages.size() > count) {
                        topReached = false;
                        res.messages.remove(res.messages.size() - 1);
                    } else {
                        topReached = true;
                    }
                    processLoadedMedia(res, uid, offset, count, max_id, type, false, classGuid, isChannel, topReached);
                }
            }
        });
        ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:47,代码来源:SharedMediaQuery.java

示例2: getMediaCount

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static void getMediaCount(final long uid, final int type, final int classGuid, boolean fromCache) {
    int lower_part = (int)uid;
    if (fromCache || lower_part == 0) {
        getMediaCountDatabase(uid, type, classGuid);
    } else {
        TLRPC.TL_messages_search req = new TLRPC.TL_messages_search();
        req.offset = 0;
        req.limit = 1;
        req.max_id = 0;
        if (type == MEDIA_PHOTOVIDEO) {
            req.filter = new TLRPC.TL_inputMessagesFilterPhotoVideo();
        } else if (type == MEDIA_FILE) {
            req.filter = new TLRPC.TL_inputMessagesFilterDocument();
        } else if (type == MEDIA_AUDIO) {
            req.filter = new TLRPC.TL_inputMessagesFilterVoice();
        } else if (type == MEDIA_URL) {
            req.filter = new TLRPC.TL_inputMessagesFilterUrl();
        } else if (type == MEDIA_MUSIC) {
            req.filter = new TLRPC.TL_inputMessagesFilterMusic();
        }
        req.q = "";
        req.peer = MessagesController.getInputPeer(lower_part);
        if (req.peer == null) {
            return;
        }
        int reqId = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
            @Override
            public void run(TLObject response, TLRPC.TL_error error) {
                if (error == null) {
                    final TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
                    MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, true, true);
                    int count;
                    if (res instanceof TLRPC.TL_messages_messages) {
                        count = res.messages.size();
                    } else {
                        count = res.count;
                    }
                    AndroidUtilities.runOnUIThread(new Runnable() {
                        @Override
                        public void run() {
                            MessagesController.getInstance().putUsers(res.users, false);
                            MessagesController.getInstance().putChats(res.chats, false);
                        }
                    });

                    processLoadedMediaCount(count, uid, type, classGuid, false);
                }
            }
        });
        ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:53,代码来源:SharedMediaQuery.java


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