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


Java EMCursorResult类代码示例

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


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

示例1: loadAndShowData

import com.easemob.chat.EMCursorResult; //导入依赖的package包/类
private void loadAndShowData(){
    new Thread(new Runnable() {

           public void run() {
               try {
                   isLoading = true;
                   final EMCursorResult<EMGroupInfo> result = EMGroupManager.getInstance().getPublicGroupsFromServer(pagesize, cursor);
                   //获取group list
                   final List<EMGroupInfo> returnGroups = result.getData();
                   runOnUiThread(new Runnable() {

                       public void run() {
                           searchBtn.setVisibility(View.VISIBLE);
                           groupsList.addAll(returnGroups);
                           if(returnGroups.size() != 0){
                               //获取cursor
                               cursor = result.getCursor();
                               if(returnGroups.size() == pagesize)
                                   footLoadingLayout.setVisibility(View.VISIBLE);
                           }
                           if(isFirstLoading){
                               pb.setVisibility(View.INVISIBLE);
                               isFirstLoading = false;
                               //设置adapter
                               adapter = new GroupsAdapter(PublicGroupsActivity.this, 1, groupsList);
                               listView.setAdapter(adapter);
                           }else{
                               if(returnGroups.size() < pagesize){
                                   hasMoreData = false;
                                   footLoadingLayout.setVisibility(View.VISIBLE);
                                   footLoadingPB.setVisibility(View.GONE);
                                   footLoadingText.setText("No more data");
                               }
                               adapter.notifyDataSetChanged();
                           }
                           isLoading = false;
                       }
                   });
               } catch (EaseMobException e) {
                   e.printStackTrace();
                   runOnUiThread(new Runnable() {
                       public void run() {
                           isLoading = false;
                           pb.setVisibility(View.INVISIBLE);
                           footLoadingLayout.setVisibility(View.GONE);
                           Toast.makeText(PublicGroupsActivity.this, "加载数据失败,请检查网络或稍后重试", 0).show();
                       }
                   });
               }
           }
       }).start();
}
 
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:53,代码来源:PublicGroupsActivity.java

示例2: loadAndShowData

import com.easemob.chat.EMCursorResult; //导入依赖的package包/类
private void loadAndShowData(){
		new Thread(new Runnable() {

            public void run() {
                try {
                    isLoading = true;
                    final EMCursorResult<EMChatRoom> result = EMChatManager.getInstance().fetchPublicChatRoomsFromServer(pagesize, cursor);
                    //获取group list
                    final List<EMChatRoom> chatRooms = result.getData();
                    runOnUiThread(new Runnable() {

                        public void run() {
                            chatRoomList.addAll(chatRooms);
                            if(chatRooms.size() != 0){
                                //获取cursor
                                cursor = result.getCursor();
//                                if(chatRooms.size() == pagesize)
//                                    footLoadingLayout.setVisibility(View.VISIBLE);
                            }
                            if(isFirstLoading){
                                pb.setVisibility(View.INVISIBLE);
                                isFirstLoading = false;
                                //设置adapter
                                adapter = new ChatRoomAdapter(PublicChatRoomsActivity.this, 1, chatRoomList);
                                listView.setAdapter(adapter);
                                rooms.addAll(chatRooms);
                            }else{
                                if(chatRooms.size() < pagesize){
                                    hasMoreData = false;
                                    footLoadingLayout.setVisibility(View.VISIBLE);
                                    footLoadingPB.setVisibility(View.GONE);
                                    footLoadingText.setText(getResources().getString(R.string.no_more_messages));
                                }
                                adapter.notifyDataSetChanged();
                            }
                            isLoading = false;
                        }
                    });
                } catch (EaseMobException e) {
                    e.printStackTrace();
                    runOnUiThread(new Runnable() {
                        public void run() {
                            isLoading = false;
                            pb.setVisibility(View.INVISIBLE);
                            footLoadingLayout.setVisibility(View.GONE);
                            Toast.makeText(PublicChatRoomsActivity.this, getResources().getString(R.string.failed_to_load_data), 0).show();
                        }
                    });
                }
            }
        }).start();
	}
 
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:53,代码来源:PublicChatRoomsActivity.java

