diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index df7ce966e..e4c2a4586 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -2176,7 +2176,7 @@ Message from relay Tapping a game opens it.\n\nYou - can instead tap the icon at the left to select or deselect games, + can instead tap the icons at the left to select or deselect games, then act on selected games, e.g. to delete them, using the menu or \"Actionbar.\" diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java index 69be7993a..5854d8602 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java @@ -157,7 +157,7 @@ public class DlgDelegate { } public void showNotAgainDlgThen( int msgID, int prefsKey, - int callbackID ) + int callbackID, Object[] params ) { if ( XWPrefs.getPrefsBoolean( m_activity, prefsKey, false ) ) { // If it's set, do the action without bothering with the @@ -165,17 +165,24 @@ public class DlgDelegate { if ( SKIP_CALLBACK != callbackID ) { m_clickCallback.dlgButtonClicked( callbackID, AlertDialog.BUTTON_POSITIVE, - null ); + params ); } } else { String msg = m_activity.getString( msgID ); DlgState state = - new DlgState( DIALOG_NOTAGAIN, msg, callbackID, prefsKey ); + new DlgState( DIALOG_NOTAGAIN, msg, callbackID, prefsKey, + params ); addState( state ); m_activity.showDialog( DIALOG_NOTAGAIN ); } } + public void showNotAgainDlgThen( int msgID, int prefsKey, + int callbackID ) + { + showNotAgainDlgThen( msgID, prefsKey, callbackID, null ); + } + public void showNotAgainDlgThen( int msgID, int prefsKey ) { showNotAgainDlgThen( msgID, prefsKey, SKIP_CALLBACK ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgState.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgState.java index b0c6dfbf9..315fc6d33 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgState.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgState.java @@ -41,6 +41,13 @@ public class DlgState implements Parcelable { this( id, msg, R.string.button_ok, cbckID, prefsKey ); } + public DlgState( int id, String msg, int cbckID, int prefsKey, + Object[] params ) + { + this( id, msg, R.string.button_ok, cbckID, prefsKey ); + m_params = params; + } + public DlgState( int id, String msg, int posButton, int cbckID, int prefsKey ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java index 0c7d27eab..5ecc46f34 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -90,6 +90,7 @@ public class GamesList extends XWExpandableListActivity private static final int NEW_FROM_ACTION = 5; private static final int DELETE_GROUP_ACTION = 6; private static final int DELETE_SELGAMES_ACTION = 7; + private static final int OPEN_GAME_ACTION = 8; private static final int[] DEBUGITEMS = { R.id.gamel_menu_loaddb , R.id.gamel_menu_storedb , R.id.gamel_menu_checkupdates @@ -494,23 +495,9 @@ public class GamesList extends XWExpandableListActivity // dialog in case it was dismissed. That way it to check for // an empty room name. if ( !m_gameLaunched ) { - if ( summary.conType == CommsAddrRec.CommsConnType.COMMS_CONN_RELAY - && summary.roomName.length() == 0 ) { - // If it's unconfigured and of the type RelayGameActivity - // can handle send it there, otherwise use the full-on - // config. - Class clazz; - if ( RelayGameActivity.isSimpleGame( summary ) ) { - clazz = RelayGameActivity.class; - } else { - clazz = GameConfig.class; - } - GameUtils.doConfig( this, rowid, clazz ); - } else { - if ( checkWarnNoDict( rowid ) ) { - launchGame( rowid ); - } - } + showNotAgainDlgThen( R.string.not_again_newselect, + R.string.key_notagain_newselect, + OPEN_GAME_ACTION, rowid, summary ); } } @@ -585,6 +572,9 @@ public class GamesList extends XWExpandableListActivity case DELETE_SELGAMES_ACTION: deleteSelected(); break; + case OPEN_GAME_ACTION: + doOpenGame( params ); + break; default: Assert.fail(); } @@ -1186,6 +1176,31 @@ public class GamesList extends XWExpandableListActivity tryAlert( intent ); } + private void doOpenGame( Object[] params ) + { + GameSummary summary = (GameSummary)params[1]; + long rowid = (Long)params[0]; + + if ( summary.conType == CommsAddrRec.CommsConnType.COMMS_CONN_RELAY + && summary.roomName.length() == 0 ) { + // If it's unconfigured and of the type RelayGameActivity + // can handle send it there, otherwise use the full-on + // config. + Class clazz; + + if ( RelayGameActivity.isSimpleGame( summary ) ) { + clazz = RelayGameActivity.class; + } else { + clazz = GameConfig.class; + } + GameUtils.doConfig( this, rowid, clazz ); + } else { + if ( checkWarnNoDict( rowid ) ) { + launchGame( rowid ); + } + } + } + public static void onGameDictDownload( Context context, Intent intent ) { intent.setClass( context, GamesList.class ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java index 3d8ed8ef0..87e9d02ea 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java @@ -84,6 +84,12 @@ public class XWExpandableListActivity extends ExpandableListActivity m_delegate.doSyncMenuitem(); } + protected void showNotAgainDlgThen( int msgID, int prefsKey, + int action, Object... params ) + { + m_delegate.showNotAgainDlgThen( msgID, prefsKey, action, params ); + } + protected void showNotAgainDlgThen( int msgID, int prefsKey, int action ) {