|
|
@ -15,8 +15,10 @@ import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.databinding.DialogEditTextBinding |
|
|
|
import io.legado.app.databinding.DialogEditTextBinding |
|
|
|
import io.legado.app.databinding.DialogReadBgTextBinding |
|
|
|
import io.legado.app.databinding.DialogReadBgTextBinding |
|
|
|
import io.legado.app.databinding.ItemBgImageBinding |
|
|
|
import io.legado.app.databinding.ItemBgImageBinding |
|
|
|
|
|
|
|
import io.legado.app.help.DefaultData |
|
|
|
import io.legado.app.help.ReadBookConfig |
|
|
|
import io.legado.app.help.ReadBookConfig |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
|
|
|
|
import io.legado.app.lib.dialogs.selector |
|
|
|
import io.legado.app.lib.permission.Permissions |
|
|
|
import io.legado.app.lib.permission.Permissions |
|
|
|
import io.legado.app.lib.permission.PermissionsCompat |
|
|
|
import io.legado.app.lib.permission.PermissionsCompat |
|
|
|
import io.legado.app.lib.theme.bottomBackground |
|
|
|
import io.legado.app.lib.theme.bottomBackground |
|
|
@ -107,12 +109,6 @@ class BgTextConfigDialog : BaseDialogFragment() { |
|
|
|
binding.ivExport.setColorFilter(primaryTextColor) |
|
|
|
binding.ivExport.setColorFilter(primaryTextColor) |
|
|
|
binding.ivDelete.setColorFilter(primaryTextColor) |
|
|
|
binding.ivDelete.setColorFilter(primaryTextColor) |
|
|
|
binding.tvBgImage.setTextColor(primaryTextColor) |
|
|
|
binding.tvBgImage.setTextColor(primaryTextColor) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("InflateParams") |
|
|
|
|
|
|
|
private fun initData() = with(ReadBookConfig.durConfig) { |
|
|
|
|
|
|
|
binding.tvName.text = name.ifBlank { "文字" } |
|
|
|
|
|
|
|
binding.swDarkStatusIcon.isChecked = curStatusIconDark() |
|
|
|
|
|
|
|
adapter = BgAdapter(requireContext(), secondaryTextColor) |
|
|
|
adapter = BgAdapter(requireContext(), secondaryTextColor) |
|
|
|
binding.recyclerView.adapter = adapter |
|
|
|
binding.recyclerView.adapter = adapter |
|
|
|
adapter.addHeaderView { |
|
|
|
adapter.addHeaderView { |
|
|
@ -131,6 +127,12 @@ class BgTextConfigDialog : BaseDialogFragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("InflateParams") |
|
|
|
|
|
|
|
private fun initData() = with(ReadBookConfig.durConfig) { |
|
|
|
|
|
|
|
binding.tvName.text = name.ifBlank { "文字" } |
|
|
|
|
|
|
|
binding.swDarkStatusIcon.isChecked = curStatusIconDark() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("InflateParams") |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
private fun initEvent() = with(ReadBookConfig.durConfig) { |
|
|
|
private fun initEvent() = with(ReadBookConfig.durConfig) { |
|
|
|
binding.ivEdit.setOnClickListener { |
|
|
|
binding.ivEdit.setOnClickListener { |
|
|
@ -148,6 +150,17 @@ class BgTextConfigDialog : BaseDialogFragment() { |
|
|
|
cancelButton() |
|
|
|
cancelButton() |
|
|
|
}.show() |
|
|
|
}.show() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
binding.tvRestore.setOnClickListener { |
|
|
|
|
|
|
|
val defaultConfigs = DefaultData.readConfigs |
|
|
|
|
|
|
|
val layoutNames = defaultConfigs.map { it.name } |
|
|
|
|
|
|
|
selector("选择预设布局", layoutNames) { _, i -> |
|
|
|
|
|
|
|
if (i >= 0) { |
|
|
|
|
|
|
|
ReadBookConfig.durConfig = defaultConfigs[i] |
|
|
|
|
|
|
|
initData() |
|
|
|
|
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
binding.swDarkStatusIcon.setOnCheckedChangeListener { _, isChecked -> |
|
|
|
binding.swDarkStatusIcon.setOnCheckedChangeListener { _, isChecked -> |
|
|
|
setCurStatusIconDark(isChecked) |
|
|
|
setCurStatusIconDark(isChecked) |
|
|
|
(activity as? ReadBookActivity)?.upSystemUiVisibility() |
|
|
|
(activity as? ReadBookActivity)?.upSystemUiVisibility() |
|
|
|