This custom snack bar will help you display much more personalized app toast

Related tags

Toast SnackBar
Overview

STYLEABLE SNACKBAR

Download API Build Status Language ktlint Open Source Love License

ko-fi

💥 Presentation

Using the native android class of snack bar. This custom snack bar will help you display much more personalized app toast. You can change the color, add an icon, outline on the toast and much more.

Success SnackBar

Failure SnackBar

Warning SnackBar

Info SnackBar

Custom SnackBar

💥 Installation

Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency:

dependencies {
	implementation "com.github.xavijimenezmulet:SnackBar:$latest_version"
}

💻 Usage

Two types of snack bar can be used. By type or custom:

Type

These are the existing types:

enum class Type {
 SUCCESS, FAILURE, WARNING, INFORMATION
}

You should call this method from StyleableSnackBar:

/**
 * Creates a snackBar instance with custom duration and color
 * @param viewGroup view group of the caller
 * @param text to be used as the message
 * @param type specifies the image and background to be prompted
 * @param long duration of snackBar false if you want short
 * @param context current context
 * @param showImage to show image (optional) default is true
*/
fun snack(
	 viewGroup: ViewGroup,
	 text: String?,
	 type: Type,
	 long: Boolean,
	 context: Context,
	 showImage: Boolean = true
)

Now we are going to show an example of snack bar setting to FAILURE with image:

StyleableSnackBar.snack(
	 requireActivity().window.decorView.rootView as ViewGroup,
	 "Custom Snack Bar",
	 StyleableSnackBar.Type.FAILURE,
	 true,
	 requireContext()
)

This will show a failure snack bar with failure icon (you can look on presentation gifts).

Custom

You should call this method from StyleableSnackBar:

/**
 * Creates a custom snackbar with the selected elements
 * @param viewGroup view group of the caller
 * @param text to be used as the message
 * @param backgroundColor the snackBar background color
 * @param image image to be used in the snackBar (optional)
 * @param tintImage color of image set (optional)
 * @param long duration of snackBar false if you want short
 * @param strokeColor the outline color (optional)
 * @param strokeWidth the outline width (optional)
*/
fun customSnack(
            viewGroup: ViewGroup,
            text: String?,
            backgroundColor: Int = R.color.black,
            image: Int? = null,
            tintImage: Int = R.color.white,
            long: Boolean,
            strokeWidth: Int = 0,
            strokeColor: Int = R.color.black,
            context: Context
)

Now we are going to show an example of custom snack bar:

StyleableSnackBar.customSnack(
	 requireActivity().window.decorView.rootView as ViewGroup,
	 "Custom Snack Bar",
	 R.color.purple_500,
	 R.drawable.ic_launcher_foreground,
	 R.color.white,
	 true,
	 2,
	 R.color.styleableYellow,
	 requireContext()
)

You can download the code and try the example as shown in the presentation part.

✔️ Changelog

Version: 1.0

  • Initial Build

License

APACHE LICENSE 2.0

You might also like...
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

Simple toast

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

 An easy, flexible way to have the toast message displayed.
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

Customizable toast message library for Android
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

MDToast - MaterialDesign Toast library written with Kotlin with lots of extensions to interact easily in contexts
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

 Android : IamToast  Another Toast library for Android
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

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

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

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.

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

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

Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.

Stetho Stetho is a sophisticated debug bridge for Android applications. When enabled, developers have access to the Chrome Developer Tools feature nat

AwesomeSwitch is a replacement for the standard Switch(View) android offers, and it offers much more customization than the standard switch component.
AwesomeSwitch is a replacement for the standard Switch(View) android offers, and it offers much more customization than the standard switch component.

AwesomeSwitch AwesomeSwitch is a replacement for the standard Switch(View) android offers, and it offers much more customization than the standard swi

TaggerString is very light library which allows to build dynamic string resource in much more readable way.

TaggerString TaggerString is very light library which allows to build dynamic string resource in much more readable way. I guess that every Android de

📭 Extension to Ktor’s routing system to add object oriented routing and much more. 💜

📭 Ktor Routing Extensions Extension to Ktor’s routing system to add object-oriented routing and much more. 💜 Why? This extension library was created

[] Action bar implementation which uses the native action bar on Android 4.0+ and a custom implementation on pre-4.0 through a single API and theme.
[] Action bar implementation which uses the native action bar on Android 4.0+ and a custom implementation on pre-4.0 through a single API and theme.

DEPRECATED ActionBarSherlock is deprecated. No more development will be taking place. For an up-to-date action bar backport use AppCompat. Thanks for

Task Timer - An android app that helps you to keep a track of how much time you spend on each task
Task Timer - An android app that helps you to keep a track of how much time you spend on each task

Task Timer - An android app that helps you to keep a track of how much time you spend on each task

💪 Rich Android Path. 🤡 Draw as you want. 🎉 Animate much as you can.
💪 Rich Android Path. 🤡 Draw as you want. 🎉 Animate much as you can.

💪 Rich Android Path. 🤡 Draw as you want. 🎉 Animate much as you can. Download sample app: Features Full Animation Control on Paths and VectorDrawabl

Kindling - A standalone collection of utilities to help Ignition users. Features various tools to help work with Ignition's custom data export formats
Releases(1.0.1)
Owner
Xavi
Xavi
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
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
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
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
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
A library that extends the Android toast framework.

SuperToasts Library The SuperToasts library enhances and builds upon the Android Toast class. This library includes support for context sensitive Supe

John Persano 2.7k Dec 29, 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
🍞 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
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