mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
go back to play being the onclick action (removing preference to make
it that way); add more newbie hints; fix DIALOG id definitions to not overlap superclass's.
This commit is contained in:
parent
038f6bd94c
commit
cff95ce3de
11 changed files with 184 additions and 178 deletions
|
@ -1,9 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/list_item_play"
|
||||
android:title="@string/list_item_play"
|
||||
/>
|
||||
<item android:id="@+id/list_item_config"
|
||||
android:title="@string/list_item_config"
|
||||
/>
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
<string name="key_peek_other">key_peek_other</string>
|
||||
<string name="key_hide_values">key_hide_values</string>
|
||||
<string name="key_ringer_zoom">key_ringer_zoom</string>
|
||||
<string name="key_click_launches">key_click_launches</string>
|
||||
<string name="key_hide_title">key_hide_title</string>
|
||||
<string name="key_show_bonussum">key_show_bonussum</string>
|
||||
<string name="key_player0">key_clr_player0</string>
|
||||
|
@ -40,6 +39,8 @@
|
|||
|
||||
<string name="key_notagain_sync">key_notagain_sync</string>
|
||||
<string name="key_notagain_chat">key_notagain_chat</string>
|
||||
<string name="key_notagain_relay">key_notagain_relay</string>
|
||||
<string name="key_notagain_newgame">key_notagain_newgame</string>
|
||||
|
||||
<string name="relayids_extra">org.eehouse.android.xw4.relayids_extra</string>
|
||||
|
||||
|
|
|
@ -91,7 +91,6 @@
|
|||
<string name="board_menu_game_history">Game history</string>
|
||||
<string name="board_menu_game_final">Final scores</string>
|
||||
<string name="board_menu_game_resend">Resend messages</string>
|
||||
<string name="board_menu_game_chat">Send message</string>
|
||||
<string name="board_submenu_file">File</string>
|
||||
<string name="board_menu_file_new">New game</string>
|
||||
<string name="board_menu_file_about">About Crosswords</string>
|
||||
|
@ -205,9 +204,6 @@
|
|||
are added</string>
|
||||
<string name="ringer_zoom">Volume keys zoom</string>
|
||||
<string name="ringer_zoom_summary">Zoom board using volume keys</string>
|
||||
<string name="click_launches">Tap to play</string>
|
||||
<string name="click_launches_summary">Tapping on game in games
|
||||
list opens it rather than dropping a menu</string>
|
||||
<string name="hide_title">Hide titlebar</string>
|
||||
<string name="hide_title_summary">Hiding the game name lets the
|
||||
board be slightly larger</string>
|
||||
|
@ -393,18 +389,31 @@
|
|||
the relay.</string>
|
||||
|
||||
<string name="msgs_progress">Checking relay for moves
|
||||
etc...</string>
|
||||
etc...</string>
|
||||
|
||||
<!-- Messages for a series of dialogs that offer newbie hints in
|
||||
strategic places. This set will be expanding for a
|
||||
while. -->
|
||||
<string name="button_notagain">Do not show again</string>
|
||||
|
||||
<string name="not_again_sync">This action checks the relay for
|
||||
pending moves for all games. Games with pending moves are
|
||||
flagged. When you open the game the new moves will be
|
||||
downloaded.</string>
|
||||
pending moves/messages for all networked games and flags those
|
||||
with pending moves. When you open a flagged game it will connect
|
||||
and sync. (In a later release these moves will be downloaded in
|
||||
the background.)</string>
|
||||
|
||||
<string name="not_again_chat">In networked game you may have no
|
||||
idea who your opponent is. This feature lets you exchange contact
|
||||
info or a short \"bingo!\" Please do not expect Crosswords to be a
|
||||
full-fledged chat app!</string>
|
||||
<string name="not_again_chat">This button lets you send a short
|
||||
message to everyone in this game -- or exchange contact info so
|
||||
you can converse via email or texting.</string>
|
||||
|
||||
<string name="not_again_relay">Multi-device games work through an
|
||||
internet relay that connects devices in \"rooms\". To play
|
||||
against a friend, make sure you both specify the same room name.
|
||||
Or try joining or creating a public room.</string>
|
||||
|
||||
<string name="not_again_newgame">The new game you have created has
|
||||
two players, the first a robot, both on this device. To play
|
||||
the game, tap it; to change its configuration or for other
|
||||
options, long-tap it.</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -147,11 +147,6 @@
|
|||
android:summary="@string/ringer_zoom_summary"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<CheckBoxPreference android:key="@string/key_click_launches"
|
||||
android:title="@string/click_launches"
|
||||
android:summary="@string/click_launches_summary"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<CheckBoxPreference android:key="@string/key_peek_other"
|
||||
android:title="@string/peek_other"
|
||||
android:summary="@string/peek_other_summary"
|
||||
|
|
|
@ -258,7 +258,6 @@ public class BoardActivity extends XWActivity implements UtilCtxt {
|
|||
@Override
|
||||
protected void onPrepareDialog( int id, Dialog dialog )
|
||||
{
|
||||
Utils.logf( "onPrepareDialog(id=" + id + ")" );
|
||||
switch( id ) {
|
||||
case DLG_OKONLY:
|
||||
dialog.setTitle( m_dlgTitle );
|
||||
|
@ -504,13 +503,12 @@ public class BoardActivity extends XWActivity implements UtilCtxt {
|
|||
case R.id.board_menu_game_resend:
|
||||
m_jniThread.handle( JNIThread.JNICmd.CMD_RESEND );
|
||||
break;
|
||||
case R.id.board_menu_game_chat:
|
||||
showDialog( GET_MESSAGE );
|
||||
break;
|
||||
|
||||
case R.id.board_menu_file_prefs:
|
||||
m_firingPrefs = true;
|
||||
startActivity( new Intent( this, PrefsActivity.class ) );
|
||||
break;
|
||||
|
||||
case R.id.board_menu_file_about:
|
||||
showAboutDialog();
|
||||
break;
|
||||
|
|
|
@ -95,8 +95,8 @@ public class DlgDelegate {
|
|||
m_activity.showDialog( DIALOG_ABOUT );
|
||||
}
|
||||
|
||||
public boolean showNotAgainDlgThen( int msgID, int prefsKey,
|
||||
Runnable proc )
|
||||
public void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||
Runnable proc )
|
||||
{
|
||||
boolean set = CommonPrefs.getPrefsBoolean( m_activity, prefsKey, false );
|
||||
if ( set ) {
|
||||
|
@ -109,7 +109,6 @@ public class DlgDelegate {
|
|||
m_prefsKey = prefsKey;
|
||||
m_activity.showDialog( DIALOG_NOTAGAIN );
|
||||
}
|
||||
return !set;
|
||||
}
|
||||
|
||||
private Dialog createAboutDialog()
|
||||
|
|
|
@ -62,14 +62,11 @@ public class GameConfig extends XWActivity
|
|||
,XWListItem.DeleteCallback
|
||||
,RefreshNamesTask.NoNameFound {
|
||||
|
||||
private static final int PLAYER_EDIT = 1;
|
||||
// private static final int ROLE_EDIT_RELAY = 2;
|
||||
// private static final int ROLE_EDIT_SMS = 3;
|
||||
// private static final int ROLE_EDIT_BT = 4;
|
||||
private static final int FORCE_REMOTE = 5;
|
||||
private static final int CONFIRM_CHANGE = 6;
|
||||
private static final int CONFIRM_CHANGE_PLAY = 7;
|
||||
private static final int NO_NAME_FOUND = 8;
|
||||
private static final int PLAYER_EDIT = DlgDelegate.DIALOG_LAST + 1;
|
||||
private static final int FORCE_REMOTE = PLAYER_EDIT + 1;
|
||||
private static final int CONFIRM_CHANGE = PLAYER_EDIT + 2;
|
||||
private static final int CONFIRM_CHANGE_PLAY = PLAYER_EDIT + 3;
|
||||
private static final int NO_NAME_FOUND = PLAYER_EDIT + 4;
|
||||
|
||||
private CheckBox m_notNetworkedGameCheckbx;
|
||||
private CheckBox m_joinPublicCheck;
|
||||
|
@ -133,118 +130,120 @@ public class GameConfig extends XWActivity
|
|||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = null;
|
||||
LayoutInflater factory;
|
||||
DialogInterface.OnClickListener dlpos;
|
||||
AlertDialog.Builder ab;
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
if ( null == dialog ) {
|
||||
LayoutInflater factory;
|
||||
DialogInterface.OnClickListener dlpos;
|
||||
AlertDialog.Builder ab;
|
||||
|
||||
switch (id) {
|
||||
case PLAYER_EDIT:
|
||||
factory = LayoutInflater.from(this);
|
||||
final View playerEditView
|
||||
= factory.inflate( R.layout.player_edit, null );
|
||||
switch (id) {
|
||||
case PLAYER_EDIT:
|
||||
factory = LayoutInflater.from(this);
|
||||
final View playerEditView
|
||||
= factory.inflate( R.layout.player_edit, null );
|
||||
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setTitle(R.string.player_edit_title)
|
||||
.setView(playerEditView)
|
||||
.setPositiveButton( R.string.button_ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
getPlayerSettings();
|
||||
loadPlayers();
|
||||
}
|
||||
})
|
||||
.setNegativeButton( R.string.button_cancel, null )
|
||||
.create();
|
||||
break;
|
||||
// case ROLE_EDIT_RELAY:
|
||||
// case ROLE_EDIT_SMS:
|
||||
// case ROLE_EDIT_BT:
|
||||
// dialog = new AlertDialog.Builder( this )
|
||||
// .setTitle(titleForDlg(id))
|
||||
// .setView( LayoutInflater.from(this)
|
||||
// .inflate( layoutForDlg(id), null ))
|
||||
// .setPositiveButton( R.string.button_ok,
|
||||
// new DialogInterface.OnClickListener() {
|
||||
// public void onClick( DialogInterface dlg,
|
||||
// int whichButton ) {
|
||||
// getRoleSettings();
|
||||
// }
|
||||
// })
|
||||
// .setNegativeButton( R.string.button_cancel, null )
|
||||
// .create();
|
||||
// break;
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setTitle(R.string.player_edit_title)
|
||||
.setView(playerEditView)
|
||||
.setPositiveButton( R.string.button_ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
getPlayerSettings();
|
||||
loadPlayers();
|
||||
}
|
||||
})
|
||||
.setNegativeButton( R.string.button_cancel, null )
|
||||
.create();
|
||||
break;
|
||||
// case ROLE_EDIT_RELAY:
|
||||
// case ROLE_EDIT_SMS:
|
||||
// case ROLE_EDIT_BT:
|
||||
// dialog = new AlertDialog.Builder( this )
|
||||
// .setTitle(titleForDlg(id))
|
||||
// .setView( LayoutInflater.from(this)
|
||||
// .inflate( layoutForDlg(id), null ))
|
||||
// .setPositiveButton( R.string.button_ok,
|
||||
// new DialogInterface.OnClickListener() {
|
||||
// public void onClick( DialogInterface dlg,
|
||||
// int whichButton ) {
|
||||
// getRoleSettings();
|
||||
// }
|
||||
// })
|
||||
// .setNegativeButton( R.string.button_cancel, null )
|
||||
// .create();
|
||||
// break;
|
||||
|
||||
case FORCE_REMOTE:
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setTitle( R.string.force_title )
|
||||
.setView( LayoutInflater.from(this)
|
||||
.inflate( layoutForDlg(id), null ) )
|
||||
.setPositiveButton( R.string.button_ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
loadPlayers();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
dialog.setOnDismissListener( new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss( DialogInterface di )
|
||||
{
|
||||
if ( m_gi.forceRemoteConsistent() ) {
|
||||
Toast.makeText( GameConfig.this,
|
||||
R.string.forced_consistent,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
loadPlayers();
|
||||
case FORCE_REMOTE:
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setTitle( R.string.force_title )
|
||||
.setView( LayoutInflater.from(this)
|
||||
.inflate( layoutForDlg(id), null ) )
|
||||
.setPositiveButton( R.string.button_ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
loadPlayers();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
dialog.setOnDismissListener( new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss( DialogInterface di )
|
||||
{
|
||||
if ( m_gi.forceRemoteConsistent() ) {
|
||||
Toast.makeText( GameConfig.this,
|
||||
R.string.forced_consistent,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
loadPlayers();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
case CONFIRM_CHANGE:
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setTitle( R.string.confirm_save_title )
|
||||
.setMessage( R.string.confirm_save )
|
||||
.setPositiveButton( R.string.button_save,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
applyChanges( true );
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton( R.string.button_discard,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
break;
|
||||
case CONFIRM_CHANGE_PLAY:
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setTitle( R.string.confirm_save_title )
|
||||
.setMessage( R.string.confirm_save )
|
||||
.setPositiveButton( R.string.button_save,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
applyChanges( true );
|
||||
launchGame();
|
||||
}
|
||||
})
|
||||
.setNegativeButton( R.string.button_cancel, null )
|
||||
.create();
|
||||
break;
|
||||
case NO_NAME_FOUND:
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setPositiveButton( R.string.button_ok, null )
|
||||
// message added below since varies with language etc.
|
||||
.setMessage("") // if not set here can't change later
|
||||
.create();
|
||||
break;
|
||||
});
|
||||
break;
|
||||
case CONFIRM_CHANGE:
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setTitle( R.string.confirm_save_title )
|
||||
.setMessage( R.string.confirm_save )
|
||||
.setPositiveButton( R.string.button_save,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
applyChanges( true );
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton( R.string.button_discard,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
break;
|
||||
case CONFIRM_CHANGE_PLAY:
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setTitle( R.string.confirm_save_title )
|
||||
.setMessage( R.string.confirm_save )
|
||||
.setPositiveButton( R.string.button_save,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
applyChanges( true );
|
||||
launchGame();
|
||||
}
|
||||
})
|
||||
.setNegativeButton( R.string.button_cancel, null )
|
||||
.create();
|
||||
break;
|
||||
case NO_NAME_FOUND:
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setPositiveButton( R.string.button_ok, null )
|
||||
// message added below since varies with language etc.
|
||||
.setMessage("") // if not set here can't change later
|
||||
.create();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return dialog;
|
||||
} // onCreateDialog
|
||||
|
@ -490,18 +489,26 @@ public class GameConfig extends XWActivity
|
|||
m_gi.juggle();
|
||||
loadPlayers();
|
||||
} else if ( m_notNetworkedGameCheckbx == view ) {
|
||||
if ( m_gi.nPlayers < 2 ) {
|
||||
Assert.assertTrue( m_gi.nPlayers == 1 );
|
||||
m_gi.addPlayer();
|
||||
Toast.makeText( this, R.string.added_player,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
m_notNetworkedGame = m_notNetworkedGameCheckbx.isChecked();
|
||||
m_gi.setServerRole( m_notNetworkedGame
|
||||
? DeviceRole.SERVER_STANDALONE
|
||||
: DeviceRole.SERVER_ISCLIENT );
|
||||
Runnable proc = new Runnable() {
|
||||
public void run() {
|
||||
if ( m_gi.nPlayers < 2 ) {
|
||||
Assert.assertTrue( m_gi.nPlayers == 1 );
|
||||
m_gi.addPlayer();
|
||||
Toast.makeText( GameConfig.this,
|
||||
R.string.added_player,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
m_notNetworkedGame =
|
||||
m_notNetworkedGameCheckbx.isChecked();
|
||||
m_gi.setServerRole( m_notNetworkedGame
|
||||
? DeviceRole.SERVER_STANDALONE
|
||||
: DeviceRole.SERVER_ISCLIENT );
|
||||
|
||||
loadPlayers();
|
||||
loadPlayers();
|
||||
}
|
||||
};
|
||||
showNotAgainDlgThen( R.string.not_again_relay,
|
||||
R.string.key_notagain_relay, proc );
|
||||
} else if ( m_joinPublicCheck == view ) {
|
||||
adjustConnectStuff();
|
||||
// } else if ( m_configureButton == view ) {
|
||||
|
|
|
@ -113,6 +113,7 @@ public class GamesList extends XWListActivity
|
|||
String msg = String.format( format, m_missingDict );
|
||||
((AlertDialog)dialog).setMessage( msg );
|
||||
}
|
||||
super.onPrepareDialog( id, dialog );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,6 +137,8 @@ public class GamesList extends XWListActivity
|
|||
public void onClick( View v ) {
|
||||
saveNew( new CurGameInfo( GamesList.this ) );
|
||||
onContentChanged();
|
||||
showNotAgainDlgThen( R.string.not_again_newgame,
|
||||
R.string.key_notagain_newgame, null );
|
||||
}
|
||||
} );
|
||||
|
||||
|
@ -217,9 +220,6 @@ public class GamesList extends XWListActivity
|
|||
{
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate( R.menu.games_list_item_menu, menu );
|
||||
if ( CommonPrefs.getClickLaunches( this ) ) {
|
||||
menu.removeItem( R.id.list_item_play );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -303,12 +303,13 @@ public class GamesList extends XWListActivity
|
|||
protected void onListItemClick( ListView l, View v, int position, long id )
|
||||
{
|
||||
super.onListItemClick( l, v, position, id );
|
||||
|
||||
if ( CommonPrefs.getClickLaunches( this ) ) {
|
||||
handleMenuItem( R.id.list_item_play, position );
|
||||
} else {
|
||||
v.showContextMenu();
|
||||
}
|
||||
String path = GameUtils.gamesList( this )[position];
|
||||
File file = new File( path );
|
||||
Uri uri = Uri.fromFile( file );
|
||||
Intent intent = new Intent( Intent.ACTION_EDIT, uri,
|
||||
this, BoardActivity.class );
|
||||
startActivity( intent );
|
||||
m_invalPath = path;
|
||||
}
|
||||
|
||||
private boolean handleMenuItem( int menuID, int position )
|
||||
|
@ -330,21 +331,13 @@ public class GamesList extends XWListActivity
|
|||
showDialog( WARN_NODICT );
|
||||
} else {
|
||||
switch ( menuID ) {
|
||||
case R.id.list_item_play:
|
||||
File file = new File( path );
|
||||
Uri uri = Uri.fromFile( file );
|
||||
Intent intent = new Intent( Intent.ACTION_EDIT, uri,
|
||||
this, BoardActivity.class );
|
||||
startActivity( intent );
|
||||
m_invalPath = path;
|
||||
break;
|
||||
|
||||
case R.id.list_item_config:
|
||||
doConfig( path );
|
||||
m_invalPath = path;
|
||||
break;
|
||||
|
||||
case R.id.list_item_reset:
|
||||
// TODO confirm_data_loss();
|
||||
GameUtils.resetGame( this, path, path );
|
||||
invalPath = path;
|
||||
break;
|
||||
|
|
|
@ -66,6 +66,12 @@ public class XWActivity extends Activity {
|
|||
return m_delegate.onCreateDialog( id );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPrepareDialog( int id, Dialog dialog )
|
||||
{
|
||||
m_delegate.onPrepareDialog( id, dialog );
|
||||
}
|
||||
|
||||
// these are duplicated in XWListActivity -- sometimes multiple
|
||||
// inheritance would be nice to have...
|
||||
protected void showAboutDialog()
|
||||
|
|
|
@ -62,6 +62,12 @@ public class XWListActivity extends ListActivity {
|
|||
return dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPrepareDialog( int id, Dialog dialog )
|
||||
{
|
||||
m_delegate.onPrepareDialog( id, dialog );
|
||||
}
|
||||
|
||||
// It sucks that these must be duplicated here and XWActivity
|
||||
protected void showAboutDialog()
|
||||
{
|
||||
|
|
|
@ -242,11 +242,6 @@ public class CommonPrefs {
|
|||
return getPrefsBoolean( context, R.string.key_hide_title, true );
|
||||
}
|
||||
|
||||
public static boolean getClickLaunches( Context context )
|
||||
{
|
||||
return getPrefsBoolean( context, R.string.key_click_launches, false );
|
||||
}
|
||||
|
||||
public static boolean getShowBonusSumms( Context context )
|
||||
{
|
||||
return getPrefsBoolean( context, R.string.key_show_bonussum, false );
|
||||
|
|
Loading…
Add table
Reference in a new issue