From e3b5848d5d682a395b079333db8dd9482cc605e2 Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 3 Mar 2015 07:05:20 -0800 Subject: [PATCH] don't post notification if there's no explanation to be offered. I've been seeing ghost notifications where there should be none; this will fix that, but I need to observe that it doesn't remove notifications that are needed. --- .../org/eehouse/android/xw4/GameUtils.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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 e858b7da9..46f1f0cfb 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -1031,14 +1031,19 @@ public class GameUtils { 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 ); + if ( null == lmi ) { + DbgUtils.logf( "postMoveNotification: posting nothing for lack" + + " of lmi" ); + } else { + 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 ); } - 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,