Merge branch 'android_branch' into android_bt

Conflicts:
	xwords4/android/XWords4/jni/xportwrapper.c
	xwords4/android/XWords4/jni/xwjni.c
This commit is contained in:
Eric House 2012-02-13 22:38:17 -08:00
commit 88ad6d81ef
24 changed files with 276 additions and 46 deletions

View file

@ -1,2 +1,8 @@
proguard.cfg
*.apk
ant_out.txt
local.properties
bin
gen
libs
proguard.cfg
obj

View file

@ -21,7 +21,7 @@
own application, the package name must be changed from "com.example.*"
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"
package="org.eehouse.android.xw4_dbg"
android:versionCode="34"
android:versionName="@string/app_version"
>

View file

@ -50,13 +50,18 @@
in between standard targets -->
<target name="-pre-build">
<exec dir=".." executable="./scripts/mkvariant.sh">
<exec dir="." executable="../scripts/mkvariant.sh" output="/dev/null" >
<arg value="--variant-name"/>
<arg value="xw4_dbg"/>
<arg value="--dest-dir"/>
<arg value="./XWords4-dbg/src"/>
<arg value="./res"/>
<arg value="--dest-dir"/>
<arg value="./XWords4-dbg/res"/>
<arg value="./src"/>
<arg value="--dest-dir"/>
<arg value="./jni"/>
</exec>
<exec dir="." executable="../scripts/ndkbuild.sh" >
<arg value="-j3"/>
</exec>
<exec dir=".." executable="./scripts/genvers.sh" output="ant_out.txt" />
</target>

View file

@ -0,0 +1,19 @@
anddict.c
anddict.h
andglobals.h
Android.mk
andutils.c
andutils.h
drawwrapper.c
drawwrapper.h
jniutlswrapper.c
jniutlswrapper.h
LocalizedStrIncludes.h
utils.c
utilwrapper.c
utilwrapper.h
xportwrapper.c
xportwrapper.h
xptypes.h
xwjni.c
paths.h

View file

@ -0,0 +1,23 @@
dicticon.png
downarrow.png
expander_ic_maximized.9.png
expander_ic_minimized.9.png
flip.png
icon48x48.png
ic_popup_sync_1.png
netarrow_allconn.png
netarrow_someconn.png
netarrow_unconn.png
next_hint.png
origin.png
prev_hint.png
refresh.png
relaygame.png
rightarrow.png
shuffle.png
sologame.png
stat_notify_chat.png
stat_notify_sync.png
undo.png
values.png
zoom.png

View file

@ -0,0 +1,27 @@
about_dlg.xml
board.xml
btinviter_item.xml.~1~
chat_history_local.xml
chat_history_remote.xml
chat.xml
color_display.xml
color_edit.xml
dflt_name.xml
dict_browser.xml
dict_browse.xml
divider_view.xml
force_remote.xml
game_config.xml
game_list_item.xml
game_list.xml
import_dict.xml
list_item.xml
lookup.xml
new_game.xml
passwd_view.xml
player_edit.xml
player_list_elem.xml
prefs_w_buttons.xml
relay_game_config.xml
rename_game.xml
select_dialog_item.xml

View file

@ -0,0 +1,5 @@
board_menu.xml
chat_menu.xml
dicts_item_menu.xml
games_list_item_menu.xml
games_list_menu.xml

View file

@ -0,0 +1 @@
changes

View file

@ -0,0 +1 @@
strings.xml

View file

@ -0,0 +1 @@
strings.xml

View file

@ -0,0 +1 @@
strings.xml

View file

@ -0,0 +1,4 @@
common_rsrc.xml
git_string.xml
strings.xml
styles.xml

View file

@ -0,0 +1 @@
xwprefs.xml

View file

