com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener Java Examples
The following examples show how to use
com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener.
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: PullToRefreshListActivity.java From effective_android_sample with Apache License 2.0 | 6 votes |
/** * Activity生成時にシステムから呼ばれる */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ptr_list); // レイアウトからカスタムリストビューを取得 mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list); // リストを引っ張ったときの処理を記述 mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() { @Override public void onRefresh(PullToRefreshBase<ListView> refreshView) { new GetDataTask().execute(); } }); // リストビューにアイテム追加 mItemList = new LinkedList<String>(); mItemList.addAll(Arrays.asList(INITIAL_LIST)); mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mItemList); ListView actualListView = mPullRefreshListView.getRefreshableView(); actualListView.setAdapter(mAdapter); }
Example #2
Source File: PostListFragment.java From Broadsheet.ie-Android with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View layout = super.onCreateView(inflater, container, savedInstanceState); // Get original ListView and Frame ListView originalLv = (ListView) layout.findViewById(android.R.id.list); ViewGroup frame = (ViewGroup) originalLv.getParent(); // Remove old ListView frame.removeView(originalLv); // Create new PullToRefreshListView and add to Frame mPullRefreshListView = new PullToRefreshListView(getActivity()); frame.addView(mPullRefreshListView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() { @Override public void onRefresh(PullToRefreshBase<ListView> refreshView) { fetchPosts(null); } }); boolean pauseOnScroll = false; boolean pauseOnFling = true; PauseOnScrollListener listener = new PauseOnScrollListener(ImageLoader.getInstance(), pauseOnScroll, pauseOnFling); mPullRefreshListView.setOnScrollListener(listener); return layout; }
Example #3
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 #4
Source File: FriendManager.java From yiim_v2 with GNU General Public License v2.0 | 5 votes |
public void onCreateView() { mListView = (PullToRefreshExpandableListView) mRootView .findViewById(R.id.tab_contacts_list); mPinnedHeaderView = mRootView .findViewById(R.id.friend_list_group_header); mPinnedImageView = (ImageView) mRootView .findViewById(R.id.friend_list_group_img); mPinnedTextView = (TextView) mRootView .findViewById(R.id.friend_list_group_text); mPinnedRightTextView = (TextView) mRootView .findViewById(R.id.friend_list_group_right_text); mPinnedImageView.setBackgroundResource(R.drawable.group_unfold_arrow); mListView .setOnRefreshListener(new OnRefreshListener<ExpandableListView>() { @Override public void onRefresh( PullToRefreshBase<ExpandableListView> refreshView) { // TODO Auto-generated method stub mGroups.clear(); mEntries.clear(); mAdapter.notifyDataSetChanged(); XmppLoadRosterRunnable runnable = new XmppLoadRosterRunnable( mYiFragment.getActivity(), null); getXmppBinder().execute(runnable); } }); }
Example #5
Source File: UserInfoSetFragment.java From yiim_v2 with GNU General Public License v2.0 | 5 votes |
protected void initDatas() { // TODO Auto-generated method stub mPullToRefreshScrollView .setOnRefreshListener(new OnRefreshListener<ScrollView>() { @Override public void onRefresh( PullToRefreshBase<ScrollView> refreshView) { // TODO Auto-generated method stub loadVcard(true); } }); loadVcard(false); }
Example #6
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 #7
Source File: PullToRefreshCustomActivity.java From effective_android_sample with Apache License 2.0 | 4 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ptr_list); mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list); // Set a listener to be invoked when the list should be refreshed. mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() { // ひっぱりきって指をはなしたとき? @Override public void onRefresh(PullToRefreshBase<ListView> refreshView) { String label = DateUtils.formatDateTime(getApplicationContext(), System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); // Update the LastUpdatedLabel refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label); // Do work to refresh the list here. new GetDataTask().execute(); } }); /** * customize */ mPullRefreshListView.setMode(Mode.BOTH); // LoadingLayoutに関してカスタマイズ(主に文言) ILoadingLayout iLoadingLayout = mPullRefreshListView.getLoadingLayoutProxy(true, true); iLoadingLayout.setLastUpdatedLabel(""); iLoadingLayout.setReleaseLabel("離してください、更新します"); iLoadingLayout.setPullLabel("さらに下に引いて下さい"); iLoadingLayout.setRefreshingLabel("更新中です"); // Add an end-of-list listener mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() { @Override public void onLastItemVisible() { Toast.makeText(PullToRefreshCustomActivity.this, "End of List!", Toast.LENGTH_SHORT) .show(); } }); /** * リスト表示 */ mIemsList = new LinkedList<String>(); mIemsList.addAll(Arrays.asList(INITIAL_LIST)); mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mIemsList); ListView actualListView = mPullRefreshListView.getRefreshableView(); actualListView.setAdapter(mAdapter); }
Example #8
Source File: MainActivity.java From codeexamples-android with Eclipse Public License 1.0 | 4 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ptr_list); mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list); // Set a listener to be invoked when the list should be refreshed. mPullRefreshListView .setOnRefreshListener(new OnRefreshListener<ListView>() { @Override public void onRefresh( PullToRefreshBase<ListView> refreshView) { String label = DateUtils.formatDateTime( getApplicationContext(), System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); // Update the LastUpdatedLabel refreshView.getLoadingLayoutProxy() .setLastUpdatedLabel(label); // Do work to refresh the list here. new GetDataTask().execute(); } }); // Add an end-of-list listener mPullRefreshListView .setOnLastItemVisibleListener(new OnLastItemVisibleListener() { @Override public void onLastItemVisible() { Toast.makeText(MainActivity.this, "End of List!", Toast.LENGTH_SHORT).show(); } }); ListView actualListView = mPullRefreshListView.getRefreshableView(); // Need to use the Actual ListView when registering for Context Menu registerForContextMenu(actualListView); mListItems = new LinkedList<String>(); mListItems.addAll(Arrays.asList(mStrings)); mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mListItems); // You can also just use setListAdapter(mAdapter) or // mPullRefreshListView.setAdapter(mAdapter) actualListView.setAdapter(mAdapter); }
Example #9
Source File: SampleActivity.java From PullToRefresh-PinnedSection-ListView with MIT License | 4 votes |
public ListView getListView() { if (mpPullToRefreshPinnedSectionListView == null) { mpPullToRefreshPinnedSectionListView = (PullToRefreshPinnedSectionListView) findViewById(R.id.list); mpPullToRefreshPinnedSectionListView.setOnRefreshListener(new OnRefreshListener<ListView>() { @Override public void onRefresh(final PullToRefreshBase<ListView> refreshView) { String label = DateUtils.formatDateTime(getApplicationContext(), System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); // Update the LastUpdatedLabel refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label); //TODO Do work to refresh the list here. new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(1500); } catch (InterruptedException e) { e.printStackTrace(); } SampleActivity.this.runOnUiThread(new Runnable() { @Override public void run() { // Stop refreshing refreshView.onRefreshComplete(); } }); } }).start(); } }); mpPullToRefreshPinnedSectionListView .setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Item item = (Item) getListView().getAdapter() .getItem(arg2); if (item != null) { Toast.makeText(SampleActivity.this, "Item " + arg2 + ": " + item.text, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(SampleActivity.this, "Item " + arg2, Toast.LENGTH_SHORT) .show(); } } }); } return mpPullToRefreshPinnedSectionListView.getRefreshableView(); }
Example #10
Source File: IPullToRefresh.java From bmob-android-demo-paging with GNU General Public License v3.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #11
Source File: IPullToRefresh.java From FacebookNewsfeedSample-Android with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #12
Source File: IPullToRefresh.java From effective_android_sample with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #13
Source File: IPullToRefresh.java From zen4android with MIT License | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #14
Source File: IPullToRefresh.java From handmarkPulltorefreshLibrary with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #15
Source File: IPullToRefresh.java From PullToRefresh-PinnedSection-ListView with MIT License | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #16
Source File: IPullToRefresh.java From iSCAU-Android with GNU General Public License v3.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #17
Source File: IPullToRefresh.java From Social with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #18
Source File: IPullToRefresh.java From ONE-Unofficial with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #19
Source File: IPullToRefresh.java From SweetMusicPlayer with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #20
Source File: IPullToRefresh.java From PullToRefreshLibrary with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #21
Source File: IPullToRefresh.java From GifAssistant with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #22
Source File: IPullToRefresh.java From LbaizxfPulltoRefresh with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #23
Source File: IPullToRefresh.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #24
Source File: IPullToRefresh.java From BigApp_Discuz_Android with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);
Example #25
Source File: IPullToRefresh.java From sctalk with Apache License 2.0 | 2 votes |
/** * Set OnRefreshListener for the Widget * * @param listener - Listener to be used when the Widget is set to Refresh */ public void setOnRefreshListener(OnRefreshListener<T> listener);