Pudding
代替Toast/SnackBar新方式,使用WindowManager 无需申请权限
WIKI
Usage
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
复制代码
implementation 'com.github.o0o0oo00.Pudding:pudding:v1.1.2'
复制代码
GIF可能要等会就顺畅了,一开始可能会比较迟钝 (●゚ω゚●)
常见的可配置的几种形式
Common configurable Pudding
Pudding.create(this) {
setTitle("This is Title")
setText("this is text")
}.show()
复制代码
Pudding.create(this) {
setChocoBackgroundColor(resources.getColor(R.color.colorAccent))
setTitleTypeface(Typeface.DEFAULT_BOLD)
}.show()
复制代码
Pudding.create(this) {
setTitle("Choco Title")
setText("this is text")
setIcon(R.drawable.ic_event_available_black_24dp)
}.show()
复制代码
Pudding.create(this) {
setTitle("Choco Title")
setText("This is Text , it's very short and I don't like short \n This is Text , it's very short and I don't like short")
onShow {
Toast.makeText(this@MainActivity, "onShowListener", Toast.LENGTH_SHORT).show()
}
onDismiss {
Toast.makeText(this@MainActivity, "onDismissListener", Toast.LENGTH_SHORT).show()
}
}.show()
复制代码
配合FancyDialog可实现Pudding显示在Dialog的阴影之上
With FancyDialog, Pudding can be displayed above the shadow of Dialog.
每个Activity拥有各自的Pudding,互相之间不影响
Each Activity has its own Pudding, which does not affect each other.
*Imitate Alerter and ☆⌒(^-゜)v THX!! a lot
what's different
Use activity decorView we can show a view on top of Activity。but when dialog is showing , its black background will cover the view , that is not cool. so i create this repository to solve this problem , and I hope it's useful to you
Something new
- Use DSL style to config
Choco
- Show Queue
- Cover Dialog/PopWindow
- Don't need to request permission