pull/32/head
kunfei 5 years ago
parent d6959d1ae8
commit 94a69f7535
  1. 3
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt
  2. 8
      app/src/main/java/io/legado/app/ui/readbook/config/BgTextConfigDialog.kt

@ -4,6 +4,7 @@ import android.graphics.Color
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import io.legado.app.App import io.legado.app.App
import io.legado.app.R
import io.legado.app.utils.* import io.legado.app.utils.*
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.GlobalScope 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))
} }
} }
} }

@ -18,12 +18,14 @@ import com.jaredrummler.android.colorpicker.ColorPickerDialog
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.constant.Bus
import io.legado.app.help.ImageLoader import io.legado.app.help.ImageLoader
import io.legado.app.help.ReadBookConfig 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.getCompatColor 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.dialog_read_bg_text.*
import kotlinx.android.synthetic.main.item_bg_image.view.* import kotlinx.android.synthetic.main.item_bg_image.view.*
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
@ -140,6 +142,11 @@ class BgTextConfigDialog : DialogFragment() {
.centerCrop() .centerCrop()
.setAsBitmap(iv_bg) .setAsBitmap(iv_bg)
tv_name.text = item.substring(0, item.lastIndexOf(".")) 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) super.onActivityResult(requestCode, resultCode, data)
when (requestCode) { when (requestCode) {
resultSelectBg -> { resultSelectBg -> {
} }
} }
} }

Loading…
Cancel
Save