[Android] Widgets: fix configuration activity not launched if another activity is

Nicolas Pomepuy git at videolan.org
Wed May 18 09:57:57 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue May 10 13:38:28 2022 +0200| [43603d8e1f329953187689b31c12a16c2b8c88ba] | committer: Duncan McNamara

Widgets: fix configuration activity not launched if another activity is

> https://code.videolan.org/videolan/vlc-android/commit/43603d8e1f329953187689b31c12a16c2b8c88ba
---

 application/vlc-android/AndroidManifest.xml                         | 5 ++++-
 .../src/org/videolan/vlc/widget/MiniPlayerConfigureActivity.kt      | 6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/application/vlc-android/AndroidManifest.xml b/application/vlc-android/AndroidManifest.xml
index 44f9d110f..0b56cdbc0 100644
--- a/application/vlc-android/AndroidManifest.xml
+++ b/application/vlc-android/AndroidManifest.xml
@@ -538,7 +538,10 @@
         <activity
                 android:name=".widget.MiniPlayerConfigureActivity"
                 android:exported="true"
-                android:theme="@style/WidgetConfiguration">
+                android:theme="@style/WidgetConfiguration"
+                android:launchMode="singleInstance"
+                android:noHistory="true"
+                android:excludeFromRecents="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
                 <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
diff --git a/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerConfigureActivity.kt b/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerConfigureActivity.kt
index f8260ac61..ea7fe4c5e 100644
--- a/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerConfigureActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerConfigureActivity.kt
@@ -147,9 +147,9 @@ class MiniPlayerConfigureActivity : BaseActivity() {
         model.widget.value?.let { WidgetCache.clear(it) }
 
         //refresh widget
-        intent.action = MiniPlayerAppWidgetProvider.ACTION_WIDGET_INIT
-        intent.component = ComponentName(this, MiniPlayerAppWidgetProvider::class.java)
-        sendBroadcast(intent)
+        sendBroadcast(Intent(MiniPlayerAppWidgetProvider.ACTION_WIDGET_INIT).apply {
+            component = ComponentName(applicationContext, MiniPlayerAppWidgetProvider::class.java)
+        })
 
         // Make sure we pass back the original appWidgetId
         val resultValue = Intent()



More information about the Android mailing list