diff --git a/app/src/main/java/io/legado/app/ui/readbook/config/ReadStyleDialog.kt b/app/src/main/java/io/legado/app/ui/readbook/config/ReadStyleDialog.kt index 6579fbf65..5ef3c30a4 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/config/ReadStyleDialog.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/config/ReadStyleDialog.kt @@ -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() diff --git a/app/src/main/res/layout/dialog_read_book_style.xml b/app/src/main/res/layout/dialog_read_book_style.xml index c2fdc5d39..da1aaee91 100644 --- a/app/src/main/res/layout/dialog_read_book_style.xml +++ b/app/src/main/res/layout/dialog_read_book_style.xml @@ -34,6 +34,7 @@ app:layout_constraintTop_toBottomOf="@id/tv_page_anim">