Closed PatrykMis closed 1 year ago
According to this: https://developer.android.com/reference/kotlin/android/content/SharedPreferences.OnSharedPreferenceChangeListener
Changing the following line in both RecorderTileService.kt
and SettingsFragment.kt
partially fixes this.
From
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
to
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String?) {
But then:
e: file:///C:/BCR/app/src/main/java/com/chiller3/bcr/settings/SettingsFragment.kt:218:37 Type mismatch: inferred type is String? but String was expected
Thanks for starting to look into this!
I haven't tested, but it's probably because Preferences.isFormatKey(key)
expects a non-null key
. This should be fixable by adding a null check to the top.
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String?) {
when {
key == null -> return
// ...
Regarding API 34, I'm thinking of updating in two phases, compileSdk
first and then targetSdk
. For targetSdk 34
, there will need to be more changes due to new background service changes (which I think I know how to handle).
Also, I won't be merging any API 34-related PRs until the source code is released in AOSP. In the past, the early SDK releases have had a proprietary license. I don't know if that's still the case because I couldn't find a license file for 34, but I'd rather play it safe.
because Preferences.isFormatKey(key) expects a non-null key. This should be fixable by adding a null check to the top.
Exactly. I did that and rebased my PR. I think it can be merged because it makes the code safer and successfully compiles with previous SDKs though.
I think it can be merged because it makes the code safer and successfully compiles with previous SDKs though.
Agreed and merged. Thanks!
Android SDK 34 is already stable. When setting CompileSdkVersion to 34, build failes with errors below.
Changed also AGP to v8.2.0-alpha10 and buildToolsVersion to 34.0.0, although buildToolsVersion does not matter here.
Few other apps compiled successfully, so most probably it isn't SDK issue. Something may have changed but I can't figure out what in this case.