Skip to content

Commit

Permalink
[*] v3.1.0. Updated Gradle and libraries.
Browse files Browse the repository at this point in the history
  • Loading branch information
VicMikhailau committed Oct 29, 2020
1 parent 2f7b6c4 commit a484d50
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 68 deletions.
12 changes: 6 additions & 6 deletions MaskedEditText/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ ext {
}

android {
compileSdkVersion 29
compileSdkVersion 30

defaultConfig {
minSdkVersion 14
targetSdkVersion 29
versionCode 8
versionName "3.0.4"
targetSdkVersion 30
versionCode 9
versionName "3.1.0"
}
buildTypes {
release {
Expand All @@ -48,8 +48,8 @@ tasks.withType(Javadoc).all {
}

ext {
androidx_appcompat = "1.1.0"
androidx_core_ktx = "1.2.0"
androidx_appcompat = '1.2.0'
androidx_core_ktx = '1.3.2'
}

dependencies {
Expand Down
75 changes: 22 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ It allows you to add a mask to EditText

# Version

3.0.4
3.1.0

# Installation

To use this library in your android project, just simply add the following dependency into your build.gradle

```sh
dependencies {
implementation 'com.vicmikhailau:MaskedEditText:3.0.4'
implementation 'com.vicmikhailau:MaskedEditText:3.1.0'
}
```

Expand All @@ -31,36 +31,36 @@ Just add in xml custom MaskedEditText with attribute app:mask="your_mask" like b
```
Or add TextChangedListener for your EditText like in following code:

```java
MaskedFormatter formatter = new MaskedFormatter("your_mask");
mEditText.addTextChangedListener(new MaskedWatcher(formatter, mEditText));
```
val formatter = MaskedFormatter("your_mask")
mEditText.addTextChangedListener(MaskedWatcher(formatter, mEditText))
```
Object of MaskedWatcher class has got a weakreference to formatter object, so you must to conside this.

**For create your mask you need to use following keys:**
```
ANYTHING KEY = *;
DIGIT KEY = #;
UPPERCASE KEY = U;
LOWERCASE KEY = L;
ALPHA NUMERIC KEY = A;
CHARACTER KEY = ?;
HEX KEY = H;
ANYTHING KEY = *
DIGIT KEY = #
UPPERCASE KEY = U
LOWERCASE KEY = L
ALPHA NUMERIC KEY = A
CHARACTER KEY = ?
HEX KEY = H
```

For example: you would like create a mask for a mobile number in format **(029)777-77-77**. Just use the simple mask **"(###)###-##-##"**.

**If you want to get text without mask just use following code:**
- For getting unmasked text for **MaskedEditText mEdtMaskedCustom** just use
- For getting unmasked text for **mEdtMaskedCustom: MaskedEditText** just use

```java
String unamskedString = mEdtMaskedCustom.getUnMaskedString();
```
val unamskedString = mEdtMaskedCustom.unMaskedText
```
- For getting unmasked text for default EditText just use
```java
String text = mEditText.getText().toString();
String unmaskedString = formatter.formatString(text).getUnMaskedString();
```
val text = mEditText.text.toString()
val unmaskedString = formatter.formatString(text).unMaskedString
```
# Fixes and updates
Expand All @@ -69,6 +69,10 @@ Unfortunately, there is no way to devote much time to the project. Please feel f
# Change Logs
### v3.1.0
Updated Gradle and libraries.
### v3.0.4
Fixes (Pull Request #26).
Expand All @@ -85,41 +89,6 @@ Changed asserts to safe call (Pull Request #23).
Moved library to androidx and kotlin.
### v2.0.4

Updated support version.

### v2.0.3

Bug with getting сredit сard mask was fixed (issue #13).

### v2.0.2

Bug with getting unmasked string was fixed (issue #11).

### v2.0.1

Bug with mask was fixed.

### v2.0.0

Main logic was updated. Bugs with deleting and changing characters inside masked EditText was fixed

### v1.1.2

Fixed crash for getting unmasked text

### v1.1.1

Superclass for MaskedEditText was changed to AppCompatEditText, which supports compatible features on older version of the platform

### v1.1.0

Ability to get unmasked text (text without mask) was added

### v1.0.0

Initial version
## Licence
Copyright 2016 Vic Mikhailau<br />
Expand Down
25 changes: 20 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,46 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
compileSdkVersion 30

defaultConfig {
applicationId "com.vicmikhailau.maskededittextsample"
minSdkVersion 14
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

kotlinOptions {
jvmTarget = "1.8"
}

compileOptions {
// Flag to enable support for the new language APIs.
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8.
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

ext {
androidx_appcompat = "1.1.0"
androidx_core_ktx = "1.2.0"
desugar_jdk_libs = '1.0.10'
androidx_appcompat = '1.2.0'
androidx_core_ktx = '1.3.2'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.13'
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_jdk_libs"
testImplementation 'junit:junit:4.13.1'
implementation "androidx.appcompat:appcompat:$androidx_appcompat"
implementation project(':MaskedEditText')
implementation "androidx.core:core-ktx:$androidx_core_ktx"
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.70'
ext.kotlin_version = '1.4.10'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Mar 18 18:16:04 MSK 2020
#Thu Oct 29 11:02:48 MSK 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

0 comments on commit a484d50

Please sign in to comment.