diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 517f9c336..63f3f63d4 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -611,4 +611,7 @@ (No moves yet) + Delete + Reset + diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java index fd4c6c59a..b557af23f 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java @@ -560,7 +560,8 @@ public class DictsActivity extends ExpandableListActivity } } - m_delegate.showConfirmThen( msg, DELETE_DICT_ACTION ); + m_delegate.showConfirmThen( msg, R.string.button_delete, + DELETE_DICT_ACTION ); } // SDCardWatcher.SDCardNotifiee interface 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 f2043d933..570352dcf 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java @@ -54,6 +54,7 @@ public class DlgDelegate { private static final String CALLBACK = "callback"; private static final String MSGID = "msgid"; private static final String PREFSKEY = "prefskey"; + private static final String POSBUTTON = "posbutton"; // Cache a couple of callback implementations that never change: private DialogInterface.OnClickListener m_cbkOnClickLstnr = null; @@ -64,6 +65,7 @@ public class DlgDelegate { } private int m_msgID; + private int m_posButton; private int m_cbckID = 0; // if this can be set twice I have a // problem. See asserts below. private String m_msg; @@ -82,6 +84,7 @@ public class DlgDelegate { m_msg = bundle.getString( MSG ); m_cbckID = bundle.getInt( CALLBACK ); m_msgID = bundle.getInt( MSGID ); + m_posButton = bundle.getInt( POSBUTTON ); m_prefsKey = bundle.getInt( PREFSKEY ); } } @@ -91,6 +94,7 @@ public class DlgDelegate { outState.putString( MSG, m_msg ); outState.putInt( CALLBACK, m_cbckID ); outState.putInt( MSGID, m_msgID ); + outState.putInt( POSBUTTON, m_posButton ); outState.putInt( PREFSKEY, m_prefsKey ); } @@ -137,6 +141,8 @@ public class DlgDelegate { ad.setMessage( m_activity.getString(m_msgID) ); break; case CONFIRM_THEN: + ad.getButton(AlertDialog.BUTTON_POSITIVE). + setText( m_activity.getString( m_posButton ) ); ad.setMessage( m_msg ); break; } @@ -185,8 +191,14 @@ public class DlgDelegate { } public void showConfirmThen( String msg, int callbackID ) + { + showConfirmThen( msg, R.string.button_ok, callbackID ); + } + + public void showConfirmThen( String msg, int posButton, int callbackID ) { m_msg = msg; + m_posButton = posButton; Assert.assertTrue( 0 != callbackID ); Assert.assertTrue( 0 == m_cbckID ); m_cbckID = callbackID; 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 7976d5c22..bb8788075 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -518,7 +518,7 @@ public class GamesList extends XWListActivity case R.id.gamel_menu_delete_all: if ( DBUtils.gamesList( this ).length > 0 ) { showConfirmThen( R.string.confirm_delete_all, - DELETE_ALL_ACTION ); + R.string.button_delete, DELETE_ALL_ACTION ); } handled = true; break; @@ -561,12 +561,14 @@ public class GamesList extends XWListActivity m_rowid = DBUtils.gamesList( this )[position]; if ( R.id.list_item_delete == menuID ) { - showConfirmThen( R.string.confirm_delete, DELETE_GAME_ACTION ); + showConfirmThen( R.string.confirm_delete, R.string.button_delete, + DELETE_GAME_ACTION ); } else { if ( checkWarnNoDict( m_rowid ) ) { switch ( menuID ) { case R.id.list_item_reset: - showConfirmThen( R.string.confirm_reset, RESET_GAME_ACTION ); + showConfirmThen( R.string.confirm_reset, + R.string.button_reset, RESET_GAME_ACTION ); break; case R.id.list_item_config: GameUtils.doConfig( this, m_rowid, GameConfig.class ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListActivity.java index 9d918e508..bbd5f3684 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListActivity.java @@ -137,6 +137,11 @@ public class XWListActivity extends ListActivity showConfirmThen( getString(msg), action ); } + protected void showConfirmThen( int msg, int posButton, int action ) + { + m_delegate.showConfirmThen( getString(msg), posButton, action ); + } + protected void doSyncMenuitem() { m_delegate.doSyncMenuitem();