Skip to content

henrychuangtw/AutoInsertEditText

Repository files navigation

AutoInsertEditText

Auto insert text into EditText.
AutoAddTextWatcher will insert text into EditText at positions you are setted.
AutoAddTextWatcher will delete text in EditText at positions you are setted, when text length bigger than 1.

Installation

Gradle

compile 'tw.henrychuang.lib:auto-insert-edittext:1.0.1'

Maven

<dependency>
  <groupId>tw.henrychuang.lib</groupId>
  <artifactId>auto-insert-edittext</artifactId>
  <version>1.0.1</version>
  <type>pom</type>
</dependency>

How to Use

Add char at positions

mEditText_creditCard.addTextChangedListener(new AutoAddTextWatcher(mEditText_creditCard,
                "-",
                4, 8, 12));

Add and delete chars at positions

mEditText_multiChars.addTextChangedListener(new AutoAddTextWatcher(mEditText_multiChars,
                "##",
                new int[]{3, 6}));

Add char at positions, and callback listener

mEditText_birthday.addTextChangedListener(new AutoAddTextWatcher(mEditText_birthday,
                "/",
                new TextWatcher() {},
                4, 6));

ScreenShot


License

Apache License Version 2.0 http://apache.org/licenses/LICENSE-2.0.txt

About

Auto insert characters into EditText

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages