pull/32/head
kunfei 5 years ago
parent 94a69f7535
commit 902d9a1028
  1. 12
      app/src/main/java/io/legado/app/ui/readbook/config/BgTextConfigDialog.kt
  2. 2
      app/src/main/java/io/legado/app/ui/readbook/config/ReadStyleDialog.kt

@ -1,6 +1,7 @@
package io.legado.app.ui.readbook.config package io.legado.app.ui.readbook.config
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity.RESULT_OK
import android.content.Context import android.content.Context
import android.content.DialogInterface import android.content.DialogInterface
import android.content.Intent import android.content.Intent
@ -24,6 +25,7 @@ import io.legado.app.help.ReadBookConfig
import io.legado.app.help.permission.Permissions import io.legado.app.help.permission.Permissions
import io.legado.app.help.permission.PermissionsCompat import io.legado.app.help.permission.PermissionsCompat
import io.legado.app.ui.readbook.Help import io.legado.app.ui.readbook.Help
import io.legado.app.utils.FileUtils
import io.legado.app.utils.getCompatColor import io.legado.app.utils.getCompatColor
import io.legado.app.utils.postEvent import io.legado.app.utils.postEvent
import kotlinx.android.synthetic.main.dialog_read_bg_text.* import kotlinx.android.synthetic.main.dialog_read_bg_text.*
@ -156,7 +158,15 @@ class BgTextConfigDialog : DialogFragment() {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
when (requestCode) { when (requestCode) {
resultSelectBg -> { resultSelectBg -> {
if (resultCode == RESULT_OK) {
data?.data?.let {
FileUtils.getPath(requireContext(), it)?.let { path ->
ReadBookConfig.getConfig().setBg(2, path)
ReadBookConfig.upBg()
postEvent(Bus.UP_CONFIG, false)
}
}
}
} }
} }
} }

@ -247,7 +247,7 @@ class ReadStyleDialog : DialogFragment() {
} }
ReadBookConfig.getConfig(i).apply { ReadBookConfig.getConfig(i).apply {
when (bgType()) { when (bgType()) {
2 -> ImageLoader.load(requireContext(), bgStr()).centerCrop().setAsFile(iv) 2 -> ImageLoader.load(requireContext(), bgStr()).centerCrop().setAsDrawable(iv)
else -> iv.setImageDrawable(bgDrawable()) else -> iv.setImageDrawable(bgDrawable())
} }
} }

Loading…
Cancel
Save