@ -0,0 +1,50 @@
BoardActivity.java
BoardDims.java
BoardView.java
BTInviteActivity.java.~1~
ChatActivity.java
CommsTransport.java
DbgUtils.java
DBHelper.java
DBUtils.java
DictBrowseActivity.java
DictImportActivity.java
DictLangCache.java
DictListPreference.java
DictsActivity.java
DictUtils.java
DispatchNotify.java
DlgDelegate.java
EditColorPreference.java
FirstRunDialog.java
GameConfig.java
GameListAdapter.java
GamesList.java
GameUtils.java
GitVersion.java
LookupView.java
MountEventReceiver.java
NBSReceiver.java
NetLaunchInfo.java
NetStateCache.java
NetUtils.java
NewGameActivity.java
PollListPreference.java
PrefsActivity.java
ReceiveNBS.java
RefreshNamesTask.java
RelayGameActivity.java
RelayMsgSink.java
RelayReceiver.java
RelayService.java
StatusReceiver.java
Toolbar.java
Utils.java
XWActivity.java
XWApp.java
XWConstants.java
XWEditTextPreference.java
XWListActivity.java
XWListAdapter.java
XWListItem.java
XWListPreference.java

View file

@ -0,0 +1,17 @@
BoardHandler.java
CommonPrefs.java
CommsAddrRec.java
CurGameInfo.java
DictInfo.java
DrawCtx.java
DrawScoreInfo.java
GameSummary.java
JNIThread.java
JNIUtilsImpl.java
JNIUtils.java
LocalPlayer.java
SyncedDraw.java
TransportProcs.java
UtilCtxtImpl.java
UtilCtxt.java
XwJNI.java

View file

@ -50,6 +50,9 @@
in between standard targets -->
<target name="-pre-build">
<exec dir="." executable="../scripts/ndkbuild.sh" >
<arg value="-j3"/>
</exec>
<exec dir=".." executable="./scripts/genvers.sh" output="ant_out.txt" />
</target>
<!--

View file

