Skip to content

MrBlackk/Alias_android_mvp

Repository files navigation

Screens

UML

StartActivity class - calling presenter methods

public class StartActivity extends AppCompatActivity implements StartView {
  Button btnNewGame;
  private StartPresenter presenter;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
  ...
  presenter = new StartPresenterImpl(this);
  presenter.onStart();
  ...
  }
  
  protected void runListeners() {
    btnNewGame.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            presenter.onNewGameButtonClick();
        }
    });
    ...
  }
  
  @Override
  public void onBackPressed() {
    presenter.onBackButtonPressed();
  }
}

StartPresenterImpl class - calling startView methods

public class StartPresenterImpl implements StartPresenter {
  StartView startView;
  
  public StartPresenterImpl(StartView startView) {
    this.startView = startView;
    ...
  }
  
  @Override
  public void onStart() {
    if(!game.isStarted())
        startView.hideContinueButton();
  }
  
  @Override
  public void onNewGameButtonClick() {
    if(game.isStarted())
        startView.showContinueGameDialog();
    else
        startNewGame();
  }
  
  @Override
  public void onBackButtonPressed() {
    startView.showExitGameDialog();
  }
}

About

Alias android game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages