项目作者: dwieners

项目描述 :
Android Toast library ❤️
高级语言: Kotlin
项目地址: git://github.com/dwieners/SmartToast.git
创建时间: 2018-10-03T16:32:09Z
项目社区:https://github.com/dwieners/SmartToast

开源协议:

下载


SmartToast

SmartToast is an Android library for a beautiful and customizable Toast

Usage

Add it in your root build.gradle at the end of repositories:

  1. allprojects {
  2. repositories {
  3. ...
  4. maven { url 'https://jitpack.io' }
  5. }
  6. }

Add the dependencies

  1. dependencies {
  2. implementation 'com.github.dwieners:SmartToast:0.1.2'
  3. }

Snackbars

Default Snackbars:

  1. SmartToast.successSnack(this, "YOUR TEXT", Snackbar.LENGTH_SHORT).show()
  2. SmartToast.successSnack(this, "YOUR TEXT").show()
  3. SmartToast.infoSnack(this, "YOUR TEXT", Snackbar.LENGTH_LONG).show()
  4. SmartToast.infoSnack(this, "YOUR TEXT").show()
  5. SmartToast.errorSnack(this, "YOUR TEXT", Snackbar.LENGTH_LONG).show()
  6. SmartToast.errorSnack(this, "YOUR TEXT").show()

Custom Snackbars:

  1. SmartToast.customSnack(this, "YOUR TEXT", SmartToast.DEFAULT_TEXT_COLOR,
  2. resources.getColor(android.R.color.holo_purple, theme),
  3. Snackbar.LENGTH_LONG).show()

Toasts

Default Toasts:

  1. SmartToast.normalToast(this,"YOUR TEXT", Toast.LENGTH_LONG).show()
  2. SmartToast.normalToast(this,"YOUR TEXT").show()
  3. SmartToast.successToast(this, "YOUR TEXT", Toast.LENGTH_LONG).show()
  4. SmartToast.successToast(this, "YOUR TEXT").show()
  5. SmartToast.infoToast(this, "YOUR TEXT", Toast.LENGTH_LONG).show()
  6. SmartToast.infoToast(this, "YOUR TEXT").show()
  7. SmartToast.errorToast(this, "YOUR TEXT", Toast.LENGTH_LONG).show()
  8. SmartToast.errorToast(this, "YOUR TEXT").show()

Custom Toasts:

  1. SmartToast.customToast(this, "YOUR TEXT", SmartToast.DEFAULT_TEXT_COLOR,
  2. resources.getColor(android.R.color.holo_purple, theme),
  3. Toast.LENGTH_LONG).show()