Androids EditText that animates the typed text. EditText is extended to create AnimatedEditText and a PinEntryEditText.

Overview

Build Status Android Arsenal

AnimatedEditText for Android

This repository contains AnimatedEditText and TextDrawable all of which extend the behaviour of EditText and implement features that are otherwise not available.

NOTE: PinEntryEditText has been moved to it's own repo on GitHub.

pop in animation

Features

AnimatedEditText

  • Text animates in as typed (4 animations available).
  • Text animates out when cleared using setText(null) or setText("").
  • Smooth forward movement of cursor (API 16+).
  • Smooth backward movement of cursor when clear is called (API 16+, see known issues).
  • Lets you specify any character to be used as a mask for input.

PinEntryEditText

PinEntryEditText has been moved to it's own repo on GitHub.

Others

  • TextDrawable which allows you to set and use text as a drawable.

Usage

Below is a fast guide to getting started. However, if you need to read about these widgets in details. Read more about AnimatedEditText, PinEntryEditText, TextDrawable.

STEP-1

Gradle

If using Jetpack use version Download

dependencies {
    implementation ('com.alimuzaffar.lib:animated-edit-text:2.0.2') {
        // Exclude is only needed if you already have the library
        // mentioned below as a dependency in your app
        exclude group: 'androidx.appcompat', module: 'appcompat'
    }
}

If not using Jetpack use version 1.x Download

dependencies {
    implementation ('com.alimuzaffar.lib:animated-edit-text:1.2.3') {
        // Exclude is only needed if you already have the library
        // mentioned below as a dependency in your app
        exclude group: 'com.android.support', module: 'appcompat-v7'
    }
}

Note: You don't need to exclude all the support groups. However, it's a good idea to do this as your code is likely to use a different version from the library.

STEP-2

Setup AnimatedTextView and PinEntryView in your layout

<com.alimuzaffar.lib.widgets.AnimatedEditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Animate pop in"
    android:inputType="textNoSuggestions" //recommended when typing text to avoid autocomplete.
    app:animationType="popIn|fromBottom|fromRight|fromMiddle|none" //Optional, default popIn
    app:animateCursor="true|false" //Optional, default true
    app:animateTextClear="true|false" /> //Optional, default true

Use in your code

Use in your code like you would use a regular EditText

EditText regular = (AnimatedEditText) findViewById(R.id.txt_regular);
if (regular != null) {
    String input = regular.getText().toString();
}

Effects :

  1. PopIn (default)
  2. Bottom Up
  3. In from right
  4. In from middle

Demo

Pop-in animation

pop in animation

Bottom Up Animations

bottom up animation

In from right

animate in from right

In from middle

animate in from middle

You can see a YouTube video of all the animations here: YouTube video

Issues :

  • Only works for single line input, the second the line has to wrap, the animation breaks.
  • Animation will work best if android:inputType="textNoSuggestions" is set.
  • Animations are only triggered when adding to the end of the string.
  • Only android:gravity="left|right|center_horizontal" is supported.
  • Smooth back movement of cursor when text is cleared doesn't work too well for android:gravity="center_horizontal"
  • No RTL language support.
  • Animate in from middle doesn't work properly except from android:gravity="left"
  • Not all features of EditText will work
  • Using some Unicode characters as masks causes the cursor to lose position. If this happens, I recommend setting cursor visibility to false or setting textPassword or numberPassword as the input type for the fields which improves the situation but doesn't really solve it in all cases.

License

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.
You might also like...
An extension of Android's TextView, EditText and Button that let's you use the font of your choice

AnyTextView (deprecated) Note: AnyTextView is no longer being maintained. I recommend replacing AnyTextView with the Calligraphy library instead. Frus

A library to show emoji in TextView, EditText (like WhatsApp) for Android
A library to show emoji in TextView, EditText (like WhatsApp) for Android

Discontinued This projected is discontinued. Please consider using other alternative, i.e EmojiCompat. Contact me if you want to continue working on a

A custom EditText with a switchable icon which shows or hides the password
A custom EditText with a switchable icon which shows or hides the password

