Avoid and supress warnings

This commit is contained in:
Juha Heinanen
2023-10-12 19:19:41 +03:00
parent 0ff1d00955
commit b958651fe9

View File

@ -890,7 +890,7 @@ object Utils {
}
}
fun bitmapFromView(view: View): Bitmap? {
fun bitmapFromView(view: View): Bitmap {
val bitmap = Bitmap.createBitmap(view.layoutParams.width, view.layoutParams.height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
view.layout(0, 0, view.layoutParams.width, view.layoutParams.height)
@ -902,6 +902,7 @@ object Utils {
return if (Build.VERSION.SDK_INT >= 31)
am.communicationDevice!!.type == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER
else
@Suppress("DEPRECATION")
am.isSpeakerphoneOn
}
@ -965,8 +966,9 @@ object Utils {
Log.d(TAG, "New com device/mode is ${am.communicationDevice!!.type}/${am.mode}")
}
} else {
@Suppress("DEPRECATION")
am.isSpeakerphoneOn = enable
Log.d(TAG, "Speakerphone is ${am.isSpeakerphoneOn}")
Log.d(TAG, "Speakerphone is $enable")
}
}
@ -977,6 +979,7 @@ object Utils {
else if (am.communicationDevice!!.type == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER)
setSpeakerPhone(executor, am, false)
} else {
@Suppress("DEPRECATION")
setSpeakerPhone(executor, am, !am.isSpeakerphoneOn)
}
}
@ -997,6 +1000,7 @@ object Utils {
if (Build.VERSION.SDK_INT >= 31) {
am.clearCommunicationDevice()
} else {
@Suppress("DEPRECATION")
if (am.isSpeakerphoneOn)
am.isSpeakerphoneOn = false
}