Pretty material design toasts with feedback animations

Related tags

Toast loadtoast
Overview

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

Comments
  • Does not disappear in some cases

    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).

    opened by vpratfr 4
  • Error

    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:
    
    help wanted 
    opened by XxGoliathusxX 3
  • loadtoast alignment is top right corner when used in a viewgroup

    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?

    opened by munimisu 3
  • align loadtoast

    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?

    opened by mlkmhd 3
  • Handle cases without text

    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.

    opened by vpratfr 3
  • Adjust width according to text length

    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
    opened by vpratfr 3
  • Show from the bottom

    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

    opened by vpratfr 2
  • loadtoast bottom position

    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.

    opened by geralt-encore 2
  • change right to left marquee

    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?

    opened by pishguy 1
  • Fix broken headings in Markdown files

    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

    opened by bryant1410 1
  • Simple hide

    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.

    enhancement 
    opened by vpratfr 1
  • loadToast not visible on devices with a top notch

    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

    opened by maxakash 0
  • Toast goes to 0X and 0Y

    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

    opened by AL4AL 0
  • Un-Escaped apostrophe in resources.

    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.

    opened by simonjlizotte 0
  • [Bug] Problem in RTL mode

    [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

    opened by TurKurT656 6
Releases(1.0.12)
  • 1.0.12(Oct 3, 2017)

    • Added LTR/RTL support (setTextDirection)
    • Added hide method.
    • Rewrote elevation logic, view should now always appear on top
    • Added border (setBorderColor, setBorderWidth)
    • Fixed a memory leak caused by the loading circle AnimatedDrawable
    Source code(tar.gz)
    Source code(zip)
  • 1.0.10(Jan 30, 2016)

  • 1.0.9(Sep 28, 2015)

  • 1.0.8(Jul 3, 2015)

    • When no text is provided, the toast shrinks to only show the circular loader.
    • Fixed a bug where calling error() or dismiss() within 1 ms after initialization would not hide the toast.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.7(Jul 3, 2015)

    If the text is too long to display inside the toast, it will no longer be cut off but it will now marque.

    I still highly suggest only using these for very short (<15 char) messages.

    Source code(tar.gz)
    Source code(zip)
  • 1.0.6(Apr 27, 2015)

  • 1.0.5(Apr 26, 2015)

Owner
Young and motivated Computer Scientist. Actively researching and learning about exciting new technologies. Contact me on LinkedIn.
null
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

Hariprasanth S 96 Dec 30, 2022
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

Aditya Bavadekar 1 Jul 7, 2022
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.

K M Rejowan Ahmmed 12 Dec 17, 2022
Balloon 🎈 A lightweight popup like tooltips, fully customizable with arrow and animations.

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

Jaewoong Eum 2.8k Jan 2, 2023
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

Mike Penz 1.8k Nov 10, 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

#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

Mike Penz 1.8k Nov 10, 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

#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

Mike Penz 1.8k Nov 10, 2022
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

py - Pierre Yves Ricau 367 Nov 15, 2022
: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

Rahul Yadav 2k Dec 29, 2022
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

Pranav Pandey 156 Dec 20, 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

Hariprasanth S 96 Dec 30, 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.

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

Shashank Singhal 1.2k Dec 26, 2022
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

Aditya Bavadekar 1 Jul 7, 2022
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

Mark Wang 769 Jan 7, 2023
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.

K M Rejowan Ahmmed 12 Dec 17, 2022
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

ihsan BAL 1.3k Dec 26, 2022
βœ”οΈ 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

Orhan Obut 13.5k Dec 30, 2022
A download button with pretty cool animation

ArrowDownloadButton A download button with pretty cool animation, this is an implemention of https://dribbble.com/shots/2012292-Download-Animation Enj

Rongchan Liu 966 Nov 29, 2022
Sliding cards with pretty gallery effects.

SlidingCard Sliding cards with pretty gallery effects. Download Include the following dependency in your build.gradle file. Gradle: repositories {

mxn 681 Sep 7, 2022