Merge branch 'android_branch' into android_translate

This commit is contained in:
Eric House 2016-08-07 13:08:13 -07:00
commit 1029bb78a0
143 changed files with 2169 additions and 1976 deletions

View file

@ -1,7 +1,6 @@
def VARIANT_NAME = 'xw4'
def INITIAL_CLIENT_VERS = 6
def CHAT_ENABLED = true
def THUMBNAIL_ENABLED = true
def LIBS_DEBUG = 'libs-debug'
def LIBS_RELEASE = 'libs-release'
def VERSION_CODE_BASE = 1
@ -135,7 +134,6 @@ task genVers(type: Exec) {
workingDir '../'
commandLine '../scripts/genvers.sh', '--variant', VARIANT_NAME,
'--client-vers', INITIAL_CLIENT_VERS,
'--thumbnail-enabled', THUMBNAIL_ENABLED,
'--vers-outfile', "assets/gitvers.txt"
}
@ -161,17 +159,15 @@ preBuild.dependsOn myPreBuild
task ndkBuildDebug(type: Exec) {
workingDir '../'
commandLine '../scripts/ndkbuild.sh', '-j3', "CHAT_ENABLED=$CHAT_ENABLED",
"THUMBNAIL_ENABLED=$THUMBNAIL_ENABLED", 'BUILD_TARGET=debug',
"INITIAL_CLIENT_VERS=$INITIAL_CLIENT_VERS", "VARIANT=$VARIANT_NAME",
"NDK_LIBS_OUT=$LIBS_DEBUG", 'NDK_OUT=./obj-debug'
'BUILD_TARGET=debug', "INITIAL_CLIENT_VERS=$INITIAL_CLIENT_VERS",
"VARIANT=$VARIANT_NAME", "NDK_LIBS_OUT=$LIBS_DEBUG", 'NDK_OUT=./obj-debug'
}
task ndkBuildRelease(type: Exec) {
workingDir '../'
commandLine '../scripts/ndkbuild.sh', '-j3', "CHAT_ENABLED=$CHAT_ENABLED",
"THUMBNAIL_ENABLED=$THUMBNAIL_ENABLED", 'BUILD_TARGET=release',
"INITIAL_CLIENT_VERS=$INITIAL_CLIENT_VERS", "VARIANT=$VARIANT_NAME",
"NDK_LIBS_OUT=$LIBS_RELEASE", 'NDK_OUT=./obj-release'
'BUILD_TARGET=release', "INITIAL_CLIENT_VERS=$INITIAL_CLIENT_VERS",
"VARIANT=$VARIANT_NAME", "NDK_LIBS_OUT=$LIBS_RELEASE", 'NDK_OUT=./obj-release'
}
task mkXml(type: Exec) {

File diff suppressed because it is too large Load diff

View file

@ -348,6 +348,10 @@ and_draw_drawTimer( DrawCtx* dctx, const XP_Rect* rect, XP_U16 player,
}
}
/* Not used on android yet */
static XP_Bool and_draw_beginDraw( DrawCtx* XP_UNUSED(dctx) ) {return XP_TRUE;}
static void and_draw_endDraw( DrawCtx* XP_UNUSED(dctx) ) {}
static XP_Bool
and_draw_boardBegin( DrawCtx* dctx, const XP_Rect* rect,
XP_U16 cellWidth, XP_U16 cellHeight,
@ -613,6 +617,8 @@ makeDraw( MPFORMAL EnvThreadInfo* ti, jobject jdraw )
}
#define SET_PROC(nam) draw->vtable->m_draw_##nam = and_draw_##nam
SET_PROC(beginDraw);
SET_PROC(endDraw);
SET_PROC(boardBegin);
SET_PROC(scoreBegin);
#ifdef XWFEATURE_SCOREONEPASS

View file

@ -62,7 +62,8 @@ typedef struct _JNIGlobalState {
MPSLOT
} JNIGlobalState;
// #define LOG_MAPPING
#define LOG_MAPPING
// #define LOG_MAPPING_ALL
#define GAMEPTR_IS_OBJECT
#ifdef GAMEPTR_IS_OBJECT
@ -79,7 +80,9 @@ countUsed(const EnvThreadInfo* ti)
for ( int ii = 0; ii < ti->nEntries; ++ii ) {
EnvThreadEntry* entry = &ti->entries[ii];
if ( 0 != entry->owner ) {
# ifdef LOG_MAPPING_ALL
XP_LOGF( "%s(): ii=%d; owner: %x", __func__, ii, (unsigned int)entry->owner );
# endif
++count;
}
}
@ -145,7 +148,7 @@ map_thread( EnvThreadInfo* ti, JNIEnv* env )
}
pthread_mutex_unlock( &ti->mtxThreads );
}
} /* map_thread */
static void
map_init( MPFORMAL EnvThreadInfo* ti, JNIEnv* env )
@ -973,6 +976,18 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1draw
return result;
}
JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1drawSnapshot
( JNIEnv *env, jclass C, GamePtrType gamePtr, jobject jdraw, jint width,
jint height )
{
XWJNI_START();
DrawCtx* newDraw = makeDraw( MPPARM(mpool) &state->globalJNI->ti, jdraw );
board_drawSnapshot( state->game.board, newDraw, width, height );
destroyDraw( &newDraw );
XWJNI_END();
}
#ifdef COMMON_LAYOUT
JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1figureLayout

View file

@ -13,13 +13,14 @@
android:background="@android:drawable/list_selector_background"
>
<FrameLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView android:id="@+id/view_unloaded"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="@string/game_list_tmp"
/>
@ -118,5 +119,6 @@
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</org.eehouse.android.xw4.GameListItem>

View file

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Remove this once dualpane is well tested -->
<item android:id="@+id/games_menu_disable_dualpane"
android:title="@string/disable_dualpane"
/>
<item android:id="@+id/games_menu_newgame_solo"
android:title="@string/new_game"
android:icon="@drawable/content_new_solo__gen"

View file

@ -67,7 +67,7 @@
<string name="key_summary_field">key_summary_field</string>
<string name="key_default_loc">key_default_loc</string>
<string name="key_force_tablet">key_force_tablet</string>
<string name="key_enable_dualpane">key_enable_dualpane</string>
<string name="key_enable_dualpane">key_enable_dualpane2</string>
<string name="key_force_radio">key_force_radio</string>
<string name="key_addrs_pref">key_addrs_pref</string>
@ -91,6 +91,7 @@
<string name="key_notagain_sync">key_notagain_sync</string>
<!-- <string name="key_notagain_sms_ready">key_notagain_sms_ready</string> -->
<string name="key_notagain_newselect">key_notagain_newselect</string>
<string name="key_notagain_dualpane">key_notagain_dualpane</string>
<string name="key_notagain_backclears">key_notagain_backclears</string>
<string name="key_notagain_chat">key_notagain_chat</string>
<string name="key_notagain_relay">key_notagain_relay</string>

View file

@ -2597,7 +2597,6 @@
<string name="pref_group_relay_title">Relay Stuff</string>
<string name="pref_group_relay_summary">Prefs related to play via internet/relay</string>
<string name="pref_group_l10n_title">Localization Stuff</string>
<string name="pref_group_tablets_title">Tablets Stuff</string>
<string name="pref_group_l10n_summary">Prefs related to in-app localization</string>
<string name="pref_item_update_title">Update between releases</string>
<string name="pref_item_update_summary">Get intermediate builds</string>
@ -2689,4 +2688,22 @@
name before you create this game?</string>
<string name="no_invites">This game has sent no invitations</string>
<string name="invite_dualpane">You appear to be running a
tablet-sized device. Would you like to try an experimental new
feature that lets you view two panes (e.g. board and chat)
side-by-side when your device is horizontal?
\n\nYou can disable the feature later using the new \"Disable
side-by-side\" menu item. Or via App Settings.
\n\nPlease let me know if you like the feature, report crashes, make
suggestions, etc.!!</string>
<string name="enable_dualpane">Enable side-by-side</string>
<string name="post_dualpane_title">Relaunch after change</string>
<string name="post_dualpane_on_body">Start Crosswords with side-by-side enabled!</string>
<string name="post_dualpane_off_body">Start Crosswords with side-by-side disabled</string>
<string name="disable_dualpane">Disable side-by-side</string>
<string name="dualpane_restart">Exiting app…</string>
</resources>

