Skip to content

Commit

Permalink
Quick fix minor warnings from Android Studio (#4406)
Browse files Browse the repository at this point in the history
- '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.
  • Loading branch information
jpelgrom authored May 15, 2024
1 parent f6cd119 commit 62673fc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 62673fc

Please sign in to comment.