mirror of
https://github.com/home-assistant/android
synced 2024-10-07 00:29:32 +00:00
Fix adding media player widget from settings (#2813)
- Adding a media player widget from settings didn't work because the list used to check that entities have been selected isn't updated immediately, but only on load or in a callback after pinning the widget. To work around this, manually check it before pinning the widget.
This commit is contained in:
parent
db8913c712
commit
af0371fb7b
|
@ -66,7 +66,10 @@ class MediaPlayerControlsWidgetConfigureActivity : BaseWidgetConfigureActivity()
|
|||
|
||||
binding.addButton.setOnClickListener {
|
||||
if (requestLauncherSetup) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && selectedEntities.size > 0) {
|
||||
if (
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
||||
binding.widgetTextConfigEntityId.text.split(",").any { entities[it.trim()] != null }
|
||||
) {
|
||||
getSystemService<AppWidgetManager>()?.requestPinAppWidget(
|
||||
ComponentName(this, MediaPlayerControlsWidget::class.java),
|
||||
null,
|
||||
|
|
Loading…
Reference in a new issue