GithubHelp home page GithubHelp logo

yat3s / chopin Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 3.0 11.51 MB

A Android Refresh Layout including refresh header and load more and sticky header

Java 100.00%
refreshlayout refresh-layout refreshrecyclerview refreshview

chopin's Introduction

Chopin

An Android Refresh layout including some powerful features.

RecyclerView

ViewPager

CoordinatorLayout

Any View & Advance setting

Gradle

implementation 'com.yat3s.android:chopin:0.6.2'

How to use

  • XML
<?xml version="1.0" encoding="utf-8"?>
<com.yat3s.chopin.ChopinLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/chopin_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <!--Any view you want-->
    <AnyView
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</com.yat3s.chopin.ChopinLayout>
  • Java or Kotlin
mChopinLayout.setHeaderIndicatorLocation(ChopinLayout.INDICATOR_LOCATION_BEHIND);
mChopinLayout.setRefreshHeaderIndicator(new LottieIndicator(this, "victory.json", 0.1f));
mChopinLayout.setOnRefreshListener(new ChopinLayout.OnRefreshListener() {
      @Override
      public void onRefresh() {
            mChopinLayout.postDelayed(new Runnable() {
                @Override
                public void run() {
                    mChopinLayout.refreshComplete();
                }
             }, 2000);
        }
    });

Customize & Other advance settings

  • NotificationView
TextView headerNotificationView = new TextView(this);
mChopinLayout.setHeaderNotificationView(headerNotificationView);

// Also you can add foot notification view
TextView footerNotificationView = new TextView(this);
mChopinLayout.setFooterNotificationView(footerNotificationView);
  • IndicatorLacation
// ChopinLayout.INDICATOR_LOCATION_OUTSIDE
// ChopinLayout.INDICATOR_LOCATION_FRONT
// ChopinLayout.INDICATOR_LOCATION_BEHIND
mChopinLayout.setHeaderIndicatorLocation(ChopinLayout.INDICATOR_LOCATION_OUTSIDE); 
mChopinLayout.setFooterIndicatorLocation(ChopinLayout.INDICATOR_LOCATION_BEHIND); 
  • IndicatorScrollResistance
// 0.0f - 1.0f
mChopinLayout.setIndicatorScrollResistance(0.5f);
  • OverScroll
mChopinLayout.setEnableOverScroll(true);
  • ViewScrollChecker
mChopinLayout.setViewScrollChecker(viewScrollChecker);

// You can view this interface
public interface ViewScrollChecker {

    /**
     * Check content view whether can do refresh,
     * so you can do some edition to control view refresh.
     *
     * @param chopinLayout
     * @param contentView  The View nested in {@link ChopinLayout}
     * @return
     */
    boolean canDoRefresh(ChopinLayout chopinLayout, View contentView);

    /**
     * Check content view whether can do loading,
     * so you can do some edition to control view loading.
     *
     * @param chopinLayout
     * @param contentView
     * @return
     */
    boolean canDoLoading(ChopinLayout chopinLayout, View contentView);
}
  • ScrollState
mChopinLayout.setOnStateChangeListener(new ChopinLayout.OnStateChangeListener() {
            @Override
            public void onStateChanged(ChopinLayout layout, int newState) {
                /*
                    public static final int STATE_DEFAULT = 0;
                
                    public static final int STATE_DRAGGING_DOWN = 1;
                
                    public static final int STATE_DRAGGING_UP = 2;
                
                    public static final int STATE_REFRESHING = 3;
                
                    public static final int STATE_LOADING = 4;
                
                    public static final int STATE_BOUNCING_DOWN = 5;
                
                    public static final int STATE_BOUNCING_UP = 6;
                
                    public static final int STATE_SHOWING_HEADER_NOTIFICATION = 7;
                
                    public static final int STATE_SHOWING_FOOTER_NOTIFICATION = 8;
                 */
            }

chopin's People

Contributors

yat3s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chopin's Issues

Optimizing code.

Now have too many codes not clearly need to be compressed and optimized.

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.