pull/94/head
kunfei 5 years ago
parent d4fab1c97f
commit 3773bad385
  1. 4
      app/build.gradle
  2. 8
      app/src/main/java/io/legado/app/ui/filechooser/utils/FileUtils.kt
  3. 1
      app/src/main/java/io/legado/app/utils/FragmentExtensions.kt

@ -106,14 +106,14 @@ dependencies {
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
//androidX //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.appcompat:appcompat:1.1.0'
implementation 'androidx.media:media:1.1.0' implementation 'androidx.media:media:1.1.0'
implementation 'androidx.preference:preference:1.1.0' implementation 'androidx.preference:preference:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
implementation 'androidx.viewpager2:viewpager2: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' implementation 'com.google.android:flexbox:1.1.0'
//lifecycle //lifecycle

@ -147,15 +147,15 @@ object FileUtils {
if (!f.isDirectory) { if (!f.isDirectory) {
return arrayOfNulls(0) return arrayOfNulls(0)
} }
val files = f.listFiles(FileFilter { f -> val files = f.listFiles(FileFilter { file ->
if (f == null) { if (file == null) {
return@FileFilter false return@FileFilter false
} }
if (f.isDirectory) { if (file.isDirectory) {
return@FileFilter false return@FileFilter false
} }
filterPattern?.matcher(f.name)?.find() ?: true filterPattern?.matcher(file.name)?.find() ?: true
}) })
?: return arrayOfNulls(0) ?: return arrayOfNulls(0)
for (file in files) { for (file in files) {

@ -13,6 +13,7 @@ import org.jetbrains.anko.connectivityManager
import org.jetbrains.anko.defaultSharedPreferences import org.jetbrains.anko.defaultSharedPreferences
import org.jetbrains.anko.internals.AnkoInternals import org.jetbrains.anko.internals.AnkoInternals
@Suppress("DEPRECATION")
fun Fragment.isOnline() = requireContext().connectivityManager.activeNetworkInfo?.isConnected == true fun Fragment.isOnline() = requireContext().connectivityManager.activeNetworkInfo?.isConnected == true
fun Fragment.getPrefBoolean(key: String, defValue: Boolean = false) = fun Fragment.getPrefBoolean(key: String, defValue: Boolean = false) =

Loading…
Cancel
Save