Pretty Toast


Source link: https://github.com/CROSP/pretty-toast

Pretty Toast

This is quite simple toast library, that make it easier to show and create custom toast.

This library provides following features :

  • Bunch of predefined static methods for frequently used messages Error, Info, Warning ...
  • Flexible Builder class, so you construct almost any kind of toast message
  • Main class extends native Toast class
  • No memory leaks
  • Support starting from Android 2.1 ( API 7)

UPDATE I updated library to version 0.2.0. There are some important issues were fixed. Now popup window looks much better. So please use 0.2.0 version.

Screenshots and Examples

You can download example app from Google Play Store

Download and Installation

Download the latest AAR or grab via Maven:

<dependency>
  <groupId>ua.com.crosp.solutions.library</groupId>
  <artifactId>pretty-toast</artifactId>
  <version>0.2.0</version> </dependency>

or Gradle:

compile 'ua.com.crosp.solutions.library:pretty-toast:0.2.0'

Usage

NOTE : If you want to use Iconify Android icons, you need to inject icons into yours ApplicationContext, invoke

PrettyToast.initIcons();

It should be called once, and Application class is great place for this, but you can also call it anywhere you want, Iconify Library takes care of filtering duplicates, so it will not waste your memory, but this doesn't mean that you should call initIcons() in a loop :)

For sure, if you are already using Iconify Library you don't need to invoke initIcons(), than in your Application custom class you have to have something like this.

Iconify

  .with(new FontAwesomeModule())

  .with(new EntypoModule())

  .with(new TypiconsModule())

  .with(new MaterialModule())

  .with(new MaterialCommunityModule())

  .with(new MeteoconsModule())

  .with(new WeathericonsModule())

  .with(new SimpleLineIconsModule())

  .with(new IoniconsModule());

By the way, you can call PrettyToast.initIcons() instead of code above. It does the same thing.

Predefined static methods

 PrettyToast.showWarning(getApplicationContext(), "WARNING");
  PrettyToast.showInfo(getApplicationContext(), "INFO");
  PrettyToast.showSuccess(getApplicationContext(), "SUCCESS");
  PrettyToast.showError(getApplicationContext(), "ERROR");
  PrettyToast.showDim(getApplicationContext(), "DIM");

Using Builder class

new PrettyToast.Builder(getApplicationContext())

 .withRightIcon("mdi-earth")

 .withMessage("Custom toast")

 .withLeftIcon("mdi-stackoverflow")

 .withDuration(Toast.LENGTH_SHORT)

 .withLeftIconColor(R.color.firebrick)

 .withBackgroundResource(R.drawable.background_custom)

 .withGravity(new PrettyToast.Gravity(Gravity.START, 15, 0))

 .withTextSize(24)

 .withRightIconColor(R.color.blueviolet)

 .withTextColor(R.color.blue)

 .build()

 .show();

Using completely custom view

 new PrettyToast.Builder(getApplicationContext())

 .withCustomView(LayoutInflater.from(MainActivity.this).inflate(R.layout.toast_custom, null, false))

 .build()

 .show();

You can use any icon provided by Android-Iconify library

Credits

License

Copyright 2016 Oleksandr Molochko  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. 

Resources

Releasing versions in Gradle is very different from releasing in Maven. Maven came with maven-release-plugin which did all the dirty work. Gradle has no such tool and probably doesn't need it anyway. Evolution of software craft came to the point, when we start thinking about SCM as ultimate source of truth about project version. Version should not be hardcoded in pom.xml or build.gradle.

JPatterns is a collection of annotations that should make it easier to communicate the use of Design Patterns within your code to your fellow developers and your future self.

Design Patterns are typically encoded into Java code in an ad-hoc fashion. They are either embedded into the names of the classes or written into the Javadocs. Unfortunately it is impossible to accurately determine a pattern based solely on the class structure without knowing the intent of the code author.

The shorctus have a features of Android 7.1 Nougat, and available only for the launcher that implement, in this library, you can implement in your launcher shortcuts starting from API 14!

Library aiming to calculate prayer time with one line code , if you implement prayer time application , there is no need to do this headache again .

TrustKit Android is an open source library that makes it easy to deploy SSL public key pinning and reporting in any Android App.

Android Application sample of how to implement Master/Detail pattern that follows Material Design visual language.

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