diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 38ebc66..8ec98fc 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -6,12 +6,12 @@ plugins { android { namespace = "net.mezimmah.wkt9" - compileSdk = 33 + compileSdk = 34 defaultConfig { applicationId = "net.mezimmah.wkt9" - minSdk = 31 - targetSdk = 33 + minSdk = 30 + targetSdk = 34 versionCode = 1 versionName = "1.0" diff --git a/app/src/main/java/net/mezimmah/wkt9/WKT9.kt b/app/src/main/java/net/mezimmah/wkt9/WKT9.kt index a66aeda..57e648c 100644 --- a/app/src/main/java/net/mezimmah/wkt9/WKT9.kt +++ b/app/src/main/java/net/mezimmah/wkt9/WKT9.kt @@ -109,7 +109,9 @@ class WKT9: InputMethodService(), SpellCheckerSession.SpellCheckerSessionListene val inputMethodManager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager val inputMethodSubtype = inputMethodManager.currentInputMethodSubtype - locale = Locale.forLanguageTag(inputMethodSubtype.languageTag) + locale = inputMethodSubtype?.let { + Locale.forLanguageTag(it.languageTag) + } ?: Locale.forLanguageTag("en-US") Log.d(tag, "WKT9 is loading: $locale") @@ -353,7 +355,7 @@ class WKT9: InputMethodService(), SpellCheckerSession.SpellCheckerSessionListene lastComposedString = null } - if (allowSuggestions) Log.d(tag, "History: ${commitHistory.toString()}") + if (allowSuggestions) Log.d(tag, "History: $commitHistory") updateInputStatus() @@ -525,6 +527,7 @@ class WKT9: InputMethodService(), SpellCheckerSession.SpellCheckerSessionListene handleComposeTimeout(this.timeout) } + @Suppress("DEPRECATION") private fun onRecord() { // The recorder must be busy... if (recorder !== null || !isInputViewShown) return @@ -539,7 +542,7 @@ class WKT9: InputMethodService(), SpellCheckerSession.SpellCheckerSessionListene val duration = Toast.LENGTH_SHORT // Instantiate recorder and start recording - recorder = MediaRecorder(this).also { + recorder = MediaRecorder().also { recording = File.createTempFile("recording.3gp", null, cacheDir) it.setAudioSource(MediaRecorder.AudioSource.MIC)