Avoid and supress warnings

This commit is contained in:
Juha Heinanen
2023-10-12 19:19:41 +03:00
parent 0ff1d00955
commit b958651fe9
@@ -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 bitmap = Bitmap.createBitmap(view.layoutParams.width, view.layoutParams.height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap) val canvas = Canvas(bitmap)
view.layout(0, 0, view.layoutParams.width, view.layoutParams.height) view.layout(0, 0, view.layoutParams.width, view.layoutParams.height)
@@ -902,6 +902,7 @@ object Utils {
return if (Build.VERSION.SDK_INT >= 31) return if (Build.VERSION.SDK_INT >= 31)
am.communicationDevice!!.type == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER am.communicationDevice!!.type == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER
else else
@Suppress("DEPRECATION")
am.isSpeakerphoneOn am.isSpeakerphoneOn
} }
@@ -965,8 +966,9 @@ object Utils {
Log.d(TAG, "New com device/mode is ${am.communicationDevice!!.type}/${am.mode}") Log.d(TAG, "New com device/mode is ${am.communicationDevice!!.type}/${am.mode}")
} }
} else { } else {
@Suppress("DEPRECATION")
am.isSpeakerphoneOn = enable 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) else if (am.communicationDevice!!.type == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER)
setSpeakerPhone(executor, am, false) setSpeakerPhone(executor, am, false)
} else { } else {
@Suppress("DEPRECATION")
setSpeakerPhone(executor, am, !am.isSpeakerphoneOn) setSpeakerPhone(executor, am, !am.isSpeakerphoneOn)
} }
} }
@@ -997,6 +1000,7 @@ object Utils {
if (Build.VERSION.SDK_INT >= 31) { if (Build.VERSION.SDK_INT >= 31) {
am.clearCommunicationDevice() am.clearCommunicationDevice()
} else { } else {
@Suppress("DEPRECATION")
if (am.isSpeakerphoneOn) if (am.isSpeakerphoneOn)
am.isSpeakerphoneOn = false am.isSpeakerphoneOn = false
} }