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.

Overview

FancyToast-Android

platform API License Android Arsenal Recommend me on LinkedIn

Get it on Google Play

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 {
	...
	implementation 'com.github.Shashank02051997:FancyToast-Android:0.1.8'
}

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 default Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.DEFAULT,true);

To display a success Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.SUCCESS,true);

To display an info Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.INFO,true);

To display a warning Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.WARNING,true);

To display the error Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.ERROR,true);

To display the confusing Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.CONFUSING,true);

You can also remove the android icon on top-right corner by passing last parameter false.

FancyToast.makeText(yourContext, "I'm a Toast", duration, type, boolean value).show();

You can also create your custom Toasts with passing your image with or without android icon(top-right corner):

FancyToast.makeText(yourContext, "I'm a custom Toast", duration, type, yourimage, boolean value).show();

To display the custom Toast with no android icon:

FancyToast.makeText(this, "This is Custom Toast with no android icon", FancyToast.LENGTH_LONG, FancyToast.CONFUSING, R.drawable.ic_android_black_24dp, false);

Screenshots

Please click the image below to enlarge.

Contributing

Please fork this repository and contribute back using pull requests.

Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed .

Contact - Let's become friend

Don't forget to star the repo it motivates me to share more open source

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

Buy Me A Coffee

License

Copyright 2020 Shashank Singhal

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
  • Remove Android Icon

    Remove Android Icon

    Amazing looking toasts! I love the raised bubbly look. It is perfect for a certain style of apps and has not been shared on Github before. Thank you!

    Is it possible to provide an option to remove the Android Icon in the top right corner of the toasts? That icon is somewhat distracting. Thank you!

    opened by searchy2 5
  • Changing Background Color and Customization of Toast.

    Changing Background Color and Customization of Toast.

    Hi, I am unable to change the background color or customize the toast. I want to increase its Width and Height. and even change the color of the Toast's background.

    opened by Afaqrehman98 4
  • Changed String message type to CharSequence

    Changed String message type to CharSequence

    I propose this change because in my App I need to use Spannable to have texts with different colors in the toasts. CharSequence seems a good parent of both String and Spannable and I think it's working fine.

    By the way, thanks for this simple but nice lib! Congrats :)

    opened by LluisFelip 4
  • duration not working please advise.

    duration not working please advise.

    Used newer as well as older version both having same issue. //implementation 'com.github.Shashank02051997:FancyToast-Android:0.1.8' implementation 'io.github.shashank02051997:FancyToast:2.0.1'

    FancyToast.makeText(getApplicationContext(), msg,5000 , FancyToast.SUCCESS, false).show();

    opened by sagar0701 2
  • Using Gravity

    Using Gravity

    Using Gravity within the Toast makes .show() come up red:

    FancyToast.makeText(Login.this, "Welcome! Please Login", FancyToast.LENGTH_SHORT, FancyToast.INFO, false).setGravity(Gravity.CENTER_HORIZONTAL, 0, 0).show();

    opened by PassionateSolutions 2
  • java.lang.RuntimeException

    java.lang.RuntimeException

    In Google Play Console - Android vitals under "Installed from anywhere" I am getting java.lang.RuntimeException com.shashank.sony.fancytoastlib.FancyToast.a

    Caused by: java.lang.RuntimeException: at android.widget.Toast$TN.<init> (Toast.java:433) at android.widget.Toast.<init> (Toast.java:118) at android.widget.Toast.<init> (Toast.java:109) at com.shashank.sony.fancytoastlib.FancyToast.a (FancyToast.java:2) at games.moisoni.evfp.MainActivity.a (MainActivity.java:13) at com.anjlab.android.iab.v3.BillingProcessor.getPurchasePayload (BillingProcessor.java) at com.anjlab.android.iab.v3.BillingProcessor.detectPurchaseTypeFromPurchaseResponseData (BillingProcessor.java) at com.anjlab.android.iab.v3.BillingProcessor.handleActivityResult (BillingProcessor.java) at com.anjlab.android.iab.v3.BillingProcessor.loadPurchasesByType (BillingProcessor.java) at com.anjlab.android.iab.v3.BillingProcessor.f (BillingProcessor.java:4) at com.anjlab.android.iab.v3.BillingProcessor$HistoryInitializationTask.doInBackground (BillingProcessor.java) at com.anjlab.android.iab.v3.BillingProcessor$HistoryInitializationTask.doInBackground (BillingProcessor.java) at android.os.AsyncTask$2.call (AsyncTask.java:333) at java.util.concurrent.FutureTask.run (FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:636) at java.lang.Thread.run (Thread.java:764)

    This happens only in "Installed from anywhere" not from Play Store. I also use in-app purchase v3 library and use this toast to confirm the purchase and eventually errors.

    `@Override public void onProductPurchased(@NonNull String productId, @Nullable TransactionDetails details) { if (productId.equalsIgnoreCase("android.test.purchased")) { //real - remove_ads_purchase |||| // test - android.test.purchased YoYo.with(Techniques.FadeOutUp) .duration(500) .repeat(0) .playOn(findViewById(R.id.relative_ads)); findViewById(R.id.no_ads_line).setVisibility(View.GONE);

            //If purchasedCounter = 1 don't show ads
            purchasedCounter = 1;
    
            //Save purchase
            SharedPreferences savePurchase = getSharedPreferences("MyPurchase", Context.MODE_PRIVATE);
            SharedPreferences.Editor editorPurchase = savePurchase.edit();
            editorPurchase.putInt("purchase", purchasedCounter);
            editorPurchase.apply();
    
            FancyToast.makeText(MainActivity.this, "Done! Thanks for your purchase!",
                    FancyToast.LENGTH_LONG, FancyToast.SUCCESS, false).show();
    
            //Restart activity for changes to take effect
            Intent intent = new Intent(MainActivity.this, MainActivity.class);
            startActivity(intent);
            finish();
            Animatoo.animateFade(MainActivity.this);
        }
    }`
    
    opened by moisoni97 2
  • Why FancyToast class is extending Toast class?

    Why FancyToast class is extending Toast class?

    I don't know why FancyToast class is extending from Toast class when your class is using static method and using default Toast class to do all the stuff?

    opened by khawarraza-netsoltech 2
  • margin attributes changed

    margin attributes changed

    Using Gravity#LEFT and Gravity#RIGHT can lead to problems when a layout is rendered in locales where text flows from right to left. Use Gravity#START and Gravity#END instead.

    Similarly, in XML gravity and layout_gravity attributes, use start rather than left. For XML attributes such as paddingLeft and layout_marginLeft, use paddingStart and layout_marginStart.

    NOTE: If your minSdkVersion is less than 17, you should add both the older left/right attributes as well as the new start/right attributes. On older platforms, where RTL is not supported and the start/right attributes are unknown and therefore ignored, you need the older left/right attributes. There is a separate lint check which catches that type of error. (Note: For Gravity#LEFT and Gravity#START, you can use these constants even when targeting older platforms, because the start bitmask is a superset of the left bitmask. Therefore, you can use gravity="start" rather than gravity="left|start".)

    opened by thenishchalraj 1
  • Added Annotations

    Added Annotations

    Using annotations improve code readability and usability. Try to use annotations or enums wherever possible, so that end user has better readability and understanding that what type of integer or some data class is required.

    opened by rooparsh 0
Releases(2.02)
Owner
Shashank Singhal
Google Certified Android Developer | Freelancer | Android App Developer | Game Developer | API Developer |Software Developer | Web Developer | Open Source lover
Shashank Singhal
:bread: Make your native android Toasts Tasty

TastyToast Make your native android toast look beautiful. Preview About Refer Here Wiki Grab the above demo app from here : Dependency Add dependency

Rahul Yadav 2k Dec 29, 2022
A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).

