Giter Club home page Giter Club logo

android-materialrefreshlayout's Introduction

MaterialRefreshLayout v1.3.0

This is a drop-down refresh control, it is more beautiful and powerful than SwipeRefreshLayout.It is easy to use and support API LEVEL >= 11 . I hope you like it !

Now let me talk about MaterialRefreshLayout of function

add a lovely sun

(1)It can be done like SwipeRefreshLayout drop-down refresh effect,this is a kind of intrusive drop-down refresh.

(2)However, there are some people who are not as like invasive drop-down refresh, so, it also has a non-invasive drop-down refresh function.

(3)If you feel too drab, we can add a background of the wave shape.

(4)If you want to make waveform covering on content, it can be done.

(5)if you like the most simple effect,You can see the image below.

(6)MaterialRefreshLayout Can pull load more, drop-down refresh automatically, pull up refresh automatically.

(7)There are a lot of functions, you can see the source code...

Usage

Add dependency.

dependencies {
    compile 'com.cjj.materialrefeshlayout:library:1.3.0'
}

Use it in your layout xml.

<com.cjj.MaterialRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/refresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
      <...ListView or GridView or RecyclerView or ScrollView and more...>

</com.cjj.MaterialRefreshLayout>

Get instance and use it.

 materialRefreshLayout = (MaterialRefreshLayout) findViewById(R.id...);
 materialRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {
      @Override
      public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
          //refreshing...
      }

       @Override
       public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) {
       	  //load more refreshing...
       }
  }

// refresh complete
materialRefreshLayout.finishRefresh();

// load more refresh complete
 materialRefreshLayout.finishRefreshLoadMore();

Config

(1)if you like SwipeRefreshLayout drop-down refresh effect

In xml, use attributes.

<com.cjj.MaterialRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/refresh"
    app:overlay="true"
    app:wave_show="false"
    >

In java code.

materialRefreshLayout.setIsOverLay(true);
materialRefreshLayout.setWaveShow(false);

(2)if you like non-invasive drop-down refresh effect

In xml, use attributes.

<com.cjj.MaterialRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/refresh"
    app:overlay="false"
    app:wave_show="false"
    >

In java code.

materialRefreshLayout.setIsOverLay(false);
materialRefreshLayout.setWaveShow(false);

(3)if you like add a background of the wave shape.

In xml, use attributes.

<com.cjj.MaterialRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/refresh"
    app:overlay="false"
    app:wave_show="true"
    app:wave_color="@color/material_green"
    app:wave_height_type="normal"  (higher)
    >

In java code.

materialRefreshLayout.setWaveColor(0xffffffff);
materialRefreshLayout.setIsOverLay(false);
materialRefreshLayout.setWaveShow(true);

(4)If you want to make waveform covering on content

<com.cjj.MaterialRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/refresh"
    app:overlay="true"
    app:wave_show="true"
    app:wave_color="#90ffffff"
    app:progress_colors="@array/material_colors"
    app:wave_height_type="higher"
    >

In java code.

materialRefreshLayout.setWaveColor(0xf90fffff);
materialRefreshLayout.setIsOverLay(true);
materialRefreshLayout.setWaveShow(true);

(5)other...

<com.cjj.MaterialRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/refresh"
    app:overlay="false"
    app:wave_show="false"
    app:progress_colors="@array/material_colors"
    app:wave_height_type="higher"
    app:progress_show_circle_backgroud="false"
    >

(6)add pull up loading more features...

<com.cjj.MaterialRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/refresh"
    app:isLoadMore="true"
    >

In java code.

       materialRefreshLayout.setLoadMore(true);

(7) It can drop-down refresh automatically and pull up refresh automatically.

In java code.

       materialRefreshLayout.autoRefresh();//drop-down refresh automatically
        materialRefreshLayout.autoRefreshLoadMore();// pull up refresh automatically

V 1.3.0

add drop-down refresh automatically and pull up refresh automatically

V 1.2.1

add pull up loading more features

V 1.2.0

add progress size type ,you can use xml attr to set app:progress_size_type="normal"(big) and fix some bugs

V 1.1.0

a new way to perform animations with support library, the library size and the amount of libraries decreased.

AT LAST

If the MaterialRefreshLayout has failed to meet to your requirements, you can go to the BeautifulRefreshLayout to find what you need.

If you want to support me,you can follow me on GitHub: https://github.com/android-cjj.

Thanks

lsjwzh/MaterialLoadingProgressBar

License

The MIT License (MIT)

Copyright (c) 2015 android-cjj

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

android-materialrefreshlayout's People

Contributors

android-cjj avatar liaohuqiu avatar ppamorim avatar

Stargazers

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

Watchers

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

android-materialrefreshlayout's Issues

好难懂

一看这英语就知道是**人写的了,简直无法看

autoRefresh() BUG

