add onResume to undo effects of onPause. I'm pretty sure this fixes

the white screen on device bug.
This commit is contained in:
eehouse 2010-05-09 20:40:39 +00:00
parent 77f21c6f2e
commit 3159e864b5

View file

@ -251,16 +251,14 @@ public class BoardActivity extends Activity implements UtilCtxt {
@Override @Override
protected void onStart() protected void onStart()
{ {
Utils.logf( "onStart" ); Utils.logf( "BoardActivity::onStart" );
loadGame();
super.onStart(); super.onStart();
} }
@Override @Override
protected void onRestart() protected void onRestart()
{ {
Utils.logf( "onRestart" ); Utils.logf( "BoardActivity::onRestart" );
// loadGame(); supposedly onRestart is always followed by onStart
super.onRestart(); super.onRestart();
} }
@ -294,6 +292,14 @@ public class BoardActivity extends Activity implements UtilCtxt {
super.onPause(); super.onPause();
} }
@Override
protected void onResume()
{
Utils.logf( "BoardActivity::onResume()" );
loadGame();
super.onResume();
}
@Override @Override
protected void onStop() protected void onStop()
{ {
@ -325,7 +331,7 @@ public class BoardActivity extends Activity implements UtilCtxt {
} }
@Override @Override
public void onConfigurationChanged( Configuration newConfig ) public void onConfigurationChanged( Configuration newConfig )
{ {
m_currentOrient = newConfig.orientation; m_currentOrient = newConfig.orientation;
super.onConfigurationChanged( newConfig ); super.onConfigurationChanged( newConfig );
@ -448,7 +454,6 @@ public class BoardActivity extends Activity implements UtilCtxt {
if ( handled && cmd != JNIThread.JNICmd.CMD_NONE ) { if ( handled && cmd != JNIThread.JNICmd.CMD_NONE ) {
m_jniThread.handle( cmd ); m_jniThread.handle( cmd );
} }
return handled; return handled;
} }
@ -554,13 +559,11 @@ public class BoardActivity extends Activity implements UtilCtxt {
private void loadGame() private void loadGame()
{ {
if ( 0 != m_jniGamePtr ) { if ( 0 == m_jniGamePtr ) {
m_view.invalidate();
} else {
byte[] stream = Utils.savedGame( this, m_path ); byte[] stream = Utils.savedGame( this, m_path );
XwJNI.gi_from_stream( m_gi, stream ); XwJNI.gi_from_stream( m_gi, stream );
Utils.logf( "dict name: " + m_gi.dictName ); Utils.logf( "loadGame: dict name: %s", m_gi.dictName );
byte[] dictBytes = Utils.openDict( this, m_gi.dictName ); byte[] dictBytes = Utils.openDict( this, m_gi.dictName );
if ( null == dictBytes ) { if ( null == dictBytes ) {
Assert.fail(); Assert.fail();