mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
replace two menuitems, default-robot and default-human, with a single
that invokes a dialog giving an explanation and three choices: robot, human and both.
This commit is contained in:
parent
54a793f6c2
commit
c996e98624
3 changed files with 40 additions and 18 deletions
|
@ -4,11 +4,8 @@
|
||||||
<item android:id="@+id/dicts_item_move"
|
<item android:id="@+id/dicts_item_move"
|
||||||
android:title="@string/dicts_item_move"
|
android:title="@string/dicts_item_move"
|
||||||
/>
|
/>
|
||||||
<item android:id="@+id/dicts_item_select_human"
|
<item android:id="@+id/dicts_item_select"
|
||||||
android:title="@string/dicts_item_select_human"
|
android:title="@string/dicts_item_select"
|
||||||
/>
|
|
||||||
<item android:id="@+id/dicts_item_select_robot"
|
|
||||||
android:title="@string/dicts_item_select_robot"
|
|
||||||
/>
|
/>
|
||||||
<item android:id="@+id/dicts_item_details"
|
<item android:id="@+id/dicts_item_details"
|
||||||
android:title="@string/dicts_item_details"
|
android:title="@string/dicts_item_details"
|
||||||
|
|
|
@ -147,10 +147,14 @@
|
||||||
<string name="button_juggle_players">Shuffle players</string>
|
<string name="button_juggle_players">Shuffle players</string>
|
||||||
|
|
||||||
<string name="dicts_item_move">Move dictionary</string>
|
<string name="dicts_item_move">Move dictionary</string>
|
||||||
<string name="dicts_item_select_human">Make default (human)</string>
|
<string name="dicts_item_select">Make default</string>
|
||||||
<string name="dicts_item_select_robot">Make default (robot)</string>
|
|
||||||
<string name="dicts_item_details">Details</string>
|
<string name="dicts_item_details">Details</string>
|
||||||
<string name="move_dictf">Move dictionary %1$s from %2$s to %3$s?</string>
|
<string name="move_dictf">Move dictionary %1$s from %2$s to %3$s?</string>
|
||||||
|
<string name="set_default_message">Use this dictionary as the
|
||||||
|
default for new games for what kind of players?</string>
|
||||||
|
<string name="button_default_human">Human</string>
|
||||||
|
<string name="button_default_robot">Robot</string>
|
||||||
|
<string name="button_default_both">Both</string>
|
||||||
|
|
||||||
<string name="dict_lang_labelf">Dictionary (in %s)</string>
|
<string name="dict_lang_labelf">Dictionary (in %s)</string>
|
||||||
<string name="connect_label">Connection (via internet)</string>
|
<string name="connect_label">Connection (via internet)</string>
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class DictsActivity extends ExpandableListActivity
|
||||||
|
|
||||||
private static final int PICK_STORAGE = DlgDelegate.DIALOG_LAST + 1;
|
private static final int PICK_STORAGE = DlgDelegate.DIALOG_LAST + 1;
|
||||||
private static final int MOVE_DICT = DlgDelegate.DIALOG_LAST + 2;
|
private static final int MOVE_DICT = DlgDelegate.DIALOG_LAST + 2;
|
||||||
|
private static final int SET_DEFAULT = DlgDelegate.DIALOG_LAST + 3;
|
||||||
private int m_lang = 0;
|
private int m_lang = 0;
|
||||||
private String[] m_langs;
|
private String[] m_langs;
|
||||||
private String m_name = null;
|
private String m_name = null;
|
||||||
|
@ -208,12 +209,12 @@ public class DictsActivity extends ExpandableListActivity
|
||||||
protected Dialog onCreateDialog( int id )
|
protected Dialog onCreateDialog( int id )
|
||||||
{
|
{
|
||||||
Dialog dialog;
|
Dialog dialog;
|
||||||
DialogInterface.OnClickListener lstnrSD;
|
DialogInterface.OnClickListener lstnr;
|
||||||
|
|
||||||
switch( id ) {
|
switch( id ) {
|
||||||
case PICK_STORAGE:
|
case PICK_STORAGE:
|
||||||
|
|
||||||
lstnrSD = new DialogInterface.OnClickListener() {
|
lstnr = new DialogInterface.OnClickListener() {
|
||||||
public void onClick( DialogInterface dlg, int item ) {
|
public void onClick( DialogInterface dlg, int item ) {
|
||||||
startDownload( m_lang, m_name, item !=
|
startDownload( m_lang, m_name, item !=
|
||||||
DialogInterface.BUTTON_POSITIVE );
|
DialogInterface.BUTTON_POSITIVE );
|
||||||
|
@ -223,12 +224,12 @@ public class DictsActivity extends ExpandableListActivity
|
||||||
dialog = new AlertDialog.Builder( this )
|
dialog = new AlertDialog.Builder( this )
|
||||||
.setTitle( R.string.storeWhereTitle )
|
.setTitle( R.string.storeWhereTitle )
|
||||||
.setMessage( R.string.storeWhereMsg )
|
.setMessage( R.string.storeWhereMsg )
|
||||||
.setPositiveButton( R.string.button_internal, lstnrSD )
|
.setPositiveButton( R.string.button_internal, lstnr )
|
||||||
.setNegativeButton( R.string.button_sd, lstnrSD )
|
.setNegativeButton( R.string.button_sd, lstnr )
|
||||||
.create();
|
.create();
|
||||||
break;
|
break;
|
||||||
case MOVE_DICT:
|
case MOVE_DICT:
|
||||||
lstnrSD = new DialogInterface.OnClickListener() {
|
lstnr = new DialogInterface.OnClickListener() {
|
||||||
public void onClick( DialogInterface dlg, int item ) {
|
public void onClick( DialogInterface dlg, int item ) {
|
||||||
Utils.logf( "CALLING moveDict" );
|
Utils.logf( "CALLING moveDict" );
|
||||||
if ( GameUtils.moveDict( DictsActivity.this,
|
if ( GameUtils.moveDict( DictsActivity.this,
|
||||||
|
@ -244,10 +245,32 @@ public class DictsActivity extends ExpandableListActivity
|
||||||
};
|
};
|
||||||
dialog = new AlertDialog.Builder( this )
|
dialog = new AlertDialog.Builder( this )
|
||||||
.setMessage( "" ) // will set later
|
.setMessage( "" ) // will set later
|
||||||
.setPositiveButton( R.string.button_ok, lstnrSD )
|
.setPositiveButton( R.string.button_ok, lstnr )
|
||||||
.setNegativeButton( R.string.button_cancel, null )
|
.setNegativeButton( R.string.button_cancel, null )
|
||||||
.create();
|
.create();
|
||||||
break;
|
break;
|
||||||
|
case SET_DEFAULT:
|
||||||
|
lstnr = new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick( DialogInterface dlg, int item ) {
|
||||||
|
if ( DialogInterface.BUTTON_NEGATIVE == item
|
||||||
|
|| DialogInterface.BUTTON_POSITIVE == item ) {
|
||||||
|
setDefault( R.string.key_default_dict, m_rowView );
|
||||||
|
}
|
||||||
|
if ( DialogInterface.BUTTON_NEGATIVE == item
|
||||||
|
|| DialogInterface.BUTTON_NEUTRAL == item ) {
|
||||||
|
setDefault( R.string.key_default_robodict,
|
||||||
|
m_rowView );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dialog = new AlertDialog.Builder( this )
|
||||||
|
.setTitle( R.string.query_title )
|
||||||
|
.setMessage( R.string.set_default_message )
|
||||||
|
.setPositiveButton( R.string.button_default_human, lstnr )
|
||||||
|
.setNeutralButton( R.string.button_default_robot, lstnr )
|
||||||
|
.setNegativeButton( R.string.button_default_both, lstnr )
|
||||||
|
.create();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
dialog = m_delegate.onCreateDialog( id );
|
dialog = m_delegate.onCreateDialog( id );
|
||||||
break;
|
break;
|
||||||
|
@ -373,11 +396,9 @@ public class DictsActivity extends ExpandableListActivity
|
||||||
case R.id.dicts_item_move:
|
case R.id.dicts_item_move:
|
||||||
askMoveDict( row );
|
askMoveDict( row );
|
||||||
break;
|
break;
|
||||||
case R.id.dicts_item_select_human:
|
case R.id.dicts_item_select:
|
||||||
setDefault( R.string.key_default_dict, row );
|
m_rowView = row;
|
||||||
break;
|
showDialog( SET_DEFAULT );
|
||||||
case R.id.dicts_item_select_robot:
|
|
||||||
setDefault( R.string.key_default_robodict, row );
|
|
||||||
break;
|
break;
|
||||||
case R.id.dicts_item_details:
|
case R.id.dicts_item_details:
|
||||||
Utils.notImpl( this );
|
Utils.notImpl( this );
|
||||||
|
|
Loading…
Reference in a new issue