Search in sources :

Example 11 with CommentBean

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

the class BrowserWeiboMsgCommentAndRepostAdapter method bindCommentData.

private void bindCommentData(ViewHolder holder, int position) {
    Drawable drawable = bg.get(holder);
    if (drawable != null) {
        holder.listview_root.setBackgroundDrawable(drawable);
    } else {
        drawable = holder.listview_root.getBackground();
        bg.put(holder, drawable);
    }
    if (listView.getCheckedItemPosition() == position + listView.getHeaderViewsCount()) {
        holder.listview_root.setBackgroundColor(checkedBG);
    }
    final CommentBean comment = (CommentBean) getItem(position);
    UserBean user = comment.getUser();
    if (user != null) {
        holder.username.setVisibility(View.VISIBLE);
        if (!TextUtils.isEmpty(user.getRemark())) {
            holder.username.setText(new StringBuilder(user.getScreen_name()).append("(").append(user.getRemark()).append(")").toString());
        } else {
            holder.username.setText(user.getScreen_name());
        }
        if (!SettingUtility.getEnableCommentRepostListAvatar()) {
            holder.avatar.setLayoutParams(new RelativeLayout.LayoutParams(0, 0));
        } else {
            buildAvatar(holder.avatar, position, user);
        }
    } else {
        holder.username.setVisibility(View.INVISIBLE);
        holder.avatar.setVisibility(View.INVISIBLE);
    }
    holder.avatar.checkVerified(user);
    holder.content.setText(comment.getListViewSpannableString());
    holder.time.setTime(comment.getMills());
    holder.reply.setVisibility(View.VISIBLE);
    holder.reply.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getActivity(), WriteReplyToCommentActivity.class);
            intent.putExtra("token", GlobalContext.getInstance().getSpecialToken());
            intent.putExtra("msg", comment);
            getActivity().startActivity(intent);
        }
    });
}
Also used : UserBean(org.qii.weiciyuan.bean.UserBean) WriteReplyToCommentActivity(org.qii.weiciyuan.ui.send.WriteReplyToCommentActivity) Drawable(android.graphics.drawable.Drawable) RelativeLayout(android.widget.RelativeLayout) Intent(android.content.Intent) CommentBean(org.qii.weiciyuan.bean.CommentBean) ImageView(android.widget.ImageView) View(android.view.View) TimeLineAvatarImageView(org.qii.weiciyuan.support.lib.TimeLineAvatarImageView) TextView(android.widget.TextView) TimeTextView(org.qii.weiciyuan.support.lib.TimeTextView) ListView(android.widget.ListView)

Example 12 with CommentBean

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

the class CommentListAdapter method bindViewData.

@Override
protected void bindViewData(final ViewHolder holder, int position) {
    Drawable drawable = bg.get(holder);
    if (drawable != null) {
        holder.listview_root.setBackgroundDrawable(drawable);
    } else {
        drawable = holder.listview_root.getBackground();
        bg.put(holder, drawable);
    }
    if (listView.getCheckedItemPosition() == position + 1) {
        holder.listview_root.setBackgroundColor(checkedBG);
    }
    final CommentBean comment = getList().get(position);
    UserBean user = comment.getUser();
    if (user != null) {
        holder.username.setVisibility(View.VISIBLE);
        if (!TextUtils.isEmpty(user.getRemark())) {
            holder.username.setText(new StringBuilder(user.getScreen_name()).append("(").append(user.getRemark()).append(")").toString());
        } else {
            holder.username.setText(user.getScreen_name());
        }
        if (!showOriStatus && !SettingUtility.getEnableCommentRepostListAvatar()) {
            holder.avatar.setLayoutParams(new RelativeLayout.LayoutParams(0, 0));
        } else {
            buildAvatar(holder.avatar, position, user);
        }
    } else {
        holder.username.setVisibility(View.INVISIBLE);
        holder.avatar.setVisibility(View.INVISIBLE);
    }
    holder.content.setText(comment.getListViewSpannableString());
    holder.time.setTime(comment.getMills());
    if (holder.source != null) {
        holder.source.setText(comment.getSourceString());
    }
    holder.repost_content.setVisibility(View.GONE);
    holder.repost_content_pic.setVisibility(View.GONE);
    CommentBean reply = comment.getReply_comment();
    if (holder.replyIV != null) {
        holder.replyIV.setVisibility(View.GONE);
    }
    if (reply != null && showOriStatus) {
        if (holder.repost_layout != null) {
            holder.repost_layout.setVisibility(View.VISIBLE);
        }
        holder.repost_flag.setVisibility(View.VISIBLE);
        holder.repost_content.setVisibility(View.VISIBLE);
        holder.repost_content.setText(reply.getListViewSpannableString());
        holder.repost_content.setTag(reply.getId());
    } else {
        MessageBean repost_msg = comment.getStatus();
        if (repost_msg != null && showOriStatus) {
            buildOriWeiboContent(repost_msg, holder, position);
        } else {
            if (holder.repost_layout != null) {
                holder.repost_layout.setVisibility(View.GONE);
            }
            holder.repost_flag.setVisibility(View.GONE);
            if (holder.replyIV != null) {
                holder.replyIV.setVisibility(View.VISIBLE);
                holder.replyIV.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(getActivity(), WriteReplyToCommentActivity.class);
                        intent.putExtra("token", GlobalContext.getInstance().getSpecialToken());
                        intent.putExtra("msg", comment);
                        getActivity().startActivity(intent);
                    }
                });
            }
        }
    }
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) UserBean(org.qii.weiciyuan.bean.UserBean) WriteReplyToCommentActivity(org.qii.weiciyuan.ui.send.WriteReplyToCommentActivity) Drawable(android.graphics.drawable.Drawable) RelativeLayout(android.widget.RelativeLayout) Intent(android.content.Intent) CommentBean(org.qii.weiciyuan.bean.CommentBean) AbsListView(android.widget.AbsListView) AutoScrollListView(org.qii.weiciyuan.support.lib.AutoScrollListView) View(android.view.View) ListView(android.widget.ListView)