Android Switch Preference Backport A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on

Benoit Lubek 498 Dec 29, 2022
A cool Open Source CoverFlow view for Android with several fancy effects.

FancyCoverFlow THIS PROJECT IS NO LONGER MAINTAINED! What is FancyCoverFlow? FancyCoverFlow is a flexible Android widget providing out of the box view

David Schreiber-Ranner 1.1k Nov 10, 2022
Takes the input from the Android MediaPlayer and displays visualizations, like in iTunes or WinAmp

Android Visualizer A View subclass that Takes the input from the Android MediaPlayer and displays visualizations, like in iTunes or WinAmp The Visuali

null 798 Dec 22, 2022
Nature takes back over.

ShatteredReclamation This is a plugin that allows the wild to slowly take player creations back over. Config Threads This plugin uses multiple threads

ShatteredSoftware 3 Jul 15, 2022
NeoPOP was created with one simple goal; to create the next generation of a beautiful, affirmative design system

NeoPop is CRED's inbuilt library for using NeoPop components in your app

CRED 254 Dec 29, 2022
Multi Roots TreeView implementation for Android Platform with a lot of options and customization

Multi roots TreeView :palm_tree: implementation for Android Platform with a lot of options and customization

Amr Hesham 112 Jan 3, 2023
A full options clock view

