diff options
author | Samuel Holland <samuel@sholland.org> | 2018-01-06 04:15:36 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-01-06 05:18:34 -0600 |
commit | 3412e34a8ec5629083603a14b745086dfd7ba9b3 (patch) | |
tree | 36818698b8ae71ab887d0bf06facd1ec7646b912 /app/src | |
parent | 6057ac8e5e683389014b4393a99e548a6c12c149 (diff) |
activity: Remove useless indirection
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'app/src')
3 files changed, 6 insertions, 10 deletions
diff --git a/app/src/main/java/com/wireguard/android/activity/BaseActivity.java b/app/src/main/java/com/wireguard/android/activity/BaseActivity.java index 4bd3407e..3a6941b9 100644 --- a/app/src/main/java/com/wireguard/android/activity/BaseActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/BaseActivity.java @@ -53,7 +53,7 @@ public abstract class BaseActivity extends Activity { super.onSaveInstanceState(outState); } - protected abstract Tunnel onSelectedTunnelChanged(Tunnel oldTunnel, Tunnel newTunnel); + protected abstract void onSelectedTunnelChanged(Tunnel oldTunnel, Tunnel newTunnel); public void removeOnSelectedTunnelChangedListener( final OnSelectedTunnelChangedListener listener) { @@ -64,11 +64,9 @@ public abstract class BaseActivity extends Activity { final Tunnel oldTunnel = selectedTunnel; if (Objects.equals(oldTunnel, tunnel)) return; - // Give the activity a chance to override the tunnel change. - selectedTunnel = onSelectedTunnelChanged(oldTunnel, tunnel); - if (Objects.equals(oldTunnel, selectedTunnel)) - return; - selectionChangeRegistry.notifyCallbacks(oldTunnel, 0, selectedTunnel); + selectedTunnel = tunnel; + onSelectedTunnelChanged(oldTunnel, tunnel); + selectionChangeRegistry.notifyCallbacks(oldTunnel, 0, tunnel); } public interface OnSelectedTunnelChangedListener { diff --git a/app/src/main/java/com/wireguard/android/activity/MainActivity.java b/app/src/main/java/com/wireguard/android/activity/MainActivity.java index 2d06a9a9..e13438d9 100644 --- a/app/src/main/java/com/wireguard/android/activity/MainActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/MainActivity.java @@ -120,9 +120,8 @@ public class MainActivity extends BaseActivity { @Override - protected Tunnel onSelectedTunnelChanged(final Tunnel oldTunnel, final Tunnel newTunnel) { + protected void onSelectedTunnelChanged(final Tunnel oldTunnel, final Tunnel newTunnel) { moveToState(newTunnel != null ? State.DETAIL : State.LIST); - return newTunnel; } private enum State { diff --git a/app/src/main/java/com/wireguard/android/activity/TunnelCreatorActivity.java b/app/src/main/java/com/wireguard/android/activity/TunnelCreatorActivity.java index 2e0454ee..9a5f4e0a 100644 --- a/app/src/main/java/com/wireguard/android/activity/TunnelCreatorActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/TunnelCreatorActivity.java @@ -21,8 +21,7 @@ public class TunnelCreatorActivity extends BaseActivity { } @Override - protected Tunnel onSelectedTunnelChanged(final Tunnel oldTunnel, final Tunnel newTunnel) { + protected void onSelectedTunnelChanged(final Tunnel oldTunnel, final Tunnel newTunnel) { finish(); - return null; } } |