Convert Figma logo to code with AI

chrisbanes logoAndroid-PullToRefresh

DEPRECATED

8,706
4,699
8,706
29

Top Related Projects

DEPRECATED This project aims to provide a reusable pull to refresh widget for Android.

4,015

Phoenix Pull-to-Refresh

Ultra Pull to Refresh for Android. Support all the views.

The implementation of https://dribbble.com/shots/2067564-Replace

Quick Overview

Android-PullToRefresh is a popular open-source library that provides a simple way to implement the "pull-to-refresh" UI pattern in Android applications. It offers a flexible and customizable solution for adding pull-to-refresh functionality to various views, including ListViews, GridViews, WebViews, and ScrollViews.

Pros

  • Easy integration with existing Android projects
  • Highly customizable appearance and behavior
  • Supports multiple view types (ListView, GridView, WebView, ScrollView)
  • Smooth animations and gesture handling

Cons

  • No longer actively maintained (last update in 2015)
  • May not be fully compatible with newer Android versions and libraries
  • Lacks support for RecyclerView, which has become more popular than ListView
  • Some reported issues with memory leaks in certain scenarios

Code Examples

  1. Basic implementation with a ListView:
PullToRefreshListView mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
    @Override
    public void onRefresh(PullToRefreshBase<ListView> refreshView) {
        // Do work to refresh the list here
        new GetDataTask().execute();
    }
});
  1. Customizing the pull label:
mPullRefreshListView.getLoadingLayoutProxy().setPullLabel("Pull to refresh...");
mPullRefreshListView.getLoadingLayoutProxy().setReleaseLabel("Release to refresh...");
mPullRefreshListView.getLoadingLayoutProxy().setRefreshingLabel("Loading...");
  1. Adding a last updated time:
PullToRefreshListView mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
    @Override
    public void onRefresh(PullToRefreshBase<ListView> refreshView) {
        String label = DateUtils.formatDateTime(getApplicationContext(), System.currentTimeMillis(),
                DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL);
        refreshView.getLoadingLayoutProxy().setLastUpdatedLabel("Last Updated: " + label);
        // Do work to refresh the list here
        new GetDataTask().execute();
    }
});

Getting Started

  1. Add the library to your project's build.gradle file:
dependencies {
    implementation 'com.github.chrisbanes.pulltorefresh:library:2.1.1'
}
  1. Add the PullToRefreshListView to your layout XML:
<com.handmark.pulltorefresh.library.PullToRefreshListView
    android:id="@+id/pull_refresh_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
  1. Initialize and use the PullToRefreshListView in your Activity or Fragment:
PullToRefreshListView mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
    @Override
    public void onRefresh(PullToRefreshBase<ListView> refreshView) {
        // Do work to refresh the list here
        new GetDataTask().execute();
    }
});

Competitor Comparisons

DEPRECATED This project aims to provide a reusable pull to refresh widget for Android.

Pros of android-pulltorefresh

  • Simpler implementation with fewer dependencies
  • Lightweight and easy to integrate into existing projects
  • More straightforward customization options

Cons of android-pulltorefresh

  • Less actively maintained (last update in 2014)
  • Fewer features and animation options compared to Android-PullToRefresh
  • Limited support for different view types (mainly focused on ListView)

Code Comparison

Android-PullToRefresh:

PullToRefreshListView mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
    @Override
    public void onRefresh(PullToRefreshBase<ListView> refreshView) {
        // Do work to refresh the list here
    }
});

android-pulltorefresh:

PullToRefreshListView listView = (PullToRefreshListView) findViewById(R.id.pull_to_refresh_listview);
listView.setOnRefreshListener(new OnRefreshListener() {
    @Override
    public void onRefresh() {
        // Do work to refresh the list here
    }
});

Both implementations offer similar basic functionality, but Android-PullToRefresh provides more flexibility with generic types and additional customization options.

4,015

Phoenix Pull-to-Refresh

Pros of Phoenix

  • More visually appealing and customizable animations
  • Modern design that aligns with Material Design principles
  • Smoother performance due to optimized rendering

Cons of Phoenix

  • Less extensive documentation compared to Android-PullToRefresh
  • Fewer configuration options for advanced use cases
  • Smaller community and fewer third-party extensions

Code Comparison

Phoenix:

val pullToRefreshView = findViewById<PullToRefreshView>(R.id.pull_to_refresh)
pullToRefreshView.setOnRefreshListener {
    // Refresh logic here
    pullToRefreshView.setRefreshing(false)
}

Android-PullToRefresh:

PullToRefreshListView mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
    @Override
    public void onRefresh(PullToRefreshBase<ListView> refreshView) {
        // Refresh logic here
        mPullRefreshListView.onRefreshComplete();
    }
});

