Edittext-Library

Introduction: EditText library for empty, masking, pattern and range checking📱📋
More: Author   ReportBugs   
Tags:

Build Status License: MIT

Edittext library by which you can easily achieve a lot of functionalities by directly implementing some lines of code in XML and on the Java side. The following are the functions that EditTextPicker provides:

  • Empty checking
  • Masking Edittext
  • Pattern checking
  • Range checking

Description:

Please see the description of this library in my article Edittext Picker Library

Result

pic-1   pic-2   pic-3

Implementation

In project.gradle add this code it in root build.gradle at the end of repositories:

dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            mavenCentral()
            maven { url 'https://jitpack.io' }
        }
    }

Now, add the dependency in app.gradle:

dependencies {
    implementation 'com.github.AliAzaz:Edittext-Library:X.X.X'
}

Quick Usage

XML

Note: By default required is true. But if you don't want to validate specific edittext then simply set it to false: app:required="false"

-- Required Edittext

<com.edittextpicker.aliazaz.EditTextPicker
     android:id="@+id/txtBoxReq"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     app:required="true" />

-- Range (5-10) with a default value of 999

<com.edittextpicker.aliazaz.EditTextPicker
     android:id="@+id/txtBoxRange"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:inputType="number"
     app:defaultValue="999"
     app:maxValue="10"
     app:minValue="5"
     app:required="true"
     app:type="range" />

-- Masking

<com.edittextpicker.aliazaz.EditTextPicker
     android:id="@+id/txtMask"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:inputType="number"
     app:mask="##-##-####"
     app:required="false" />

-- Pattern with default value checking [Following pattern is: (2-4)Characters with (3-5)Digits ]

<com.edittextpicker.aliazaz.EditTextPicker
     android:id="@+id/txtBoxDefault"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     app:defaultValue="null"
     app:pattern="[^0-9]{2,4}[0-9]{3,5}"
     app:required="true"
     app:type="equal" />

Java/Kotlin

Implement this code in submit button click

--- For Required component

if (!txtBoxReq.isEmptyTextBox()) return;

-- For validating range component

if (!txtBoxRange.isRangeTextValidate()) return;

-- For validating pattern component

if (!txtBoxDefault.isTextEqualToPattern()) return;

Support Builder Pattern

This library also support chain request

txtPicker = EditTextPicker(this,
         EditTextPickerBuilder().apply {
                setRequired(true)
                setRangeValues(0.5f, 40.0f)
                setMask("##.##")
                setPattern("^(\\d{2,2}\\.\\d{2,2})$")
          }.build())
          .apply {
                hint = "##.##"
                inputType = InputType.TYPE_CLASS_NUMBER
          }

Set values at Run time

Users can easily set the attribute values at runtime.

txtDate.setMask("##-##-####").setRequired(false)


EditText-Picker Gradle Configuration

  edittextpicker = 2.1.1
  gradle = 7.4.2
  kotlin = 1.8.0
  build_version = 34.0.0
  min_api_level = 21
  max_api_level = 34

CONNECT👍

LinkedIn Badge Twitter Badge Medium Badge Stackoverflow Badge

LICENSE

Distributed under the MIT license. See LICENSE information.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools