1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-01-01 12:54:07 +00:00

Attempt to fix disabling other VPNs

This commit is contained in:
M66B 2017-04-17 08:25:09 +02:00
parent 7d80aaf61d
commit f399b46e3d
2 changed files with 2 additions and 12 deletions

View file

@ -45,12 +45,7 @@ public class WidgetLockdown extends AppWidgetProvider {
try {
try {
PendingIntent pi;
if (VpnService.prepare(context) == null)
pi = PendingIntent.getBroadcast(context, 0, new Intent(lockdown ? WidgetAdmin.INTENT_LOCKDOWN_OFF : WidgetAdmin.INTENT_LOCKDOWN_ON), PendingIntent.FLAG_UPDATE_CURRENT);
else
pi = PendingIntent.getActivity(context, 0, new Intent(context, ActivityMain.class), PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent pi = PendingIntent.getBroadcast(context, 0, new Intent(lockdown ? WidgetAdmin.INTENT_LOCKDOWN_OFF : WidgetAdmin.INTENT_LOCKDOWN_ON), PendingIntent.FLAG_UPDATE_CURRENT);
for (int id : appWidgetIds) {
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widgetlockdown);
views.setOnClickPendingIntent(R.id.ivEnabled, pi);

View file

@ -45,12 +45,7 @@ public class WidgetMain extends AppWidgetProvider {
try {
try {
PendingIntent pi;
if (VpnService.prepare(context) == null)
pi = PendingIntent.getBroadcast(context, 0, new Intent(enabled ? WidgetAdmin.INTENT_OFF : WidgetAdmin.INTENT_ON), PendingIntent.FLAG_UPDATE_CURRENT);
else
pi = PendingIntent.getActivity(context, 0, new Intent(context, ActivityMain.class), PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent pi = PendingIntent.getBroadcast(context, 0, new Intent(enabled ? WidgetAdmin.INTENT_OFF : WidgetAdmin.INTENT_ON), PendingIntent.FLAG_UPDATE_CURRENT);
for (int id : appWidgetIds) {
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widgetmain);
views.setOnClickPendingIntent(R.id.ivEnabled, pi);