From a2a6f2cb0c8ec3793866cf67730b3c1648b6c468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Mon, 30 Sep 2024 21:11:55 +0200 Subject: [PATCH] TestActivity: show key presses (#515) --- app/src/main/java/org/koreader/launcher/TestActivity.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/org/koreader/launcher/TestActivity.kt b/app/src/main/java/org/koreader/launcher/TestActivity.kt index 040fb579c..b93b25d9d 100644 --- a/app/src/main/java/org/koreader/launcher/TestActivity.kt +++ b/app/src/main/java/org/koreader/launcher/TestActivity.kt @@ -3,6 +3,7 @@ package org.koreader.launcher import android.graphics.Point import android.text.method.LinkMovementMethod import android.util.Log +import android.view.KeyEvent import android.widget.ArrayAdapter import android.widget.Toast import androidx.appcompat.app.AppCompatActivity @@ -145,6 +146,13 @@ class TestActivity: AppCompatActivity() { super.onDestroy() Log.i(tag, MARKER_END) } + + override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + val msg = String.format("Pressed: %d", keyCode) + Toast.makeText(this, msg, Toast.LENGTH_SHORT).show() + return super.onKeyDown(keyCode, event) + } + private fun runLights(id: String) { lightsMap[id]?.let { driver -> Log.i(tag, String.format("running lights test: %s", id))