All Projects → YukiMatsumura → denbun

YukiMatsumura / denbun

Licence: Apache-2.0 license
Adjust showing frequency of Android app messages, and to be more user friendly 🐦

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to denbun

Noty
A simple library for creating animated warnings/dialogs/alerts for Android.
Stars: ✭ 136 (+700%)
Mutual labels:  dialog, toast, snackbar, notification
Flash
⚡️A highly customizable, powerful and easy-to-use alerting library for Flutter.
Stars: ✭ 174 (+923.53%)
Mutual labels:  dialog, toast, snackbar
Anylayer
Android稳定高效的浮层创建管理框架
Stars: ✭ 745 (+4282.35%)
Mutual labels:  dialog, toast, notification
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 (+988.24%)
Mutual labels:  toast, snackbar, notification
React Toastify
React notification made easy 🚀 !
Stars: ✭ 8,113 (+47623.53%)
Mutual labels:  toast, snackbar, notification
smart-show
Toast # Snackbar # Dialog
Stars: ✭ 500 (+2841.18%)
Mutual labels:  dialog, toast, snackbar
Smart Show
Toast & Snackbar & TopBar & Dialog
Stars: ✭ 430 (+2429.41%)
Mutual labels:  dialog, toast, snackbar
React Cool Portal
😎 🍒 React hook for Portals, which renders modals, dropdowns, tooltips etc. to <body> or else.
Stars: ✭ 458 (+2594.12%)
Mutual labels:  dialog, toast, notification
Livesmashbar
An elegant looking and easy to use informative library with LiveData integration for Android.
Stars: ✭ 107 (+529.41%)
Mutual labels:  dialog, toast, snackbar
Alerttoast
Create Apple-like alerts & toasts using SwiftUI
Stars: ✭ 151 (+788.24%)
Mutual labels:  dialog, toast
Sweetalert2
A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.
Stars: ✭ 13,929 (+81835.29%)
Mutual labels:  dialog, toast
Wc Messagebox
基于 Vue 2.0 开发的 Alert, Toast, Confirm 插件, UI仿照 iOS 原生
Stars: ✭ 203 (+1094.12%)
Mutual labels:  dialog, toast
Rxtool
Android开发人员不得不收集的工具类集合 | 支付宝支付 | 微信支付(统一下单) | 微信分享 | Zip4j压缩(支持分卷压缩与加密) | 一键集成UCrop选择圆形头像 | 一键集成二维码和条形码的扫描与生成 | 常用Dialog | WebView的封装可播放视频 | 仿斗鱼滑动验证码 | Toast封装 | 震动 | GPS | Location定位 | 图片缩放 | Exif 图片添加地理位置信息(经纬度) | 蛛网等级 | 颜色选择器 | ArcGis | VTPK | 编译运行一下说不定会找到惊喜
Stars: ✭ 11,567 (+67941.18%)
Mutual labels:  dialog, toast
Aiforms.dialogs
AiForms.Dialogs for Xamarin.Forms
Stars: ✭ 143 (+741.18%)
Mutual labels:  dialog, toast
Appupdater
A library that checks for your apps' updates on Google Play, GitHub, Amazon, F-Droid or your own server. API 9+ required.
Stars: ✭ 1,793 (+10447.06%)
Mutual labels:  dialog, snackbar
Jh flutter demo
a flutter demo
Stars: ✭ 229 (+1247.06%)
Mutual labels:  dialog, toast
AckBar
AckBar is a very lightweight and customizable android library to display brief message to user.
Stars: ✭ 14 (-17.65%)
Mutual labels:  toast, snackbar
fusion
An Easy-to-use Kotlin based Customizable Modules Collection with Material Layouts by BlackBeared.
Stars: ✭ 39 (+129.41%)
Mutual labels:  dialog, toast
bs5-utils
A JavaScript utility package for Bootstrap 5 components.
Stars: ✭ 26 (+52.94%)
Mutual labels:  toast, snackbar
vue2-dialog
A mobile Vue plugin for VueDialog
Stars: ✭ 21 (+23.53%)
Mutual labels:  dialog, toast

denbun


Many applications are display messages using Dialogs, Toasts, Snackbars, Tutorial, etc.
However, some messages may be overkind and boring.

"Denbun" is a lightweight library. Denbun("電文") in Japanese is called "Message" in English.
This library supports to suppress messages and adjust frequency.

For example...

  • Dialog with "Don't ask again"
  • One shot (or N shots) dialog
  • Showing once per week
  • Dialog for light users

Denbun is save the display time, counts and Frequency.
It helps to calculate the best timing of next display.


Download License codecov CircleCI

Download

Get the latest JARs or grab via Gradle:

compile 'com.yuki312:denbun:<latest version>'

Usage

First, initialize DenbunBox in Application.onCreate.

DenbunBox.init(new DenbunConfig(this));

Next, get a Denbun instance.
The message state is restored to the Denbun instance.

Denbun msg = DenbunBox.get(ID);

Following code will save the message state.

Denbun msg = DenbunBox.get(ID);
msg.shown();

Display frequency can be adjusted with the adjuster.

// This message is displayed only once.
Denbun msg = DenbunBox.get(ID, new CountAdjuster(1));
...
msg.isShowable(); // true
msg.shown();
msg.isShowable(); // false

Or adjuster can be preset to the DenbunBox.

DenbunBox.preset(ID, new CountAdjuster(1));
...
Denbun msg = DenbunBox.get(ID);  // Has CountAdjuster.

Following code is suppress message.

Denbun msg = DenbunBox.get(ID);
msg.suppress(true);

Preset frequency adjusters

There are several adjusters provided in this library.

Adjuster Name Description
CountAdjuster For N shots dialogs
IntervalAdjuster For periodic dialogs
CoolDownAdjuster For periodic and N shots dialogs

Or create custom adjuster.

Denbun msg = DenbunBox.find(ID,
    s -> s.count == 0 ? Frequency.MIN : Frequency.MAX);
if (msg.isShowable())
  msg.shown();  // s.count will increment.

Configuration

DenbunBox is configured with DenbunConfig.

Method Description
preference Set SharedPreference to save message history
daoProvider Set SharedPreference DAO (For your UnitTest)

How it works?

Denbun save the display history to SharedPreference. You can find the default SharedPreference path in DenbunConfig.PREF_NAME.

Denbun can be created using DenbunBox. DenbunBox has Application scope, you can access DenbunBox from anywhere in the application and create Denbun instance. FrequencyAdjuster can be preset to the DenbunBox. Denbun uses FrequencyAdjuster to adjust display frequency.

Testability

You can mock/spy the Denbun data I/O.

DenbunConfig conf = new DenbunConfig(app);

// spy original DaoProvider
Dao.Provider origin = conf.daoProvider();
conf.daoProvider(pref -> (spyDao = spy(origin.create(pref))));
DenbunBox.init(conf);

DenbunBox.find(ID).shown();
verify(spyDao, times(1)).update(any());

License

Copyright 2017 Matsumura Yuki. Licensed under the Apache License, Version 2.0;

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].