Fix critical finish() bug

This commit is contained in:
Ruben 2017-09-08 10:05:43 +02:00
parent 5a76d03d58
commit 5f840969a0
6 changed files with 11 additions and 13 deletions

View file

@ -397,15 +397,13 @@ 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

@ -329,8 +329,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

@ -90,9 +90,9 @@ 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);
finish();
}
}

View file

@ -240,8 +240,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();
}
});
@ -249,8 +250,6 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
showSettings();
}
// all setup, see wheter we immediately continue to intro:
boolean showIntro = getIntent().getBooleanExtra(INTENT_EXTRA_SHOW_INTRO, false);
if(showIntro) {

View file

@ -204,8 +204,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

@ -207,8 +207,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();
}
});
@ -229,8 +230,8 @@ public class ReviewActivity extends AppCompatActivity {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), EndingActivity.class);
finish();
startActivity(intent);
finish();
}
});
} else {
@ -241,8 +242,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();
}
});
}
@ -343,8 +344,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();
}