Java Code Examples for android.support.v4.widget.SwipeRefreshLayout#OnRefreshListener
The following examples show how to use
android.support.v4.widget.SwipeRefreshLayout#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: AdhellReportsFragment.java From notSABS with MIT License | 6 votes |
protected SwipeRefreshLayout.OnRefreshListener getSwipeRefreshListener(){ return new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { AdhellReportViewModel adhellReportViewModel = ViewModelProviders.of(getActivity()).get(AdhellReportViewModel.class); adhellReportViewModel.getReportBlockedUrls().observe(getActivity(), reportBlockedUrls -> { assert reportBlockedUrls != null; ReportBlockedUrlAdapter reportBlockedUrlAdapter = new ReportBlockedUrlAdapter(Objects.requireNonNull(getContext()), reportBlockedUrls); blockedDomainsListView.setAdapter(reportBlockedUrlAdapter); lastDayBlockedTextView.setText(String.valueOf(reportBlockedUrls.size())); reportBlockedUrlAdapter.notifyDataSetChanged(); }); mHandler.postDelayed(new Runnable() { public void run() { if (refreshRecentActivity != null) { refreshRecentActivity.setRefreshing(false); } } }, 1000); } }; }
Example 2
Source File: RefreshProxy.java From orz with Apache License 2.0 | 6 votes |
public RefreshProxy bindingRefresh(@NonNull View layout, IRefreshProxyListener listener) { mSwipeRefreashLayout = (SwipeRefreshLayout) layout.findViewById(R.id.common_refreash_swipe_layout); mProxyListener = listener; if (mSwipeRefreashLayout == null) { throw new NullPointerException("SwipeRefreshLayout null"); } mRefreshListener = new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { if (mProxyListener != null) { mProxyListener.onRefresh(); } } }; mSwipeRefreashLayout.setOnRefreshListener(mRefreshListener); mSwipeRefreashLayout.setColorSchemeResources(R.color.refreash_circle_1, R.color.refreash_circle_2, R.color.refreash_circle_3); return this; }
Example 3
Source File: PackageDisablerFragment.java From SABS with MIT License | 6 votes |
protected SwipeRefreshLayout.OnRefreshListener getSwipeRefreshListener(){ return new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { //editText.setText(""); loadApplicationsList(true, ""); mHandler.postDelayed(new Runnable() { public void run() { if (swipeToRefresh != null) { swipeToRefresh.setRefreshing(false); } } }, 5000); } }; }
Example 4
Source File: BindingConfig.java From Android-MVVMFramework with Apache License 2.0 | 6 votes |
@BindingAdapter(value = {"onRefreshListener", "refreshingAttrChanged"}, requireAll = false) public static void setOnRefreshListener(final SwipeRefreshLayout view, final SwipeRefreshLayout.OnRefreshListener listener, final InverseBindingListener refreshingAttrChanged) { SwipeRefreshLayout.OnRefreshListener newValue = new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { if (listener != null) { if (refreshingAttrChanged != null) { refreshingAttrChanged.onChange(); } listener.onRefresh(); } } }; SwipeRefreshLayout.OnRefreshListener oldValue = ListenerUtil.trackListener(view, newValue, R.id.onRefreshListener); if (oldValue != null) { view.setOnRefreshListener(null); } view.setOnRefreshListener(newValue); }
Example 5
Source File: HistoryFragment.java From nongbeer-mvp-android-demo with Apache License 2.0 | 5 votes |
@NonNull private SwipeRefreshLayout.OnRefreshListener onPullRefresh(){ return new SwipeRefreshLayout.OnRefreshListener(){ @Override public void onRefresh(){ getPresenter().setHistoryItemGroup( null ); getPresenter().requestHistory(); } }; }
Example 6
Source File: AggregateReportFragment.java From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void setupSwipeRefreshLayout(View root, Bundle savedInstanceState) { swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.ptr_layout); SwipeRefreshLayout.OnRefreshListener listener = new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { startUpdate(); } }; @ColorInt int blue = R.color.actionbar_blue; swipeRefreshLayout.setOnRefreshListener(listener); swipeRefreshLayout.setColorSchemeColors(blue, blue); PrefUtils.State datasetState = PrefUtils.getResourceState( getActivity(), PrefUtils.Resources.DATASETS); boolean isRefreshing = false; if (savedInstanceState != null && savedInstanceState.containsKey(STATE_IS_REFRESHING)) { isRefreshing = savedInstanceState.getBoolean(STATE_IS_REFRESHING, false); } if (!swipeRefreshLayout.isRefreshing()) { isRefreshing = datasetState == PrefUtils.State.REFRESHING; } if (!isRefreshing) { boolean needsUpdate = datasetState == PrefUtils.State.OUT_OF_DATE; boolean isConnectionAvailable = NetworkUtils.checkConnection(getActivity()); if (needsUpdate && isConnectionAvailable) { startUpdate(); } } else { showProgressBar(); } }
Example 7
Source File: BaseFragment.java From hr with GNU Affero General Public License v3.0 | 5 votes |
public void setHasSwipeRefreshView(View parent, int resource_id, SwipeRefreshLayout.OnRefreshListener listener) { mSwipeRefresh = (SwipeRefreshLayout) parent.findViewById(resource_id); mSwipeRefresh.setOnRefreshListener(listener); mSwipeRefresh.setColorSchemeResources(R.color.android_blue, R.color.android_green, R.color.android_orange_dark, R.color.android_red); }
Example 8
Source File: HarvestRecyclerView.java From RefreshLoadMoreRecyclerView with MIT License | 5 votes |
/** * enable refresh * * @param onRefreshListener refresh callback */ private void enableRefresh(final OnRefreshListener onRefreshListener) { swipeRefreshLayout.setEnabled(true); mOnRefreshListener = new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { if (onRefreshListener != null) onRefreshListener.onRefresh(); if (swipeRefreshLayout.isRefreshing()) swipeRefreshLayout.setRefreshing(false); } }; swipeRefreshLayout.setOnRefreshListener(mOnRefreshListener); }
Example 9
Source File: MainFragment.java From RxParse with Apache License 2.0 | 4 votes |
@Override public View onCreateView(final LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_main, container, false); ButterKnife.inject(this, view); listAdapter = ListRecyclerAdapter.create(); listAdapter.createViewHolder(new Func2<ViewGroup, Integer, ParseUserViewHolder>() { @Override public ParseUserViewHolder call(@Nullable ViewGroup viewGroup, Integer position) { android.util.Log.d("RxParse", "ParseUserViewHolder"); return new ParseUserViewHolder(inflater.inflate(R.layout.item_parse_user, viewGroup, false)); } }); listView.setLayoutManager(new android.support.v7.widget.LinearLayoutManager(getActivity())); listView.setAdapter(listAdapter); refresher = new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { loading.setRefreshing(true); AppObservable.bindFragment(MainFragment.this, ParseObservable.find(ParseUser.getQuery())) .doOnNext(new Action1<ParseUser>() { @Override public void call(final ParseUser user) { android.util.Log.d("RxParse", "onNext: " + user.getObjectId()); } }) .toList() .subscribe(new Action1<List<ParseUser>>() { @Override public void call(final List<ParseUser> users) { loading.setRefreshing(false); android.util.Log.d("RxParse", "subscribe: " + users); handler.post(new Runnable() { @Override public void run() { listAdapter.getList().clear(); listAdapter.getList().addAll(users); listAdapter.notifyDataSetChanged(); } }); } }); } }; loading.setOnRefreshListener(refresher); handler.post(new Runnable() { @Override public void run() { refresher.onRefresh(); } }); return view; }
Example 10
Source File: MultiFuncRecyclerView.java From TestChat with Apache License 2.0 | 4 votes |
public void setRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) { if (onRefreshListener != null) { mSwipeRefreshLayout.setOnRefreshListener(onRefreshListener); } }
Example 11
Source File: CommentsPresenter.java From yahnac with Apache License 2.0 | 4 votes |
public CommentsPresenter(HNewsActivity activity, SwipeRefreshLayout.OnRefreshListener refreshListener) { this.activity = activity; this.refreshListener = refreshListener; }
Example 12
Source File: WebFragment.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) { refreshLayout.setOnRefreshListener(onRefreshListener); }
Example 13
Source File: BaseRefreshDetailViewModel.java From Android-MVVMFramework with Apache License 2.0 | 4 votes |
public SwipeRefreshLayout.OnRefreshListener getOnRefreshListener() { return onRefreshListener; }
Example 14
Source File: SwipeRefreshListFragment.java From android-SwipeRefreshListFragment with Apache License 2.0 | 2 votes |
/** * Set the {@link android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener} to listen for * initiated refreshes. * * @see android.support.v4.widget.SwipeRefreshLayout#setOnRefreshListener(android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener) */ public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) { mSwipeRefreshLayout.setOnRefreshListener(listener); }
Example 15
Source File: UltimateListview.java From UltimateAndroid with Apache License 2.0 | 2 votes |
/** * Set the listener when refresh is triggered and enable the SwipeRefreshLayout * * @param listener */ public void setRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) { mSwipeRefreshLayout.setEnabled(true); mSwipeRefreshLayout.setOnRefreshListener(listener); }
Example 16
Source File: SwipeRecyclerIView.java From MeiZiNews with MIT License | 2 votes |
/** * δΈζηε¬ * * @param listener */ public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) { swipe_refresh.setOnRefreshListener(listener); }
Example 17
Source File: RefreshBinding.java From SimpleFTP with MIT License | 2 votes |
/** * Sets the refresh listener. * @param view The current swipe refresh layout. * @param listener The listener which will call for refresh. */ @BindingAdapter("onRefresh") public static void setListener(SwipeRefreshLayout view, SwipeRefreshLayout.OnRefreshListener listener) { view.setOnRefreshListener(listener); }
Example 18
Source File: UltimateListview.java From UltimateAndroid with Apache License 2.0 | 2 votes |
/** * Set the listener when refresh is triggered and enable the SwipeRefreshLayout * * @param listener */ public void setRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) { mSwipeRefreshLayout.setEnabled(true); mSwipeRefreshLayout.setOnRefreshListener(listener); }
Example 19
Source File: SwipeRefreshListFragment.java From soas with Apache License 2.0 | 2 votes |
/** * Set the {@link android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener} to listen for * initiated refreshes. * * @see android.support.v4.widget.SwipeRefreshLayout#setOnRefreshListener(android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener). */ public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) { mSwipeRefreshLayout.setOnRefreshListener(listener); }
Example 20
Source File: UltimateListview.java From UltimateAndroid with Apache License 2.0 | 2 votes |
/** * Set the listener when refresh is triggered and enable the SwipeRefreshLayout * * @param listener */ public void setRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) { mSwipeRefreshLayout.setEnabled(true); mSwipeRefreshLayout.setOnRefreshListener(listener); }