Search in sources :

Example 6 with UserBean

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

the class ModifyGroupMemberDao method executeTask.

private UserBean executeTask(String url) throws WeiboException {
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("uid", uid);
    map.put("list_id", list_id);
    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
    Gson gson = new Gson();
    UserBean value = null;
    try {
        value = gson.fromJson(jsonData, UserBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    return value;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) UserBean(org.qii.weiciyuan.bean.UserBean) HashMap(java.util.HashMap) Gson(com.google.gson.Gson)

Example 7 with UserBean

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

the class ObjectToStringUtility method toString.

public static String toString(DMBean dm) {
    UserBean userBean = dm.getUser();
    String username = (userBean != null ? userBean.getScreen_name() : "user is null");
    return String.format("%s @%s:%s", TimeUtility.getListTime(dm.getMills()), username, dm.getText());
}
Also used : UserBean(org.qii.weiciyuan.bean.UserBean) SearchUserBean(org.qii.weiciyuan.bean.SearchUserBean) AtUserBean(org.qii.weiciyuan.bean.AtUserBean) DMUserBean(org.qii.weiciyuan.bean.DMUserBean)

Example 8 with UserBean

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

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

the class StatusListAdapter 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 + listView.getHeaderViewsCount()) {
        holder.listview_root.setBackgroundColor(checkedBG);
    }
    final MessageBean msg = bean.get(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 (!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);
    }
    if (!TextUtils.isEmpty(msg.getListViewSpannableString())) {
        boolean haveCachedHeight = msgHeights.get(msg.getIdLong()) != null;
        ViewGroup.LayoutParams layoutParams = holder.content.getLayoutParams();
        if (haveCachedHeight) {
            layoutParams.height = msgHeights.get(msg.getIdLong());
        } else {
            layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        }
        boolean haveCachedWidth = msgWidths.get(msg.getIdLong()) != null;
        if (haveCachedWidth) {
            layoutParams.width = msgWidths.get(msg.getIdLong());
        } else {
            layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
        }
        holder.content.requestLayout();
        holder.content.setText(msg.getListViewSpannableString());
        if (!haveCachedHeight) {
            msgHeights.append(msg.getIdLong(), layoutParams.height);
        }
        if (!haveCachedWidth) {
            msgWidths.append(msg.getIdLong(), layoutParams.width);
        }
    } else {
        TimeLineUtility.addJustHighLightLinks(msg);
        holder.content.setText(msg.getListViewSpannableString());
    }
    holder.time.setTime(msg.getMills());
    if (holder.source != null) {
        holder.source.setText(msg.getSourceString());
    }
    if (showOriStatus) {
        boolean checkRepostsCount = (msg.getReposts_count() != 0);
        boolean checkCommentsCount = (msg.getComments_count() != 0);
        boolean checkPic = msg.havePicture() || (msg.getRetweeted_status() != null && msg.getRetweeted_status().havePicture());
        checkPic = (checkPic && !SettingUtility.isEnablePic());
        boolean checkGps = (msg.getGeo() != null);
        if (!checkRepostsCount && !checkCommentsCount && !checkPic && !checkGps) {
            holder.count_layout.setVisibility(View.INVISIBLE);
        } else {
            holder.count_layout.setVisibility(View.VISIBLE);
            if (checkPic) {
                holder.timeline_pic.setVisibility(View.VISIBLE);
            } else {
                holder.timeline_pic.setVisibility(View.GONE);
            }
            if (checkGps) {
                holder.timeline_gps.setVisibility(View.VISIBLE);
            } else {
                holder.timeline_gps.setVisibility(View.INVISIBLE);
            }
            if (checkRepostsCount) {
                holder.repost_count.setText(String.valueOf(msg.getReposts_count()));
                holder.repost_count.setVisibility(View.VISIBLE);
            } else {
                holder.repost_count.setVisibility(View.GONE);
            }
            if (checkCommentsCount) {
                holder.comment_count.setText(String.valueOf(msg.getComments_count()));
                holder.comment_count.setVisibility(View.VISIBLE);
            } else {
                holder.comment_count.setVisibility(View.GONE);
            }
        }
    }
    holder.repost_content.setVisibility(View.GONE);
    holder.repost_content_pic.setVisibility(View.GONE);
    holder.repost_content_pic_multi.setVisibility(View.GONE);
    holder.content_pic.setVisibility(View.GONE);
    holder.content_pic_multi.setVisibility(View.GONE);
    if (msg.havePicture()) {
        if (msg.isMultiPics()) {
            buildMultiPic(msg, holder.content_pic_multi);
        } else {
            buildPic(msg, holder.content_pic, position);
        }
    }
    MessageBean repost_msg = msg.getRetweeted_status();
    if (repost_msg != null && showOriStatus) {
        if (holder.repost_layout != null) {
            holder.repost_layout.setVisibility(View.VISIBLE);
        }
        holder.repost_flag.setVisibility(View.VISIBLE);
        //sina weibo official account can send repost message with picture, fuck sina weibo
        if (holder.content_pic.getVisibility() != View.GONE) {
            holder.content_pic.setVisibility(View.GONE);
        }
        buildRepostContent(msg, repost_msg, holder, position);
        if (holder.content_pic_multi != holder.repost_content_pic_multi) {
            interruptPicDownload(holder.content_pic_multi);
        }
        if (holder.repost_content_pic != holder.content_pic) {
            interruptPicDownload(holder.repost_content_pic);
        }
    } else {
        if (holder.content_pic_multi != holder.repost_content_pic_multi) {
            interruptPicDownload(holder.repost_content_pic_multi);
        }
        if (holder.repost_content_pic != holder.content_pic) {
            interruptPicDownload(holder.repost_content_pic);
        }
        if (holder.repost_layout != null) {
            holder.repost_layout.setVisibility(View.GONE);
        }
        holder.repost_flag.setVisibility(View.GONE);
    }
    boolean interruptPic = false;
    boolean interruptMultiPic = false;
    boolean interruptRepostPic = false;
    boolean interruptRepostMultiPic = false;
    if (msg.havePicture()) {
        if (msg.isMultiPics()) {
            interruptPic = true;
        } else {
            interruptMultiPic = true;
        }
    }
    if (repost_msg != null && showOriStatus) {
        if (repost_msg.havePicture()) {
            if (repost_msg.isMultiPics()) {
                interruptRepostPic = true;
            } else {
                interruptRepostMultiPic = true;
            }
        }
    }
    if (interruptPic && interruptRepostPic) {
        interruptPicDownload(holder.content_pic);
        interruptPicDownload(holder.repost_content_pic);
    }
    if (interruptMultiPic && interruptRepostMultiPic) {
        interruptPicDownload(holder.content_pic_multi);
        interruptPicDownload(holder.repost_content_pic_multi);
    }
    if (interruptPic && !interruptRepostPic) {
        if (holder.content_pic != holder.repost_content_pic) {
            interruptPicDownload(holder.content_pic);
        }
    }
    if (!interruptPic && interruptRepostPic) {
        if (holder.content_pic != holder.repost_content_pic) {
            interruptPicDownload(holder.repost_content_pic);
        }
    }
    if (interruptMultiPic && !interruptRepostMultiPic) {
        if (holder.content_pic_multi != holder.repost_content_pic_multi) {
            interruptPicDownload(holder.content_pic_multi);
        }
    }
    if (!interruptMultiPic && interruptRepostMultiPic) {
        if (holder.content_pic_multi != holder.repost_content_pic_multi) {
            interruptPicDownload(holder.repost_content_pic_multi);
        }
    }
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) UserBean(org.qii.weiciyuan.bean.UserBean) ViewGroup(android.view.ViewGroup) Drawable(android.graphics.drawable.Drawable) RelativeLayout(android.widget.RelativeLayout)

Example 10 with UserBean

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

the class UserListAdapter method bindViewData.

private void bindViewData(ViewHolder holder, int position) {
    holder.listview_root.setBackgroundColor(defaultBG);
    if (listView.getCheckedItemPosition() == position + 1) {
        holder.listview_root.setBackgroundColor(checkedBG);
    }
    UserBean user = getList().get(position);
    holder.avatar.checkVerified(user);
    holder.avatar.setPressesStateVisibility(false);
    holder.username.setText(user.getScreen_name());
    String image_url = user.getProfile_image_url();
    if (!TextUtils.isEmpty(image_url)) {
        commander.downloadAvatar(holder.avatar.getImageView(), user, false);
    }
    holder.content.setText(user.getDescription());
}
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