fix crash

This commit is contained in:
Milos Kozak 2022-09-22 12:34:03 +02:00
parent b38cb58338
commit 9bdebd7667

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.utils.ui
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Service import android.app.Service
import android.content.Context import android.content.Context
import android.os.Build
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.os.Message import android.os.Message
@ -146,7 +147,10 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager .getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
if (manager.isEnabled) { if (manager.isEnabled) {
val valueDescription = formatter?.format(currentValue) val valueDescription = formatter?.format(currentValue)
AccessibilityEvent().apply { @Suppress("DEPRECATION")
(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) AccessibilityEvent()
else AccessibilityEvent.obtain())
.apply {
eventType = AccessibilityEvent.TYPE_ANNOUNCEMENT eventType = AccessibilityEvent.TYPE_ANNOUNCEMENT
className = javaClass.name className = javaClass.name
packageName = context.packageName packageName = context.packageName