need onCreateDialog() to get into DlgDelegate; onContentChanged needs to call super()

This commit is contained in:
Eric House 2014-03-25 06:03:25 -07:00
parent 1da9d36f3a
commit cae30c61e8
3 changed files with 18 additions and 13 deletions

View file

@ -20,6 +20,7 @@
package org.eehouse.android.xw4; package org.eehouse.android.xw4;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.Action;
@ -35,6 +36,11 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify {
m_delegate = new DlgDelegate( activity, this, bundle ); m_delegate = new DlgDelegate( activity, this, bundle );
} }
protected Dialog onCreateDialog( int id )
{
return m_delegate.onCreateDialog( id );
}
protected void showNotAgainDlgThen( int msgID, int prefsKey, protected void showNotAgainDlgThen( int msgID, int prefsKey,
Action action, Object... params ) Action action, Object... params )
{ {

View file

@ -111,7 +111,7 @@ public class GamesListActivity extends ExpandableListActivity {
{ {
super.onContentChanged(); super.onContentChanged();
if ( null != m_dlgt ) { if ( null != m_dlgt ) {
m_dlgt.onContentChanged(); m_dlgt.contentChanged();
} }
} }

View file

@ -243,7 +243,7 @@ public class GamesListDelegate extends DelegateBase
DBUtils.setGroupName( m_activity, DBUtils.setGroupName( m_activity,
m_groupid, name ); m_groupid, name );
m_adapter.inval( m_rowid ); m_adapter.inval( m_rowid );
onContentChanged(); m_activity.onContentChanged();
} }
}; };
dialog = buildNamerDlg( m_adapter.groupName( m_groupid ), dialog = buildNamerDlg( m_adapter.groupName( m_groupid ),
@ -258,7 +258,7 @@ public class GamesListDelegate extends DelegateBase
String name = m_namer.getName(); String name = m_namer.getName();
DBUtils.addGroup( m_activity, name ); DBUtils.addGroup( m_activity, name );
// m_adapter.inval(); // m_adapter.inval();
onContentChanged(); m_activity.onContentChanged();
} }
}; };
dialog = buildNamerDlg( "", R.string.newgroup_label, dialog = buildNamerDlg( "", R.string.newgroup_label,
@ -293,7 +293,7 @@ public class GamesListDelegate extends DelegateBase
DBUtils.moveGame( m_activity, rowid, gid ); DBUtils.moveGame( m_activity, rowid, gid );
} }
DBUtils.setGroupExpanded( m_activity, gid, true ); DBUtils.setGroupExpanded( m_activity, gid, true );
onContentChanged(); m_activity.onContentChanged();
} }
}; };
String[] groups = m_adapter.groupNames(); String[] groups = m_adapter.groupNames();
@ -334,7 +334,7 @@ public class GamesListDelegate extends DelegateBase
break; break;
default: default:
// just drop it; super.onCreateDialog likely failed dialog = super.onCreateDialog( id );
break; break;
} }
return dialog; return dialog;
@ -460,7 +460,7 @@ public class GamesListDelegate extends DelegateBase
m_activity.runOnUiThread( new Runnable() { m_activity.runOnUiThread( new Runnable() {
public void run() { public void run() {
if ( countChanged || DBUtils.ROWID_NOTFOUND == rowid ) { if ( countChanged || DBUtils.ROWID_NOTFOUND == rowid ) {
onContentChanged(); m_activity.onContentChanged();
if ( DBUtils.ROWID_NOTFOUND != rowid ) { if ( DBUtils.ROWID_NOTFOUND != rowid ) {
m_launchedGame = rowid; m_launchedGame = rowid;
} }
@ -564,7 +564,7 @@ public class GamesListDelegate extends DelegateBase
for ( long rowid : rowids ) { for ( long rowid : rowids ) {
GameUtils.resetGame( m_activity, rowid ); GameUtils.resetGame( m_activity, rowid );
} }
onContentChanged(); // required because position may change m_activity.onContentChanged(); // required because position may change
break; break;
case SYNC_MENU: case SYNC_MENU:
doSyncMenuitem(); doSyncMenuitem();
@ -584,7 +584,7 @@ public class GamesListDelegate extends DelegateBase
GameUtils.deleteGroup( m_activity, groupID ); GameUtils.deleteGroup( m_activity, groupID );
} }
clearSelections(); clearSelections();
onContentChanged(); m_activity.onContentChanged();
break; break;
case DELETE_GAMES: case DELETE_GAMES:
deleteGames( (long[])params[0] ); deleteGames( (long[])params[0] );
@ -601,9 +601,8 @@ public class GamesListDelegate extends DelegateBase
} }
} }
protected void onContentChanged() protected void contentChanged()
{ {
// super.onContentChanged();
if ( null != m_adapter ) { if ( null != m_adapter ) {
m_adapter.expandGroups( m_activity.getExpandableListView() ); m_adapter.expandGroups( m_activity.getExpandableListView() );
} }
@ -831,7 +830,7 @@ public class GamesListDelegate extends DelegateBase
DBUtils.saveSummary( self, lock, smry ); DBUtils.saveSummary( self, lock, smry );
m_selGames.add( lock.getRowid() ); m_selGames.add( lock.getRowid() );
lock.unlock(); lock.unlock();
onContentChanged(); m_activity.onContentChanged();
} }
}); });
} }
@ -894,7 +893,7 @@ public class GamesListDelegate extends DelegateBase
clearSelections(); clearSelections();
} }
if ( changeContent ) { if ( changeContent ) {
onContentChanged(); m_activity.onContentChanged();
} }
return handled;// || super.onOptionsItemSelected( item ); return handled;// || super.onOptionsItemSelected( item );
@ -1157,7 +1156,7 @@ public class GamesListDelegate extends DelegateBase
if ( m_adapter.setField( newField ) ) { if ( m_adapter.setField( newField ) ) {
// The adapter should be able to decide whether full // The adapter should be able to decide whether full
// content change is required. PENDING // content change is required. PENDING
onContentChanged(); m_activity.onContentChanged();
} }
} }