Deprecated This library is deprecated now as there is an official way to use the password toggle with the TextInputLayout (inside the support library

A module designed to encapsulate the use of an Android EditText field for gathering currency information from a user. Supports all ISO-3166 compliant locales/currencies.
A module designed to encapsulate the use of an Android EditText field for gathering currency information from a user. Supports all ISO-3166 compliant locales/currencies.

CurrencyEditText CurrencyEditText is an extension of Android's EditText view object. It is a module designed to provide ease-of-use when using an Edit

A single EditText instead of a classical form. Library that implements flavienlaurent's singleinputform
A single EditText instead of a classical form. Library that implements flavienlaurent's singleinputform

material-singleinputform A single EditText instead of a classical form. This Library is a library implementation of flavienlaurent's "Single input for

A single EditText instead of a classical form. Library that implements flavienlaurent's singleinputform
A single EditText instead of a classical form. Library that implements flavienlaurent's singleinputform

material-singleinputform A single EditText instead of a classical form. This Library is a library implementation of flavienlaurent's "Single input for

A simple Android Tag EditText
A simple Android Tag EditText

TagEditText A simple Android Tag EditText. Setup The easiest way to add the TagEditText library to your project is by adding it as a dependency to you

Uma máscara personalizável para EditText, que pode ser adicionada como um TextWatcher.

Custom-Mask-for-EditText 🎭 ( Máscara personalizável para EditTexts!) Uma máscara customizável que pode ser adicionada aos seus EditTexts, e adaptada

MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.
MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

Comments
  • AnimatedEditText only animates first character when using custom keyboard.

    AnimatedEditText only animates first character when using custom keyboard.

    HI. I have a problem with your AnimatedEditText. I ran your sample app on my phone having a custom keyboard(Swiftkey keyboard). When i started entering characters, only the first character gets animated.

    I debugged and found that onTextChanged() method returns start value as always zero.

    opened by sjthn 4
  • Fast clearing Multiple EditText Elements crashes

    Fast clearing Multiple EditText Elements crashes

    Having 4 AnimatedEditText elements each containing 1 element/char of a PIN entry. If I remove one, then the next, when the 1st animation is still is in progress, the app crashes. Are these dependent on each other?

    device-2017-12-16-153246

    12-16 15:29:57.217 17646-17646/*****.debug E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                Process: *****, PID: 17646
                                                                                java.lang.StringIndexOutOfBoundsException: String index out of range: -1
                                                                                    at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:954)
                                                                                    at java.lang.StringBuilder.substring(Unknown Source:0)
                                                                                    at android.text.TextUtils.substring(TextUtils.java:286)
                                                                                    at com.alimuzaffar.lib.widgets.AnimatedEditText.getFixedText(AnimatedEditText.java:336)
                                                                                    at com.alimuzaffar.lib.widgets.AnimatedEditText.drawGravityCenterHorizontal(AnimatedEditText.java:270)
                                                                                    at com.alimuzaffar.lib.widgets.AnimatedEditText.onDraw(AnimatedEditText.java:237)
                                                                                    at android.view.View.draw(View.java:19192)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18142)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4220)
                                                                                    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4200)
                                                                                    at android.view.View.updateDisplayListIfDirty(View.java:18101)
                                                                                    at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:669)
                                                                                    at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:675)
                                                                                    at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:783)
                                                                                    at android.view.ViewRootImpl.draw(ViewRootImpl.java:2992)
                                                                                    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2806)
                                                                                    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2359)
                                                                                    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392)
                                                                                    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752)
    12-16 15:29:57.217 17646-17646/at.psa.app.volksbank.debug E/AndroidRuntime:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
                                                                                    at android.view.Choreographer.doCallbacks(Choreographer.java:723)
                                                                                    at android.view.Choreographer.doFrame(Choreographer.java:658)
                                                                                    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
                                                                                    at android.os.Handler.handleCallback(Handler.java:790)
                                                                                    at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                    at android.os.Looper.loop(Looper.java:164)
                                                                                    at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                                    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
    
    opened by patrickfav 1
Releases(release/v0.0.7)
  • release/v0.0.7(Apr 17, 2016)

    • Fixed issue where textColor didn't work.
    • Added support for pinBackgroundDrawable so you don't have to use the default look and can try to create your own.
    Source code(tar.gz)
    Source code(zip)
Owner
Ali Muzaffar
A ray of hope for your darkest code!
Ali Muzaffar
Android form edit text is an extension of EditText that brings data validation facilities to the edittext.

Android Form EditText Android form edit text is an extension of EditText that brings data validation facilities to the edittext. Example App I built a

Andrea 1.5k Dec 14, 2022
Simple way to create linked text, such as @username or #hashtag, in Android TextView and EditText

Simple Linkable Text Simple way to create link text, such as @username or #hashtag, in Android TextView and EditText Installation Gradle Add dependenc

Aditya Pradana Sugiarto 76 Nov 29, 2022
Android library contain custom realisation of EditText component for masking and formatting input text

Masked-Edittext Masked-Edittext android library EditText widget wrapper add masking and formatting input text functionality. Install Maven <dependency

Evgeny Safronov 600 Nov 29, 2022
Add text masking functionality to Android EditText. It will prevent user from inserting not allowed signs, and format input as well.

MaskFormatter MaskFormatter adds mask functionality to your EditText. It will prevent user from inserting not allowed signs, and format input as well.

Azimo Labs 161 Nov 25, 2022
AutosizeEditText for Android is an extension of native EditText that offer a smooth auto scale text size.

AutoscaleEditText AutosizeEditText for Android is an extension of native EditText that offer a smooth auto scale text size. Latest Version How to use

Txus Ballesteros 354 Nov 28, 2022
An Android App example of how to create a custom EditText using DoubleLinkedList Data Structure

DoubleLinkedListEditText Library This is a library to create an EditText based on the Doubly Linked List data structure so that the user can enter cod

Layon Martins 1 Nov 9, 2021
A editable text with a constant text/placeholder for Android.

ParkedTextView A EditText with a constant text in the end. How to use <com.goka.parkedtextview.ParkedTextView xmlns:app="http://schemas.android.co

goka 270 Nov 11, 2022
RTL marquee text view android right to left moving text - persian - farsi - arabic - urdo

RTL marquee text view android right to left moving text - persian - farsi - arabic - urdo

mehran elyasi 4 Feb 14, 2022
An easy approach on how to create your country code picker for the edit text.

Country-Code-Picker Original Article on Dev.to Click below ?? App's Overview In this article, I am going to demonstrate how to create a simple country

Siddharth Singh 5 Mar 10, 2022
Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Provides easy means to validate with dependencies.

android-formidable-validation Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Pr

Linden 147 Nov 20, 2022