Coder Social home page Coder Social logo

augmify / recyclerrefreshlayout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dinuscxj/recyclerrefreshlayout

0.0 0.0 0.0 23.42 MB

A pull to refresh layout for android, the RecyclerRefreshLayout is based on the SwipeRefreshLayout. support all the views, highly customizable, code simplicity, etc

Java 100.00%

recyclerrefreshlayout's Introduction

RecyclerRefreshLayout

Android Arsenal

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.


Features

Usage

Add dependency

dependencies {
   compile 'com.dinuscxj:recyclerrefreshlayout:1.0.1'
}

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>

Set the OnRefreshListener in java

mRecyclerRefreshLayout.setOnRefreshListener(OnRefreshListener);

Customize

You can add a refresh view (need to implements IRefreshStatus) to RecyclerRefreshLayout to implement any UI effect you want.

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
   */
  void pullProgress(float pullDistance, float pullProgress);
}

Set the refresh view

mRecyclerRefreshLayout.setRefreshView(View, LayoutParams);

If necessary, Maybe you need to reference RefreshViewEg

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.

recyclerrefreshlayout's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.