|
|
@ -10,6 +10,7 @@ import io.legado.app.lib.theme.backgroundColor |
|
|
|
import io.legado.app.utils.getPrefString |
|
|
|
import io.legado.app.utils.getPrefString |
|
|
|
import io.legado.app.utils.hideSoftInput |
|
|
|
import io.legado.app.utils.hideSoftInput |
|
|
|
import io.legado.app.utils.putPrefString |
|
|
|
import io.legado.app.utils.putPrefString |
|
|
|
|
|
|
|
import splitties.views.onClick |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PageKeyDialog(context: Context) : Dialog(context, R.style.AppTheme_AlertDialog) { |
|
|
|
class PageKeyDialog(context: Context) : Dialog(context, R.style.AppTheme_AlertDialog) { |
|
|
@ -18,15 +19,21 @@ class PageKeyDialog(context: Context) : Dialog(context, R.style.AppTheme_AlertDi |
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
setContentView(binding.root) |
|
|
|
setContentView(binding.root) |
|
|
|
binding.contentView.setBackgroundColor(context.backgroundColor) |
|
|
|
binding.run { |
|
|
|
binding.etPrev.setText(context.getPrefString(PreferKey.prevKeys)) |
|
|
|
contentView.setBackgroundColor(context.backgroundColor) |
|
|
|
binding.etNext.setText(context.getPrefString(PreferKey.nextKeys)) |
|
|
|
etPrev.setText(context.getPrefString(PreferKey.prevKeys)) |
|
|
|
binding.tvOk.setOnClickListener { |
|
|
|
etNext.setText(context.getPrefString(PreferKey.nextKeys)) |
|
|
|
context.putPrefString(PreferKey.prevKeys, binding.etPrev.text?.toString()) |
|
|
|
tvReset.onClick { |
|
|
|
context.putPrefString(PreferKey.nextKeys, binding.etNext.text?.toString()) |
|
|
|
etPrev.setText("") |
|
|
|
|
|
|
|
etNext.setText("") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
tvOk.setOnClickListener { |
|
|
|
|
|
|
|
context.putPrefString(PreferKey.prevKeys, etPrev.text?.toString()) |
|
|
|
|
|
|
|
context.putPrefString(PreferKey.nextKeys, etNext.text?.toString()) |
|
|
|
dismiss() |
|
|
|
dismiss() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { |
|
|
|
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { |
|
|
|
if (keyCode != KeyEvent.KEYCODE_BACK && keyCode != KeyEvent.KEYCODE_DEL) { |
|
|
|
if (keyCode != KeyEvent.KEYCODE_BACK && keyCode != KeyEvent.KEYCODE_DEL) { |
|
|
|