From a484d50b0a7cbe0e783384efa6e909faab00a889 Mon Sep 17 00:00:00 2001 From: vicmikhailau Date: Thu, 29 Oct 2020 11:30:29 +0300 Subject: [PATCH] [*] v3.1.0. Updated Gradle and libraries. --- MaskedEditText/build.gradle | 12 ++-- README.md | 75 +++++++----------------- app/build.gradle | 25 ++++++-- build.gradle | 4 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 5 files changed, 52 insertions(+), 68 deletions(-) diff --git a/MaskedEditText/build.gradle b/MaskedEditText/build.gradle index 79a6ec6..67b6397 100644 --- a/MaskedEditText/build.gradle +++ b/MaskedEditText/build.gradle @@ -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 { @@ -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 { diff --git a/README.md b/README.md index fb645e4..b2e7bc4 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ It allows you to add a mask to EditText # Version -3.0.4 +3.1.0 # Installation @@ -15,7 +15,7 @@ To use this library in your android project, just simply add the following depen ```sh dependencies { - implementation 'com.vicmikhailau:MaskedEditText:3.0.4' + implementation 'com.vicmikhailau:MaskedEditText:3.1.0' } ``` @@ -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 @@ -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). @@ -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
diff --git a/app/build.gradle b/app/build.gradle index ba93d0b..cd6cbd0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,14 +3,15 @@ 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 { @@ -18,16 +19,30 @@ android { 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" diff --git a/build.gradle b/build.gradle index edebbca..a2212a5 100644 --- a/build.gradle +++ b/build.gradle @@ -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" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 14b9005..792d26a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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