diff options
author | Samuel Holland <samuel@sholland.org> | 2018-09-05 18:33:42 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-11-11 21:50:23 -0600 |
commit | a264f7ab36bf1335999d53cb4a0d753c54b231d0 (patch) | |
tree | 8adb020e43111ff0420569c16c8c529f69b6a0e5 /app/src/main/java/com/wireguard/android/QuickTileService.java | |
parent | 4e134772d7d2fea02722a87e413947965764fef8 (diff) |
Auto-format the source directories
Blame Jason for writing Java in vim.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/android/QuickTileService.java')
-rw-r--r-- | app/src/main/java/com/wireguard/android/QuickTileService.java | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/app/src/main/java/com/wireguard/android/QuickTileService.java b/app/src/main/java/com/wireguard/android/QuickTileService.java index 28e2b2ee..2463896e 100644 --- a/app/src/main/java/com/wireguard/android/QuickTileService.java +++ b/app/src/main/java/com/wireguard/android/QuickTileService.java @@ -40,9 +40,9 @@ public class QuickTileService extends TileService { private final OnStateChangedCallback onStateChangedCallback = new OnStateChangedCallback(); private final OnTunnelChangedCallback onTunnelChangedCallback = new OnTunnelChangedCallback(); - @Nullable private Tunnel tunnel; - @Nullable private Icon iconOn; @Nullable private Icon iconOff; + @Nullable private Icon iconOn; + @Nullable private Tunnel tunnel; /* This works around an annoying unsolved frameworks bug some people are hitting. */ @Override @@ -58,6 +58,22 @@ public class QuickTileService extends TileService { } @Override + public void onClick() { + if (tunnel != null) { + final Tile tile = getQsTile(); + if (tile != null) { + tile.setIcon(tile.getIcon() == iconOn ? iconOff : iconOn); + tile.updateTile(); + } + tunnel.setState(State.TOGGLE).whenComplete(this::onToggleFinished); + } else { + final Intent intent = new Intent(this, MainActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivityAndCollapse(intent); + } + } + + @Override public void onCreate() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { iconOff = iconOn = Icon.createWithResource(this, R.drawable.ic_tile); @@ -80,22 +96,6 @@ public class QuickTileService extends TileService { } @Override - public void onClick() { - if (tunnel != null) { - final Tile tile = getQsTile(); - if (tile != null) { - tile.setIcon(tile.getIcon() == iconOn ? iconOff : iconOn); - tile.updateTile(); - } - tunnel.setState(State.TOGGLE).whenComplete(this::onToggleFinished); - } else { - final Intent intent = new Intent(this, MainActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivityAndCollapse(intent); - } - } - - @Override public void onStartListening() { Application.getTunnelManager().addOnPropertyChangedCallback(onTunnelChangedCallback); if (tunnel != null) |