MaterialRefreshLayout. autoRefresh() there is a bug..... with autoRefresh() ,the CircleProgressBar is not working. the arrow no Animation . Test on LG F240K S6EDGE NOTE4

在android studio里面无法预览

报这个错误Rendering Problems java.lang.NoSuchFieldError com.cjj.MaterialHeadView.setProgressValue(MaterialHeadView.java:93),
请使用isInEditMode这个属性做判断

WaveShow和WaveColor无效

xml/java中设置waveShow没有效果,均会显示
waveColor设置颜色无效

<com.cjj.MaterialRefreshLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:overlay="true"
    app:wave_color="@color/black"
    app:wave_show="true ">

    <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</com.cjj.MaterialRefreshLayout>

HomeButtonisUP

Hi. My main activity contain fragment. Fragment contained RecycleView wrapped in MaterialRefreshLayout. Problem is (after I add MaterialRefreshLayout) than app start NavigationDrawerFragment home button view as UP button(back) instead Home button(open menu). Yet I do not understand why

Disable RefreshLayout

how to disable RefreshLayout ?

something like this :

MaterialRefreshLayout.Enabled = False;

自动刷新会导致app异常退出

你好 , 非常感谢你开源的这个下拉刷新的库, 在设置materialRefreshLayout.autoRefresh();自动刷新的时候,会导致app异常退出。

发现一个崩溃问题,空指针异常。

04-21 16:44:09.566 8417-8417/ E/AndroidRuntime: FATAL EXCEPTION: main

java.lang.NullPointerException
at com.cjj.MaterialRefreshLayout.setProgressValue(MaterialRefreshLayout.java:393)
at com.cjj.MaterialRefreshLayout.finishRefreshing(MaterialRefreshLayout.java:484)
at com.cjj.MaterialRefreshLayout$2.run(MaterialRefreshLayout.java:492)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5072)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)

发现的多个问题。。。

1.进入列表的页面的时候不能直接下拉刷新,必须先滑动列表然后才能下拉刷新
2.刷新的时候列表不能滑动了
3.加载的时候还可以滑上去下拉刷新
4.加载的时候滑上去刷新 然后 就一直在加载中...
5.难道你自己不用的吗?

布局中使用app:overlay="false" 与autoRefresh(); 同时使用会出现NullPointException

报错代码

public void autoRefresh()
    {
        updateListener();
        if(isOverlay)
        {

            mHeadLayout.getLayoutParams().height = (int) mHeadHeight;
            mHeadLayout.requestLayout();
        }else
        {
            createAnimatorTranslationY(mChildView, mHeadHeight, mHeadLayout);
        }
    }

在程序执行到mHeadLayout.getLayoutParams().height = (int) mHeadHeight; 时出现空指针
布局文件如下

<com.cjj.MaterialRefreshLayout
        android:id="@+id/refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/buyCarLayout"
        android:layout_below="@id/productsOptions"
        app:isLoadMore="true"
        app:overlay="true"
        app:wave_show="false">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/products"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
</com.cjj.MaterialRefreshLayout>

List view is locked while refreshing.

When refreshing we cant click on list view items. it freezes while refreshing? Is there any way to enable the listview (Clickable and scrollable) while refreshing?

app:wave_show="false"

1.3.0
app:wave_show="false"
这一个设置了没有效果?不管理是false还是true都会出现波浪形状的背景。

有没有方法能判断页面正在Loading中?就是Loading还没有结束

Glitch on Marshamallow in circular progress

When the user pulls and releases arrows rotates and a "colored circle" appears before progress rotates. This glitch appears only on Marshmallow, on lower OS it works fine. I'll upload a gif/video in some time.

头部有时候会报这NullPointException

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.cjj.CircleProgressBar.setProgress(int)' on a null object reference
at com.cjj.MaterialHeadView$1.run(MaterialHeadView.java:96)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Remove .idea

Please remove this generated folder. We don`t need it.

Show and hide circle progress bar manually

First of all I must thank you for this wonderful library....I wondered is there any way to show and hide the progress bar manually??

Not by swiping or things like that.

tnx

java.lang.NullPointerException

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.cjj.f.setProgressValue(int)' on a null object reference
at com.cjj.MaterialRefreshLayout.setProgressValue(MaterialRefreshLayout.java:393)
at com.cjj.MaterialRefreshLayout.g(MaterialRefreshLayout.java:484)

自动加载更多

您好,请问自动加载更多如何实现呢?感觉现在上拉一下才能触发加载更多效果不是很好,自己尝试改了一下好多问题。。。T_T

MaterialRefreshLayout

java.lang.NullPointerException
at com.cjj.g.run(MaterialHeadView.java:96)
at android.os.Handler.handleCallback(Handler.java:800)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5469)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:857)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
at dalvik.system.NativeStart.main(Native Method)

Swipe to refresh is too sensitive

Is there some way to reduce the sensitivity as the application starts refreshing even if the swipe is too low? And this behavior is same in all devices.

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.