summaryrefslogtreecommitdiffhomepage
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <harsh@prjkt.io>2018-07-15 17:10:38 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2018-07-16 17:31:14 +0200
commitc6dd48330e98cff3ae077f85c0422d4faf5b7215 (patch)
tree679e9cc06b8d257c9b52f60dc75ceee08d27a02b /app/src/main
parent6076083361082037e64540df7560acc8f21c0e95 (diff)
android: QuickTileService: Do not use slashed icon on Android P
Android P features circle masked QS tiles which make use of colors to denote STATE_ACTIVE/STATE_INACTIVE rather than a slash across the drawable as seen on Android Oreo. Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/wireguard/android/QuickTileService.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/app/src/main/java/com/wireguard/android/QuickTileService.java b/app/src/main/java/com/wireguard/android/QuickTileService.java
index 8630ccfd..fba8f57e 100644
--- a/app/src/main/java/com/wireguard/android/QuickTileService.java
+++ b/app/src/main/java/com/wireguard/android/QuickTileService.java
@@ -55,12 +55,17 @@ public class QuickTileService extends TileService {
icon.setBounds(0, 0, c.getWidth(), c.getHeight());
icon.draw(c);
iconOn = Icon.createWithBitmap(b);
- icon.setSlashed(true);
- b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
- c = new Canvas(b);
- icon.setBounds(0, 0, c.getWidth(), c.getHeight());
- icon.draw(c);
- iconOff = Icon.createWithBitmap(b);
+ /* TODO(msf): Change this to an explicit test for P when we start targetting SDK 28 */
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1) {
+ iconOff = iconOn;
+ } else {
+ icon.setSlashed(true);
+ b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
+ c = new Canvas(b);
+ icon.setBounds(0, 0, c.getWidth(), c.getHeight());
+ icon.draw(c);
+ iconOff = Icon.createWithBitmap(b);
+ }
}
@Override