View file

@ -116,14 +116,19 @@
android:defaultValue="@string/game_summary_field_opponents"
/>
<CheckBoxPreference android:key="@string/key_hide_newgames"
android:title="@string/hide_newgames_title"
android:summary="@string/hide_newgames_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_hide_title"
android:title="@string/hide_title"
android:summary="@string/hide_title_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_hide_newgames"
android:title="@string/hide_newgames_title"
android:summary="@string/hide_newgames_summary"
<CheckBoxPreference android:key="@string/key_enable_dualpane"
android:title="@string/enable_dualpane_title"
android:summary="@string/enable_dualpane_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_show_arrow"
@ -232,6 +237,12 @@
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_notify_sound"
android:title="@string/notify_sound"
android:summary="@string/notify_other_summary"
android:defaultValue="true"
/>
<PreferenceScreen android:title="@string/disable_nags_title"
>
@ -314,11 +325,6 @@
/>
</PreferenceScreen>
<CheckBoxPreference android:key="@string/key_notify_sound"
android:title="@string/notify_sound"
android:summary="@string/notify_other_summary"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_notify_vibrate"
android:title="@string/notify_vibrate"
android:summary="@string/notify_other_summary"
@ -423,19 +429,11 @@
/>
</PreferenceScreen>
<PreferenceScreen android:title="@string/pref_group_tablets_title"
>
<CheckBoxPreference android:key="@string/key_enable_dualpane"
android:title="@string/enable_dualpane_title"
android:summary="@string/enable_dualpane_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_force_tablet"
android:title="@string/force_tablet_title"
android:summary="@string/force_tablet_summary"
android:defaultValue="false"
/>
</PreferenceScreen>
<CheckBoxPreference android:key="@string/key_force_tablet"
android:title="@string/force_tablet_title"
android:summary="@string/force_tablet_summary"
android:defaultValue="false"
/>
<PreferenceScreen android:title="@string/pref_group_l10n_title"
android:summary="@string/pref_group_l10n_summary"

View file

@ -2228,7 +2228,6 @@
<string name="pref_group_relay_title">Yaler Ffuts</string>
<string name="pref_group_relay_summary">Sferp detaler ot yalp aiv yaler/tenretni</string>
<string name="pref_group_l10n_title">Noitazilacol Ffuts</string>
<string name="pref_group_tablets_title">Stelbat Ffuts</string>
<string name="pref_group_l10n_summary">Sferp detaler ot ppa-ni noitazilacol</string>
<string name="pref_item_update_title">Etadpu neewteb sesaeler</string>
<string name="pref_item_update_summary">Teg etaidemretni sdliub</string>
@ -2299,4 +2298,20 @@
reyalp eman \"%1$s\". Dluow uoy ekil ot ezilanosrep htiw ruoy nwo
eman erofeb uoy etaerc siht ?emag</string>
<string name="no_invites">Siht emag sah tnes on snoitativni</string>
<string name="invite_dualpane">Uoy raeppa ot eb gninnur a
dezis-telbat ecived. Dluow uoy ekil ot yrt na latnemirepxe wen
erutaef taht stel uoy weiv owt senap e(.g. draob dna )tahc
edis-yb-edis nehw ruoy ecived si ?latnoziroh
\n\nUoy nac elbasid eht erutaef retal gnisu eht wen \"Elbasid
edis-yb-edis\" unem meti. Ro aiv Ppa Sgnittes.
\n\nEsaelp tel em wonk fi uoy ekil eht ,erutaef troper ,sehsarc ekam
,snoitseggus cte.!!</string>
<string name="enable_dualpane">Elbane edis-yb-edis</string>
<string name="post_dualpane_title">Hcnualer retfa egnahc</string>
<string name="post_dualpane_on_body">Trats Sdrowssorc htiw edis-yb-edis !delbane</string>
<string name="post_dualpane_off_body">Trats Sdrowssorc htiw edis-yb-edis delbasid</string>
<string name="disable_dualpane">Elbasid edis-yb-edis</string>
<string name="dualpane_restart">Gnitixe ppa…</string>
</resources>

View file

@ -2228,7 +2228,6 @@
<string name="pref_group_relay_title">RELAY STUFF</string>
<string name="pref_group_relay_summary">PREFS RELATED TO PLAY VIA INTERNET/RELAY</string>
<string name="pref_group_l10n_title">LOCALIZATION STUFF</string>
<string name="pref_group_tablets_title">TABLETS STUFF</string>
<string name="pref_group_l10n_summary">PREFS RELATED TO IN-APP LOCALIZATION</string>
<string name="pref_item_update_title">UPDATE BETWEEN RELEASES</string>
<string name="pref_item_update_summary">GET INTERMEDIATE BUILDS</string>
@ -2299,4 +2298,20 @@
PLAYER NAME \"%1$s\". WOULD YOU LIKE TO PERSONALIZE WITH YOUR OWN
NAME BEFORE YOU CREATE THIS GAME?</string>
<string name="no_invites">THIS GAME HAS SENT NO INVITATIONS</string>
<string name="invite_dualpane">YOU APPEAR TO BE RUNNING A
TABLET-SIZED DEVICE. WOULD YOU LIKE TO TRY AN EXPERIMENTAL NEW
FEATURE THAT LETS YOU VIEW TWO PANES (E.G. BOARD AND CHAT)
SIDE-BY-SIDE WHEN YOUR DEVICE IS HORIZONTAL?
\n\nYOU CAN DISABLE THE FEATURE LATER USING THE NEW \"DISABLE
SIDE-BY-SIDE\" MENU ITEM. OR VIA APP SETTINGS.
\n\nPLEASE LET ME KNOW IF YOU LIKE THE FEATURE, REPORT CRASHES, MAKE
SUGGESTIONS, ETC.!!</string>
<string name="enable_dualpane">ENABLE SIDE-BY-SIDE</string>
<string name="post_dualpane_title">RELAUNCH AFTER CHANGE</string>
<string name="post_dualpane_on_body">START CROSSWORDS WITH SIDE-BY-SIDE ENABLED!</string>
<string name="post_dualpane_off_body">START CROSSWORDS WITH SIDE-BY-SIDE DISABLED</string>
<string name="disable_dualpane">DISABLE SIDE-BY-SIDE</string>
<string name="dualpane_restart">EXITING APP…</string>
</resources>

View file