@ -22,6 +22,7 @@
#include <time.h>
#include "andutils.h"
#include "paths.h"
#include "comtypes.h"
#include "xwstream.h"
@ -320,7 +321,7 @@ setJAddrRec( JNIEnv* env, jobject jaddr, const CommsAddrRec* addr )
{
XP_ASSERT( !!addr );
intToJenumField( env, jaddr, addr->conType, "conType",
"org/eehouse/android/xw4/jni/CommsAddrRec$CommsConnType" );
PKG_PATH("jni/CommsAddrRec$CommsConnType") );
switch ( addr->conType ) {
case COMMS_CONN_NONE:
@ -351,9 +352,9 @@ setJAddrRec( JNIEnv* env, jobject jaddr, const CommsAddrRec* addr )
void
getJAddrRec( JNIEnv* env, CommsAddrRec* addr, jobject jaddr )
{
addr->conType = jenumFieldToInt( env, jaddr, "conType",
"org/eehouse/android/xw4/jni/"
"CommsAddrRec$CommsConnType" );
addr->conType =
jenumFieldToInt( env, jaddr, "conType",
PKG_PATH("jni/CommsAddrRec$CommsConnType") );
switch ( addr->conType ) {
case COMMS_CONN_NONE:

View file

@ -20,6 +20,7 @@
#include "drawwrapper.h"
#include "andutils.h"
#include "paths.h"
enum {
JCACHE_RECT0
@ -75,8 +76,7 @@ makeDSI( AndDraw* draw, int indx, const DrawScoreInfo* dsi )
jobject dsiobj = draw->jCache[indx];
if ( !dsiobj ) {
jclass rclass = (*env)->FindClass( env, "org/eehouse/android/"
"xw4/jni/DrawScoreInfo");
jclass rclass = (*env)->FindClass( env, PKG_PATH("jni/DrawScoreInfo") );
jmethodID initId = (*env)->GetMethodID( env, rclass, "<init>", "()V" );
dsiobj = (*env)->NewObject( env, rclass, initId );
(*env)->DeleteLocalRef( env, rclass );
@ -153,8 +153,8 @@ and_draw_measureScoreText( DrawCtx* dctx,
XP_U16* width, XP_U16* height )
{
DRAW_CBK_HEADER("measureScoreText",
"(Landroid/graphics/Rect;Lorg/eehouse/android/"
"xw4/jni/DrawScoreInfo;[I[I)V" );
"(Landroid/graphics/Rect;L"
PKG_PATH("jni/DrawScoreInfo;[I[I)V") );
jobject jrect = makeJRect( draw, JCACHE_RECT0, r );
jobject jdsi = makeDSI( draw, JCACHE_DSI, dsi );
@ -192,7 +192,7 @@ and_draw_score_drawPlayer( DrawCtx* dctx,
{
DRAW_CBK_HEADER("score_drawPlayer",
"(Landroid/graphics/Rect;Landroid/graphics/Rect;"
"Lorg/eehouse/android/xw4/jni/DrawScoreInfo;)V" );
"L" PKG_PATH("jni/DrawScoreInfo") ";)V" );
jobject jrinner = makeJRect( draw, JCACHE_RECT0, rInner );
jobject jrouter = makeJRect( draw, JCACHE_RECT1, rOuter );

View file

@ -0,0 +1,25 @@
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */
/*
* Copyright © 2012 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.
*/
#ifndef _PATHS_H_
#define _PATHS_H_
#define PKG_PATH(elem) "org/eehouse/android/xw4/" elem
#endif

View file

@ -20,6 +20,7 @@
#include "xportwrapper.h"
#include "andutils.h"
#include "paths.h"
typedef struct _AndTransportProcs {
TransportProcs tp;
@ -34,7 +35,7 @@ makeJAddr( JNIEnv* env, const CommsAddrRec* addr )
jobject jaddr = NULL;
if ( NULL != addr ) {
jclass clazz
= (*env)->FindClass(env, "org/eehouse/android/xw4/jni/CommsAddrRec");
= (*env)->FindClass(env, PKG_PATH("jni/CommsAddrRec") );
XP_ASSERT( !!clazz );
jmethodID mid = getMethodID( env, clazz, "<init>", "()V" );
XP_ASSERT( !!mid );
@ -73,7 +74,7 @@ and_xport_send( const XP_U8* buf, XP_U16 len, const CommsAddrRec* addr,
AndTransportProcs* aprocs = (AndTransportProcs*)closure;
if ( NULL != aprocs->jxport ) {
JNIEnv* env = *aprocs->envp;
const char* sig = "([BLorg/eehouse/android/xw4/jni/CommsAddrRec;I)I";
const char* sig = "([BL" PKG_PATH("jni/CommsAddrRec") ";I)I";
jmethodID mid = getMethodID( env, aprocs->jxport, "transportSend", sig );
jbyteArray jbytes = makeByteArray( env, len, (jbyte*)buf );
@ -98,12 +99,11 @@ and_xport_relayStatus( void* closure, CommsRelayState newState )
AndTransportProcs* aprocs = (AndTransportProcs*)closure;
if ( NULL != aprocs->jxport ) {
JNIEnv* env = *aprocs->envp;
const char* sig = "(Lorg/eehouse/android/xw4/jni/"
"TransportProcs$CommsRelayState;)V";
const char* sig = "(L" PKG_PATH("jni/TransportProcs$CommsRelayState") ";)V";
jmethodID mid = getMethodID( env, aprocs->jxport, "relayStatus", sig );
jobject jenum = intToJEnum( env, newState, "org/eehouse/android/xw4/jni/"
"TransportProcs$CommsRelayState" );
jobject jenum = intToJEnum( env, newState,
PKG_PATH("jni/TransportProcs$CommsRelayState") );
(*env)->CallVoidMethod( env, aprocs->jxport, mid, jenum );
(*env)->DeleteLocalRef( env, jenum );
}
@ -155,12 +155,12 @@ and_xport_relayError( void* closure, XWREASON relayErr )
if ( NULL != aprocs->jxport ) {
JNIEnv* env = *aprocs->envp;
jmethodID mid;
const char* sig = "(Lorg/eehouse/android/xw4/jni/"
"TransportProcs$XWRELAY_ERROR;)V";
const char* sig =
"(L" PKG_PATH("jni/TransportProcs$XWRELAY_ERROR") ";)V";
mid = getMethodID( env, aprocs->jxport, "relayErrorProc", sig );
jobject jenum = intToJEnum( env, relayErr, "org/eehouse/android/xw4/jni/"
"TransportProcs$XWRELAY_ERROR" );
jobject jenum = intToJEnum( env, relayErr,
PKG_PATH("jni/TransportProcs$XWRELAY_ERROR") );
(*env)->CallVoidMethod( env, aprocs->jxport, mid, jenum );
(*env)->DeleteLocalRef( env, jenum );

View file

@ -37,6 +37,7 @@
#include "anddict.h"
#include "andutils.h"
#include "jniutlswrapper.h"
#include "paths.h"
static CurGameInfo*
makeGI( MPFORMAL JNIEnv* env, jobject j_gi )
@ -65,12 +66,12 @@ makeGI( MPFORMAL JNIEnv* env, jobject j_gi )
gi->allowPickTiles = getBool( env, j_gi, "allowPickTiles" );
gi->allowHintRect = getBool( env, j_gi, "allowHintRect" );
gi->phoniesAction = jenumFieldToInt( env, j_gi, "phoniesAction",
"org/eehouse/android/xw4/jni/"
"CurGameInfo$XWPhoniesChoice");
gi->phoniesAction =
jenumFieldToInt( env, j_gi, "phoniesAction",
PKG_PATH("jni/CurGameInfo$XWPhoniesChoice") );
gi->serverRole =
jenumFieldToInt( env, j_gi, "serverRole",
"org/eehouse/android/xw4/jni/CurGameInfo$DeviceRole");
jenumFieldToInt( env, j_gi, "serverRole",
PKG_PATH("jni/CurGameInfo$DeviceRole"));
getString( env, j_gi, "dictName", buf, VSIZE(buf) );
gi->dictName = copyString( mpool, buf );
@ -78,8 +79,7 @@ makeGI( MPFORMAL JNIEnv* env, jobject j_gi )
XP_ASSERT( gi->nPlayers <= MAX_NUM_PLAYERS );
jobject jplayers;
if ( getObject( env, j_gi, "players",
"[Lorg/eehouse/android/xw4/jni/LocalPlayer;",
if ( getObject( env, j_gi, "players", "[L" PKG_PATH("jni/LocalPlayer") ";",
&jplayers ) ) {
int ii;
for ( ii = 0; ii < gi->nPlayers; ++ii ) {
@ -125,13 +125,13 @@ setJGI( JNIEnv* env, jobject jgi, const CurGameInfo* gi )
setString( env, jgi, "dictName", gi->dictName );
intToJenumField( env, jgi, gi->phoniesAction, "phoniesAction",
"org/eehouse/android/xw4/jni/CurGameInfo$XWPhoniesChoice" );
PKG_PATH("jni/CurGameInfo$XWPhoniesChoice") );
intToJenumField( env, jgi, gi->serverRole, "serverRole",
"org/eehouse/android/xw4/jni/CurGameInfo$DeviceRole" );
PKG_PATH("jni/CurGameInfo$DeviceRole") );
jobject jplayers;
if ( getObject( env, jgi, "players",
"[Lorg/eehouse/android/xw4/jni/LocalPlayer;",
"[L" PKG_PATH("jni/LocalPlayer") ";",
&jplayers ) ) {
int ii;
for ( ii = 0; ii < gi->nPlayers; ++ii ) {
@ -1096,8 +1096,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
CommsCtxt* comms = state->game.comms;
comms_getAddr( comms, &addr );
intToJenumField( env, jsummary, addr.conType, "conType",
"org/eehouse/android/xw4/jni/"
"CommsAddrRec$CommsConnType" );
PKG_PATH("jni/CommsAddrRec$CommsConnType") );
setInt( env, jsummary, "seed", comms_getChannelSeed( comms ) );
setInt( env, jsummary, "missingPlayers",
server_getMissingPlayers( state->game.server ) );

View file

@ -1 +1,23 @@
# -*- mode: Makefile; -*-
$(DEST_PATH)/%.java : $(SRC_PATH)/%.java
@sed \
-e "s,\(package org.eehouse.android.\)xw4\(.*\);,\1$(VARIANT)\2;," \
-e "s,\(import org.eehouse.android.\)xw4\(.*\);,\1$(VARIANT)\2;," \
< $< > $@
$(DEST_PATH)/%.png : $(SRC_PATH)/%.png
@cp $< $@
$(DEST_PATH)/%.xml : $(SRC_PATH)/%.xml
@sed \
-e "s,\(^.*org.eehouse.android.\)xw4\(.*$$\),\1$(VARIANT)\2," \
< $< > $@
$(DEST_PATH)/%.h : $(SRC_PATH)/%.h
sed \
-e "s,\(^.*org/eehouse/android/\)xw4\(.*$$\),\1$(VARIANT)\2," \
< $< > $@
$(DEST_PATH)/% : $(SRC_PATH)/%
@cp $< $@

View file

@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/bash
set -u -e
MAKEFILE=./Variant.mk
MAKEFILE=$(dirname $0)/Variant.mk
DIRS=""
VARIANT=""
@ -12,22 +12,35 @@ usage() {
exit 1
}
add_to_gitignored() {
DIR=$1
FILE=$2
touch ${DIR}/.gitignore
grep -q "^${FILE}\$" ${DIR}/.gitignore || echo $FILE >> ${DIR}/.gitignore
}
do_dir() {
local SRC_PATH=$1
local DEST_PATH=$2
local DIR=$3
SRC_PATH=$SRC_PATH/$DIR
[ -d $SRC_PATH ] || usage "$SRC_PATH not found"
DEST_PATH=$DEST_PATH/$DIR
mkdir -p $DEST_PATH
for FILE in $SRC_PATH; do
for FILE in $SRC_PATH/*; do
if [ -d $FILE ]; then
do_dir $SRC_PATH $DEST_PATH $FILE
do_dir $SRC_PATH $DEST_PATH $(basename $FILE)
else
make -f $MAKEFILE SRC_PATH=$SRC_PATH $DEST_PATH=$DEST_PATH make_file
FILE=${FILE/$SRC_PATH/$DEST_PATH}
if git ls-files $FILE --error-unmatch 2>/dev/null; then
echo "skipping $FILE; it's under version control within this variant"
else
make -f $MAKEFILE SRC_PATH=$SRC_PATH DEST_PATH=$DEST_PATH VARIANT=${VARIANT} $FILE
add_to_gitignored $DEST_PATH $(basename $FILE)
fi
fi
done
}
@ -56,3 +69,7 @@ done
echo "$0 DIRS: $DIRS"
[ -n "$VARIANT" ] || usage "--variant-name not supplied"
for DIR in $DIRS; do
do_dir ../XWords4 . $DIR
done

View file

@ -1,6 +1,11 @@
#!/bin/sh
OLDDIR=$(pwd)
set -e -u
if [ ! -e build.xml ]; then
echo "no build.xml; please run from root of source tree"
exit 1
fi
if [ -z "$NDK_ROOT" ]; then
echo -n "NDK_ROOT not set... "
@ -8,9 +13,6 @@ if [ -z "$NDK_ROOT" ]; then
exit 1
fi
cd $(dirname $0)/../XWords4
${NDK_ROOT}/ndk-build $*
cd $OLDDIR
echo "$0 done"