summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/android
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-01-06 04:15:36 -0600
committerSamuel Holland <samuel@sholland.org>2018-01-06 05:18:34 -0600
commitdbed7155d611071eae969559be67d75b2996d4a8 (patch)
tree36818698b8ae71ab887d0bf06facd1ec7646b912 /app/src/main/java/com/wireguard/android
parent63efaa2dccef207bfaba745ced7960be98de6bad (diff)
activity: Remove useless indirection
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'app/src/main/java/com/wireguard/android')
-rw-r--r--app/src/main/java/com/wireguard/android/activity/BaseActivity.java10
-rw-r--r--app/src/main/java/com/wireguard/android/activity/MainActivity.java3
-rw-r--r--app/src/main/java/com/wireguard/android/activity/TunnelCreatorActivity.java3
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;
}
}