Search in sources :

Example 16 with MessageListBean

use of org.qii.weiciyuan.bean.MessageListBean 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);
}
Also used : UnreadBean(org.qii.weiciyuan.bean.UnreadBean) MessageListBean(org.qii.weiciyuan.bean.MessageListBean) CommentListBean(org.qii.weiciyuan.bean.CommentListBean)

Example 17 with MessageListBean

use of org.qii.weiciyuan.bean.MessageListBean 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);
}
Also used : MessageListBean(org.qii.weiciyuan.bean.MessageListBean) TimeLinePosition(org.qii.weiciyuan.bean.android.TimeLinePosition) MessageTimeLineData(org.qii.weiciyuan.bean.android.MessageTimeLineData)

Example 18 with MessageListBean

use of org.qii.weiciyuan.bean.MessageListBean 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);
}
Also used : MessageListBean(org.qii.weiciyuan.bean.MessageListBean) TimeLinePosition(org.qii.weiciyuan.bean.android.TimeLinePosition) MessageTimeLineData(org.qii.weiciyuan.bean.android.MessageTimeLineData)

Example 19 with MessageListBean

use of org.qii.weiciyuan.bean.MessageListBean in project weiciyuan by qii.

the class MentionsWeiboTimeLineFragment 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<MentionTimeLineData> loader = getLoaderManager().getLoader(DB_CACHE_LOADER_ID);
            if (loader != null) {
                getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
            }
            MessageListBean savedBean = savedInstanceState.getParcelable(ARGUMENTS_DATA_EXTRA);
            if (savedBean != null && savedBean.getSize() > 0) {
                getList().replaceData(savedBean);
                timeLineAdapter.notifyDataSetChanged();
                refreshLayout(getList());
                AppNotificationCenter.getInstance().addCallback(callback);
            } else {
                getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
            }
            break;
    }
}
Also used : MessageListBean(org.qii.weiciyuan.bean.MessageListBean) MentionTimeLineData(org.qii.weiciyuan.bean.android.MentionTimeLineData)

Example 20 with MessageListBean

use of org.qii.weiciyuan.bean.MessageListBean in project weiciyuan by qii.

the class FriendsTimeLineFragment method putToGroupDataMemoryCache.

private void putToGroupDataMemoryCache(String groupId, MessageListBean value) {
    MessageListBean copy = new MessageListBean();
    copy.addNewData(value);
    groupDataCache.put(groupId, copy);
}
Also used : MessageListBean(org.qii.weiciyuan.bean.MessageListBean)

Aggregations

MessageListBean (org.qii.weiciyuan.bean.MessageListBean)25 Gson (com.google.gson.Gson)8 JsonSyntaxException (com.google.gson.JsonSyntaxException)8 MessageBean (org.qii.weiciyuan.bean.MessageBean)8 ArrayList (java.util.ArrayList)6 CommentListBean (org.qii.weiciyuan.bean.CommentListBean)5 Cursor (android.database.Cursor)4 UnreadBean (org.qii.weiciyuan.bean.UnreadBean)4 TimeLinePosition (org.qii.weiciyuan.bean.android.TimeLinePosition)4 MentionTimeLineData (org.qii.weiciyuan.bean.android.MentionTimeLineData)3 MessageTimeLineData (org.qii.weiciyuan.bean.android.MessageTimeLineData)3 AccountBean (org.qii.weiciyuan.bean.AccountBean)2 MentionsWeiboTimeLineDao (org.qii.weiciyuan.dao.maintimeline.MentionsWeiboTimeLineDao)2 Notification (android.app.Notification)1 NotificationManager (android.app.NotificationManager)1 PendingIntent (android.app.PendingIntent)1 Context (android.content.Context)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 Bitmap (android.graphics.Bitmap)1