A material design Toast Library for Android
CuteToast is an Android Custom Toast
library that could be used instead of Default Toast
. It does everything as Toast but with some extra spice.
CuteToast allows developers to use Toast with Colorful design and Icons. It's open-source and free to use. Give it a try.!
- CuteToast without pre-built icon version added. Check the dependencies.
More changes in Release
Tab.
Click to View High Quality
Add this in your root build.gradle
file (not your module build.gradle
file):
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Add this to your module's build.gradle
file (make sure the version matches the JitPack badge above):
dependencies {
...
implementation 'com.github.ahmmedrejowan.CuteToast:CuteToast:1.2'
}
If you want to use only Custom Background Options (no Pre-build Icons), then:
dependencies {
...
implementation 'com.github.ahmmedrejowan.CuteToast:CuteToast-Custom:1.2'
}
Each of the following method returns a Toast
. Don't Forget to Call .show()
To display an Info Toast:
CuteToast.ct(this, "This is a Info Toast", CuteToast.LENGTH_SHORT, CuteToast.INFO, true).show();
To display a Warning Toast:
CuteToast.ct(this, "This is a Warning Toast", CuteToast.LENGTH_SHORT, CuteToast.WARN, true).show();
To display an Error Toast:
CuteToast.ct(this, "This is a Error Toast", CuteToast.LENGTH_SHORT, CuteToast.ERROR, true).show();
To display a Success Toast:
CuteToast.ct(this, "This is a Success Toast", CuteToast.LENGTH_SHORT, CuteToast.SUCCESS, true).show();
To display a Happy Toast:
CuteToast.ct(this, "This is a Happy Toast", CuteToast.LENGTH_SHORT, CuteToast.HAPPY, true).show();
To display a Sad Toast:
CuteToast.ct(this, "This is a Sad Toast", CuteToast.LENGTH_SHORT, CuteToast.SAD, true).show();
To display a Confuse Toast:
CuteToast.ct(this, "This is a Confuse Toast", CuteToast.LENGTH_SHORT, CuteToast.CONFUSE, true).show();
To display a Delete Toast:
CuteToast.ct(this, "This is a Delete Toast", CuteToast.LENGTH_SHORT, CuteToast.DELETE, true).show();
To display a Save Toast:
CuteToast.ct(this, "This is a Save Toast", CuteToast.LENGTH_SHORT, CuteToast.SAVE, true).show();
To display a Normal Toast:
CuteToast.ct(this, "This is a Normal Toast", CuteToast.LENGTH_SHORT, CuteToast.NORMAL, true).show();
CuteToast.ct(this, "This is a Info Toast", CuteToast.LENGTH_SHORT, CuteToast.INFO, false).show();
CuteToast.ct(this, "This is a Error Toast", CuteToast.LENGTH_SHORT, CuteToast.ERROR, false).show();
and same for the other types too.
CuteToast.ct(this, "This is a Info Toast", CuteToast.LENGTH_SHORT, CuteToast.INFO).show();
CuteToast.ct(this, "This is a Error Toast", CuteToast.LENGTH_SHORT, CuteToast.ERROR).show();
CuteToast.ct(this, "This is an Info Toast with Custom Star Icon", CuteToast.LENGTH_SHORT, CuteToast.INFO, R.drawable.ic_star).show();
CuteToast.ct(this, "This is an Error Toast with Custom Danger Icon", CuteToast.LENGTH_SHORT, CuteToast.ERROR, R.drawable.danger_ic).show();
- If
this
shows an error, then replace it withMyActivity.this
where MyActivity is your activity name. - Durations are
CuteToast.LENGTH_SHORT
andCuteToast.LENGTH_LONG
. - Total 10 Background Desings are available:
- INFO
- WARN
- ERROR
- SUCCESS
- HAPPY
- SAD
- CONFUSE
- DELETE
- SAVE
- NORMAL
- Icon Options:
- If
icon
istrue
, then pre-built icons will be shown - If 'icon
is 'false
or 'boolean' is removed, then no icon will be shown - If 'icon' is added by using
R.drawabale.icon_name
, then custom icon will be shown.
- If
- If you use the Custom Dependency (
implementation 'com.github.ahmmedrejowan.CuteToast:CuteToast-Custom:1.1
) then you can't use the pre-built icons.
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 .
Let me know which features you want in the future in Request Feature
tab.
If this project helps you a little bit, then give a to Star ⭐ the Repo.
Created with Love by K M Rejowan Ahmmed (@ahmmedrejowan)
Reach me @
Copyright 2021 K M Rejowan Ahmmed (ahmmedrejowan)
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.