diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d56d4e6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,47 +0,0 @@ -language: android -jdk: oraclejdk8 -sudo: false - -android: - components: - - platform-tools - - tools - - build-tools-24.0.2 - - build-tools-25.0.2 - - android-22 - - android-24 - - android-25 - - sys-img-armeabi-v7a-android-22 - - sys-img-armeabi-v7a-android-25 - - extra-android-m2repository - -# # Uncomment the lines below if you want to -# # use the latest revision of Android SDK Tools -# - platform-tools -# - tools -# -# # The BuildTools version used by your project -# - build-tools-25.0.2 -# -# # The SDK version used to compile your project -# - android-25 -# -# # Additional components -# - extra-google-google_play_services -# - extra-google-m2repository -# - extra-android-m2repository -# - addon-google_apis-google-25 -# -# # Specify at least one system image, -# # if you need to run emulator(s) during your tests -# - sys-img-armeabi-v7a-android-22 -# - sys-img-armeabi-v7a-android-16 - -before_script: - # Create and start emulator - - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a - - emulator -avd test -no-skin -no-audio -no-window & - - android-wait-for-emulator - - adb shell input keyevent 82 & - -script: ./gradlew -PbintrayUser=blah -PbintrayApikey=blah connectedAndroidTest diff --git a/MaskedEditText/build.gradle b/MaskedEditText/build.gradle deleted file mode 100644 index e57534e..0000000 --- a/MaskedEditText/build.gradle +++ /dev/null @@ -1,129 +0,0 @@ -plugins { - id "com.jfrog.bintray" version "1.7.3" -} - -apply plugin: 'com.android.library' -apply plugin: 'com.github.dcendents.android-maven' - -String projectVersion = "1.0.5" -String projectGroup = "ru.egslava" - -version = projectVersion -group = projectGroup - -android { - compileSdkVersion 25 - buildToolsVersion '25.0.2' - - - defaultConfig { - minSdkVersion 9 - targetSdkVersion 25 - versionCode 1 - versionName projectVersion - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - } -} - -dependencies { - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { - exclude group: 'com.android.support', module: 'support-annotations' - }) - - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:25.2.0' - - testCompile 'junit:junit:4.12' -} - - -// bintray deploy .... -String projectName = "edittext-mask" -String projectDescription = GFileUtils.readFile(new File("README.md")) -String webUrl = "https://github.com/egslava/edittext-mask" -String gitUrl = "https://github.com/egslava/edittext-mask.git" - - -install { - repositories.mavenInstaller { - pom { - project { - packaging 'aar' - - name projectName - description projectDescription - url webUrl - - inceptionYear '2017' // HARDCODED - - licenses { - license { - name 'MIT' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - - scm { - connection gitUrl - developerConnection gitUrl - url webUrl - } - developers { - developer { - id 'egslava' - name 'Slava Egorenkov' - email 'egslava@gmail.com' - } - } - } - } - } -} - -// The end of the gradle file is for JCenter publication. -// The original code was written with look at Alexander Matveychuk's code -// and -// https://www.virag.si/2015/01/publishing-gradle-android-library-to-jcenter/ - -task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' -} - -task javadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} -artifacts { - archives javadocJar - archives sourcesJar -} - -bintray { - user = bintrayUser - key = bintrayApikey - - configurations = ['archives'] - pkg { - repo = "maven" - name = projectName - userOrg = user -// projectUrl = webUrl - vcsUrl = gitUrl - licenses = ["MIT"] - group = projectGroup - publish = true - - version { - name = projectVersion -// desc = projectDescription - vcsTag = projectVersion - } - } -} \ No newline at end of file diff --git a/MaskedEditText/src/androidTest/AndroidManifest.xml b/MaskedEditText/src/androidTest/AndroidManifest.xml deleted file mode 100755 index bd876b8..0000000 --- a/MaskedEditText/src/androidTest/AndroidManifest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/MainActivityTest.java b/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/MainActivityTest.java deleted file mode 100644 index 75cdcc7..0000000 --- a/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/MainActivityTest.java +++ /dev/null @@ -1,211 +0,0 @@ -package ru.egslava.lib_phone; - - -import android.content.pm.ActivityInfo; -import android.support.test.espresso.action.ViewActions; -import android.support.test.filters.Suppress; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; -import android.test.suitebuilder.annotation.LargeTest; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.security.InvalidParameterException; - -import ru.egslava.lib_phone.actions.HintViewAction; - -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.action.ViewActions.clearText; -import static android.support.test.espresso.action.ViewActions.click; -import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard; -import static android.support.test.espresso.action.ViewActions.typeText; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; -import static android.support.test.espresso.matcher.ViewMatchers.withId; -import static android.support.test.espresso.matcher.ViewMatchers.withText; -import static org.hamcrest.Matchers.allOf; -import static ru.egslava.lib_phone.actions.KeepHintViewAction.dontKeepHints; -import static ru.egslava.lib_phone.actions.KeepHintViewAction.keepHints; - -@LargeTest -@RunWith(AndroidJUnit4.class) -public class MainActivityTest { - - public static final int phone_input = br.com.sapereaude.maskedEditText.test.R.id.vControl; - - @Rule - public ActivityTestRule mActivityTestRule = new ActivityTestRule<>(TestActivity.class); - - @Test - public void textTypingTest() { - onView( - allOf( - withId(phone_input), - isDisplayed()) - ).perform(click()); - - // just in case, check again that it's the same view after the click - onView( - allOf( - withId(phone_input), - isDisplayed()) - ).perform(typeText("9997055671")); - - onView( - allOf( - withId(phone_input), - withText("+7(999)705-56-71"), - isDisplayed()) - ).perform(closeSoftKeyboard()); - - onView( allOf( - withId(phone_input), - isDisplayed()) - ).check(matches(withText("+7(999)705-56-71"))); - } - - @Test - public void saveInstanceStateTest() { - onView( - allOf( - withId(phone_input), - isDisplayed()) - ).perform(click()); - - // just in case, check again that it's the same view after the click - onView( - allOf( - withId(phone_input), - isDisplayed()) - ).perform(typeText("9997055671")); - - onView( - allOf( - withId(phone_input), - withText("+7(999)705-56-71"), - isDisplayed()) - ).perform(closeSoftKeyboard()); - - mActivityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - mActivityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - - onView( allOf( - withId(phone_input), - isDisplayed()) - ).check(matches(withText("+7(999)705-56-71"))); - } - - - /** - * After merging with Alexander Matveychuk, the demo app started to crash - * if there's no any text and you rotate the phone - */ - @Test - public void saveInstanceStateTest2() { - mActivityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - mActivityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - } - - /** - * After setKeepHint(true) a hint should appeared. - * After setKeepHint(false) a hint should disappear. - */ - @Test - public void setKeepHintTest() { - onView(withId(phone_input)) - .perform(new HintViewAction("9997055671")) - .perform(dontKeepHints) // just to be sure - - // the first check. After setKeepHint(true) the hint should appear immediate - .perform(ViewActions.typeText("999")) - .perform(keepHints) - .check(matches(withText("+7(999)705-56-71"))) - - // the second check. After setKeepHint(false) the hint should disappear immediate - .perform(dontKeepHints) - .check(matches(withText("+7(999)"))); - } - - - /** - * If the text is empty changing of keepHint can lead to a crash. - * It's the regression test - */ - @Test - public void setEmptyTextTest() { - - // given - onView(withId(phone_input)) - .perform(new HintViewAction("9997055671")) - - // tests - .perform(dontKeepHints) - .check(matches(withText("+7(999)705-56-71"))) - .perform(keepHints) - .check(matches(withText("+7(999)705-56-71"))) - .perform(dontKeepHints) - - // YES! Because the text is empty, user need to see a hint - .check(matches(withText("+7(999)705-56-71"))); - } - /** - * It should keep state of keepHint after activity recreation :-/ - * It's the regression test - */ - @Test - @Suppress // TODO - public void keepHintAfterRotationTest() throws InterruptedException { - - // ====================================== - // if initial state was keepHint(false) - - // given - onView(withId(phone_input)) - .perform(new HintViewAction("9997055671")) - .perform(keepHints) - .perform(typeText("999")) - .check(matches(withText("+7(999)705-56-71"))) - .perform(dontKeepHints); - - // rotating screen - final TestActivity a1 = mActivityTestRule.getActivity(); - a1.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - - Thread.sleep(2500); - final TestActivity a2 = mActivityTestRule.getActivity(); - a2.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - Thread.sleep(2500); - - - if (a1 != a2) { - throw new InvalidParameterException("a1 != a2"); - } - // tests - onView(withId(phone_input)) - .check(matches(withText("+7(999)"))); - - // ====================================== - // and if initial state was keepHint(true) - - onView(withId(phone_input)) - .perform(clearText()) // after previous test - .perform(new HintViewAction("1234567890")) - .perform(keepHints) - .perform(typeText("999")) - .check(matches(withText("+7(999)456-78-90"))) - ; - - // rotating screen - mActivityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - Thread.sleep(5000); - mActivityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - Thread.sleep(2500); - - - // tests - onView(withId(phone_input)) - .check(matches(withText("+7(999)456-78-90"))); - } -} diff --git a/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/TestActivity.java b/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/TestActivity.java deleted file mode 100644 index 31ef0a0..0000000 --- a/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/TestActivity.java +++ /dev/null @@ -1,16 +0,0 @@ -package ru.egslava.lib_phone; - -import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; - -/** - * Created by egslava on 04/03/2017. - */ - -public class TestActivity extends AppCompatActivity { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(br.com.sapereaude.maskedEditText.test.R.layout.activity_main); - } -} diff --git a/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/actions/HintViewAction.java b/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/actions/HintViewAction.java deleted file mode 100644 index d2d571e..0000000 --- a/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/actions/HintViewAction.java +++ /dev/null @@ -1,34 +0,0 @@ -package ru.egslava.lib_phone.actions; - -import android.support.test.espresso.UiController; -import android.support.test.espresso.ViewAction; -import android.view.View; -import android.widget.TextView; - -import org.hamcrest.Matcher; -import org.hamcrest.Matchers; - -public class HintViewAction implements ViewAction { - - - String hint; - - public HintViewAction(String hint) { - this.hint = hint; - } - - @Override - public Matcher getConstraints() { - return Matchers.instanceOf(TextView.class); - } - - @Override - public String getDescription() { - return "Set hints on view"; - } - - @Override - public void perform(UiController uiController, View view) { - ((TextView)view).setHint(hint); - } -} \ No newline at end of file diff --git a/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/actions/KeepHintViewAction.java b/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/actions/KeepHintViewAction.java deleted file mode 100644 index cf925c9..0000000 --- a/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/actions/KeepHintViewAction.java +++ /dev/null @@ -1,36 +0,0 @@ -package ru.egslava.lib_phone.actions; - -import android.support.test.espresso.UiController; -import android.support.test.espresso.ViewAction; -import android.view.View; - -import org.hamcrest.Matcher; -import org.hamcrest.Matchers; - -import br.com.sapereaude.maskedEditText.MaskedEditText; - -public enum KeepHintViewAction implements ViewAction { - keepHints(true), dontKeepHints(false); - - - boolean keepHint; - - KeepHintViewAction(boolean keepHint) { - this.keepHint = keepHint; - } - - @Override - public Matcher getConstraints() { - return Matchers.instanceOf(MaskedEditText.class); - } - - @Override - public String getDescription() { - return "Set keepHint on/off"; - } - - @Override - public void perform(UiController uiController, View view) { - ((MaskedEditText)view).setKeepHint(keepHint); - } -} \ No newline at end of file diff --git a/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/actions/SetTextViewAction.java b/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/actions/SetTextViewAction.java deleted file mode 100644 index c8869c5..0000000 --- a/MaskedEditText/src/androidTest/java/ru/egslava/lib_phone/actions/SetTextViewAction.java +++ /dev/null @@ -1,38 +0,0 @@ -package ru.egslava.lib_phone.actions; - -import android.support.test.espresso.UiController; -import android.support.test.espresso.ViewAction; -import android.view.View; - -import org.hamcrest.Matcher; - -import br.com.sapereaude.maskedEditText.MaskedEditText; - -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.instanceOf; - -public class SetTextViewAction implements ViewAction { - - private String value; - - public SetTextViewAction(String value) { - this.value = value; - } - - @SuppressWarnings("unchecked") - @Override - public Matcher getConstraints() { - return allOf(instanceOf(MaskedEditText.class)); - } - - @Override - public void perform(UiController uiController, View view) { - MaskedEditText maskedEditText = (MaskedEditText) view; - maskedEditText.setText(maskedEditText.getRawText()); - } - - @Override - public String getDescription() { - return "replace text"; - } -}; \ No newline at end of file diff --git a/MaskedEditText/src/androidTest/res/layout/activity_main.xml b/MaskedEditText/src/androidTest/res/layout/activity_main.xml deleted file mode 100644 index cacc738..0000000 --- a/MaskedEditText/src/androidTest/res/layout/activity_main.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/MaskedEditText/src/androidTest/res/values/styles.xml b/MaskedEditText/src/androidTest/res/values/styles.xml deleted file mode 100644 index 766ab99..0000000 --- a/MaskedEditText/src/androidTest/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/MaskedEditText/src/main/res/values/attrs.xml b/MaskedEditText/src/main/res/values/attrs.xml deleted file mode 100755 index 7378319..0000000 --- a/MaskedEditText/src/main/res/values/attrs.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/app/.gitignore b/app/.gitignore index 796b96d..42afabf 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1 @@ -/build +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 0a82ff0..36c92c4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,30 +1,39 @@ -apply plugin: 'com.android.application' +plugins { + id 'com.android.application' +} android { - compileSdkVersion 25 - buildToolsVersion '25.0.2' + compileSdkVersion 30 + buildToolsVersion '30.0.2' defaultConfig { - applicationId "ru.egslava.edittextphonenumber" - minSdkVersion 9 - targetSdkVersion 25 + applicationId "br.com.sapereaude.edittext_mask" + minSdkVersion 16 + targetSdkVersion 30 versionCode 1 - versionName "1.0.0" - testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + buildTypes { release { minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:25.2.0' - compile project(':MaskedEditText') - androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', { - exclude group: 'com.android.support', module: 'support-annotations' - } -} + implementation project(':maskedEditText') + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.google.android.material:material:1.2.1' + implementation 'androidx.constraintlayout:constraintlayout:2.0.1' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index f28a2a3..481bb43 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,17 +1,21 @@ # Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/egslava/apps/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html -# Add any project specific keep options here: - # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/ru/egslava/edittextphonenumber/ApplicationTest.java b/app/src/androidTest/java/ru/egslava/edittextphonenumber/ApplicationTest.java deleted file mode 100644 index c8f6060..0000000 --- a/app/src/androidTest/java/ru/egslava/edittextphonenumber/ApplicationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package ru.egslava.edittextphonenumber; - -import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * Testing Fundamentals - */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f5e2592..15a7107 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,15 +1,15 @@ + package="com.tezro_official.maskedEditText"> - + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/Theme.Edittextmask"> + @@ -17,4 +17,4 @@ - + \ No newline at end of file diff --git a/app/src/main/java/com/tezro_official/maskedEditText/MainActivity.java b/app/src/main/java/com/tezro_official/maskedEditText/MainActivity.java new file mode 100644 index 0000000..e1df86b --- /dev/null +++ b/app/src/main/java/com/tezro_official/maskedEditText/MainActivity.java @@ -0,0 +1,14 @@ +package com.tezro_official.maskedEditText; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/egslava/edittextphonenumber/MainActivity.java b/app/src/main/java/ru/egslava/edittextphonenumber/MainActivity.java deleted file mode 100644 index 81443b0..0000000 --- a/app/src/main/java/ru/egslava/edittextphonenumber/MainActivity.java +++ /dev/null @@ -1,38 +0,0 @@ -package ru.egslava.edittextphonenumber; - -import android.support.v7.app.ActionBarActivity; -import android.os.Bundle; -import android.text.InputFilter; -import android.text.Spanned; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.widget.EditText; - - -import br.com.sapereaude.maskedEditText.MaskedEditText; - -public class MainActivity extends ActionBarActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - MaskedEditText phone = (MaskedEditText)findViewById(R.id.phone_input); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.main, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - int id = item.getItemId(); - if (id == R.id.action_settings) { - return true; - } - return super.onOptionsItemSelected(item); - } -} diff --git a/app/src/main/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index 96a442e..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 359047d..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 71c6d76..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png deleted file mode 100644 index 4df1894..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a0645e3..32272f5 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -7,7 +7,6 @@ android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" - tools:context=".MainActivity" android:orientation="vertical"> + tools:context="br.com.tezro_official.maskedEditText.MainActivity" > + + + \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml deleted file mode 100644 index f277d96..0000000 --- a/app/src/main/res/values-ru/strings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - EditTextPhoneNumber - Hello world! - Settings - Пожалуйста, укажите свой номер телефона - diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml deleted file mode 100644 index 63fc816..0000000 --- a/app/src/main/res/values-w820dp/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 64dp - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 47c8224..70eeb8a 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,5 +1,5 @@ + - 16dp 16dp - + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 35eacbb..11eb34d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,9 +1,6 @@ - - EditTextPhoneNumber Hello world! Settings Please, provide your phone number - - + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml deleted file mode 100644 index 766ab99..0000000 --- a/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..7b6f66d --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 0b9dbcf..5a7c7fc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,21 +1,25 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { repositories { - jcenter() + google() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.3' -// classpath 'com.github.dcendents:android-maven-plugin:1.2' - // https://mvnrepository.com/artifact/com.github.dcendents/android-maven-gradle-plugin - classpath group: 'com.github.dcendents', name: 'android-maven-gradle-plugin', version: '1.5' -// classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' + classpath "com.android.tools.build:gradle:4.2.2" + // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } + allprojects { repositories { - jcenter() + google() + mavenCentral() + jcenter() // Warning: this repository is going to shut down soon } +} + +task clean(type: Delete) { + delete rootProject.buildDir } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index fd12690..6826e61 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,17 @@ # Project-wide Gradle settings. - # IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html - # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m - org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -org.gradle.parallel=true -org.gradle.daemon=true \ No newline at end of file +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 8c0fb64..f6b961f 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fab72e1..8f3917f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Fri Jul 30 14:12:35 NOVT 2021 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip \ No newline at end of file +zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 91a7e26..cccdd3d 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -90,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -114,6 +113,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index aec9973..e95643d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/maskedEditText/.gitignore b/maskedEditText/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/maskedEditText/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/maskedEditText/build.gradle b/maskedEditText/build.gradle new file mode 100644 index 0000000..b315457 --- /dev/null +++ b/maskedEditText/build.gradle @@ -0,0 +1,38 @@ +plugins { + id 'com.android.library' +} + +android { + compileSdkVersion 30 + buildToolsVersion '30.0.2' + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'com.google.android.material:material:1.4.0' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/maskedEditText/consumer-rules.pro b/maskedEditText/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/maskedEditText/proguard-rules.pro b/maskedEditText/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/maskedEditText/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/maskedEditText/src/androidTest/java/br/com/sapereaude/maskedEditText/ExampleInstrumentedTest.java b/maskedEditText/src/androidTest/java/br/com/sapereaude/maskedEditText/ExampleInstrumentedTest.java new file mode 100644 index 0000000..ae9e1ec --- /dev/null +++ b/maskedEditText/src/androidTest/java/br/com/sapereaude/maskedEditText/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package br.com.sapereaude.maskedEditText; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("br.com.sapereaude.maskededittext.test", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/MaskedEditText/src/main/AndroidManifest.xml b/maskedEditText/src/main/AndroidManifest.xml old mode 100755 new mode 100644 similarity index 71% rename from MaskedEditText/src/main/AndroidManifest.xml rename to maskedEditText/src/main/AndroidManifest.xml index 82f60e1..11c9d16 --- a/MaskedEditText/src/main/AndroidManifest.xml +++ b/maskedEditText/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="br.com.sapereaude.maskedEditText"> \ No newline at end of file diff --git a/MaskedEditText/src/main/java/br/com/sapereaude/maskedEditText/MaskedEditText.java b/maskedEditText/src/main/java/br/com/sapereaude/maskedEditText/MaskedEditText.java similarity index 99% rename from MaskedEditText/src/main/java/br/com/sapereaude/maskedEditText/MaskedEditText.java rename to maskedEditText/src/main/java/br/com/sapereaude/maskedEditText/MaskedEditText.java index 5d7f88c..23db0fa 100755 --- a/MaskedEditText/src/main/java/br/com/sapereaude/maskedEditText/MaskedEditText.java +++ b/maskedEditText/src/main/java/br/com/sapereaude/maskedEditText/MaskedEditText.java @@ -4,8 +4,6 @@ import android.content.res.TypedArray; import android.os.Bundle; import android.os.Parcelable; -import android.support.v4.text.TextUtilsCompat; -import android.support.v7.widget.AppCompatEditText; import android.text.Editable; import android.text.SpannableStringBuilder; import android.text.TextWatcher; @@ -16,6 +14,8 @@ import android.view.View; import android.widget.TextView; +import androidx.appcompat.widget.AppCompatEditText; + import static android.content.ContentValues.TAG; public class MaskedEditText extends AppCompatEditText implements TextWatcher { diff --git a/MaskedEditText/src/main/java/br/com/sapereaude/maskedEditText/Range.java b/maskedEditText/src/main/java/br/com/sapereaude/maskedEditText/Range.java similarity index 100% rename from MaskedEditText/src/main/java/br/com/sapereaude/maskedEditText/Range.java rename to maskedEditText/src/main/java/br/com/sapereaude/maskedEditText/Range.java diff --git a/MaskedEditText/src/main/java/br/com/sapereaude/maskedEditText/RawText.java b/maskedEditText/src/main/java/br/com/sapereaude/maskedEditText/RawText.java similarity index 100% rename from MaskedEditText/src/main/java/br/com/sapereaude/maskedEditText/RawText.java rename to maskedEditText/src/main/java/br/com/sapereaude/maskedEditText/RawText.java diff --git a/maskedEditText/src/main/res/values/attr.xml b/maskedEditText/src/main/res/values/attr.xml new file mode 100644 index 0000000..dcf66ec --- /dev/null +++ b/maskedEditText/src/main/res/values/attr.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/maskedEditText/src/test/java/br/com/sapereaude/maskedEditText/ExampleUnitTest.java b/maskedEditText/src/test/java/br/com/sapereaude/maskedEditText/ExampleUnitTest.java new file mode 100644 index 0000000..27c3907 --- /dev/null +++ b/maskedEditText/src/test/java/br/com/sapereaude/maskedEditText/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package br.com.sapereaude.maskedEditText; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index fc8e6e6..2f22ba5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,3 @@ -include ':app', ':MaskedEditText' \ No newline at end of file +rootProject.name = "edittext-mask" +include ':app' +include ':maskedEditText'