From cae30c61e89fa7c4d447baa8565d412a7203c79d Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 25 Mar 2014 06:03:25 -0700 Subject: [PATCH] need onCreateDialog() to get into DlgDelegate; onContentChanged needs to call super() --- .../org/eehouse/android/xw4/DelegateBase.java | 6 +++++ .../android/xw4/GamesListActivity.java | 2 +- .../android/xw4/GamesListDelegate.java | 23 +++++++++---------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java index 41e3f5e35..2f3d88ed5 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java @@ -20,6 +20,7 @@ package org.eehouse.android.xw4; import android.app.Activity; +import android.app.Dialog; import android.os.Bundle; import org.eehouse.android.xw4.DlgDelegate.Action; @@ -35,6 +36,11 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify { m_delegate = new DlgDelegate( activity, this, bundle ); } + protected Dialog onCreateDialog( int id ) + { + return m_delegate.onCreateDialog( id ); + } + protected void showNotAgainDlgThen( int msgID, int prefsKey, Action action, Object... params ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListActivity.java index 884b2ff34..d8e2f3d24 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListActivity.java @@ -111,7 +111,7 @@ public class GamesListActivity extends ExpandableListActivity { { super.onContentChanged(); if ( null != m_dlgt ) { - m_dlgt.onContentChanged(); + m_dlgt.contentChanged(); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java index 597f3f9a1..3852e0dd4 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java @@ -243,7 +243,7 @@ public class GamesListDelegate extends DelegateBase DBUtils.setGroupName( m_activity, m_groupid, name ); m_adapter.inval( m_rowid ); - onContentChanged(); + m_activity.onContentChanged(); } }; dialog = buildNamerDlg( m_adapter.groupName( m_groupid ), @@ -258,7 +258,7 @@ public class GamesListDelegate extends DelegateBase String name = m_namer.getName(); DBUtils.addGroup( m_activity, name ); // m_adapter.inval(); - onContentChanged(); + m_activity.onContentChanged(); } }; dialog = buildNamerDlg( "", R.string.newgroup_label, @@ -293,7 +293,7 @@ public class GamesListDelegate extends DelegateBase DBUtils.moveGame( m_activity, rowid, gid ); } DBUtils.setGroupExpanded( m_activity, gid, true ); - onContentChanged(); + m_activity.onContentChanged(); } }; String[] groups = m_adapter.groupNames(); @@ -334,7 +334,7 @@ public class GamesListDelegate extends DelegateBase break; default: - // just drop it; super.onCreateDialog likely failed + dialog = super.onCreateDialog( id ); break; } return dialog; @@ -460,7 +460,7 @@ public class GamesListDelegate extends DelegateBase m_activity.runOnUiThread( new Runnable() { public void run() { if ( countChanged || DBUtils.ROWID_NOTFOUND == rowid ) { - onContentChanged(); + m_activity.onContentChanged(); if ( DBUtils.ROWID_NOTFOUND != rowid ) { m_launchedGame = rowid; } @@ -564,7 +564,7 @@ public class GamesListDelegate extends DelegateBase for ( long rowid : rowids ) { GameUtils.resetGame( m_activity, rowid ); } - onContentChanged(); // required because position may change + m_activity.onContentChanged(); // required because position may change break; case SYNC_MENU: doSyncMenuitem(); @@ -584,7 +584,7 @@ public class GamesListDelegate extends DelegateBase GameUtils.deleteGroup( m_activity, groupID ); } clearSelections(); - onContentChanged(); + m_activity.onContentChanged(); break; case DELETE_GAMES: 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 ) { m_adapter.expandGroups( m_activity.getExpandableListView() ); } @@ -831,7 +830,7 @@ public class GamesListDelegate extends DelegateBase DBUtils.saveSummary( self, lock, smry ); m_selGames.add( lock.getRowid() ); lock.unlock(); - onContentChanged(); + m_activity.onContentChanged(); } }); } @@ -894,7 +893,7 @@ public class GamesListDelegate extends DelegateBase clearSelections(); } if ( changeContent ) { - onContentChanged(); + m_activity.onContentChanged(); } return handled;// || super.onOptionsItemSelected( item ); @@ -1157,7 +1156,7 @@ public class GamesListDelegate extends DelegateBase if ( m_adapter.setField( newField ) ) { // The adapter should be able to decide whether full // content change is required. PENDING - onContentChanged(); + m_activity.onContentChanged(); } }