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;
}
Aggregations