From 9e81fb53b5ec95977e5c0c567a5638ff9c4a8ba7 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 18 Aug 2016 10:08:27 -0700 Subject: [PATCH 01/16] move NotAgainView into scroller for small screens --- .../XWords4/res/layout/not_again_view.xml | 32 ++++++++++++------- .../org/eehouse/android/xw4/NotAgainView.java | 6 ++-- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/xwords4/android/XWords4/res/layout/not_again_view.xml b/xwords4/android/XWords4/res/layout/not_again_view.xml index bf4f49552..d51c3e300 100644 --- a/xwords4/android/XWords4/res/layout/not_again_view.xml +++ b/xwords4/android/XWords4/res/layout/not_again_view.xml @@ -6,18 +6,26 @@ android:layout_height="fill_parent" > - + + - + + + + diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NotAgainView.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NotAgainView.java index 47933b08d..3a241c586 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NotAgainView.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NotAgainView.java @@ -1,6 +1,6 @@ /* -*- compile-command: "find-and-ant.sh debug install"; -*- */ /* - * Copyright 2009 - 2012 by Eric House (xwords@eehouse.org). All + * Copyright 2009 - 2016 by Eric House (xwords@eehouse.org). All * rights reserved. * * This program is free software; you can redistribute it and/or @@ -24,10 +24,10 @@ import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.CheckBox; -import android.widget.LinearLayout; +import android.widget.ScrollView; import android.widget.TextView; -public class NotAgainView extends LinearLayout { +public class NotAgainView extends ScrollView { public NotAgainView( Context cx, AttributeSet as ) { super( cx, as ); From 2a8ce27ca90aebad5cc65a59042f2994665f4a02 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 18 Aug 2016 11:30:32 -0700 Subject: [PATCH 02/16] make custom layout better on old android version tweaks to BoardContainer and Toolbar to better position toolbar and better hide/show it in tile exchange mode. The bar's still partially offscreen sometimes on a 2.3.7 emulator but it's usable. Next I need to try specifying the size of the bar rather than having it derive from the size of the images it contains. --- .../src/org/eehouse/android/xw4/ABUtils.java | 4 +- .../eehouse/android/xw4/BoardContainer.java | 136 ++++++++++++------ .../src/org/eehouse/android/xw4/Toolbar.java | 20 +-- 3 files changed, 105 insertions(+), 55 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ABUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ABUtils.java index 500b25667..98037a7f7 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ABUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ABUtils.java @@ -69,7 +69,9 @@ public class ABUtils { public static boolean haveActionBar() { - return null != s_safeInval; + boolean result = null != s_safeInval; + // DbgUtils.logf( "haveActionBar() => %b", result ); + return result; } // http://stackoverflow.com/questions/10929579/how-to-check-if-android-phone-has-hardware-menu-button-in-android-2-1: diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardContainer.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardContainer.java index 72e2928ad..0a3e7bf06 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardContainer.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardContainer.java @@ -26,12 +26,22 @@ import android.util.AttributeSet; import android.widget.LinearLayout; import android.view.ViewGroup; import android.view.View; +import android.view.View.MeasureSpec; +import android.graphics.Rect; import junit.framework.Assert; public class BoardContainer extends ViewGroup { - private static final int TBAR_PCT_HOR = 90; - private static final int TBAR_PCT_VERT = 85; + // If the ratio of height/width exceeds this, use portrait layout + private static final int PORTRAIT_THRESHHOLD = 105; + + private static final int BOARD_PCT_HOR = 90; + private static final int BOARD_PCT_VERT = 85; + + private static final int BOARD_INDX = 0; + private static final int EXCH_INDX = 1; + private static final int VBAR_INDX = 2; + private static final int HBAR_INDX = 3; private static boolean s_isPortrait = true; // initial assumption private static int s_width = 0; @@ -59,23 +69,29 @@ public class BoardContainer extends ViewGroup { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - final int childCount = getChildCount(); - Assert.assertTrue( 4 == childCount ); - - int width = View.MeasureSpec.getSize( widthMeasureSpec ); - int height = View.MeasureSpec.getSize( heightMeasureSpec ); + int width = MeasureSpec.getSize( widthMeasureSpec ); + int height = MeasureSpec.getSize( heightMeasureSpec ); if ( 0 != width || 0 != height ) { setForPortrait( width, height ); - } - for ( int ii = 0; ii < childCount; ii++ ) { - final View child = getChildAt( ii ); - if ( GONE != child.getVisibility() ) { - // Measure the child. - measureChild( child, widthMeasureSpec, heightMeasureSpec ); + Rect[] rects = figureBounds( 0, 0, width, height ); + + // Measure the board + measureChild( BOARD_INDX, rects[0] ); + + int childCount = getChildCount(); + if ( 1 < childCount ) { + Assert.assertTrue( 4 == childCount ); + + if ( haveTradeBar() ) { + // Measure the exchange buttons bar + measureChild( EXCH_INDX, rects[1] ); + } + + // Measure the toolbar + measureChild( s_isPortrait ? HBAR_INDX : VBAR_INDX, rects[1] ); } } - setMeasuredDimension( width, height ); } @@ -85,37 +101,42 @@ public class BoardContainer extends ViewGroup { protected void onLayout( boolean changed, int left, int top, int right, int bottom) { - boolean haveTradeBar - = GONE != findViewById(R.id.exchange_buttons).getVisibility(); - int boardHt = bottom - top; - if ( haveTradeBar || s_isPortrait ) { - boardHt = boardHt * TBAR_PCT_HOR / 100; - } - int boardWidth = right - left; - if ( !s_isPortrait ) { - boardWidth = boardWidth * TBAR_PCT_VERT / 100; - } + Rect[] rects = figureBounds( left, top, right, bottom ); // layout the board - BoardView board = (BoardView)getChildAt( 0 ); - board.layout( left, top, left + boardWidth, top + boardHt ); + BoardView board = (BoardView)getChildAt( BOARD_INDX ); + layoutChild( board, rects[0] ); - // The trade bar - if ( haveTradeBar ) { - LinearLayout exchButtons = (LinearLayout)getChildAt( 1 ); - Assert.assertTrue( exchButtons.getId() == R.id.exchange_buttons ); - exchButtons.layout( left, top + boardHt, right, bottom ); - } + if ( 1 < getChildCount() ) { - // Now one of the toolbars - View scrollView = getChildAt( s_isPortrait ? 3 : 2 ); - Assert.assertTrue( GONE != scrollView.getVisibility() ); - if ( s_isPortrait ) { - top += boardHt; - } else { - left += boardWidth; + // The trade bar + if ( haveTradeBar() ) { + LinearLayout exchButtons = (LinearLayout)getChildAt( EXCH_INDX ); + Assert.assertTrue( exchButtons.getId() == R.id.exchange_buttons ); + layoutChild( exchButtons, rects[1] ); + } + + // Now one of the toolbars + View scrollView = getChildAt( s_isPortrait ? HBAR_INDX : VBAR_INDX ); + if ( GONE != scrollView.getVisibility() ) { + layoutChild( scrollView, rects[1] ); + } } - scrollView.layout( left, top, right, bottom ); + } + + private void measureChild( int index, Rect rect ) + { + int childWidthSpec = MeasureSpec.makeMeasureSpec(rect.width(), + MeasureSpec.AT_MOST ); + int childHeightSpec = MeasureSpec.makeMeasureSpec(rect.height(), + MeasureSpec.AT_MOST ); + View view = getChildAt( index ); + measureChild( view, childWidthSpec, childHeightSpec ); + } + + private void layoutChild( View child, Rect rect ) + { + child.layout( rect.left, rect.top, rect.right, rect.bottom ); } private void setForPortrait( final int width, final int height ) @@ -123,7 +144,7 @@ public class BoardContainer extends ViewGroup { if ( height != s_height || width != s_width ) { s_height = height; s_width = width; - s_isPortrait = height > width; + s_isPortrait = PORTRAIT_THRESHHOLD < (height*100) / width; findViewById( R.id.tbar_parent_hor ) .setVisibility( s_isPortrait ? VISIBLE : GONE ); findViewById( R.id.tbar_parent_vert ) @@ -133,6 +154,39 @@ public class BoardContainer extends ViewGroup { } } + private Rect[] figureBounds( int left, int top, int width, int height ) + { + int boardHeight = ( haveTradeBar() || s_isPortrait) + ? height * BOARD_PCT_HOR / 100 : height; + int boardWidth = s_isPortrait ? width : width * BOARD_PCT_VERT / 100; + + // board + Rect boardBounds = new Rect( left, top, left + boardWidth, + top + boardHeight ); + // DbgUtils.logf( "BoardContainer: boardBounds: %s", boardBounds.toString() ); + // toolbar + if ( s_isPortrait ) { + top += boardHeight; + height -= boardHeight; + } else { + left += boardWidth; + width -= boardWidth; + } + Rect toolsBounds = new Rect( left, top, left + width, top + height ); + // DbgUtils.logf( "BoardContainer: toolsBounds: %s", toolsBounds.toString() ); + return new Rect[] { boardBounds, toolsBounds }; + } + + private boolean haveTradeBar() + { + boolean result = false; + if ( s_isPortrait && 1 < getChildCount() ) { + View bar = getChildAt( 1 ); + result = null != bar && GONE != bar.getVisibility(); + } + return result; + } + private static void callSCL() { if ( 0 != s_width || 0 != s_height ) { 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 496007e4a..3d3c79351 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java @@ -81,7 +81,7 @@ public class Toolbar implements BoardContainer.SizeChangeListener { { if ( m_visible != visible ) { m_visible = visible; - doShowHide( null ); + doShowHide(); } } @@ -134,10 +134,9 @@ public class Toolbar implements BoardContainer.SizeChangeListener { // SizeChangeListener public void sizeChanged( int width, int height, boolean isPortrait ) { - DbgUtils.logf( "Toolbar.sizeChanged(isPortrait=%b)", isPortrait ); tryAddListeners( m_onClickListeners ); tryAddListeners( m_onLongClickListeners ); - doShowHide( new Boolean(isPortrait) ); + doShowHide(); } private void tryAddListeners( Map map ) @@ -168,14 +167,10 @@ public class Toolbar implements BoardContainer.SizeChangeListener { return success; } - private void doShowHide( Boolean shouldBePortrait ) + private void doShowHide() { - // BoardContainer owns which scroller we'll use, and signals its - // choice by setting their visibility. We use the one that's visible. - boolean isPortrait = View.GONE != m_scrollHor.getVisibility(); - DbgUtils.logf( "Toolbar.doShowHide(): isPortrait: %b", isPortrait ); - Assert.assertTrue( null == shouldBePortrait - || shouldBePortrait.equals(isPortrait) ); + boolean isPortrait = BoardContainer.getIsPortrait(); + DbgUtils.logdf( "Toolbar.doShowHide(): isPortrait: %b", isPortrait ); if ( null == m_layout ) { m_layout = (LinearLayout)LocUtils.inflate( m_activity, R.layout.toolbar ); @@ -186,13 +181,12 @@ public class Toolbar implements BoardContainer.SizeChangeListener { LinearLayout.HORIZONTAL : LinearLayout.VERTICAL ); ViewGroup scroller = isPortrait ? m_scrollHor : m_scrollVert; - Assert.assertNotNull( scroller ); if ( null != scroller ) { // Google's had reports of a crash adding second view scroller.removeAllViews(); scroller.addView( m_layout ); - } - m_layout.setVisibility( m_visible? View.VISIBLE : View.GONE ); + scroller.setVisibility( m_visible? View.VISIBLE : View.GONE ); + } } } From c4d7626ae1fbb1d62db0db271abc999427be7981 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 18 Aug 2016 12:00:18 -0700 Subject: [PATCH 03/16] tweak toolbar layout to fit better --- xwords4/android/XWords4/res/values-large/styles.xml | 9 --------- xwords4/android/XWords4/res/values/styles.xml | 5 +++-- .../src/org/eehouse/android/xw4/BoardContainer.java | 8 ++++---- 3 files changed, 7 insertions(+), 15 deletions(-) delete mode 100644 xwords4/android/XWords4/res/values-large/styles.xml diff --git a/xwords4/android/XWords4/res/values-large/styles.xml b/xwords4/android/XWords4/res/values-large/styles.xml deleted file mode 100644 index a29b34e33..000000000 --- a/xwords4/android/XWords4/res/values-large/styles.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/xwords4/android/XWords4/res/values/styles.xml b/xwords4/android/XWords4/res/values/styles.xml index e97d95284..d99e7e7b7 100644 --- a/xwords4/android/XWords4/res/values/styles.xml +++ b/xwords4/android/XWords4/res/values/styles.xml @@ -38,9 +38,10 @@ + diff --git a/xwords4/android/XWords4/res/values-xlarge/styles.xml b/xwords4/android/XWords4/res/values-xlarge/styles.xml new file mode 100644 index 000000000..77167324f --- /dev/null +++ b/xwords4/android/XWords4/res/values-xlarge/styles.xml @@ -0,0 +1,8 @@ + + + + From 41e8df6f191a51a206eecb8786962593ed1dd772 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 19 Aug 2016 10:05:31 -0700 Subject: [PATCH 08/16] give any extra space to the board Measure toolbar before board, and if it's narrower/shorter than we allowed more that extra space into the rect given the board. --- .../eehouse/android/xw4/BoardContainer.java | 74 ++++++++++++------- 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardContainer.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardContainer.java index e7f4a39c2..01aaabb19 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardContainer.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardContainer.java @@ -47,6 +47,9 @@ public class BoardContainer extends ViewGroup { private static int s_width = 0; private static int s_height = 0; + private Rect m_boardBounds; + private Rect m_toolsBounds; + interface SizeChangeListener { void sizeChanged( int width, int height, boolean isPortrait ); } @@ -74,23 +77,30 @@ public class BoardContainer extends ViewGroup { if ( 0 != width || 0 != height ) { setForPortrait( width, height ); - Rect[] rects = figureBounds( 0, 0, width, height ); - - // Measure the board - measureChild( BOARD_INDX, rects[0] ); + figureBounds( 0, 0, width, height ); + // Measure any toolbar first so we can take extra space for the + // board int childCount = getChildCount(); if ( 1 < childCount ) { Assert.assertTrue( 4 == childCount ); + // Measure the toolbar + measureChild( s_isPortrait ? HBAR_INDX : VBAR_INDX, m_toolsBounds ); + adjustBounds(); + View child = getChildAt( s_isPortrait ? HBAR_INDX : VBAR_INDX ); + DbgUtils.logf( "measured %s; passed ht: %d; got back ht: %d", + child.toString(), m_toolsBounds.height(), + child.getMeasuredHeight() ); + if ( haveTradeBar() ) { // Measure the exchange buttons bar - measureChild( EXCH_INDX, rects[1] ); + measureChild( EXCH_INDX, m_toolsBounds ); } - - // Measure the toolbar - measureChild( s_isPortrait ? HBAR_INDX : VBAR_INDX, rects[1] ); } + + // Measure the board + measureChild( BOARD_INDX, m_boardBounds ); } setMeasuredDimension( width, height ); } @@ -101,26 +111,20 @@ public class BoardContainer extends ViewGroup { protected void onLayout( boolean changed, int left, int top, int right, int bottom) { - Rect[] rects = figureBounds( left, top, right, bottom ); + // If this isn't true, need to refigure the rects + // Assert.assertTrue( 0 == left && 0 == top ); // layout the board - BoardView board = (BoardView)getChildAt( BOARD_INDX ); - layoutChild( board, rects[0] ); + layoutChild( BOARD_INDX, m_boardBounds ); if ( 1 < getChildCount() ) { - // The trade bar if ( haveTradeBar() ) { - LinearLayout exchButtons = (LinearLayout)getChildAt( EXCH_INDX ); - Assert.assertTrue( exchButtons.getId() == R.id.exchange_buttons ); - layoutChild( exchButtons, rects[1] ); + layoutChild( EXCH_INDX, m_toolsBounds ); } // Now one of the toolbars - View scrollView = getChildAt( s_isPortrait ? HBAR_INDX : VBAR_INDX ); - if ( GONE != scrollView.getVisibility() ) { - layoutChild( scrollView, rects[1] ); - } + layoutChild( s_isPortrait ? HBAR_INDX : VBAR_INDX, m_toolsBounds ); } } @@ -134,9 +138,12 @@ public class BoardContainer extends ViewGroup { measureChild( view, childWidthSpec, childHeightSpec ); } - private void layoutChild( View child, Rect rect ) + private void layoutChild( int index, Rect rect ) { - child.layout( rect.left, rect.top, rect.right, rect.bottom ); + View child = getChildAt( index ); + if ( GONE != child.getVisibility() ) { + child.layout( rect.left, rect.top, rect.right, rect.bottom ); + } } private void setForPortrait( final int width, final int height ) @@ -154,14 +161,14 @@ public class BoardContainer extends ViewGroup { } } - private Rect[] figureBounds( int left, int top, int width, int height ) + private void figureBounds( int left, int top, int width, int height ) { int boardHeight = ( haveTradeBar() || s_isPortrait) ? height * (BOARD_PCT_VERT) / 100 : height; int boardWidth = s_isPortrait ? width : (width * BOARD_PCT_HOR) / 100; // board - Rect boardBounds = new Rect( left, top, left + boardWidth, + m_boardBounds = new Rect( left, top, left + boardWidth, top + boardHeight ); // DbgUtils.logf( "BoardContainer: boardBounds: %s", boardBounds.toString() ); // toolbar @@ -172,9 +179,24 @@ public class BoardContainer extends ViewGroup { left += boardWidth; width -= boardWidth; } - Rect toolsBounds = new Rect( left, top, left + width, top + height ); - // DbgUtils.logf( "BoardContainer: toolsBounds: %s", toolsBounds.toString() ); - return new Rect[] { boardBounds, toolsBounds }; + m_toolsBounds = new Rect( left, top, left + width, top + height ); + } + + private void adjustBounds() + { + if ( s_isPortrait ) { + int curHeight = m_toolsBounds.height(); + int newHeight = getChildAt( HBAR_INDX ).getMeasuredHeight(); + int diff = curHeight - newHeight; + m_boardBounds.bottom += diff; + m_toolsBounds.top += diff; + } else { + int curWidth = m_toolsBounds.width(); + int newWidth = getChildAt( VBAR_INDX ).getMeasuredWidth(); + int diff = curWidth - newWidth; + m_boardBounds.right += diff; + m_toolsBounds.left += diff; + } } private boolean haveTradeBar() From 0bd96671633623da5ce8af2829f5439fc517b6ea Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 19 Aug 2016 10:29:12 -0700 Subject: [PATCH 09/16] cleanup: remove unnecessary attributes --- xwords4/android/XWords4/res/layout/board.xml | 4 ++-- xwords4/android/XWords4/res/layout/toolbar.xml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/res/layout/board.xml b/xwords4/android/XWords4/res/layout/board.xml index 8cdd4237c..2c0884293 100644 --- a/xwords4/android/XWords4/res/layout/board.xml +++ b/xwords4/android/XWords4/res/layout/board.xml @@ -11,6 +11,7 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" > + - + From ba968b1e3686c062b7db471179cd152f7d3245ba Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 19 Aug 2016 10:57:48 -0700 Subject: [PATCH 10/16] fix so extra game info shows in dual-pane mode too onWindowFocusChanged() isn't called when a pane opens, and setting up that field depended on it. So call from init() too. --- .../XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java | 1 + 1 file changed, 1 insertion(+) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java index f0d61266a..9e73a6c5f 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java @@ -989,6 +989,7 @@ public class GamesListDelegate extends ListDelegateBase } } ); + updateField(); } // init @Override From 6cc67b23472aa65419c770a353bc815f0c4f437a Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 19 Aug 2016 11:37:24 -0700 Subject: [PATCH 11/16] always show toast announcing dual-pane mode on startup, even for non-debug builds. And move the string into a resource for localization. --- xwords4/android/XWords4/archive/R.java | 1 + xwords4/android/XWords4/res/values/strings.xml | 1 + xwords4/android/XWords4/res_src/values-ba_CK/strings.xml | 1 + xwords4/android/XWords4/res_src/values-ca_PS/strings.xml | 1 + .../XWords4/src/org/eehouse/android/xw4/MainActivity.java | 4 ++-- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xwords4/android/XWords4/archive/R.java b/xwords4/android/XWords4/archive/R.java index 6d8945458..846e4929a 100644 --- a/xwords4/android/XWords4/archive/R.java +++ b/xwords4/android/XWords4/archive/R.java @@ -2010,6 +2010,7 @@ XLATE-ME /** SMS Data is only available on GSM phones. */ public static final int data_gsm_only=0x7f05029b; + public static final int db_enabled_toast=0x7f050351; /** SD card write complete. */ public static final int db_store_done=0x7f05032d; diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 469305240..cf002f46b 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -2694,4 +2694,5 @@ Exiting app… This change will not take effect until you restart Crosswords. + Side-by-side mode ENABLED 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 78b07ad58..e5b0ee733 100644 --- a/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml +++ b/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml @@ -2302,4 +2302,5 @@ Gnitixe ppa… Siht egnahc lliw ton ekat tceffe litnu uoy tratser Sdrowssorc. + Edis-yb-edis edom DELBANE 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 5f5413943..55ee6dae0 100644 --- a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml +++ b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml @@ -2302,4 +2302,5 @@ EXITING APP… THIS CHANGE WILL NOT TAKE EFFECT UNTIL YOU RESTART CROSSWORDS. + SIDE-BY-SIDE MODE ENABLED diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java index 3c1c55c37..270b10891 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java @@ -62,8 +62,8 @@ public class MainActivity extends XWActivity protected void onCreate( Bundle savedInstanceState ) { m_dpEnabled = XWPrefs.dualpaneEnabled( this ); - if ( BuildConfig.DEBUG && m_dpEnabled ) { - Utils.showToast( this, "Side-by-side mode ENABLED" ); + if ( m_dpEnabled ) { + Utils.showToast( this, R.string.db_enabled_toast ); } m_dlgt = m_dpEnabled ? new DualpaneDelegate( this, savedInstanceState ) From 16b9bab719927945d7cd66d5510f889b214652fd Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 19 Aug 2016 11:58:10 -0700 Subject: [PATCH 12/16] up version strings and changes list --- xwords4/android/XWords4/AndroidManifest.xml | 2 +- xwords4/android/XWords4/assets/changes.html | 28 +++++++++---------- .../android/XWords4/res/values/app_name.xml | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/xwords4/android/XWords4/AndroidManifest.xml b/xwords4/android/XWords4/AndroidManifest.xml index c2955d7fc..ce3f269b3 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/assets/changes.html b/xwords4/android/XWords4/assets/changes.html index 452f4e4c0..949eada0b 100644 --- a/xwords4/android/XWords4/assets/changes.html +++ b/xwords4/android/XWords4/assets/changes.html @@ -13,10 +13,10 @@ -

Crosswords 4.4.108 release

+

Crosswords 4.4.109 release

-

This release fixes a nasty bug in invitations on older Android - and improves in-game chat functionality.

+

This release adds experimental support for side-by-side views on + tablets.

Please take @@ -26,18 +26,19 @@

New with this release

    -
  • Fix problem with invitations on older Android versions - (e.g. 4.2 and 4.3)
  • +
  • Add side-by-side mode for tablets. For now, it's an option + you'll be encouraged to enable. Later it'll always be on.
  • -
  • Chat fixes: send without closing the window, expand for - longer messages, smart editing, etc.
  • +
  • For small screens, make alerts' content scrollable
  • -
  • Fix so Bluetooth finds tablets as well as phones
  • +
  • Modern phones have multi-touch screens, so remove old ways + of zooming board
  • -
  • Add ability to disable relay play (to save battery for users - who play standalone only)
  • +
  • Improve generation of board snapshots
  • -
  • Improvements to French and Japanese translations
  • +
  • Move "Play sound" preference
  • + +
  • Fix problem with invitations and unclosable games

(The full changelog @@ -45,10 +46,9 @@

Next up

    -
  • Working on dual-pane mode (so e.g. board and chat can be - side-by-side on tablets)
  • Take advantage of Marshmallow's new permissions model (where - the app only asks for them when it needs them.) + the app only asks for permission, e.g. to send SMS, when it + needs it.)

Please let me know diff --git a/xwords4/android/XWords4/res/values/app_name.xml b/xwords4/android/XWords4/res/values/app_name.xml index 6197ce619..d3cc3eef6 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.108 + 4.4.109 From 495c82baa02da88ccae729d4c0bce69ad76e08a7 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 19 Aug 2016 12:28:54 -0700 Subject: [PATCH 13/16] look for and remove '-' in locale Some versions apparently return "en-us" as the language code when "en" is expected. Check for and remove anything after a '-'. --- .../XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java index df80ad82e..f5b203587 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java @@ -568,6 +568,11 @@ public class LocUtils { } if ( null == lang ) { lang = Locale.getDefault().getLanguage(); + // sometimes I get "en-us" in this case, i.e. the locale's + // there too. Strip it. + if ( lang.contains( "-" ) ) { + lang = TextUtils.split(lang, "-")[0]; + } } s_curLang = lang; } From 2285502f3349fe11570a43cd815e4813943ee6db Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 19 Aug 2016 12:48:15 -0700 Subject: [PATCH 14/16] offer to enable dual-pane mode only on upgrade And do it starting with launches after the changes list has been shown. Also change "Cancel" on negative button to "Later". --- .../eehouse/android/xw4/GamesListDelegate.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java index 9e73a6c5f..b3ba58338 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java @@ -954,19 +954,14 @@ public class GamesListDelegate extends ListDelegateBase FirstRunDialog.show( m_activity ); } s_firstShown = true; - } - - } - - // Combine with above when "true" removed - if ( true || isUpgrade ) { - if ( !XWPrefs.getPrefsBoolean( m_activity, - R.string.key_enable_dualpane, false ) - && XWPrefs.getIsTablet( m_activity ) ) { - + } else if ( !XWPrefs.getPrefsBoolean( m_activity, + R.string.key_enable_dualpane, + false ) + && XWPrefs.getIsTablet( m_activity ) ) { makeConfirmThenBuilder(R.string.invite_dualpane, Action.ENABLE_DUALPANE) .setNAKey(R.string.key_notagain_dualpane) .setPosButton(R.string.enable_dualpane) + .setNegButton(R.string.button_later) .show(); } } From e1dbd8efc7951c784fda3e47f97d3cf7f0c56366 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 19 Aug 2016 12:49:30 -0700 Subject: [PATCH 15/16] cleanup and add a bit of logging I suspect curThis() is no longer needed so will log it for a while. --- .../XWords4/src/org/eehouse/android/xw4/DelegateBase.java | 4 +++- .../XWords4/src/org/eehouse/android/xw4/FirstRunDialog.java | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java index 9c4739d7f..4c26bcf97 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java @@ -160,7 +160,9 @@ public class DelegateBase implements DlgClickNotify, if ( null != ref ) { result = ref.get(); } - // DbgUtils.logdf( "%s.curThis() => " + result, this.toString() ); + if ( this != result ) { + DbgUtils.logdf( "%s.curThis() => " + result, this.toString() ); + } return result; } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/FirstRunDialog.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/FirstRunDialog.java index fe26f0d72..cc1b7a181 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/FirstRunDialog.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/FirstRunDialog.java @@ -65,12 +65,12 @@ public class FirstRunDialog { view.getSettings().setJavaScriptEnabled( true ); // for surveymonkey view.loadUrl("file:///android_asset/changes.html"); - AlertDialog dialog = LocUtils.makeAlertBuilder( context ) + LocUtils.makeAlertBuilder( context ) .setIcon(android.R.drawable.ic_menu_info_details) .setTitle( R.string.changes_title ) .setView( view ) .setPositiveButton( android.R.string.ok, null) - .create(); - dialog.show(); + .create() + .show(); } } From 06b60917807e76298693191234721f8d42633538 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 19 Aug 2016 12:56:07 -0700 Subject: [PATCH 16/16] upgrade -Dbg version code too --- xwords4/android/XWords4-dbg/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwords4/android/XWords4-dbg/AndroidManifest.xml b/xwords4/android/XWords4-dbg/AndroidManifest.xml index 9bc1b2afc..1a5254ce0 100644 --- a/xwords4/android/XWords4-dbg/AndroidManifest.xml +++ b/xwords4/android/XWords4-dbg/AndroidManifest.xml @@ -6,7 +6,7 @@ to come from a domain that you own or have control over. -->