Convert Figma logo to code with AI

Shashank02051997 logoFancyToast-Android

Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

1,290
190
1,290
2

Top Related Projects

6,569

The usual Toast, but with steroids 💪

[Moved to MavenCentral] An Android library that takes the standard toast to the next level with many styling options. Works on all Android versions.

A library that extends the Android toast framework.

:bread: Make your native android Toasts Tasty

Quick Overview

FancyToast-Android is a custom Android toast library that enhances the standard Android toast functionality. It provides visually appealing and customizable toast messages with various styles, icons, and animations, allowing developers to create more engaging user notifications in their Android applications.

Pros

  • Easy to integrate and use in Android projects
  • Offers multiple pre-defined toast styles (success, error, warning, etc.)
  • Supports custom animations and durations
  • Allows for extensive customization of toast appearance

Cons

  • May increase app size slightly due to additional resources
  • Limited documentation and examples
  • Not actively maintained (last update was over a year ago)
  • Might not be fully compatible with the latest Android versions

Code Examples

  1. Basic usage of FancyToast:
FancyToast.makeText(
    this,
    "Hello World!",
    FancyToast.LENGTH_LONG,
    FancyToast.SUCCESS,
    false
).show()
  1. Customizing FancyToast appearance:
FancyToast.makeText(
    this,
    "Custom Toast",
    FancyToast.LENGTH_LONG,
    FancyToast.DEFAULT,
    R.drawable.ic_custom_icon,
    true
).show()
  1. Creating a FancyToast with a custom configuration:
val fancyToast = FancyToast.makeText(this, "Customized Toast", FancyToast.LENGTH_LONG, FancyToast.INFO, false)
fancyToast.setTextColor(Color.RED)
fancyToast.setTextSize(16)
fancyToast.setIcon(R.drawable.ic_custom_icon)
fancyToast.show()

Getting Started

  1. Add the JitPack repository to your project's build.gradle file:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency to your app's build.gradle file:
dependencies {
    implementation 'com.github.Shashank02051997:FancyToast-Android:0.1.8'
}
  1. Use FancyToast in your Android code as shown in the code examples above.

Competitor Comparisons

6,569

The usual Toast, but with steroids 💪

Pros of Toasty

  • More customization options, including custom fonts and icon tinting
  • Supports dark theme out of the box
  • Smaller library size, potentially reducing app bloat

Cons of Toasty

  • Less intuitive API for creating toasts compared to FancyToast-Android
  • Fewer pre-defined toast styles (success, error, etc.) than FancyToast-Android
  • Limited animation options compared to FancyToast-Android

Code Comparison

FancyToast-Android:

FancyToast.makeText(this, "Hello World!", FancyToast.LENGTH_LONG, FancyToast.SUCCESS, true).show();

Toasty:

Toasty.success(getApplicationContext(), "Hello World!", Toast.LENGTH_SHORT, true).show();

Both libraries offer similar functionality for creating custom toasts, but FancyToast-Android provides a more familiar API that closely resembles Android's native Toast class. Toasty, on the other hand, requires specifying the toast type (success, error, etc.) as a method call, which may be less intuitive for some developers.

FancyToast-Android offers more pre-defined styles and animation options, making it easier to create visually appealing toasts quickly. However, Toasty provides more fine-grained control over customization, including the ability to set custom fonts and tint icons.

Overall, the choice between these libraries depends on the specific needs of your project and personal preference for API design.

[Moved to MavenCentral] An Android library that takes the standard toast to the next level with many styling options. Works on all Android versions.

Pros of StyleableToast

  • More customization options, including custom fonts and corner radius
  • Supports Kotlin DSL for easier configuration
  • Smaller library size and fewer dependencies

Cons of StyleableToast

  • Lacks some pre-defined styles available in FancyToast-Android
  • Does not support custom animations out of the box

Code Comparison

FancyToast-Android:

FancyToast.makeText(this, "Hello World!", FancyToast.LENGTH_LONG, FancyToast.SUCCESS, true).show()

StyleableToast:

StyleableToast.Builder(context)
    .text("Hello World!")
    .textColor(Color.WHITE)
    .backgroundColor(Color.GREEN)
    .show()

Both libraries offer easy-to-use APIs for creating custom toasts, but StyleableToast provides more granular control over individual elements. FancyToast-Android focuses on pre-defined styles, while StyleableToast allows for more detailed customization.

