All Projects → santalu → Maskara

santalu / Maskara

Licence: apache-2.0
A simple way to format text fields without getting affected by input filters

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Maskara

EasyMoney-Widgets
The widgets (EditText and TextView) for support of money requirements like currency, number formatting, comma formatting etc.
Stars: ✭ 91 (-82.33%)
Mutual labels:  widget, edittext
Brazilian Utils
Utils library for specific Brazilian businesses
Stars: ✭ 1,023 (+98.64%)
Mutual labels:  formatter, mask
Masked Edittext
Android library contain custom realisation of EditText component for masking and formatting input text
Stars: ✭ 592 (+14.95%)
Mutual labels:  widget, mask
Bankcardformat
💳 自动格式化银行卡号的EditText,卡号格式化、归属银行及卡别判断
Stars: ✭ 273 (-46.99%)
Mutual labels:  formatter, edittext
yii2-number
A number format mask control and input for Yii2 Framework
Stars: ✭ 22 (-95.73%)
Mutual labels:  widget, mask
AutoFormatInputWatcher
This repository contains input watcher for auto formatting digits in edit text
Stars: ✭ 15 (-97.09%)
Mutual labels:  formatter, edittext
Nativescript Masked Text Field
#️⃣ A NativeScript Masked Text Field widget
Stars: ✭ 24 (-95.34%)
Mutual labels:  widget, mask
BlockEditText
Block EditText is a library provide an input view present in multiple block style that common use in TAC or credit card field.
Stars: ✭ 113 (-78.06%)
Mutual labels:  widget, edittext
currency edittext
Simple currency formatter for Android EditText
Stars: ✭ 64 (-87.57%)
Mutual labels:  formatter, edittext
Edittext Mask
The custom masks for EditText. The solution for input phone numbers, SSN, and so on for Android
Stars: ✭ 413 (-19.81%)
Mutual labels:  edittext, mask
Unibeautify
One Beautifier to rule them all, One Beautifier to clean them, One Beautifier to bring them all and in the darkness sheen them
Stars: ✭ 466 (-9.51%)
Mutual labels:  formatter
Gaussianblur
An easy and fast library to apply gaussian blur filter on any images. 🎩
Stars: ✭ 473 (-8.16%)
Mutual labels:  filters
Globalize
A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data
Stars: ✭ 4,612 (+795.53%)
Mutual labels:  formatter
React Event Timeline
A responsive event timeline in React.js
Stars: ✭ 504 (-2.14%)
Mutual labels:  widget
Dividerdrawable
Help to layout and draw dividers on android views.
Stars: ✭ 464 (-9.9%)
Mutual labels:  widget
Chip Navigation Bar
An android navigation bar widget
Stars: ✭ 491 (-4.66%)
Mutual labels:  widget
Flutter easyloading
✨A clean and lightweight loading/toast widget for Flutter, easy to use without context, support iOS、Android and Web
Stars: ✭ 455 (-11.65%)
Mutual labels:  widget
Prettier Eslint Cli
CLI for prettier-eslint
Stars: ✭ 451 (-12.43%)
Mutual labels:  formatter
Androidedit
Android EditText的撤销和恢复(反撤销)
Stars: ✭ 449 (-12.82%)
Mutual labels:  edittext
Typescript Formatter
Formatter of TypeScript code
Stars: ✭ 510 (-0.97%)
Mutual labels:  formatter

Maskara

Build Status API

A simple way to format text fields without getting affected by input filters.

Normal Completable Persistent
maskara maskara maskara

How It Works

Mask

Used to define how to format the text.

  • value is used to define the format string. E.g. +90 (___) ___ __ __

There's no limitation here. You can use any type of characters with any type of input filters.

  • maskCharacter is used to define which characters in the format string user can edit. E.g. _

It's not mandatory to define this explicitly. Mask will set the character with most occurences in the format string as maskCharacter by default.

You should use non alphanumeric characters here.

MaskStyle

Used to define mask visibility and cursor behaviour.

  • Normal Mask is never visible. Cursor is not limited.

  • Completable Mask becomes visible right after the user started typing until the user deleted everything. Cursor is not limited.

  • Persistent Mask becomes visible right after the user started typing and never becomes hidden. Cursor is limited between mask characters.

MaskResult

You can retrieve these from both the widget and the listener.

  • masked Masked version of input text.

  • unMasked Raw version of input text.

  • isDone Validity of input text.

Usage

With Widget

<com.santalu.maskara.widget.MaskEditText
    android:id="@+id/input"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:inputType="number"
    app:mask="+90 (___) ___ __ __"
    app:maskCharacter="_"
    app:maskStyle="completable" />

To get the result:

val masked = input.masked
val raw = input.unMasked
val isDone = input.isDone

Without Widget

val mask = Mask(
    value = "+90 (___) ___ __ __",
    character = '_',
    style = MaskStyle.COMPLETABLE
)
val listener = MaskChangedListener(mask)
textField.addTextChangedListener(listener)

To get the result:

val masked = listener.masked
val raw = listener.unMasked
val isDone = listener.isDone

Dependencies

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
    implementation 'com.github.santalu:maskara:1.0.0'
}

License

Copyright 2020 Fatih Santalu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].