Show Custom TOAST
Dependencies
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency :
implementation 'com.github.abuanzeh:AnzehLibrary:1.0.5'
Example on Success Toast
ToasterMessage.Builder()
//set context
.setContext(context)
//set Your Message
.setMessage("YOUR MESSAGE HERE")
//set custom background color default is green color
.setSuccessBackgroundColor(R.color.cusom_color)
//set custom corner radius if you want
.setCornerRadius(50)
//set success custom icon
.setSuccessIcon(R.drawable.ic_check)
//Where to display the message Gravity.TOP or Gravity.BOTTOM
.setGravityOfMessage(Gravity.TOP)
//Message display time Toast.LENGTH_SHORT or Toast.LENGTH_LONG
.setDuration(Toast.LENGTH_SHORT)
//set Text Color
.setTextColor()
.build()
.showMessage()
Example on Error Toast
ToasterMessage.Builder()
//set context
.setContext(context)
//set Your Message
.setMessage("YOUR MESSAGE HERE")
//set custom background color default is green color
.setFieldBackgroundColor(R.color.cusom_color)
//set custom corner radius if you want
.setCornerRadius(50)
//set success custom icon
.setFieldIcon(R.drawable.ic_check)
//Where to display the message Gravity.TOP or Gravity.BOTTOM
.setGravityOfMessage(Gravity.TOP)
//Message display time Toast.LENGTH_SHORT or Toast.LENGTH_LONG
.setDuration(Toast.LENGTH_SHORT)
//set Text Color
.setTextColor()
.build()
.showMessage()