diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2018-05-06 03:02:22 +0530 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-09 18:16:09 +0200 |
commit | e2ab2210cdda2d598c213f07dbc1d1199499ffd3 (patch) | |
tree | 0f2de0ba663b5f320ef04570bb15d7154a90dd1e /app/src/main/java/com/wireguard/android | |
parent | 332c35747ed8376097a010ee111915746a4825dc (diff) |
MainActivity: Nip out as early as possible when moving to same fragment
Save the useless logging and fragment manager object creation.
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/wireguard/android')
-rw-r--r-- | app/src/main/java/com/wireguard/android/activity/MainActivity.java | 6 |
1 files changed, 3 insertions, 3 deletions
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 9494dd22..21bec130 100644 --- a/app/src/main/java/com/wireguard/android/activity/MainActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/MainActivity.java @@ -35,11 +35,11 @@ public class MainActivity extends BaseActivity { private State state = State.EMPTY; private boolean moveToState(final State nextState) { + if (state == nextState) + return false; final FragmentManager fragmentManager = getSupportFragmentManager(); Log.i(TAG, "Moving from " + state.name() + " to " + nextState.name()); - if (nextState == state) { - return false; - } else if (nextState.layer > state.layer + 1) { + if (nextState.layer > state.layer + 1) { moveToState(State.ofLayer(state.layer + 1)); moveToState(nextState); return true; |