|
|
@ -8,6 +8,7 @@ import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.utils.getPrefInt |
|
|
|
import io.legado.app.utils.getPrefInt |
|
|
|
import io.legado.app.utils.hideSoftInput |
|
|
|
import io.legado.app.utils.hideSoftInput |
|
|
|
import io.legado.app.utils.putPrefInt |
|
|
|
import io.legado.app.utils.putPrefInt |
|
|
|
|
|
|
|
import io.legado.app.utils.removePref |
|
|
|
import kotlinx.android.synthetic.main.dialog_page_key.* |
|
|
|
import kotlinx.android.synthetic.main.dialog_page_key.* |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
|
|
|
|
|
|
|
@ -19,11 +20,17 @@ class PageKeyDialog(context: Context) : Dialog(context, R.style.AppTheme_AlertDi |
|
|
|
et_prev.setText(context.getPrefInt(PreferKey.prevKey).toString()) |
|
|
|
et_prev.setText(context.getPrefInt(PreferKey.prevKey).toString()) |
|
|
|
et_next.setText(context.getPrefInt(PreferKey.nextKey).toString()) |
|
|
|
et_next.setText(context.getPrefInt(PreferKey.nextKey).toString()) |
|
|
|
tv_ok.onClick { |
|
|
|
tv_ok.onClick { |
|
|
|
et_prev.text?.let { |
|
|
|
val prevKey = et_prev.text?.toString() |
|
|
|
context.putPrefInt(PreferKey.prevKey, it.toString().toInt()) |
|
|
|
if (prevKey.isNullOrEmpty()) { |
|
|
|
} |
|
|
|
context.removePref(PreferKey.prevKey) |
|
|
|
et_next.text?.let { |
|
|
|
} else { |
|
|
|
context.putPrefInt(PreferKey.nextKey, it.toString().toInt()) |
|
|
|
context.putPrefInt(PreferKey.prevKey, prevKey.toInt()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
val nextKey = et_next.text?.toString() |
|
|
|
|
|
|
|
if (nextKey.isNullOrEmpty()) { |
|
|
|
|
|
|
|
context.removePref(PreferKey.nextKey) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
context.putPrefInt(PreferKey.nextKey, nextKey.toInt()) |
|
|
|
} |
|
|
|
} |
|
|
|
dismiss() |
|
|
|
dismiss() |
|
|
|
} |
|
|
|
} |
|
|
|