mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-25 23:35:29 +03:00
Use AndroidX use
extension function instead of Kotlin built-in one
The Kotlin built-in `use` extension function applies to `AutoCloseable` only, and throws an error if the object it's being called on is not an `AutoCloseable`. This causes `OnScreenView` to fail to inflate on SDK < 31 as it retrieved the current theme primary color with a `TypedArray`, which only implements `AutoCloseable` since SDK 31 (Android 12). The AndroidX core library provides a `use` extension function that applies to `TypeArray` instead of `AutoCloseable` so the fix is just a simple import.
This commit is contained in:
parent
cce4b3f89a
commit
b7548e51cf
@ -16,6 +16,7 @@ import android.graphics.drawable.GradientDrawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.util.TypedValue
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.use
|
||||
import emu.skyline.R
|
||||
import emu.skyline.input.ButtonId
|
||||
import kotlin.math.roundToInt
|
||||
|
@ -21,6 +21,7 @@ import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.View.OnTouchListener
|
||||
import androidx.annotation.IntRange
|
||||
import androidx.core.content.res.use
|
||||
import emu.skyline.R
|
||||
import emu.skyline.input.ButtonId
|
||||
import emu.skyline.input.ButtonState
|
||||
|
@ -13,6 +13,7 @@ import android.graphics.Rect
|
||||
import android.graphics.RectF
|
||||
import android.graphics.Typeface
|
||||
import android.os.SystemClock
|
||||
import androidx.core.content.res.use
|
||||
import androidx.core.graphics.minus
|
||||
import emu.skyline.R
|
||||
import emu.skyline.input.ButtonId
|
||||
|
Loading…
Reference in New Issue
Block a user