pull/1713/head
kunfei 3 years ago
parent b346e6b1ea
commit a5e5f5405b
  1. 2
      app/src/main/java/io/legado/app/help/glide/ImageLoader.kt
  2. 9
      app/src/main/java/io/legado/app/utils/ContextExtensions.kt

@ -29,7 +29,7 @@ object ImageLoader {
val byteArray = Base64.decode(dataUriBase64, Base64.DEFAULT) val byteArray = Base64.decode(dataUriBase64, Base64.DEFAULT)
Glide.with(context).load(byteArray) Glide.with(context).load(byteArray)
}.getOrDefault( }.getOrDefault(
Glide.with(context).load(path) GlideApp.with(context).load(path)
) )
path.isAbsUrl() -> { path.isAbsUrl() -> {
val url = kotlin.runCatching { val url = kotlin.runCatching {

@ -13,6 +13,7 @@ import android.content.res.ColorStateList
import android.content.res.Configuration import android.content.res.Configuration
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.net.ConnectivityManager
import android.net.Uri import android.net.Uri
import android.os.BatteryManager import android.os.BatteryManager
import android.os.Build import android.os.Build
@ -29,7 +30,7 @@ import io.legado.app.R
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
import io.legado.app.help.IntentHelp import io.legado.app.help.IntentHelp
import splitties.systemservices.clipboardManager import splitties.systemservices.clipboardManager
import splitties.systemservices.connectivityManager
import java.io.File import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
@ -326,6 +327,12 @@ fun Context.openFileUri(uri: Uri, type: String? = null) {
} }
} }
val Context.isWifiConnect: Boolean
get() {
val info = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI)
return info?.isConnected == true
}
val Context.isPad: Boolean val Context.isPad: Boolean
get() { get() {
return resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK >= Configuration.SCREENLAYOUT_SIZE_LARGE return resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK >= Configuration.SCREENLAYOUT_SIZE_LARGE

Loading…
Cancel
Save