Giter Club home page Giter Club logo

format-watcher's Introduction

FormatWatcher

version

The FormatWatcher library provides a simple and easy-to-use way to apply predefined formatting to user input for Android EditText. The formatter is separator sensitive, meaning if a separator is entered manually, the format will not be applied again.

Installation

To install the library use Gradle:

repositories {
    mavenCentral()
}

dependencies {
    implementation 'io.github.ihermandev:format-watcher:1.0.1'
}

Usage

Simply create a new instance of the FormatWatcher and set it as the TextWatcher interface for the EditText.

val formatter = FormatWatcher("###-##-####", '#')
editText.addTextChangedListener(formatter)

The first argument passed to the FormatWatcher constructor is the format string to be applied to the text, the second argument is the character to be used as a placeholder in the format string.

In order to obtain the formatted or raw input String you can call currentInput and rawInput accordingly via FormatWatcher instance.

formatter.currentInput
formatter.rawInput

Customization

You can customize the behavior of the FormatWatcher class by changing the format string, and the placeholder character to match your specific requirements.

Contribute

If you find any bugs or have any suggestions for improvements, please open an issue or create a pull request on the GitHub repository

Demo

text_watcher_demo_v1_0_1.mp4

License

This library is released under the Apache 2.0 license. See the LICENSE file for more information.

format-watcher's People

Contributors

ihcoople avatar ihermandev avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.