use of org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshBase 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.PullToRefreshBase 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;
}
Aggregations