button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Success Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.SUCCESS,
isIconAnimated = true
).show()
}
button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Info Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.INFO,
isIconAnimated = true
).show()
}
button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Warning Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.WARNING,
isIconAnimated = true
).show()
}
button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Error Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.ERROR,
isIconAnimated = true
).show()
}
button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Default Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.DEFAULT,
isIconAnimated = true
).show()
}
button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Default Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.DEFAULT,
isIconAnimated = true,
customIcon = R.drawable.ic_heart,
font = R.font.helveticabold,
customBackground = R.drawable.bg_pink,
textColor = Color.WHITE,
customIconAnimation = R.anim.rotate
).show()
}
β¨ Can I add any icon I want instead of defaults? ππ» Yes!
customIcon = R.drawable.ic_heart
β¨ Can I add any animation to icon instead of defaults? ππ» Yes!
customIconAnimation = R.anim.rotate
β¨ Can I use different font style for text? ππ» Yes!
font = R.font.helveticabold
β¨ Can I change the text color? ππ» Yes!
textColor = Color.WHITE
β¨ Can I change the background? ππ» Yes!
customBackground = R.drawable.bg_pink
β¨ I don't want to use any animation for icon. Is that possible to use without animation? ππ» Yes!
isIconAnimated = false
sampleApp.mp4
πΌ Thanks for Icons
Tick icons created by Alfredo Hernandez - Flaticon
Error icons created by Ilham Fitrotul Hayat - Flaticon
Warning icons created by Creatype - Flaticon
Info icons created by Plastic Donut - Flaticon
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.yagmurerdogan:Toastic:latest-version'
}
Please feel free to contribute!
If this will be your first contributon, you can check this website.
Created by 2022 yagmurerdogan (YaΔmur ErdoΔan)
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.