Clock View Full options Clock view. You are now able to create and design your own clock view with changing just attributes. Over 20 attributes are av

Belkilani Ahmed Radhouane 65 Dec 9, 2022
Allows you to launch various /hidden/ options of the Oculus Quest (2)

vrLauncher Allows you to launch various /hidden/ options of the Oculus Quest (2) Using it Sideload the apk onto your Oculus Quest (2) Choose the optio

Bastian 153 Dec 25, 2022
Card with swipe options in Jetpack Compose

SwipeableActionCard Card with swipe options in Jetpack Compose Tutorial: Click Here Import SwipeableActionCard library Add this in project level build

Harsh Mahajan 1 Nov 23, 2021
Provides 9-patch based drop shadow for view elements. Works on API level 9 or later.

Material Shadow 9-Patch This library provides 9-patch based drop shadow for view elements. Works on API level 14 or later. Target platforms API level

Haruki Hasegawa 481 Dec 19, 2022
Display code with syntax highlighting :sparkles: in native way.

CodeView (Android) CodeView helps to show code content with syntax highlighting in native way. Description CodeView contains 3 core parts to implement

Kirill Biakov 827 Dec 22, 2022
Make a cool intro for your Android app.

AppIntro AppIntro is an Android Library that helps you build a cool carousel intro for your App. AppIntro has support for requesting permissions and h

AppIntro Team 10.3k Dec 30, 2022
Make a cool intro for your Android app.

AppIntro AppIntro is an Android Library that helps you build a cool carousel intro for your App. AppIntro has support for requesting permissions and h

AppIntro Team 40 Jan 3, 2023
Bootstrap style widgets for Android, with Glyph Icons

Android-Bootstrap Android Bootstrap is an Android library which provides custom views styled according to the Twitter Bootstrap Specification. This al

Bearded Hen 7.3k Jan 3, 2023
A util for setting status bar style on Android App.

StatusBarUtil A util for setting status bar style on Android App. It can work above API 19(KitKat 4.4). 中文版点我 Sample Download StatusBarUtil-Demo Chang

Jaeger 8.8k Jan 7, 2023
An Android custom view to display digits rendered as dots in a grid, with a style like a 1970s LED clock.

#DotMatrixView This is an Android library project providing a custom view that can display things on a grid of dots. When the displayed value changes,

Mark Roberts 48 Apr 21, 2022
This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementation of a lesson on the Pluralsight platform, but with some code improvements

NoteKeeper-Custom-Widgets This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementati

Ibrahim Mushtaha 3 Oct 29, 2022
A set of Android-UI components to make it easier to request permission in a user friendly way.

Permission UI A set of Android-UI components to make it easier to request permission in a user friendly way. Access background location A jetpack comp

Stefan Wärting 54 Nov 3, 2022