Pretty material design toasts with feedback animations

Last update: May 10, 2022

Load Toast Library

The default toasts are ugly and don't really provide much more than a short message. This small library provides a better toast which will give the user feedback by morphing into a checkmark or cross (success and fail). The lifetime of the toast is completely controlled by you.

Demo

Usage

Step 1

Gradle

dependencies {
    compile 'net.steamcrafted:load-toast:1.0.12'
}

Step 2

The API is very simple, create a new toast by providing a context:

LoadToast lt = new LoadToast(context);

Change the displayed text:

lt.setText("Sending Reply...");

If you don't have a message to display, the toast will shrink to only show the circular loader.

Then proceed to show the toast:

lt.show();

When your background thingy is done provide feedback to the user and hide the toast:

// Call this if it was successful
lt.success();

// Or this method if it failed
lt.error();

// Or if no feedback is desired you can simply hide the toast
lt.hide();

To properly position the toast use the following method to adjust the Y offset:

lt.setTranslationY(100); // y offset in pixels

You can also change the colors of the different toast elements:

lt.setTextColor(Color.RED).setBackgroundColor(Color.GREEN).setProgressColor(Color.BLUE);

In some situations a border might be desired for increased visibility, by default it is transparent:

// Change the border color
lt.setBorderColor(int color);

// Change the border width
lt.setBorderWidthPx(int widthPx);
lt.setBorderWidthDp(int widthDp);
lt.setBorderWidthRes(int resourceId);

When displaying a message in a RTL language you can force the text to marquee from left to right instead of the default right to left:

// pass in false for RTL text, true for LTR text
lt.setTextDirection(boolean isLeftToRight);

These can be chained as you can see.

License

Released under the Apache 2.0 License

GitHub

