Search in sources :

Example 11 with UserBean

use of org.qii.weiciyuan.bean.UserBean 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 12 with UserBean

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

the class DMUserListAdapter method bindViewData.

protected void bindViewData(DMViewHolder holder, int position) {
    final DMUserBean msg = bean.get(position);
    UserBean user = msg.getUser();
    if (user != null) {
        holder.username.setVisibility(View.VISIBLE);
        buildUsername(holder, user);
        buildAvatar(holder.avatar, position, user);
    } else {
        holder.username.setVisibility(View.INVISIBLE);
        holder.avatar.setVisibility(View.INVISIBLE);
    }
    if (!TextUtils.isEmpty(msg.getListViewSpannableString())) {
        holder.content.setText(msg.getListViewSpannableString());
    } else {
        TimeLineUtility.addJustHighLightLinks(msg);
        holder.content.setText(msg.getListViewSpannableString());
    }
    bindOnTouchListener(holder);
    String time = msg.getListviewItemShowTime();
    if (!holder.time.getText().toString().equals(time)) {
        holder.time.setText(time);
    }
    holder.time.setTag(msg.getId());
}
Also used : DMUserBean(org.qii.weiciyuan.bean.DMUserBean) UserBean(org.qii.weiciyuan.bean.UserBean) DMUserBean(org.qii.weiciyuan.bean.DMUserBean)

Example 13 with UserBean

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

the class TimeLineUtility method filterHomeTimeLineSinaWeiboAd.

public static void filterHomeTimeLineSinaWeiboAd(MessageListBean value) {
    if (!SettingUtility.isFilterSinaAd()) {
        return;
    }
    List<MessageBean> msgList = value.getItemList();
    Iterator<MessageBean> iterator = msgList.iterator();
    final List<AdBean> adBeanList = value.getAd();
    if (adBeanList.size() > 0) {
        AppLogger.i("filter " + adBeanList.size() + " sina weibo ads");
        List<String> adIdList = new ArrayList<String>();
        for (AdBean adBean : adBeanList) {
            adIdList.add(adBean.getId());
        }
        while (iterator.hasNext()) {
            MessageBean msg = iterator.next();
            UserBean user = msg.getUser();
            if (user == null) {
                continue;
            }
            if (adIdList.contains(msg.getId())) {
                iterator.remove();
                value.removedCountPlus();
            }
        }
    }
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) UserBean(org.qii.weiciyuan.bean.UserBean) DMUserBean(org.qii.weiciyuan.bean.DMUserBean) AdBean(org.qii.weiciyuan.bean.AdBean) ArrayList(java.util.ArrayList) SpannableString(android.text.SpannableString)

Example 14 with UserBean

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

the class TimeLineUtility method buildOriWeiboSpannalString.

private static SpannableString buildOriWeiboSpannalString(MessageBean oriMsg) {
    String name = "";
    UserBean oriUser = oriMsg.getUser();
    if (oriUser != null) {
        name = oriUser.getScreen_name();
        if (TextUtils.isEmpty(name)) {
            name = oriUser.getId();
        }
    }
    SpannableString value;
    if (!TextUtils.isEmpty(name)) {
        value = TimeLineUtility.convertNormalStringToSpannableString("@" + name + ":" + oriMsg.getText());
    } else {
        value = TimeLineUtility.convertNormalStringToSpannableString(oriMsg.getText());
    }
    return value;
}
Also used : SpannableString(android.text.SpannableString) UserBean(org.qii.weiciyuan.bean.UserBean) DMUserBean(org.qii.weiciyuan.bean.DMUserBean) SpannableString(android.text.SpannableString)

Example 15 with UserBean

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

the class UserTopicListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    UserBean userBean = (UserBean) getIntent().getParcelableExtra("userBean");
    ArrayList<String> topicList = getIntent().getStringArrayListExtra("topicList");
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setTitle(getString(R.string.topic));
    if (savedInstanceState == null) {
        UserTopicListFragment fragment;
        if (topicList != null) {
            fragment = new UserTopicListFragment(userBean, topicList);
        } else {
            fragment = new UserTopicListFragment(userBean);
        }
        getFragmentManager().beginTransaction().replace(android.R.id.content, fragment).commit();
    }
}
Also used : UserBean(org.qii.weiciyuan.bean.UserBean)

Aggregations

UserBean (org.qii.weiciyuan.bean.UserBean)31 Gson (com.google.gson.Gson)9 JsonSyntaxException (com.google.gson.JsonSyntaxException)9 DMUserBean (org.qii.weiciyuan.bean.DMUserBean)8 HashMap (java.util.HashMap)7 MessageBean (org.qii.weiciyuan.bean.MessageBean)6 Drawable (android.graphics.drawable.Drawable)4 RelativeLayout (android.widget.RelativeLayout)4 AtUserBean (org.qii.weiciyuan.bean.AtUserBean)4 SearchUserBean (org.qii.weiciyuan.bean.SearchUserBean)4 Intent (android.content.Intent)3 SpannableString (android.text.SpannableString)3 CommentBean (org.qii.weiciyuan.bean.CommentBean)3 Cursor (android.database.Cursor)2 View (android.view.View)2 ListView (android.widget.ListView)2 ArrayList (java.util.ArrayList)2 AccountBean (org.qii.weiciyuan.bean.AccountBean)2 WriteReplyToCommentActivity (org.qii.weiciyuan.ui.send.WriteReplyToCommentActivity)2 PendingIntent (android.app.PendingIntent)1