Convert Figma logo to code with AI

race604 logoFlyRefresh

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

2,834
545
2,834
5

Top Related Projects

4,015

Phoenix Pull-to-Refresh

Render After Effects animations natively on Android and iOS, Web, and React Native

DEPRECATED

Android loading animations

🔥下拉刷新、上拉加载、二级刷新、淘宝二楼、RefreshLayout、OverScroll,Android智能下拉刷新框架,支持越界回弹、越界拖动,具有极强的扩展性,集成了几十种炫酷的Header和 Footer。

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

Quick Overview

FlyRefresh is an iOS library that provides a customizable and smooth pull-to-refresh functionality for UIScrollView and its subclasses. It offers a variety of built-in refresh styles and allows developers to create their own custom refresh views.

Pros

  • Customizable Refresh Views: The library allows developers to create their own custom refresh views, providing a high degree of flexibility and control over the user experience.
  • Smooth Animation: The library uses a smooth and natural-looking animation for the refresh process, enhancing the overall user experience.
  • Compatibility: FlyRefresh is compatible with UIScrollView and its subclasses, making it easy to integrate into existing projects.
  • Performance: The library is designed to be lightweight and efficient, with minimal impact on the overall performance of the application.

Cons

  • Limited Platforms: FlyRefresh is currently only available for iOS, and there is no support for other platforms such as Android or web.
  • Dependency on UIKit: The library is tightly coupled with UIKit, which may limit its portability to other iOS frameworks or platforms.
  • Lack of Documentation: The project's documentation could be more comprehensive, making it harder for new developers to get started with the library.
  • Infrequent Updates: The project has not been actively maintained in recent years, which may raise concerns about its long-term viability and support.

Code Examples

Here are a few code examples demonstrating the usage of FlyRefresh:

// Initializing a FlyRefreshView
let refreshView = FlyRefreshView(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: 80))
refreshView.delegate = self
scrollView.addSubview(refreshView)

// Handling refresh events
extension ViewController: FlyRefreshViewDelegate {
    func flyRefreshViewDidStartRefreshing(_ refreshView: FlyRefreshView) {
        // Perform your refresh logic here
        // ...
        refreshView.endRefreshing()
    }
}

// Customizing the refresh view
let customRefreshView = CustomRefreshView(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: 80))
customRefreshView.delegate = self
scrollView.addSubview(customRefreshView)

class CustomRefreshView: FlyRefreshView {
    // Implement your custom refresh view logic here
}

Getting Started

To get started with FlyRefresh, follow these steps:

  1. Add the FlyRefresh library to your project. You can do this by using a package manager like CocoaPods or Carthage, or by manually adding the source files to your project.

  2. Import the FlyRefresh library in your Swift file:

    import FlyRefresh
    
  3. Create an instance of the FlyRefreshView and add it to your UIScrollView:

    let refreshView = FlyRefreshView(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: 80))
    refreshView.delegate = self
    scrollView.addSubview(refreshView)
    
  4. Implement the FlyRefreshViewDelegate protocol to handle the refresh events:

    extension ViewController: FlyRefreshViewDelegate {
        func flyRefreshViewDidStartRefreshing(_ refreshView: FlyRefreshView) {
            // Perform your refresh logic here
            // ...
            refreshView.endRefreshing()
        }
    }
    
  5. (Optional) Customize the refresh view by creating a subclass of FlyRefreshView and implementing your own logic:

    class CustomRefreshView: FlyRefreshView {
        // Implement your custom refresh view logic here
    }
    
  6. (Optional) Adjust the appearance and behavior of the refresh view by modifying the properties and methods of the FlyRefreshView instance.

That's the basic getting started guide for using FlyRefresh in your iOS project. Refer to the project's documentation for more advanced usage and customization options.

Competitor Comparisons

4,015

Phoenix Pull-to-Refresh

Pros of Phoenix

  • More customizable with various animation styles and options
  • Supports both pull-to-refresh and load-more functionality
  • Better documentation and examples provided

Cons of Phoenix

  • Larger library size, potentially impacting app performance
  • Steeper learning curve due to more complex implementation
  • Less frequent updates and maintenance

Code Comparison

Phoenix:

