Search in sources :

Example 1 with BrowserWeiboMsgCommentAndRepostAdapter

use of org.qii.weiciyuan.ui.adapter.BrowserWeiboMsgCommentAndRepostAdapter in project weiciyuan by qii.

the class BrowserWeiboMsgFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    SwipeFrameLayout swipeFrameLayout = new SwipeFrameLayout(getActivity());
    PullToRefreshListView pullToRefreshListView = new PullToRefreshListView(getActivity());
    pullToRefreshListView.setMode(PullToRefreshBase.Mode.DISABLED);
    pullToRefreshListView.setOnLastItemVisibleListener(onLastItemVisibleListener);
    pullToRefreshListView.setOnScrollListener(listViewOnScrollListener);
    listView = pullToRefreshListView.getRefreshableView();
    View header = inflater.inflate(R.layout.browserweibomsgfragment_layout, listView, false);
    listView.addHeaderView(header);
    View switchView = inflater.inflate(R.layout.browserweibomsgfragment_switch_list_type_header, listView, false);
    listView.addHeaderView(switchView);
    switchView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
        //empty
        }
    });
    View progressHeaderLayout = inflater.inflate(R.layout.browserweibomsgfragment_progress_header, listView, false);
    progressHeader = progressHeaderLayout.findViewById(R.id.progressbar);
    progressHeader.setVisibility(View.GONE);
    listView.addHeaderView(progressHeaderLayout);
    View emptyLayout = inflater.inflate(R.layout.browserweibomsgfragment_empty_header, listView, false);
    emptyHeader = (TextView) emptyLayout.findViewById(R.id.empty_text);
    emptyHeader.setOnClickListener(new EmptyHeaderOnClickListener());
    listView.addHeaderView(emptyLayout);
    footerView = inflater.inflate(R.layout.listview_footer_layout, null);
    listView.addFooterView(footerView);
    dismissFooterView();
    repostTab = (TextView) switchView.findViewById(R.id.repost);
    commentTab = (TextView) switchView.findViewById(R.id.comment);
    repostTab.setOnClickListener(new RepostTabOnClickListener());
    commentTab.setOnClickListener(new CommentTabOnClickListener());
    commentTab.setTextColor(getResources().getColor(R.color.orange));
    listView.setFooterDividersEnabled(false);
    listView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
    listView.setOnItemClickListener(commentOnItemClickListener);
    listView.setOnItemLongClickListener(commentOnItemLongClickListener);
    initView(header, savedInstanceState);
    adapter = new BrowserWeiboMsgCommentAndRepostAdapter(this, listView, commentList.getItemList(), repostList.getItemList());
    listView.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    listView.setHeaderDividersEnabled(false);
    swipeFrameLayout.addView(pullToRefreshListView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    return swipeFrameLayout;
}
Also used : BrowserWeiboMsgCommentAndRepostAdapter(org.qii.weiciyuan.ui.adapter.BrowserWeiboMsgCommentAndRepostAdapter) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) ViewGroup(android.view.ViewGroup) SwipeFrameLayout(org.qii.weiciyuan.support.lib.SwipeFrameLayout) ImageView(android.widget.ImageView) WeiboDetailImageView(org.qii.weiciyuan.support.lib.WeiboDetailImageView) View(android.view.View) AdapterView(android.widget.AdapterView) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) ProfileTopAvatarImageView(org.qii.weiciyuan.support.lib.ProfileTopAvatarImageView)

Aggregations

View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 AbsListView (android.widget.AbsListView)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 ProfileTopAvatarImageView (org.qii.weiciyuan.support.lib.ProfileTopAvatarImageView)1 SwipeFrameLayout (org.qii.weiciyuan.support.lib.SwipeFrameLayout)1 WeiboDetailImageView (org.qii.weiciyuan.support.lib.WeiboDetailImageView)1 PullToRefreshListView (org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView)1 BrowserWeiboMsgCommentAndRepostAdapter (org.qii.weiciyuan.ui.adapter.BrowserWeiboMsgCommentAndRepostAdapter)1