All Projects → minube → Text-Length-Bar

minube / Text-Length-Bar

Licence: MIT License
No description or website provided.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Text-Length-Bar

SheenValidator
Android library to make form validation easier
Stars: ✭ 29 (-6.45%)
Mutual labels:  edittext
AutoFormatInputWatcher
This repository contains input watcher for auto formatting digits in edit text
Stars: ✭ 15 (-51.61%)
Mutual labels:  edittext
LG LinesEditView
Android 多行文本输入框 字数统计 限制字数
Stars: ✭ 31 (+0%)
Mutual labels:  edittext
searchview
🔍 A beautiful searchview with animations.
Stars: ✭ 12 (-61.29%)
Mutual labels:  edittext
KodeEditor
A simple code editor with syntax highlighting and pinch to zoom
Stars: ✭ 60 (+93.55%)
Mutual labels:  edittext
android-prefix-suffix-edit-text
EditText with support for non editable prefix and suffix.
Stars: ✭ 36 (+16.13%)
Mutual labels:  edittext
Hyena
鬣狗快速开发库(2018年6月停止维护)
Stars: ✭ 21 (-32.26%)
Mutual labels:  edittext
RotatableAutofitEditText
Extended EditText which allows to move, rotate and resize text at the same time
Stars: ✭ 51 (+64.52%)
Mutual labels:  edittext
EasyMoney-Widgets
The widgets (EditText and TextView) for support of money requirements like currency, number formatting, comma formatting etc.
Stars: ✭ 91 (+193.55%)
Mutual labels:  edittext
TagEditText
A simple Android Tag EditText
Stars: ✭ 14 (-54.84%)
Mutual labels:  edittext
clearable-edittext
Simple custom view for clearable EditText.
Stars: ✭ 58 (+87.1%)
Mutual labels:  edittext
currency-edittext
A Custom EditText implementation that allows formatting of currency-based numeric inputs.
Stars: ✭ 86 (+177.42%)
Mutual labels:  edittext
fastedit
安卓端高性能输入框。
Stars: ✭ 38 (+22.58%)
Mutual labels:  edittext
passport
A Kotlin-based Android view validation library with a simple DSL.
Stars: ✭ 31 (+0%)
Mutual labels:  edittext
textmatcher
A simple text watcher that matches specific targets like mention or hashtag in a string by defining rules
Stars: ✭ 67 (+116.13%)
Mutual labels:  edittext
TextViewPlus
an android library for setting custom font in xml layout
Stars: ✭ 27 (-12.9%)
Mutual labels:  edittext
BlockEditText
Block EditText is a library provide an input view present in multiple block style that common use in TAC or credit card field.
Stars: ✭ 113 (+264.52%)
Mutual labels:  edittext
CustomEditText
Simple Custom EditText for Android like Instagram
Stars: ✭ 23 (-25.81%)
Mutual labels:  edittext
CustomFontView
Custom View classes for TextView, EditText & Buttons - to set custom fonts
Stars: ✭ 26 (-16.13%)
Mutual labels:  edittext
VerifyBlocksView
Android view for providing blocks (Edit Texts) to achieve verification process.
Stars: ✭ 28 (-9.68%)
Mutual labels:  edittext

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).

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="minube.com.textlengthbar.MainActivity">

  <EditText
      android:id="@+id/edit_text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      />

  <minube.com.library.TextLengthBar
      android:id="@+id/text_length_bar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      app:barBackgroundColor="@android:color/holo_red_dark"
      app:barIcon="@drawable/ic_min_chars"
      app:barMinChars="50"
      app:barMessage="@string/default_message_content"
      app:barMessageTextColor="@android:color/white"
      app:textFontPath="fonts/Raleway-Medium.ttf"
      app:barMessageTextSize="14dp"/>

</RelativeLayout>

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<TextLengthBarState> buildStates() {

        List<TextLengthBarState> 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

<dependency>
    <groupId>com.github.minube</groupId>
    <artifactId>Text-Length-Bar</artifactId>
    <version>beta-1.0</version>
</dependency>

Coming soon

ProgressTextLengthBar

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].