https://github.com/code-mc/loadtoast
Comments
  • 1. Does not disappear in some cases

    When show() and success() are called within a very short time frame, it looks like the toast is not dismissed.

    This happens for instance in my loader when data is cached (calling show when starting the loader but that one gets completed within 10ms and thus I call success() really quick).

    Reviewed by vpratfr at 2015-04-28 09:01
  • 2. Error

     LoadToast lt = new LoadToast(this);
            lt.setTextColor(Color.RED).setBackgroundColor(Color.GREEN).setProgressColor(Color.BLUE);
            lt.setText("Hallo");
            lt.show();
    
    FATAL EXCEPTION: main
                                                                        Process: com.oli.fitnessapp, PID: 27811
                                                                        java.lang.NoClassDefFoundError: Failed resolution of: Lnet/steamcrafted/loadtoast/R$color;
                                                                            at net.steamcrafted.loadtoast.LoadToastView.<init>(LoadToastView.java:83)
                                                                            at net.steamcrafted.loadtoast.LoadToast.<init>(LoadToast.java:32)
                                                                            at com.oli.myfitnessapp.activities.LiveSelectActivity.onCreate(LiveSelectActivity.java:114)
                                                                            at android.app.Activity.performCreate(Activity.java:6052)
                                                                            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2332)
                                                                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2441)
                                                                            at android.app.ActivityThread.access$800(ActivityThread.java:162)
                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                            at android.os.Looper.loop(Looper.java:135)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:5431)
                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                            at java.lang.reflect.Method.invoke(Method.java:372)
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
                                                                         Caused by: java.lang.ClassNotFoundException: Didn't find class "net.steamcrafted.loadtoast.R$color" on path:
    
    Reviewed by XxGoliathusxX at 2016-05-25 20:17
  • 3. loadtoast alignment is top right corner when used in a viewgroup

    I am using loadtoast in viewpager and when displaying loadtoast, its aligned to top right instead of middle top.

    How can i make it to display normally in middle?

    Reviewed by munimisu at 2015-09-18 04:24
  • 4. align loadtoast

    Hi, thank you for this library. this is very good I have a problem. when I am testing loadtoast on android 4.4 it is showing in center&top of screen but on android 4.0, its align is right&top of screen. I want loadtoast be center&top always. also some time in android 4.4 showing in right&top how can i fix this problem?

    Reviewed by mlkmhd at 2015-05-08 10:11
  • 5. Handle cases without text

    If there is no text, the LoadToast should just show the progress loader without any empty space on the left.

    Sometimes we don't want to write anything, just show that something is getting done in the background.

    Reviewed by vpratfr at 2015-04-28 09:19
  • 6. Adjust width according to text length

    • If the text is too long for the fixed width, the text gets cut. The toast should either
      • marquee the text (scroll it from right to left)
      • adjust the width of the toast (up to screen width minus some margin)
      • split text on multiple lines
    Reviewed by vpratfr at 2015-04-28 09:16
  • 7. Show from the bottom

    Would be nice to be able to tell the toast to show from the bottom instead of from the top.

    My UI has some important elements on top and it would be better to have the toast slide in from the bottom of the screen

    Reviewed by vpratfr at 2015-04-28 07:41
  • 8. loadtoast bottom position

    Hey! I've implemented some basic support of toast bottom positioning. Feel free to suggest any improvements or workarounds.

    P.S. I am kinda new in open source stuff so if I did something wrong - let me know so i could make it better.

    Reviewed by geralt-encore at 2015-04-26 17:53
  • 9. change right to left marquee

    when i have a long text on toast, that cause of make marquee from that which direction and animation is left to right. how can i change that to right to left?

    Reviewed by pishguy at 2017-05-29 14:47
  • 10. Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    Reviewed by bryant1410 at 2017-04-17 10:18
  • 11. Simple hide

    When just loading data, sometimes we would like to just hide the toast, simply because the user did not really do anything which implies showing success or error.

    Would be nice to have a hide method which simply requests the toast to hide while in loading state.

    Reviewed by vpratfr at 2016-03-02 09:51
  • 12. loadToast not visible on devices with a top notch

    On devices having a physical top notch , the loadtoast hides behind the notch and is not visible to the user . The only workaround is to set loadToast.setTranslationY() . But different devices have different not size , so it is not a solution. Please fix this issue to show the loadtoast below status bar so that it is visible on all devices. See the issue in the video link below link

    Reviewed by maxakash at 2020-02-22 09:46
  • 13. Toast goes to 0X and 0Y

    I have imported the library, it works nicely but goes to 0x and 0y and i couldn't change its position by setting translationX or translationY or setX or sety tested on android 8, layout direction was rtl

    Reviewed by AL4AL at 2019-05-07 10:34
  • 14. Un-Escaped apostrophe in resources.

    I am receiving an error on the latest Android (3.2) that is registering an unescaped apostrophe in the following string.

    screen shot 2018-10-03 at 9 14 20 am screen shot 2018-10-03 at 9 14 48 am

    The word don't is enescaped and throwing this issue. Never had it prior to the update although I can't find a workaround at the moment.

    If you could please fix this minor issue I would greatly appreciate it.

    Reviewed by simonjlizotte at 2018-10-03 13:17
  • 15. [Bug] Problem in RTL mode

    Hi, Thank you for this fancy toast library. However there is a problem in rendering in RTL devices. The load toast is shown in right side of the screen instead of center

    Reviewed by TurKurT656 at 2018-06-15 09:41
Related tags
Android library to create customizable floating animated toasts like in Clash Royale app