Example 13 with CommentBean

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

the class CommentsToMeTimeLineFragment method addUnreadMessage.

private void addUnreadMessage(CommentListBean data) {
    if (data != null && data.getSize() > 0) {
        CommentBean last = data.getItem(data.getSize() - 1);
        boolean dup = getList().getItemList().contains(last);
        if (!dup) {
            addNewDataAndRememberPosition(data, true);
        }
    }
}
Also used : CommentBean(org.qii.weiciyuan.bean.CommentBean)

Example 14 with CommentBean

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

the class MentionsCommentTimeLineFragment method addUnreadMessage.

private void addUnreadMessage(CommentListBean data) {
    if (data != null && data.getSize() > 0) {
        CommentBean last = data.getItem(data.getSize() - 1);
        boolean dup = getList().getItemList().contains(last);
        if (!dup) {
            addNewDataAndRememberPosition(data);
        }
    }
}
Also used : CommentBean(org.qii.weiciyuan.bean.CommentBean)

Example 15 with CommentBean

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

the class SendReplyToCommentService method onStartCommand.

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    int lastNotificationId = intent.getIntExtra("lastNotificationId", -1);
    if (lastNotificationId != -1) {
        NotificationUtility.cancel(lastNotificationId);
    }
    String token = intent.getStringExtra("token");
    AccountBean account = (AccountBean) intent.getParcelableExtra("account");
    String content = intent.getStringExtra("content");
    String repostContent = intent.getStringExtra("repostContent");
    CommentBean oriMsg = (CommentBean) intent.getParcelableExtra("oriMsg");
    ReplyDraftBean replyDraftBean = (ReplyDraftBean) intent.getParcelableExtra("draft");
    WeiboSendTask task = new WeiboSendTask(account, token, content, repostContent, oriMsg, replyDraftBean);
    task.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
    tasksResult.put(task, false);
    return START_REDELIVER_INTENT;
}
Also used : ReplyDraftBean(org.qii.weiciyuan.support.database.draftbean.ReplyDraftBean) AccountBean(org.qii.weiciyuan.bean.AccountBean) CommentBean(org.qii.weiciyuan.bean.CommentBean)

Aggregations

CommentBean (org.qii.weiciyuan.bean.CommentBean)30 Gson (com.google.gson.Gson)13 JsonSyntaxException (com.google.gson.JsonSyntaxException)9 Intent (android.content.Intent)8 HashMap (java.util.HashMap)8 ArrayList (java.util.ArrayList)7 CommentListBean (org.qii.weiciyuan.bean.CommentListBean)7 TimeLinePosition (org.qii.weiciyuan.bean.android.TimeLinePosition)7 MessageBean (org.qii.weiciyuan.bean.MessageBean)6 CommentTimeLineData (org.qii.weiciyuan.bean.android.CommentTimeLineData)5 PendingIntent (android.app.PendingIntent)4 Cursor (android.database.Cursor)4 Notification (android.app.Notification)3 NotificationManager (android.app.NotificationManager)3 Context (android.content.Context)3 IntentFilter (android.content.IntentFilter)3 DatabaseUtils (android.database.DatabaseUtils)3 SQLException (android.database.SQLException)3 View (android.view.View)3 ListView (android.widget.ListView)3