本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}