mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-29 10:26:36 +01:00
Merge branch 'android_branch' into send_in_background
This commit is contained in:
commit
867b9118c1
18 changed files with 268 additions and 166 deletions
|
@ -31,6 +31,8 @@
|
|||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<!-- <uses-permission android:name="android.permission.RECEIVE_SMS" /> -->
|
||||
<!-- <uses-permission android:name="android.permission.SEND_SMS" /> -->
|
||||
|
||||
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
|
||||
|
||||
|
@ -122,5 +124,13 @@
|
|||
|
||||
<service android:name="RelayService"/>
|
||||
|
||||
<!-- <receiver android:name="NBSReceiver"> -->
|
||||
<!-- <intent-filter android:priority="10"> -->
|
||||
<!-- <action android:name="android.intent.action.DATA_SMS_RECEIVED" /> -->
|
||||
<!-- <data android:scheme="sms" /> -->
|
||||
<!-- <data android:port="50009" /> -->
|
||||
<!-- </intent-filter> -->
|
||||
<!-- </receiver> -->
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="4dip"
|
||||
/> <!-- end players column -->
|
||||
|
||||
<!-- holds right column. Could hold more... -->
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
<li>Use the term "wordlist" instead of "dictionary" to not imply that
|
||||
there are definitions provided.</li>
|
||||
|
||||
<li>Add color of bonus hints -- the 2L etc. that appear on the board
|
||||
-- to set of editable colors</li>
|
||||
|
||||
<li>Change how downloaded wordlists are opened to consume much less
|
||||
Java memory. Downside: wordlists on external storage are not
|
||||
available when that storage is mounted on a computer over USB.</li>
|
||||
|
@ -34,6 +37,9 @@
|
|||
from standalone. These are placeholders until I can get an artist
|
||||
to help out. :-)</li>
|
||||
|
||||
<li>Fix a family of crashes that occurred when dialogs were up and
|
||||
memory got low: rare, but annoying.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>Please remember that this is beta software. Please let me know (at
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<string name="key_empty">key_clr_empty</string>
|
||||
<string name="key_background">key_clr_background</string>
|
||||
<string name="key_clr_crosshairs">key_clr_crosshairs</string>
|
||||
<string name="key_clr_bonushint">key_clr_bonushint</string>
|
||||
|
||||
<string name="key_relay_host">key_relay_host</string>
|
||||
<string name="key_redir_host">key_redir_host</string>
|
||||
|
|
|
@ -332,6 +332,7 @@
|
|||
<string name="empty">Empty cell/background</string>
|
||||
<string name="clr_crosshairs">Crosshairs color</string>
|
||||
<string name="background">Board background</string>
|
||||
<string name="key_bonushint">In-square bonus hint</string>
|
||||
|
||||
<string name="tab_relay">Internet/Relay</string>
|
||||
<string name="tab_sms">SMS (broken)</string>
|
||||
|
|
|
@ -177,6 +177,13 @@
|
|||
android:title="@string/clr_crosshairs"
|
||||
android:defaultValue="0x7070FF"
|
||||
/>
|
||||
|
||||
<org.eehouse.android.xw4.EditColorPreference
|
||||
android:key="@string/key_clr_bonushint"
|
||||
android:title="@string/key_bonushint"
|
||||
android:defaultValue="0x7F7F7F"
|
||||
/>
|
||||
|
||||
<org.eehouse.android.xw4.EditColorPreference
|
||||
android:key="@string/key_tile_back"
|
||||
android:title="@string/tile_back"
|
||||
|
|
|
@ -75,11 +75,22 @@ public class BoardActivity extends XWActivity
|
|||
|
||||
private static final int UNDO_LAST_ACTION = 1;
|
||||
private static final int LAUNCH_INVITE_ACTION = 2;
|
||||
private static final int SYNC_ACTION = 3;
|
||||
private static final int COMMIT_ACTION = 4;
|
||||
private static final int SHOW_EXPL_ACTION = 5;
|
||||
private static final int PREV_HINT_ACTION = 6;
|
||||
private static final int NEXT_HINT_ACTION = 7;
|
||||
private static final int JUGGLE_ACTION = 8;
|
||||
private static final int FLIP_ACTION = 9;
|
||||
private static final int ZOOM_ACTION = 10;
|
||||
private static final int UNDO_ACTION = 11;
|
||||
private static final int CHAT_ACTION = 12;
|
||||
|
||||
private static final String DLG_TITLE = "DLG_TITLE";
|
||||
private static final String DLG_TITLESTR = "DLG_TITLESTR";
|
||||
private static final String DLG_BYTES = "DLG_BYTES";
|
||||
private static final String ROOM = "ROOM";
|
||||
private static final String TOASTSTR = "TOASTSTR";
|
||||
|
||||
private BoardView m_view;
|
||||
private int m_jniGamePtr;
|
||||
|
@ -114,6 +125,7 @@ public class BoardActivity extends XWActivity
|
|||
private boolean m_blockingDlgPosted = false;
|
||||
|
||||
private String m_room;
|
||||
private String m_toastStr;
|
||||
private int m_missing;
|
||||
private boolean m_haveInvited = false;
|
||||
|
||||
|
@ -364,6 +376,7 @@ public class BoardActivity extends XWActivity
|
|||
outState.putString( DLG_TITLESTR, m_dlgTitleStr );
|
||||
outState.putString( DLG_BYTES, m_dlgBytes );
|
||||
outState.putString( ROOM, m_room );
|
||||
outState.putString( TOASTSTR, m_toastStr );
|
||||
}
|
||||
|
||||
private void getBundledData( Bundle bundle )
|
||||
|
@ -373,6 +386,7 @@ public class BoardActivity extends XWActivity
|
|||
m_dlgTitle = bundle.getInt( DLG_TITLE );
|
||||
m_dlgBytes = bundle.getString( DLG_BYTES );
|
||||
m_room = bundle.getString( ROOM );
|
||||
m_toastStr = bundle.getString( TOASTSTR );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,13 +495,8 @@ public class BoardActivity extends XWActivity
|
|||
int id = item.getItemId();
|
||||
switch ( id ) {
|
||||
case R.id.board_menu_done:
|
||||
proc = new Runnable() {
|
||||
public void run() {
|
||||
checkAndHandle( JNIThread.JNICmd.CMD_COMMIT );
|
||||
}
|
||||
};
|
||||
showNotAgainDlgThen( R.string.not_again_done,
|
||||
R.string.key_notagain_done, proc );
|
||||
R.string.key_notagain_done, COMMIT_ACTION );
|
||||
break;
|
||||
// case R.id.board_menu_juggle:
|
||||
// cmd = JNIThread.JNICmd.CMD_JUGGLE;
|
||||
|
@ -541,7 +550,9 @@ public class BoardActivity extends XWActivity
|
|||
break;
|
||||
|
||||
case R.id.gamel_menu_checkmoves:
|
||||
doSyncMenuitem();
|
||||
showNotAgainDlgThen( R.string.not_again_sync,
|
||||
R.string.key_notagain_sync,
|
||||
SYNC_ACTION );
|
||||
break;
|
||||
|
||||
case R.id.board_menu_file_prefs:
|
||||
|
@ -570,13 +581,7 @@ public class BoardActivity extends XWActivity
|
|||
@Override
|
||||
public void dlgButtonClicked( int id, int which )
|
||||
{
|
||||
switch ( id ) {
|
||||
case UNDO_LAST_ACTION:
|
||||
if ( AlertDialog.BUTTON_POSITIVE == which ) {
|
||||
m_jniThread.handle( JNIThread.JNICmd.CMD_UNDO_LAST );
|
||||
}
|
||||
break;
|
||||
case LAUNCH_INVITE_ACTION:
|
||||
if ( LAUNCH_INVITE_ACTION == id ) {
|
||||
if ( DlgDelegate.DISMISS_BUTTON != which ) {
|
||||
GameUtils.launchInviteActivity( BoardActivity.this,
|
||||
DlgDelegate.TEXT_BTN == which,
|
||||
|
@ -584,9 +589,46 @@ public class BoardActivity extends XWActivity
|
|||
m_gi.dictLang,
|
||||
m_gi.nPlayers );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Assert.fail();
|
||||
} else if ( AlertDialog.BUTTON_POSITIVE == which ) {
|
||||
switch ( id ) {
|
||||
case UNDO_LAST_ACTION:
|
||||
m_jniThread.handle( JNIThread.JNICmd.CMD_UNDO_LAST );
|
||||
break;
|
||||
case SYNC_ACTION:
|
||||
doSyncMenuitem();
|
||||
break;
|
||||
case COMMIT_ACTION:
|
||||
checkAndHandle( JNIThread.JNICmd.CMD_COMMIT );
|
||||
break;
|
||||
case SHOW_EXPL_ACTION:
|
||||
Toast.makeText( BoardActivity.this, m_toastStr,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
m_toastStr = null;
|
||||
break;
|
||||
case PREV_HINT_ACTION:
|
||||
checkAndHandle( JNIThread.JNICmd.CMD_PREV_HINT );
|
||||
break;
|
||||
case NEXT_HINT_ACTION:
|
||||
checkAndHandle( JNIThread.JNICmd.CMD_NEXT_HINT );
|
||||
break;
|
||||
case JUGGLE_ACTION:
|
||||
checkAndHandle( JNIThread.JNICmd.CMD_JUGGLE );
|
||||
break;
|
||||
case FLIP_ACTION:
|
||||
checkAndHandle( JNIThread.JNICmd.CMD_FLIP );
|
||||
break;
|
||||
case ZOOM_ACTION:
|
||||
checkAndHandle( JNIThread.JNICmd.CMD_TOGGLEZOOM );
|
||||
break;
|
||||
case UNDO_ACTION:
|
||||
checkAndHandle( JNIThread.JNICmd.CMD_UNDO_CUR );
|
||||
break;
|
||||
case CHAT_ACTION:
|
||||
startChatActivity();
|
||||
break;
|
||||
default:
|
||||
Assert.fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -777,17 +819,12 @@ public class BoardActivity extends XWActivity
|
|||
}
|
||||
|
||||
if ( null != str ) {
|
||||
final String fstr = str;
|
||||
Runnable proc = new Runnable() {
|
||||
public void run() {
|
||||
Toast.makeText( BoardActivity.this, fstr,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
};
|
||||
m_toastStr = str;
|
||||
if ( naMsg == 0 ) {
|
||||
proc.run();
|
||||
dlgButtonClicked( SHOW_EXPL_ACTION,
|
||||
AlertDialog.BUTTON_POSITIVE );
|
||||
} else {
|
||||
showNotAgainDlgThen( naMsg, naKey, proc );
|
||||
showNotAgainDlgThen( naMsg, naKey, SHOW_EXPL_ACTION );
|
||||
}
|
||||
}
|
||||
} // handleConndMessage
|
||||
|
@ -894,8 +931,7 @@ public class BoardActivity extends XWActivity
|
|||
post( new Runnable() {
|
||||
public void run() {
|
||||
showNotAgainDlgThen( R.string.not_again_turnchanged,
|
||||
R.string.key_notagain_turnchanged,
|
||||
null );
|
||||
R.string.key_notagain_turnchanged );
|
||||
}
|
||||
} );
|
||||
m_jniThread.handle( JNIThread.JNICmd. CMD_ZOOM, -8 );
|
||||
|
@ -1165,71 +1201,31 @@ public class BoardActivity extends XWActivity
|
|||
m_toolbar.setListener( Toolbar.BUTTON_HINT_PREV,
|
||||
R.string.not_again_hintprev,
|
||||
R.string.key_notagain_hintprev,
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
checkAndHandle( JNIThread.JNICmd.
|
||||
CMD_PREV_HINT );
|
||||
}
|
||||
} );
|
||||
PREV_HINT_ACTION );
|
||||
m_toolbar.setListener( Toolbar.BUTTON_HINT_NEXT,
|
||||
R.string.not_again_hintnext,
|
||||
R.string.key_notagain_hintnext,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
checkAndHandle( JNIThread.JNICmd
|
||||
.CMD_NEXT_HINT );
|
||||
}
|
||||
} );
|
||||
NEXT_HINT_ACTION );
|
||||
m_toolbar.setListener( Toolbar.BUTTON_JUGGLE,
|
||||
R.string.not_again_juggle,
|
||||
R.string.key_notagain_juggle,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
checkAndHandle( JNIThread.JNICmd
|
||||
.CMD_JUGGLE );
|
||||
}
|
||||
} );
|
||||
JUGGLE_ACTION );
|
||||
m_toolbar.setListener( Toolbar.BUTTON_FLIP,
|
||||
R.string.not_again_flip,
|
||||
R.string.key_notagain_flip,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
checkAndHandle( JNIThread.JNICmd
|
||||
.CMD_FLIP );
|
||||
}
|
||||
} );
|
||||
FLIP_ACTION );
|
||||
m_toolbar.setListener( Toolbar.BUTTON_ZOOM,
|
||||
R.string.not_again_zoom,
|
||||
R.string.key_notagain_zoom,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
checkAndHandle( JNIThread.JNICmd
|
||||
.CMD_TOGGLEZOOM );
|
||||
}
|
||||
} );
|
||||
ZOOM_ACTION );
|
||||
m_toolbar.setListener( Toolbar.BUTTON_UNDO,
|
||||
R.string.not_again_undo,
|
||||
R.string.key_notagain_undo,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
checkAndHandle( JNIThread.JNICmd
|
||||
.CMD_UNDO_CUR );
|
||||
}
|
||||
});
|
||||
UNDO_ACTION );
|
||||
m_toolbar.setListener( Toolbar.BUTTON_CHAT,
|
||||
R.string.not_again_chat,
|
||||
R.string.key_notagain_chat,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
startChatActivity();
|
||||
}
|
||||
});
|
||||
CHAT_ACTION );
|
||||
} // populateToolbar
|
||||
|
||||
private OnDismissListener makeODLforBlocking( final int id )
|
||||
|
|
|
@ -119,7 +119,6 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
|||
private static final int BLACK = 0xFF000000;
|
||||
private static final int WHITE = 0xFFFFFFFF;
|
||||
private static final int FRAME_GREY = 0xFF101010;
|
||||
private static final int GREY = 0xFF7F7F7F;
|
||||
private int[] m_bonusColors;
|
||||
private int[] m_playerColors;
|
||||
private int[] m_otherColors;
|
||||
|
@ -506,7 +505,8 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
|||
m_origin.setBounds( rect );
|
||||
m_origin.draw( m_canvas );
|
||||
} else if ( null != bonusStr ) {
|
||||
m_fillPaint.setColor( GREY );
|
||||
m_fillPaint.
|
||||
setColor( m_otherColors[CommonPrefs.COLOR_BONUSHINT] );
|
||||
Rect brect = new Rect( rect );
|
||||
brect.inset( 0, brect.height()/10 );
|
||||
drawCentered( bonusStr, brect, m_fontDims );
|
||||
|
@ -562,8 +562,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
|||
public void run() {
|
||||
m_parent.
|
||||
showNotAgainDlgThen( R.string.not_again_arrow,
|
||||
R.string.key_notagain_arrow,
|
||||
null );
|
||||
R.string.key_notagain_arrow );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -48,10 +48,16 @@ public class DlgDelegate {
|
|||
public static final int TEXT_BTN = AlertDialog.BUTTON_POSITIVE;
|
||||
public static final int HTML_BTN = AlertDialog.BUTTON_NEGATIVE;
|
||||
public static final int DISMISS_BUTTON = 0;
|
||||
public static final int SKIP_CALLBACK = -1;
|
||||
|
||||
private static final String MSG = "msg";
|
||||
private static final String CALLBACK = "callback";
|
||||
private static final String MSGID = "msgid";
|
||||
private static final String PREFSKEY = "prefskey";
|
||||
|
||||
// Cache a couple of callback implementations that never change:
|
||||
private DialogInterface.OnClickListener m_cbkOnClickLstnr = null;
|
||||
private DialogInterface.OnDismissListener m_cbkOnDismissLstnr = null;
|
||||
|
||||
public interface DlgClickNotify {
|
||||
void dlgButtonClicked( int id, int button );
|
||||
|
@ -61,7 +67,6 @@ public class DlgDelegate {
|
|||
private int m_cbckID = 0; // if this can be set twice I have a
|
||||
// problem. See asserts below.
|
||||
private String m_msg;
|
||||
private Runnable m_proc = null;
|
||||
private int m_prefsKey;
|
||||
private Activity m_activity;
|
||||
private DlgClickNotify m_clickCallback;
|
||||
|
@ -77,6 +82,7 @@ public class DlgDelegate {
|
|||
m_msg = bundle.getString( MSG );
|
||||
m_cbckID = bundle.getInt( CALLBACK );
|
||||
m_msgID = bundle.getInt( MSGID );
|
||||
m_prefsKey = bundle.getInt( PREFSKEY );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,6 +91,7 @@ public class DlgDelegate {
|
|||
outState.putString( MSG, m_msg );
|
||||
outState.putInt( CALLBACK, m_cbckID );
|
||||
outState.putInt( MSGID, m_msgID );
|
||||
outState.putInt( PREFSKEY, m_prefsKey );
|
||||
}
|
||||
|
||||
public Dialog onCreateDialog( int id )
|
||||
|
@ -152,21 +159,31 @@ public class DlgDelegate {
|
|||
}
|
||||
|
||||
public void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||
Runnable proc )
|
||||
int callbackID )
|
||||
{
|
||||
boolean set = CommonPrefs.getPrefsBoolean( m_activity, prefsKey, false );
|
||||
if ( set ) {
|
||||
if ( null != proc ) {
|
||||
proc.run();
|
||||
}
|
||||
if ( set || 0 != m_cbckID ) {
|
||||
// If it's set, do the action without bothering with the
|
||||
// dialog
|
||||
if ( SKIP_CALLBACK != callbackID ) {
|
||||
m_clickCallback.dlgButtonClicked( callbackID,
|
||||
AlertDialog.BUTTON_POSITIVE );
|
||||
}
|
||||
} else {
|
||||
m_msgID = msgID;
|
||||
m_proc = proc;
|
||||
Assert.assertTrue( 0 != callbackID );
|
||||
Assert.assertTrue( 0 == m_cbckID ); // fired
|
||||
m_cbckID = callbackID;
|
||||
m_prefsKey = prefsKey;
|
||||
m_activity.showDialog( DIALOG_NOTAGAIN );
|
||||
}
|
||||
}
|
||||
|
||||
public void showNotAgainDlgThen( int msgID, int prefsKey )
|
||||
{
|
||||
showNotAgainDlgThen( msgID, prefsKey, SKIP_CALLBACK );
|
||||
}
|
||||
|
||||
public void showConfirmThen( String msg, int callbackID )
|
||||
{
|
||||
m_msg = msg;
|
||||
|
@ -239,36 +256,29 @@ public class DlgDelegate {
|
|||
|
||||
private Dialog createNotAgainDialog()
|
||||
{
|
||||
Dialog dialog = null;
|
||||
if ( 0 != m_msgID ) {
|
||||
DialogInterface.OnClickListener lstnr_p =
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int item ) {
|
||||
if ( null != m_proc ) {
|
||||
m_proc.run();
|
||||
}
|
||||
}
|
||||
};
|
||||
DialogInterface.OnClickListener lstnr_p = mkCallbackClickListener();
|
||||
|
||||
DialogInterface.OnClickListener lstnr_n =
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int item ) {
|
||||
CommonPrefs.setPrefsBoolean( m_activity, m_prefsKey,
|
||||
true );
|
||||
if ( null != m_proc ) {
|
||||
m_proc.run();
|
||||
}
|
||||
DialogInterface.OnClickListener lstnr_n =
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int item ) {
|
||||
CommonPrefs.setPrefsBoolean( m_activity, m_prefsKey,
|
||||
true );
|
||||
if ( SKIP_CALLBACK != m_cbckID ) {
|
||||
m_clickCallback.
|
||||
dlgButtonClicked( m_cbckID,
|
||||
AlertDialog.BUTTON_POSITIVE );
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
dialog = new AlertDialog.Builder( m_activity )
|
||||
.setTitle( R.string.newbie_title )
|
||||
.setMessage( m_msgID )
|
||||
.setPositiveButton( R.string.button_ok, lstnr_p )
|
||||
.setNegativeButton( R.string.button_notagain, lstnr_n )
|
||||
.create();
|
||||
}
|
||||
return dialog;
|
||||
Dialog dialog = new AlertDialog.Builder( m_activity )
|
||||
.setTitle( R.string.newbie_title )
|
||||
.setMessage( m_msgID )
|
||||
.setPositiveButton( R.string.button_ok, lstnr_p )
|
||||
.setNegativeButton( R.string.button_notagain, lstnr_n )
|
||||
.create();
|
||||
|
||||
return setCallbackDismissListener( dialog );
|
||||
} // createNotAgainDialog
|
||||
|
||||
private Dialog createConfirmThenDialog()
|
||||
|
@ -317,28 +327,33 @@ public class DlgDelegate {
|
|||
|
||||
private DialogInterface.OnClickListener mkCallbackClickListener()
|
||||
{
|
||||
DialogInterface.OnClickListener lstnr =
|
||||
new DialogInterface.OnClickListener() {
|
||||
if ( null == m_cbkOnClickLstnr ) {
|
||||
m_cbkOnClickLstnr = new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int button ) {
|
||||
Assert.assertTrue( 0 != m_cbckID );
|
||||
m_clickCallback.dlgButtonClicked( m_cbckID, button );
|
||||
if ( SKIP_CALLBACK != m_cbckID ) {
|
||||
m_clickCallback.dlgButtonClicked( m_cbckID,
|
||||
button );
|
||||
}
|
||||
}
|
||||
};
|
||||
return lstnr;
|
||||
}
|
||||
return m_cbkOnClickLstnr;
|
||||
}
|
||||
|
||||
private Dialog setCallbackDismissListener( Dialog dialog )
|
||||
{
|
||||
DialogInterface.OnDismissListener lstnr =
|
||||
new DialogInterface.OnDismissListener() {
|
||||
if ( null == m_cbkOnDismissLstnr ) {
|
||||
m_cbkOnDismissLstnr = new DialogInterface.OnDismissListener() {
|
||||
public void onDismiss( DialogInterface di ) {
|
||||
Assert.assertTrue( 0 != m_cbckID );
|
||||
m_clickCallback.dlgButtonClicked( m_cbckID,
|
||||
DISMISS_BUTTON );
|
||||
if ( SKIP_CALLBACK != m_cbckID ) {
|
||||
m_clickCallback.dlgButtonClicked( m_cbckID,
|
||||
DISMISS_BUTTON );
|
||||
}
|
||||
m_cbckID = 0;
|
||||
}
|
||||
};
|
||||
dialog.setOnDismissListener( lstnr );
|
||||
}
|
||||
dialog.setOnDismissListener( m_cbkOnDismissLstnr );
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ public class GameConfig extends XWActivity
|
|||
private static final int NO_NAME_FOUND = PLAYER_EDIT + 4;
|
||||
|
||||
private static final String WHICH_PLAYER = "WHICH_PLAYER";
|
||||
private static final int LOCKED_CHANGE_ACTION = 1;
|
||||
|
||||
private CheckBox m_joinPublicCheck;
|
||||
private CheckBox m_gameLockedCheck;
|
||||
|
@ -539,6 +540,20 @@ public class GameConfig extends XWActivity
|
|||
showDialog( NO_NAME_FOUND );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dlgButtonClicked( int id, int button )
|
||||
{
|
||||
switch( id ) {
|
||||
case LOCKED_CHANGE_ACTION:
|
||||
if ( AlertDialog.BUTTON_POSITIVE == button ) {
|
||||
handleLockedChange();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Assert.fail();
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick( View view )
|
||||
{
|
||||
if ( m_addPlayerButton == view ) {
|
||||
|
@ -555,11 +570,7 @@ public class GameConfig extends XWActivity
|
|||
} else if ( m_gameLockedCheck == view ) {
|
||||
showNotAgainDlgThen( R.string.not_again_unlock,
|
||||
R.string.key_notagain_unlock,
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
handleLockedChange();
|
||||
}
|
||||
});
|
||||
LOCKED_CHANGE_ACTION );
|
||||
} else if ( m_refreshRoomsButton == view ) {
|
||||
refreshNames();
|
||||
} else if ( m_playButton == view ) {
|
||||
|
|
|
@ -67,6 +67,8 @@ public class GamesList extends XWListActivity
|
|||
private static final int RESET_GAME_ACTION = 2;
|
||||
private static final int DELETE_GAME_ACTION = 3;
|
||||
private static final int DELETE_ALL_ACTION = 4;
|
||||
private static final int SYNC_MENU_ACTION = 5;
|
||||
private static final int DUPE_GAME_ACTION = 6;
|
||||
|
||||
private GameListAdapter m_adapter;
|
||||
private String m_missingDict;
|
||||
|
@ -426,6 +428,15 @@ public class GamesList extends XWListActivity
|
|||
m_adapter.inval( games[ii] );
|
||||
}
|
||||
break;
|
||||
case SYNC_MENU_ACTION:
|
||||
doSyncMenuitem();
|
||||
break;
|
||||
case DUPE_GAME_ACTION:
|
||||
long newid = GameUtils.dupeGame( GamesList.this, m_rowid );
|
||||
if ( null != m_adapter ) {
|
||||
m_adapter.inval( newid );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Assert.fail();
|
||||
}
|
||||
|
@ -520,11 +531,7 @@ public class GamesList extends XWListActivity
|
|||
case R.id.gamel_menu_checkmoves:
|
||||
showNotAgainDlgThen( R.string.not_again_sync,
|
||||
R.string.key_notagain_sync,
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
doSyncMenuitem();
|
||||
}
|
||||
} );
|
||||
SYNC_MENU_ACTION );
|
||||
break;
|
||||
|
||||
case R.id.gamel_menu_prefs:
|
||||
|
@ -551,46 +558,36 @@ public class GamesList extends XWListActivity
|
|||
boolean handled = true;
|
||||
DialogInterface.OnClickListener lstnr;
|
||||
|
||||
final long rowid = DBUtils.gamesList( this )[position];
|
||||
|
||||
m_rowid = DBUtils.gamesList( this )[position];
|
||||
|
||||
if ( R.id.list_item_delete == menuID ) {
|
||||
m_rowid = rowid;
|
||||
showConfirmThen( R.string.confirm_delete, DELETE_GAME_ACTION );
|
||||
} else {
|
||||
if ( checkWarnNoDict( rowid ) ) {
|
||||
if ( checkWarnNoDict( m_rowid ) ) {
|
||||
switch ( menuID ) {
|
||||
case R.id.list_item_reset:
|
||||
m_rowid = rowid;
|
||||
showConfirmThen( R.string.confirm_reset, RESET_GAME_ACTION );
|
||||
break;
|
||||
case R.id.list_item_config:
|
||||
GameUtils.doConfig( this, rowid, GameConfig.class );
|
||||
GameUtils.doConfig( this, m_rowid, GameConfig.class );
|
||||
break;
|
||||
case R.id.list_item_rename:
|
||||
m_rowid = rowid;
|
||||
showDialog( RENAME_GAME );
|
||||
break;
|
||||
|
||||
case R.id.list_item_new_from:
|
||||
Runnable proc = new Runnable() {
|
||||
public void run() {
|
||||
long newid =
|
||||
GameUtils.dupeGame( GamesList.this, rowid );
|
||||
if ( null != m_adapter ) {
|
||||
m_adapter.inval( newid );
|
||||
}
|
||||
}
|
||||
};
|
||||
showNotAgainDlgThen( R.string.not_again_newfrom,
|
||||
R.string.key_notagain_newfrom, proc );
|
||||
R.string.key_notagain_newfrom,
|
||||
DUPE_GAME_ACTION );
|
||||
break;
|
||||
|
||||
case R.id.list_item_copy:
|
||||
GameSummary summary = DBUtils.getSummary( this, rowid, true );
|
||||
GameSummary summary = DBUtils.getSummary( this,
|
||||
m_rowid, true );
|
||||
if ( summary.inNetworkGame() ) {
|
||||
showOKOnlyDialog( R.string.no_copy_network );
|
||||
} else {
|
||||
byte[] stream = GameUtils.savedGame( this, rowid );
|
||||
byte[] stream = GameUtils.savedGame( this, m_rowid );
|
||||
GameUtils.GameLock lock =
|
||||
GameUtils.saveNewGame( this, stream );
|
||||
DBUtils.saveSummary( this, lock, summary );
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
// /* -*- compile-command: "cd ../../../../../; ant install"; -*- */
|
||||
// /*
|
||||
// * Copyright 2010 by Eric House (xwords@eehouse.org). All rights
|
||||
// * reserved.
|
||||
// *
|
||||
// * This program is free software; you can redistribute it and/or
|
||||
// * modify it under the terms of the GNU General Public License as
|
||||
// * published by the Free Software Foundation; either version 2 of the
|
||||
// * License, or (at your option) any later version.
|
||||
// *
|
||||
// * This program is distributed in the hope that it will be useful, but
|
||||
// * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// * General Public License for more details.
|
||||
// *
|
||||
// * You should have received a copy of the GNU General Public License
|
||||
// * along with this program; if not, write to the Free Software
|
||||
// * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
// */
|
||||
|
||||
// package org.eehouse.android.xw4;
|
||||
|
||||
// import android.content.BroadcastReceiver;
|
||||
// import android.content.Context;
|
||||
// import android.content.Intent;
|
||||
|
||||
// import android.telephony.SmsManager;
|
||||
|
||||
// public class NBSReceiver extends BroadcastReceiver {
|
||||
|
||||
// @Override
|
||||
// public void onReceive( Context context, Intent intent )
|
||||
// {
|
||||
// Utils.logf( "NBSReceiver::onReceive(intent=%s)!!!!",
|
||||
// intent.toString() );
|
||||
// }
|
||||
|
||||
// static void tryNBSMessage()
|
||||
// {
|
||||
// byte[] data = { 'a', 'b', 'c' };
|
||||
|
||||
// SmsManager mgr = SmsManager.getDefault();
|
||||
|
||||
// try {
|
||||
// mgr.sendDataMessage( "123-456-7890", null, (short)50009,
|
||||
// data, null, null );
|
||||
// // PendingIntent sentIntent,
|
||||
// // PendingIntent deliveryIntent );
|
||||
// Utils.logf( "sendDataMessage finished" );
|
||||
// } catch ( IllegalArgumentException iae ) {
|
||||
// Utils.logf( "%s", iae.toString() );
|
||||
// }
|
||||
// }
|
||||
// }
|
|
@ -47,8 +47,6 @@ public class NetLaunchInfo {
|
|||
bundle.putString( ROOM, room );
|
||||
bundle.putInt( NPLAYERS, nPlayers );
|
||||
bundle.putBoolean( VALID, m_valid );
|
||||
Utils.logf( "bundling NetLaunchInfo: %d, %s, %d, %b",
|
||||
lang, room, nPlayers, m_valid );
|
||||
}
|
||||
|
||||
public NetLaunchInfo( Bundle bundle )
|
||||
|
@ -57,8 +55,6 @@ public class NetLaunchInfo {
|
|||
room = bundle.getString( ROOM );
|
||||
nPlayers = bundle.getInt( NPLAYERS );
|
||||
m_valid = bundle.getBoolean( VALID );
|
||||
Utils.logf( "unbundled NetLaunchInfo: %d, %s, %d, %b",
|
||||
lang, room, nPlayers, m_valid );
|
||||
}
|
||||
|
||||
public static Uri makeLaunchUri( Context context, String room,
|
||||
|
|
|
@ -68,6 +68,7 @@ public class PrefsActivity extends PreferenceActivity
|
|||
R.string.key_clr_crosshairs,
|
||||
R.string.key_empty,
|
||||
R.string.key_background,
|
||||
R.string.key_clr_bonushint,
|
||||
};
|
||||
for ( int colorKey : colorKeys ) {
|
||||
editor.remove( getString(colorKey) );
|
||||
|
|
|
@ -85,11 +85,11 @@ public class Toolbar {
|
|||
}
|
||||
|
||||
public void setListener( int index, final int msgID, final int prefsKey,
|
||||
final Runnable proc )
|
||||
final int callback )
|
||||
{
|
||||
View.OnClickListener listener = new View.OnClickListener() {
|
||||
public void onClick( View view ) {
|
||||
m_activity.showNotAgainDlgThen( msgID, prefsKey, proc );
|
||||
m_activity.showNotAgainDlgThen( msgID, prefsKey, callback );
|
||||
}
|
||||
};
|
||||
setListener( index, listener );
|
||||
|
|
|
@ -116,9 +116,14 @@ public class XWActivity extends Activity
|
|||
}
|
||||
|
||||
protected void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||
Runnable proc )
|
||||
int action )
|
||||
{
|
||||
m_delegate.showNotAgainDlgThen( msgID, prefsKey, proc );
|
||||
m_delegate.showNotAgainDlgThen( msgID, prefsKey, action );
|
||||
}
|
||||
|
||||
protected void showNotAgainDlgThen( int msgID, int prefsKey )
|
||||
{
|
||||
m_delegate.showNotAgainDlgThen( msgID, prefsKey );
|
||||
}
|
||||
|
||||
protected void showOKOnlyDialog( int msgID )
|
||||
|
|
|
@ -112,14 +112,14 @@ public class XWListActivity extends ListActivity
|
|||
}
|
||||
|
||||
protected void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||
Runnable proc )
|
||||
int action )
|
||||
{
|
||||
m_delegate.showNotAgainDlgThen( msgID, prefsKey, proc );
|
||||
m_delegate.showNotAgainDlgThen( msgID, prefsKey, action );
|
||||
}
|
||||
|
||||
protected void showNotAgainDlg( int msgID, int prefsKey )
|
||||
{
|
||||
m_delegate.showNotAgainDlgThen( msgID, prefsKey, null );
|
||||
m_delegate.showNotAgainDlgThen( msgID, prefsKey );
|
||||
}
|
||||
|
||||
protected void showOKOnlyDialog( int msgID )
|
||||
|
@ -134,7 +134,7 @@ public class XWListActivity extends ListActivity
|
|||
|
||||
protected void showConfirmThen( int msg, int action )
|
||||
{
|
||||
m_delegate.showConfirmThen( getString(msg), action );
|
||||
showConfirmThen( getString(msg), action );
|
||||
}
|
||||
|
||||
protected void doSyncMenuitem()
|
||||
|
|
|
@ -36,7 +36,8 @@ public class CommonPrefs {
|
|||
public static final int COLOR_NOTILE = 1;
|
||||
public static final int COLOR_FOCUS = 2;
|
||||
public static final int COLOR_BACKGRND = 3;
|
||||
public static final int COLOR_LAST = 4;
|
||||
public static final int COLOR_BONUSHINT = 4;
|
||||
public static final int COLOR_LAST = 5;
|
||||
|
||||
private static CommonPrefs s_cp = null;
|
||||
|
||||
|
@ -101,6 +102,7 @@ public class CommonPrefs {
|
|||
R.string.key_empty,
|
||||
R.string.key_clr_crosshairs,
|
||||
R.string.key_background,
|
||||
R.string.key_clr_bonushint,
|
||||
};
|
||||
for ( int ii = 0; ii < idsOther.length; ++ii ) {
|
||||
otherColors[ii] = prefToColor( context, sp, idsOther[ii] );
|
||||
|
|
Loading…
Reference in a new issue