A library that extends the Android toast framework.

Related tags

Toast SuperToasts
Overview

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.
Comments
  • Using MetricAffectSpans to get different typeface leads to wrong padding

    Using MetricAffectSpans to get different typeface leads to wrong padding

    Because of the missing Typeface-setting option, I tried a real clue: Setting texts using SpannableStrings that include a different MetricAffectingSpan (see http://stackoverflow.com/a/15181195/273456)

    But when doing that, the padding around the text gets really small, the toasts become extremely thin... Could you help?

    opened by Zordid 10
  • Naming conventions

    Naming conventions

    I notice, that the naming conventions of member fields, local variables and parameters are wildly mixed in the code.

    In Android, it's convention to use the prefix "m" for member fields only, not for local variables. In your code, sometimes you have member fields without any prefix but also some local variables have an "m" prefix.

    Makes your code hard to read and understand. I would offer help, but I am new to github and don't know how to contribute...

    opened by Zordid 8
  • Is the repository dead?

    Is the repository dead?

    Hey,

    Thanks for sharing! I'm just curious if the repository is still maintained. If not, it would be great to know it in order to switch to another toast framework.

    Cheers! :panos

    opened by le4ker 6
  • Floating SuperCardToast?

    Floating SuperCardToast?

    Have you thought in adding a 'floating' style to SuperCardToasts? Something like what Crouton does. I really like SuperCardToast and the customization possibilities, but two things made me finally discard it:

    • The need to add a new layout in my root view
    • Because SuperCardToast moves everything down, if working with lists this forces the adapter to repaint (and remeasure) everything over and over.

    It would be nice to have the possibility to display the card over the current layout

    enhancement 
    opened by lgvalle 6
  • Why onTouchListener for button click?

    Why onTouchListener for button click?

    Using SuperCardToasts with buttons isn't working so well for me in 1.3.2.

    The button seems to have an OnTouchListener that dismisses the toast before the wrapped OnClickListener is called.

    Why are you using Touch listeners instead of Click listeners for the button?

    opened by myanimal 6
  • How to transport information for OnClickWrappers?

    How to transport information for OnClickWrappers?

    Hi John! Well, now I see how you want to "restore" OnClickListeners for Buttons in Toasts - using the Wrapper classes and a tag. But your example case is too simple: how should I transport information to my potentially restored OnClickListener between orientation changes? In your demo it is clear that the "potentially destructive action" which gives a toast with a button cannot use any context data, like what should restored when the button is clicked! ...that is one reason why I do not like the restoring of toasts at all! In my use cases, I create an OnClickListener class that inherently "knows" which data is to be worked on, just because I use inner classes. That cannot be done using your model at all. What is needed is a way to maybe also give a bundle to the Wrapper for each use of the toast - and that will have to be restored on orientation change as well... See what I mean? Thanks! Olaf

    opened by Zordid 6
  • Decomposition required

    Decomposition required

    Right now there's five completely unrelated classes. Though works fine they're too large and difficult to read. A lot of code duplication can also be avoided. It would be great to introduce some hierarchy and maybe couple interfaces...

    opened by RomanZhilich 6
  • setGravity() for SuperActivitiyToast

    setGravity() for SuperActivitiyToast

    I would like to slightly adjust the position of a SuperActivityToast, but it doesn't seem to have a setGravity() method, like SuperToast does. Can this be added?

    enhancement 
    opened by justbbetter 4
  • Request: Please remove unused resources from the library project

    Request: Please remove unused resources from the library project

    For example "dummy_layout.xml" . If you just need its id to be declared, just declare an id in a "ids.xml" file.

    In order to find all of the unused resources, I suggest to run Lint (and on the way to also check other warnings of it).

    enhancement 
    opened by AndroidDeveloperLB 4
  • SuperActivityToast now showing (and not clickable) occasionally ?

    SuperActivityToast now showing (and not clickable) occasionally ?

    I am using SuperActivityToast to show a confirmation with an optional info button (which launches another activity).

    Occasionally the toast doesn't come up. Occasionally it comes up but the button is not clickable. Noticed this happens when we try using it frequently. I am using it from a fragment. Any clues ?

    Code below:

        subscribeConfirmationToast = new SuperActivityToast(getActivity(), SuperToast.Type.BUTTON);
        subscribeConfirmationToast.setTouchToDismiss(true);
        subscribeConfirmationToast.setText(getResources().getString(R.string.button_subscribe_confirmation));
        subscribeConfirmationToast.setButtonIcon(R.drawable.ic_action_database, 
                getResources().getString(R.string.page_title_subscribed));
        subscribeConfirmationToast.setDuration(SuperToast.Duration.SHORT);
        subscribeConfirmationToast.setOnClickWrapper(new OnClickWrapper(this.getClass().getName(), new OnClickListener() {
            @Override
            public void onClick(View view, Parcelable token) {
                SuperActivityToast.cancelAllSuperActivityToasts();
                EventBus.getDefault().post(new Event.ShowMyShowsClicked(getActivity()));    // This will launch another activity.           
            }
        }));
    
    public void onEventMainThread(Event.ShowSubscribed event) {
        // some other UI updations
        if(subscribeConfirmationToast != null) {
            subscribeConfirmationToast.show();
        }
       }
    
    bug 
    opened by skadavan 4
  • SuperCardToast with ViewPager

    SuperCardToast with ViewPager

    I've a Fragment that holds a ViewPager. This ViewPager has 2 fragments (let's call them, "FragmentA" and "FragmentB" as tabbed views.

    Both FragmentA and FragmentB have:

    As root on their XML layout. When FragmentB is on the screen and the user presses something in there to fire a Toast the Toast is displayed, always, on FragmentA (which is not visible to the user) and not in the FragmentB (where the user is).

    It should fire the Toasts in the "on screen" fragment.

    Is this a bug? I can't find out a solution for this and I can't find anything on google regarding this issue.

    opened by dazito 3
  • Gravity doesn't work when style.TYPE_BUTTON is used

    Gravity doesn't work when style.TYPE_BUTTON is used

    Hi am trying to add gravity in main activity, applying

    .setGravity(Gravity.TOP) takes the toast out of the screen.

    I tried adding position with the gravity and it doesnt work

     position_x = (int) (CommonClass.width * 0.24);
    position_y = (int) (CommonClass.height * 0.18);
    
    
     SuperActivityToast.create(activity, new Style(), Style.TYPE_BUTTON)
                            .setButtonText("UNDO")
                            .setButtonIconResource(R.drawable.ic_home_black_24dp)
                            .setProgressBarColor(Color.WHITE)
                            .setText(s)
                            .setGravity(Gravity.TOP,position_x,position_y)
                            .setDuration(Style.DURATION_VERY_SHORT)
                            .setFrame(Style.FRAME_STANDARD)
                            .setColor(this.getResources().getColor(R.color.bluetoast))
                            .setPriorityLevel(Style.PRIORITY_HIGH)
                            .setAnimations(Style.ANIMATIONS_POP).show();
    

    is there any possibility that i could toast by setting offset in x and y using TYPE_BUTTON?

    opened by Surakshaajith 0
  • cannot resolve symbol 'Style'

    cannot resolve symbol 'Style'

    import com.github.johnpersano.supertoasts.library.Style; import com.github.johnpersano.supertoasts.library.SuperActivityToast; how to resolve cannot resolve symbol 'Style' ?? and resolve cannot resolve symbol 'SuperActivityToast' ??

    Thanks and regard Sondang

    opened by sondangpangrib 0
  • Obsolete version overriding

    Obsolete version overriding

    Hello!

    I'm working with old project (about 2014 y) which is using SuperToasts. I want to override to its latest 2.0 version, but there's a problem that all of methods are changed. You're so lucky man, I have no so much time for totally rewrite my libraries which is working well. So, Wiki's is so old, so can I ask you about newest alternatives?

    1. setOnButtonClickListener () What we need to add to the third argument of it? And what is second one? Trying to add OnButtonClickListener method, but it's an abstract.
    2. How is setOnDismissWrapper () method called now? I need it because there's widget repaint needed on this action.
    3. Now new setButtonIconResource () accept only one method, so the second one is not needed which was needed in old setButtonIcon () method?

    Thanks in advance!

    opened by ointeractive-depot 0
Releases(2.0)
Owner
John Persano
John Persano
Android : IamToast Another Toast library for Android

Android : IamToast Another Toast library for Android Warning. toast custom view is deprecated since android 11(R) Setup allprojects { repositories

null 2 Jun 12, 2022
🍞 The missing toast library for Android.

Literally Toast ?? A toast library for Android. Usage: ?? Use the LitToast to get lit and show your users a proper toast. LitToast.create(context, "My

David Voiss 229 Nov 25, 2022
Toastie is a customizable Android toast library.

Toastie Getting Started Gradle Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories: Note

Burak Fidan 36 Apr 3, 2021
Attractive, stylish and customizable toast library for Android.

FabToast min SDK 16 (Jelly Bean 4.1) written in Java To download the demo app for this library from Google Playstore so you can see it in action, clic

Dean Spencer 11 Feb 14, 2022
Customizable toast message library for Android

Android Custom Toast Message (SnToast) Customizable Toast Message Library For Android Add this in your root build.gradle file allprojects { reposito

null 9 Nov 15, 2021
A really simple library that help you to display a custom toast with many colors (for : success, warning, danger, info, dark, light, primary...etc ), or with rounded corners, or event with image.

CoolToast A really simple library that help you to display a custom toast with many colors (for : success, warning, danger, info, dark, light, primary

null 21 Dec 20, 2022
Custom Toast Library by Google Developer Student Club University of Brawijaya

GDSCToast Custom Toast Library by Google Developer Student Club University of Brawijaya Prerequisites For old version of gradle (before arctic fox upd

Kylix Eza S 6 Sep 15, 2022
MDToast - MaterialDesign Toast library written with Kotlin with lots of extensions to interact easily in contexts

MDToast - MaterialDesign Toast A lightweight Toast library written with Kotlin i

Morteza Omar Mohammady 12 Dec 23, 2022
In-layout notifications. Based on Toast notifications and article by Cyril Mottier (http://android.cyrilmottier.com/?p=773).

Android AppMsg (Crouton) Library Implementation of in-layout notifications. Based on Toast notifications and article The making of Prixing #4: in-layo

Evgeny Shishkin 1.4k Nov 25, 2022
An Android Toast replacement, similar to the one seen in the GMail app.

MessageBar An Android Toast replacement, similar to the one seen in the GMail app. Multiple messages can be posted in succession, and each message wil

Simon Vig Therkildsen 555 Nov 25, 2022
Android Custom Toast

Super Toast Library Written Purely in Kotlin ❤️ Usual Toast but with super powers!!! ?? A Fully Customised and Customisable Toast. ]( https://android-

null 26 Dec 27, 2022
Android Toast For RTL Applications

RTL-Toast Android library to show Toasts in a pretty RTL way Install Add it in your root build.gradle allprojects { repositories { ... ma

Arash Hatami 15 Nov 16, 2022
The usual Toast, but with steroids 💪

Toasty The usual Toast, but with steroids. Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { r

null 6.4k Jan 9, 2023
Simple toast

newlibrary Simple toast Step 1. Add the JitPack repository to your build file allprojects { repositories { ... maven { url 'https://jitpack.io

Aziz Developer 0 Nov 5, 2021
An easy, flexible way to have the toast message displayed.

IToaster Library An easy, flexible way to have the toast message displayed. Download Gradle Add below codes to your root build.gradle file (not your m

Evans Kiptarus Kibet 1 Mar 19, 2022
This custom snack bar will help you display much more personalized app toast

?? Presentation Using the native android class of snack bar. This custom snack bar will help you display much more personalized app

Xavi 4 Dec 8, 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
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
A tooltip/showcase library for Android re-written in Kotlin.

UglyTooltip Based on another Showcase library. Being kotlinized, customized and refactored.

null 26 Dec 9, 2022