pass bundle into DlgDelegate so state can be saved and restored. Not

doing anything with it yet because any scheme to survive
OS-restoration has to deal with the Runnables I'm saving that can't be
bundled.  Work in progress....
This commit is contained in:
Andy2 2011-08-22 18:10:22 -07:00
parent 7e6daa5797
commit 3296cad731
4 changed files with 35 additions and 7 deletions

View file

@ -294,14 +294,14 @@ public class DictsActivity extends ExpandableListActivity
}
@Override
protected void onCreate(Bundle savedInstanceState)
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
Resources res = getResources();
m_locNames = res.getStringArray( R.array.loc_names );
m_delegate = new DlgDelegate( this );
m_delegate = new DlgDelegate( this, savedInstanceState );
m_factory = LayoutInflater.from( this );
m_download = getString( R.string.download_dicts );
@ -338,6 +338,13 @@ public class DictsActivity extends ExpandableListActivity
expandGroups();
}
@Override
protected void onSaveInstanceState( Bundle outState )
{
super.onSaveInstanceState( outState );
m_delegate.onSaveInstanceState( outState );
}
protected void onPause() {
m_cardWatcher.close();
m_cardWatcher = null;

View file

@ -21,14 +21,16 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import junit.framework.Assert;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import android.app.AlertDialog;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.CommonPrefs;
@ -56,9 +58,14 @@ public class DlgDelegate {
};
private TextOrHtmlClicked m_txt_or_html;
public DlgDelegate( Activity activity ) {
public DlgDelegate( Activity activity, Bundle bundle ) {
m_activity = activity;
}
public void onSaveInstanceState( Bundle outState )
{
// not doing anything yet
}
public Dialog onCreateDialog( int id )
{

View file

@ -41,7 +41,7 @@ public class XWActivity extends Activity {
{
Utils.logf( "%s.onCreate(this=%H)", getClass().getName(), this );
super.onCreate( savedInstanceState );
m_delegate = new DlgDelegate( this );
m_delegate = new DlgDelegate( this, savedInstanceState );
}
@Override
@ -82,6 +82,13 @@ public class XWActivity extends Activity {
super.onDestroy();
}
@Override
protected void onSaveInstanceState( Bundle outState )
{
super.onSaveInstanceState( outState );
m_delegate.onSaveInstanceState( outState );
}
@Override
protected Dialog onCreateDialog( int id )
{

View file

@ -35,7 +35,7 @@ public class XWListActivity extends ListActivity {
{
Utils.logf( "%s.onCreate(this=%H)", getClass().getName(), this );
super.onCreate( savedInstanceState );
m_delegate = new DlgDelegate( this );
m_delegate = new DlgDelegate( this, savedInstanceState );
}
@Override
@ -76,6 +76,13 @@ public class XWListActivity extends ListActivity {
super.onDestroy();
}
@Override
protected void onSaveInstanceState( Bundle outState )
{
super.onSaveInstanceState( outState );
m_delegate.onSaveInstanceState( outState );
}
@Override
protected Dialog onCreateDialog( final int id )
{