背景配置自由添加

pull/371/head
gedoor 4 years ago
parent 21f941c64b
commit 808fbd83e1
  1. 13
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt
  2. 13
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
  3. 29
      app/src/main/res/layout/dialog_read_bg_text.xml

@ -118,13 +118,16 @@ object ReadBookConfig {
}
}
fun resetDur() {
defaultConfigs[styleSelect].let {
durConfig.setBg(it.bgType(), it.bgStr())
durConfig.setTextColor(it.textColor())
fun deleteDur(): Boolean {
if (configList.size > 5) {
configList.removeAt(styleSelect)
if (styleSelect > 0) {
styleSelect -= 1
}
upBg()
save()
return true
}
return false
}
private fun resetAll() {

@ -102,6 +102,7 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack {
sw_dark_status_icon.setTextColor(primaryTextColor)
iv_import.setColorFilter(primaryTextColor)
iv_export.setColorFilter(primaryTextColor)
iv_delete.setColorFilter(primaryTextColor)
tv_bg_image.setTextColor(primaryTextColor)
}
@ -149,10 +150,6 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack {
.setDialogId(BG_COLOR)
.show(requireActivity())
}
tv_default.onClick {
ReadBookConfig.resetDur()
postEvent(EventBus.UP_CONFIG, false)
}
iv_import.onClick {
val importFormNet = "网络导入"
val otherActions = arrayListOf(importFormNet)
@ -175,6 +172,14 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack {
title = getString(R.string.export_str)
)
}
iv_delete.onClick {
if (ReadBookConfig.deleteDur()) {
postEvent(EventBus.UP_CONFIG, true)
dismiss()
} else {
toast("数量以是最少,不能删除.")
}
}
}
private fun selectImage() {

@ -57,23 +57,6 @@
app:isBottomBackground="true"
tools:ignore="HardcodedText" />
<io.legado.app.ui.widget.text.StrokeTextView
android:id="@+id/tv_default"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_weight="3"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:padding="6dp"
android:singleLine="true"
android:text="@string/btn_default_s"
android:textSize="14sp"
app:isBottomBackground="true"
tools:ignore="HardcodedText" />
<ImageView
android:id="@+id/iv_import"
android:layout_width="36dp"
@ -98,6 +81,18 @@
android:tooltipText="@string/export_str"
tools:ignore="UnusedAttribute" />
<ImageView
android:id="@+id/iv_delete"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="@string/delete"
android:src="@drawable/ic_clear_all"
android:tooltipText="@string/delete"
tools:ignore="UnusedAttribute" />
</LinearLayout>
<TextView

Loading…
Cancel
Save