com.handmark.pulltorefresh.library.PullToRefreshBase Java Examples
The following examples show how to use
com.handmark.pulltorefresh.library.PullToRefreshBase.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RefreshListView.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
@Override public void onPullEvent(PullToRefreshBase<ListView> refreshView, com.handmark.pulltorefresh.library.PullToRefreshBase.State state, com.handmark.pulltorefresh.library.PullToRefreshBase.Mode direction) { refreshView.getLoadingLayoutProxy().setLoadingDrawable(getResources().getDrawable(R.drawable.loading_light_gray)); if (direction == PullToRefreshBase.Mode.PULL_FROM_END) { refreshView.getLoadingLayoutProxy().setPullLabel(mContext.getResources().getString(R.string.pull_to_load)); refreshView.getLoadingLayoutProxy().setRefreshingLabel(mContext.getResources().getString(R.string.loading)); refreshView.getLoadingLayoutProxy().setReleaseLabel(mContext.getResources().getString(R.string.release_to_load)); } else { refreshView.getLoadingLayoutProxy().setPullLabel(mContext.getResources().getString(R.string.pull_to_refresh)); refreshView.getLoadingLayoutProxy().setRefreshingLabel(mContext.getResources().getString(R.string.refreshing)); refreshView.getLoadingLayoutProxy().setReleaseLabel(mContext.getResources().getString(R.string.release_to_refresh)); } }
Example #2
Source File: QuestionsListFragment.java From iZhihu with GNU General Public License v2.0 | 6 votes |
@Override public void handleMessage(Message msg) { try { if (msg.what > 0) { mQuestionsAdapter.notifyDataSetChanged(); } else { Helper.showShortToast(mContext, getString(R.string.nomore_questions)); } } catch (IllegalStateException e) { e.printStackTrace(); } finally { mPull2RefreshView.onRefreshComplete(); if (msg.what <= 0) { mPull2RefreshView.setMode(PullToRefreshBase.Mode.DISABLED); } } }
Example #3
Source File: UserDetailDialogFragment.java From SmileEssence with MIT License | 6 votes |
@Override public void onPullDownToRefresh(final PullToRefreshBase<ListView> refreshView) { final MainActivity activity = (MainActivity) getActivity(); final Account account = activity.getAccount(); final Consumer consumer = activity.getConsumer(); Twitter twitter = TwitterApi.getTwitter(consumer, account); final StatusListAdapter adapter = getListAdapter(activity); Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); if (adapter.getCount() > 0) { paging.setSinceId(adapter.getTopID()); } new UserTimelineTask(twitter, getUserID(), paging) { @Override protected void onPostExecute(twitter4j.Status[] statuses) { super.onPostExecute(statuses); for (int i = statuses.length - 1; i >= 0; i--) { twitter4j.Status status = statuses[i]; adapter.addToTop(new StatusViewModel(status, account)); } updateListView(refreshView.getRefreshableView(), adapter, true); refreshView.onRefreshComplete(); } }.execute(); }
Example #4
Source File: MentionsFragment.java From SmileEssence with MIT License | 6 votes |
@Override public void onPullDownToRefresh(final PullToRefreshBase<ListView> refreshView) { final MainActivity activity = (MainActivity) getActivity(); final Account account = activity.getAccount(); final Consumer consumer = activity.getConsumer(); Twitter twitter = TwitterApi.getTwitter(consumer, account); final StatusListAdapter adapter = getListAdapter(activity); Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); if (adapter.getCount() > 0) { paging.setSinceId(adapter.getTopID()); } new MentionsTimelineTask(twitter, activity, paging) { @Override protected void onPostExecute(twitter4j.Status[] statuses) { super.onPostExecute(statuses); for (int i = statuses.length - 1; i >= 0; i--) { twitter4j.Status status = statuses[i]; adapter.addToTop(new StatusViewModel(status, account)); } updateListViewWithNotice(refreshView.getRefreshableView(), adapter, true); refreshView.onRefreshComplete(); } }.execute(); }
Example #5
Source File: UserDetailDialogFragment.java From SmileEssence with MIT License | 6 votes |
@Override public void onPullUpToRefresh(final PullToRefreshBase<ListView> refreshView) { final MainActivity activity = (MainActivity) getActivity(); final Account account = activity.getAccount(); final Consumer consumer = activity.getConsumer(); Twitter twitter = TwitterApi.getTwitter(consumer, account); final StatusListAdapter adapter = getListAdapter(activity); Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); if (adapter.getCount() > 0) { paging.setMaxId(adapter.getLastID() - 1); } new UserTimelineTask(twitter, getUserID(), paging) { @Override protected void onPostExecute(twitter4j.Status[] statuses) { super.onPostExecute(statuses); for (twitter4j.Status status : statuses) { adapter.addToBottom(new StatusViewModel(status, account)); } updateListView(refreshView.getRefreshableView(), adapter, false); refreshView.onRefreshComplete(); } }.execute(); }
Example #6
Source File: MentionsFragment.java From SmileEssence with MIT License | 6 votes |
@Override public void onPullUpToRefresh(final PullToRefreshBase<ListView> refreshView) { final MainActivity activity = (MainActivity) getActivity(); final Account account = activity.getAccount(); final Consumer consumer = activity.getConsumer(); Twitter twitter = TwitterApi.getTwitter(consumer, account); final StatusListAdapter adapter = getListAdapter(activity); Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); if (adapter.getCount() > 0) { paging.setMaxId(adapter.getLastID() - 1); } new MentionsTimelineTask(twitter, activity, paging) { @Override protected void onPostExecute(twitter4j.Status[] statuses) { super.onPostExecute(statuses); for (twitter4j.Status status : statuses) { adapter.addToBottom(new StatusViewModel(status, account)); } updateListViewWithNotice(refreshView.getRefreshableView(), adapter, false); refreshView.onRefreshComplete(); } }.execute(); }
Example #7
Source File: DailyNoteListActivity.java From imsdk-android with MIT License | 6 votes |
private void initView() { actionBar = (QtNewActionBar) this.findViewById(R.id.my_action_bar); setNewActionBar(actionBar); setActionBarTitle(R.string.atom_ui_note_title_notebook); setActionBarRightText(R.string.atom_ui_btn_note_new); setActionBarRightTextClick(new View.OnClickListener() { @Override public void onClick(View v) { showNoteDialogDialog(); } }); notelist_listview = (PullToRefreshListView) findViewById(R.id.note_listview); adapter = new DailyNoteListAdapter(this, dailyMindMains, R.layout.atom_ui_item_note); notelist_listview.getRefreshableView().setAdapter(adapter); notelist_listview.getRefreshableView().setOnItemClickListener(this); notelist_listview.setMode(PullToRefreshBase.Mode.PULL_FROM_END); notelist_listview.getRefreshableView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) { showEditDialog(adapter.getItem(i-1)); return true; } }); }
Example #8
Source File: CommentFragment.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mListView = (RefreshListView) inflater.inflate(R.layout.fragment_list, container, false); ViewUtils.inject(this, mListView); mListView.setMode(PullToRefreshBase.Mode.DISABLED); BundleData bundleData = FragmentUtils.getData(this); ZogUtils.printObj(CommentFragment.class, bundleData); Type type = new TypeToken<ArrayList<CommentField>>() { }.getType(); ArrayList<CommentField> list = bundleData.getArrayList(Key.CLAN_DATA,type); ZogUtils.printError(CommentFragment.class, "list.size():" + list.size()); mAdapter = new CommentAdapter(getActivity(), list); mListView.setAdapter(mAdapter); return mListView; }
Example #9
Source File: ActApplyFragment.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mListView = (RefreshListView) inflater.inflate(R.layout.fragment_list, container, false); ViewUtils.inject(this, mListView); mListView.setMode(PullToRefreshBase.Mode.DISABLED); BundleData bundleData = FragmentUtils.getData(this); ZogUtils.printObj(ActApplyFragment.class, bundleData); SpecialActivity specialActivity = bundleData.getObject(Key.CLAN_DATA, SpecialActivity.class); ArrayList<JoinField> list = specialActivity.getJoinFields(); ZogUtils.printError(ActApplyFragment.class, "list.size():" + list.size()); mAdapter = new ActApplyAdapter(getActivity(), list); mListView.setAdapter(mAdapter); return mListView; }
Example #10
Source File: AddFriendsActivity.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new FriendsAdapter(this, module, getClanHttpParams()); listView.setAdapter(adapter); listView.setDefaultMode(PullToRefreshBase.Mode.DISABLED); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ZogUtils.printError(FriendsActivity.class, "position=" + position); String uid = ((User) adapter.getItem(position)).getUid(); Bundle b = new Bundle(); b.putString(Key.KEY_UID, uid); IntentUtils.gotoNextActivity(AddFriendsActivity.this, HomePageActivity.class, b); } }); }
Example #11
Source File: ActApplyFragment.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mListView = (RefreshListView) inflater.inflate(R.layout.fragment_list, container, false); ViewUtils.inject(this, mListView); mListView.setMode(PullToRefreshBase.Mode.DISABLED); BundleData bundleData = FragmentUtils.getData(this); ZogUtils.printObj(ActApplyFragment.class, bundleData); SpecialActivity specialActivity = bundleData.getObject(Key.CLAN_DATA, SpecialActivity.class); ArrayList<JoinField> list = specialActivity.getJoinFields(); ZogUtils.printError(ActApplyFragment.class, "list.size():" + list.size()); mAdapter = new ActApplyAdapter(getActivity(), list); mListView.setAdapter(mAdapter); return mListView; }
Example #12
Source File: MessageActivity.java From sctalk with Apache License 2.0 | 5 votes |
@Override public void onPullDownToRefresh( final PullToRefreshBase<ListView> refreshView) { // 获取消息 refreshView.postDelayed(new Runnable() { @Override public void run() { ListView mlist = lvPTR.getRefreshableView(); int preSum = mlist.getCount(); MessageEntity messageEntity = adapter.getTopMsgEntity(); if (messageEntity != null) { List<MessageEntity> historyMsgInfo = imService.getMessageManager().loadHistoryMsg(messageEntity, historyTimes); if (historyMsgInfo.size() > 0) { historyTimes++; adapter.loadHistoryList(historyMsgInfo); } } int afterSum = mlist.getCount(); mlist.setSelection(afterSum - preSum); /**展示位置为这次消息的最末尾*/ //mlist.setSelection(size); // 展示顶部 // if (!(mlist).isStackFromBottom()) { // mlist.setStackFromBottom(true); // } // mlist.setStackFromBottom(false); refreshView.onRefreshComplete(); } }, 200); }
Example #13
Source File: SoundPullEventListener.java From ONE-Unofficial with Apache License 2.0 | 5 votes |
@Override public final void onPullEvent(PullToRefreshBase<V> refreshView, State event, Mode direction) { Integer soundResIdObj = mSoundMap.get(event); if (null != soundResIdObj) { playSound(soundResIdObj.intValue()); } }
Example #14
Source File: CameraListActivity.java From Viewer with Apache License 2.0 | 5 votes |
@Override public void onRefresh(PullToRefreshBase<ListView> refreshView) { if(mUserInfo.isLogin){ mCameraListHandler.doThing(CameraListHandler.SYNC_CID_REQUEST); }else{ mHandler.postDelayed(new Runnable() { @Override public void run() { mCameraListView.onRefreshComplete(); } }, DELAY_TIME); } }
Example #15
Source File: SoundPullEventListener.java From sctalk with Apache License 2.0 | 5 votes |
@Override public final void onPullEvent(PullToRefreshBase<V> refreshView, State event, Mode direction) { Integer soundResIdObj = mSoundMap.get(event); if (null != soundResIdObj) { playSound(soundResIdObj.intValue()); } }
Example #16
Source File: ChatListView.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
@Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { IRefreshAndEditableAdapter adapter = getAdapter(); if (adapter != null) { adapter.refresh(new OnLoadListener() { @Override public void onSuccess(boolean hasMore) { onRefreshComplete(); clearChoices(); setMode(hasMore ? Mode.BOTH : Mode.PULL_FROM_END); if (mEmptyView != null) { mEmptyView.showEmpty(); } } @Override public void onFailed() { onRefreshComplete(); if (mEmptyView != null) { mEmptyView.showError(); } } }); } }
Example #17
Source File: AndroidPullToRefreshSampleActivity.java From android-opensource-library-56 with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_android_pull_to_refresh_sample); final PullToRefreshListView listView = (PullToRefreshListView) findViewById(R.id.list_view); listView.setMode(Mode.PULL_FROM_START); final List<String> items = new ArrayList<String>() { private static final long serialVersionUID = 1L; { this.add("red"); this.add("yellow"); this.add("green"); } }; ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, items); listView.setOnRefreshListener(new OnRefreshListener<ListView>() { @Override public void onRefresh(final PullToRefreshBase<ListView> refreshView) { // リスト更新処理。一般的には通信処理や、データベースアクセスをする為別スレッドで実行する。 // ここではHandlerを使って1秒後にリストを更新する様にしている。 new Handler().postDelayed(new Runnable() { @Override public void run() { items.add("No." + (items.size() + 1)); refreshView.onRefreshComplete(); } }, 1000); } }); listView.setAdapter(adapter); }
Example #18
Source File: UserInfoActivity.java From yiim_v2 with GNU General Public License v2.0 | 5 votes |
@Override protected void initDatas() { // TODO Auto-generated method stub mUser = getIntent().getStringExtra("user"); mWhich = getIntent().getStringExtra("which"); mName = getIntent().getStringExtra("name"); try { if (isMySelf()) { mSendMsgBtn.setVisibility(View.GONE); mUserMemoRootView.setVisibility(View.GONE); } else { setTitleBarRightImageBtnSrc(R.drawable.mm_title_btn_menu); } } catch (Exception e) { // TODO: handle exception } mPullToRefreshScrollView .setOnRefreshListener(new OnRefreshListener<ScrollView>() { @Override public void onRefresh( PullToRefreshBase<ScrollView> refreshView) { // TODO Auto-generated method stub loadVcard(true); } }); loadVcard(false); }
Example #19
Source File: PbChatSearchResultActivity.java From imsdk-android with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); chat_region.setMode(PullToRefreshBase.Mode.BOTH); chat_region.getRefreshableView().setTranscriptMode(AbsListView.TRANSCRIPT_MODE_DISABLED); // searching = true; }
Example #20
Source File: UserListFragment.java From SmileEssence with MIT License | 5 votes |
@Override public void onPullDownToRefresh(final PullToRefreshBase<ListView> refreshView) { final MainActivity activity = getMainActivity(); final Account account = activity.getAccount(); final Consumer consumer = activity.getConsumer(); Twitter twitter = TwitterApi.getTwitter(consumer, account); final UserListListAdapter adapter = getListAdapter(activity); String listFullName = adapter.getListFullName(); if (TextUtils.isEmpty(listFullName)) { new UIHandler() { @Override public void run() { notifyTextEmpty(activity); refreshView.onRefreshComplete(); } }.post(); return; } Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); if (adapter.getCount() > 0) { paging.setSinceId(adapter.getTopID()); } new UserListStatusesTask(twitter, listFullName, activity, paging) { @Override protected void onPostExecute(twitter4j.Status[] statuses) { super.onPostExecute(statuses); for (int i = statuses.length - 1; i >= 0; i--) { twitter4j.Status status = statuses[i]; StatusViewModel statusViewModel = new StatusViewModel(status, account); adapter.addToTop(statusViewModel); StatusFilter.filter(activity, statusViewModel); } updateListViewWithNotice(refreshView.getRefreshableView(), adapter, true); refreshView.onRefreshComplete(); } }.execute(); }
Example #21
Source File: ChatListView.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
@Override public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { IRefreshAndEditableAdapter adapter = getAdapter(); if (adapter != null) { adapter.loadMore(new OnLoadListener() { @Override public void onSuccess(boolean hasMore) { ZogUtils.printError(ChatListView.class, "onPullDownToRefresh onSuccess"); clearChoices(); onRefreshComplete(); setMode(hasMore ? Mode.BOTH : Mode.PULL_FROM_END); if (mEmptyView != null) { mEmptyView.showEmpty(); } } @Override public void onFailed() { ZogUtils.printError(ChatListView.class, "onPullDownToRefresh onFailed"); onRefreshComplete(); if (mEmptyView != null) { mEmptyView.showError(); } } }); } }
Example #22
Source File: SoundPullEventListener.java From GifAssistant with Apache License 2.0 | 5 votes |
@Override public final void onPullEvent(PullToRefreshBase<V> refreshView, State event, Mode direction) { Integer soundResIdObj = mSoundMap.get(event); if (null != soundResIdObj) { playSound(soundResIdObj.intValue()); } }
Example #23
Source File: BaseListFragment.java From iZhihu with GNU General Public License v2.0 | 5 votes |
@Override public void onStart() { super.onStart(); // 默认关闭下拉 mPull2RefreshView.setMode(PullToRefreshBase.Mode.DISABLED); }
Example #24
Source File: ArticleListFragment.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { list = (RefreshListView) inflater.inflate(R.layout.fragment_list, null); adapter = new ArticleListAdapter(getActivity(), null, null); adapter.setCatId(catId); list.setDefaultMode(PullToRefreshBase.Mode.BOTH); list.setAdapter(adapter); return list; }
Example #25
Source File: SoundPullEventListener.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
@Override public final void onPullEvent(PullToRefreshBase<V> refreshView, State event, Mode direction) { Integer soundResIdObj = mSoundMap.get(event); if (null != soundResIdObj) { playSound(soundResIdObj.intValue()); } }
Example #26
Source File: SoundPullEventListener.java From PullToRefresh-PinnedSection-ListView with MIT License | 5 votes |
@Override public final void onPullEvent(PullToRefreshBase<V> refreshView, State event, Mode direction) { Integer soundResIdObj = mSoundMap.get(event); if (null != soundResIdObj) { playSound(soundResIdObj.intValue()); } }
Example #27
Source File: SoundPullEventListener.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
@Override public final void onPullEvent(PullToRefreshBase<V> refreshView, State event, Mode direction) { Integer soundResIdObj = mSoundMap.get(event); if (null != soundResIdObj) { playSound(soundResIdObj.intValue()); } }
Example #28
Source File: SearchBook.java From iSCAU-Android with GNU General Public License v3.0 | 5 votes |
@Override public void onRefresh(PullToRefreshBase refreshView) { if(page < Math.ceil(count/10)){ page++; loadData(); }else{ AppMsg.makeText(getSherlockActivity(), R.string.tips_default_last, AppMsg.STYLE_CONFIRM).show(); refreshView.setRefreshing(false); } }
Example #29
Source File: SoundPullEventListener.java From LbaizxfPulltoRefresh with Apache License 2.0 | 5 votes |
@Override public final void onPullEvent(PullToRefreshBase<V> refreshView, State event, Mode direction) { Integer soundResIdObj = mSoundMap.get(event); if (null != soundResIdObj) { playSound(soundResIdObj.intValue()); } }
Example #30
Source File: SoundPullEventListener.java From zen4android with MIT License | 5 votes |
@Override public final void onPullEvent(PullToRefreshBase<V> refreshView, State event, Mode direction) { Integer soundResIdObj = mSoundMap.get(event); if (null != soundResIdObj) { playSound(soundResIdObj.intValue()); } }