state: fix restoring when the loadables werent actually deserialized

refactor-toolbar
Floens 8 years ago
parent 125ef9e959
commit a6d5805683
  1. 15
      Clover/app/src/main/java/org/floens/chan/ui/activity/StartActivity.java

@ -232,10 +232,19 @@ public class StartActivity extends AppCompatActivity implements NfcAdapter.Creat
state.thread.site = site; state.thread.site = site;
state.thread.board = board; state.thread.board = board;
Loadable boardLoadable = loadableManager.get(state.board); // When restarting the parcelable isn't actually deserialized, but the same object
Loadable threadLoadable = loadableManager.get(state.thread); // instance is reused. This means that the loadables we gave to the state are
// the same instance, and also have the id set etc. We don't need to query
// these from the loadablemanager.
Loadable threadLoadable;
if (state.thread.id == 0) {
threadLoadable = loadableManager.get(state.thread);
} else {
threadLoadable = state.thread;
}
return new Pair<>(boardLoadable, threadLoadable.mode == Loadable.Mode.THREAD ? threadLoadable : null); return new Pair<>(state.board,
threadLoadable.mode == Loadable.Mode.THREAD ? threadLoadable : null);
} }
} }

Loading…
Cancel
Save