FloatingToast-Android An android library to make customisable floating animated toasts Getting Started In your build.gradle dependencies { impleme

Mar 9, 2022
An android library for easy implementation of Toasts in Android with easy customisation.
An android library for easy implementation of Toasts in Android with easy customisation.

ToastTypeDecore ©️ A library for easy implementation of Toasts in Android with easy customisation. Latest Version : v2.1 Screenshots Success Toast1 Su

Oct 27, 2021
CuteToast is an Material Design Custom Toast for Android | Custom Material Design Toast
CuteToast is an Material Design Custom Toast for Android | Custom Material Design Toast

CuteToast is an Android Custom Toast library that could be used instead of Default Toast. It does everything as Toast but with some extra spice.

Dec 14, 2021
Balloon 🎈 A lightweight popup like tooltips, fully customizable with arrow and animations.
Balloon  🎈 A lightweight popup like tooltips, fully customizable with arrow and animations.

Balloon ?? A lightweight popup like tooltips, fully customizable with arrow and animations.

May 20, 2022
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Apr 17, 2022
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Apr 17, 2022
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Apr 17, 2022
Stale Android Toasts made tasty.
Stale Android Toasts made tasty.

FrenchToast Stale Android Toasts made tasty. Android Toasts are amazing, but they have a few major drawbacks: You cannot control when they show up as

Apr 15, 2022
:bread: Make your native android Toasts Tasty
:bread: Make your native android Toasts Tasty

TastyToast Make your native android toast look beautiful. Preview About Refer Here Wiki Grab the above demo app from here : Dependency Add dependency

May 2, 2022
Custom toasts with color and icon for Android.
Custom toasts with color and icon for Android.

Dynamic Toasts A simple library to display themed toasts with icon and text on Android 2.3 (API 9) and above devices. Since v0.4.0, it uses 26.x.x sup

May 10, 2022
Android library to create customizable floating animated toasts like in Clash Royale app

FloatingToast-Android An android library to make customisable floating animated toasts Getting Started In your build.gradle dependencies { impleme

Mar 9, 2022
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.
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.

FancyToast-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ... ma

May 19, 2022
An android library for easy implementation of Toasts in Android with easy customisation.
An android library for easy implementation of Toasts in Android with easy customisation.

ToastTypeDecore ©️ A library for easy implementation of Toasts in Android with easy customisation. Latest Version : v2.1 Screenshots Success Toast1 Su

Oct 27, 2021
Material Design text field that comes in a box, based on (OLD) Google Material Design guidelines.
Material Design text field that comes in a box, based on (OLD) Google Material Design guidelines.

TextFieldBoxes A new Material Design text field that comes in a box, based on Google Material Design guidelines. ???? δΈ­ζ–‡ηœ‹θΏ™ι‡Œ UPDATE NOTICE 1.4.5 Releas

May 2, 2022
CuteToast is an Material Design Custom Toast for Android | Custom Material Design Toast
CuteToast is an Material Design Custom Toast for Android | Custom Material Design Toast

CuteToast is an Android Custom Toast library that could be used instead of Default Toast. It does everything as Toast but with some extra spice.

Dec 14, 2021
An OkHttp interceptor which has pretty logger for request and response. +Mock support
An OkHttp interceptor which has pretty logger for request and response. +Mock support

LoggingInterceptor - Interceptor for OkHttp3 with pretty logger Usage val client = OkHttpClient.Builder() client.addInterceptor(LoggingInterceptor

May 18, 2022
βœ”οΈ Simple, pretty and powerful logger for android
βœ”οΈ Simple, pretty and powerful logger for android

Logger Simple, pretty and powerful logger for android Setup Download implementation 'com.orhanobut:logger:2.2.0' Initialize Logger.addLogAdapter(new A

May 17, 2022
A custom ViewPager title strip which gives continuous feedback to the user when scrolling
A custom ViewPager title strip which gives continuous feedback to the user when scrolling

SmartTabLayout A custom ViewPager title strip which gives continuous feedback to the user when scrolling. This library has been added some features an

May 13, 2022
Extended Android Tab Layout with animated indicators that have continuous feedback.
Extended Android Tab Layout with animated indicators that have continuous feedback.

Dachshund Tab Layout Introduction Boosted Android Tab Layout with custom animated indicators including "Dachshund" animation inspired by this. Sample

May 18, 2022