diff --git a/app/app.iml b/app/app.iml
index f8015f8b..16cf64f9 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -42,6 +42,12 @@
+
+
+
+
+
+
@@ -50,12 +56,6 @@
-
-
-
-
-
-
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4f7ee712..087826dc 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -121,7 +121,7 @@
@@ -130,6 +130,16 @@
+
+
+
+
+
+
diff --git a/app/src/main/java/eu/faircode/netguard/ServiceTileGraph.java b/app/src/main/java/eu/faircode/netguard/ServiceTileGraph.java
new file mode 100644
index 00000000..210164f2
--- /dev/null
+++ b/app/src/main/java/eu/faircode/netguard/ServiceTileGraph.java
@@ -0,0 +1,68 @@
+package eu.faircode.netguard;
+
+/*
+ This file is part of NetGuard.
+
+ NetGuard is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ NetGuard is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with NetGuard. If not, see .
+
+ Copyright 2015-2016 by Marcel Bokhorst (M66B)
+*/
+
+
+import android.annotation.TargetApi;
+import android.content.SharedPreferences;
+import android.os.Build;
+import android.preference.PreferenceManager;
+import android.service.quicksettings.Tile;
+import android.service.quicksettings.TileService;
+import android.util.Log;
+
+@TargetApi(Build.VERSION_CODES.N)
+public class ServiceTileGraph extends TileService implements SharedPreferences.OnSharedPreferenceChangeListener {
+ private static final String TAG = "NetGuard.TileGraph";
+
+ public void onStartListening() {
+ Log.i(TAG, "Start listening");
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ prefs.registerOnSharedPreferenceChangeListener(this);
+ boolean stats = prefs.getBoolean("show_stats", false);
+ getQsTile().setState(stats ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
+ getQsTile().updateTile();
+ }
+
+ @Override
+ public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
+ if ("show_stats".equals(key)) {
+ boolean stats = prefs.getBoolean(key, false);
+ getQsTile().setState(stats ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
+ getQsTile().updateTile();
+ }
+ }
+
+ public void onStopListening() {
+ Log.i(TAG, "Stop listening");
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ prefs.unregisterOnSharedPreferenceChangeListener(this);
+ }
+
+ public void onClick() {
+ Log.i(TAG, "Click");
+
+ // Check state
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ boolean stats = !prefs.getBoolean("show_stats", false);
+ prefs.edit().putBoolean("show_stats", stats).apply();
+ ServiceSinkhole.reloadStats("tile", this);
+ }
+}
diff --git a/app/src/main/java/eu/faircode/netguard/ServiceTile.java b/app/src/main/java/eu/faircode/netguard/ServiceTileMain.java
similarity index 91%
rename from app/src/main/java/eu/faircode/netguard/ServiceTile.java
rename to app/src/main/java/eu/faircode/netguard/ServiceTileMain.java
index 11790736..68c8cdaa 100644
--- a/app/src/main/java/eu/faircode/netguard/ServiceTile.java
+++ b/app/src/main/java/eu/faircode/netguard/ServiceTileMain.java
@@ -35,16 +35,8 @@ import android.util.Log;
import java.util.Date;
@TargetApi(Build.VERSION_CODES.N)
-public class ServiceTile extends TileService implements SharedPreferences.OnSharedPreferenceChangeListener {
- private static final String TAG = "NetGuard.Tile";
-
- public void onTileAdded() {
- Log.i(TAG, "Added");
- }
-
- public void onTileRemoved() {
- Log.i(TAG, "Removed");
- }
+public class ServiceTileMain extends TileService implements SharedPreferences.OnSharedPreferenceChangeListener {
+ private static final String TAG = "NetGuard.TileMain";
public void onStartListening() {
Log.i(TAG, "Start listening");