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>
This commit is contained in:
Harsh Shandilya 2018-05-06 03:02:22 +05:30 committed by Jason A. Donenfeld
parent 332c35747e
commit e2ab2210cd

View File

@ -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;