Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

decoro

> 数据库
Open source

Android library designed for automatic formatting of text input by custom rules

390 stars0 likes1 views
WebsiteGitHub

About

Android library designed for automatic formatting of text input by custom rules

Maven Central

Decoro

Android library designed for automatic formatting of text input by custom rules.

Installation

Add to the build.gradle of your app module:

groovy
dependencies {
    compile 'ru.tinkoff.decoro:decoro:$latestVersion'
}

Usage

String formatting

In examples below the content of the String text will be formatted according to a mask.

Example 1. Using predefined mask
java
Mask mask = new MaskImpl(PredefinedSlots.RUS_PHONE_NUMBER, true);
mask.insertFront("9995554433");
System.out.println(mask.toString()); // +7 (999) 555-44-33
Using custom mask

Example 2:

java
Slot[] slots = new UnderscoreDigitSlotsParser().parseSlots("___ ___");
Mask mask = MaskImpl.createTerminated(slots); // 'terminated' mask
mask.insertFront("9995554433");
System.out.println(mask.toString()); // 999 555

Example 3:

java
Slot[] slots = new UnderscoreDigitSlotsParser().parseSlots("___ ___");
Mask mask = MaskImpl.createNonTeminated(slots); // 'non-terminated' mask
mask.insertFront("9995554433");
System.out.println(mask.toString()); // 999 5554433

Formatting "on the fly"

In examples below all the user's text input to EditText will be formatted according to a mask.

Example 4. Using predefined mask
java
MaskImpl mask = MaskImpl.createTerminated(PredefinedSlots.CARD_NUMBER_USUAL);
FormatWatcher watcher = new MaskFormatWatcher(mask);
watcher.installOn(editText); // install on any TextView

sample static

Masks available out of the box:
…
Example 5. Using custom mask
java
Slot[] slots = new UnderscoreDigitSlotsParser().parseSlots("___ ___ ___");
FormatWatcher formatWatcher = new MaskFormatWatcher(MaskImpl.createTerminated(slots));
formatWatcher.installOn(editText); // install on any TextView

sample static

Migration

In version 1.1.0 class FormatWatcherImpl was renamed to DescriptorFormatWatcher. Also this version introduced MaskFormatWatcher that offers more clean API than DescriptorFormatWatcher.

References

More examples and details can be found in our wiki (in Russian yet).

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaandroidformattingtext

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库