Add back widget, fix implicit Intent
This commit is contained in:
@@ -93,16 +93,16 @@
|
||||
android:value="true" />
|
||||
</service>
|
||||
|
||||
<!--<receiver android:name=".receiver.WidgetProvider">-->
|
||||
<!--<meta-data-->
|
||||
<!--android:name="android.appwidget.provider"-->
|
||||
<!--android:resource="@xml/app_widget_provider" />-->
|
||||
|
||||
<!--<intent-filter>-->
|
||||
<!--<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />-->
|
||||
<!--<action android:name="com.v2ray.ang.action.widget.click" />-->
|
||||
<!--</intent-filter>-->
|
||||
<!--</receiver>-->
|
||||
<receiver android:name=".receiver.WidgetProvider"
|
||||
android:process=":RunSoLibV2RayDaemon">
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/app_widget_provider" />
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="com.v2ray.ang.action.widget.click" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name=".service.QSTileService"
|
||||
|
||||
@@ -20,7 +20,8 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
super.onUpdate(context, appWidgetManager, appWidgetIds)
|
||||
|
||||
val remoteViews = RemoteViews(context.packageName, R.layout.widget_switch)
|
||||
val intent = Intent(AppConfig.BROADCAST_ACTION_WIDGET_CLICK)
|
||||
val intent = Intent(context, WidgetProvider::class.java)
|
||||
intent.setAction(AppConfig.BROADCAST_ACTION_WIDGET_CLICK)
|
||||
val pendingIntent = PendingIntent.getBroadcast(context, R.id.layout_switch, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
remoteViews.setOnClickPendingIntent(R.id.layout_switch, pendingIntent)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user