Quick fix minor warnings from Android Studio (#4406)

- 'getter for isSpeakerphoneOn: Boolean' is deprecated. Deprecated in Java
 - Unnecessary safe call on a non-null receiver of type Intent
 - The corresponding parameter in the supertype 'BaseWidgetConfigureActivity' is named 'savedInstanceState'. This may cause problems when calling this function with named arguments.
This commit is contained in:
Joris Pelgröm 2024-05-15 23:30:54 +02:00 committed by GitHub
parent f6cd119e8e
commit 62673fc7a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 9 deletions

View File

@ -194,8 +194,8 @@ class ButtonWidgetConfigureActivity : BaseWidgetConfigureActivity() {
return "${service.domain}.${service.service}"
}
public override fun onCreate(icicle: Bundle?) {
super.onCreate(icicle)
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Set the result to CANCELED. This will cause the widget host to cancel
// out of the widget placement if the user presses the back button.

View File

@ -54,8 +54,8 @@ class CameraWidgetConfigureActivity : BaseWidgetConfigureActivity() {
private var entityAdapter: SingleItemArrayAdapter<Entity<Any>>? = null
public override fun onCreate(icicle: Bundle?) {
super.onCreate(icicle)
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Set the result to CANCELED. This will cause the widget host to cancel
// out of the widget placement if the user presses the back button.

View File

@ -425,7 +425,7 @@ class EntityWidgetConfigureActivity : BaseWidgetConfigureActivity() {
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
if (intent?.extras != null && intent.hasExtra(PIN_WIDGET_CALLBACK)) {
if (intent.extras != null && intent.hasExtra(PIN_WIDGET_CALLBACK)) {
appWidgetId = intent.extras!!.getInt(
AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID

View File

@ -58,8 +58,8 @@ class MediaPlayerControlsWidgetConfigureActivity : BaseWidgetConfigureActivity()
private var entityAdapter: SingleItemArrayAdapter<Entity<Any>>? = null
public override fun onCreate(icicle: Bundle?) {
super.onCreate(icicle)
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Set the result to CANCELED. This will cause the widget host to cancel
// out of the widget placement if the user presses the back button.

View File

@ -54,8 +54,8 @@ class TemplateWidgetConfigureActivity : BaseWidgetConfigureActivity() {
private var requestLauncherSetup = false
public override fun onCreate(icicle: Bundle?) {
super.onCreate(icicle)
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Set the result to CANCELED. This will cause the widget host to cancel
// out of the widget placement if the user presses the back button.

View File

@ -330,6 +330,8 @@ class AudioSensorManager : SensorManager {
return
}
// Use deprecated function as we can't perfectly map communication device to speakerphone
@Suppress("DEPRECATION")
val isSpeakerOn = audioManager.isSpeakerphoneOn
val icon = if (isSpeakerOn) "mdi:volume-high" else "mdi:volume-off"