GentleToast
Android library to customize toasts
DEMO
DOWNLOAD
Add this to your root build.gradle
file
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Add this to your app module's build.gradle
file
dependencies {
compile 'com.github.DamanSingh4321:GentleToast:1.0'
}
USAGE
For simple use:
GentleToast.with(this)
.shortToast("Simple!")
.show();
For custom use:
GentleToast.with(this)
.longToast("Custom!")
.setTextColor(R.color.white)
.setBackgroundColor(R.color.colorPrimaryDark
.setBackgroundRadius(16)
.setStrokeColor(R.color.colorAccent)
.setStrokeWidth(4)
.setImage(R.mipmap.ic_launcher)
.show();
For pre-defined views:
GentleToast.with(this)
.longToast("Done!", GentleToast.DONE)
.show();
Available pre-defined views:
- GentleToast.DONE
Method Name | Description | Parameter(s) | Default |
---|---|---|---|
with | Context | Context | |
longToast/shortToast | For long/short toast | String message, int ToastType | |
setTextColor | To change text color | int color | white |
setBackgroundColor | To change background color | int color | black |
setBackgroundRadius | To change corner of background | int radius | 20 |
setStrokeColor | To change stroke color | int color | black |
setStrokeWidth | To change stroke width | int width | 0 |
setImage | To add image | int image | |
show | To show toast |
License
Copyright 2017 Damanpreet Singh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.