Search in sources :

Example 1 with MentionTimelineFragment

use of org.aisen.weibo.sina.ui.fragment.mention.MentionTimelineFragment in project AisenWeiBo by wangdan.

the class TimelineItemView method onClick.

@Override
public void onClick(View v) {
    // 查看转发微博信息
    if (v.getId() == R.id.layRe) {
        StatusContent reContent = (StatusContent) v.getTag();
        TimelineDetailPagerFragment.launch(fragment.getActivity(), reContent);
    } else // 转发
    if (v.getId() == R.id.btnRepost) {
        StatusContent status = (StatusContent) v.getTag();
        bizFragment.statusRepost(status);
    } else // 评论
    if (v.getId() == R.id.btnCmt) {
        StatusContent status = (StatusContent) v.getTag();
        bizFragment.commentCreate(status);
    } else // 点赞
    if (v.getId() == R.id.btnLike) {
        StatusContent status = (StatusContent) v.getTag();
        LikeBean likeBean = DoLikeAction.likeCache.get(status.getId() + "");
        boolean like = likeBean == null || !likeBean.isLiked();
        v.findViewById(R.id.imgLike).setSelected(like);
        bizFragment.doLike(status, like, v, this);
    } else // 溢出菜单
    if (v.getId() == R.id.btnMenus) {
        final String[] timelineMenuArr = GlobalContext.getInstance().getResources().getStringArray(R.array.timeline_menus);
        final StatusContent status = (StatusContent) v.getTag();
        List<String> menuList = new ArrayList<String>();
        if (status.getRetweeted_status() != null && status.getRetweeted_status().getUser() != null)
            menuList.add(timelineMenuArr[0]);
        //			menuList.add(timelineMenuArr[3]);
        //			if (status.getVisible() == null || "0".equals(status.getVisible().getType()))
        //				menuList.add(timelineMenuArr[2]);
        menuList.add(timelineMenuArr[4]);
        menuList.add(timelineMenuArr[5]);
        menuList.add(timelineMenuArr[1]);
        if (status.getUser() != null && status.getUser().getIdstr().equals(AppContext.getAccount().getUser().getIdstr()))
            menuList.add(timelineMenuArr[6]);
        if (fragment instanceof MentionTimelineFragment)
            menuList.add(timelineMenuArr[7]);
        final String[] menus = new String[menuList.size()];
        for (int i = 0; i < menuList.size(); i++) menus[i] = menuList.get(i);
        AisenUtils.showMenuDialog(fragment, v, menus, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                AisenUtils.timelineMenuSelected(fragment, menus[which], status);
            }
        });
    }
}
Also used : StatusContent(org.aisen.weibo.sina.sinasdk.bean.StatusContent) DialogInterface(android.content.DialogInterface) ArrayList(java.util.ArrayList) MentionTimelineFragment(org.aisen.weibo.sina.ui.fragment.mention.MentionTimelineFragment) LikeBean(org.aisen.weibo.sina.support.bean.LikeBean)

Aggregations

DialogInterface (android.content.DialogInterface)1 ArrayList (java.util.ArrayList)1 StatusContent (org.aisen.weibo.sina.sinasdk.bean.StatusContent)1 LikeBean (org.aisen.weibo.sina.support.bean.LikeBean)1 MentionTimelineFragment (org.aisen.weibo.sina.ui.fragment.mention.MentionTimelineFragment)1