RecyclerRefreshLayout


Source link: https://github.com/dinuscxj/RecyclerRefreshLayout

RecyclerRefreshLayout

English | ???

RecyclerRefreshLayout based on the { @link android.support.v4.widget.SwipeRefreshLayout } The RecyclerRefreshLayout should be used whenever the user can refresh the contents of a view via a vertical swipe gesture. The activity that instantiates this view should add an OnRefreshListener to be notified whenever the swipe to refresh gesture is completed. The RecyclerRefreshLayout will notify the listener each and every time the gesture is completed again; the listener is responsible for correctly determining when to actually initiate a refresh of its content. If the listener determines there should not be a refresh, it must call setRefreshing(false) to cancel any visual indication of a refresh. If an activity wishes to show just the progress animation, it should call setRefreshing(true). To disable the gesture and progress animation, call setEnabled(false) on the view.

Note: The RecyclerRefreshLayout supports all of the views: ListView, GridView, ScrollView, FrameLayout, or Even a single TextView



Installation

Add the following dependency to your build.gradle file:

 dependencies {

compile 'com.dinuscxj:recyclerrefreshlayout:2.0.5'
  
}

Usage

Config in xml

<?xml version="1.0" encoding="utf-8"?> <com.dinuscxj.refresh.RecyclerRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"  android:id="@+id/refresh_layout"  android:layout_width="match_parent"  android:layout_height="match_parent">  <android.support.v7.widget.RecyclerView

android:id="@+id/recycler_view"

android:layout_width="match_parent"

android:layout_height="match_parent" /> </app.dinus.com.refresh.RecyclerRefreshLayout>

Configure the attributes(* must)

Set the listener to be notified when a refresh is triggered via the swipe gesture.

RecyclerRefreshLayout.setOnRefreshListener(OnRefreshListener);

Notify the widget that refresh state has changed. Do not call this when refresh is triggered by a swipe gesture.

RecyclerRefreshLayout.setRefreshing(boolean);

Configure the attributes(optional)

Set the interpolator used by the animation that move the refresh view the release point to the refreshing point.

RecyclerRefreshLayout.setAnimateToRefreshInterpolator(Interpolator);

Set the interpolator used by the animation that move the refresh view from the refreshing point or (the release point) to the start point.

RecyclerRefreshLayout.setAnimateToStartInterpolator(Interpolator);

Set the duration used by the animation that move the refresh view the release point to the refreshing point.

RecyclerRefreshLayout.setAnimateToRefreshDuration(int);

Set the duration used by the animation that move the refresh view from the refreshing point or (the release point) to the start point.

RecyclerRefreshLayout.setAnimateToStartDuration(int);

Set the top position of the RefreshView relative to its parent.

RecyclerRefreshLayoutsetRefreshInitialOffset(float)

Set The minimum distance that trigger refresh

RecyclerRefreshLayout.setRefreshTargetOffset(float)

Set the style of the RefreshView

RecyclerRefreshLayout.setRefreshStyle(@NonNull RefreshStyle) 

Customize

Customize a refresh view (need to implements IRefreshStatus) for RecyclerRefreshLayout.

public interface IRefreshStatus {
 /** * When the content view has reached top and refresh has been completed, view will be reset. */ void reset();
 /** * Refresh View is refreshing */ void refreshing();
 /** * Refresh View is dropped down to the refresh point */ void pullToRefresh();
 /** * Refresh View is released into the refresh point */ void releaseToRefresh();
 /** * @param pullDistance The drop-down distance of the refresh View * @param pullProgress The drop-down progress of the refresh View and the pullProgress may be more than 1.0f *

pullProgress = pullDistance / refreshTargetOffset */ void pullProgress(float pullDistance, float pullProgress);
 
}
RecyclerRefreshLayout.setRefreshView(View, LayoutParams);

Eg. RefreshView or RefreshViewEg

Customize a drag distance converter (need to implements IDragDistanceConverter) for RecyclerRefreshLayout.

public interface IDragDistanceConverter {
  /**   * @param scrollDistance the distance between the ACTION_DOWN point and the ACTION_MOVE point   * @param refreshDistance the distance between the refresh point and the start point   * @return the real distance of the refresh view moved   */  float convert(float scrollDistance, float refreshDistance);
 
}
RecyclerRefreshLayout.setDragDistanceConverter(@NonNull IDragDistanceConverter) 

Eg. MaterialDragDistanceConverter or DragDistanceConverterEg

Misc

QQ Group: 342748245

License

Copyright 2015-2019 dinus  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

Interesting and fun drop-down refresh library. Do you remember how to play in black and white handheld game it?

A Utility class that wraps the ExoPlayer in to a standardized View and API much like the built in Android VideoView and MediaPlayer. Additionally, to simplify playback of media lists a playlist manager and playlist service have been provided.

An Android RecyclerView enhancement library focused on simplifying common use cases and filling in gaps between the ListView and the RecyclerView.

Playlist Core is a media playback management library for Android that simplifies playing lists of media (Audio and Video) by providing the service, notification, and other media controls such as Bluetooth devices, Android Wear, and Lock screens.

Are you sad to create every time the ThreadPool and MainThread to be exposed with Dagger to the application? If yes, you can use this library to reduce your work.

A simple, reactive Android library based on RxJava that monitors app state changes. It notifies subscribers every time the app goes into background and comes back into foreground.

A typical use case is, for example, session tracking for analytics purposes or suppressing push notifications when the app is currently visible to the user.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes