Fix critical finish() bug

This commit is contained in:
Ruben 2017-09-08 10:05:43 +02:00
parent 866c6fa4ae
commit 433e09d454
6 changed files with 9 additions and 11 deletions

View file

@ -427,16 +427,14 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
// scores.add(score); // scores.add(score);
player.savePlayerInfo(playerInfo); player.savePlayerInfo(playerInfo);
finish();
GameOpenHelper gameHelper = new GameOpenHelper(getApplicationContext()); GameOpenHelper gameHelper = new GameOpenHelper(getApplicationContext());
gameHelper.insertGame(currentScenario.game); gameHelper.insertGame(currentScenario.game);
Log.d(LOG_TAG, "WHYYYY won't it work?!!! ;-)");
Intent intent = new Intent(this, ReviewActivity.class); Intent intent = new Intent(this, ReviewActivity.class);
intent.putExtra(ReviewActivity.INTENT_EXTRA_GAME_ID, currentScenario.game.id); intent.putExtra(ReviewActivity.INTENT_EXTRA_GAME_ID, currentScenario.game.id);
intent.putExtra(ReviewActivity.INTENT_EXTRA_FROM_GAME, true); intent.putExtra(ReviewActivity.INTENT_EXTRA_FROM_GAME, true);
startActivity(intent); startActivity(intent);
finish();
} }
/** /**

View file

@ -331,8 +331,8 @@ public class HighscoreActivity extends AppCompatActivity {
getContext().getResources().getString(R.string.load_game_activity), true); getContext().getResources().getString(R.string.load_game_activity), true);
Intent intent = new Intent(getContext(), GamingActivity.class); Intent intent = new Intent(getContext(), GamingActivity.class);
intent.putExtra(GamingActivity.INTENT_EXTRA_SCENARIO, scenario.id); intent.putExtra(GamingActivity.INTENT_EXTRA_SCENARIO, scenario.id);
getActivity().finish();
startActivity(intent); startActivity(intent);
getActivity().finish();
} }
}); });
} else { } else {

View file

@ -93,7 +93,6 @@ public class IntroActivity extends AppCompatActivity {
public void continueToMenu() { public void continueToMenu() {
continueHandler.removeCallbacks(continueRunnable); continueHandler.removeCallbacks(continueRunnable);
Intent intent = new Intent(this, MirrorMenuActivity.class); Intent intent = new Intent(this, MirrorMenuActivity.class);
// finish();
startActivity(intent); startActivity(intent);
//disable distracting transition when going to menu //disable distracting transition when going to menu
IntroActivity.this.overridePendingTransition(0, 0); IntroActivity.this.overridePendingTransition(0, 0);

View file

@ -246,9 +246,9 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(MirrorMenuActivity.this, ProgressActivity.class); Intent intent = new Intent(MirrorMenuActivity.this, ProgressActivity.class);
finish();
startActivity(intent); startActivity(intent);
stopDetector(); stopDetector();
finish();
} }
}); });

View file

@ -206,8 +206,8 @@ public class ProgressActivity extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), EndingActivity.class); Intent intent = new Intent(getApplicationContext(), EndingActivity.class);
finish();
startActivity(intent); startActivity(intent);
finish();
} }
}); });
} }

View file

@ -209,8 +209,9 @@ public class ReviewActivity extends AppCompatActivity {
intent.putExtra(GamingActivity.INTENT_EXTRA_SCENARIO, game.scenario.id); intent.putExtra(GamingActivity.INTENT_EXTRA_SCENARIO, game.scenario.id);
ProgressDialog dialog = ProgressDialog.show(ReviewActivity.this, "", ProgressDialog dialog = ProgressDialog.show(ReviewActivity.this, "",
getApplicationContext().getResources().getString(R.string.load_game_activity), true); getApplicationContext().getResources().getString(R.string.load_game_activity), true);
finish();
startActivity(intent); startActivity(intent);
finish();
} }
}); });
@ -231,8 +232,8 @@ public class ReviewActivity extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), EndingActivity.class); Intent intent = new Intent(getApplicationContext(), EndingActivity.class);
finish();
startActivity(intent); startActivity(intent);
finish();
} }
}); });
} else { } else {
@ -243,8 +244,8 @@ public class ReviewActivity extends AppCompatActivity {
intent.putExtra(GamingActivity.INTENT_EXTRA_SCENARIO, game.scenario.getNextLevelId()); intent.putExtra(GamingActivity.INTENT_EXTRA_SCENARIO, game.scenario.getNextLevelId());
ProgressDialog dialog = ProgressDialog.show(ReviewActivity.this, "", ProgressDialog dialog = ProgressDialog.show(ReviewActivity.this, "",
getApplicationContext().getResources().getString(R.string.load_game_activity), true); getApplicationContext().getResources().getString(R.string.load_game_activity), true);
finish();
startActivity(intent); startActivity(intent);
finish();
} }
}); });
} }
@ -345,8 +346,8 @@ public class ReviewActivity extends AppCompatActivity {
if(fromGame) { if(fromGame) {
Intent intent = new Intent(getApplicationContext(), HighscoreActivity.class); Intent intent = new Intent(getApplicationContext(), HighscoreActivity.class);
intent.putExtra(HighscoreActivity.INTENT_EXTRA_GAME_ID, game.id); intent.putExtra(HighscoreActivity.INTENT_EXTRA_GAME_ID, game.id);
finish();
startActivity(intent); startActivity(intent);
finish();
} else { } else {
onBackPressed(); onBackPressed();
} }