From 3773bad385d5601ee2a9f55aa644ef6d646ca2f9 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 7 Feb 2020 12:08:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 ++-- .../java/io/legado/app/ui/filechooser/utils/FileUtils.kt | 8 ++++---- .../main/java/io/legado/app/utils/FragmentExtensions.kt | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f5886b609..835fcda25 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -106,14 +106,14 @@ dependencies { implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' //androidX - implementation 'androidx.core:core-ktx:1.2.0-rc01' + implementation 'androidx.core:core-ktx:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.media:media:1.1.0' implementation 'androidx.preference:preference:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' implementation 'androidx.viewpager2:viewpager2:1.0.0' - implementation 'com.google.android.material:material:1.2.0-alpha04' + implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.android:flexbox:1.1.0' //lifecycle diff --git a/app/src/main/java/io/legado/app/ui/filechooser/utils/FileUtils.kt b/app/src/main/java/io/legado/app/ui/filechooser/utils/FileUtils.kt index f06054bb4..309dee0a2 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/utils/FileUtils.kt +++ b/app/src/main/java/io/legado/app/ui/filechooser/utils/FileUtils.kt @@ -147,15 +147,15 @@ object FileUtils { if (!f.isDirectory) { return arrayOfNulls(0) } - val files = f.listFiles(FileFilter { f -> - if (f == null) { + val files = f.listFiles(FileFilter { file -> + if (file == null) { return@FileFilter false } - if (f.isDirectory) { + if (file.isDirectory) { return@FileFilter false } - filterPattern?.matcher(f.name)?.find() ?: true + filterPattern?.matcher(file.name)?.find() ?: true }) ?: return arrayOfNulls(0) for (file in files) { diff --git a/app/src/main/java/io/legado/app/utils/FragmentExtensions.kt b/app/src/main/java/io/legado/app/utils/FragmentExtensions.kt index b2379e89a..de7f10b96 100644 --- a/app/src/main/java/io/legado/app/utils/FragmentExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/FragmentExtensions.kt @@ -13,6 +13,7 @@ import org.jetbrains.anko.connectivityManager import org.jetbrains.anko.defaultSharedPreferences import org.jetbrains.anko.internals.AnkoInternals +@Suppress("DEPRECATION") fun Fragment.isOnline() = requireContext().connectivityManager.activeNetworkInfo?.isConnected == true fun Fragment.getPrefBoolean(key: String, defValue: Boolean = false) =