All Projects → DjamshidDjurayev → AutoFormatInputWatcher

DjamshidDjurayev / AutoFormatInputWatcher

Licence: Apache-2.0 license
This repository contains input watcher for auto formatting digits in edit text

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to AutoFormatInputWatcher

unicode-formatter
Convert portions of text to fancy text using unicode fonts for use on Twitter and other sites that don't support rich text
Stars: ✭ 31 (+106.67%)
Mutual labels:  formatter, formatting, format
teks
Easily get custom go template based outputs to your command-line tool. Like in docker/kubernetes
Stars: ✭ 41 (+173.33%)
Mutual labels:  formatter, formatting, format
MTextField
A new Material Design text field that comes in a box, based on [Google Material Design guidelines]
Stars: ✭ 32 (+113.33%)
Mutual labels:  edittext, edittextview
laravel-formatters
«‎Formatter» pattern for Laravel
Stars: ✭ 86 (+473.33%)
Mutual labels:  formatter, formatting
googlejavaformat-action
GitHub Action that formats Java files following Google Style guidelines
Stars: ✭ 66 (+340%)
Mutual labels:  formatter, format
lit-date
Light-weight, faster datetime formatter for modern browsers.
Stars: ✭ 33 (+120%)
Mutual labels:  formatter, format
awesome-python-code-formatters
A curated list of awesome Python code formatters
Stars: ✭ 168 (+1020%)
Mutual labels:  formatter, formatting
Golite
Add essential language support for the Go language to Sublime Text 3.
Stars: ✭ 14 (-6.67%)
Mutual labels:  formatter, formatting
Juliaformatter.jl
An opinionated code formatter for Julia. Plot twist - the opinion is your own.
Stars: ✭ 217 (+1346.67%)
Mutual labels:  formatter, formatting
vue-translated
Internationalization (i18n) and localization (l10n) library for Vue.js v2.
Stars: ✭ 19 (+26.67%)
Mutual labels:  formatter, format
format-date
📆 A small library (around 400 B when gziped & minified) to format JavaScript `Date` object using same tokens as moment.
Stars: ✭ 25 (+66.67%)
Mutual labels:  formatter, format
passport
A Kotlin-based Android view validation library with a simple DSL.
Stars: ✭ 31 (+106.67%)
Mutual labels:  text, edittext
idea-uroborosql-formatter
Beautiful SQL Formatter for IntelliJ Platform
Stars: ✭ 18 (+20%)
Mutual labels:  formatter, formatting
Sublime-uroboroSQL-formatter
Beautiful SQL Formatter for Sublime Text 3
Stars: ✭ 25 (+66.67%)
Mutual labels:  formatter, formatting
winston-dev-console
Winston@3 console format aimed to improve development UX
Stars: ✭ 88 (+486.67%)
Mutual labels:  formatter, format
Nginx Config Formatter
nginx config file formatter/beautifier written in Python.
Stars: ✭ 222 (+1380%)
Mutual labels:  formatter, formatting
react-native-styled-text
Styled Text for React Native
Stars: ✭ 57 (+280%)
Mutual labels:  text, format
Editorconfig Netbeans
A NetBeans IDE plugin supporting the EditorConfig standard. ⛺
Stars: ✭ 123 (+720%)
Mutual labels:  formatter, formatting
Uncrustify
Code beautifier
Stars: ✭ 2,442 (+16180%)
Mutual labels:  formatter, format
table
Produces a string that represents slice data in a text table, inspired by gajus/table.
Stars: ✭ 130 (+766.67%)
Mutual labels:  text, format

AutoFormatInputWatcher

This repository contains an exampe project with input watcher for auto formatting digits in edit text.

It's fast and simpe in use, supports fast delete and insert. Enjoy using it.

Demo with comma:

alt text

Demo with space:

alt text

How to use it:

    EditText input = findViewById(R.id.input);

    NumberAutoFormatWatcher numberAutoFormatWatcher = new NumberAutoFormatWatcher();
    numberAutoFormatWatcher.setFilter(filter);
    numberAutoFormatWatcher.setDecimalFractions(2); // set decimal fractions
    numberAutoFormatWatcher.setIntegerFractions(9); // set integer fractions

    input.setFilters(new InputFilter[] { filter });
    input.addTextChangedListener(numberAutoFormatWatcher);
    
    InputFilter filter = new InputFilter() {
    @Override
    public CharSequence filter(CharSequence source, int i, int i1, Spanned spanned, int i2,
        int i3) {

      String fullString = input.getText().toString() + source.toString();

      int dotAmount = InputUtils.getSignCount(fullString, '.');

      // preventing multiple dots

      if (dotAmount > 1) {
        return "";
      }

      return source;
    }
  };
  <EditText
      android:id="@+id/input"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:inputType="numberDecimal"
      android:singleLine="true"
      />

What's new:

-prevent symbols entering (while paste)
-fixed crash (while paste symbols)
-set limit for integer fractions
-set limit for decimal fractions
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].