mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
Merge branch 'android_branch' into send_in_background
Conflicts: xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java
This commit is contained in:
commit
17edc79aaf
24 changed files with 145 additions and 43 deletions
|
@ -177,6 +177,9 @@ loadCommonPrefs( JNIEnv* env, CommonPrefs* cp, jobject j_cp )
|
|||
cp->showColors = getBool( env, j_cp, "showColors" );
|
||||
cp->sortNewTiles = getBool( env, j_cp, "sortNewTiles" );
|
||||
cp->allowPeek = getBool( env, j_cp, "allowPeek" );
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
cp->hideCrosshairs = getBool( env, j_cp, "hideCrosshairs" );
|
||||
#endif
|
||||
}
|
||||
|
||||
static XWStreamCtxt*
|
||||
|
|
|
@ -7,14 +7,6 @@
|
|||
android:layout_height="fill_parent"
|
||||
>
|
||||
|
||||
<TextView android:id="@+id/summary"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFFFF"
|
||||
/>
|
||||
|
||||
<ListView android:id="@+id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
|
|
|
@ -16,18 +16,23 @@
|
|||
android:title="@string/gamel_menu_dicts"
|
||||
android:icon="@drawable/dicticon"
|
||||
/>
|
||||
<item android:id="@+id/gamel_menu_checkmoves"
|
||||
android:title="@string/gamel_menu_checkmoves"
|
||||
android:icon="@drawable/stat_notify_sync"
|
||||
<item android:id="@+id/gamel_menu_about"
|
||||
android:title="@string/board_menu_file_about"
|
||||
android:icon="@android:drawable/ic_menu_info_details"
|
||||
/>
|
||||
|
||||
<item android:id="@+id/gamel_menu_email"
|
||||
android:title="@string/board_menu_file_email"
|
||||
android:icon="@android:drawable/ic_menu_send"
|
||||
/>
|
||||
|
||||
<item android:id="@+id/gamel_menu_delete_all"
|
||||
android:title="@string/gamel_menu_delete_all"
|
||||
android:icon="@android:drawable/ic_menu_delete"
|
||||
/>
|
||||
<item android:id="@+id/gamel_menu_about"
|
||||
android:title="@string/board_menu_file_about"
|
||||
android:icon="@android:drawable/ic_menu_info_details"
|
||||
android:alphabeticShortcut="A"
|
||||
<item android:id="@+id/gamel_menu_checkmoves"
|
||||
android:title="@string/gamel_menu_checkmoves"
|
||||
android:icon="@drawable/stat_notify_sync"
|
||||
/>
|
||||
|
||||
<!-- ic_menu_archive.png -->
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<string name="key_skip_confirm">key_skip_confirm</string>
|
||||
<string name="key_sort_tiles">key_sort_tiles</string>
|
||||
<string name="key_peek_other">key_peek_other</string>
|
||||
<string name="key_hide_crosshairs">key_hide_crosshairs</string>
|
||||
<string name="key_hide_values">key_hide_values</string>
|
||||
<string name="key_ringer_zoom">key_ringer_zoom</string>
|
||||
<string name="key_hide_title">key_hide_title</string>
|
||||
|
@ -81,6 +82,9 @@
|
|||
<!-- Name is not localized -->
|
||||
<string name="app_name">Crosswords</string>
|
||||
|
||||
<!-- Nor is my email address -->
|
||||
<string name="email_author_email">xwords@eehouse.org</string>
|
||||
|
||||
<!-- other -->
|
||||
<string name="default_host">eehouse.org</string>
|
||||
|
||||
|
|
|
@ -1057,6 +1057,18 @@
|
|||
<string name="peek_other_summary">Tapping on scoreboard name shows
|
||||
that player\'s tiles</string>
|
||||
|
||||
|
||||
<!-- If this preference is checked the "crosshairs" (vertical and
|
||||
horzontal lines through the cell your finger is on that help
|
||||
you tell where the app thinks you're actually tapping) will
|
||||
not be shown. Some users have complained that this feature
|
||||
is distracting, presumably because they're using tablets with
|
||||
large enough screens that they always know where they're
|
||||
tapping. -->
|
||||
<string name="hide_crosshairs">Disable crosshairs</string>
|
||||
<!-- explanation of the above -->
|
||||
<string name="hide_crosshairs_summary">Do not visually indicate which board cell is touched</string>
|
||||
|
||||
<string name="network_behavior">Network game settings</string>
|
||||
<!-- explanation of the above -->
|
||||
<string name="network_behavior_summary">Settings that apply to
|
||||
|
@ -1799,4 +1811,12 @@
|
|||
<string name="prompt_min_len">Words no shorter than</string>
|
||||
<string name="prompt_max_len">Words no longer than</string>
|
||||
|
||||
<string name="board_menu_file_email">Email author</string>
|
||||
<string name="email_author_subject">Comment about Crosswords</string>
|
||||
<string name="email_author_chooser">Send comment via</string>
|
||||
|
||||
<string name="email_body_revf">(If relevant, please include the
|
||||
version: \"%s\"; and make/model of your phone or
|
||||
tablet.)"</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -231,6 +231,11 @@
|
|||
android:summary="@string/ringer_zoom_summary"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<CheckBoxPreference android:key="@string/key_hide_crosshairs"
|
||||
android:title="@string/hide_crosshairs"
|
||||
android:summary="@string/hide_crosshairs_summary"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<CheckBoxPreference android:key="@string/key_peek_other"
|
||||
android:title="@string/peek_other"
|
||||
android:summary="@string/peek_other_summary"
|
||||
|
|
|
@ -543,6 +543,10 @@ public class GamesList extends XWListActivity
|
|||
showAboutDialog();
|
||||
break;
|
||||
|
||||
case R.id.gamel_menu_email:
|
||||
Utils.emailAuthor( this );
|
||||
break;
|
||||
|
||||
// case R.id.gamel_menu_view_hidden:
|
||||
// Utils.notImpl( this );
|
||||
// break;
|
||||
|
|
|
@ -69,7 +69,6 @@ public class LookupView extends LinearLayout
|
|||
private int m_state;
|
||||
private ArrayAdapter<String> m_wordsAdapter;
|
||||
private Button m_doneButton;
|
||||
private TextView m_summary;
|
||||
private Dialog m_dialog;
|
||||
private Context m_context;
|
||||
private int m_dlgId;
|
||||
|
@ -96,7 +95,6 @@ public class LookupView extends LinearLayout
|
|||
|
||||
m_doneButton = (Button)findViewById( R.id.button_done );
|
||||
m_doneButton.setOnClickListener( this );
|
||||
m_summary = (TextView)findViewById( R.id.summary );
|
||||
|
||||
switchState();
|
||||
}
|
||||
|
@ -233,12 +231,12 @@ public class LookupView extends LinearLayout
|
|||
|
||||
private void setSummary( int id )
|
||||
{
|
||||
m_summary.setText( m_context.getString( id ) );
|
||||
m_dialog.setTitle( m_context.getString( id ) );
|
||||
}
|
||||
|
||||
private void setSummary( String word )
|
||||
{
|
||||
String title = Utils.format( m_context, R.string.pick_url_titlef, word );
|
||||
m_summary.setText( title );
|
||||
m_dialog.setTitle( title );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class RelayReceiver extends BroadcastReceiver {
|
|||
{
|
||||
if ( null != intent && null != intent.getAction()
|
||||
&& intent.getAction().equals( Intent.ACTION_BOOT_COMPLETED ) ) {
|
||||
DbgUtils.logf( "launching timer on boot" );
|
||||
DbgUtils.logf("RelayReceiver.onReceive: launching timer on boot");
|
||||
RestartTimer( context );
|
||||
} else {
|
||||
// DbgUtils.logf( "RelayReceiver::onReceive()" );
|
||||
|
@ -82,10 +82,10 @@ public class RelayReceiver extends BroadcastReceiver {
|
|||
Intent intent = new Intent( context, RelayReceiver.class );
|
||||
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 );
|
||||
|
||||
if ( interval_millis > 0 || force ) {
|
||||
// DbgUtils.logf( "setting alarm for %d millis", interval_millis );
|
||||
if ( force || interval_millis > 0 ) {
|
||||
long first_millis = force ? 0 : interval_millis;
|
||||
am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,
|
||||
0, // first firing
|
||||
first_millis, // first firing
|
||||
interval_millis, pi );
|
||||
} else {
|
||||
am.cancel( pi );
|
||||
|
|
|
@ -57,6 +57,21 @@ public class Utils {
|
|||
} );
|
||||
}
|
||||
|
||||
public static void emailAuthor( Context context )
|
||||
{
|
||||
Intent intent = new Intent( Intent.ACTION_SEND );
|
||||
intent.setType( "text/html" );
|
||||
intent.putExtra( Intent.EXTRA_SUBJECT,
|
||||
context.getString( R.string.email_author_subject ) );
|
||||
String[] addrs = { context.getString( R.string.email_author_email ) };
|
||||
intent.putExtra( Intent.EXTRA_EMAIL, addrs );
|
||||
String body = format( context, R.string.email_body_revf,
|
||||
GitVersion.VERS );
|
||||
intent.putExtra( Intent.EXTRA_TEXT, body );
|
||||
String chooserMsg = context.getString( R.string.email_author_chooser );
|
||||
context.startActivity( Intent.createChooser( intent, chooserMsg ) );
|
||||
}
|
||||
|
||||
public static View inflate( Context context, int layoutId )
|
||||
{
|
||||
LayoutInflater factory = LayoutInflater.from( context );
|
||||
|
|
|
@ -30,6 +30,8 @@ public class XWApp extends Application {
|
|||
DbgUtils.logEnable( this );
|
||||
DbgUtils.logf( "XWApp.onCreate(); git_rev=%s",
|
||||
getString(R.string.git_rev) );
|
||||
|
||||
RelayReceiver.RestartTimer( this );
|
||||
super.onCreate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*- compile-command: "cd ../../../../../../; ant debug install"; -*- */
|
||||
/*
|
||||
* Copyright 2009-2010 by Eric House (xwords@eehouse.org). All
|
||||
* Copyright 2009 - 2011 by Eric House (xwords@eehouse.org). All
|
||||
* rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -27,7 +27,6 @@ import android.graphics.Paint;
|
|||
import android.content.res.Resources;
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eehouse.android.xw4.Utils;
|
||||
import org.eehouse.android.xw4.R;
|
||||
import org.eehouse.android.xw4.DictUtils;
|
||||
|
||||
|
@ -48,6 +47,7 @@ public class CommonPrefs {
|
|||
public boolean showColors;
|
||||
public boolean sortNewTiles;
|
||||
public boolean allowPeek;
|
||||
public boolean hideCrosshairs;
|
||||
|
||||
public int[] playerColors;
|
||||
public int[] bonusColors;
|
||||
|
@ -78,6 +78,7 @@ public class CommonPrefs {
|
|||
showColors = getBoolean( context, sp, R.string.key_color_tiles, true );
|
||||
sortNewTiles = getBoolean( context, sp, R.string.key_sort_tiles, true );
|
||||
allowPeek = getBoolean( context, sp, R.string.key_peek_other, false );
|
||||
hideCrosshairs = getBoolean( context, sp, R.string.key_hide_crosshairs, false );
|
||||
|
||||
int ids[] = { R.string.key_player0,
|
||||
R.string.key_player1,
|
||||
|
@ -181,31 +182,37 @@ public class CommonPrefs {
|
|||
public static int getDefaultBoardSize( Context context )
|
||||
{
|
||||
String value = getString( context, R.string.key_board_size );
|
||||
int result;
|
||||
try {
|
||||
return Integer.parseInt( value.substring( 0, 2 ) );
|
||||
result = Integer.parseInt( value.substring( 0, 2 ) );
|
||||
} catch ( Exception ex ) {
|
||||
return 15;
|
||||
result = 15;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int getDefaultPlayerMinutes( Context context )
|
||||
{
|
||||
String value = getString( context, R.string.key_initial_player_minutes );
|
||||
int result;
|
||||
try {
|
||||
return Integer.parseInt( value );
|
||||
result = Integer.parseInt( value );
|
||||
} catch ( Exception ex ) {
|
||||
return 25;
|
||||
result = 25;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static long getProxyInterval( Context context )
|
||||
{
|
||||
String value = getString( context, R.string.key_connect_frequency );
|
||||
long result;
|
||||
try {
|
||||
return Long.parseLong( value );
|
||||
result = Long.parseLong( value );
|
||||
} catch ( Exception ex ) {
|
||||
return -1;
|
||||
result = -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String getDefaultHumanDict( Context context )
|
||||
|
|
|
@ -227,7 +227,7 @@ public class UtilCtxtImpl implements UtilCtxt {
|
|||
}
|
||||
|
||||
private void subclassOverride( String name ) {
|
||||
DbgUtils.logf( "%s::%s() called", getClass().getName(), name );
|
||||
// DbgUtils.logf( "%s::%s() called", getClass().getName(), name );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -435,6 +435,9 @@ board_prefsChanged( BoardCtxt* board, CommonPrefs* cp )
|
|||
board->skipCommitConfirm = cp->skipCommitConfirm;
|
||||
board->showColors = cp->showColors;
|
||||
board->allowPeek = cp->allowPeek;
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
board->hideCrosshairs = cp->hideCrosshairs;
|
||||
#endif
|
||||
|
||||
if ( showArrowChanged ) {
|
||||
showArrowChanged = setArrowVisible( board, XP_FALSE );
|
||||
|
@ -1413,6 +1416,9 @@ invalCellsUnderRect( BoardCtxt* board, const XP_Rect* rect )
|
|||
void
|
||||
invalCol( BoardCtxt* board, XP_U16 col )
|
||||
{
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
XP_ASSERT( !board->hideCrosshairs );
|
||||
#endif
|
||||
XP_U16 row;
|
||||
XP_U16 nCols = model_numCols(board->model);
|
||||
for ( row = 0; row < nCols; ++row ) {
|
||||
|
@ -1423,6 +1429,9 @@ invalCol( BoardCtxt* board, XP_U16 col )
|
|||
void
|
||||
invalRow( BoardCtxt* board, XP_U16 row )
|
||||
{
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
XP_ASSERT( !board->hideCrosshairs );
|
||||
#endif
|
||||
XP_U16 col;
|
||||
XP_U16 nCols = model_numCols(board->model);
|
||||
for ( col = 0; col < nCols; ++col ) {
|
||||
|
|
|
@ -242,13 +242,15 @@ static CellFlags
|
|||
flagsForCrosshairs( const BoardCtxt* board, XP_U16 col, XP_U16 row )
|
||||
{
|
||||
CellFlags flags = 0;
|
||||
XP_Bool inHor, inVert;
|
||||
dragDropInCrosshairs( board, col, row, &inHor, &inVert );
|
||||
if ( inHor ) {
|
||||
flags |= CELL_CROSSHOR;
|
||||
}
|
||||
if ( inVert ) {
|
||||
flags |= CELL_CROSSVERT;
|
||||
if ( ! board->hideCrosshairs ) {
|
||||
XP_Bool inHor, inVert;
|
||||
dragDropInCrosshairs( board, col, row, &inHor, &inVert );
|
||||
if ( inHor ) {
|
||||
flags |= CELL_CROSSHOR;
|
||||
}
|
||||
if ( inVert ) {
|
||||
flags |= CELL_CROSSVERT;
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
|
|
@ -176,6 +176,9 @@ struct BoardCtxt {
|
|||
XP_Bool hideValsInTray;
|
||||
XP_Bool skipCommitConfirm;
|
||||
XP_Bool allowPeek; /* Can look at non-turn player's rack */
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
XP_Bool hideCrosshairs;
|
||||
#endif
|
||||
|
||||
XP_Bool eraseTray;
|
||||
XP_Bool boardObscuresTray;
|
||||
|
|
|
@ -200,6 +200,9 @@ typedef struct CommonPrefs {
|
|||
#endif
|
||||
XP_Bool showColors; /* applies to all games */
|
||||
XP_Bool allowPeek; /* applies to all games */
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
XP_Bool hideCrosshairs; /* applies to all games */
|
||||
#endif
|
||||
} CommonPrefs;
|
||||
|
||||
typedef struct _PlayerDicts {
|
||||
|
|
|
@ -92,7 +92,11 @@ ddStartBoard( BoardCtxt* board, XP_U16 xx, XP_U16 yy )
|
|||
|
||||
found = coordToCell( board, xx, yy, &col, &row );
|
||||
XP_ASSERT( found );
|
||||
(void)crosshairs_set( board, col, row );
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
if ( !board->hideCrosshairs ) {
|
||||
(void)crosshairs_set( board, col, row );
|
||||
}
|
||||
#endif
|
||||
|
||||
trayVisible = board->trayVisState == TRAY_REVEALED;
|
||||
if ( trayVisible && holdsPendingTile( board, col, row ) ) {
|
||||
|
@ -481,8 +485,12 @@ dragDropContinueImpl( BoardCtxt* board, XP_U16 xx, XP_U16 yy,
|
|||
if ( newInfo.obj == OBJ_BOARD ) {
|
||||
(void)coordToCell( board, xx, yy, &newInfo.u.board.col,
|
||||
&newInfo.u.board.row );
|
||||
draw = crosshairs_set( board, newInfo.u.board.col,
|
||||
newInfo.u.board.row );
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
if ( !board->hideCrosshairs ) {
|
||||
draw = crosshairs_set( board, newInfo.u.board.col,
|
||||
newInfo.u.board.row );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( ds->dtype == DT_DIVIDER ) {
|
||||
|
|
|
@ -2269,6 +2269,9 @@ gtkmain( LaunchParams* params, int argc, char *argv[] )
|
|||
globals.cGlobals.cp.robotThinkMin = params->robotThinkMin;
|
||||
globals.cGlobals.cp.robotThinkMax = params->robotThinkMax;
|
||||
#endif
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
globals.cGlobals.cp.hideCrosshairs = params->hideCrosshairs;
|
||||
#endif
|
||||
|
||||
setupGtkUtilCallbacks( &globals, params->util );
|
||||
|
||||
|
|
|
@ -412,6 +412,9 @@ typedef enum {
|
|||
,CMD_SKIPCONFIRM
|
||||
,CMD_VERTICALSCORE
|
||||
,CMD_NOPEEK
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
,CMD_NOCROSSHAIRS
|
||||
#endif
|
||||
,CMD_ADDPIPE
|
||||
,CMD_ADDNBS
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
|
@ -492,6 +495,9 @@ static CmdInfoRec CmdInfoRecs[] = {
|
|||
,{ CMD_SKIPCONFIRM, false, "skip-confirm", "don't confirm before commit" }
|
||||
,{ CMD_VERTICALSCORE, false, "vertical", "scoreboard is vertical" }
|
||||
,{ CMD_NOPEEK, false, "no-peek", "disallow scoreboard tap changing player" }
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
,{ CMD_NOCROSSHAIRS, false, "hide-crosshairs", "don't show crosshairs on board" }
|
||||
#endif
|
||||
,{ CMD_ADDPIPE, true, "with-pipe", "named pipe to listen on for relay msgs" }
|
||||
,{ CMD_ADDNBS, true, "with-nbs",
|
||||
"nbs socket to listen/reply on for relay msgs" }
|
||||
|
@ -1334,7 +1340,7 @@ main( int argc, char** argv )
|
|||
mainParams.allowPeek = XP_TRUE;
|
||||
mainParams.showRobotScores = XP_FALSE;
|
||||
mainParams.useMmap = XP_TRUE;
|
||||
|
||||
|
||||
/* serverName = mainParams.info.clientInfo.serverName = "localhost"; */
|
||||
|
||||
#if defined PLATFORM_GTK
|
||||
|
@ -1549,6 +1555,12 @@ main( int argc, char** argv )
|
|||
break;
|
||||
case CMD_NOPEEK:
|
||||
mainParams.allowPeek = XP_FALSE;
|
||||
break;
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
case CMD_NOCROSSHAIRS:
|
||||
mainParams.hideCrosshairs = XP_TRUE;
|
||||
break;
|
||||
#endif
|
||||
case CMD_ADDPIPE:
|
||||
mainParams.pipe = optarg;
|
||||
break;
|
||||
|
|
|
@ -80,6 +80,10 @@ typedef struct LaunchParams {
|
|||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
XP_Bool allowHintRect;
|
||||
#endif
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
XP_Bool hideCrosshairs;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XWFEATURE_SLOW_ROBOT
|
||||
XP_U16 robotThinkMin, robotThinkMax;
|
||||
|
|
|
@ -6,6 +6,7 @@ LIMIT=10000
|
|||
|
||||
usage() {
|
||||
echo "usage: $0 [--limit <n>]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
|
|
|
@ -6,6 +6,7 @@ CONNNAME=""
|
|||
|
||||
usage() {
|
||||
echo "usage: $0 [--connname <s>]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
|
|
|
@ -6,6 +6,7 @@ LIMIT=10000
|
|||
|
||||
usage() {
|
||||
echo "usage: $0 [--limit <n>]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
|
|
Loading…
Add table
Reference in a new issue