diff options
author | Harsh Shandilya <harsh@prjkt.io> | 2018-05-06 03:02:22 +0530 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-09 18:16:09 +0200 |
commit | a524d531e49b8c1c818c7db183914b45f97a7aee (patch) | |
tree | 0f2de0ba663b5f320ef04570bb15d7154a90dd1e /app/src/main/java | |
parent | 83d70cf960764c1715ba20c307af8c9bc4ee9462 (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 <harsh@prjkt.io>
Diffstat (limited to 'app/src/main/java')
-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; |