Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Jul 12, 2024
1 parent f519546 commit 285723e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto"
android:versionCode="531"
android:versionCode="532"
android:versionName="1.7.2">

<uses-feature android:name="android.hardware.type.pc" android:required="false" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@ class CelestiaInteraction(context: Context, private val appCore: AppCore, privat
return false
}

// Ignore Back button action
if (event.keyCode == KeyEvent.KEYCODE_BACK)
return false

if (event.action == KeyEvent.ACTION_UP)
return onKeyUp(keyCode, event)
else if (event.action == KeyEvent.ACTION_DOWN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fun Activity.showLoading(title: String, cancelHandler: (() -> Unit)? = null): Al
return builder.show()
}

fun Activity.showAlert(title: String, message: String? = null, handler: (() -> Unit)? = null) {
fun Activity.showAlert(title: String, message: String? = null, handler: (() -> Unit)? = null, cancelHandler: (() -> Unit)? = null) {
if (isFinishing || isDestroyed)
return

Expand All @@ -126,11 +126,16 @@ fun Activity.showAlert(title: String, message: String? = null, handler: (() -> U
if (handler != null)
handler()
}
if (handler != null) {
if (handler != null || cancelHandler != null) {
builder.setNegativeButton(CelestiaString("Cancel", "")) { dialog, _ ->
dialog.cancel()
}
}
if (cancelHandler != null) {
builder.setOnCancelListener {
cancelHandler()
}
}
builder.show()
}

Expand Down

0 comments on commit 285723e

Please sign in to comment.