@ -26,26 +26,24 @@ import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Spinner;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.Iterator;
import junit.framework.Assert;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify.InviteMeans;
import org.eehouse.android.xw4.DlgDelegate.Action;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class BTInviteDelegate extends InviteDelegate {

View file

@ -20,11 +20,11 @@
package org.eehouse.android.xw4;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
public class BTReceiver extends BroadcastReceiver {

View file

@ -24,40 +24,34 @@ import android.app.Activity;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass.Device.Major;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import junit.framework.Assert;
import org.eehouse.android.xw4.MultiService.DictFetchOwner;
import org.eehouse.android.xw4.MultiService.MultiEvent;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.loc.LocUtils;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import org.eehouse.android.xw4.MultiService.DictFetchOwner;
import org.eehouse.android.xw4.MultiService.MultiEvent;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.LastMoveInfo;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.loc.LocUtils;
import org.eehouse.android.xw4.XWService.ReceiveResult;
import junit.framework.Assert;
public class BTService extends XWService {
private static final String BOGUS_MARSHMALLOW_ADDR = "02:00:00:00:00:00";

View file

@ -20,8 +20,6 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.KeyEvent;

View file

@ -30,7 +30,8 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.BoardDims;
import org.eehouse.android.xw4.jni.CommonPrefs;
@ -41,8 +42,6 @@ import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.jni.XwJNI.DictWrapper;
import org.eehouse.android.xw4.loc.LocUtils;
import junit.framework.Assert;
public class BoardCanvas extends Canvas implements DrawCtx {
private static final int BLACK = 0xFF000000;
private static final int WHITE = 0xFFFFFFFF;

View file

@ -24,13 +24,11 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnDismissListener;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@ -39,30 +37,37 @@ import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.Semaphore;
import junit.framework.Assert;
import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify.InviteMeans;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.jni.CurGameInfo;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.jni.JNIThread.*;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.jni.JNIThread.JNICmd;
import org.eehouse.android.xw4.jni.JNIUtils;
import org.eehouse.android.xw4.jni.JNIUtilsImpl;
import org.eehouse.android.xw4.jni.LastMoveInfo;
import org.eehouse.android.xw4.jni.TransportProcs;
import org.eehouse.android.xw4.jni.UtilCtxt;
import org.eehouse.android.xw4.jni.UtilCtxtImpl;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.jni.XwJNI.GamePtr;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.concurrent.Semaphore;
public class BoardDelegate extends DelegateBase
implements TransportProcs.TPMsgHandler, View.OnClickListener,
DwnldDelegate.DownloadFinishedListener,
@ -1539,29 +1544,28 @@ public class BoardDelegate extends DelegateBase
}
} else if ( nMissing > 0 ) {
if ( m_summary.hasRematchInfo() ) {
tryRematchInvites( false );
skipDismiss = !tryRematchInvites( false );
} else if ( !m_haveInvited ) {
m_haveInvited = true;
m_room = room;
showDialog( DlgID.DLG_INVITE );
invalidateOptionsMenuIf();
skipDismiss = true;
} else {
if ( !m_haveInvited ) {
m_haveInvited = true;
m_room = room;
showDialog( DlgID.DLG_INVITE );
invalidateOptionsMenuIf();
skipDismiss = true;
toastStr = getQuantityString( R.plurals.msg_relay_waiting_fmt, nMissing,
devOrder, room, nMissing );
if ( devOrder == 1 ) {
naMsg = R.string.not_again_conndfirst;
naKey = R.string.key_notagain_conndfirst;
} else {
toastStr = getQuantityString( R.plurals.msg_relay_waiting_fmt, nMissing,
devOrder, room, nMissing );
if ( devOrder == 1 ) {
naMsg = R.string.not_again_conndfirst;
naKey = R.string.key_notagain_conndfirst;
} else {
naMsg = R.string.not_again_conndmid;
naKey = R.string.key_notagain_conndmid;
}
naMsg = R.string.not_again_conndmid;
naKey = R.string.key_notagain_conndmid;
}
}
}
if ( null != toastStr ) {
DbgUtils.logf( "handleConndMessage(): toastStr: %s", toastStr );
m_toastStr = toastStr;
if ( naMsg == 0 ) {
dlgButtonClicked( Action.SHOW_EXPL_ACTION,
@ -1752,7 +1756,7 @@ public class BoardDelegate extends DelegateBase
R.string.key_notagain_turnchanged );
}
} );
handleViaThread( JNICmd. CMD_ZOOM, -8 );
handleViaThread( JNICmd.CMD_ZOOM, -8 );
handleViaThread( JNICmd.CMD_SAVE );
}
}
@ -2692,7 +2696,8 @@ public class BoardDelegate extends DelegateBase
}
}
private void tryRematchInvites( boolean force )
// Return true if anything sent
private boolean tryRematchInvites( boolean force )
{
if ( XWApp.REMATCH_SUPPORTED ) {
if ( !force ) {
@ -2728,6 +2733,7 @@ public class BoardDelegate extends DelegateBase
showToast( R.string.rematch_sent_toast );
}
}
return force;
}
private void sendSMSInviteIf( String phone, NetLaunchInfo nli,

View file

@ -31,11 +31,16 @@ import android.util.FloatMath;
import android.view.MotionEvent;
import android.view.View;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.BoardDims;
import org.eehouse.android.xw4.jni.BoardHandler;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.jni.CurGameInfo;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.jni.SyncedDraw;
import org.eehouse.android.xw4.jni.XwJNI;
public class BoardView extends View implements BoardHandler, SyncedDraw {
private static final float MIN_FONT_DIPS = 10.0f;

View file

@ -28,8 +28,8 @@ import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View.OnLayoutChangeListener;
import android.view.View;
import android.view.View.OnLayoutChangeListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ScrollView;

View file

@ -21,6 +21,16 @@
package org.eehouse.android.xw4;
import android.content.Context;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.jni.JNIThread.JNICmd;
import org.eehouse.android.xw4.jni.TransportProcs;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException;
@ -31,13 +41,6 @@ import java.nio.channels.UnresolvedAddressException;
import java.util.Iterator;
import java.util.Vector;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.jni.JNIThread.*;
public class CommsTransport implements TransportProcs,
NetStateCache.StateChangedIf {
private Selector m_selector;

View file

@ -20,13 +20,9 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.content.Context;
import android.preference.CheckBoxPreference;
import android.util.AttributeSet;
import android.view.View;
import org.eehouse.android.xw4.DlgDelegate.Action;
public abstract class ConfirmingCheckBoxPreference extends CheckBoxPreference {
private boolean m_attached = false;

View file

@ -28,16 +28,9 @@ import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
import android.text.format.DateUtils;
import android.text.format.Time;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.Iterator;
import junit.framework.Assert;
@ -46,6 +39,13 @@ import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.loc.LocUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.Iterator;
public class ConnStatusHandler {
public interface ConnStatusCBacks {

View file

@ -23,18 +23,16 @@ package org.eehouse.android.xw4;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.CheckBox;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.LinearLayout;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.HasDlgDelegate;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.loc.LocUtils;
import junit.framework.Assert;
public class ConnViaViewLayout extends LinearLayout {
private CommsConnTypeSet m_curSet;
private DlgDelegate.HasDlgDelegate m_dlgDlgt;

View file

@ -26,11 +26,12 @@ import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.Arrays;
import org.eehouse.android.xw4.loc.LocUtils;
import java.util.ArrayList;
import java.util.Arrays;
public class DBHelper extends SQLiteOpenHelper {
public static final String TABLE_NAME_SUM = "summaries";

View file

@ -27,23 +27,30 @@ import android.database.sqlite.SQLiteConstraintException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteStatement;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Environment;
import android.text.TextUtils;
import java.sql.Timestamp;
import junit.framework.Assert;
import org.eehouse.android.xw4.DictUtils.DictLoc;
import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify.InviteMeans;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.jni.CurGameInfo;
import org.eehouse.android.xw4.jni.DictInfo;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.loc.LocUtils;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.FileChannel;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@ -52,14 +59,6 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import junit.framework.Assert;
import org.eehouse.android.xw4.DictUtils.DictLoc;
import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify.InviteMeans;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.loc.LocUtils;
public class DBUtils {
public static final int ROWID_NOTFOUND = -1;

View file

@ -22,27 +22,18 @@ package org.eehouse.android.xw4;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.text.format.Time;
import android.util.Log;
import android.widget.Toast;
import java.lang.Thread;
import java.util.ArrayList;
import java.util.Formatter;
import java.util.Iterator;
import java.util.Set;
import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
import java.util.Formatter;
public class DbgUtils {
private static final String TAG = BuildConstants.DBG_TAG;
private static boolean s_doLog = BuildConfig.DEBUG;

View file

@ -24,11 +24,11 @@ import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Bundle;
import android.graphics.Point;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@ -39,19 +39,19 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import junit.framework.Assert;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.ActionPair;
import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify;
import org.eehouse.android.xw4.MultiService.MultiEvent;
import org.eehouse.android.xw4.loc.LocUtils;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.ActionPair;
import org.eehouse.android.xw4.loc.LocUtils;
import org.eehouse.android.xw4.MultiService.MultiEvent;
import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify;
import junit.framework.Assert;
public class DelegateBase implements DlgClickNotify,
DlgDelegate.HasDlgDelegate,
MultiService.MultiEventListener {
@ -549,6 +549,12 @@ public class DelegateBase implements DlgClickNotify,
m_dlgDelegate.showConfirmThen( msg, posButton, action, params );
}
public void showConfirmThen( DlgDelegate.NAKey nakey, int msgId,
int posButtonId, Action action )
{
m_dlgDelegate.showConfirmThen( nakey, msgId, posButtonId, action );
}
protected void showConfirmThen( int msgID, Action action )
{
m_dlgDelegate.showConfirmThen( msgID, action );
@ -557,8 +563,8 @@ public class DelegateBase implements DlgClickNotify,
public void showConfirmThen( Runnable onNA, String msg, int posButton,
int negButton, Action action, Object... params )
{
m_dlgDelegate.showConfirmThen( onNA, msg, posButton, negButton, action,
params );
m_dlgDelegate.showConfirmThen( null, onNA, msg, posButton, negButton,
action, params );
}
protected boolean post( Runnable runnable )

View file

@ -30,9 +30,8 @@ package org.eehouse.android.xw4;
*/
import android.content.Context;
import com.google.android.gcm.GCMRegistrar;
import junit.framework.Assert;
import com.google.android.gcm.GCMRegistrar;
public class DevID {

View file

@ -21,25 +21,20 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.DataSetObserver;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SectionIndexer;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import java.util.Arrays;
import junit.framework.Assert;
@ -47,6 +42,8 @@ import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.jni.JNIUtilsImpl;
import org.eehouse.android.xw4.jni.XwJNI;
import java.util.Arrays;
public class DictBrowseDelegate extends ListDelegateBase
implements View.OnClickListener, OnItemSelectedListener {

View file

@ -25,6 +25,16 @@ import android.content.res.Resources;
import android.os.Handler;
import android.widget.ArrayAdapter;
import junit.framework.Assert;
import org.eehouse.android.xw4.DictUtils.DictAndLoc;
import org.eehouse.android.xw4.DictUtils.DictLoc;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.DictInfo;
import org.eehouse.android.xw4.jni.JNIUtilsImpl;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.loc.LocUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@ -34,16 +44,6 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import junit.framework.Assert;
import org.eehouse.android.xw4.DictUtils.DictAndLoc;
import org.eehouse.android.xw4.DictUtils.DictLoc;
import org.eehouse.android.xw4.jni.JNIUtilsImpl;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.jni.DictInfo;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.loc.LocUtils;
public class DictLangCache {
private static String[] s_langNames;
private static HashMap<String, Integer> s_langCodes;

View file

@ -20,14 +20,11 @@
package org.eehouse.android.xw4;
import android.preference.ListPreference;
import android.content.Context;
import android.util.AttributeSet;
import java.util.ArrayList;
import junit.framework.Assert;
public class DictListPreference extends XWListPreference {
public DictListPreference( Context context, AttributeSet attrs )

View file

@ -20,31 +20,22 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.net.Uri;
import android.os.Environment;
import android.text.Html;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.JNIUtilsImpl;
import org.eehouse.android.xw4.jni.XwJNI;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
public class DictUtils {

View file

@ -20,17 +20,7 @@
package org.eehouse.android.xw4;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import java.util.HashMap;
import org.eehouse.android.xw4.DictUtils.DictAndLoc;
import org.eehouse.android.xw4.loc.LocUtils;
public class DictsActivity extends XWActivity {

View file

@ -24,9 +24,9 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
@ -35,10 +35,8 @@ import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CheckBox;
@ -47,30 +45,27 @@ import android.widget.ListView;
import android.widget.PopupMenu;
import android.widget.TextView;
import java.net.HttpURLConnection;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
import junit.framework.Assert;
import org.eehouse.android.xw4.DictUtils.DictAndLoc;
import org.eehouse.android.xw4.DictUtils.DictLoc;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.loc.LocUtils;
import org.eehouse.android.xw4.DwnldDelegate.DownloadFinishedListener;
import org.eehouse.android.xw4.DwnldDelegate.OnGotLcDictListener;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.loc.LocUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class DictsDelegate extends ListDelegateBase
implements View.OnClickListener, AdapterView.OnItemLongClickListener,

View file

@ -21,15 +21,8 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.net.Uri;
import android.widget.Toast;
import android.os.Bundle;
import java.util.HashSet;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.GameSummary;
public class DispatchNotify extends Activity {

View file

@ -24,19 +24,23 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import junit.framework.Assert;
import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
import org.eehouse.android.xw4.loc.LocUtils;
import java.lang.ref.WeakReference;
import java.text.DateFormat;
@ -46,11 +50,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
public class DlgDelegate {
public static enum Action {
@ -69,6 +68,7 @@ public class DlgDelegate {
SET_HIDE_NEWGAME_BUTTONS,
DWNLD_LOC_DICT,
NEW_GAME_DFLT_NAME,
ENABLE_DUALPANE,
// BoardDelegate
UNDO_LAST_ACTION,
@ -135,6 +135,23 @@ public class DlgDelegate {
public Object[] params; // null for now
}
// typesafe int, basically
public static class NAKey implements Runnable {
private Context m_context;
private int m_nakey;
public NAKey(int key) { m_nakey = key; }
boolean isSet( Context context ) {
m_context = context; // hack!!!
return XWPrefs.getPrefsBoolean( context, m_nakey, false );
}
@Override
public void run() {
Assert.assertNotNull( m_context );
XWPrefs.setPrefsBoolean( m_context, m_nakey, true );
}
}
public static final int SMS_BTN = AlertDialog.BUTTON_POSITIVE;
public static final int NFC_BTN = AlertDialog.BUTTON_NEUTRAL;
public static final int DISMISS_BUTTON = 0;
@ -374,41 +391,55 @@ public class DlgDelegate {
public void showConfirmThen( int msg, int posButton, int negButton, Action action )
{
showConfirmThen( null, getString(msg), posButton, negButton, action, null );
showConfirmThen( null, null, getString(msg), posButton, negButton, action, null );
}
public void showConfirmThen( String msg, int posButton, int negButton, Action action )
{
showConfirmThen( null, msg, posButton, negButton, action, null );
showConfirmThen( null, null, msg, posButton, negButton, action, null );
}
public void showConfirmThen( int msg, int posButton, int negButton, Action action,
Object... params )
{
showConfirmThen( null, getString(msg), posButton, negButton, action, params );
showConfirmThen( null, null, getString(msg), posButton, negButton, action, params );
}
public void showConfirmThen( int msg, int posButton, Action action,
Object[] params )
{
showConfirmThen( null, getString(msg), posButton, android.R.string.cancel,
showConfirmThen( null, null, getString(msg), posButton, android.R.string.cancel,
action, params );
}
public void showConfirmThen( Runnable onNA, String msg, int posButton, Action action,
Object[] params )
{
showConfirmThen( onNA, msg, posButton, android.R.string.cancel, action,
showConfirmThen( null, onNA, msg, posButton, android.R.string.cancel, action,
params );
}
public void showConfirmThen( Runnable onNA, String msg, int posButton,
public void showConfirmThen( NAKey nakey, int msgId, int posButtonId,
Action action )
{
showConfirmThen( nakey, null, getString(msgId), posButtonId,
android.R.string.cancel, action, null );
}
public void showConfirmThen( NAKey nakey, Runnable onNA, String msg, int posButton,
int negButton, Action action, Object[] params )
{
DlgState state = new DlgState( DlgID.CONFIRM_THEN, onNA, msg, posButton,
negButton, action, 0, params );
addState( state );
showDialog( DlgID.CONFIRM_THEN );
if ( null != nakey ) {
Assert.assertNull( onNA );
onNA = nakey; // so the run() method will be called to set the key
}
if ( null == nakey || !nakey.isSet( m_activity ) ) {
DlgState state
= new DlgState( DlgID.CONFIRM_THEN, onNA, msg, posButton,
negButton, action, 0, params );
addState( state );
showDialog( DlgID.CONFIRM_THEN );
}
}
public void showInviteChoicesThen( final Action action,

View file

@ -20,12 +20,12 @@
package org.eehouse.android.xw4;
import android.os.Parcel;
import android.os.Parcelable;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.ActionPair;
import android.os.Parcelable;
import android.os.Parcel;
public class DlgState implements Parcelable {
public DlgID m_id;
public String m_msg;

View file

@ -24,8 +24,8 @@ import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;

View file

@ -20,7 +20,6 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;

View file

@ -27,28 +27,24 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import junit.framework.Assert;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URI;
import java.net.URLConnection;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import junit.framework.Assert;
public class DwnldDelegate extends ListDelegateBase {

View file

@ -20,20 +20,18 @@
package org.eehouse.android.xw4;
import android.preference.DialogPreference;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.View;
import android.widget.SeekBar;
import android.widget.EditText;
import android.app.Dialog;
import android.content.SharedPreferences;
import android.app.AlertDialog;
import android.text.TextWatcher;
import android.text.Editable;
import junit.framework.Assert;
import android.widget.SeekBar;
import org.eehouse.android.xw4.loc.LocUtils;

View file

@ -26,16 +26,17 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.view.View;
import junit.framework.Assert;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import junit.framework.Assert;
public class ExpiringDelegate {

View file

@ -23,8 +23,10 @@ package org.eehouse.android.xw4;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import com.google.android.gcm.GCMBaseIntentService;
import com.google.android.gcm.GCMRegistrar;
import org.json.JSONArray;
public class GCMIntentService extends GCMBaseIntentService {

View file

@ -21,44 +21,41 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.net.Uri;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import android.widget.TextView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.app.Dialog;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageButton;
import android.view.KeyEvent;
import android.widget.Spinner;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import java.util.List;
import android.widget.TextView;
import junit.framework.Assert;
import org.eehouse.android.xw4.DictLangCache.LangsArrayAdapter;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.ActionPair;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.DictLangCache.LangsArrayAdapter;
import org.eehouse.android.xw4.jni.CurGameInfo;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.jni.LocalPlayer;
import org.eehouse.android.xw4.jni.XwJNI;
public class GameConfigDelegate extends DelegateBase
implements View.OnClickListener

View file

@ -21,14 +21,11 @@
package org.eehouse.android.xw4;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.eehouse.android.xw4.DBUtils.GameGroupInfo;
import org.eehouse.android.xw4.loc.LocUtils;
public class GameListGroup extends ExpiringLinearLayout

View file

@ -24,10 +24,7 @@ import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.View;
@ -36,18 +33,17 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.loc.LocUtils;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashSet;
import java.util.concurrent.LinkedBlockingQueue;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.loc.LocUtils;
public class GameListItem extends LinearLayout
implements View.OnClickListener, SelectableItem.LongClickHandler {
@ -207,9 +203,13 @@ public class GameListItem extends LinearLayout
if ( loaded != m_loaded ) {
m_loaded = loaded;
// This should be enough to invalidate
m_viewUnloaded.setVisibility( loaded ? View.GONE : View.VISIBLE );
m_viewLoaded.setVisibility( loaded ? View.VISIBLE : View.GONE );
if ( loaded ) {
// This should be enough to invalidate
m_viewUnloaded.setVisibility( View.INVISIBLE );
m_viewLoaded.setVisibility( View.VISIBLE );
} else {
m_viewLoaded.invalidate();
}
}
}

View file

@ -20,10 +20,10 @@
package org.eehouse.android.xw4;
import java.util.HashMap;
import junit.framework.Assert;
import java.util.HashMap;
// Implements read-locks and write-locks per game. A read lock is
// obtainable when other read locks are granted but not when a
// write lock is. Write-locks are exclusive.

View file

@ -27,8 +27,6 @@ import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
public class GameNamer extends LinearLayout {

View file

@ -24,33 +24,39 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Html;
import android.text.TextUtils;
import android.view.Display;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.jni.CurGameInfo;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.jni.DrawCtx;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.jni.JNIUtilsImpl;
import org.eehouse.android.xw4.jni.LastMoveInfo;
import org.eehouse.android.xw4.jni.TransportProcs;
import org.eehouse.android.xw4.jni.UtilCtxt;
import org.eehouse.android.xw4.jni.UtilCtxtImpl;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.jni.XwJNI.GamePtr;
import org.eehouse.android.xw4.loc.LocUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.HashSet;
import java.util.concurrent.locks.Lock;
import org.json.JSONArray;
import org.json.JSONObject;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.jni.LastMoveInfo;
import org.eehouse.android.xw4.jni.XwJNI.GamePtr;
import org.eehouse.android.xw4.loc.LocUtils;
import java.util.Iterator;
public class GameUtils {
@ -351,21 +357,6 @@ public class GameUtils {
return thumb;
}
public static Bitmap loadMakeBitmap( Context context, byte[] stream,
GameLock lock )
{
Bitmap thumb = null;
CurGameInfo gi = new CurGameInfo( context );
GamePtr gamePtr = loadMakeGame( context, gi, null, null, stream,
lock.getRowid() );
if ( null != gamePtr ) {
thumb = takeSnapshot( context, gamePtr, gi );
gamePtr.release();
DBUtils.saveThumbnail( context, lock, thumb );
}
return thumb;
}
public static Bitmap takeSnapshot( Context context, GamePtr gamePtr,
CurGameInfo gi )
{
@ -391,15 +382,8 @@ public class GameUtils {
thumb = Bitmap.createBitmap( size, size,
Bitmap.Config.ARGB_8888 );
XwJNI.board_figureLayout( gamePtr, gi, 0, 0, size, size,
0, 0, 0, 20, 20, false, null );
ThumbCanvas canvas = new ThumbCanvas( context, thumb );
XwJNI.board_setDraw( gamePtr, canvas );
XwJNI.board_invalAll( gamePtr );
Assert.assertNotNull( gamePtr );
XwJNI.board_draw( gamePtr );
XwJNI.board_drawSnapshot( gamePtr, canvas, size, size );
}
}
return thumb;

View file

@ -24,38 +24,25 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import junit.framework.Assert;
import org.eehouse.android.xw4.DBUtils.GameChangeType;
@ -63,13 +50,25 @@ import org.eehouse.android.xw4.DBUtils.GameGroupInfo;
import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.ActionPair;
import org.eehouse.android.xw4.DlgDelegate.NAKey;
import org.eehouse.android.xw4.DwnldDelegate.DownloadFinishedListener;
import org.eehouse.android.xw4.DwnldDelegate.OnGotLcDictListener;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.jni.CurGameInfo;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.jni.LastMoveInfo;
import org.eehouse.android.xw4.loc.LocUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class GamesListDelegate extends ListDelegateBase
implements OnItemLongClickListener,
DBUtils.DBChangeListener, SelectableItem,
@ -947,11 +946,26 @@ public class GamesListDelegate extends ListDelegateBase
DBUtils.setDBChangeListener( this );
boolean isUpgrade = Utils.firstBootThisVersion( m_activity );
if ( isUpgrade && !s_firstShown ) {
if ( LocUtils.getCurLangCode( m_activity ).equals( "en" ) ) {
FirstRunDialog.show( m_activity );
if ( isUpgrade ) {
if ( !s_firstShown ) {
if ( LocUtils.getCurLangCode( m_activity ).equals( "en" ) ) {
FirstRunDialog.show( m_activity );
}
s_firstShown = true;
}
}
// Combine with above when "true" removed
if ( true || isUpgrade ) {
if ( !XWPrefs.getPrefsBoolean( m_activity,
R.string.key_enable_dualpane, false )
&& XWPrefs.getIsTablet( m_activity ) ) {
showConfirmThen( new NAKey(R.string.key_notagain_dualpane),
R.string.invite_dualpane,
R.string.enable_dualpane,
Action.ENABLE_DUALPANE );
}
s_firstShown = true;
}
m_newGameButtons = new Button[] {
@ -1256,6 +1270,9 @@ public class GamesListDelegate extends ListDelegateBase
case OPEN_GAME:
doOpenGame( params );
break;
case ENABLE_DUALPANE:
setDualpaneAndFinish( true );
break;
case CLEAR_SELS:
clearSelections();
break;
@ -1429,6 +1446,10 @@ public class GamesListDelegate extends ListDelegateBase
0 < DBUtils.getGamesWithSendsPending( m_activity ).size();
Utils.setItemVisible( menu, R.id.games_menu_resend, enable );
enable = XWPrefs.getPrefsBoolean( m_activity, R.string.key_enable_dualpane,
false );
Utils.setItemVisible( menu, R.id.games_menu_disable_dualpane, enable );
Assert.assertTrue( m_menuPrepared );
} else {
DbgUtils.logf( "onPrepareOptionsMenu: incomplete so bailing" );
@ -1461,6 +1482,10 @@ public class GamesListDelegate extends ListDelegateBase
switch ( itemID ) {
// There's no selection for these items, so nothing to clear
case R.id.games_menu_disable_dualpane:
setDualpaneAndFinish( false );
break;
case R.id.games_menu_resend:
GameUtils.resendAllIf( m_activity, null, true );
break;
@ -2520,6 +2545,20 @@ public class GamesListDelegate extends ListDelegateBase
}
}
private void setDualpaneAndFinish( boolean enable )
{
XWPrefs.setPrefsBoolean( m_activity, R.string.key_enable_dualpane,
enable );
Intent intent = makeSelfIntent( m_activity );
int bodyID = enable ? R.string.post_dualpane_on_body
: R.string.post_dualpane_off_body;
Utils.postNotification( m_activity, intent,
R.string.post_dualpane_title,
bodyID, R.string.post_dualpane_title );
Utils.showToast( m_activity, R.string.dualpane_restart );
m_activity.finish();
}
public static void boardDestroyed( long rowid )
{
if ( null != s_self ) {

View file

@ -21,17 +21,13 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.view.ViewGroup;
import junit.framework.Assert;
abstract class InviteDelegate extends ListDelegateBase
implements View.OnClickListener,

View file

@ -22,7 +22,6 @@ package org.eehouse.android.xw4;
import android.content.Context;
import android.util.AttributeSet;
import android.preference.PreferenceActivity;
import org.eehouse.android.xw4.loc.LocUtils;

View file

@ -21,22 +21,15 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
@ -44,12 +37,12 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
import java.util.ArrayList;
public class LookupAlert extends LinearLayout
implements View.OnClickListener, Dialog.OnKeyListener,
AdapterView.OnItemClickListener {

View file

@ -26,25 +26,20 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager.BackStackEntry;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import junit.framework.Assert;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eehouse.android.xw4.jni.CurGameInfo;
import junit.framework.Assert;
public class MainActivity extends XWActivity
implements FragmentManager.OnBackStackChangedListener {
private static final int MAX_PANES_LANDSCAPE = 2;

View file

@ -23,6 +23,7 @@ package org.eehouse.android.xw4;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import java.util.HashSet;
import java.util.Iterator;

View file

@ -21,13 +21,15 @@
package org.eehouse.android.xw4;
import android.content.Context;
import java.util.HashSet;
import java.util.Set;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.TransportProcs;
import java.util.HashSet;
import java.util.Set;
public class MultiMsgSink implements TransportProcs {
private long m_rowid;

View file

@ -20,11 +20,10 @@
package org.eehouse.android.xw4;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import junit.framework.Assert;

View file

@ -21,10 +21,8 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface;
import android.content.Intent;
import android.nfc.NdefMessage;
@ -34,8 +32,6 @@ import android.nfc.NfcEvent;
import android.nfc.NfcManager;
import android.os.Parcelable;
import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
public class NFCUtils {

View file

@ -25,11 +25,7 @@ import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import junit.framework.Assert;
@ -37,6 +33,10 @@ import org.eehouse.android.xw4.DBUtils.NeedsNagInfo;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.loc.LocUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
public class NagTurnReceiver extends BroadcastReceiver {
private static final long INTERVAL_MILLIS = 1000 * 30; // every half minute for now

View file

@ -25,19 +25,20 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import java.io.InputStream;
import java.util.Iterator;
import org.json.JSONException;
import org.json.JSONObject;
import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.jni.CurGameInfo;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.loc.LocUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.InputStream;
import java.util.Iterator;
public class NetLaunchInfo {
private static final String ADDRS_KEY = "ad";

View file

@ -28,14 +28,15 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Handler;
import java.util.HashSet;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicBoolean;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import java.util.HashSet;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicBoolean;
public class NetStateCache {
private static final long WAIT_STABLE_MILLIS = 2 * 1000;

View file

@ -21,8 +21,12 @@
package org.eehouse.android.xw4;
import android.content.Context;
import android.text.TextUtils;
import junit.framework.Assert;
import org.json.JSONObject;
import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
@ -38,14 +42,10 @@ import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.net.SocketFactory;
import org.json.JSONObject;
import junit.framework.Assert;
public class NetUtils {
public static final String k_PARAMS = "params";

View file

@ -20,11 +20,10 @@
package org.eehouse.android.xw4;
import android.preference.Preference;
import android.preference.ListPreference;
import android.content.Context;
import android.preference.ListPreference;
import android.preference.Preference;
import android.util.AttributeSet;
import junit.framework.Assert;
public class PollListPreference extends ListPreference

View file

@ -22,14 +22,13 @@ package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.Dialog;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.loc.LocUtils;
public class PrefsActivity extends PreferenceActivity
implements Delegator, DlgDelegate.HasDlgDelegate {

View file

@ -23,10 +23,8 @@ package org.eehouse.android.xw4;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
@ -35,14 +33,14 @@ import android.preference.PreferenceScreen;
import android.view.View;
import android.widget.Button;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import junit.framework.Assert;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.loc.LocUtils;
import junit.framework.Assert;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class PrefsDelegate extends DelegateBase
implements SharedPreferences.OnSharedPreferenceChangeListener {
@ -341,6 +339,9 @@ public class PrefsDelegate extends DelegateBase
if ( ABUtils.haveActionBar() ) {
hideOne( R.string.key_hide_title, R.string.prefs_appearance );
}
}
if ( !XWPrefs.getIsTablet( m_activity ) ) {
hideOne( R.string.key_enable_dualpane, R.string.prefs_appearance );
}
}
}

View file

@ -21,18 +21,18 @@
package org.eehouse.android.xw4;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.content.Context;
import android.os.AsyncTask;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import java.io.InputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.util.ArrayList;
import java.net.Socket;
import org.eehouse.android.xw4.loc.LocUtils;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.Socket;
import java.util.ArrayList;
public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
public interface NoNameFound {

View file

@ -20,11 +20,8 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.content.Context;
import android.preference.CheckBoxPreference;
import android.util.AttributeSet;
import android.view.View;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.loc.LocUtils;

View file

@ -20,8 +20,6 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class RelayInviteActivity extends InviteActivity {

View file

@ -22,43 +22,32 @@ package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract;
import android.text.method.DialerKeyListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.ImageButton;
import android.widget.Spinner;
import junit.framework.Assert;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.json.JSONArray;
import org.json.JSONObject;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONObject;
import junit.framework.Assert;
import org.eehouse.android.xw4.DlgDelegate.Action;
public class RelayInviteDelegate extends InviteDelegate {
// private static final int GET_CONTACT = 1;

View file

@ -26,7 +26,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;
import android.widget.Toast;
public class RelayReceiver extends BroadcastReceiver {

View file

@ -26,7 +26,18 @@ import android.content.Intent;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import junit.framework.Assert;
import org.eehouse.android.xw4.GameUtils.BackMoveResult;
import org.eehouse.android.xw4.MultiService.DictFetchOwner;
import org.eehouse.android.xw4.MultiService.MultiEvent;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.UtilCtxt.DevIDType;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.loc.LocUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
@ -43,20 +54,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.concurrent.LinkedBlockingQueue;
import junit.framework.Assert;
import org.eehouse.android.xw4.MultiService.DictFetchOwner;
import org.eehouse.android.xw4.MultiService.MultiEvent;
import org.eehouse.android.xw4.GameUtils.BackMoveResult;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.jni.LastMoveInfo;
import org.eehouse.android.xw4.jni.UtilCtxt.DevIDType;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.loc.LocUtils;
public class RelayService extends XWService
implements NetStateCache.StateChangedIf {
private static final int MAX_SEND = 1024;

View file

@ -20,11 +20,8 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.content.Context;
import android.preference.CheckBoxPreference;
import android.util.AttributeSet;
import android.view.View;
import org.eehouse.android.xw4.DlgDelegate.Action;

View file

@ -20,8 +20,6 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class SMSInviteActivity extends InviteActivity {

View file

@ -28,28 +28,27 @@ import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.text.method.DialerKeyListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.ImageButton;
import android.widget.Spinner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import junit.framework.Assert;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
import org.eehouse.android.xw4.DlgDelegate.Action;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
public class SMSInviteDelegate extends InviteDelegate {

View file

@ -20,12 +20,12 @@
package org.eehouse.android.xw4;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.CheckBox;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.LinearLayout;
import android.widget.TextView;
public class SMSListItem extends LinearLayout {

View file

@ -26,8 +26,6 @@ import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import junit.framework.Assert;
public class SMSReceiver extends BroadcastReceiver {
@Override

View file

@ -20,52 +20,38 @@
package org.eehouse.android.xw4;
import android.telephony.TelephonyManager;
import android.app.Activity;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.preference.PreferenceManager;
import android.telephony.PhoneNumberUtils;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import android.telephony.TelephonyManager;
import junit.framework.Assert;
import org.eehouse.android.xw4.MultiService.DictFetchOwner;
import org.eehouse.android.xw4.MultiService.MultiEvent;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.loc.LocUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.lang.System;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import junit.framework.Assert;
import org.eehouse.android.xw4.XWService.ReceiveResult;
import org.eehouse.android.xw4.GameUtils.BackMoveResult;
import org.eehouse.android.xw4.MultiService.DictFetchOwner;
import org.eehouse.android.xw4.MultiService.MultiEvent;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.LastMoveInfo;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.loc.LocUtils;
public class SMSService extends XWService {
private static final String INSTALL_URL = "http://eehouse.org/_/a.py/a ";

View file

@ -19,28 +19,22 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.ClipboardManager;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Spinner;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import junit.framework.Assert;
@ -48,6 +42,10 @@ import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.loc.LocUtils;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class StudyListDelegate extends ListDelegateBase
implements OnItemSelectedListener, SelectableItem,
View.OnLongClickListener, View.OnClickListener {

View file

@ -22,18 +22,15 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import junit.framework.Assert;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.HasDlgDelegate;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.loc.LocUtils;
public class Toolbar {

View file

@ -30,16 +30,13 @@ import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.SystemClock;
import java.net.HttpURLConnection;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.eehouse.android.xw4.loc.LocUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.eehouse.android.xw4.loc.LocUtils;
import java.io.File;
import java.net.HttpURLConnection;
public class UpdateCheckReceiver extends BroadcastReceiver {

View file

@ -29,7 +29,6 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences.Editor;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@ -47,17 +46,18 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.loc.LocUtils;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.loc.LocUtils;
public class Utils {
public static final int TURN_COLOR = 0x7F00FF00;

View file

@ -25,11 +25,10 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;

View file

@ -26,10 +26,10 @@ import android.graphics.Color;
import android.os.Build;
import android.preference.PreferenceManager;
import java.util.UUID;
import org.eehouse.android.xw4.jni.XwJNI;
import java.util.UUID;
public class XWApp extends Application {
public static final boolean BTSUPPORTED = true;

View file

@ -20,12 +20,10 @@
package org.eehouse.android.xw4;
import android.preference.EditTextPreference;
import android.content.Context;
import android.preference.EditTextPreference;
import android.util.AttributeSet;
import junit.framework.Assert;
public class XWDevIDPreference extends EditTextPreference {
private Context m_context;

View file

@ -20,12 +20,10 @@
package org.eehouse.android.xw4;
import android.preference.EditTextPreference;
import android.content.Context;
import android.preference.EditTextPreference;
import android.util.AttributeSet;
import junit.framework.Assert;
public class XWEditTextPreference extends EditTextPreference {
public XWEditTextPreference( Context context, AttributeSet attrs )

View file

@ -22,14 +22,15 @@ package org.eehouse.android.xw4;
import android.view.View;
import android.view.ViewGroup;
import junit.framework.Assert;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import junit.framework.Assert;
abstract class XWExpListAdapter extends XWListAdapter {
interface GroupTest {

View file

@ -21,7 +21,6 @@
package org.eehouse.android.xw4;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;

View file

@ -20,10 +20,8 @@
package org.eehouse.android.xw4;
import android.widget.ListAdapter;
import android.content.Context;
import android.database.DataSetObserver;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
/**
* Let's see if we can implement a few of these methods just once.

View file

@ -21,15 +21,12 @@
package org.eehouse.android.xw4;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.CheckBox;
import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;

View file

@ -20,12 +20,10 @@
package org.eehouse.android.xw4;
import android.preference.ListPreference;
import android.content.Context;
import android.preference.ListPreference;
import android.util.AttributeSet;
import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
public class XWListPreference extends ListPreference {

View file

@ -25,7 +25,6 @@ import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import java.util.ArrayList;
import junit.framework.Assert;

View file

@ -25,9 +25,6 @@ import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import java.util.HashSet;
import java.util.Set;
import junit.framework.Assert;
import org.eehouse.android.xw4.MultiService.MultiEvent;
@ -36,6 +33,9 @@ import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.jni.UtilCtxt;
import org.eehouse.android.xw4.jni.UtilCtxtImpl;
import java.util.HashSet;
import java.util.Set;
class XWService extends Service {
public static enum ReceiveResult { OK, GAME_GONE, UNCONSUMED };

View file

@ -23,8 +23,6 @@ package org.eehouse.android.xw4;
import android.content.Context;
import android.util.AttributeSet;
import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;

View file

@ -21,6 +21,7 @@
package org.eehouse.android.xw4.jni;
import android.app.Activity;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
public interface BoardHandler {

View file

@ -23,16 +23,12 @@ package org.eehouse.android.xw4.jni;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Paint;
import android.os.Build;
import android.preference.PreferenceManager;
import junit.framework.Assert;
import org.eehouse.android.xw4.XWPrefs;
import org.eehouse.android.xw4.R;
import org.eehouse.android.xw4.DictUtils;
import org.eehouse.android.xw4.DbgUtils;
import org.eehouse.android.xw4.R;
import org.eehouse.android.xw4.XWPrefs;
import org.eehouse.android.xw4.loc.LocUtils;
public class CommonPrefs extends XWPrefs {

View file

@ -22,9 +22,6 @@ package org.eehouse.android.xw4.jni;
import android.content.Context;
import android.text.TextUtils;
import java.net.InetAddress;
import java.util.HashSet;
import java.util.Iterator;
import junit.framework.Assert;
@ -37,6 +34,10 @@ import org.eehouse.android.xw4.Utils;
import org.eehouse.android.xw4.XWPrefs;
import org.eehouse.android.xw4.loc.LocUtils;
import java.net.InetAddress;
import java.util.HashSet;
import java.util.Iterator;
public class CommsAddrRec {
public enum CommsConnType {

View file

@ -21,18 +21,19 @@
package org.eehouse.android.xw4.jni;
import android.content.Context;
import java.util.ArrayList;
import junit.framework.Assert;
import org.eehouse.android.xw4.DbgUtils;
import org.eehouse.android.xw4.DictLangCache;
import org.eehouse.android.xw4.DictUtils;
import org.eehouse.android.xw4.R;
import org.eehouse.android.xw4.loc.LocUtils;
import org.json.JSONObject;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Random;
import junit.framework.Assert;
import org.json.JSONObject;
import org.eehouse.android.xw4.DbgUtils;
import org.eehouse.android.xw4.DictUtils;
import org.eehouse.android.xw4.R;
import org.eehouse.android.xw4.DictLangCache;
import org.eehouse.android.xw4.loc.LocUtils;
public class CurGameInfo {

View file

@ -22,10 +22,8 @@ package org.eehouse.android.xw4.jni;
import android.content.Context;
import android.text.TextUtils;
import java.util.Iterator;
import junit.framework.Assert;
import org.json.JSONObject;
import org.eehouse.android.xw4.DBUtils;
import org.eehouse.android.xw4.DbgUtils;
@ -36,6 +34,7 @@ import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.loc.LocUtils;
import org.json.JSONObject;
/** Info we want to access when the game's closed that's not available
* in CurGameInfo

View file

@ -23,18 +23,10 @@ package org.eehouse.android.xw4.jni;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Handler;
import android.os.Message;
import java.lang.InterruptedException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.HashSet;
import java.util.Set;
import junit.framework.Assert;
import org.eehouse.android.xw4.CommsTransport;
import org.eehouse.android.xw4.ConnStatusHandler;
@ -44,14 +36,16 @@ import org.eehouse.android.xw4.DictUtils;
import org.eehouse.android.xw4.GameLock;
import org.eehouse.android.xw4.GameUtils;
import org.eehouse.android.xw4.R;
import org.eehouse.android.xw4.Toolbar;
import org.eehouse.android.xw4.XWPrefs;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.jni.DrawCtx;
import org.eehouse.android.xw4.jni.XwJNI.GamePtr;
import junit.framework.Assert;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;
public class JNIThread extends Thread {
@ -140,14 +134,12 @@ public class JNIThread extends Thread {
private boolean m_stopped = false;
private boolean m_saveOnStop = false;
private GamePtr m_jniGamePtr;
private byte[] m_lastSavedState;
private int m_lastSavedState = 0;
private GameLock m_lock;
private Context m_context;
private CurGameInfo m_gi;
private Handler m_handler;
private SyncedDraw m_drawer;
private static final int kMinDivWidth = 10;
private int m_connsIconID = 0;
private String m_newDict = null;
private long m_rowid;
private int m_refCount;
@ -166,9 +158,10 @@ public class JNIThread extends Thread {
Object[] m_args;
}
private JNIThread( long rowid )
private JNIThread( GameLock lock )
{
m_rowid = rowid;
m_lock = lock;
m_rowid = lock.getRowid();
m_queue = new LinkedBlockingQueue<QueueElem>();
}
@ -181,12 +174,6 @@ public class JNIThread extends Thread {
m_drawer = drawer;
m_handler = handler;
if ( null == m_lock ) {
m_lock = new GameLock( m_rowid, true ).lock();
} else {
m_jniGamePtr.release(); // let the old game copy go
}
// If this isn't true then the queue has to be allowed to empty,
// working on the old game state, before we can re-use any of this.
Assert.assertTrue( 0 == m_queue.size() );
@ -227,7 +214,7 @@ public class JNIThread extends Thread {
null, cp, m_xport );
}
m_lastSavedState = stream;
m_lastSavedState = Arrays.hashCode( stream );
return this;
}
@ -363,15 +350,14 @@ public class JNIThread extends Thread {
m_gi.dictName = m_newDict;
}
byte[] state = XwJNI.game_saveToStream( m_jniGamePtr, m_gi );
boolean arraysEqual = Arrays.equals( m_lastSavedState, state );
boolean hashesEqual = Arrays.hashCode( m_lastSavedState) == Arrays.hashCode(state);
DbgUtils.logf( "arraysEqual: %b; hashesEqual: %b", arraysEqual, hashesEqual );
int newHash = Arrays.hashCode( state );
boolean hashesEqual = m_lastSavedState == newHash;
// PENDING: once certain this is true, stop saving the full array and
// instead save the hash. Also, update it after each save.
Assert.assertTrue( arraysEqual == hashesEqual );
if ( Arrays.equals( m_lastSavedState, state ) ) {
if ( hashesEqual ) {
DbgUtils.logdf( "JNIThread.save_jni(): no change in game; can skip saving" );
} else {
// Don't need this!!!! this only runs on the run() thread
synchronized( this ) {
Assert.assertNotNull( m_lock );
GameSummary summary = new GameSummary( m_context, m_gi );
@ -381,9 +367,11 @@ public class JNIThread extends Thread {
// There'd better be no way for saveGame above to fail!
XwJNI.game_saveSucceeded( m_jniGamePtr );
m_lastSavedState = state;
m_lastSavedState = newHash;
GameUtils.loadMakeBitmap( m_context, state, m_lock );
Bitmap thumb
= GameUtils.takeSnapshot( m_context, m_jniGamePtr, m_gi );
DBUtils.saveThumbnail( m_context, m_lock, thumb );
}
}
}
@ -391,9 +379,11 @@ public class JNIThread extends Thread {
boolean m_running = false;
public void startOnce()
{
if ( !m_running ) {
m_running = true;
start();
synchronized ( this ) {
if ( !m_running ) {
m_running = true;
start();
}
}
}
@ -768,7 +758,7 @@ public class JNIThread extends Thread {
if ( stop ) {
waitToStop( true );
} else if ( save && null != m_lastSavedState ) { // has configure() run?
} else if ( save && 0 != m_lastSavedState ) { // has configure() run?
handle( JNICmd.CMD_SAVE ); // in case releaser has made changes
}
}
@ -784,7 +774,7 @@ public class JNIThread extends Thread {
synchronized( s_instances ) {
result = s_instances.get( rowid );
if ( null == result && makeNew ) {
result = new JNIThread( rowid );
result = new JNIThread( new GameLock( rowid, true ).lock() );
s_instances.put( rowid, result );
}
if ( null != result ) {

View file

@ -20,8 +20,6 @@
package org.eehouse.android.xw4.jni;
import android.graphics.drawable.BitmapDrawable;
public interface JNIUtils {
// Stuff I can't do in C....

Some files were not shown because too many files have changed in this diff Show more