feat: 优化

pull/209/head
kunfei 5 years ago
parent c710aff4c4
commit dbe03c79f7
  1. 8
      app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt
  2. 9
      app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt

@ -86,9 +86,13 @@ class TipConfigDialog : BaseDialogFragment() {
tipHeaderLeft = i tipHeaderLeft = i
tv_header_left.text = tipArray[i] tv_header_left.text = tipArray[i]
} }
if (i == ReadTipConfig.battery) {
activity?.recreate()
} else {
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} }
}
tv_header_middle.onClick { tv_header_middle.onClick {
selector(items = ReadTipConfig.tipArray.toList()) { _, i -> selector(items = ReadTipConfig.tipArray.toList()) { _, i ->
ReadTipConfig.apply { ReadTipConfig.apply {
@ -179,9 +183,13 @@ class TipConfigDialog : BaseDialogFragment() {
tipFooterLeft = i tipFooterLeft = i
tv_footer_left.text = tipArray[i] tv_footer_left.text = tipArray[i]
} }
if (i == ReadTipConfig.battery) {
activity?.recreate()
} else {
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} }
}
tv_footer_middle.onClick { tv_footer_middle.onClick {
selector(items = ReadTipConfig.tipArray.toList()) { _, i -> selector(items = ReadTipConfig.tipArray.toList()) { _, i ->
ReadTipConfig.apply { ReadTipConfig.apply {

@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.view.MotionEvent import android.view.MotionEvent
import android.view.ViewGroup
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
@ -143,8 +142,8 @@ class ContentView(context: Context) : FrameLayout(context) {
ReadTipConfig.tipHeaderLeft -> { ReadTipConfig.tipHeaderLeft -> {
ConstraintUtil(ll_header).begin() ConstraintUtil(ll_header).begin()
.clear(R.id.tv_header_left, 2) .clear(R.id.tv_header_left, 2)
.setWidth(R.id.tv_header_left, ViewGroup.LayoutParams.WRAP_CONTENT) .setHorizontalWeight(R.id.tv_footer_left, 0.0F)
.setHorizontalWeight(R.id.tv_footer_left, 0f) .setWidth(R.id.tv_header_left, LayoutParams.WRAP_CONTENT)
.commit() .commit()
tv_header_left tv_header_left
} }
@ -153,8 +152,8 @@ class ContentView(context: Context) : FrameLayout(context) {
ReadTipConfig.tipFooterLeft -> { ReadTipConfig.tipFooterLeft -> {
ConstraintUtil(ll_header).begin() ConstraintUtil(ll_header).begin()
.clear(R.id.tv_footer_left, 2) .clear(R.id.tv_footer_left, 2)
.setWidth(R.id.tv_footer_left, ViewGroup.LayoutParams.WRAP_CONTENT) .setHorizontalWeight(R.id.tv_footer_left, 0.0F)
.setHorizontalWeight(R.id.tv_footer_left, 0f) .setWidth(R.id.tv_footer_left, LayoutParams.WRAP_CONTENT)
.commit() .commit()
tv_footer_left tv_footer_left
} }

Loading…
Cancel
Save