v0.6.2e: fixed bad changes made to app lifecycle managment
This commit is contained in:
parent
5c087e72aa
commit
aa88bf7d23
|
@ -149,13 +149,13 @@ public class Game extends Activity implements GLSurfaceView.Renderer, View.OnTou
|
|||
|
||||
private boolean paused;
|
||||
|
||||
//Checks for gingerbread are here due to minor activity lifecycle differences
|
||||
//Starting with honeycomb, android's lifecycle management changes slightly
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
|
||||
resumeGame();
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +164,11 @@ public class Game extends Activity implements GLSurfaceView.Renderer, View.OnTou
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1){
|
||||
if (scene != null) {
|
||||
scene.onResume();
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
|
||||
resumeGame();
|
||||
}
|
||||
}
|
||||
|
@ -174,10 +178,10 @@ public class Game extends Activity implements GLSurfaceView.Renderer, View.OnTou
|
|||
super.onPause();
|
||||
|
||||
if (scene != null) {
|
||||
scene.onFocusLost();
|
||||
scene.onPause();
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1){
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
|
||||
pauseGame();
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +190,7 @@ public class Game extends Activity implements GLSurfaceView.Renderer, View.OnTou
|
|||
public void onStop() {
|
||||
super.onStop();
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
|
||||
pauseGame();
|
||||
}
|
||||
}
|
||||
|
@ -213,11 +217,6 @@ public class Game extends Activity implements GLSurfaceView.Renderer, View.OnTou
|
|||
Sample.INSTANCE.resume();
|
||||
}
|
||||
|
||||
public static void quitGame(){
|
||||
Game.instance.finish();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public boolean isPaused(){
|
||||
return paused;
|
||||
}
|
||||
|
|
|
@ -52,10 +52,14 @@ public class Scene extends Group {
|
|||
super.destroy();
|
||||
}
|
||||
|
||||
public void onFocusLost() {
|
||||
public void onPause() {
|
||||
|
||||
}
|
||||
|
||||
public void onResume(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
@ -67,7 +71,7 @@ public class Scene extends Group {
|
|||
}
|
||||
|
||||
protected void onBackPressed() {
|
||||
Game.quitGame();
|
||||
Game.instance.finish();
|
||||
}
|
||||
|
||||
protected void onMenuPressed() {
|
||||
|
|
|
@ -416,7 +416,7 @@ public class CursedWand {
|
|||
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
ShatteredPixelDungeon.quitGame();
|
||||
Game.instance.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -454,7 +454,7 @@ public class GameScene extends PixelScene {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onFocusLost() {
|
||||
public synchronized void onPause() {
|
||||
try {
|
||||
Dungeon.saveAll();
|
||||
Badges.saveGlobal();
|
||||
|
|
|
@ -70,7 +70,7 @@ public class ExitButton extends Button {
|
|||
@Override
|
||||
protected void onClick() {
|
||||
if (Game.scene() instanceof TitleScene) {
|
||||
ShatteredPixelDungeon.quitGame();
|
||||
Game.instance.finish();
|
||||
} else {
|
||||
ShatteredPixelDungeon.switchNoFade( TitleScene.class );
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public class WndGame extends Window {
|
|||
} catch (IOException e) {
|
||||
ShatteredPixelDungeon.reportException(e);
|
||||
}
|
||||
ShatteredPixelDungeon.quitGame();
|
||||
Game.instance.finish();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue
Block a user