TextLengthBar is an android library to manage EditText input count state.

Overview

TextLengthBar

TextLengthBar is an android library to manage EditText input count state.

Features

  • Set TextLengthBar attributes on xml
  • Set TextLengthBar attributes programatically
  • Set TextLengthBar single state
  • Add multiples states to TextLengthBar

Usage

Add TextLengthBar to your activity/fragment layout resource file with your empty text entry configuration (by attrs).

">


   

  
    

  
    


   

Attrs

Name Format
barMessageTextColor color
barBackgroundColor color
barMessageTextSize dimension
barMinChars integer
barIcon reference
barMessage string
textFontPath string

Set TextLengthBar attributes programatically

textLengthBar.setBackgroundColor(ContextCompat.getColor(this,android.R.color.black));
textLengthBar.setTextSize(20);
textLengthBar.setText("Message content");
textLengthBar.setTypeface("fonts/Raleway-Medium.ttf");
textLengthBar.setTextColor(ContextCompat.getColor(this,android.R.color.holo_red_dark);

Working with multiple states

  • Configure your own states
  • Add states to TextLengthBar
  • Attach your EdtiText to TextLengthBar

The state entity:

new TextLengthBarState.Builder(CHARS_TO_NEXT_STATE, CURRENT_STATE_MESSAGE)
            .backgroundColor(BACKGROUND_COLOR_RESOURCE)
            .icon(ICON_DRAWABLE_RESOURCE)
            .build()

Sample:

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.edit_text) EditText editText;
    @BindView(R.id.text_length_bar) TextLengthBar textLengthBar;

    @Override protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

        textLengthBar.setStates(buildStates());
        textLengthBar.attachToEditText(editText);
    }

    private List
   
     buildStates() {

        List
    
      states = new ArrayList<>();

        states.add(new TextLengthBarState.Builder(100, "Add %d more characters for a great review.")
            .backgroundColor(R.color.first_state_color)
            .icon(R.drawable.ic_first_step)
            .build());

        states.add(new TextLengthBarState.Builder(150, "Help others by adding %d more characters.")
            .backgroundColor(R.color.second_state_color)
            .icon(R.drawable.ic_second_state)
            .build());

        states.add(new TextLengthBarState.Builder(200, "You're doing great.")
            .backgroundColor(R.color.third_state_color)
            .icon(R.drawable.ic_third_state)
            .build());

        return states;
    }
}

    
   

Note: If you want to draw pendings chars to change to the next state you need to place "%d" on your state message

Working with single state

Simply set your own state and atach TextLengthBar to EditText

textLengthBar.setState(new TextLengthBarState.Builder(100, "Great experience")
            .backgroundColor(R.color.first_state_color)
            .icon(R.drawable.ic_first_step)
            .build());

textLengthBar.attachToEditText(editText);

Notes

If you want to push up TextLengthBar with the keyboard don't forget to add the following line into your AndroidManifest file within your Activity declaration:

android:windowSoftInputMode="stateVisible|adjustResize"

Furthermore you need to add the following line to TextLengthBar xml declaration:

android:layout_alignParentBottom="true"

Gradle

dependencies {
  compile 'com.github.minube:Text-Length-Bar:beta-1.0'
}

Maven


   
    
    
     com.github.minube
    
    
    
     Text-Length-Bar
    
    
    
     beta-1.0
    

   

Coming soon

ProgressTextLengthBar

You might also like...
AutosizeEditText for Android is an extension of native EditText that offer a smooth auto scale text size.
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

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

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

Simple way to create linked text, such as @username or #hashtag, in Android TextView and EditText
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

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

An Android App example of how to create a custom EditText using DoubleLinkedList Data Structure
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

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

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

An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.
An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.

⚠️ Archived: this repository is no longer going to be maintained. SectionedRecyclerViewAdapter An Adapter that allows a RecyclerView to be split into

Owner
minube
minube
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
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
Androids EditText that animates the typed text. EditText is extended to create AnimatedEditText and a PinEntryEditText.

AnimatedEditText for Android This repository contains AnimatedEditText and TextDrawable all of which extend the behaviour of EditText and implement fe

Ali Muzaffar 439 Nov 29, 2022
A TextView that automatically fit its font and line count based on its available size and content

AutoFitTextView A TextView that automatically fit its font and line count based on its available size and content This code is heavily based on this S

null 899 Jan 2, 2023
User input masking library repo.

More GIFs [~3 MB] Migration Guide: v.6 This update brings breaking changes. Namely, the autocomplete flag is now a part of the CaretGravity enum, thus

red_mad_robot 1.2k Dec 20, 2022
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

Hieu Rocker 3.6k Jan 5, 2023
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
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

Jan Heinrich Reimer 200 Nov 14, 2022
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

Jan Heinrich Reimer 200 Nov 14, 2022
A material style input for codes

Material Code input A material style input for put codes Based on Code input field concept by SAMUEL KANTALA How to use Minimal SDK Version 11 Usage w

Adrián Lomas 962 Nov 26, 2022