Convert Figma logo to code with AI

jmp-12 logoSuperToasts

A library that extends the Android toast framework.

2,673
499
2,673
41

Top Related Projects

In-layout notifications. Based on Toast notifications and article by Cyril Mottier (http://android.cyrilmottier.com/?p=773).

A library that extends the Android toast framework.

6,569

The usual Toast, but with steroids 💪

:bread: Make your native android Toasts Tasty

Pretty material design toasts with feedback animations

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

Quick Overview

SuperToasts is an Android library that enhances the standard Android Toast notifications with additional features and customization options. It allows developers to create more visually appealing and interactive toast messages, including progress bars, buttons, and custom layouts.

Pros

  • Offers a wide range of customization options for toast notifications
  • Provides additional functionality like progress bars and buttons within toasts
  • Easy to integrate into existing Android projects
  • Supports both standard and custom layouts for toast messages

Cons

  • May not be actively maintained (last update was several years ago)
  • Some features might not be compatible with newer Android versions
  • Limited documentation and examples available
  • Potential performance impact when using complex custom layouts

Code Examples

Creating a basic SuperToast:

SuperToast.create(context, "Hello, SuperToast!", SuperToast.Duration.MEDIUM).show();

Adding a button to a SuperToast:

SuperActivityToast.create(activity, "Action Required", SuperToast.Duration.LONG)
    .setButtonText("UNDO")
    .setOnButtonClickListener("undo_tag", null, onButtonClickListener)
    .show();

Displaying a progress bar in a SuperToast:

SuperActivityToast.create(activity, "Downloading...", SuperToast.Duration.EXTRA_LONG)
    .setProgressIndeterminate(true)
    .setFrame(Style.FRAME_LOLLIPOP)
    .setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_PURPLE))
    .show();

Getting Started

  1. Add the SuperToasts dependency to your build.gradle file:
dependencies {
    implementation 'com.github.johnpersano:supertoasts:2.0'
}
  1. In your Activity or Fragment, import the necessary classes:
import com.github.johnpersano.supertoasts.library.SuperToast;
import com.github.johnpersano.supertoasts.library.Style;
  1. Create and show a SuperToast:
SuperToast.create(this, "Hello, SuperToast!", SuperToast.Duration.SHORT)
    .setFrame(Style.FRAME_LOLLIPOP)
    .setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BLUE))
    .setAnimations(Style.ANIMATIONS_POP)
    .show();

Competitor Comparisons

In-layout notifications. Based on Toast notifications and article by Cyril Mottier (http://android.cyrilmottier.com/?p=773).

Pros of Android-AppMsg

  • More customizable appearance options for messages
  • Supports chaining multiple messages in a queue
  • Better integration with Material Design principles

Cons of Android-AppMsg

  • Less frequent updates and maintenance
  • Fewer animation options for message display and dismissal
  • Limited support for custom layouts compared to SuperToasts

Code Comparison

Android-AppMsg:

AppMsg appMsg = AppMsg.makeText(this, "Hello World", AppMsg.STYLE_INFO);
appMsg.setAnimation(android.R.anim.fade_in, android.R.anim.fade_out);
appMsg.show();

SuperToasts:

SuperToast.create(this, "Hello World", Style.DURATION_SHORT)
    .setFrame(Style.FRAME_KITKAT)
    .setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BLUE))
    .setAnimations(Style.ANIMATIONS_POP)
    .show();

Both libraries offer simple ways to create and display toast-like messages, but SuperToasts provides more built-in styling options and animation types out of the box. Android-AppMsg focuses on a cleaner API and easier integration with existing Android components, while SuperToasts offers more extensive customization capabilities for advanced use cases.

A library that extends the Android toast framework.

Pros of SuperToasts

  • More comprehensive documentation
  • Wider range of customization options
  • Active community support and regular updates

Cons of SuperToasts

  • Larger file size due to additional features
  • Steeper learning curve for beginners
  • May have performance overhead for simple use cases

Code Comparison

SuperToasts:

SuperToast.create(this, "Hello, SuperToast!", SuperToast.Duration.SHORT)
    .setIcon(R.drawable.ic_star)
    .setGravity(Gravity.CENTER)
    .show();

SuperToasts>:

Toast.makeText(this, "Hello, Toast!", Toast.LENGTH_SHORT)
    .setGravity(Gravity.CENTER, 0, 0)
    .show();

SuperToasts offers more built-in customization options and a fluent API, while SuperToasts> provides a simpler, more straightforward approach. The SuperToasts example demonstrates the ability to easily add icons and adjust gravity, which would require additional code in SuperToasts>.

Both libraries serve the purpose of displaying toast notifications, but SuperToasts is better suited for applications requiring advanced customization and features, while SuperToasts> is ideal for simpler use cases where standard Android Toast functionality suffices.

6,569

The usual Toast, but with steroids 💪

Pros of Toasty

  • Simpler API and easier to implement
  • Supports custom animations for toast appearance/disappearance
  • Smaller library size, potentially reducing app bloat

Cons of Toasty

  • Less customization options for toast appearance
  • Lacks some advanced features like progress bars or buttons within toasts
  • Not actively maintained (last update was in 2018)

Code Comparison

SuperToasts:

