platform
License
jitpack

GDSCToast

Custom Toast Library by Google Developer Student Club University of Brawijaya

Prerequisites

  • For old version of gradle (before arctic fox update)

    Add this in your root build.gradle file (project scope)

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}
  • For gradle version 7 or latest

    Add this in your root setting.gradle file

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Dependency

Add this to your module’s build.gradle file :

dependencies {
	...
	implementation 'com.github.KylixEza:GDSCToast:version'
}

you can check the version on jitpack badge above or on release tag

Usage

Each function start with ‘make…’ like makeNomralToast always returns a Toast object, so you can customize your own Toast. But if you just want to show the toast without any customization, you can use function that start with ‘show…’ like showNormalToast

  • To display a normal Toast:

GDSCToast.makeNormalToast(this@MainActivity, "This is a normal toast", Toast.LENGTH_LONG, true).show()
GDSCToast.showNormalToast(this@MainActivity, "This is a normal toast", Toast.LENGTH_LONG, true)
  • To display a success Toast:

GDSCToast.makeSuccessToast(this@MainActivity, "This is a success toast", Toast.LENGTH_LONG, true).show()
GDSCToast.showSuccessToast(this@MainActivity, "This is a success toast", Toast.LENGTH_LONG, true)
  • To display an error Toast:

GDSCToast.makeErrorToast(this@MainActivity, "This is an error toast", Toast.LENGTH_LONG, true).show()
GDSCToast.showErrorToast(this@MainActivity, "This is an error toast", Toast.LENGTH_LONG, true)
  • To display an warning Toast:

GDSCToast.makeWarningToast(this@MainActivity, "This is a warning toast", Toast.LENGTH_LONG, true).show()
GDSCToast.showWarningToast(this@MainActivity, "This is a warning toast", Toast.LENGTH_LONG, true)
  • To display an info Toast:

GDSCToast.makeInfoToast(this@MainActivity, "This is an info toast", Toast.LENGTH_LONG, true).show()
GDSCToast.showInfoToast(this@MainActivity, "This is an info toast", Toast.LENGTH_LONG, true)

Preview

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

kylix-eza-saputra-1bb1b7192
k_ylix
#Kylix3272

Don’t forget to ⭐this repository to motivates me to share more open source library

GitHub

View Github