diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 04f3c2010..477671acc 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -79,6 +79,8 @@
+
@@ -291,5 +293,26 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/eu/faircode/netguard/ActivityShortcut.java b/app/src/main/java/eu/faircode/netguard/ActivityShortcut.java
new file mode 100644
index 000000000..c56b6e29e
--- /dev/null
+++ b/app/src/main/java/eu/faircode/netguard/ActivityShortcut.java
@@ -0,0 +1,40 @@
+package eu.faircode.netguard;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.widget.Toast;
+
+import net.kollnig.missioncontrol.R;
+
+public class ActivityShortcut extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ String action = getIntent().getAction();
+ String nextAction = null;
+ String message = null;
+
+ if ("eu.faircode.netguard.SHORTCUT_ON".equals(action)) {
+ nextAction = WidgetAdmin.INTENT_ON;
+ message = getString(R.string.shortcut_on);
+ } else if ("eu.faircode.netguard.SHORTCUT_OFF".equals(action)) {
+ nextAction = WidgetAdmin.INTENT_OFF;
+ message = getString(R.string.shortcut_off);
+ }
+
+ if (nextAction != null) {
+ Intent toggleIntent = new Intent(nextAction);
+ toggleIntent.setPackage(getPackageName());
+ sendBroadcast(toggleIntent);
+
+ if (message != null) {
+ Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ finish();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/eu/faircode/netguard/ReceiverShortcut.java b/app/src/main/java/eu/faircode/netguard/ReceiverShortcut.java
new file mode 100644
index 000000000..0ca2f99f4
--- /dev/null
+++ b/app/src/main/java/eu/faircode/netguard/ReceiverShortcut.java
@@ -0,0 +1,45 @@
+package eu.faircode.netguard;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.widget.Toast;
+
+import androidx.preference.PreferenceManager;
+
+import net.kollnig.missioncontrol.R;
+
+public class ReceiverShortcut extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ String nextAction = null;
+ String message = null;
+
+ if ("eu.faircode.netguard.SHORTCUT_ON".equals(action)) {
+ nextAction = WidgetAdmin.INTENT_ON;
+ message = context.getString(R.string.shortcut_on);
+ } else if ("eu.faircode.netguard.SHORTCUT_OFF".equals(action)) {
+ nextAction = WidgetAdmin.INTENT_OFF;
+ message = context.getString(R.string.shortcut_off);
+ } else {
+ // Fallback to toggle if needed
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ boolean enabled = prefs.getBoolean("enabled", false);
+ nextAction = (enabled ? WidgetAdmin.INTENT_OFF : WidgetAdmin.INTENT_ON);
+ message = context.getString(enabled ? R.string.shortcut_off : R.string.shortcut_on);
+ }
+
+ if (nextAction != null) {
+ Intent toggleIntent = new Intent(nextAction);
+ toggleIntent.setPackage(context.getPackageName());
+ context.sendBroadcast(toggleIntent);
+
+ if (message != null) {
+ Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index dddf92ce2..f8d15172c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -652,4 +652,7 @@ Sincerely,\n\n]]>
Invalid URL
Failed to apply host files
Last update: %s
+
+ Protection ON
+ Protection OFF
diff --git a/app/src/main/res/xml/shortcuts.xml b/app/src/main/res/xml/shortcuts.xml
new file mode 100644
index 000000000..5db2b3e35
--- /dev/null
+++ b/app/src/main/res/xml/shortcuts.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file