use of org.qii.weiciyuan.bean.android.MessageTimeLineData in project weiciyuan by qii.
the class FriendsTimeLineDBTask method getOtherGroupData.
public static List<MessageTimeLineData> getOtherGroupData(String accountId, String exceptGroupId) {
List<MessageTimeLineData> data = new ArrayList<MessageTimeLineData>();
if (!"0".equals(exceptGroupId)) {
TimeLinePosition position = getPosition(accountId);
MessageListBean msgList = getHomeLineMsgList(accountId, position.position + AppConfig.DB_CACHE_COUNT_OFFSET);
MessageTimeLineData home = new MessageTimeLineData("0", msgList, position);
data.add(home);
}
MessageTimeLineData biGroup = HomeOtherGroupTimeLineDBTask.getTimeLineData(accountId, "1");
data.add(biGroup);
GroupListBean groupListBean = GroupDBTask.get(accountId);
if (groupListBean != null) {
List<GroupBean> lists = groupListBean.getLists();
for (GroupBean groupBean : lists) {
MessageTimeLineData dbMsg = HomeOtherGroupTimeLineDBTask.getTimeLineData(accountId, groupBean.getId());
data.add(dbMsg);
}
}
Iterator<MessageTimeLineData> iterator = data.iterator();
while (iterator.hasNext()) {
MessageTimeLineData single = iterator.next();
if (single.groupId.equals(exceptGroupId)) {
iterator.remove();
break;
}
}
return data;
}
use of org.qii.weiciyuan.bean.android.MessageTimeLineData in project weiciyuan by qii.
the class FriendsTimeLineFragment method handleDBCacheResultData.
private void handleDBCacheResultData(List<MessageTimeLineData> result) {
for (MessageTimeLineData single : result) {
putToGroupDataMemoryCache(single.groupId, single.msgList);
positionCache.put(single.groupId, single.position);
}
}
use of org.qii.weiciyuan.bean.android.MessageTimeLineData in project weiciyuan by qii.
the class FriendsTimeLineDBTask method getRecentGroupData.
public static MessageTimeLineData getRecentGroupData(String accountId) {
String groupId = getRecentGroupId(accountId);
MessageListBean msgList;
TimeLinePosition position;
if (groupId.equals("0")) {
position = getPosition(accountId);
msgList = getHomeLineMsgList(accountId, position.position + AppConfig.DB_CACHE_COUNT_OFFSET);
} else {
position = HomeOtherGroupTimeLineDBTask.getPosition(accountId, groupId);
msgList = HomeOtherGroupTimeLineDBTask.get(accountId, groupId, position.position + AppConfig.DB_CACHE_COUNT_OFFSET);
}
return new MessageTimeLineData(groupId, msgList, position);
}
use of org.qii.weiciyuan.bean.android.MessageTimeLineData in project weiciyuan by qii.
the class HomeOtherGroupTimeLineDBTask method getTimeLineData.
static MessageTimeLineData getTimeLineData(String accountId, String groupId) {
TimeLinePosition position = getPosition(accountId, groupId);
MessageListBean msgList = get(accountId, groupId, position.position + AppConfig.DB_CACHE_COUNT_OFFSET);
return new MessageTimeLineData(groupId, msgList, position);
}
use of org.qii.weiciyuan.bean.android.MessageTimeLineData in project weiciyuan by qii.
the class FriendsTimeLineFragment method handleDBCacheOnProgressUpdateData.
private void handleDBCacheOnProgressUpdateData(MessageTimeLineData[] result) {
if (result != null && result.length > 0) {
MessageTimeLineData recentData = result[0];
getList().replaceData(recentData.msgList);
putToGroupDataMemoryCache(recentData.groupId, recentData.msgList);
positionCache.put(recentData.groupId, recentData.position);
currentGroupId = recentData.groupId;
}
getPullToRefreshListView().setVisibility(View.VISIBLE);
getAdapter().notifyDataSetChanged();
setListViewPositionFromPositionsCache();
if (getActivity().getActionBar().getNavigationMode() == ActionBar.NAVIGATION_MODE_LIST) {
getActivity().getActionBar().setSelectedNavigationItem(getRecentNavIndex());
}
refreshLayout(getList());
/**
* when this account first open app,if he don't have any data in database,fetch data from server automally
*/
if (getList().getSize() == 0) {
getPullToRefreshListView().setRefreshing();
loadNewMsg();
} else {
new RefreshReCmtCountTask(FriendsTimeLineFragment.this, getList()).executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
}
}
Aggregations