From 32c2a17a7f0997c50ce82d6f7d6dcf2dd3a829f8 Mon Sep 17 00:00:00 2001 From: ai03 Date: Thu, 11 Nov 2021 22:25:59 +0900 Subject: [PATCH 1/2] Add Android 12 style subtitle display --- .../java/n/eus/wifiqs/WifiTileService.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/n/eus/wifiqs/WifiTileService.java b/app/src/main/java/n/eus/wifiqs/WifiTileService.java index 68aa029..0ab7563 100644 --- a/app/src/main/java/n/eus/wifiqs/WifiTileService.java +++ b/app/src/main/java/n/eus/wifiqs/WifiTileService.java @@ -25,17 +25,32 @@ public void onWifiStateChanged(WifiState state, String ssid) { switch (state) { case DISABLED: tile.setIcon(Icon.createWithResource(this, R.drawable.disabled)); - tile.setLabel("OFF"); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + tile.setLabel("Wi-Fi"); + tile.setSubtitle(("Off")); + } else { + tile.setLabel("OFF"); + } tile.setState(Tile.STATE_INACTIVE); break; case ENABLED: tile.setIcon(Icon.createWithResource(this, R.drawable.enabled)); - tile.setLabel("ON"); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + tile.setLabel("Wi-Fi"); + tile.setSubtitle(("Disconnected")); + } else { + tile.setLabel("ON"); + } tile.setState(Tile.STATE_ACTIVE); break; case CONNECTED: tile.setIcon(Icon.createWithResource(this, R.drawable.connected)); - tile.setLabel(ssid != null ? ssid : "CONNECTED"); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + tile.setLabel(("Wi-Fi")); + tile.setSubtitle(ssid != null ? ssid : "Connected"); + } else { + tile.setLabel(ssid != null ? ssid : "Connected"); + } tile.setState(Tile.STATE_ACTIVE); break; } From fad9e10d4060b23f305a267d5ceacc00fcda061d Mon Sep 17 00:00:00 2001 From: ai03 Date: Thu, 11 Nov 2021 22:32:11 +0900 Subject: [PATCH 2/2] Add missing import --- app/src/main/java/n/eus/wifiqs/WifiTileService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/n/eus/wifiqs/WifiTileService.java b/app/src/main/java/n/eus/wifiqs/WifiTileService.java index 0ab7563..1807529 100644 --- a/app/src/main/java/n/eus/wifiqs/WifiTileService.java +++ b/app/src/main/java/n/eus/wifiqs/WifiTileService.java @@ -4,6 +4,7 @@ import android.net.wifi.WifiManager; import android.service.quicksettings.Tile; import android.service.quicksettings.TileService; +import android.os.Build; public class WifiTileService extends TileService implements WifiStateListener { WifiStateReceiver wifiStateReceiver;