PullToRefreshView mPullToRefreshView = (PullToRefreshView) findViewById(R.id.pull_to_refresh);
mPullToRefreshView.setOnRefreshListener(new PullToRefreshView.OnRefreshListener() {
    @Override
    public void onRefresh() {
        mPullToRefreshView.postDelayed(new Runnable() {
            @Override
            public void run() {
                mPullToRefreshView.setRefreshing(false);
            }
        }, REFRESH_DELAY);
    }
});

FlyRefresh:

mFlylayout.setOnPullRefreshListener(new FlyRefreshLayout.OnPullRefreshListener() {
    @Override
    public void onRefresh(FlyRefreshLayout layout) {
        layout.postDelayed(new Runnable() {
            @Override
            public void run() {
                layout.onRefreshFinish();
            }
        }, REFRESH_DELAY);
    }
});

Both libraries offer similar functionality for implementing pull-to-refresh, but Phoenix provides more customization options and additional features. FlyRefresh, on the other hand, offers a simpler implementation with a unique flying animation. The choice between the two depends on the specific requirements of your project and the desired user experience.

Render After Effects animations natively on Android and iOS, Web, and React Native

Pros of lottie-android

  • More versatile, supporting complex animations from After Effects
  • Widely adopted and maintained by a large company (Airbnb)
  • Extensive documentation and community support

Cons of lottie-android

  • Steeper learning curve, especially for designers unfamiliar with After Effects
  • Larger library size, potentially impacting app performance

Code Comparison

FlyRefresh:

mFlightView = new FlightView(getContext());
addView(mFlightView, new LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
mFlightView.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        startRefresh();
    }
});

lottie-android:

LottieAnimationView animationView = findViewById(R.id.animation_view);
animationView.setAnimation(R.raw.animation);
animationView.setRepeatCount(LottieDrawable.INFINITE);
animationView.playAnimation();

Summary

FlyRefresh is a lightweight library focused on a specific pull-to-refresh animation, while lottie-android offers a more comprehensive solution for complex animations. FlyRefresh is easier to implement for simple use cases, but lottie-android provides greater flexibility and design options. The choice between the two depends on the project's specific animation requirements and the development team's expertise.

DEPRECATED

Pros of AVLoadingIndicatorView

  • Offers a wide variety of loading indicator styles (26+)
  • Easy to implement and customize
  • Lightweight and efficient

Cons of AVLoadingIndicatorView

  • Limited to loading indicators only
  • Less visually unique compared to FlyRefresh's animated character

Code Comparison

AVLoadingIndicatorView:

AVLoadingIndicatorView avi = findViewById(R.id.avi);
avi.show();
// To hide the indicator
// avi.hide();

FlyRefresh:

mFlylayout.setOnPullRefreshListener(new FlyRefreshLayout.OnPullRefreshListener() {
    @Override
    public void onRefresh(FlyRefreshLayout view) {
        view.postDelayed(new Runnable() {
            @Override
            public void run() {
                view.onRefreshFinish();
            }
        }, 2000);
    }
});

AVLoadingIndicatorView provides a simple, straightforward implementation for loading indicators, while FlyRefresh offers a more complex but visually engaging pull-to-refresh animation. AVLoadingIndicatorView is better suited for general loading scenarios, whereas FlyRefresh is specifically designed for pull-to-refresh interactions with a unique animated character.

Android loading animations

Pros of Android-SpinKit

  • Offers a wider variety of loading animations (8 different styles)
  • Provides more customization options for each animation style
  • Easier to implement with a simple XML declaration

Cons of Android-SpinKit

  • Less visually unique compared to FlyRefresh's paper plane animation
  • May not integrate as seamlessly with specific app themes or designs
  • Lacks the pull-to-refresh functionality of FlyRefresh

Code Comparison

FlyRefresh implementation:

mFlightView = (PaperAirplaneView) findViewById(R.id.flight_view);
mPullHeaderView = (PullHeaderView) findViewById(R.id.pull_header);
mPullHeaderView.setOnPullRefreshListener(new PullHeaderView.OnPullRefreshListener() {
    @Override
    public void onRefresh(PullHeaderView view) {
        // Handle refresh action
    }
});

Android-SpinKit implementation:

<com.github.ybq.android.spinkit.SpinKitView
    android:id="@+id/spin_kit"
    style="@style/SpinKitView.Large.Circle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    app:SpinKit_Color="@color/colorAccent" />

