Convert Figma logo to code with AI

Yalantis logoPhoenix

Phoenix Pull-to-Refresh

4,015
920
4,015
15

Top Related Projects

3,990

微信,企微,机器人,企业微信,企微机器人,微信机器人,小红书,美团,美团爬虫,聚合聊天,RPA,协议,hook,逆向,群发,自动回复,chatgpt,API对接,稳定防封全语言通用,企业定制/SCRM/SAAS专用

6,294

Android Asynchronous Networking and Image Loading

17,071

An Android library for managing images and the memory they use.

34,576

An image loading and caching library for Android focused on smooth scrolling

18,705

A powerful image downloading and caching library for Android

Powerful and flexible library for loading, caching and displaying images on Android.

Quick Overview

Phoenix is a lightweight pull-to-refresh library for Android that provides a customizable and smooth refreshing animation. It offers a unique and visually appealing way to implement the pull-to-refresh functionality in Android applications, enhancing the user experience with its fluid animations and customizable options.

Pros

  • Beautiful and smooth animations for pull-to-refresh functionality
  • Highly customizable, allowing developers to create unique refresh experiences
  • Easy to integrate into existing Android projects
  • Lightweight library with minimal impact on app size

Cons

  • Limited to pull-to-refresh functionality, not a comprehensive UI library
  • May require additional customization for complex use cases
  • Documentation could be more extensive for advanced usage scenarios
  • Not actively maintained (last update was several years ago)

Code Examples

  1. Basic implementation of Phoenix in an activity:
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val phoenixPullToRefresh: PullToRefreshView = findViewById(R.id.pull_to_refresh)
        phoenixPullToRefresh.setOnRefreshListener {
            // Perform refresh operation
            phoenixPullToRefresh.postDelayed({
                phoenixPullToRefresh.setRefreshing(false)
            }, 3000)
        }
    }
}
  1. Customizing the Phoenix refresh view:
val phoenixPullToRefresh: PullToRefreshView = findViewById(R.id.pull_to_refresh)
phoenixPullToRefresh.apply {
    setRefreshStyle(PullToRefreshView.STYLE_SUN)
    setColor(ContextCompat.getColor(context, R.color.custom_color))
    setSunRadius(15f)
    setSunRotationSpeed(0.5f)
}
  1. Programmatically triggering refresh:
val phoenixPullToRefresh: PullToRefreshView = findViewById(R.id.pull_to_refresh)
phoenixPullToRefresh.setRefreshing(true)
// Perform refresh operation
phoenixPullToRefresh.setRefreshing(false)

Getting Started

To use Phoenix in your Android project:

  1. Add the JitPack repository to your root build.gradle:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency to your app's build.gradle:
dependencies {
    implementation 'com.github.Yalantis:Phoenix:v1.2.3'
}
  1. Include the PullToRefreshView in your layout XML:
<com.yalantis.phoenix.PullToRefreshView
    android:id="@+id/pull_to_refresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Your scrollable content here -->

</com.yalantis.phoenix.PullToRefreshView>
  1. Initialize and use the PullToRefreshView in your activity or fragment as shown in the code examples above.

Competitor Comparisons

3,990

微信,企微,机器人,企业微信,企微机器人,微信机器人,小红书,美团,美团爬虫,聚合聊天,RPA,协议,hook,逆向,群发,自动回复,chatgpt,API对接,稳定防封全语言通用,企业定制/SCRM/SAAS专用

Pros of vbot

  • Focused on building virtual agents and chatbots
  • Provides natural language processing capabilities
  • Supports multiple messaging platforms

Cons of vbot

  • Less active development and community support
  • More limited in scope compared to Phoenix's broader web application focus
  • Fewer customization options for UI components

Code Comparison

vbot example:

bot = Vbot::Bot.new do
  hear /hello/i do
    say "Hi there!"
  end
end

bot.start

Phoenix example:

