From ada85cfdb612ec5adcee92e0473a56130f8cd17c Mon Sep 17 00:00:00 2001 From: Richard Meissner Date: Thu, 11 Jul 2019 13:02:08 +0200 Subject: [PATCH] Remove old support lib dependencies (#36) --- android-common/build.gradle | 6 +-- .../svalinn/common/utils/AndroidUtils.kt | 6 +-- .../svalinn/common/utils/ContextUtils.kt | 32 ++++++------- .../svalinn/common/utils/QrCodeUtils.kt | 4 +- .../common/utils/ZxingIntentIntegrator.java | 3 +- buildsystem/dependencies.gradle | 47 ++++++++++--------- utils-testing/build.gradle | 3 +- .../TestListUpdateCallback.kt | 4 +- 8 files changed, 54 insertions(+), 51 deletions(-) diff --git a/android-common/build.gradle b/android-common/build.gradle index fdf083e..9c2b48f 100644 --- a/android-common/build.gradle +++ b/android-common/build.gradle @@ -9,9 +9,9 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlin" //Android - implementation "com.android.support:appcompat-v7:$versions.android_support" - implementation "com.android.support:cardview-v7:$versions.android_support" - implementation "com.android.support:design:$versions.android_support" + implementation "androidx.appcompat:appcompat:$versions.androidx_app_compat" + implementation "androidx.cardview:cardview:$versions.androidx_card_view" + implementation "com.google.android.material:material:$versions.material" //Rx implementation "io.reactivex.rxjava2:rxjava:$versions.rxjava" diff --git a/android-common/src/main/java/pm/gnosis/svalinn/common/utils/AndroidUtils.kt b/android-common/src/main/java/pm/gnosis/svalinn/common/utils/AndroidUtils.kt index a87324d..53021f2 100644 --- a/android-common/src/main/java/pm/gnosis/svalinn/common/utils/AndroidUtils.kt +++ b/android-common/src/main/java/pm/gnosis/svalinn/common/utils/AndroidUtils.kt @@ -2,12 +2,12 @@ package pm.gnosis.svalinn.common.utils import android.content.SharedPreferences import android.os.Bundle -import android.support.v4.app.Fragment -import android.support.v4.app.FragmentManager -import android.support.v4.app.FragmentTransaction import android.text.SpannableStringBuilder import android.text.Spanned import android.view.View +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentManager +import androidx.fragment.app.FragmentTransaction inline fun SharedPreferences.edit(func: SharedPreferences.Editor.() -> Unit) { val editor = edit() diff --git a/android-common/src/main/java/pm/gnosis/svalinn/common/utils/ContextUtils.kt b/android-common/src/main/java/pm/gnosis/svalinn/common/utils/ContextUtils.kt index 3a4ca62..b4bf12d 100644 --- a/android-common/src/main/java/pm/gnosis/svalinn/common/utils/ContextUtils.kt +++ b/android-common/src/main/java/pm/gnosis/svalinn/common/utils/ContextUtils.kt @@ -8,15 +8,15 @@ import android.content.Context.VIBRATOR_SERVICE import android.net.Uri import android.os.Vibrator import android.provider.Browser -import android.support.annotation.ColorRes -import android.support.annotation.PluralsRes -import android.support.annotation.RequiresPermission -import android.support.annotation.StringRes -import android.support.design.widget.Snackbar -import android.support.v4.content.ContextCompat import android.view.View import android.view.inputmethod.InputMethodManager import android.widget.Toast +import androidx.annotation.ColorRes +import androidx.annotation.PluralsRes +import androidx.annotation.RequiresPermission +import androidx.annotation.StringRes +import androidx.core.content.ContextCompat +import com.google.android.material.snackbar.Snackbar import timber.log.Timber @@ -28,17 +28,17 @@ fun Context.toast(@StringRes text: Int, duration: Int = Toast.LENGTH_LONG) { Toast.makeText(this, text, duration).show() } -fun snackbar(view: View, text: CharSequence, duration: Int = Snackbar.LENGTH_LONG, action: Pair Unit>? = null) { - val snackbar = Snackbar.make(view, text, duration) - action?.let { snackbar.setAction(it.first, it.second) } - snackbar.show() -} +fun snackbar(view: View, text: CharSequence, duration: Int = Snackbar.LENGTH_LONG, action: Pair Unit>? = null) = + Snackbar.make(view, text, duration).apply { + action?.let { setAction(it.first, it.second) } + show() + } -fun snackbar(view: View, @StringRes textId: Int, duration: Int = Snackbar.LENGTH_LONG, action: Pair Unit>? = null) { - val snackbar = Snackbar.make(view, textId, duration) - action?.let { snackbar.setAction(it.first, it.second) } - snackbar.show() -} +fun snackbar(view: View, @StringRes textId: Int, duration: Int = Snackbar.LENGTH_LONG, action: Pair Unit>? = null) = + Snackbar.make(view, textId, duration).apply { + action?.let { setAction(it.first, it.second) } + show() + } fun Context.getSimplePlural(@PluralsRes stringId: Int, quantity: Long): String = resources.getQuantityString(stringId, quantity.toInt(), quantity) diff --git a/android-common/src/main/java/pm/gnosis/svalinn/common/utils/QrCodeUtils.kt b/android-common/src/main/java/pm/gnosis/svalinn/common/utils/QrCodeUtils.kt index d03f3f1..5583acd 100644 --- a/android-common/src/main/java/pm/gnosis/svalinn/common/utils/QrCodeUtils.kt +++ b/android-common/src/main/java/pm/gnosis/svalinn/common/utils/QrCodeUtils.kt @@ -3,8 +3,8 @@ package pm.gnosis.svalinn.common.utils import android.app.Activity import android.graphics.Bitmap import android.graphics.Color -import android.support.annotation.ColorInt -import android.support.v4.app.Fragment +import androidx.annotation.ColorInt +import androidx.fragment.app.Fragment import com.google.zxing.BarcodeFormat import com.google.zxing.WriterException import com.google.zxing.qrcode.QRCodeWriter diff --git a/android-common/src/main/java/pm/gnosis/svalinn/common/utils/ZxingIntentIntegrator.java b/android-common/src/main/java/pm/gnosis/svalinn/common/utils/ZxingIntentIntegrator.java index ed8ff78..8bfeb70 100644 --- a/android-common/src/main/java/pm/gnosis/svalinn/common/utils/ZxingIntentIntegrator.java +++ b/android-common/src/main/java/pm/gnosis/svalinn/common/utils/ZxingIntentIntegrator.java @@ -25,7 +25,6 @@ import android.content.pm.ResolveInfo; import android.net.Uri; import android.os.Bundle; -import android.support.v4.app.Fragment; import android.util.Log; import java.util.Arrays; @@ -35,6 +34,8 @@ import java.util.List; import java.util.Map; +import androidx.fragment.app.Fragment; + /** *

A utility class which helps ease integration with Barcode Scanner via {@link Intent}s. This is a simple * way to invoke barcode scanning and receive the result, without any need to integrate, modify, or learn the diff --git a/buildsystem/dependencies.gradle b/buildsystem/dependencies.gradle index 32ec10b..4bb9f57 100644 --- a/buildsystem/dependencies.gradle +++ b/buildsystem/dependencies.gradle @@ -1,31 +1,34 @@ ext { versions = [ // Plug-Ins - android_tools : '3.3.0', - kotlin : '1.3.11', - jacoco : '0.7.9', + android_tools : '3.3.0', + kotlin : '1.3.11', + jacoco : '0.7.9', // Runtime dependencies - android_support: '28.0.0', - android_room : '1.1.1', - bivrost : 'v0.7.1', - bouncycastle : '1.61', - geth : '1.7.1', - kethereum : '0.33', - moshi : '1.8.0', - okhttp : '3.11.0', - okio : '2.1.0', - retrofit : '2.4.0', - rxandroid : '2.1.0', - rxbinding : '2.1.1', - rxjava : '2.2.1', - rxkotlin : '2.3.0', - timber : '4.7.1', - zxing : '3.3.1', + androidx_app_compat : '1.0.2', + androidx_card_view : '1.0.0', + androidx_recycler_view: '1.0.0', + android_room : '1.1.1', + bivrost : 'v0.7.1', + bouncycastle : '1.61', + geth : '1.7.1', + kethereum : '0.33', + material : '1.0.0', + moshi : '1.8.0', + okhttp : '3.11.0', + okio : '2.1.0', + retrofit : '2.4.0', + rxandroid : '2.1.0', + rxbinding : '2.1.1', + rxjava : '2.2.1', + rxkotlin : '2.3.0', + timber : '4.7.1', + zxing : '3.3.1', // Test dependencies - espresso : '3.0.0', - junit : '4.12', - mockito : '2.12.0', + espresso : '3.0.0', + junit : '4.12', + mockito : '2.12.0', ] } diff --git a/utils-testing/build.gradle b/utils-testing/build.gradle index 92272e9..d08d824 100644 --- a/utils-testing/build.gradle +++ b/utils-testing/build.gradle @@ -16,6 +16,5 @@ dependencies { implementation "org.mockito:mockito-core:$versions.mockito" implementation "org.mockito:mockito-inline:$versions.mockito" - implementation "com.android.support:appcompat-v7:$versions.android_support" - implementation "com.android.support:design:$versions.android_support" + implementation "androidx.recyclerview:recyclerview:$versions.androidx_recycler_view" } diff --git a/utils-testing/src/main/java/pm.gnosis.tests.utils/TestListUpdateCallback.kt b/utils-testing/src/main/java/pm.gnosis.tests.utils/TestListUpdateCallback.kt index 9040c1d..5329708 100644 --- a/utils-testing/src/main/java/pm.gnosis.tests.utils/TestListUpdateCallback.kt +++ b/utils-testing/src/main/java/pm.gnosis.tests.utils/TestListUpdateCallback.kt @@ -1,7 +1,7 @@ package pm.gnosis.tests.utils -import android.support.v7.util.DiffUtil -import android.support.v7.util.ListUpdateCallback +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListUpdateCallback import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue