Giter Club home page Giter Club logo

stoast's Introduction

SToast ๐ŸŒ„

Build Status stability-stable minimumSDK stable version Repository size

Android custom toast with 2 types of toast

Content


Setup ๐Ÿ“ฒ

Step 1. Add the JitPack repository to your build file.
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.smith8h:SToast:2.5'
}

Documentation ๐Ÿ“ƒ

Adaptive SToast

It's useful when you use it in direct alerts.

Create Adaptive SToast:

  • AdaptiveSToast.with(context) pass a context.
  • .duration(AdaptiveSToast.LENGTH_LONG) or LENGTH_SHORT (Optional | Default is short).
  • .icon(iconIntRes, colorInt) int resource drawable for icon, and int|String color for icon color (Optional).
  • .title("title") to set the title of toast.
  • .text("some text") to set the message for the user.
  • .show() to show the SToast.

Final code:

AdaptiveSToast.with(this)
    .title("title")
    .text("text")
    
    /* for customization
    .icon(R.drawable.icon, getColor(R.color.color)) // or โ†“
    OR .icon(R.drawable.icon, "hex color")
    .duration(AdaptiveSToast.LENGTH_LONG)
    */
    
    .show();

Mode SToast

It's useful when you use it to warn or notify the user about some actions.


This is DONE mode

Create new Mode SToast:

  • ModeSToast.with(context) pass a context.
  • .mode(...) to set the mode you can use ModeSToast.MODE_OK, MODE_DONE, MODE_WARN,- MODE_ERROR, MODE_CONFUSE, MODE_INFO, MODE_HEART
  • .duration(ModeSToast.LENGTH_LONG) or LENGTH_SHORT (Optional | Default is short).
  • .title("title") to set the title of toast.
  • .text("some text") to set the message for the user.
  • show() to show the SToast.

Final Code:

ModeSToast(this)
    .mode(ModeSToast.MODE_HEART)
    .title("Big Love!")
    .text("Thanks for your donation.")
    .show();

Usable Resources ๐Ÿ—„

You can use the drawables of this lib in your app!
import smith.lib.alerts.toast.R and use them ok_img, true_img, false_img, warn_img, info_img, confuse_img, heart_img

Donations โค

If you would like to support this project's further development, the creator of this projects or the continuous maintenance of the project feel free to donate. Your donation is highly appreciated. Thank you!


You can choose what you want to donate, all donations are awesome!

PayPal Buy me a coffee Ko-fi


With โค๏ธ

stoast's People

Contributors

smith8h avatar

Stargazers

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

Watchers

 avatar

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.