Giter VIP home page Giter VIP logo

sweettoast's Introduction

SweetToast

Screenshots of toasts

default info success warning
error custom (only text) custom (only icon) custom (full)

Setup

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.TheHasnatBD:SweetToast:1.0.2'
}

Usage

Android Default Toast

To display default short Toast-

SweetToast.defaultShort(context, "YOUR STRING");

To display default long Toast-

SweetToast.defaultLong(context, "YOUR STRING");

SweetToast Default Toast

(without duration parameter, every Default Toast's duration is Toast.LENGTH_SHORT)
To display a success Toast-

SweetToast.success(context, "YOUR STRING");
SweetToast.success(context, "YOUR STRING", duration);

To display an info Toast-

SweetToast.info(context, "YOUR STRING");
SweetToast.info(context, "YOUR STRING", duration);

To display a warning Toast-

SweetToast.warning(context, "YOUR STRING");
SweetToast.warning(context, "YOUR STRING", duration);

To display an error Toast-

SweetToast.error(context, "YOUR STRING");
SweetToast.error(context, "YOUR STRING", duration);

Custom Toast

( duration parameter is must be needed in custom method)
(textColor takes a int value.
textColor example- Color.WHITE or, getResources().getColor(R.color.colorWhite) or Color.parseColor("#FFFFFF"))


To display a partial-custom Toast-

// Only custom Icon >> in pre-defined backgroundColor and textColor : LightGRAY and BLACK
SweetToast.custom(context, "YOUR STRING", drawableIcon, duration);

To display a custom Text Toast without Icon-

SweetToast.custom(context, "YOUR STRING", textColor, backgroundDrawable, duration);

To display a FULLY custom Toast-

SweetToast.custom(context, "YOUR STRING", drawableIcon, textColor, backgroundDrawable, duration);

SweetToast Demo App


(If you find/face any problem, please open an issue or make a pull request)


sweettoast's People

Contributors

thehasnatbd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

mosione70

sweettoast's Issues

Leak in SweetToast

private static View view, myView;

This element and several other elements may cause memory leaks in different scenarios

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.