Helper: implement keyboard navigation help popup

pull/317/head
Georg Lukas 2021-10-14 09:36:53 +02:00
rodzic 00cd675550
commit 7d63e7967e
2 zmienionych plików z 26 dodań i 0 usunięć

Wyświetl plik

@ -356,6 +356,15 @@
<string name="p_themefile_choose">Choose theme file</string>
<string name="themefile_error">Error loading theme file %s!</string>
<string name="kbdnav_title">Keyboard Navigation</string>
<!-- keyboard navigation info -->
<string-array name="kbdnav_lines">
<item>move map</item>
<item>zoom</item>
<item>menu</item>
<item>select</item>
</string-array>
<string name="translator_credits">translator-credits</string>
<!-- Bluetooth TNC settings -->

Wyświetl plik

@ -137,6 +137,23 @@ trait UIHelper extends Activity
passcodeDialog.show()
}
def keyboardNavDialog() {
if (getPackageManager().hasSystemFeature("android.hardware.touchscreen"))
return
if (prefs.getBoolean("kbdnav_shown", false))
return
prefs.prefs.edit().putBoolean("kbdnav_shown", true).commit()
val keys = Array("⬅➡⬆⬇", "⏪⏩", "⏯️", "⏎🆗")
val titles = getResources().getStringArray(R.array.kbdnav_lines)
val text = keys zip titles map { case (k, v) => "%s\t%s".format(k, v) } mkString("\n")
new AlertDialog.Builder(this).setTitle(R.string.kbdnav_title)
.setMessage(text)
.setIcon(android.R.drawable.ic_dialog_info)
.setPositiveButton(android.R.string.ok, null)
.create.show
}
def setTitleStatus() {
if (AprsService.link_error != 0) {
setTitle(getString(R.string.status_linkoff, getString(AprsService.link_error)))