defmodule MyApp.PageController do
  use MyApp.Web, :controller

  def index(conn, _params) do
    render conn, "index.html"
  end
end

While both projects are open-source and related to web technologies, they serve different purposes. Phoenix is a web framework for building scalable web applications in Elixir, offering features like channels for real-time communication. vbot, on the other hand, is more specialized for creating chatbots and virtual agents.

Phoenix provides a more comprehensive solution for web development, including routing, controllers, and views. It has a larger community and more frequent updates. vbot is tailored for conversational interfaces but may require additional tools for full-scale web applications.

The code examples highlight the difference in focus: vbot's code demonstrates setting up a simple chatbot response, while Phoenix's code shows a basic controller action for rendering a web page.

6,294

Android Asynchronous Networking and Image Loading

Pros of Ion

  • More comprehensive library with features beyond image loading (e.g., networking, caching)
  • Better support for older Android versions and a wider range of devices
  • More active development and frequent updates

Cons of Ion

  • Larger library size, which may impact app size and performance
  • Steeper learning curve due to more extensive API and features
  • Less focus on specific UI animations compared to Phoenix

Code Comparison

Phoenix (Pull-to-refresh animation):

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);
    }
});

Ion (Image loading with placeholder):

Ion.with(imageView)
    .placeholder(R.drawable.placeholder_image)
    .error(R.drawable.error_image)
    .load("http://example.com/image.jpg");

While Phoenix focuses on providing a specific pull-to-refresh animation, Ion offers a more general-purpose solution for networking and image loading tasks in Android applications.

17,071

An Android library for managing images and the memory they use.

Pros of Fresco

  • More comprehensive image loading and caching solution for Android
  • Supports a wider range of image formats and sources
  • Better memory management and performance optimization

Cons of Fresco

  • Larger library size and more complex integration
  • Steeper learning curve for developers
  • Less customizable UI components compared to Phoenix

Code Comparison

Phoenix (Pull-to-refresh implementation):

val phoenix = Phoenix(myListView)
phoenix.setOnRefreshListener(object : OnRefreshListener {
    override fun onRefresh() {
        // Refresh logic here
    }
})

Fresco (Image loading):

SimpleDraweeView draweeView = findViewById(R.id.my_image_view);
draweeView.setImageURI("https://example.com/image.jpg");

While Phoenix focuses on providing a customizable pull-to-refresh animation, Fresco is a more comprehensive image loading library. Phoenix offers a simpler API for implementing pull-to-refresh functionality, while Fresco provides advanced image loading and caching capabilities. The code examples demonstrate the different use cases and implementation approaches of these libraries.

34,576

An image loading and caching library for Android focused on smooth scrolling

Pros of Glide

  • Broader functionality: Glide is a comprehensive image loading and caching library, while Phoenix focuses specifically on pull-to-refresh animations.
  • Active development: Glide has more recent updates and a larger community, ensuring ongoing support and improvements.
  • Performance optimization: Glide offers advanced features like memory and disk caching, image resizing, and format decoding.

Cons of Glide

  • Steeper learning curve: Glide's extensive features may require more time to master compared to Phoenix's focused functionality.
  • Larger library size: Glide's comprehensive nature results in a larger footprint, which may impact app size more than Phoenix.

Code Comparison

Phoenix (Pull-to-refresh implementation):

val phoenix = Phoenix(scrollView)
phoenix.setOnRefreshListener(OnRefreshListener {
    // Refresh logic here
})

Glide (Image loading):

Glide.with(context)
    .load(imageUrl)
    .placeholder(R.drawable.placeholder)
    .into(imageView)

While both libraries serve different purposes, this comparison highlights their primary use cases. Phoenix provides a simple, visually appealing pull-to-refresh implementation, while Glide offers a robust solution for image loading and caching in Android applications.

18,705

A powerful image downloading and caching library for Android

Pros of Picasso

  • Broader image loading capabilities, supporting various sources (network, local, content providers)
  • More extensive features for image transformation and caching
  • Larger community and more frequent updates

