Ejemplo n.º 1
0
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   initGameRecyclerView();
   initFab();
   setPresenterView();
   gameListPresenter.onStart();
 }
Ejemplo n.º 2
0
  /**
   * Saving current games loaded to restore them if the view lifecycle is restarted
   *
   * @param outState with current games loaded parcel
   */
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    List<Game> currentGames = gameAdapter.getCurrentGames();

    Parcelable currentGamesParcel = Parcels.wrap(currentGames);
    outState.putParcelable(EXTRA_CURRENT_GAMES_LOADED, currentGamesParcel);
  }
Ejemplo n.º 3
0
  /**
   * Trying to restore games stored when lifecycle got stopped
   *
   * @param savedInstanceState
   */
  @Override
  public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
    super.onViewStateRestored(savedInstanceState);

    if (savedInstanceState != null) {
      Parcelable safeGamesLoadedParcel =
          savedInstanceState.getParcelable(EXTRA_CURRENT_GAMES_LOADED);
      List<Game> safeGamesLoaded = Parcels.unwrap(safeGamesLoadedParcel);
      gameListPresenter.updateViewWithSafeGames(safeGamesLoaded);
    }
  }
Ejemplo n.º 4
0
 @Override
 public void onPause() {
   super.onPause();
   gameListPresenter.onPause();
 }
Ejemplo n.º 5
0
 @Override
 public void onResume() {
   super.onResume();
   gameListPresenter.onResume();
 }