From f093aba1a60b5de0181e47b4d21d9e81d57d26f3 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 30 Jul 2014 07:05:34 -0700 Subject: [PATCH 1/4] add missing ID so background coloring can work --- xwords4/android/XWords4/res/layout-small/board.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/xwords4/android/XWords4/res/layout-small/board.xml b/xwords4/android/XWords4/res/layout-small/board.xml index 610c8df8f..066ec68be 100644 --- a/xwords4/android/XWords4/res/layout-small/board.xml +++ b/xwords4/android/XWords4/res/layout-small/board.xml @@ -1,6 +1,7 @@ Date: Wed, 30 Jul 2014 07:05:49 -0700 Subject: [PATCH 2/4] test for null (though should not be required to fix this) --- .../XWords4/src/org/eehouse/android/xw4/Toolbar.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java index a13f92704..e624f2643 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java @@ -160,9 +160,11 @@ public class Toolbar { int id = isLandscape ? R.id.tbar_parent_vert : R.id.tbar_parent_hor; ViewGroup scroller = (ViewGroup)m_activity.findViewById( id ); - // Google's had reports of a crash adding second view - scroller.removeAllViews(); - scroller.addView( m_layout ); // failing + if ( null != scroller ) { + // Google's had reports of a crash adding second view + scroller.removeAllViews(); + scroller.addView( m_layout ); // failing + } } m_layout.setVisibility( m_visible? View.VISIBLE : View.GONE ); From 7f880627ecbb5837b3a9d685d5ad9a027a39c861 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 30 Jul 2014 07:07:00 -0700 Subject: [PATCH 3/4] don't create toolbar unless required widgets are present in layout, then test for null toolbar before use. Fixes NPEs on small screens. --- .../eehouse/android/xw4/BoardDelegate.java | 130 ++++++++++-------- 1 file changed, 71 insertions(+), 59 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java index ae072a8fc..695d90ab5 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java @@ -519,10 +519,14 @@ public class BoardDelegate extends DelegateBase m_view = (BoardView)findViewById( R.id.board_view ); if ( ! ABUtils.haveActionBar() ) { m_tradeButtons = findViewById( R.id.exchange_buttons ); - m_exchCommmitButton = (Button)findViewById( R.id.exchange_commit ); - m_exchCommmitButton.setOnClickListener( this ); - m_exchCancelButton = (Button)findViewById( R.id.exchange_cancel ); - m_exchCancelButton.setOnClickListener( this ); + if ( null != m_tradeButtons ) { + m_exchCommmitButton = (Button) + findViewById( R.id.exchange_commit ); + m_exchCommmitButton.setOnClickListener( this ); + m_exchCancelButton = (Button) + findViewById( R.id.exchange_cancel ); + m_exchCancelButton.setOnClickListener( this ); + } } m_volKeysZoom = XWPrefs.getVolKeysZoom( m_activity ); @@ -1855,9 +1859,11 @@ public class BoardDelegate extends DelegateBase setTitle( GameUtils.getName( m_activity, m_rowid ) ); } - int orient = m_activity.getResources().getConfiguration().orientation; - boolean isLandscape = Configuration.ORIENTATION_LANDSCAPE == orient; - m_toolbar = new Toolbar( m_activity, this, isLandscape ); + if ( null != findViewById( R.id.tbar_parent_hor ) ) { + int orient = m_activity.getResources().getConfiguration().orientation; + boolean isLandscape = Configuration.ORIENTATION_LANDSCAPE == orient; + m_toolbar = new Toolbar( m_activity, this, isLandscape ); + } populateToolbar(); adjustTradeVisibility(); @@ -1907,47 +1913,49 @@ public class BoardDelegate extends DelegateBase private void populateToolbar() { - m_toolbar.setListener( Toolbar.BUTTON_BROWSE_DICT, - R.string.not_again_browseall, - R.string.key_na_browseall, - Action.BUTTON_BROWSEALL_ACTION ); - m_toolbar.setLongClickListener( Toolbar.BUTTON_BROWSE_DICT, - R.string.not_again_browse, - R.string.key_na_browse, - Action.BUTTON_BROWSE_ACTION ); - m_toolbar.setListener( Toolbar.BUTTON_HINT_PREV, - R.string.not_again_hintprev, - R.string.key_notagain_hintprev, - Action.PREV_HINT_ACTION ); - m_toolbar.setListener( Toolbar.BUTTON_HINT_NEXT, - R.string.not_again_hintnext, - R.string.key_notagain_hintnext, - Action.NEXT_HINT_ACTION ); - m_toolbar.setListener( Toolbar.BUTTON_JUGGLE, - R.string.not_again_juggle, - R.string.key_notagain_juggle, - Action.JUGGLE_ACTION ); - m_toolbar.setListener( Toolbar.BUTTON_FLIP, - R.string.not_again_flip, - R.string.key_notagain_flip, - Action.FLIP_ACTION ); - m_toolbar.setListener( Toolbar.BUTTON_ZOOM, - R.string.not_again_zoom, - R.string.key_notagain_zoom, - Action.ZOOM_ACTION ); - m_toolbar.setListener( Toolbar.BUTTON_VALUES, - R.string.not_again_values, - R.string.key_na_values, - Action.VALUES_ACTION ); - m_toolbar.setListener( Toolbar.BUTTON_UNDO, - R.string.not_again_undo, - R.string.key_notagain_undo, - Action.UNDO_ACTION ); - if ( BuildConstants.CHAT_SUPPORTED ) { - m_toolbar.setListener( Toolbar.BUTTON_CHAT, - R.string.not_again_chat, - R.string.key_notagain_chat, - Action.CHAT_ACTION ); + if ( null != m_toolbar ) { + m_toolbar.setListener( Toolbar.BUTTON_BROWSE_DICT, + R.string.not_again_browseall, + R.string.key_na_browseall, + Action.BUTTON_BROWSEALL_ACTION ); + m_toolbar.setLongClickListener( Toolbar.BUTTON_BROWSE_DICT, + R.string.not_again_browse, + R.string.key_na_browse, + Action.BUTTON_BROWSE_ACTION ); + m_toolbar.setListener( Toolbar.BUTTON_HINT_PREV, + R.string.not_again_hintprev, + R.string.key_notagain_hintprev, + Action.PREV_HINT_ACTION ); + m_toolbar.setListener( Toolbar.BUTTON_HINT_NEXT, + R.string.not_again_hintnext, + R.string.key_notagain_hintnext, + Action.NEXT_HINT_ACTION ); + m_toolbar.setListener( Toolbar.BUTTON_JUGGLE, + R.string.not_again_juggle, + R.string.key_notagain_juggle, + Action.JUGGLE_ACTION ); + m_toolbar.setListener( Toolbar.BUTTON_FLIP, + R.string.not_again_flip, + R.string.key_notagain_flip, + Action.FLIP_ACTION ); + m_toolbar.setListener( Toolbar.BUTTON_ZOOM, + R.string.not_again_zoom, + R.string.key_notagain_zoom, + Action.ZOOM_ACTION ); + m_toolbar.setListener( Toolbar.BUTTON_VALUES, + R.string.not_again_values, + R.string.key_na_values, + Action.VALUES_ACTION ); + m_toolbar.setListener( Toolbar.BUTTON_UNDO, + R.string.not_again_undo, + R.string.key_notagain_undo, + Action.UNDO_ACTION ); + if ( BuildConstants.CHAT_SUPPORTED ) { + m_toolbar.setListener( Toolbar.BUTTON_CHAT, + R.string.not_again_chat, + R.string.key_notagain_chat, + Action.CHAT_ACTION ); + } } } // populateToolbar @@ -2134,21 +2142,25 @@ public class BoardDelegate extends DelegateBase private void updateToolbar() { - m_toolbar.update( Toolbar.BUTTON_FLIP, m_gsi.visTileCount >= 1 ); - m_toolbar.update( Toolbar.BUTTON_VALUES, m_gsi.visTileCount >= 1 ); - m_toolbar.update( Toolbar.BUTTON_JUGGLE, m_gsi.canShuffle ); - m_toolbar.update( Toolbar.BUTTON_UNDO, m_gsi.canRedo ); - m_toolbar.update( Toolbar.BUTTON_HINT_PREV, m_gsi.canHint ); - m_toolbar.update( Toolbar.BUTTON_HINT_NEXT, m_gsi.canHint ); - m_toolbar.update( Toolbar.BUTTON_CHAT, - BuildConstants.CHAT_SUPPORTED && m_gsi.canChat ); - m_toolbar.update( Toolbar.BUTTON_BROWSE_DICT, - null != m_gi.dictName( m_view.getCurPlayer() ) ); + if ( null != m_toolbar ) { + m_toolbar.update( Toolbar.BUTTON_FLIP, m_gsi.visTileCount >= 1 ); + m_toolbar.update( Toolbar.BUTTON_VALUES, m_gsi.visTileCount >= 1 ); + m_toolbar.update( Toolbar.BUTTON_JUGGLE, m_gsi.canShuffle ); + m_toolbar.update( Toolbar.BUTTON_UNDO, m_gsi.canRedo ); + m_toolbar.update( Toolbar.BUTTON_HINT_PREV, m_gsi.canHint ); + m_toolbar.update( Toolbar.BUTTON_HINT_NEXT, m_gsi.canHint ); + m_toolbar.update( Toolbar.BUTTON_CHAT, + BuildConstants.CHAT_SUPPORTED && m_gsi.canChat ); + m_toolbar.update( Toolbar.BUTTON_BROWSE_DICT, + null != m_gi.dictName( m_view.getCurPlayer() ) ); + } } private void adjustTradeVisibility() { - m_toolbar.setVisible( !m_inTrade ); + if ( null != m_toolbar ) { + m_toolbar.setVisible( !m_inTrade ); + } if ( null != m_tradeButtons ) { m_tradeButtons.setVisibility( m_inTrade? View.VISIBLE : View.GONE ); } From b532883361bdd956f3ed99d429d149e379489b86 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 30 Jul 2014 07:10:53 -0700 Subject: [PATCH 4/4] up strings for new release --- xwords4/android/XWords4/AndroidManifest.xml | 2 +- xwords4/android/XWords4/res/raw/changes | 6 ++++-- xwords4/android/XWords4/res/values/app_name.xml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xwords4/android/XWords4/AndroidManifest.xml b/xwords4/android/XWords4/AndroidManifest.xml index 09b424842..ec8543e96 100644 --- a/xwords4/android/XWords4/AndroidManifest.xml +++ b/xwords4/android/XWords4/AndroidManifest.xml @@ -22,7 +22,7 @@ to come from a domain that you own or have control over. --> diff --git a/xwords4/android/XWords4/res/raw/changes b/xwords4/android/XWords4/res/raw/changes index 9940d2d79..965cdc51c 100644 --- a/xwords4/android/XWords4/res/raw/changes +++ b/xwords4/android/XWords4/res/raw/changes @@ -5,12 +5,14 @@ -Crosswords 4.4 beta 86 release +Crosswords 4.4 beta 87 release -

New with this (and prev.) release

+

New with this (and prev.) releases

  • Don't prevent board displaying in the landscape orientation on large and x-large devices (tablets)
  • +
  • Fix changes for above to not crash on small-screened phones + (thanks Anonymous)
  • Fix changes for above so Nexus 10 and other x-large devices still use the full screen in the portrait orientation (thanks DS)
  • Fix reported crash in new toolbar code (thanks Anonymous)
  • diff --git a/xwords4/android/XWords4/res/values/app_name.xml b/xwords4/android/XWords4/res/values/app_name.xml index c06726f30..68ba83b9b 100644 --- a/xwords4/android/XWords4/res/values/app_name.xml +++ b/xwords4/android/XWords4/res/values/app_name.xml @@ -1,5 +1,5 @@ - 4.4 beta 86 + 4.4 beta 87