From 94a69f75350efa696466f44d7e802f5355bcb65f Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 31 Aug 2019 13:06:52 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/help/ReadBookConfig.kt | 3 ++- .../legado/app/ui/readbook/config/BgTextConfigDialog.kt | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index df282cfb1..c2114b9b6 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -4,6 +4,7 @@ import android.graphics.Color import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import io.legado.app.App +import io.legado.app.R import io.legado.app.utils.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.GlobalScope @@ -177,7 +178,7 @@ object ReadBookConfig { } } } - return bgDrawable ?: ColorDrawable(Color.parseColor("#015A86")) + return bgDrawable ?: ColorDrawable(App.INSTANCE.getCompatColor(R.color.background)) } } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/readbook/config/BgTextConfigDialog.kt b/app/src/main/java/io/legado/app/ui/readbook/config/BgTextConfigDialog.kt index 104e8f788..c0192ad9c 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/config/BgTextConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/config/BgTextConfigDialog.kt @@ -18,12 +18,14 @@ import com.jaredrummler.android.colorpicker.ColorPickerDialog import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter +import io.legado.app.constant.Bus import io.legado.app.help.ImageLoader import io.legado.app.help.ReadBookConfig import io.legado.app.help.permission.Permissions import io.legado.app.help.permission.PermissionsCompat import io.legado.app.ui.readbook.Help import io.legado.app.utils.getCompatColor +import io.legado.app.utils.postEvent import kotlinx.android.synthetic.main.dialog_read_bg_text.* import kotlinx.android.synthetic.main.item_bg_image.view.* import org.jetbrains.anko.sdk27.listeners.onClick @@ -140,6 +142,11 @@ class BgTextConfigDialog : DialogFragment() { .centerCrop() .setAsBitmap(iv_bg) tv_name.text = item.substring(0, item.lastIndexOf(".")) + this.onClick { + ReadBookConfig.getConfig().setBg(1, item) + ReadBookConfig.upBg() + postEvent(Bus.UP_CONFIG, false) + } } } @@ -149,6 +156,7 @@ class BgTextConfigDialog : DialogFragment() { super.onActivityResult(requestCode, resultCode, data) when (requestCode) { resultSelectBg -> { + } } }