Merge branch 'android_branch' into android_sms_kitkat

This commit is contained in:
Eric House 2013-12-01 21:37:43 -08:00
commit 40a4bf348e
26 changed files with 214 additions and 129 deletions

View file

@ -22,7 +22,7 @@
to come from a domain that you own or have control over. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.eehouse.android.xw4"
android:versionCode="65"
android:versionCode="67"
android:versionName="@string/app_version"
>

View file

@ -54,6 +54,11 @@ static const SetInfo gi_bools[] = {
,ARR_MEMBER( CurGameInfo, allowHintRect )
};
static const SetInfo pl_ints[] = {
ARR_MEMBER( LocalPlayer, robotIQ )
,ARR_MEMBER( LocalPlayer, secondsUsed )
};
static CurGameInfo*
makeGI( MPFORMAL JNIEnv* env, jobject jgi )
{
@ -95,7 +100,8 @@ makeGI( MPFORMAL JNIEnv* env, jobject jgi )
jobject jlp = (*env)->GetObjectArrayElement( env, jplayers, ii );
XP_ASSERT( !!jlp );
lp->robotIQ = getInt( env, jlp, "robotIQ" );
getInts( env, (void*)lp, jlp, pl_ints, VSIZE(pl_ints) );
lp->isLocal = getBool( env, jlp, "isLocal" );
getString( env, jlp, "name", buf, VSIZE(buf) );
@ -105,8 +111,6 @@ makeGI( MPFORMAL JNIEnv* env, jobject jgi )
getString( env, jlp, "dictName", buf, VSIZE(buf) );
lp->dictName = copyString( mpool, buf );
lp->secondsUsed = 0;
deleteLocalRef( env, jlp );
}
deleteLocalRef( env, jplayers );
@ -143,12 +147,12 @@ setJGI( JNIEnv* env, jobject jgi, const CurGameInfo* gi )
jobject jlp = (*env)->GetObjectArrayElement( env, jplayers, ii );
XP_ASSERT( !!jlp );
setInt( env, jlp, "robotIQ", lp->robotIQ );
setInts( env, jlp, (void*)lp, pl_ints, VSIZE(pl_ints) );
setBool( env, jlp, "isLocal", lp->isLocal );
setString( env, jlp, "name", lp->name );
setString( env, jlp, "password", lp->password );
setString( env, jlp, "dictName", lp->dictName );
setInt( env, jlp, "secondsUsed", lp->secondsUsed );
deleteLocalRef( env, jlp );
}
@ -350,7 +354,9 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1tilesAreSame
{
jboolean result;
const DictionaryCtxt* dict1 = (DictionaryCtxt*)dictPtr1;
XP_ASSERT( !!dict1 );
const DictionaryCtxt* dict2 = (DictionaryCtxt*)dictPtr2;
XP_ASSERT( !!dict2 );
result = dict_tilesAreSame( dict1, dict2 );
return result;
}

View file

@ -16,6 +16,7 @@
android:layout_width="fill_parent"
android:text="@string/confirm_sms_expl"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginBottom="10dip"
/>
<Spinner android:id="@+id/confirm_sms_reasons"

View file

@ -2,6 +2,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/board_menu_invite"
android:title="@string/board_menu_invite"
/>
<group android:id="@+id/group_done">
<!-- title set in BoardActivity -->
<item android:id="@+id/board_menu_done"

View file

@ -5,13 +5,16 @@
</style>
</head>
<body>
<b>Crosswords 4.4 beta 73 release</b>
<b>Crosswords 4.4 beta 75 release</b>
<p>This release adds two new features, snapshots of in-progress games
<p>(Betas 74 and 75 fix a couple of crashing bugs but add nothing
new, so the previous notes remain in place.)</p>
<p>Beta 73 adds two new features, snapshots of in-progress games
displayed as part of the main Games List screen, and the ability to
send invitations by tapping your device against the one you want to
invite (using &quot;Near Field Communication&quot;, or NFC, which Google
brands &quot;Android beaming&quot;.)</p>
invite (using &quot;Near Field Communication&quot;, or NFC, which
Google brands &quot;Android beaming&quot;.)</p>
<p>Both features are optional. NFC is off by default, so you have to
enable it via Google's system Preferences app. And snapshots, while

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_version">4.4 beta 73</string>
<string name="app_version">4.4 beta 75</string>
</resources>