The code comparison shows that Android-SpinKit is simpler to implement, requiring only XML declaration, while FlyRefresh needs more Java code to set up the refresh listener and customize the animation.

🔥下拉刷新、上拉加载、二级刷新、淘宝二楼、RefreshLayout、OverScroll,Android智能下拉刷新框架,支持越界回弹、越界拖动,具有极强的扩展性,集成了几十种炫酷的Header和 Footer。

Pros of SmartRefreshLayout

  • More comprehensive and feature-rich, offering a wide variety of refresh styles and animations
  • Better documentation and examples, making it easier for developers to implement and customize
  • Actively maintained with frequent updates and bug fixes

Cons of SmartRefreshLayout

  • Larger library size, which may impact app performance and size
  • Steeper learning curve due to its extensive features and customization options

Code Comparison

FlyRefresh:

mFlightView = (PullHeaderView) findViewById(R.id.headerview);
mListView = (ListView) findViewById(R.id.list);
mFlightView.setOnPullRefreshListener(new PullHeaderView.OnPullRefreshListener() {
    @Override
    public void onRefresh(PullHeaderView headerView) {
        // Refresh logic here
    }
});

SmartRefreshLayout:

RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
refreshLayout.setRefreshHeader(new ClassicsHeader(this));
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
    @Override
    public void onRefresh(RefreshLayout refreshlayout) {
        // Refresh logic here
    }
});

Both libraries provide easy-to-use APIs for implementing pull-to-refresh functionality. However, SmartRefreshLayout offers more customization options and a wider range of built-in header styles.

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

Pros of RecyclerRefreshLayout

  • More flexible and customizable, supporting various types of refresh animations
  • Better integration with RecyclerView, providing smoother scrolling experience
  • Supports both pull-to-refresh and push-to-load-more functionalities

Cons of RecyclerRefreshLayout

  • More complex implementation, requiring more setup code
  • Less visually striking out-of-the-box compared to FlyRefresh's unique animation
  • May have a steeper learning curve for developers new to custom layouts

Code Comparison

RecyclerRefreshLayout:

RecyclerRefreshLayout refreshLayout = findViewById(R.id.refresh_layout);
refreshLayout.setOnRefreshListener(new RecyclerRefreshLayout.OnRefreshListener() {
    @Override
    public void onRefresh() {
        // Refresh logic here
    }
});

FlyRefresh:

mFlayRefresh = findViewById(R.id.fly_layout);
mFlayRefresh.setOnPullRefreshListener(new FlyRefreshLayout.OnPullRefreshListener() {
    @Override
    public void onRefresh(FlyRefreshLayout layout) {
        // Refresh logic here
    }
});

Both libraries offer pull-to-refresh functionality for Android applications, but RecyclerRefreshLayout provides more extensive customization options and better integration with RecyclerView. FlyRefresh, on the other hand, offers a unique and visually appealing animation out-of-the-box. The choice between the two depends on the specific requirements of the project and the desired user experience.

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

FlyRefresh

The Android implementation of Replace, designed by Zee Youn. I implement this as a FlyRefresh layout. The content of the layout can be any NestedScrollingChild, such as a RecyclerView, NestedScrollView, VerticalGridView, etc. This library can also work with NestedScrollingParent as parent, such as CoordinatorLayout.

How it looks

flyrefresh

Features

How to use

Add Gradle dependency:

dependencies {
   compile 'com.race604.flyrefresh:library:2.0.0'
}

An example of basic usage in layout.xml:

<com.race604.flyrefresh.FlyRefreshLayout
  android:id="@+id/fly_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
      android:id="@+id/list"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingTop="24dp"
      android:background="#FFFFFF"/>
</com.race604.flyrefresh.FlyRefreshLayout>

Or you can use PullHeaderLayout for more configurations, you can set custom attributes as shown below:

<declare-styleable name="PullHeaderLayout">
    <!-- hader size -->
    <attr name="phl_header_height" format="dimension" />
    <attr name="phl_header_expand_height" format="dimension" />
    <attr name="phl_header_shrink_height" format="dimension" />
    <!-- header view id -->
    <attr name="phl_header" format="reference" />
    <!-- content view id -->
    <attr name="phl_content" format="reference" />
    <!-- Float action button icon -->
    <attr name="phl_action" format="reference" />
</declare-styleable>

For more, please turn to the source code.

License

FlyRefresh is available under the MIT license.