Search in sources :

Example 51 with MessageBean

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

the class StatusListAdapter method setTopTipBar.

public void setTopTipBar(TopTipBar bar) {
    this.topTipBar = bar;
    AutoScrollListView autoScrollListView = (AutoScrollListView) listView;
    autoScrollListView.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            VelocityListView velocityListView = (VelocityListView) view;
            //                if (velocityListView.getVelocity() < 0) {
            //                    topTipBar.hideCount();
            //                } else if (velocityListView.getVelocity() > 0) {
            //                    if (topTipBar.getValues().size() == 0) {
            //                        return;
            //                    }
            View childView = Utility.getListViewItemViewFromPosition(listView, firstVisibleItem);
            if (childView == null) {
                return;
            }
            int position = firstVisibleItem - ((ListView) view).getHeaderViewsCount();
            if (childView.getTop() == 0 && position <= 0) {
                topTipBar.clearAndReset();
            } else {
                handle(position + 1);
            }
        //                }
        }

        private void handle(int position) {
            if (position > 0 && topTipBar != null && position < bean.size()) {
                MessageBean next = bean.get(position);
                if (next != null) {
                    MessageBean helperMsg = bean.get(position - 1);
                    long helperId = 0L;
                    if (helperMsg != null) {
                        helperId = helperMsg.getIdLong();
                    }
                    topTipBar.handle(next.getIdLong(), helperId);
                }
            }
        }
    });
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) VelocityListView(org.qii.weiciyuan.support.lib.VelocityListView) AutoScrollListView(org.qii.weiciyuan.support.lib.AutoScrollListView) VelocityListView(org.qii.weiciyuan.support.lib.VelocityListView) AbsListView(android.widget.AbsListView) AutoScrollListView(org.qii.weiciyuan.support.lib.AutoScrollListView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) VelocityListView(org.qii.weiciyuan.support.lib.VelocityListView) AbsListView(android.widget.AbsListView) AutoScrollListView(org.qii.weiciyuan.support.lib.AutoScrollListView) View(android.view.View) ListView(android.widget.ListView)

Example 52 with MessageBean

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

the class BrowserWeiboMsgCommentAndRepostAdapter method bindRepostData.

private void bindRepostData(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 MessageBean msg = (MessageBean) getItem(position);
    UserBean user = msg.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);
    }
    if (!TextUtils.isEmpty(msg.getListViewSpannableString())) {
        holder.content.setText(msg.getListViewSpannableString());
    } else {
        TimeLineUtility.addJustHighLightLinks(msg);
        holder.content.setText(msg.getListViewSpannableString());
    }
    holder.avatar.checkVerified(user);
    holder.time.setTime(msg.getMills());
    holder.reply.setVisibility(View.GONE);
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) UserBean(org.qii.weiciyuan.bean.UserBean) Drawable(android.graphics.drawable.Drawable) RelativeLayout(android.widget.RelativeLayout)

Aggregations

MessageBean (org.qii.weiciyuan.bean.MessageBean)52 Gson (com.google.gson.Gson)21 JsonSyntaxException (com.google.gson.JsonSyntaxException)16 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)8 MessageListBean (org.qii.weiciyuan.bean.MessageListBean)8 Cursor (android.database.Cursor)7 Intent (android.content.Intent)6 CommentBean (org.qii.weiciyuan.bean.CommentBean)6 UserBean (org.qii.weiciyuan.bean.UserBean)6 DatabaseUtils (android.database.DatabaseUtils)4 SQLException (android.database.SQLException)4 View (android.view.View)4 PendingIntent (android.app.PendingIntent)3 Drawable (android.graphics.drawable.Drawable)3 SpannableString (android.text.SpannableString)3 AbsListView (android.widget.AbsListView)3 ListView (android.widget.ListView)3 RelativeLayout (android.widget.RelativeLayout)3 TextView (android.widget.TextView)3