44

GitHub - MrCodeSniper/PopLayer: 一个通用的Android端弹窗管理框架,内部维护弹窗优先...

 5 years ago
source link: https://github.com/MrCodeSniper/PopLayer
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

PopLayer

一个通用的Android端弹窗管理框架,内部维护弹窗优先级队列 具备弹窗管理扩展功能 整合Dialog,PoupoWindow,悬浮Widget,透明Webview,Toast,SnackBar,无需再为繁琐的业务弹窗逻辑所困扰

弹窗管理

如何添加依赖

只需要两行代码轻松接入

//add this to your repositories
 maven { url 'https://www.jitpack.io' }

//add this to your dependencies
implementation 'com.github.MrCodeSniper:PopLayer:2.0.0'

具体如何使用

1.根据策略创建对应的弹窗view

//Dialog形式
PopLayerView  mLayerView = new PopLayerView(this,R.layout.common_dialog_upgrade_app);
//透明Webview形式
PopLayerView mLayerView = new PopLayerView(this,LayerConfig.redPocketScheme);

2.开始装配弹窗配置

Popi mUpgradePopi1 = new Popi.Builder()
                .setmPopId(4)//弹窗的唯一标识 当id发生改变 视为新的弹窗
                .setmPriority(2)//优先级这里不具体划分对应的范围 值越小优先级越高
                .setmCancelType(TRIGGER_CANCEL)//弹窗消失的类型分为 TRIGGER_CANCEL(触摸消失) COUNTDOWN_CANCEL (延时消失)
                .setMaxShowTimeLength(5)//最长显示时间(S)
                .setMaxShowCount(5)//最大显示次数
                .setmBeginDate(1548858028)//开始时间 2019-01-30 22:20:28
                .setmEndDate(1548944428)//结束时间 2019-01-31 22:20:28
                .setLayerView(mLayerView)//弹窗View
                .build();

3.纳入弹窗管理

//纳入弹窗管理
PopManager.getInstance().pushToQueue(mUpgradePopi);
//开始显示弹窗
PopManager.getInstance().showNextPopi();

效果预览

avatar

未来的计划

逐步统一 其他类型的弹窗 希望能提供给大家一个较为全面的应对业务需求的弹窗管理框架

版本记录

V1方案

版本号 LOG 进度更新 V1.0.0 项目开源,完成弹窗管理与Dialog形式扩展 Dialog策略扩展完成 V1.0.1 修复Dialog策略无法获取dialog实体bug Dialog策略优化 V1.0.2 修复activity摧毁造成的弹窗异常 bug Dialog策略优化 V1.0.3 优化了弹窗的使用更加方便快捷 框架使用优化

V2方案

版本号 LOG 进度更新 V2.0.0 正式加入透明Webview弹窗策略扩展 透明Webview策略扩展完成

作者介绍

Hello 我叫lalala,如果您喜欢这个项目 请给个star 能follow我那真是太好了!!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK