From fce899978d2f0c28945a35a7ee0696328951af96 Mon Sep 17 00:00:00 2001 From: Eoin Mcloughlin Date: Sun, 17 May 2020 16:40:41 +0100 Subject: [PATCH] Don't jump to result scren after leaving activity --- app/src/main/java/es/eoinrul/ecwt/TrainingActivity.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/es/eoinrul/ecwt/TrainingActivity.kt b/app/src/main/java/es/eoinrul/ecwt/TrainingActivity.kt index cb196d3..c08361f 100644 --- a/app/src/main/java/es/eoinrul/ecwt/TrainingActivity.kt +++ b/app/src/main/java/es/eoinrul/ecwt/TrainingActivity.kt @@ -52,6 +52,8 @@ class TrainingActivity : AppCompatActivity(), val imm = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0); } + + mLessonStarted = false } override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { @@ -75,6 +77,11 @@ class TrainingActivity : AppCompatActivity(), } override fun streamFinished(stream: DitDahSoundStream) { + if(!mLessonStarted) { + // Don't do anything if we've stopped the activity + return + } + // The lesson text has an extra space at the end, which we don't want to grade var lessonText = mLessonText.trim() // The input text has a leading space that we don't want to grade