Toasty


Source link: https://github.com/GrenderG/Toasty/

Toasty

The usual Toast, but with steroids.

Prerequisites

Add this in your root build.gradle file ( not your module build.gradle file):

allprojects {
  repositories {

...
maven {
 url "https://jitpack.io" 
}
  
}
 
}

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
  ...  compile 'com.github.GrenderG:Toasty:1.2.5' 
}

Configuration

This step is optional, but if you want you can configure some Toasty parameters. Place this anywhere in your app:

Toasty.Config.getInstance()
  .setErrorColor(@ColorInt int errorColor) // optional
  .setInfoColor(@ColorInt int infoColor) // optional
  .setSuccessColor(@ColorInt int successColor) // optional
  .setWarningColor(@ColorInt int warningColor) // optional
  .setTextColor(@ColorInt int textColor) // optional
  .tintIcon(boolean tintIcon) // optional (apply textColor also to the icon)
  .setToastTypeface(@NonNull Typeface typeface) // optional
  .setTextSize(int sizeInSp) // optional
  .apply();
 // required

You can reset the configuration by using reset() method:

Toasty.Config.reset();

Usage

Each method always returns a Toast object, so you can customize the Toast much more. DON'T FORGET THE show() METHOD!

To display an error Toast:

Toasty.error(yourContext, "This is an error toast.", Toast.LENGTH_SHORT, true).show();

To display a success Toast:

Toasty.success(yourContext, "Success!", Toast.LENGTH_SHORT, true).show();

To display an info Toast:

Toasty.info(yourContext, "Here is some info for you.", Toast.LENGTH_SHORT, true).show();

To display a warning Toast:

Toasty.warning(yourContext, "Beware of the dog.", Toast.LENGTH_SHORT, true).show();

To display the usual Toast:

Toasty.normal(yourContext, "Normal toast w/o icon").show();

To display the usual Toast with icon:

Toasty.normal(yourContext, "Normal toast w/ icon", yourIconDrawable).show();

You can also create your custom Toasts with the custom() method:

Toasty.custom(yourContext, "I'm a custom Toast", yourIconDrawable, tintColor, duration, withIcon,  shouldTint).show();

Extra

You can pass formatted text to Toasty!

There are variants of each method, feel free to explore this library.

Screenshots

Please click the image below to enlarge.

Apps using Toasty

Want to be here? Open an issue or make a pull request.

ChromoPhoto - Colorize B&W
AutoTagger - ???????? ?????.
ColorHub - Color Palette
Touch for Facebook
Daily – News flipped around
Oz! Comic Reader
Impactor Unroot
Fusemounter
BlueWords
Levipic - Photo Gallery & Map
Maki for Facebook & Twitter
Eva: Everything for Telegram
Pastebin

Resources

Simplified Android Rest API wrapper on-top of okHttp

A utility library for Android to schedule one-time or periodic jobs while your app is running. Currently, Android OS supports 3 types of scheduling APIs: Handler, AlarmManager and JobScheduler. The choice of one suitable API, the inflexibility of switching between them and the amount of boilerplate code required for setting up makes it difficult to use these APIs.

A Java library that adjust interpolator dynamically (inspired by Facebook Rebound).

TContributionsView can be use for a Contributions View, like in one personal homepage of Github, and more than that.

A Gradle plugin to easily apply the same setup of static analysis tools across different Android or Java projects.

ScrollParallaxImageView extends ImageView, and provides parallax effects when it scrolls in the screen.It can be use in any view which can scroll its content, like ListView, RecyclerView, ScrollView, etc.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes