From 4378c3c7859637ca72eb9786bcd369849864a51f Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Mon, 31 Oct 2022 13:42:06 +0200 Subject: [PATCH 01/12] Upgrade to Gradle 7.2 --- build.gradle | 3 +-- countrycodepicker/build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 08ecb55..c6a8387 100644 --- a/build.gradle +++ b/build.gradle @@ -4,8 +4,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.6.3' - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.android.tools.build:gradle:7.1.3' } } diff --git a/countrycodepicker/build.gradle b/countrycodepicker/build.gradle index 951f057..c617adf 100644 --- a/countrycodepicker/build.gradle +++ b/countrycodepicker/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'com.android.library' -apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'maven-publish' group = 'com.github.joielechong' version = "2.4.2" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 997247a..909a458 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jun 05 03:29:53 WIB 2020 +#Mon Oct 31 13:35:44 EET 2022 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip From 832434b857ab5bea0f71b65de6d02b5927d617ad Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Mon, 31 Oct 2022 13:42:49 +0200 Subject: [PATCH 02/12] Remove any references to jCenter --- build.gradle | 4 ++-- countrycodepicker/build.gradle | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index c6a8387..4ab1aac 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ buildscript { repositories { - jcenter() + mavenCentral() google() } dependencies { @@ -10,7 +10,7 @@ buildscript { allprojects { repositories { - jcenter() + mavenCentral() google() maven { url "https://jitpack.io" } mavenLocal() diff --git a/countrycodepicker/build.gradle b/countrycodepicker/build.gradle index c617adf..f35e237 100644 --- a/countrycodepicker/build.gradle +++ b/countrycodepicker/build.gradle @@ -25,10 +25,6 @@ android { } dependencies { -// implementation fileTree(dir: 'libs', include: ['*.jar']) -// testImplementation 'junit:junit:4.12' -// api 'io.michaelrocks:libphonenumber-android:8.10.7' -// api 'io.michaelrocks:libphonenumber-android:8.10.16' - api 'io.michaelrocks:libphonenumber-android:8.12.5' + api 'com.github.MichaelRocks:libphonenumber-android:v8.12.5' implementation 'androidx.annotation:annotation:1.1.0' } \ No newline at end of file From d9c48e20efd0939fd28d992f15152862faec3a70 Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Mon, 31 Oct 2022 13:49:46 +0200 Subject: [PATCH 03/12] Set compile and target version to 33 --- countrycodepicker/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/countrycodepicker/build.gradle b/countrycodepicker/build.gradle index f35e237..3deb9c7 100644 --- a/countrycodepicker/build.gradle +++ b/countrycodepicker/build.gradle @@ -6,12 +6,12 @@ version = "2.4.2" def verCode = 242 android { - compileSdkVersion 29 + compileSdkVersion 33 buildToolsVersion "29.0.3" defaultConfig { minSdkVersion 14 - targetSdkVersion 29 + targetSdkVersion 33 versionCode verCode versionName version } From 1e1993ba3469536fa08d4be3fb0f12bf6c8dc923 Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Mon, 31 Oct 2022 13:54:22 +0200 Subject: [PATCH 04/12] Bump library's version to 2.4.3rt --- countrycodepicker/build.gradle | 5 ++--- sample/build.gradle | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/countrycodepicker/build.gradle b/countrycodepicker/build.gradle index 3deb9c7..a306b3f 100644 --- a/countrycodepicker/build.gradle +++ b/countrycodepicker/build.gradle @@ -2,12 +2,11 @@ apply plugin: 'com.android.library' apply plugin: 'maven-publish' group = 'com.github.joielechong' -version = "2.4.2" -def verCode = 242 +version = "2.4.3rt" +def verCode = 243 android { compileSdkVersion 33 - buildToolsVersion "29.0.3" defaultConfig { minSdkVersion 14 diff --git a/sample/build.gradle b/sample/build.gradle index 35e9e31..4a2973f 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,15 +1,14 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 29 - buildToolsVersion "29.0.3" + compileSdkVersion 33 defaultConfig { applicationId "com.rilixtech.countrycodepicker" minSdkVersion 14 - targetSdkVersion 29 + targetSdkVersion 33 versionCode 242 - versionName '2.4.2' + versionName '2.4.3' } buildTypes { release { From cd2745b54ed8f0f84f6dca2e3a1b465c680034cd Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Mon, 31 Oct 2022 14:10:21 +0200 Subject: [PATCH 05/12] Implement Maven publication --- countrycodepicker/build.gradle | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/countrycodepicker/build.gradle b/countrycodepicker/build.gradle index a306b3f..dd36323 100644 --- a/countrycodepicker/build.gradle +++ b/countrycodepicker/build.gradle @@ -26,4 +26,22 @@ android { dependencies { api 'com.github.MichaelRocks:libphonenumber-android:v8.12.5' implementation 'androidx.annotation:annotation:1.1.0' +} + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + from android.sourceSets.main.java.srcDirs } + +project.afterEvaluate { + publishing { + publications { + release(MavenPublication) { + version = project.property("version") + groupId = project.property("group") + artifactId = 'CountryCodePicker' + artifact androidSourcesJar + from components.release + } + } + } } \ No newline at end of file From f30df26a591ef0e65f76da222268dbff17540a62 Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Mon, 31 Oct 2022 14:23:19 +0200 Subject: [PATCH 06/12] Minor change to Maven publication --- countrycodepicker/build.gradle | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/countrycodepicker/build.gradle b/countrycodepicker/build.gradle index a306b3f..527d56d 100644 --- a/countrycodepicker/build.gradle +++ b/countrycodepicker/build.gradle @@ -1,7 +1,6 @@ apply plugin: 'com.android.library' apply plugin: 'maven-publish' -group = 'com.github.joielechong' version = "2.4.3rt" def verCode = 243 @@ -26,4 +25,21 @@ android { dependencies { api 'com.github.MichaelRocks:libphonenumber-android:v8.12.5' implementation 'androidx.annotation:annotation:1.1.0' +} + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + from android.sourceSets.main.java.srcDirs } + +project.afterEvaluate { + publishing { + publications { + release(MavenPublication) { + version = project.property("version") + artifactId = 'CountryCodePicker' + artifact androidSourcesJar + from components.release + } + } + } } \ No newline at end of file From 17a03e0a40f12ae8d4ea63f692b3c90ecc93464e Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Mon, 31 Oct 2022 15:02:04 +0200 Subject: [PATCH 07/12] Allow Jitpack to use OpenJDK11 --- jitpack.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 jitpack.yml diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..46c8529 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +jdk: + - openjdk11 \ No newline at end of file From b95ad3a283c47b934b11f3feb5cc259281fe6daa Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Mon, 31 Oct 2022 15:06:03 +0200 Subject: [PATCH 08/12] Allow activities to be exported --- sample/src/main/AndroidManifest.xml | 6 ++++-- sampletv/src/main/AndroidManifest.xml | 1 + simplesample/src/main/AndroidManifest.xml | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 11d7585..9e6ef24 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -10,8 +10,10 @@ android:theme="@style/AppTheme"> - + android:windowSoftInputMode="stateHidden" + android:exported="true"/> + diff --git a/sampletv/src/main/AndroidManifest.xml b/sampletv/src/main/AndroidManifest.xml index 86d52bb..3f2064a 100644 --- a/sampletv/src/main/AndroidManifest.xml +++ b/sampletv/src/main/AndroidManifest.xml @@ -19,6 +19,7 @@ android:theme="@style/AppTheme" tools:ignore="GoogleAppIndexingWarning"> - + From 4c0ebd368547276fb4bc4792719fa2e68b451d53 Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Mon, 31 Oct 2022 15:17:38 +0200 Subject: [PATCH 09/12] Remove redundant information from Maven publication --- countrycodepicker/build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/countrycodepicker/build.gradle b/countrycodepicker/build.gradle index 527d56d..26f8634 100644 --- a/countrycodepicker/build.gradle +++ b/countrycodepicker/build.gradle @@ -35,8 +35,6 @@ project.afterEvaluate { publishing { publications { release(MavenPublication) { - version = project.property("version") - artifactId = 'CountryCodePicker' artifact androidSourcesJar from components.release } From 5b9285fa98f8cbe2c85c38487d509a9ba20b2067 Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Thu, 15 Dec 2022 10:44:46 +0200 Subject: [PATCH 10/12] Update `libphonenumber-android` library to `8.13.2` & disable its api declaration --- README.md | 3 ++- countrycodepicker/build.gradle | 4 ++-- .../countrycodepicker/CountryCodeArrayAdapter.java | 1 + .../widget/countrycodepicker/CountryCodeDialog.java | 1 + .../widget/countrycodepicker/CountryCodePicker.java | 11 +++++++---- sample/build.gradle | 11 +++++------ .../countrycodepicker/CountryPreferenceFragment.java | 3 ++- .../countrycodepicker/CustomColorFragment.java | 3 ++- .../countrycodepicker/CustomFontFragment.java | 5 +++-- .../countrycodepicker/CustomMasterFragment.java | 3 ++- .../countrycodepicker/CustomSizeFragment.java | 5 +++-- .../countrycodepicker/DefaultCountryFragment.java | 3 ++- .../rilixtech/countrycodepicker/ExampleActivity.java | 3 ++- .../countrycodepicker/FullNumberFragment.java | 6 ++++-- .../countrycodepicker/GetCountryFragment.java | 3 ++- .../com/rilixtech/countrycodepicker/HomeActivity.java | 3 ++- .../countrycodepicker/IntroductionFragment.java | 4 +++- .../countrycodepicker/PerformClickActivity.java | 6 ++++-- .../PhoneNumberValidityFragment.java | 6 ++++-- .../countrycodepicker/SetCountryFragment.java | 3 ++- sample/src/main/res/layout/activity_example.xml | 1 - sample/src/main/res/layout/fragment_set_country.xml | 4 +--- sampletv/build.gradle | 2 +- .../countrycodepicker/sampletv/MainActivity.java | 1 + 24 files changed, 58 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 1612e3a..4049965 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,8 @@ How to add to your project ````groovy dependencies { - implementation 'com.github.joielechong:countrycodepicker:2.4.2' + implementation 'io.michaelrocks:libphonenumber-android:8.13.2' + implementation 'com.github.rtsketo:CountryCodePicker:2.4.4rt' } ```` diff --git a/countrycodepicker/build.gradle b/countrycodepicker/build.gradle index 26f8634..7877365 100644 --- a/countrycodepicker/build.gradle +++ b/countrycodepicker/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'maven-publish' -version = "2.4.3rt" +version = "2.4.4rt" def verCode = 243 android { @@ -23,7 +23,7 @@ android { } dependencies { - api 'com.github.MichaelRocks:libphonenumber-android:v8.12.5' + implementation 'io.michaelrocks:libphonenumber-android:8.13.2' implementation 'androidx.annotation:annotation:1.1.0' } diff --git a/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodeArrayAdapter.java b/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodeArrayAdapter.java index fe347e7..78cb106 100644 --- a/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodeArrayAdapter.java +++ b/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodeArrayAdapter.java @@ -12,6 +12,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; + import java.util.List; import java.util.Locale; diff --git a/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodeDialog.java b/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodeDialog.java index 351e3cf..324b42c 100644 --- a/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodeDialog.java +++ b/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodeDialog.java @@ -18,6 +18,7 @@ import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; + import java.util.ArrayList; import java.util.List; diff --git a/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodePicker.java b/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodePicker.java index 51799f1..0838913 100644 --- a/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodePicker.java +++ b/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodePicker.java @@ -18,18 +18,21 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; - import android.widget.TextView; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import io.michaelrocks.libphonenumber.android.NumberParseException; -import io.michaelrocks.libphonenumber.android.PhoneNumberUtil; -import io.michaelrocks.libphonenumber.android.Phonenumber; + import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.TimeZone; +import io.michaelrocks.libphonenumber.android.BuildConfig; +import io.michaelrocks.libphonenumber.android.NumberParseException; +import io.michaelrocks.libphonenumber.android.PhoneNumberUtil; +import io.michaelrocks.libphonenumber.android.Phonenumber; + public class CountryCodePicker extends RelativeLayout { private static String TAG = CountryCodePicker.class.getSimpleName(); diff --git a/sample/build.gradle b/sample/build.gradle index 4a2973f..ee6e20f 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -19,12 +19,11 @@ android { } dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - testImplementation 'junit:junit:4.12' implementation project(':countrycodepicker') -// implementation 'com.github.joielechong:countrycodepicker:2.4.1' - - implementation 'androidx.appcompat:appcompat:1.1.0' + implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation 'io.michaelrocks:libphonenumber-android:8.13.2' + implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.cardview:cardview:1.0.0' -// implementation 'io.michaelrocks:libphonenumber-android:8.9.14' + + testImplementation 'junit:junit:4.13.2' } diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/CountryPreferenceFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/CountryPreferenceFragment.java index 49d3531..6858c12 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/CountryPreferenceFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/CountryPreferenceFragment.java @@ -1,7 +1,6 @@ package com.rilixtech.countrycodepicker; import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; @@ -11,6 +10,8 @@ import android.widget.EditText; import android.widget.Toast; +import androidx.fragment.app.Fragment; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/CustomColorFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/CustomColorFragment.java index c5b94f3..7504f68 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/CustomColorFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/CustomColorFragment.java @@ -2,7 +2,6 @@ import android.graphics.PorterDuff; import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -11,6 +10,8 @@ import android.widget.RelativeLayout; import android.widget.TextView; +import androidx.fragment.app.Fragment; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/CustomFontFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/CustomFontFragment.java index 7d014d5..c60ebdd 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/CustomFontFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/CustomFontFragment.java @@ -3,13 +3,14 @@ import android.graphics.Typeface; import android.os.Bundle; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/CustomMasterFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/CustomMasterFragment.java index 5683789..5362a34 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/CustomMasterFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/CustomMasterFragment.java @@ -1,7 +1,6 @@ package com.rilixtech.countrycodepicker; import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; @@ -11,6 +10,8 @@ import android.widget.EditText; import android.widget.Toast; +import androidx.fragment.app.Fragment; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/CustomSizeFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/CustomSizeFragment.java index 6218338..8133efe 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/CustomSizeFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/CustomSizeFragment.java @@ -2,13 +2,14 @@ import android.os.Bundle; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + /** * A simple {@link Fragment} subclass. diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/DefaultCountryFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/DefaultCountryFragment.java index 4bb2a95..b945b71 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/DefaultCountryFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/DefaultCountryFragment.java @@ -2,7 +2,6 @@ import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; @@ -13,6 +12,8 @@ import android.widget.EditText; import android.widget.Toast; +import androidx.fragment.app.Fragment; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/ExampleActivity.java b/sample/src/main/java/com/rilixtech/countrycodepicker/ExampleActivity.java index e699c38..b288910 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/ExampleActivity.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/ExampleActivity.java @@ -1,11 +1,12 @@ package com.rilixtech.countrycodepicker; import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager.widget.ViewPager; -import androidx.appcompat.app.AppCompatActivity; public class ExampleActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/FullNumberFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/FullNumberFragment.java index d8734a0..07fc32c 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/FullNumberFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/FullNumberFragment.java @@ -2,8 +2,6 @@ import android.os.Bundle; -import androidx.fragment.app.Fragment; -import androidx.appcompat.widget.AppCompatEditText; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; @@ -12,7 +10,11 @@ import android.view.ViewGroup; import android.widget.Button; +import androidx.appcompat.widget.AppCompatEditText; +import androidx.fragment.app.Fragment; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; + import io.michaelrocks.libphonenumber.android.PhoneNumberUtil; /** diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/GetCountryFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/GetCountryFragment.java index 8cde973..deac154 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/GetCountryFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/GetCountryFragment.java @@ -2,13 +2,14 @@ import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; +import androidx.fragment.app.Fragment; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/HomeActivity.java b/sample/src/main/java/com/rilixtech/countrycodepicker/HomeActivity.java index 7214ac2..d41b0cf 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/HomeActivity.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/HomeActivity.java @@ -2,11 +2,12 @@ import android.content.Intent; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; + public class HomeActivity extends AppCompatActivity { TextView textIntro, textDefaultCountry, textPreference, textCustomMaster, diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/IntroductionFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/IntroductionFragment.java index 0aeb766..9d92c32 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/IntroductionFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/IntroductionFragment.java @@ -2,11 +2,13 @@ import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; + +import androidx.fragment.app.Fragment; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; /** diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/PerformClickActivity.java b/sample/src/main/java/com/rilixtech/countrycodepicker/PerformClickActivity.java index a77f015..3cd5333 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/PerformClickActivity.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/PerformClickActivity.java @@ -1,10 +1,12 @@ package com.rilixtech.countrycodepicker; import android.os.Bundle; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.Button; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; public class PerformClickActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/PhoneNumberValidityFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/PhoneNumberValidityFragment.java index cb5332d..1823924 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/PhoneNumberValidityFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/PhoneNumberValidityFragment.java @@ -1,14 +1,16 @@ package com.rilixtech.countrycodepicker; import android.os.Bundle; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; + +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; /** diff --git a/sample/src/main/java/com/rilixtech/countrycodepicker/SetCountryFragment.java b/sample/src/main/java/com/rilixtech/countrycodepicker/SetCountryFragment.java index 7fe6b00..8ce8aff 100644 --- a/sample/src/main/java/com/rilixtech/countrycodepicker/SetCountryFragment.java +++ b/sample/src/main/java/com/rilixtech/countrycodepicker/SetCountryFragment.java @@ -1,7 +1,6 @@ package com.rilixtech.countrycodepicker; import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; @@ -11,6 +10,8 @@ import android.widget.EditText; import android.widget.Toast; +import androidx.fragment.app.Fragment; + import com.rilixtech.widget.countrycodepicker.Country; import com.rilixtech.widget.countrycodepicker.CountryCodePicker; diff --git a/sample/src/main/res/layout/activity_example.xml b/sample/src/main/res/layout/activity_example.xml index 8a9de53..160e5b8 100644 --- a/sample/src/main/res/layout/activity_example.xml +++ b/sample/src/main/res/layout/activity_example.xml @@ -3,7 +3,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - xmlns:app="http://schemas.android.com/apk/res-auto" tools:context="com.rilixtech.countrycodepicker.ExampleActivity"> + tools:context="com.rilixtech.countrycodepicker.SetCountryFragment"> diff --git a/sampletv/build.gradle b/sampletv/build.gradle index 02f0e27..19b8bf2 100644 --- a/sampletv/build.gradle +++ b/sampletv/build.gradle @@ -23,6 +23,6 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':countrycodepicker') -// implementation 'com.github.joielechong:countrycodepicker:2.4.1' implementation 'androidx.leanback:leanback:1.0.0' + implementation 'io.michaelrocks:libphonenumber-android:8.13.2' } diff --git a/sampletv/src/main/java/com/rilixtech/countrycodepicker/sampletv/MainActivity.java b/sampletv/src/main/java/com/rilixtech/countrycodepicker/sampletv/MainActivity.java index 6edb41b..671f5b5 100644 --- a/sampletv/src/main/java/com/rilixtech/countrycodepicker/sampletv/MainActivity.java +++ b/sampletv/src/main/java/com/rilixtech/countrycodepicker/sampletv/MainActivity.java @@ -3,6 +3,7 @@ import android.app.Activity; import android.os.Bundle; import android.widget.EditText; + import com.rilixtech.widget.countrycodepicker.CountryCodePicker; public class MainActivity extends Activity { From ae1aff884af82659aad179232b66ea8ed921d9d6 Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Thu, 15 Dec 2022 11:25:29 +0200 Subject: [PATCH 11/12] Upgrade to API`33` & AndroidX's annotation to `1.5.0` --- build.gradle | 2 +- countrycodepicker/build.gradle | 4 +--- gradle/wrapper/gradle-wrapper.properties | 4 ++-- sampletv/build.gradle | 5 ++--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 4ab1aac..0ce8b09 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.3' + classpath 'com.android.tools.build:gradle:7.3.1' } } diff --git a/countrycodepicker/build.gradle b/countrycodepicker/build.gradle index 7877365..f45d234 100644 --- a/countrycodepicker/build.gradle +++ b/countrycodepicker/build.gradle @@ -10,8 +10,6 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 33 - versionCode verCode - versionName version } buildTypes { @@ -24,7 +22,7 @@ android { dependencies { implementation 'io.michaelrocks:libphonenumber-android:8.13.2' - implementation 'androidx.annotation:annotation:1.1.0' + implementation 'androidx.annotation:annotation:1.5.0' } task androidSourcesJar(type: Jar) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 909a458..df82d55 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Oct 31 13:35:44 EET 2022 +#Thu Dec 15 11:01:48 EET 2022 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/sampletv/build.gradle b/sampletv/build.gradle index 19b8bf2..7beda3d 100644 --- a/sampletv/build.gradle +++ b/sampletv/build.gradle @@ -1,13 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 29 - buildToolsVersion "29.0.3" + compileSdkVersion 33 defaultConfig { applicationId "com.rilixtech.countrycodepicker.sampletv" minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 33 versionCode 1 versionName "1.0" } From 55920e401692786c05502f5a62f3e2cdc78721ea Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Tue, 12 Sep 2023 16:34:19 +0300 Subject: [PATCH 12/12] Create separate functions for changing the background of dialog and button --- countrycodepicker/build.gradle | 2 +- .../countrycodepicker/CountryCodePicker.java | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/countrycodepicker/build.gradle b/countrycodepicker/build.gradle index f45d234..3132d99 100644 --- a/countrycodepicker/build.gradle +++ b/countrycodepicker/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'maven-publish' -version = "2.4.4rt" +version = "2.4.5rt" def verCode = 243 android { diff --git a/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodePicker.java b/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodePicker.java index 0838913..25f4312 100644 --- a/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodePicker.java +++ b/countrycodepicker/src/main/java/com/rilixtech/widget/countrycodepicker/CountryCodePicker.java @@ -34,7 +34,7 @@ import io.michaelrocks.libphonenumber.android.Phonenumber; public class CountryCodePicker extends RelativeLayout { - private static String TAG = CountryCodePicker.class.getSimpleName(); + private static final String TAG = CountryCodePicker.class.getSimpleName(); private final String DEFAULT_COUNTRY = Locale.getDefault().getCountry(); private static final String DEFAULT_ISO_COUNTRY = "ID"; @@ -65,7 +65,7 @@ public class CountryCodePicker extends RelativeLayout { private boolean mHideNameCode = false; private boolean mShowFlag = true; private boolean mShowFullName = false; - private boolean mUseFullName = false; + private final boolean mUseFullName = false; private boolean mSelectionDialogShowSearch = true; private List mPreferredCountries; @@ -220,7 +220,7 @@ private void applyCustomProperty(AttributeSet attrs) { setDefaultCountryFlagAndCode(); } } catch (Exception e) { - Log.d(TAG, "exception = " + e.toString()); + Log.d(TAG, "exception = " + e); if (isInEditMode()) { mTvSelectedCountry.setText( getContext().getString(R.string.phone_code, @@ -942,6 +942,14 @@ public void setBackgroundColor(int backgroundColor) { mRlyHolder.setBackgroundColor(backgroundColor); } + public void setDialogBackgroundColor(int backgroundColor) { + mBackgroundColor = backgroundColor; + } + + public void setButtonBackgroundColor(int backgroundColor) { + mRlyHolder.setBackgroundColor(backgroundColor); + } + public int getDefaultBackgroundColor() { return DEFAULT_BACKGROUND_COLOR; } @@ -1026,7 +1034,7 @@ public void setTypeFace(@NonNull String fontAssetPath) { mTypeFace = typeFace; mTvSelectedCountry.setTypeface(typeFace); } catch (Exception e) { - Log.d(TAG, "Invalid fontPath. " + e.toString()); + Log.d(TAG, "Invalid fontPath. " + e); } } @@ -1301,7 +1309,7 @@ private void setDefaultCountryFlagAndCode() { if (BuildConfig.DEBUG) Log.d(TAG, "simCountryIso = " + simCountryIso); } } catch (Exception e) { - Log.e(TAG, "Error when getting sim country, error = " + e.toString()); + Log.e(TAG, "Error when getting sim country, error = " + e); setEmptyDefault(getDefaultCountryCode()); } }