zhiqiang-series / Smart Show
Toast & Snackbar & TopBar & Dialog
Stars: ✭ 430
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to Smart Show
Flash
⚡️A highly customizable, powerful and easy-to-use alerting library for Flutter.
Stars: ✭ 174 (-59.53%)
Mutual labels: dialog, toast, snackbar
denbun
Adjust showing frequency of Android app messages, and to be more user friendly 🐦
Stars: ✭ 17 (-96.05%)
Mutual labels: dialog, toast, snackbar
Livesmashbar
An elegant looking and easy to use informative library with LiveData integration for Android.
Stars: ✭ 107 (-75.12%)
Mutual labels: dialog, toast, snackbar
Noty
A simple library for creating animated warnings/dialogs/alerts for Android.
Stars: ✭ 136 (-68.37%)
Mutual labels: dialog, toast, snackbar
Wc Messagebox
基于 Vue 2.0 开发的 Alert, Toast, Confirm 插件, UI仿照 iOS 原生
Stars: ✭ 203 (-52.79%)
Mutual labels: dialog, toast
fusion
An Easy-to-use Kotlin based Customizable Modules Collection with Material Layouts by BlackBeared.
Stars: ✭ 39 (-90.93%)
Mutual labels: dialog, toast
Alerttoast
Create Apple-like alerts & toasts using SwiftUI
Stars: ✭ 151 (-64.88%)
Mutual labels: dialog, toast
mosha-vue-toastify
A light weight and fun Vue 3 toast or notification or snack bar or however you wanna call it library.
Stars: ✭ 185 (-56.98%)
Mutual labels: toast, snackbar
bs5-utils
A JavaScript utility package for Bootstrap 5 components.
Stars: ✭ 26 (-93.95%)
Mutual labels: toast, snackbar
Sweetalert2
A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.
Stars: ✭ 13,929 (+3139.3%)
Mutual labels: dialog, toast
AckBar
AckBar is a very lightweight and customizable android library to display brief message to user.
Stars: ✭ 14 (-96.74%)
Mutual labels: toast, snackbar
Toaster-Library
🎫 Android library, Custom toast and dialog (2018)
Stars: ✭ 14 (-96.74%)
Mutual labels: dialog, toast
Razor.SweetAlert2
A Razor class library for interacting with SweetAlert2
Stars: ✭ 98 (-77.21%)
Mutual labels: dialog, toast
Rxtool
Android开发人员不得不收集的工具类集合 | 支付宝支付 | 微信支付(统一下单) | 微信分享 | Zip4j压缩(支持分卷压缩与加密) | 一键集成UCrop选择圆形头像 | 一键集成二维码和条形码的扫描与生成 | 常用Dialog | WebView的封装可播放视频 | 仿斗鱼滑动验证码 | Toast封装 | 震动 | GPS | Location定位 | 图片缩放 | Exif 图片添加地理位置信息(经纬度) | 蛛网等级 | 颜色选择器 | ArcGis | VTPK | 编译运行一下说不定会找到惊喜
Stars: ✭ 11,567 (+2590%)
Mutual labels: dialog, toast
SmartShow
★★★ 本库为androidx支持库版。
模块导航:
功能总览:
- 优雅封装,简化调用
- 处理系统bug等,如Android 7.1系统关于Toast的BadTokenException
- 解决已知的UI性能缺陷,提高用户体验,如Toast重复弹跳等,关闭通知权限后Toast不显示
- 对不同系统版本及厂商设备进行适配
- 合理的复用策略,节约内存开销的同时及时解除引用以便被垃圾回收器回收
- 根据实际开发中的常见需求,进行功能扩展
效果展示
代码实现
回到模块导航
如果你对实现感兴趣,请参考我的CSDN博客:
- 2.x 版本 https://blog.csdn.net/jungle_pig/article/details/83959662
- 1.x 版本 https://blog.csdn.net/jungle_pig/article/details/78568493
关于作者
回到模块导航
为使SmartShow库更加健壮,如果您在使用过程中发现任何问题,请联系我,我会立即跟进修复和维护。感谢您的支持!
作者:朱志强
微信:w361281607
邮箱:[email protected]
引入SmartShow
第一步,在Project的gradle文件中添加jitpack仓库
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
第二步,在Module的gradle文件中添加依赖
- 第一种方式,引入所有模块
implementation 'com.github.zhiqiang-series.smart-show:all:3.1.3'
//material库,SmartSnackbar模块需要用到
implementation 'com.google.android.material:material:1.3.0-alpha04'
//注解处理库,只在编译期间起作用,不会打包到apk
annotationProcessor 'com.github.zhiqiang-series.smart-show:annotation-compiler:3.1.3'
- 第二种方式,自由引入各个模块
最好保证不同模块的版本号一致,以便其内部依赖的基本库版本相同。
implementation 'com.github.zhiqiang-series.smart-show:toast:3.1.3'
//注解处理库,只在编译期间起作用,不会打包到apk
annotationProcessor 'com.github.zhiqiang-series.smart-show:annotation-compiler:3.1.3'
implementation 'com.github.zhiqiang-series.smart-show:dialog:3.1.3'
//注解处理库,只在编译期间起作用,不会打包到apk
annotationProcessor 'com.github.zhiqiang-series.smart-show:annotation-compiler:3.1.3'
implementation 'com.github.zhiqiang-series.smart-show:topbar:3.1.3'
//注解处理库,只在编译期间起作用,不会打包到apk
annotationProcessor 'com.github.zhiqiang-series.smart-show:annotation-compiler:3.1.3'
implementation 'com.github.zhiqiang-series.smart-show:snackbar:3.1.3'
//添加material依赖库
implementation 'com.google.android.material:material:1.3.0-alpha04'
//注解处理库,只在编译期间起作用,不会打包到apk
annotationProcessor 'com.github.zhiqiang-series.smart-show:annotation-compiler:3.1.3'
SmartShow.init(this);
SmartToast部分
- 使用application context,而不是activity,避免因activity生命周期问题引起的各种问题
- 复用Toast实例,当Toast正在显示时,多次触发内容和位置均未改变的Toast,不会重复弹出;下一个Toast不会等到上一个Toast的Duration耗尽才弹出
- 解决传统复用模式的功能缺陷,如果复用的Toast正在显示,改变其Gravity以改变显示位置会无效,直到消失后再次显示才生效
- 可修改Toast默认布局的风格,如背景颜色,文字大小和颜色等
- 可为Toast设置自定义布局
- 完美解决Android 7.1的系统bug——Toast BadTokenException
- 完美解决应用关闭通知权限后Toast不显示问题
- 适配android 11对toast的相关限制
- 可配置离开当前页面(退出当前activity或进入新的activity),立即消失正在显示的Toast
- 结合主流app消息提示的效果,提供info、success、error、warning、complete、forbid、wait、fail 8 种类型的Toast
API
普通 Toast
SmartTopbar部分
回到模块导航
默认样式:设置背景色:
- SmartTopbar在功能以及使用上很像一个顶部的Snackbar
- 当Topbar正在显示,多次触发时,若msg和actionTex均未改变,则不会重复弹出,否则有弹出效果
- 可修改布局风格,如背景颜色,文字大小和颜色等
- 可配置离开当前Activity时,立即消失正在显示的Topbar。如,在Activity A 上显示了一个Indefinite Topbar,并且用户没有 点击响应,启动activity B,然后再返回A,原来的Topbar已自动消失
- 可通过手势右滑隐藏Topbar
API
详细文档请参阅wiki:
SmartDialog部分
- 解决因activity、fragment生命周期导致的BadTokenException、NullPointException等问题
- 提供主流APP中使用的message、input、list、loading等对话框
效果图
原理
SmartDialog并不是android.app.Dialog的子类,只是个包装器,它内部持有一个真正的Dialog,用来显示。SmartDialog负责处理当Activity、Fragment
生命周期异常时,取消创建或显示所持Dialog。
API
详细文档请参阅wiki:
-
预定义的SmartDialog实现
-
自定义
SmartSnackbar部分
- 复用Snackbar实例,当Snackbar正在显示,多次触发时,若msg和actionTex均未改变,则不会重复弹出,否则会有弹出效果
- 可修改布局风格,如背景颜色,文字大小和颜色等
- 可配置离开当前Activity时,立即消失正在显示的Snackbar。如,在Activity A 上显示了一个Indefinite Snackbar,并且用户没有点击响应,启动activity B,然后再返回A,原来的Snackbar已自动消失
API
详细文档请参阅wiki:
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].