Cons of Picasso

  • Steeper learning curve due to more complex API
  • Larger library size, potentially increasing app size
  • Less focused on specific UI effects compared to Phoenix

Code Comparison

Phoenix (Pull-to-refresh):

val phoenix = Phoenix(myListView)
phoenix.setOnRefreshListener(object : OnRefreshListener {
    override fun onRefresh() {
        // Refresh logic here
    }
})

Picasso (Image loading):

Picasso.get()
    .load("https://example.com/image.jpg")
    .resize(200, 200)
    .centerCrop()
    .into(imageView)

Summary

Phoenix is a specialized library for pull-to-refresh animations, while Picasso is a comprehensive image loading and caching library. Phoenix offers a simpler API for its specific use case, while Picasso provides more extensive features for image handling. The choice between them depends on the project's requirements: Phoenix for custom refresh animations, Picasso for general image loading and manipulation needs.

Powerful and flexible library for loading, caching and displaying images on Android.

Pros of Android-Universal-Image-Loader

  • More mature and widely adopted library with extensive documentation
  • Supports a broader range of image loading scenarios and customization options
  • Offers memory and disk caching for improved performance

Cons of Android-Universal-Image-Loader

  • No longer actively maintained, with the last update in 2016
  • Larger library size compared to Phoenix, which may impact app size
  • More complex setup and configuration process

Code Comparison

Android-Universal-Image-Loader:

ImageLoader imageLoader = ImageLoader.getInstance();
DisplayImageOptions options = new DisplayImageOptions.Builder()
    .cacheInMemory(true)
    .cacheOnDisk(true)
    .build();
imageLoader.displayImage(imageUri, imageView, options);

Phoenix:

Phoenix.with(imageView)
    .load(url);

Android-Universal-Image-Loader provides more granular control over image loading and caching options, while Phoenix offers a simpler, more concise API for basic image loading tasks. Phoenix focuses specifically on pull-to-refresh animations, whereas Android-Universal-Image-Loader is a more comprehensive image loading solution. The choice between the two depends on the specific requirements of your project, with Phoenix being better suited for projects needing pull-to-refresh functionality and Android-Universal-Image-Loader for more general-purpose image loading needs.

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

Android Arsenal Yalantis

Phoenix Pull-to-Refresh

This project aims to provide a simple and customizable pull to refresh implementation. Made in [Yalantis] (https://yalantis.com/?utm_source=github)

Check this [project on Dribbble] (https://dribbble.com/shots/1650317-Pull-to-Refresh-Rentals)
Check this [project on Behance] (https://www.behance.net/gallery/20411445/Mobile-Animations-Interactions)

alt text

#Usage

For a working implementation, Have a look at the Sample Project - sample

  1. Include the library as local library project.

    compile 'com.yalantis:phoenix:1.2.3'

  2. Include the PullToRefreshView widget in your layout.

    <com.yalantis.phoenix.PullToRefreshView
        android:id="@+id/pull_to_refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <ListView
            android:id="@+id/list_view"
            android:divider="@null"
            android:dividerHeight="0dp"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    
    </com.yalantis.phoenix.PullToRefreshView>
    
  3. In your onCreate method refer to the View and setup OnRefreshListener.

    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);
        }
     });
    

#Customization

To customize drawables you can change:

  • sun.png - Sun image
  • sky.png - background image
  • buildings.png - foreground image

Misc

If you need to change progress state:

	mPullToRefreshView.setRefreshing(boolean isRefreshing)

#Compatibility

  • Android GINGERBREAD 2.3+

Changelog

Version: 1.2

  • Sample updated with RecyclerView example
  • Showing the refresh view just in it's bounds. (Issue with transparent / empty ListView)
  • Possibility to set refresh view padding

Version: 1.0

  • Initial Build

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for Android (iOS) better than better. Stay tuned!

License

Copyright 2017, Yalantis

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.

NPM DownloadsLast 30 Days