示例3: loadAndShowData

import com.easemob.chat.EMCursorResult; //导入依赖的package包/类
private void loadAndShowData() {
    new Thread(new Runnable() {

        public void run() {
            try {
                isLoading = true;
                final EMCursorResult<EMGroupInfo> result = EMGroupManager.getInstance().getPublicGroupsFromServer(pagesize, cursor);
                //获取group list
                final List<EMGroupInfo> returnGroups = result.getData();
                runOnUiThread(new Runnable() {

                    public void run() {
                        searchBtn.setVisibility(View.VISIBLE);
                        groupsList.addAll(returnGroups);
                        if (returnGroups.size() != 0) {
                            //获取cursor
                            cursor = result.getCursor();
                            if (returnGroups.size() == pagesize)
                                footLoadingLayout.setVisibility(View.VISIBLE);
                        }
                        if (isFirstLoading) {
                            pb.setVisibility(View.INVISIBLE);
                            isFirstLoading = false;
                            //设置adapter
                            adapter = new GroupsAdapter(PublicGroupsActivity.this, 1, groupsList);
                            listView.setAdapter(adapter);
                        } else {
                            if (returnGroups.size() < pagesize) {
                                hasMoreData = false;
                                footLoadingLayout.setVisibility(View.VISIBLE);
                                footLoadingPB.setVisibility(View.GONE);
                                footLoadingText.setText("No more data");
                            }
                            adapter.notifyDataSetChanged();
                        }
                        isLoading = false;
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        isLoading = false;
                        pb.setVisibility(View.INVISIBLE);
                        footLoadingLayout.setVisibility(View.GONE);
                        Toast.makeText(PublicGroupsActivity.this, "加载数据失败,请检查网络或稍后重试", 0).show();
                    }
                });
            }
        }
    }).start();
}
 
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:53,代码来源:PublicGroupsActivity.java

示例4: loadAndShowData

import com.easemob.chat.EMCursorResult; //导入依赖的package包/类
private void loadAndShowData() {
        new Thread(new Runnable() {

            public void run() {
                try {
                    isLoading = true;
                    final EMCursorResult<EMChatRoom> result = EMChatManager.getInstance().fetchPublicChatRoomsFromServer(pagesize, cursor);
                    //获取group list
                    final List<EMChatRoom> chatRooms = result.getData();
                    runOnUiThread(new Runnable() {

                        public void run() {
                            chatRoomList.addAll(chatRooms);
                            if (chatRooms.size() != 0) {
                                //获取cursor
                                cursor = result.getCursor();
//                                if(chatRooms.size() == pagesize)
//                                    footLoadingLayout.setVisibility(View.VISIBLE);
                            }
                            if (isFirstLoading) {
                                pb.setVisibility(View.INVISIBLE);
                                isFirstLoading = false;
                                //设置adapter
                                adapter = new ChatRoomAdapter(PublicChatRoomsActivity.this, 1, chatRoomList);
                                listView.setAdapter(adapter);
                                rooms.addAll(chatRooms);
                            } else {
                                if (chatRooms.size() < pagesize) {
                                    hasMoreData = false;
                                    footLoadingLayout.setVisibility(View.VISIBLE);
                                    footLoadingPB.setVisibility(View.GONE);
                                    footLoadingText.setText(getResources().getString(R.string.no_more_messages));
                                }
                                adapter.notifyDataSetChanged();
                            }
                            isLoading = false;
                        }
                    });
                } catch (EaseMobException e) {
                    e.printStackTrace();
                    runOnUiThread(new Runnable() {
                        public void run() {
                            isLoading = false;
                            pb.setVisibility(View.INVISIBLE);
                            footLoadingLayout.setVisibility(View.GONE);
                            Toast.makeText(PublicChatRoomsActivity.this, getResources().getString(R.string.failed_to_load_data), 0).show();
                        }
                    });
                }
            }
        }).start();
    }
 
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:53,代码来源:PublicChatRoomsActivity.java


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