use of org.qii.weiciyuan.bean.android.CommentTimeLineData in project weiciyuan by qii.
the class CommentsByMeTimeLineFragment 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();
} else {
getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
}
break;
}
}
use of org.qii.weiciyuan.bean.android.CommentTimeLineData 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.android.CommentTimeLineData 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.android.CommentTimeLineData in project weiciyuan by qii.
the class AppNotificationCenter method addDatabaseUnreadMentionsComment.
private void addDatabaseUnreadMentionsComment(String accountId, CommentListBean mentions) {
CommentTimeLineData dbData = MentionCommentsTimeLineDBTask.getCommentLineMsgList(accountId);
List<CommentBean> itemList = dbData.cmtList.getItemList();
TimeLinePosition position = dbData.position;
TreeSet<Long> newMsgIds = position.newMsgIds;
HashMap<Long, CommentBean> map = new HashMap<>();
for (CommentBean msg : itemList) {
map.put(msg.getIdLong(), msg);
}
for (Object object : newMsgIds) {
long id;
if (object instanceof Double) {
Double value = (Double) object;
id = value.longValue();
} else {
id = (Long) object;
}
CommentBean msg = map.get(id);
if (msg != null) {
mentions.getItemList().add(msg);
}
}
}
Aggregations