View file

@ -103,6 +103,7 @@
<string name="key_notagain_newfrom">key_notagain_newfrom</string>
<string name="key_notagain_trading">key_notagain_trading</string>
<string name="key_na_lookup">key_na_lookup</string>
<string name="key_na_firefox">key_na_firefox</string>
<string name="key_na_browse">key_na_browse</string>
<string name="key_na_browseall">key_na_browseall</string>
<string name="key_na_values">key_na_values</string>

View file

@ -1743,7 +1743,7 @@
<string name="default_name_title">Welcome</string>
<!-- Welcome dialog text -->
<string name="default_name_message">Thanks for installing
Crosswords! Feel free to enter your name here. It will be used
Crosswords!\n\nFeel free to enter your name here. It will be used
when creating new games. (You can change it later in the \"New
game default\" section of Settings.)</string>
@ -2192,4 +2192,9 @@
play if he/she is also using NFC.</string>
<string name="pct_suffix">\u0020pct.</string>
<string name="not_again_firefox">If Android gives you a choice of
browsers for viewing the wordlists downloads page, DO NOT choose
Firefox. Some versions have a bug that can cause the wordlists to
be lost.</string>
</resources>

View file

@ -745,15 +745,22 @@ public class BoardActivity extends XWActivity
item = menu.findItem( R.id.board_menu_tray );
item.setTitle( strId );
hideShowItem( menu, R.id.board_menu_flip, m_gsi.visTileCount >= 1 );
hideShowItem( menu, R.id.board_menu_toggle, m_gsi.visTileCount >= 1 );
hideShowItem( menu, R.id.board_menu_juggle, m_gsi.canShuffle );
hideShowItem( menu, R.id.board_menu_undo_current, m_gsi.canRedo );
hideShowItem( menu, R.id.board_menu_hint_prev, m_gsi.canHint );
hideShowItem( menu, R.id.board_menu_hint_next, m_gsi.canHint );
hideShowItem( menu, R.id.board_menu_chat,
BuildConstants.CHAT_SUPPORTED && m_gsi.canChat );
hideShowItem( menu, R.id.board_menu_tray,
Utils.setItemVisible( menu, R.id.board_menu_flip,
m_gsi.visTileCount >= 1 );
Utils.setItemVisible( menu, R.id.board_menu_toggle,
m_gsi.visTileCount >= 1 );
Utils.setItemVisible( menu, R.id.board_menu_juggle,
m_gsi.canShuffle );
Utils.setItemVisible( menu, R.id.board_menu_undo_current,
m_gsi.canRedo );
Utils.setItemVisible( menu, R.id.board_menu_hint_prev,
m_gsi.canHint );
Utils.setItemVisible( menu, R.id.board_menu_hint_next,
m_gsi.canHint );
Utils.setItemVisible( menu, R.id.board_menu_chat,
BuildConstants.CHAT_SUPPORTED
&& m_gsi.canChat );
Utils.setItemVisible( menu, R.id.board_menu_tray,
!inTrade && m_gsi.canHideRack );
}
@ -2184,14 +2191,6 @@ public class BoardActivity extends XWActivity
null != m_gi.dictName( m_view.getCurPlayer() ) );
}
private void hideShowItem( Menu menu, int id, boolean visible )
{
MenuItem item = menu.findItem( id );
if ( null != item ) {
item.setVisible( visible );
}
}
private void adjustTradeVisibility()
{
m_toolbar.setVisibility( m_inTrade? View.GONE : View.VISIBLE );

View file

@ -32,9 +32,10 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import org.eehouse.android.xw4.jni.BoardDims;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.DrawCtx;
import org.eehouse.android.xw4.jni.DrawScoreInfo;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.jni.XwJNI;
@ -494,10 +495,9 @@ public class BoardCanvas extends Canvas implements DrawCtx {
boolean selected = 0 != (flags & CELL_HIGHLIGHT);
int index = isCursor? CommonPrefs.COLOR_FOCUS : CommonPrefs.COLOR_BACKGRND;
rect.inset( 0, 1 );
fillRectOther( rect, index );
rect.inset( rect.width()/4, 0 );
rect.inset( rect.width()/4, 1 );
if ( selected ) {
drawRect( rect, m_strokePaint );
} else {
@ -844,7 +844,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
if ( !useDark ) {
Bitmap src = ((BitmapDrawable)arrow).getBitmap();
Bitmap bitmap = src.copy( Bitmap.Config.ARGB_8888, true );
Bitmap bitmap = src.copy( Bitmap.Config.RGB_565, true );
for ( int xx = 0; xx < bitmap.getWidth(); ++xx ) {
for( int yy = 0; yy < bitmap.getHeight(); ++yy ) {
if ( BLACK == bitmap.getPixel( xx, yy ) ) {

View file

@ -81,6 +81,8 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
@Override
public boolean onTouchEvent( MotionEvent event )
{
boolean wantMore = null != m_jniThread;
if ( wantMore ) {
int action = event.getAction();
int xx = (int)event.getX();
int yy = (int)event.getY();
@ -124,8 +126,8 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
DbgUtils.logf( "onTouchEvent: unknown action: %d", action );
break;
}
return true; // required to get subsequent events
}
return wantMore; // true required to get subsequent events
}
// private void printMode( String comment, int mode )
@ -227,7 +229,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
if ( null == s_bitmap ) {
s_bitmap = Bitmap.createBitmap( bmWidth, bmHeight,
Bitmap.Config.ARGB_8888 );
Bitmap.Config.RGB_565 );
}
if ( null == m_canvas ) {
m_canvas = new BoardCanvas( m_parent, s_bitmap, m_jniThread,

View file

@ -79,6 +79,7 @@ public class DictsActivity extends XWExpandableListActivity
// For new callback alternative
private static final int DELETE_DICT_ACTION = 1;
private static final int DOWNLOAD_DICT_ACTION = 2;
private static final int MOVE_DICT = DlgDelegate.DIALOG_LAST + 1;
private static final int SET_DEFAULT = DlgDelegate.DIALOG_LAST + 2;
@ -643,6 +644,9 @@ public class DictsActivity extends XWExpandableListActivity
clearSelections();
}
break;
case DOWNLOAD_DICT_ACTION:
startDownload( (Intent)params[0] );
break;
default:
Assert.fail();
}
@ -665,7 +669,9 @@ public class DictsActivity extends XWExpandableListActivity
private void startDownload( int lang, String name )
{
Intent intent = mkDownloadIntent( this, lang, name );
startDownload( intent );
showNotAgainDlgThen( R.string.not_again_firefox,
R.string.key_na_firefox,
DOWNLOAD_DICT_ACTION, intent );
}
private void startDownload( Intent downloadIntent )

View file

@ -179,7 +179,7 @@ public class ExpiringDelegate {
private Drawable mkBackground( int pct )
{
Assert.assertTrue( 0 <= pct && pct <= 100 );
Bitmap bm = Bitmap.createBitmap( 100, 1, Bitmap.Config.ARGB_8888 );
Bitmap bm = Bitmap.createBitmap( 100, 1, Bitmap.Config.RGB_565 );
Canvas canvas = new Canvas(bm);
Paint paint = new Paint();

View file

@ -343,7 +343,7 @@ public class GameUtils {
int size = dim - (dim % nCols);
thumb = Bitmap.createBitmap( size, size,
Bitmap.Config.ARGB_8888 );
Bitmap.Config.RGB_565 );
XwJNI.board_figureLayout( gamePtr, gi, 0, 0, size, size,
0, 0, 0, 20, 20, false, null );

View file

@ -348,8 +348,10 @@ public class Utils {
public static void setItemVisible( Menu menu, int id, boolean enabled )
{
MenuItem item = menu.findItem( id );
if ( null != item ) {
item.setVisible( enabled );
}
}
public static void setItemEnabled( Menu menu, int id, boolean enabled )
{

View file

@ -1,7 +1,7 @@
/* -*- compile-command: "cd ../../../../../; ant debug install"; -*- */
/* -*- compile-command: "cd ../../../../../../; ant debug install"; -*- */
/*
* Copyright 2009-2010 by Eric House (xwords@eehouse.org). All
* rights reserved.
* Copyright 2009-2013 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
@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
package org.eehouse.android.xw4.jni;
// Why does this have to be its own class...

View file

@ -32,7 +32,6 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.concurrent.LinkedBlockingQueue;
import org.eehouse.android.xw4.BoardDims;
import org.eehouse.android.xw4.ConnStatusHandler;
import org.eehouse.android.xw4.DBUtils;
import org.eehouse.android.xw4.DbgUtils;

View file

@ -21,7 +21,6 @@
package org.eehouse.android.xw4.jni;
import android.graphics.Rect;
import org.eehouse.android.xw4.BoardDims;
public interface SyncedDraw {
void doJNIDraw();

View file

@ -21,16 +21,12 @@
package org.eehouse.android.xw4.jni;
import android.graphics.Rect;
import org.eehouse.android.xw4.BoardDims;
// Collection of native methods
public class XwJNI {
// This needs to be called before the first attempt to use the
// jni. I figure this class has to be loaded before that cna
// happen. Doing this in GamesList isn't enough because sometimes
// BoardActivity is the first Activity loaded.
// jni.
static {
System.loadLibrary("xwjni");
}

View file

@ -0,0 +1,49 @@
#!/bin/bash
set -e -u
LIST=""
ALL=""
FILE=""
DIR="/sdcard/Pictures/Screenshots"
WD=$(pwd)
usage() {
[ $# -ge 1 ] && echo "Error: $1"
echo "usage: $0 --help | --list | <name.png>"
exit 1
}
pullFile() {
echo "pulling $1"
adb pull ${DIR}/$1 ${WD}/
}
[ $# -eq 1 ] || usage "Requires a single parameter"
while [ $# -ge 1 ]; do
echo $1
case $1 in
--list)
LIST=1
;;
--help)
usage
;;
*)
FILE=$1
;;
esac
shift
done
SHOTS=$(adb shell "ls $DIR")
if [ -n "$FILE" ]; then
pullFile ${FILE}
elif [ -n "$LIST" ]; then
for SHOT in $SHOTS; do
echo $SHOT
done
fi

View file

@ -99,6 +99,8 @@ static void invalTradeWindow( BoardCtxt* board, XP_S16 turn, XP_Bool redraw );
static XP_Bool invalCellsWithTiles( BoardCtxt* board );
static void setTimerIf( BoardCtxt* board );
static void clearTimerIf( const BoardCtxt* board );
static XP_Bool p_board_timerFired( void* closure, XWTimerReason why );
static XP_Bool replaceLastTile( BoardCtxt* board );
@ -193,6 +195,7 @@ board_make( MPFORMAL ModelCtxt* model, ServerCtxt* server, DrawCtx* draw,
void
board_destroy( BoardCtxt* board )
{
clearTimerIf( board );
XP_FREE( board->mpool, board );
} /* board_destroy */
@ -1234,6 +1237,12 @@ setTimerIf( BoardCtxt* board )
}
} /* setTimerIf */
static void
clearTimerIf( const BoardCtxt* board )
{
util_clearTimer( board->util, TIMER_TIMERTICK );
}
static void
timerFiredForTimer( BoardCtxt* board )
{

View file

@ -74,6 +74,7 @@ dict_getBlankTile( const DictionaryCtxt* dict )
XP_U16
dict_getTileValue( const DictionaryCtxt* dict, Tile tile )
{
XP_ASSERT( !!dict );
if ( (tile & TILE_VALUE_MASK) != tile ) {
XP_ASSERT( tile == 32 &&
tile == dict_getBlankTile( dict ) );

View file

@ -316,15 +316,16 @@ game_getState( const XWGame* game, GameStateInfo* gsi )
{
XP_Bool gameOver = server_getGameIsOver( game->server );
gsi->curTurnSelected = board_curTurnSelected( game->board );
gsi->trayVisState = board_getTrayVisState( game->board );
gsi->visTileCount = board_visTileCount( game->board );
gsi->canHint = !gameOver && board_canHint( game->board );
gsi->canRedo = board_canTogglePending( game->board );
gsi->inTrade = board_inTrade( game->board, &gsi->tradeTilesSelected );
BoardCtxt* board = game->board;
gsi->curTurnSelected = board_curTurnSelected( board );
gsi->trayVisState = board_getTrayVisState( board );
gsi->visTileCount = board_visTileCount( board );
gsi->canHint = !gameOver && board_canHint( board );
gsi->canRedo = board_canTogglePending( board );
gsi->inTrade = board_inTrade( board, &gsi->tradeTilesSelected );
gsi->canChat = !!game->comms && comms_canChat( game->comms );
gsi->canShuffle = board_canShuffle( game->board );
gsi->canHideRack = board_canHideRack( game->board );
gsi->canShuffle = board_canShuffle( board );
gsi->canHideRack = board_canHideRack( board );
}
void

View file

@ -357,7 +357,8 @@ figureSecondsLeft( BoardCtxt* board )
void
drawTimer( BoardCtxt* board )
{
if ( board->gi->timerEnabled ) {
if ( board->gi->timerEnabled && 0 < board->timerBounds.width
&& 0 < board->timerBounds.height ) {
XP_S16 secondsLeft = figureSecondsLeft( board );
draw_drawTimer( board->draw, &board->timerBounds,

View file

@ -31,6 +31,7 @@ $(XWLANG)Main.dict.gz: $(SOURCEDICT) $(MAKEFILE)
file -z $(SOURCEDICT) | grep -q 'UTF-8 Unicode' || exit 1
zcat $< \
| sed 's/;.*$$//' \
| tr -d '\r' \
| sed '/^$$/d' \
| sed 's,.,\U\0,g' \
| sed -e 's/ß/SS/g' \

View file

@ -26,7 +26,7 @@ LANGFILTER: | sed -e 's/ß/SS/g'
# uppercase all
LANGFILTER: | tr [a-zäöü] [A-ZÄÖÜ]
# no words not containing a vowel
LANGFILTER: | grep '[AEIOUÄÖÜ]'
# LANGFILTER: | grep '[AEIOUÄÖÜ]'
# none with illegal chars
LANGFILTER: | grep '^[A-ZÄÖÜ]\+$'
@ -49,34 +49,34 @@ XLOC_HEADER:0x8300
<BEGIN_TILES>
2 0 {"_"}
5 1 'A'
1 6 'Ä'
2 3 'B'
2 4 'C'
4 1 'D'
15 1 'E'
2 4 'F'
3 2 'G'
4 2 'H'
6 1 'I'
1 6 'J'
2 4 'K'
3 2 'L'
4 3 'M'
9 1 'N'
3 2 'O'
1 8 'Ö'
1 4 'P'
1 10 'Q'
6 1 'R'
7 1 'S'
6 1 'T'
6 1 'U'
1 6 'Ü'
1 6 'V'
1 3 'W'
1 8 'X'
1 10 'Y'
1 3 'Z'
5 1 'A|a'
1 6 'Ä'
2 3 'B|b'
2 4 'C|c'
4 1 'D|d'
15 1 'E|e'
2 4 'F|f'
3 2 'G|g'
4 2 'H|h'
6 1 'I|i'
1 6 'J|j'
2 4 'K|k'
3 2 'L|l'
4 3 'M|m'
9 1 'N|n'
3 2 'O|o'
1 8 'Ö'
1 4 'P|p'
1 10 'Q|q'
6 1 'R|r'
7 1 'S|s'
6 1 'T|t'
6 1 'U|u'
1 6 'Ü'
1 6 'V|v'
1 3 'W|w'
1 8 'X|x'
1 10 'Y|y'
1 3 'Z|z'
<END_TILES>
# should ignore all after the <END_TILES> above