Both libraries provide pull-to-refresh functionality for Android applications, but Phoenix focuses on a more modern and visually appealing approach. Android-PullToRefresh offers more extensive documentation and configuration options, making it suitable for complex implementations. Phoenix excels in providing a sleek, Material Design-inspired user experience with smoother animations. The code comparison shows that Phoenix has a slightly more concise implementation, while Android-PullToRefresh offers more granular control over the refresh process.

Ultra Pull to Refresh for Android. Support all the views.

Pros of Android-Ultra-Pull-To-Refresh

  • More flexible and customizable, supporting various UI components
  • Better performance with smoother animations
  • Actively maintained with recent updates

Cons of Android-Ultra-Pull-To-Refresh

  • Slightly more complex implementation due to increased flexibility
  • May require more setup time for basic use cases

Code Comparison

Android-PullToRefresh:

PullToRefreshListView mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
    @Override
    public void onRefresh(PullToRefreshBase<ListView> refreshView) {
        // Do work to refresh the list here
    }
});

Android-Ultra-Pull-To-Refresh:

PtrFrameLayout frame = (PtrFrameLayout) findViewById(R.id.store_house_ptr_frame);
frame.setPtrHandler(new PtrHandler() {
    @Override
    public void onRefreshBegin(PtrFrameLayout frame) {
        // Do refresh work here
    }
});

Both libraries offer pull-to-refresh functionality, but Android-Ultra-Pull-To-Refresh provides more customization options and smoother performance. It supports various UI components and has active maintenance. However, it may require more setup time for basic use cases due to its increased flexibility. The code comparison shows that Android-Ultra-Pull-To-Refresh uses a slightly different approach with its PtrFrameLayout and PtrHandler, while Android-PullToRefresh uses a more straightforward PullToRefreshListView with an OnRefreshListener.

The implementation of https://dribbble.com/shots/2067564-Replace

Pros of FlyRefresh

  • Unique and visually appealing animation
  • Lightweight implementation
  • Customizable paper plane icon and colors

Cons of FlyRefresh

  • Limited to a specific animation style
  • May not be suitable for all app designs
  • Less flexibility in terms of content display during refresh

Code Comparison

FlyRefresh:

mFlightView = (FlyRefreshLayout) findViewById(R.id.fly_layout);
mFlightView.setOnPullRefreshListener(new FlyRefreshLayout.OnPullRefreshListener() {
    @Override
    public void onRefresh(FlyRefreshLayout view) {
        // Handle refresh action
    }
});

Android-PullToRefresh:

PullToRefreshListView mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
    @Override
    public void onRefresh(PullToRefreshBase<ListView> refreshView) {
        // Handle refresh action
    }
});

Summary

FlyRefresh offers a unique and visually appealing pull-to-refresh animation with a paper plane icon, making it stand out in terms of user experience. However, it's less flexible than Android-PullToRefresh, which provides more customization options and supports various view types. Android-PullToRefresh is more versatile and widely adopted, while FlyRefresh is better suited for apps looking for a specific, eye-catching refresh animation.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED


Pull To Refresh Views for Android

Screenshot

This project aims to provide a reusable Pull to Refresh widget for Android. It was originally based on Johan Nilsson's library (mainly for graphics, strings and animations), but these have been replaced since.

Features

  • Supports both Pulling Down from the top, and Pulling Up from the bottom (or even both).
  • Animated Scrolling for all devices.
  • Over Scroll supports for devices on Android v2.3+.
  • Currently works with:
    • ListView
    • ExpandableListView
    • GridView
    • WebView
    • ScrollView
    • HorizontalScrollView
    • ViewPager
  • Integrated End of List Listener for use of detecting when the user has scrolled to the bottom.
  • Maven Support.
  • Indicators to show the user when a Pull-to-Refresh is available.
  • Support for ListFragment!
  • Lots of Customisation options!

Repository at https://github.com/chrisbanes/Android-PullToRefresh.

Sample Application

The sample application (the source is in the repository) has been published onto Google Play for easy access:

Get it on Google Play

Usage

To begin using the library, please see the Quick Start Guide page.

Customisation

Please see the Customisation page for more information on how to change the behaviour and look of the View.

Pull Up to Refresh

By default this library is set to Pull Down to Refresh, but if you want to allow Pulling Up to Refresh then you can do so. You can even set the View to enable both Pulling Up and Pulling Down using the 'both' setting. See the Customisation page for more information on how to set this.

Apps

Want to see which Apps are already using Android-PullToRefresh? Have a look here. If you have an App which is not on the list, let me know.

Changelog

Please see the new Changelog page to see what's recently changed.

Pull Requests

I will gladly accept pull requests for fixes and feature enhancements but please do them in the dev branch. The master branch is for the latest stable code, dev is where I try things out before releasing them as stable. Any pull requests that are against master from now on will be closed asking for you to do another pull against dev.

Acknowledgments

License

Copyright 2011, 2012 Chris Banes

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.