use of org.qii.weiciyuan.bean.CommentListBean in project weiciyuan by qii.
the class CommentsToMeTimeLineFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
userBean = getArguments().getParcelable(ARGUMENTS_USER_EXTRA);
accountBean = getArguments().getParcelable(ARGUMENTS_ACCOUNT_EXTRA);
token = getArguments().getString(ARGUMENTS_TOKEN_EXTRA);
super.onActivityCreated(savedInstanceState);
switch(getCurrentState(savedInstanceState)) {
case FIRST_TIME_START:
getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
break;
case ACTIVITY_DESTROY_AND_CREATE:
timeLinePosition = (TimeLinePosition) savedInstanceState.getSerializable(ARGUMENTS_TIMELINE_POSITION_EXTRA);
Loader<CommentTimeLineData> loader = getLoaderManager().getLoader(DB_CACHE_LOADER_ID);
if (loader != null) {
getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
}
CommentListBean savedBean = savedInstanceState.getParcelable(ARGUMENTS_DATA_EXTRA);
if (savedBean != null && savedBean.getSize() > 0) {
clearAndReplaceValue(savedBean);
timeLineAdapter.notifyDataSetChanged();
refreshLayout(getList());
// setListViewPositionFromPositionsCache();
AppNotificationCenter.getInstance().addCallback(callback);
} else {
getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
}
break;
}
}
use of org.qii.weiciyuan.bean.CommentListBean in project weiciyuan by qii.
the class CommentsToMeMsgLoader method loadData.
public CommentListBean loadData() throws WeiboException {
MainCommentsTimeLineDao dao = new MainCommentsTimeLineDao(token);
dao.setSince_id(sinceId);
dao.setMax_id(maxId);
CommentListBean result = null;
lock.lock();
try {
result = dao.getGSONMsgList();
} finally {
lock.unlock();
}
return result;
}
use of org.qii.weiciyuan.bean.CommentListBean in project weiciyuan by qii.
the class MentionsCommentTimeLineFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
userBean = getArguments().getParcelable(ARGUMENTS_USER_EXTRA);
accountBean = getArguments().getParcelable(ARGUMENTS_ACCOUNT_EXTRA);
token = getArguments().getString(ARGUMENTS_TOKEN_EXTRA);
super.onActivityCreated(savedInstanceState);
switch(getCurrentState(savedInstanceState)) {
case FIRST_TIME_START:
getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
break;
case ACTIVITY_DESTROY_AND_CREATE:
timeLinePosition = (TimeLinePosition) savedInstanceState.getSerializable(ARGUMENTS_TIMELINE_POSITION_EXTRA);
CommentListBean savedBean = savedInstanceState.getParcelable(ARGUMENTS_DATA_EXTRA);
Loader<CommentTimeLineData> loader = getLoaderManager().getLoader(DB_CACHE_LOADER_ID);
if (loader != null) {
getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
}
if (savedBean != null && savedBean.getSize() > 0) {
clearAndReplaceValue(savedBean);
timeLineAdapter.notifyDataSetChanged();
refreshLayout(getList());
AppNotificationCenter.getInstance().addCallback(callback);
} else {
getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
}
break;
}
}
use of org.qii.weiciyuan.bean.CommentListBean in project weiciyuan by qii.
the class AppNotificationCenter method showAndroidNotification.
public void showAndroidNotification(AccountBean account) {
UnreadBean unreadBean = unreadBeans.get(account);
MessageListBean mentions = unreadMentions.get(account);
CommentListBean comments = unreadComments.get(account);
CommentListBean mentionsComment = unreadMentionsComment.get(account);
String accountId = account.getUid();
if (mentions == null) {
mentions = new MessageListBean();
}
addDatabaseUnreadMentionsWeibo(accountId, mentions);
Utility.removeDuplicateAndSortStatus(mentions.getItemList());
if (comments == null) {
comments = new CommentListBean();
}
addDatabaseUnreadCommentsToMe(accountId, comments);
Utility.removeDuplicateAndSortComment(comments.getItemList());
if (mentionsComment == null) {
mentionsComment = new CommentListBean();
}
addDatabaseUnreadMentionsComment(accountId, mentionsComment);
Utility.removeDuplicateAndSortComment(mentionsComment.getItemList());
showNotification(GlobalContext.getInstance(), account, mentions, comments, mentionsComment, unreadBean);
}
use of org.qii.weiciyuan.bean.CommentListBean in project weiciyuan by qii.
the class CommentToMeTimeLineDBTask method asyncReplace.
public static void asyncReplace(final CommentListBean list, final String accountId) {
final CommentListBean data = new CommentListBean();
data.replaceAll(list);
new Thread(new Runnable() {
@Override
public void run() {
deleteAllComments(accountId);
addCommentLineMsg(data, accountId);
}
}).start();
}
Aggregations