Toastic - The new way for creating custom toast messages
? Success Toastic
button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Success Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.SUCCESS,
isIconAnimated = true
).show()
}
? Info Toastic
button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Info Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.INFO,
isIconAnimated = true
).show()
}
? Warning Toastic
button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Warning Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.WARNING,
isIconAnimated = true
).show()
}
? Error Toastic
button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Error Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.ERROR,
isIconAnimated = true
).show()
}
⚫️ Default Toastic
button.setOnClickListener {
Toastic.toastic(
context = this@MainActivity,
message = "This is Default Toastic!",
duration = Toastic.LENGTH_SHORT,
type = Toastic.DEFAULT,
isIconAnimated = true
).show()
}
??♀️ Can I customize the Toastic more?
? Customized Default Toastic
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()
}
? F.A.Q
✨ 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
??♀️ Sample App
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
? Implementation
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.yagmurerdogan:Toastic:latest-version'
}
? Contribution
Please feel free to contribute!
If this will be your first contributon, you can check this website.
? License
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.