StyleableToast's Kotlin DSL support makes it more convenient for Kotlin developers, while FancyToast-Android's pre-defined styles can be quicker to implement for common use cases.

Overall, StyleableToast is better suited for projects requiring extensive toast customization, while FancyToast-Android may be preferable for quick implementation of common toast styles.

A library that extends the Android toast framework.

Pros of SuperToasts

  • More customization options for toast appearance and behavior
  • Supports additional toast types like progress and button toasts
  • Includes a manager class for handling multiple toasts

Cons of SuperToasts

  • Less actively maintained (last update was several years ago)
  • More complex implementation compared to FancyToast-Android
  • Larger library size due to additional features

Code Comparison

FancyToast-Android:

FancyToast.makeText(this, "Hello World!", FancyToast.LENGTH_LONG, FancyToast.SUCCESS, true).show();

SuperToasts:

SuperToast.create(this, "Hello World!", Style.DURATION_LONG)
    .setBackground(Style.GREEN)
    .setAnimations(Style.ANIMATIONS_POP)
    .show();

Both libraries offer simple ways to create and display custom toasts, but SuperToasts provides more granular control over toast properties. FancyToast-Android uses a more concise syntax, while SuperToasts allows for method chaining to set various options.

FancyToast-Android is more lightweight and easier to implement for basic use cases, making it suitable for projects that need quick and simple custom toasts. SuperToasts, on the other hand, offers more advanced features and customization options, making it a better choice for projects requiring complex toast functionality.

:bread: Make your native android Toasts Tasty

Pros of TastyToast

  • Offers more toast types, including confusing, warning, and default styles
  • Includes animated icons for each toast type, enhancing visual appeal
  • Smaller library size, potentially reducing app bloat

Cons of TastyToast

  • Less customization options compared to FancyToast-Android
  • Limited to predefined styles, while FancyToast-Android allows for more flexibility
  • Less active maintenance and updates

Code Comparison

TastyToast:

TastyToast.makeText(getApplicationContext(), "Hello World!", TastyToast.LENGTH_LONG, TastyToast.SUCCESS);

FancyToast-Android:

FancyToast.makeText(this, "Hello World!", FancyToast.LENGTH_LONG, FancyToast.SUCCESS, true).show();

Both libraries offer similar ease of use, with TastyToast requiring slightly less code. However, FancyToast-Android provides more customization options through additional parameters and methods.

TastyToast focuses on predefined styles with animated icons, making it ideal for quick implementation of visually appealing toasts. FancyToast-Android, on the other hand, offers greater flexibility in terms of customization, allowing developers to tailor the toast appearance to their specific needs.

While TastyToast has a smaller footprint, FancyToast-Android compensates with more frequent updates and active maintenance, potentially providing better long-term support and compatibility.

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

FancyToast-Android

platform API License Maven Central Android Arsenal Recommend me on LinkedIn

Get it on Google Play

Prerequisites

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
	repositories {
		...
		mavenCentral()
	}
}

Dependency

This library is available on MavenCentreal

Add this to your module's build.gradle file (make sure the version matches the Maven-Central badge above):

dependencies {
	...
	implementation 'io.github.shashank02051997:FancyToast:2.0.2'
}

Usage

Each method always returns a Toast object, so you can customize the Toast much more. DON'T FORGET THE show() METHOD!

To display an default Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.DEFAULT,true);

To display a success Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.SUCCESS,true);

To display an info Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.INFO,true);

To display a warning Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.WARNING,true);

To display the error Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.ERROR,true);

To display the confusing Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.CONFUSING,true);

You can also remove the android icon on top-right corner by passing last parameter false.

FancyToast.makeText(yourContext, "I'm a Toast", duration, type, boolean value).show();

You can also create your custom Toasts with passing your image with or without android icon(top-right corner):

FancyToast.makeText(yourContext, "I'm a custom Toast", duration, type, yourimage, boolean value).show();

To display the custom Toast with no android icon:

FancyToast.makeText(this, "This is Custom Toast with no android icon", FancyToast.LENGTH_LONG, FancyToast.CONFUSING, R.drawable.ic_android_black_24dp, false);

Screenshots

Please click the image below to enlarge.

Contributing

Please fork this repository and contribute back using pull requests.

Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed .

Contact - Let's become friend

Don't forget to star ⭐ the repo it motivates me to share more open source

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

Buy Me A Coffee

License

Copyright 2020 Shashank Singhal

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.