From bf567a131a44467b13845bf1e1a961acc5e58e0c Mon Sep 17 00:00:00 2001 From: Andy2 Date: Tue, 22 Feb 2011 18:09:20 -0800 Subject: [PATCH 1/4] fix crash (according to stack crawl from device) --- .../XWords4/src/org/eehouse/android/xw4/BoardActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index ebfe349ee..d4934689c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -145,8 +145,10 @@ public class BoardActivity extends XWActivity { case QUERY_REQUEST_BLK: case QUERY_INFORM_BLK: ab = new AlertDialog.Builder( this ) - .setTitle( m_dlgTitle ) .setMessage( m_dlgBytes ); + if ( 0 != m_dlgTitle ) { + ab.setTitle( m_dlgTitle ); + } lstnr = new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int whichButton ) { From dbb69bfff51460ac6c20d6b39725bb41ccf63f9b Mon Sep 17 00:00:00 2001 From: Andy2 Date: Tue, 22 Feb 2011 18:29:53 -0800 Subject: [PATCH 2/4] add in flags to get vibration and sound with notifications. (Untested on device.) Will want to add prefs to disable these. --- .../XWords4/src/org/eehouse/android/xw4/RelayService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 a3c8c735b..3f1691b33 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java @@ -81,7 +81,9 @@ public class RelayService extends Service { Notification notification = new Notification( R.drawable.icon48x48, title, System.currentTimeMillis() ); - notification.flags |= Notification.FLAG_AUTO_CANCEL; + notification.flags |= + Notification.FLAG_AUTO_CANCEL | Notification.DEFAULT_SOUND; + notification.flags |= Notification.DEFAULT_VIBRATE; notification. setLatestEventInfo( this, title, From 151df44c9690f6233a6659e602c83f6026d8cd10 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Tue, 22 Feb 2011 18:30:37 -0800 Subject: [PATCH 3/4] get rid of m_invalPath. It seems to be the onContentChanged() on focus grabs that was needed. --- .../XWords4/src/org/eehouse/android/xw4/GamesList.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java index 38c679916..722a01be3 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -58,7 +58,6 @@ public class GamesList extends XWListActivity private static final int SHOW_SUBST = WARN_NODICT + 2; private GameListAdapter m_adapter; - private String m_invalPath = null; private String m_missingDict; private Handler m_handler; private String m_missingDictName; @@ -206,7 +205,6 @@ public class GamesList extends XWListActivity String path = addGame( true ); GameUtils.doConfig( GamesList.this, path, RelayGameActivity.class ); - m_invalPath = path; } }); @@ -290,9 +288,7 @@ public class GamesList extends XWListActivity public void onWindowFocusChanged( boolean hasFocus ) { super.onWindowFocusChanged( hasFocus ); - if ( hasFocus && null != m_invalPath ) { - m_adapter.inval( m_invalPath ); - m_invalPath = null; + if ( hasFocus ) { onContentChanged(); } } @@ -422,7 +418,6 @@ public class GamesList extends XWListActivity GameUtils.launchGame( this, path ); } } - m_invalPath = path; } private boolean handleMenuItem( int menuID, int position ) @@ -457,7 +452,6 @@ public class GamesList extends XWListActivity break; case R.id.list_item_config: GameUtils.doConfig( this, path, GameConfig.class ); - m_invalPath = path; break; case R.id.list_item_new_from: From aaffb749cd75cf007864890274c9e8675bc4f4a5 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Tue, 22 Feb 2011 18:59:56 -0800 Subject: [PATCH 4/4] move network prefs into its own category; add prefs checkboxes there and getters controlling whether vibrate and sound are used as part of notifications. --- .../android/XWords4/res/values/common_rsrc.xml | 2 ++ xwords4/android/XWords4/res/values/strings.xml | 8 ++++++++ xwords4/android/XWords4/res/xml/xwprefs.xml | 15 +++++++++++++++ .../src/org/eehouse/android/xw4/RelayService.java | 12 +++++++++--- .../org/eehouse/android/xw4/jni/CommonPrefs.java | 10 ++++++++++ 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml index 1d3026435..df7126f09 100644 --- a/xwords4/android/XWords4/res/values/common_rsrc.xml +++ b/xwords4/android/XWords4/res/values/common_rsrc.xml @@ -36,6 +36,8 @@ key_default_phonies2 key_default_timerenabled key_connect_frequency + key_notify_sound + key_notify_vibrate key_notagain_sync key_notagain_chat diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index f31c53ab0..ccd37a641 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -256,6 +256,10 @@ Behavior Settings controlling app behavior + Network settings + Settings that apply to + networked games + Game dictionary Handle phonies How to handle \"phonies\" @@ -394,6 +398,10 @@ Once every day Never connect + Play sound + Vibrate + When opponent moves arrive + Fetching public rooms for %d-player games in %s. No public rooms found for %d-player diff --git a/xwords4/android/XWords4/res/xml/xwprefs.xml b/xwords4/android/XWords4/res/xml/xwprefs.xml index db1dfbd45..b95a55616 100644 --- a/xwords4/android/XWords4/res/xml/xwprefs.xml +++ b/xwords4/android/XWords4/res/xml/xwprefs.xml @@ -156,7 +156,11 @@ android:summary="@string/peek_other_summary" android:defaultValue="false" /> + + + + +