LovelyToast
Introduction: 反射获取动画设置,支持 3 种动画,6 种 Toast 类型可选,支持快速点击,home 键监听,优化了内部,使得你的 Toast 变得很生动与简单。支持自定义动画。
Tags:
Toast控件-图像 Toast-LovelyToast
Make u Toast become lovely and alive,
- 6 kinds of types(6 种的 toast 类型)
- 3 kinds of show and out animation(3 种显示与取消的动画) support custom(支持自定义添加更多)
- 2 kinds of animation location(可选 2 种动画位置)
- support fast click ,cancel previous animation automatically(支持快速点击,自定取消上次动画)
- listen homekey to cancel Toast.(内部作了 home 键的监听取消 Toast)
preview
Dependency(引入)
dependencies {
compile 'com.ljs.lovelytoast:LovelyToast:1.0.0'
}
This Demo
Usage (用法)
LovelyToast.makeText(mActivity.this, " SUCCESS!!", LovelyToast.LENGTH_SHORT,
LovelyToast.SUCCESS);
LovelyToast.makeText(mActivity.this, " Hi guys !",LovelyToast.LENGTH_SHORT , LovelyToast.SUCCESS, LovelyToast.SCALE , LovelyToast.RIGHT);
public static void makeText(Context context, String msg, int length, int type, @Nullable int showanim, @Nullable int leftorright)
parms
type :(六种 Toast 类型分别)
- LovelyToast.SUCCESS,
- LovelyToast.WARNING,
- LovelyToast.ERROR,
- LovelyToast.CONFUSING,
- LovelyToast..INFO,
- LovelyToast.DEFAULT。
showanim :(三种 Toast 展示动画)
- LovelyToast.SCALE
- LovelyToast.TOP_DOWN
- LovelyToast.LEFT_RIGHT
- custom style,(可以自定义)
- null=native anim;(不填默认原生动画)
leftorright:(二种动画位置)
- LovelyToast.LEFT
- LovelyToast.RIGHT
- null=LovelyToast.LEFT(不填默认左边动画)
custom style
LovelyToast.makeText(mActivity.this, " hi guys",LovelyToast.LENGTH_SHORT, LovelyToast.SUCCESS, R.style.customanim , LovelyToast.RIGHT)
//引用自定义写的 toast 展示与退出动画,必须是 R.style 下的文件
<style name="customanim">
<item name="android:windowEnterAnimation">@anim/toast_enter</item>
<item name="android:windowExitAnimation">@anim/toast_out</item>
</style>
Thanks
https://github.com/geftimov/android-pathview
Contributors
I want to update this Toast and make it better. So any help will be appreciated. Make and pull - request and we can discuss it.
Licence
This Licence, don't need a Public Licence!i don't care! If u like the LovelyToast, give me a star, don't be such a dick, u just do what u want to do. (不需要 licence,大家想怎么用怎么用,给个 star 即可,thanks!! )