mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-07-11 01:24:22 +02:00
Android: Silence deprecation warnings in ControllerInterface
We have to use the deprecated APIs when running on old devices.
This commit is contained in:
+4
@@ -160,6 +160,7 @@ object ControllerInterface {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
DolphinVibratorManagerPassthrough(device.vibratorManager)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
DolphinVibratorManagerCompat(device.vibrator)
|
||||
}
|
||||
}
|
||||
@@ -174,6 +175,7 @@ object ControllerInterface {
|
||||
return DolphinVibratorManagerPassthrough(vibratorManager)
|
||||
}
|
||||
}
|
||||
@Suppress("DEPRECATION")
|
||||
val vibrator = DolphinApplication.getAppContext()
|
||||
.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
|
||||
return DolphinVibratorManagerCompat(vibrator)
|
||||
@@ -190,11 +192,13 @@ object ControllerInterface {
|
||||
} else {
|
||||
val attributes = AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_MEDIA).build()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
@Suppress("DEPRECATION")
|
||||
vibrator.vibrate(
|
||||
VibrationEffect.createOneShot(100, VibrationEffect.DEFAULT_AMPLITUDE),
|
||||
attributes
|
||||
)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
vibrator.vibrate(100, attributes)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user