a bit more code shortening

This commit is contained in:
tibbi 2021-08-15 23:25:37 +02:00
parent 73aaf290f9
commit 37b9699276
1 changed files with 2 additions and 6 deletions

View File

@ -100,9 +100,7 @@ class ReadTextActivity : SimpleActivity() {
override fun onBackPressed() {
val hasUnsavedChanges = originalText != read_text_view.text.toString()
when {
isSearchActive -> {
closeSearch()
}
isSearchActive -> closeSearch()
hasUnsavedChanges && System.currentTimeMillis() - lastSavePromptTS > SAVE_DISCARD_PROMPT_INTERVAL -> {
lastSavePromptTS = System.currentTimeMillis()
ConfirmationAdvancedDialog(this, "", R.string.save_before_closing, R.string.save, R.string.discard) {
@ -113,9 +111,7 @@ class ReadTextActivity : SimpleActivity() {
}
}
}
else -> {
super.onBackPressed()
}
else -> super.onBackPressed()
}
}