feat: 优化代码

pull/117/head
kunfei 5 years ago
parent 187d904ac7
commit 37b212dcb0
  1. 10
      app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt
  2. 7
      app/src/main/res/layout/dialog_read_padding.xml

@ -10,6 +10,7 @@ import io.legado.app.R
import io.legado.app.constant.EventBus
import io.legado.app.help.ReadBookConfig
import io.legado.app.ui.book.read.Help
import io.legado.app.utils.dp
import io.legado.app.utils.postEvent
import io.legado.app.utils.visible
import kotlinx.android.synthetic.main.dialog_read_padding.*
@ -51,13 +52,20 @@ class PaddingConfigDialog : DialogFragment() {
}
private fun initData() = with(ReadBookConfig) {
if (hideStatusBar) {
tv_header_padding.visible()
dsb_header_padding_top.visible()
dsb_header_padding_bottom.visible()
dsb_header_padding_left.visible()
dsb_header_padding_right.visible()
tv_body_padding.setPadding(0, 10.dp, 0, 10.dp)
}
//正文
dsb_padding_top.progress = paddingTop
dsb_padding_bottom.progress = paddingBottom
dsb_padding_left.progress = paddingLeft
dsb_padding_right.progress = paddingRight
//页眉
tv_header_padding.visible(hideStatusBar)
dsb_header_padding_top.progress = headerPaddingTop
dsb_header_padding_bottom.progress = headerPaddingBottom
dsb_header_padding_left.progress = headerPaddingLeft

@ -13,12 +13,14 @@
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:textSize="18sp"
android:visibility="gone"
android:text="@string/header" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_header_padding_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:title="@string/padding_top"
app:max="100" />
@ -26,6 +28,7 @@
android:id="@+id/dsb_header_padding_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:title="@string/padding_bottom"
app:max="100" />
@ -33,6 +36,7 @@
android:id="@+id/dsb_header_padding_left"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:title="@string/padding_left"
app:max="100" />
@ -40,13 +44,14 @@
android:id="@+id/dsb_header_padding_right"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:title="@string/padding_right"
app:max="100" />
<io.legado.app.ui.widget.text.AccentTextView
android:id="@+id/tv_body_padding"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:textSize="18sp"
android:text="@string/main_body" />

Loading…
Cancel
Save