Git Product home page Git Product logo

animatededittext's Introduction

Build Status Download 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

dependencies {
    compile 'com.alimuzaffar.lib:animated-edit-text:1.0'
}

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.

animatededittext's People

Contributors

alphamu avatar

Watchers

James Cloos avatar David 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.