pull/32/head
kunfei 5 years ago
parent 90acdadb9b
commit aa261f298d
  1. 17
      app/src/main/java/io/legado/app/ui/readbook/config/ReadStyleDialog.kt
  2. 2
      app/src/main/res/layout/dialog_read_book_style.xml

@ -6,6 +6,7 @@ import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.get
import androidx.fragment.app.DialogFragment
import io.legado.app.R
import io.legado.app.constant.Bus
@ -14,8 +15,11 @@ import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.readbook.Help
import io.legado.app.utils.getPrefInt
import io.legado.app.utils.postEvent
import io.legado.app.utils.putPrefInt
import kotlinx.android.synthetic.main.dialog_read_book_style.*
import org.jetbrains.anko.sdk27.listeners.onCheckedChange
import org.jetbrains.anko.sdk27.listeners.onClick
class ReadStyleDialog : DialogFragment() {
@ -51,12 +55,25 @@ class ReadStyleDialog : DialogFragment() {
}
private fun initData() {
requireContext().getPrefInt("pageAnim").let {
if (it >= 0 && it < rg_page_anim.childCount) {
rg_page_anim.check(rg_page_anim[it].id)
}
}
setBg()
upBg()
}
private fun initOnClick() {
rg_page_anim.onCheckedChange { _, checkedId ->
for (i in 0 until rg_page_anim.childCount) {
if (checkedId == rg_page_anim[i].id) {
requireContext().putPrefInt("pageAnim", i)
break
}
}
}
tv_bg0.onClick {
ReadBookConfig.styleSelect = 0
ReadBookConfig.upBg()

@ -34,6 +34,7 @@
app:layout_constraintTop_toBottomOf="@id/tv_page_anim">
<io.legado.app.lib.theme.view.ATERadioNoButton
android:id="@+id/rb_anim0"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -45,6 +46,7 @@
android:text="@string/page_anim_cover" />
<io.legado.app.lib.theme.view.ATERadioNoButton
android:id="@+id/rb_anim1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"

Loading…
Cancel
Save