summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-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;
}
}