diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index bea57f93d..b522e38b5 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -1859,7 +1859,7 @@ Crosswords on %1$s wrong version for Bluetooth play. - New move via Bluetooth + Message via Bluetooth One or more moves has arrived diff --git a/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml b/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml index 4a1480028..3150aa5aa 100644 --- a/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml +++ b/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml @@ -1596,7 +1596,7 @@ Sdrowssorc no %1$s gnorw noisrev rof Htooteulb yalp. - Wen evom aiv Htooteulb + Egassem aiv Htooteulb Eno ro erom sevom sah devirra diff --git a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml index 674a57a3a..de277a8bd 100644 --- a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml +++ b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml @@ -1596,7 +1596,7 @@ CROSSWORDS ON %1$s WRONG VERSION FOR BLUETOOTH PLAY. - NEW MOVE VIA BLUETOOTH + MESSAGE VIA BLUETOOTH ONE OR MORE MOVES HAS ARRIVED diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java index 8b316a8a5..aca26400e 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java @@ -1,6 +1,6 @@ -/* -*- compile-command: "find-and-ant.sh debug install"; -*- */ +/* -*- compile-command: "find-and-ant.sh -i debug"; -*- */ /* - * Copyright 2010 - 2012 by Eric House (xwords@eehouse.org). All + * Copyright 2010 - 2014 by Eric House (xwords@eehouse.org). All * rights reserved. * * This program is free software; you can redistribute it and/or @@ -46,6 +46,7 @@ import java.util.concurrent.TimeUnit; 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.loc.LocUtils; import junit.framework.Assert; @@ -483,16 +484,19 @@ public class BTService extends XWService { host.getAddress() ); for ( long rowid : rowids ) { - if ( BoardDelegate.feedMessage( gameID, buffer, addr ) ) { - // do nothing - } else if ( haveGame && - GameUtils.feedMessage( BTService.this, rowid, - buffer, addr, - m_btMsgSink, null ) ) { - postNotification( gameID, R.string.new_btmove_title, - R.string.new_move_body, rowid ); - // do nothing - } else { + boolean consumed = + BoardDelegate.feedMessage( gameID, buffer, addr ); + if ( !consumed && haveGame ) { + LastMoveInfo lmi = new LastMoveInfo(); + if ( GameUtils.feedMessage( BTService.this, rowid, + buffer, addr, + m_btMsgSink, lmi ) ) { + consumed = true; + GameUtils.postMoveNotification( BTService.this, + rowid, lmi ); + } + } + if ( !consumed ) { DbgUtils.logf( "nobody took msg for gameID %X", gameID ); } @@ -962,12 +966,6 @@ public class BTService extends XWService { return dos; } - private void postNotification( int gameID, int title, int body, long rowid ) - { - String bstr = LocUtils.getString( this, body ); - postNotification( gameID, title, bstr, rowid ); - } - private void postNotification( int gameID, int title, String body, long rowid ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index fa0fec20b..f911df985 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -952,6 +952,19 @@ public class GameUtils { return rint; } + public static void postMoveNotification( Context context, long rowid, + LastMoveInfo lmi ) + { + Intent intent = GamesListDelegate.makeRowidIntent( context, rowid ); + String msg = ""; + if ( null != lmi ) { + msg = lmi.format( context ); + } + String title = LocUtils.getString( context, R.string.notify_title_fmt, + getName( context, rowid ) ); + Utils.postNotification( context, intent, title, msg, (int)rowid ); + } + private static void tellDied( Context context, GameLock lock, boolean informNow ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java index 7fab68910..69fbabaa7 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java @@ -374,24 +374,12 @@ public class RelayService extends XWService long[] rowids = DBUtils.getRowIDsFor( this, relayID ); if ( null != rowids ) { for ( long rowid : rowids ) { - setupNotification( rowid, lmi ); + GameUtils.postMoveNotification( this, rowid, lmi ); } } } } - private void setupNotification( long rowid, LastMoveInfo lmi ) - { - Intent intent = GamesListDelegate.makeRowidIntent( this, rowid ); - String msg = ""; - if ( null != lmi ) { - msg = lmi.format( this ); - } - String title = LocUtils.getString( this, R.string.notify_title_fmt, - GameUtils.getName( this, rowid ) ); - Utils.postNotification( this, intent, title, msg, (int)rowid ); - } - private boolean startFetchThreadIf() { // DbgUtils.logf( "startFetchThreadIf()" ); @@ -870,7 +858,7 @@ public class RelayService extends XWService LastMoveInfo lmi = new LastMoveInfo(); if ( GameUtils.feedMessage( this, rowid, msg, null, sink, lmi ) ) { - setupNotification( rowid, lmi ); + GameUtils.postMoveNotification( this, rowid, lmi ); } else { DbgUtils.logf( "feedMessage(): background dropped it" ); }