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);
player.savePlayerInfo(playerInfo);
finish();
GameOpenHelper gameHelper = new GameOpenHelper(getApplicationContext());
gameHelper.insertGame(currentScenario.game);
Log.d(LOG_TAG, "WHYYYY won't it work?!!! ;-)");
Intent intent = new Intent(this, ReviewActivity.class);
intent.putExtra(ReviewActivity.INTENT_EXTRA_GAME_ID, currentScenario.game.id);
intent.putExtra(ReviewActivity.INTENT_EXTRA_FROM_GAME, true);
startActivity(intent);
finish();
}
/**

View file

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

View file

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

View file

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

View file

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

View file

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