use of org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView 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;
}
use of org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView in project weiciyuan by qii.
the class DMConversationListFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dmconversationlistfragment_layout, container, false);
empty = (TextView) view.findViewById(R.id.empty);
//dirty hack.....in other list, progressbar is used to indicate loading local data; but in this list,
//use a progressbar to indicate loading new data first time, maybe be refactored at 0.50 version
progressBar = new ProgressBar(getActivity());
dmProgressBar = (ProgressBar) view.findViewById(R.id.progressbar);
pullToRefreshListView = (PullToRefreshListView) view.findViewById(R.id.listView);
pullToRefreshListView.setMode(PullToRefreshBase.Mode.BOTH);
pullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
@Override
public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
loadOldMsg(null);
}
@Override
public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
loadNewMsg();
}
});
getListView().setScrollingCacheEnabled(false);
getListView().setHeaderDividersEnabled(false);
getListView().setStackFromBottom(true);
footerView = inflater.inflate(R.layout.listview_footer_layout, null);
getListView().addFooterView(footerView);
dismissFooterView();
et = (EditText) view.findViewById(R.id.content);
view.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
send();
}
});
ImageButton emoticon = (ImageButton) view.findViewById(R.id.emoticon);
emoticon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (smiley.isShown()) {
hideSmileyPicker(true);
} else {
showSmileyPicker(SmileyPickerUtility.isKeyBoardShow(getActivity()));
}
}
});
smiley = (SmileyPicker) view.findViewById(R.id.smiley_picker);
smiley.setEditText(getActivity(), (ViewGroup) view.findViewById(R.id.root_layout), et);
mContainer = (LinearLayout) view.findViewById(R.id.container);
et.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
hideSmileyPicker(true);
}
});
buildListAdapter();
return view;
}
use of org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView in project weiciyuan by qii.
the class RepostsByIdTimeLineFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.repostsbyidtimelinefragment_layout, container, false);
empty = (TextView) view.findViewById(R.id.empty);
progressBar = (ProgressBar) view.findViewById(R.id.progressbar);
quick_repost = (LinearLayout) view.findViewById(R.id.quick_repost);
pullToRefreshListView = (PullToRefreshListView) view.findViewById(R.id.listView);
pullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
loadNewMsg();
}
});
pullToRefreshListView.setOnLastItemVisibleListener(new PullToRefreshBase.OnLastItemVisibleListener() {
@Override
public void onLastItemVisible() {
loadOldMsg(null);
}
});
getListView().setScrollingCacheEnabled(false);
getListView().setHeaderDividersEnabled(false);
footerView = inflater.inflate(R.layout.listview_footer_layout, null);
getListView().addFooterView(footerView);
dismissFooterView();
getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (actionMode != null) {
getListView().clearChoices();
actionMode.finish();
actionMode = null;
return;
}
getListView().clearChoices();
if (position - 1 < getList().getSize() && position - 1 >= 0) {
listViewItemClick(parent, view, position - 1, id);
} else if (position - 1 >= getList().getSize()) {
loadOldMsg(view);
}
}
});
if (savedInstanceState == null && msg != null) {
if (msg.getRetweeted_status() == null) {
quick_repost.setVisibility(View.VISIBLE);
}
} else if (savedInstanceState != null) {
msg = (MessageBean) savedInstanceState.getParcelable("msg");
if (msg.getRetweeted_status() == null) {
quick_repost.setVisibility(View.VISIBLE);
}
}
et = (EditText) view.findViewById(R.id.content);
view.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendRepost();
}
});
buildListAdapter();
return view;
}
use of org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView in project weiciyuan by qii.
the class AbstractUserListFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.listview_layout, container, false);
empty = (TextView) view.findViewById(R.id.empty);
progressBar = (ProgressBar) view.findViewById(R.id.progressbar);
pullToRefreshListView = (PullToRefreshListView) view.findViewById(R.id.listView);
pullToRefreshListView.setOnRefreshListener(new UserListOnRefreshListener());
pullToRefreshListView.setOnLastItemVisibleListener(new UserListOnLastItemVisibleListener());
pullToRefreshListView.setOnPullEventListener(getPullEventListener());
pullToRefreshListView.setOnScrollListener(new UserListOnScrollListener());
pullToRefreshListView.setOnItemClickListener(new UserListOnItemClickListener());
pullToRefreshListView.getRefreshableView().setFooterDividersEnabled(false);
footerView = inflater.inflate(R.layout.listview_footer_layout, null);
getListView().addFooterView(footerView);
dismissFooterView();
userListAdapter = new UserListAdapter(AbstractUserListFragment.this, bean.getUsers(), getListView());
pullToRefreshListView.setAdapter(userListAdapter);
return view;
}
Aggregations