SuperToast.create(this, "Hello World!", SuperToast.Duration.LONG)
    .setBackground(Color.RED)
    .setTextColor(Color.WHITE)
    .setIcon(R.drawable.icon_star)
    .show();

Toasty:

Toasty.success(getApplicationContext(), "Success!", Toast.LENGTH_SHORT, true).show();
Toasty.error(getApplicationContext(), "Error!", Toast.LENGTH_SHORT, true).show();
Toasty.info(getApplicationContext(), "Info", Toast.LENGTH_SHORT, true).show();

SuperToasts offers more granular control over toast appearance, while Toasty provides pre-defined styles for quick implementation. SuperToasts allows for more complex customizations, but Toasty's API is more straightforward for basic use cases. Both libraries extend Android's native Toast functionality, but cater to different levels of customization needs.

:bread: Make your native android Toasts Tasty

Pros of TastyToast

  • More modern and visually appealing design with animated icons
  • Supports custom colors for toast backgrounds
  • Easier to implement with a simpler API

Cons of TastyToast

  • Limited customization options compared to SuperToasts
  • Lacks advanced features like swipe-to-dismiss or progress bars
  • No support for custom layouts or views within toasts

Code Comparison

TastyToast:

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

SuperToasts:

SuperToast.create(this, "Hello World!", Style.DURATION_LONG)
    .setIcon(R.drawable.icon_success, IconPosition.LEFT)
    .setBackground(PaletteUtils.getSolidColor(PaletteUtils.GREEN))
    .show();

TastyToast offers a more concise implementation, while SuperToasts provides greater flexibility and customization options. TastyToast is better suited for quick, visually appealing toasts with minimal setup, whereas SuperToasts is ideal for developers requiring more advanced features and fine-grained control over toast appearance and behavior.

Pretty material design toasts with feedback animations

Pros of loadtoast

  • Simpler API with fewer customization options, making it easier to implement quickly
  • Focuses specifically on loading toasts, providing a more streamlined solution for this use case
  • Smoother animations and transitions out of the box

Cons of loadtoast

  • Limited customization options compared to SuperToasts
  • Lacks support for different toast types (e.g., info, warning, error)
  • No built-in support for action buttons or additional interactivity

Code Comparison

SuperToasts:

SuperToast superToast = new SuperToast(context);
superToast.setDuration(SuperToast.Duration.MEDIUM);
superToast.setText("Hello, SuperToast!");
superToast.setIcon(R.drawable.icon_success, SuperToast.IconPosition.LEFT);
superToast.show();

loadtoast:

LoadToast lt = new LoadToast(context);
lt.setText("Loading...");
lt.show();
// ... Perform task ...
lt.success();

Summary

loadtoast offers a simpler, more focused solution for loading toasts with smoother animations, while SuperToasts provides greater flexibility and customization options for various toast types and interactions. Choose loadtoast for quick implementation of loading indicators, and SuperToasts for more complex toast requirements.

[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 active development with recent updates and contributions
  • Extensive customization options for toast appearance
  • Better documentation and usage examples

Cons of StyleableToast

  • Limited animation options compared to SuperToasts
  • Lacks some advanced features like progress bars or buttons in toasts

Code Comparison

StyleableToast:

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

SuperToasts:

SuperToast.create(context, "Hello World!", Style.DURATION_SHORT)
    .setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BLUE))
    .setAnimations(Style.ANIMATIONS_POP)
    .show();

Both libraries offer simple ways to create and customize toasts, but StyleableToast provides a more modern, Kotlin-friendly API. SuperToasts offers more built-in animation options, while StyleableToast focuses on extensive styling capabilities.

StyleableToast is generally more suitable for projects requiring highly customized toast appearances, while SuperToasts may be preferred for applications needing advanced toast features like progress indicators or interactive elements.

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

SuperToasts Library

Download

The SuperToasts library enhances and builds upon the Android Toast class. This library includes support for context sensitive SuperActivityToasts that can show progress and handle button clicks as well as non-context sensitive SuperToasts which offer many customization options over the standard Android Toast class.

Screenshot

Adding SuperToasts to your project

SuperToasts are now available on Jcenter. Add the following to your module's build.gradle file:

dependencies {
    compile 'com.github.johnpersano:supertoasts:2.0'
}

Using the library

Simple sample:

SuperActivityToast.create(getActivity(), new Style(), Style.TYPE_BUTTON)
    .setButtonText("UNDO")
    .setButtonIconResource(R.drawable.ic_undo)
    .setOnButtonClickListener("good_tag_name", null, onButtonClickListener)
    .setProgressBarColor(Color.WHITE)
    .setText("Email deleted")
    .setDuration(Style.DURATION_LONG)
    .setFrame(Style.FRAME_LOLLIPOP)
    .setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_PURPLE))
    .setAnimations(Style.ANIMATIONS_POP).show();

Check out the Wiki pages* for more detailed samples.
*Please note that the Wiki pages are still being updated and may not reflect the most recent changes in version 2.0.

Demo Application

A simple demo application is available on Google Play. This demo application does not showcase all of the libraries functions rather it is a short demonstration of major features of the library.

Android app on Google Play

Considerations

Some of the ideas for this library came from the UndoBar Library and the Crouton Library.

Developer

John Persano

License

Copyright 2013-2016 John Persano

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.