Merge branch 'android_branch' into send_in_background

Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java
(conflicts were for formatting changes only)
This commit is contained in:
Andy2 2011-12-07 18:46:59 -08:00
commit 2992c33396
3 changed files with 25 additions and 20 deletions

View file

@ -232,6 +232,7 @@ public class DBUtils {
values.put( DBHelper.DICTLANG, summary.dictLang );
values.put( DBHelper.GAME_OVER, summary.gameOver );
values.put( DBHelper.DICTLIST, summary.dictNames(DICTS_SEP) );
values.put( DBHelper.HASMSGS, summary.pendingMsgLevel );
if ( null != summary.scores ) {
StringBuffer sb = new StringBuffer();

View file

@ -202,15 +202,15 @@ public class GameUtils {
XwJNI.comms_setAddr( gamePtr, addr );
}
if ( null == lockDest ) {
long rowid = saveNewGame( context, gamePtr, gi );
lockDest = new GameLock( rowid, true ).lock();
} else {
saveGame( context, gamePtr, gi, lockDest, true );
}
summarizeAndClose( context, lockDest, gamePtr, gi );
if ( null == lockDest ) {
long rowid = saveNewGame( context, gamePtr, gi );
lockDest = new GameLock( rowid, true ).lock();
} else {
saveGame( context, gamePtr, gi, lockDest, true );
}
summarizeAndClose( context, lockDest, gamePtr, gi );
return lockDest;
return lockDest;
} // resetGame
public static void resetGame( Context context, long rowidIn )
@ -316,16 +316,18 @@ public class GameUtils {
gamePtr = XwJNI.initJNI();
String langName = gi.langName();
boolean madeGame = XwJNI.game_makeFromStream( gamePtr, stream, gi,
dictNames, pairs.m_bytes,
pairs.m_paths, langName,
util, JNIUtilsImpl.get(),
CommonPrefs.get(context),
tp);
boolean madeGame =
XwJNI.game_makeFromStream( gamePtr, stream, gi,
dictNames, pairs.m_bytes,
pairs.m_paths, langName,
util, JNIUtilsImpl.get(),
CommonPrefs.get(context),
tp);
if ( !madeGame ) {
XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get(),
CommonPrefs.get(context), dictNames,
pairs.m_bytes, pairs.m_paths, langName );
pairs.m_bytes, pairs.m_paths,
langName );
}
}
return gamePtr;

View file

@ -33,6 +33,7 @@ import android.content.Intent;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.os.SystemClock;
import java.net.Socket;
import java.io.InputStream;
import java.io.DataInputStream;
@ -53,10 +54,8 @@ public class RelayReceiver extends BroadcastReceiver {
RestartTimer( context );
} else {
// DbgUtils.logf( "RelayReceiver::onReceive()" );
// if ( XWConstants.s_showProxyToast ) {
// Toast.makeText(context, "RelayReceiver: fired",
// Toast.LENGTH_SHORT).show();
// }
// Toast.makeText(context, "RelayReceiver: fired",
// Toast.LENGTH_SHORT).show();
Intent service = new Intent( context, RelayService.class );
context.startService( service );
}
@ -83,7 +82,10 @@ public class RelayReceiver extends BroadcastReceiver {
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 );
if ( force || interval_millis > 0 ) {
long first_millis = force ? 0 : interval_millis;
long first_millis = SystemClock.elapsedRealtime();
if ( !force ) {
first_millis += interval_millis;
}
am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,
first_millis, // first firing
interval_millis, pi );