Android-Edit-Textview-Library - A Library to manage properties of Edittext and Textview

Overview

EditTextviewLibrary

This Library can be used to create Textview and Edittext efficiently , this library provides you 16 type of font styles, different type of validation on fields, types of text sizes and some default view like text color,text size, font style, type face etc. you can also change that properties by using Library methods.

Only you have to add jitpack in your root build.gradle :

allprojects { 	
	repositories  	
	{ 	
		... 	
		maven { url 'https://jitpack.io' } 	
	} 	
} 	

and add the dependency in app.gradle :

dependencies {  
        compile 'com.github.rohitpuriji:EditTextviewLibrary:-SNAPSHOT'
      }

This library made with java8 so add the jack option inside defaultCondig in your app gradle file :

    minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    jackOptions {
        enabled true
    }

and add compile ad dex options :

  dexOptions {
    incremental true
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

You can create field in layout file like this :

  <com.tech.edittextviewlibrary.TextViewField
      android:layout_width="match_parent"
      android:layout_margin="10dp"
      android:id="@+id/tvUsername"
      android:layout_height="wrap_content"/>


  <com.tech.edittextviewlibrary.EdittextField
      android:layout_width="match_parent"
      android:layout_margin="10dp"
      android:id="@+id/etFirstName"
      android:inputType="textPassword"
      android:layout_height="wrap_content"/>

  <com.tech.edittextviewlibrary.EdittextField
      android:layout_width="match_parent"
      android:layout_margin="10dp"
      android:id="@+id/etEmail"
      android:layout_height="wrap_content"/>


  <com.tech.edittextviewlibrary.EdittextField
      android:layout_width="match_parent"
      android:layout_margin="10dp"
      android:id="@+id/etUsername"
      android:inputType="textPassword"
      android:layout_height="wrap_content"/>

  <com.tech.edittextviewlibrary.EdittextField
      android:layout_width="match_parent"
      android:layout_margin="10dp"
      android:id="@+id/etPassword"
      android:inputType="textPassword"
      android:layout_height="wrap_content"/>

  <Button
      android:layout_width="wrap_content"
      android:text="Check"
      android:padding="10dp"
      android:id="@+id/btnCheck"
      android:layout_gravity="center"
      android:layout_height="wrap_content" />

Then access Fields like this :

      TextViewField tvUsername = (TextViewField) findViewById(R.id.tvUsername);
      final EdittextField etEmail = (EdittextField) findViewById(R.id.etEmail);
      final EdittextField etPassword = (EdittextField) findViewById(R.id.etPassword);
      EdittextField etFirstName = (EdittextField)findViewById(R.id.etFirstName);
      EdittextField etUsername = (EdittextField)findViewById(R.id.etUsername);

you can set text by using setTextString Method.

      tvUsername.setTextString("Registration form");  

you can set text color by using setTextStringcolor Method otherwise default color will be GRAY.

      tvUsername.setTextStringcolor(Color.BLUE);

you can set view background color by using setBgColor Method otherwise default color will be WHITE.

      tvUsername.setBgColor(Color.BLUE);

you can set padding by using setTextPadding Method otherwise default padding will be 20dp.

      etFirstName.setTextPadding(10,10,10,10);

We have basic 8 types of font style with regular and bold format like :

      *
      *    arial,
      *    courier,
      *    georgia,
      *    helvetica,
      *    roboto,
      *    tahoma,
      *    times,
      *    verdana
      *
      * 
      tvUsername.setTextTypeFaceBold(FontTypes.georgia,this);
      etFirstName.setTextTypeFaceNormal(FontTypes.georgia,this);

you can set text font size by using setFontSize Method

      there are many sizes available :
        *
        *      small(12),
        *      mid(15),
        *      large(17),
        *      xlarge(20),
        *      xxlarge(22);
        *
        *
      tvUsername.setFontSize(FontSizeTypes.xxlarge);

you can set some background view or drawable xml by using setBackgroundView Method otherwise a default drawable xml will be use.

      etEmail.setBackgroundView(R.drawable.edittext_bg);

Similarly you can set Edittext hint text,color.

We have basic 4 types of Field Validations like :

      *
      *       EmailType,
      *       PasswordType,
      *       OnlyAlphabetsType,
      *       AlphaNumericTypes,
      *       None
      *
      etEmail.setValidationType(ValidationType.EmailType,"Not a Valid email!");

you can set password length by using setValidationLength Method otherwise default length will be 6.

        etPassword.setValidationLength(PasswordLength.Five);

you can set error message by passing second parameter as a message if empty then default message will show.

          etPassword.setValidationType(ValidationType.PasswordType,"");

And on button click you can

Button btnCheck = (Button)findViewById(R.id.btnCheck);
        btnCheck.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

              //On submit you only need to check getError null if getError==null then field has valid entry.

              if (etEmail.getError() == null && !TextUtils.isEmpty(etEmail.getText().toString()){
                  Toast.makeText(MainActivity.this,"etUsername valid entry",Toast.LENGTH_LONG).show();
              }

              if (etPassword.getError() != null && !TextUtils.isEmpty(etPassword.getText().toString()){
                  Toast.makeText(MainActivity.this,"etPassword invalid entry",Toast.LENGTH_LONG).show();
              }

          }
      });

For more information please check the code.

Developed By

Rohit Puri

License

Copyright Rohit Puri Copyright (C) 2011 The Android Open Source Project

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...
LocalizedEditText - Custom edit text that allow only one language
LocalizedEditText - Custom edit text that allow only one language

LocalizedEditText Custom edit text that allow only one language Supported languages : Arabic , English Default language : English Examples

Android library contain custom realisation of EditText component for masking and formatting input text
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

Add text masking functionality to Android EditText. It will prevent user from inserting not allowed signs, and format input as well.
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.

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

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

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

Owner
rohit puri
rohit puri
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
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
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

Hans Petter Eide 165 Nov 11, 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
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
A simple and flexible Checked TextView or Checkable TextView

CheckableTextView Checkable TextView [KOTLIN] ⚡ A simple and flexible Checked TextView or Checkable TextView written in Kotlin ⚡ What's New Animation

null 110 Nov 20, 2022
Mentions-TextView - Make Mentions and hashtags clickable in Textview

Mentions Textview Custome Textview with Mentions and hashtags being clickable. D

null 2 Jan 9, 2022
Float Label Edit Texts for Android

Floating Label Edit Text for Android For more info, see this blog post. Salient features Simple and clean library (open up the source to see for yours

null 428 Nov 25, 2022
Android Custom View for prevent the view behind on-screen keyboard when edit text is focused

Group Focusable Prevent the view behind on-screen keyboard when edit text is focused in Android UI Download Gradle implementation 'com.akexorcist:grou

Akexorcist 8 Jun 22, 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