Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Re-opening app from in-progress TrainingActivity will lead to TrainingActivity
  • Loading branch information
ibrahim-gabol-19 committed Oct 5, 2024
1 parent b183d8e commit 3174828
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_training_overview);

if(TrainingPersistenceHelper.getActiveItem(this) != null){
// show current training session if there is one.
Log.w(LOG_CLASS, "Found active training session");
startTrainingActivity();
}
checkForActiveTrainingSession();

mEmptyView = findViewById(R.id.empty_view);

Expand Down Expand Up @@ -119,10 +115,19 @@ public void onClick(View v) {
@Override
public void onResume() {
super.onResume();
checkForActiveTrainingSession();
// Force refresh of trainings.
showTrainings();
}

private void checkForActiveTrainingSession() {
if (TrainingPersistenceHelper.getActiveItem(this) != null) {
// show current training session if there is one.
Log.w(LOG_CLASS, "Found active training session");
startTrainingActivity();
}
}

protected void startTrainingActivity(){
Intent intent = new Intent(this, TrainingActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
Expand Down

0 comments on commit 3174828

Please sign in to comment.