All Projects → pranavpandey → Dynamic Toasts

pranavpandey / Dynamic Toasts

Licence: apache-2.0
Custom toasts with color and icon for Android.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Dynamic Toasts

Smartmaterialspinner
The powerful android spinner library for your application
Stars: ✭ 108 (-18.18%)
Mutual labels:  library, material-design, hint
Iconshowcase
Full-of-features, easy-to-customize, free and open source, Material Design dashboard for icon packs.
Stars: ✭ 91 (-31.06%)
Mutual labels:  material-design, icon
Ngx Select Dropdown
Custom Dropdown for Angular 4+ with multiple and single selection options
Stars: ✭ 91 (-31.06%)
Mutual labels:  library, custom
Ts3admin.class
The ts3admin.class is a powerful api for communication with Teamspeak 3 Servers from your website! Your creativity knows no bounds!
Stars: ✭ 103 (-21.97%)
Mutual labels:  library, icon
Wymaterialbutton
Interactive and fully animated Material Design button for iOS developers.
Stars: ✭ 80 (-39.39%)
Mutual labels:  library, material-design
Floatingtoast
Android library to create customizable floating animated toasts like in Clash Royale app
Stars: ✭ 86 (-34.85%)
Mutual labels:  library, toast
Simpledialogfragments
A collection of easy to use and extendable DialogFragment's for Android
Stars: ✭ 94 (-28.79%)
Mutual labels:  library, material-design
Fancytoast Android
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.
Stars: ✭ 1,067 (+708.33%)
Mutual labels:  material-design, toast
Materialtextfield
A different beautiful Floating Edit Text
Stars: ✭ 1,504 (+1039.39%)
Mutual labels:  text, material-design
Kivymd
Set of widgets for Kivy inspired by Google's Material Design.
Stars: ✭ 107 (-18.94%)
Mutual labels:  library, material-design
Bottombar
(Deprecated) A custom view component that mimics the new Material Design Bottom Navigation pattern.
Stars: ✭ 8,459 (+6308.33%)
Mutual labels:  library, material-design
Sscustomedittextoutlineborder
Same as an Outlined text fields presented in Material Design page but with some dynamic changes
Stars: ✭ 119 (-9.85%)
Mutual labels:  material-design, custom
Materialchipview
Material Chip view. Can be used as tags for categories, contacts or creating text clouds
Stars: ✭ 1,181 (+794.7%)
Mutual labels:  text, material-design
Icon Workshop
图标工场 - 移动应用图标生成工具,一键生成所有尺寸的应用图标和启动图
Stars: ✭ 1,303 (+887.12%)
Mutual labels:  material-design, icon
Dotsloaderview
Simple dots loader view
Stars: ✭ 63 (-52.27%)
Mutual labels:  library, custom
Completely
Java autocomplete library.
Stars: ✭ 90 (-31.82%)
Mutual labels:  library, text
Art
🎨 ASCII art library for Python
Stars: ✭ 1,026 (+677.27%)
Mutual labels:  library, text
Viewtooltip
A fluent tooltip for Android
Stars: ✭ 1,029 (+679.55%)
Mutual labels:  custom, hint
Bubble Navigation
🎉 [Android Library] A light-weight library to easily make beautiful Navigation Bar with ton of 🎨 customization option.
Stars: ✭ 1,537 (+1064.39%)
Mutual labels:  library, material-design
Folding Cell
📃 FoldingCell is an expanding content cell with animation made by @Ramotion
Stars: ✭ 10,035 (+7502.27%)
Mutual labels:  library, material-design

Dynamic Toasts

License Build Status Download

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 support libraries so, minimum SDK will be Android 4.0 (API 14).
Since v2.0.0, it uses AndroidX so, first migrate your project to AndroidX.


Contents


Installation

It can be installed by adding the following dependency to your build.gradle file:

dependencies {
    // For AndroidX enabled projects.
    implementation 'com.pranavpandey.android:dynamic-toasts:3.3.1'

    // For legacy projects.
    implementation 'com.pranavpandey.android:dynamic-toasts:1.3.0'
}

Usage

It has several method to display toasts based on the requirement. Each method returns a Toast object which can be customised further.

Please call show() method to display the toast.

For complete reference, please read the documentation.

Configuration

Optional configuration to customise the toasts further like custom background color or drawable, custom text size, typeface or icon size, etc.

Various methods can be called anywhere in the app to do customisations.

DynamicToast.Config.getInstance()
    // Background color for default toast.
    .setDefaultBackgroundColor(@ColorInt int defaultBackgroundColor)
    // Tint color for default toast.
    .setDefaultTintColor(@ColorInt int defaultTintColor)
    // Background color for error toast.
    .setErrorBackgroundColor(@ColorInt int errorBackgroundColor)
    // Background color for success toast.
    .setSuccessBackgroundColor(@ColorInt int successBackgroundColor)
    // Background color for warning toast.
    .setWarningBackgroundColor(@ColorInt int warningBackgroundColor)
    // Custom icon for error toast. Pass `null` to use default icon.
    .setErrorIcon(@Nullable Drawable errorIcon)
    // Custom icon for success toast. Pass `null` to use default icon.
    .setSuccessIcon(@Nullable Drawable successIcon)
    // Custom icon for warning toast. Pass `null` to use default icon.
    .setWarningIcon(@Nullable Drawable warningIcon)
    // Disable icon for all the toasts.
    .setDisableIcon(boolean disableIcon)
    // Custom icon size in `pixels` for all the toasts.
    .setIconSize(int iconSize)
    // Custom text size in `SP` for all the toasts.
    .setTextSize(int textSize)
    // Custom text typeface for all the toasts. Pass `null` to use system typeface.
    .setTextTypeface(@Nullable Typeface textTypeface)
    // Custom background drawable for all the toasts. Pass `null` to use default background.
    .setToastBackground(@Nullable Drawable toastBackground)
    // Apply customisations.
    .apply();

Call reset() method to reset all the customisations.

// Reset customisations.
DynamicToast.Config.getInstance().reset();

Default toast

Simple toast based on the vanilla Android theme for Toast.LENGTH_SHORT duration.

DynamicToast.make(context, "Default toast").show();

Default toast with duration

Simple toast based on the vanilla Android theme for supplied duration.

DynamicToast.make(context, "Default toast with duration", duration).show();

Default toast with icon

Simple toast based on the vanilla Android theme with a icon for Toast.LENGTH_SHORT duration.

DynamicToast.make(context, "Default toast with icon", drawable).show();

Default toast with icon and duration

Simple toast based on the vanilla Android theme with a icon for supplied duration.

DynamicToast.make(context, "Default toast with icon and duration", drawable, duration).show();

Error toast

Error toast with #F44336 background for Toast.LENGTH_SHORT duration.

DynamicToast.makeError(context, "Error toast").show();

Error toast with duration

Error toast with #F44336 background for supplied duration.

DynamicToast.makeError(context, "Error toast with duration", duration).show();

Success toast

Success toast with #4CAF50 background for Toast.LENGTH_SHORT duration.

DynamicToast.makeSuccess(context, "Success toast").show();

Success toast with duration

Success toast with #4CAF50 background for supplied duration.

DynamicToast.makeSuccess(context, "Success toast with duration", duration).show();

Warning toast

Warning toast with #FFEB3B background for Toast.LENGTH_SHORT duration.

DynamicToast.makeWarning(context, "Warning toast").show();

Warning toast with duration

Warning toast with #FFEB3B background for supplied duration.

DynamicToast.makeWarning(context, "Warning toast with duration", duration).show();

Custom toast

Custom toast based on the supplied background and tint color for Toast.LENGTH_SHORT duration.

DynamicToast.make(context, "Custom toast", tintColor, backgroundColor).show();

Custom toast with duration

Custom toast based on the supplied background and tint color for supplied duration.

DynamicToast.make(context, "Custom toast with duration", tintColor, backgroundColor, duration).show();

Custom toast with icon

Custom toast based on the supplied icon, background and tint color theme for Toast.LENGTH_SHORT duration.

DynamicToast.make(context, "Custom toast with icon", drawable, tintColor, backgroundColor).show();

Custom toast with icon and duration

Custom toast based on the supplied icon, background and tint color theme for supplied duration.

DynamicToast.make(context, "Custom toast with icon and duration", drawable, 
        tintColor, backgroundColor, duration).show();

Cheat sheets

Use dynamic hint to display cheat sheets for any view. All the methods are same as explained above, just replace DynamicToast with DynamicHint to create a cheat sheet.

Use DynamicHint.show(view, toast) method to display it according to the anchor view position.

Dependency

It depends on the dynamic-utils to perform various internal operations. So, its functions can also be used to perform other useful operations.


Author

Pranav Pandey

GitHub Follow on Twitter Donate via PayPal


License

Copyright 2017-2021 Pranav Pandey

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].