Java Code Examples for androidx.swiperefreshlayout.widget.SwipeRefreshLayout#OnRefreshListener

The following examples show how to use androidx.swiperefreshlayout.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: UltimateRecyclerView.java    From UltimateRecyclerView with Apache License 2.0 6 votes vote down vote up
/**
 * Set the listener when refresh is triggered and enable the SwipeRefreshLayout
 *
 * @param listener SwipeRefreshLayout
 */
public void setDefaultOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) {

    mSwipeRefreshLayout.setEnabled(true);
    if (defaultSwipeToDismissColors != null && defaultSwipeToDismissColors.length > 0) {
        mSwipeRefreshLayout.setColorSchemeColors(defaultSwipeToDismissColors);
    } else {
        mSwipeRefreshLayout.setColorSchemeResources(
                android.R.color.holo_blue_bright,
                android.R.color.holo_green_light,
                android.R.color.holo_orange_light,
                android.R.color.holo_red_light);

    }

    mSwipeRefreshLayout.setOnRefreshListener(listener);
}
 
Example 2
Source File: RecyclerMessageView.java    From CommonUtils with Apache License 2.0 5 votes vote down vote up
public void enableSwipeRefresh(@NonNull SwipeRefreshLayout.OnRefreshListener listener, @ColorRes int... colors) {
    if (colors.length <= 0) throw new IllegalArgumentException("Provide at least one color!");

    swipeRefresh.setEnabled(true);
    swipeRefresh.setColorSchemeResources(colors);
    swipeRefresh.setOnRefreshListener(listener);
    list.setVisibility(VISIBLE);
}
 
Example 3
Source File: DynamicRecyclerViewFrame.java    From dynamic-support with Apache License 2.0 5 votes vote down vote up
/**
 * Set the swipe refresh layout listener to provide pull to efresh functionality.
 *
 * @param onRefreshListener The listener to be set.
 */
public void setOnRefreshListener(
        @Nullable SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
    this.mOnRefreshListener = onRefreshListener;

    if (mSwipeRefreshLayout != null) {
        if (onRefreshListener != null) {
            mSwipeRefreshLayout.setOnRefreshListener(onRefreshListener);
            mSwipeRefreshLayout.setEnabled(true);
        } else {
            mSwipeRefreshLayout.setEnabled(false);
        }
    }
}
 
Example 4
Source File: ContactSelectionListFragment.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
  this.swipeRefresh.setOnRefreshListener(onRefreshListener);
}
 
Example 5
Source File: CommonRecyclerViewEmptyView.java    From BaseProject with Apache License 2.0 4 votes vote down vote up
public void setOutsideRefreshListener(SwipeRefreshLayout.OnRefreshListener refreshListener) {
    this.outsideRefreshListener = refreshListener;
}
 
Example 6
Source File: ContactSelectionListFragment.java    From deltachat-android with GNU General Public License v3.0 4 votes vote down vote up
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
  this.swipeRefresh.setOnRefreshListener(onRefreshListener);
}
 
Example 7
Source File: ShadowSwipeRefreshLayout.java    From materialistic with Apache License 2.0 4 votes vote down vote up
@Implementation
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) {
    mListener = listener;
}
 
Example 8
Source File: ShadowSwipeRefreshLayout.java    From materialistic with Apache License 2.0 4 votes vote down vote up
public SwipeRefreshLayout.OnRefreshListener getOnRefreshListener() {
    return mListener;
}
 
Example 9
Source File: ScrollbarRecyclerViewManager.java    From RedReader with GNU General Public License v3.0 4 votes vote down vote up
public void enablePullToRefresh(@NonNull final SwipeRefreshLayout.OnRefreshListener listener) {
	mSwipeRefreshLayout.setOnRefreshListener(listener);
	mSwipeRefreshLayout.setEnabled(true);
}
 
Example 10
Source File: DynamicRecyclerViewFrame.java    From dynamic-support with Apache License 2.0 2 votes vote down vote up
/**
 * Override this method to set swipe refresh layout listener immediately after
 * initializing the view.
 *
 * @return The on refresh listener for the swipe refresh layout.
 *
 * @see #setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener)
 */
protected SwipeRefreshLayout.OnRefreshListener setOnRefreshListener() {
    return null;
}
 
Example 11
Source File: DynamicRecyclerViewFrame.java    From dynamic-support with Apache License 2.0 2 votes vote down vote up
/**
 * Get the swipe refresh layout listener used by this view.
 *
 * @return The swipe refresh layout listener used by this view.
 */
public SwipeRefreshLayout.OnRefreshListener getOnRefreshListener() {
    return mOnRefreshListener;
}