Merge branch 'android_branch' into android_translate

This commit is contained in:
Eric House 2016-08-19 13:12:57 -07:00
commit 54feb61bf4
31 changed files with 254 additions and 122 deletions

View file

@ -6,7 +6,7 @@
to come from a domain that you own or have control over. --> to come from a domain that you own or have control over. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.eehouse.android.xw4dbg" package="org.eehouse.android.xw4dbg"
android:versionCode="100" android:versionCode="104"
android:versionName="@string/app_version" android:versionName="@string/app_version"
> >

View file

@ -22,7 +22,7 @@
to come from a domain that you own or have control over. --> to come from a domain that you own or have control over. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.eehouse.android.xw4" package="org.eehouse.android.xw4"
android:versionCode="103" android:versionCode="104"
android:versionName="@string/app_version" android:versionName="@string/app_version"
> >

View file

@ -127,7 +127,7 @@ public final class R {
public static final int button_rescan=0x7f0c000a; public static final int button_rescan=0x7f0c000a;
public static final int button_study=0x7f0c0065; public static final int button_study=0x7f0c0065;
public static final int change_connection=0x7f0c003f; public static final int change_connection=0x7f0c003f;
public static final int chat_button=0x7f0c0084; public static final int chat_button=0x7f0c0081;
public static final int chat_edit=0x7f0c0011; public static final int chat_edit=0x7f0c0011;
public static final int chat_history=0x7f0c0010; public static final int chat_history=0x7f0c0010;
public static final int chat_menu_clear=0x7f0c00a5; public static final int chat_menu_clear=0x7f0c00a5;
@ -148,7 +148,7 @@ public final class R {
public static final int details=0x7f0c0076; public static final int details=0x7f0c0076;
public static final int dict_label=0x7f0c006d; public static final int dict_label=0x7f0c006d;
public static final int dict_spinner=0x7f0c0031; public static final int dict_spinner=0x7f0c0031;
public static final int dictlist_button=0x7f0c0083; public static final int dictlist_button=0x7f0c0084;
public static final int dicts_delete=0x7f0c00a8; public static final int dicts_delete=0x7f0c00a8;
public static final int dicts_deselect_all=0x7f0c00a7; public static final int dicts_deselect_all=0x7f0c00a7;
public static final int dicts_download=0x7f0c00a6; public static final int dicts_download=0x7f0c00a6;
@ -268,7 +268,7 @@ public final class R {
public static final int seek_green=0x7f0c0019; public static final int seek_green=0x7f0c0019;
public static final int seek_red=0x7f0c0017; public static final int seek_red=0x7f0c0017;
public static final int show_remote=0x7f0c0021; public static final int show_remote=0x7f0c0021;
public static final int shuffle_button=0x7f0c0081; public static final int shuffle_button=0x7f0c0082;
public static final int slmenu_clear_sel=0x7f0c00d1; public static final int slmenu_clear_sel=0x7f0c00d1;
public static final int slmenu_copy_sel=0x7f0c00d0; public static final int slmenu_copy_sel=0x7f0c00d0;
public static final int slmenu_deselect_all=0x7f0c00cf; public static final int slmenu_deselect_all=0x7f0c00cf;
@ -285,7 +285,7 @@ public final class R {
public static final int timer_minutes_edit=0x7f0c0043; public static final int timer_minutes_edit=0x7f0c0043;
public static final int timer_set=0x7f0c0042; public static final int timer_set=0x7f0c0042;
public static final int toolbar=0x7f0c007e; public static final int toolbar=0x7f0c007e;
public static final int undo_button=0x7f0c0082; public static final int undo_button=0x7f0c0083;
public static final int use_timer=0x7f0c0041; public static final int use_timer=0x7f0c0041;
public static final int values_button=0x7f0c0085; public static final int values_button=0x7f0c0085;
public static final int version_string=0x7f0c0000; public static final int version_string=0x7f0c0000;
@ -2010,6 +2010,7 @@ XLATE-ME
/** <string name="data_gsm_only">SMS Data is only available on GSM phones.</string> /** <string name="data_gsm_only">SMS Data is only available on GSM phones.</string>
*/ */
public static final int data_gsm_only=0x7f05029b; public static final int data_gsm_only=0x7f05029b;
public static final int db_enabled_toast=0x7f050351;
/** <string name="db_store_done">SD card write complete.</string> /** <string name="db_store_done">SD card write complete.</string>
*/ */
public static final int db_store_done=0x7f05032d; public static final int db_store_done=0x7f05032d;

View file

@ -13,10 +13,10 @@
</style> </style>
</head> </head>
<body> <body>
<h2>Crosswords 4.4.108 release</h2> <h2>Crosswords 4.4.109 release</h2>
<p>This release fixes a nasty bug in invitations on older Android <p>This release adds experimental support for side-by-side views on
and improves in-game chat functionality.</p> tablets.</p>
<div id="survey"> <div id="survey">
<p>Please <a href="https://www.surveymonkey.com/s/GX3XLHR">take <p>Please <a href="https://www.surveymonkey.com/s/GX3XLHR">take
@ -26,18 +26,19 @@
<h3>New with this release</h3> <h3>New with this release</h3>
<ul> <ul>
<li>Fix problem with invitations on older Android versions <li>Add side-by-side mode for tablets. For now, it's an option
(e.g. 4.2 and 4.3)</li> you'll be encouraged to enable. Later it'll always be on.</li>
<li>Chat fixes: send without closing the window, expand for <li>For small screens, make alerts' content scrollable</li>
longer messages, smart editing, etc.</li>
<li>Fix so Bluetooth finds tablets as well as phones</li> <li>Modern phones have multi-touch screens, so remove old ways
of zooming board</li>
<li>Add ability to disable relay play (to save battery for users <li>Improve generation of board snapshots</li>
who play standalone only)</li>
<li>Improvements to French and Japanese translations</li> <li>Move "Play sound" preference</li>
<li>Fix problem with invitations and unclosable games</li>
</ul> </ul>
<p>(The full changelog <p>(The full changelog
@ -45,10 +46,9 @@
<h3>Next up</h3> <h3>Next up</h3>
<ul> <ul>
<li>Working on dual-pane mode (so e.g. board and chat can be
side-by-side on tablets)</li>
<li>Take advantage of Marshmallow's new permissions model (where <li>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.)
</ul> </ul>
<p>Please let me know <p>Please let me know

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -11,6 +11,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
> >
<org.eehouse.android.xw4.BoardView <org.eehouse.android.xw4.BoardView
android:id="@+id/board_view" android:id="@+id/board_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -40,7 +41,7 @@
/> />
</LinearLayout> </LinearLayout>
<!-- toolbar goes inside one of these --> <!-- Toolbar goes inside one of these. One will always be GONE. -->
<ScrollView android:id="@+id/tbar_parent_vert" <ScrollView android:id="@+id/tbar_parent_vert"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -48,7 +49,6 @@
android:visibility="gone" android:visibility="gone"
/> />
<HorizontalScrollView android:id="@+id/tbar_parent_hor" <HorizontalScrollView android:id="@+id/tbar_parent_hor"
android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"

View file

@ -6,18 +6,26 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
> >
<TextView android:id="@+id/msg" <!-- Container derives from ScrollView, so this LinearLayout must be
android:layout_width="match_parent" the only child. -->
android:layout_height="wrap_content" <LinearLayout android:orientation="vertical"
android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="fill_parent"
android:padding="8dp" android:layout_height="wrap_content"
/> >
<CheckBox android:id="@+id/not_again_check" <TextView android:id="@+id/msg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/button_notagain" android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginLeft="20dip" android:padding="8dp"
/> />
<CheckBox android:id="@+id/not_again_check"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/button_notagain"
android:layout_marginLeft="20dip"
/>
</LinearLayout>
</org.eehouse.android.xw4.NotAgainView> </org.eehouse.android.xw4.NotAgainView>

View file

@ -2,7 +2,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:orientation="vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
> >
@ -14,6 +13,10 @@
style="@style/toolbar_button" style="@style/toolbar_button"
android:src="@drawable/next_hint" android:src="@drawable/next_hint"
/> />
<ImageButton android:id="@+id/chat_button"
style="@style/toolbar_button"
android:src="@drawable/stat_notify_chat"
/>
<ImageButton android:id="@+id/shuffle_button" <ImageButton android:id="@+id/shuffle_button"
style="@style/toolbar_button" style="@style/toolbar_button"
android:src="@drawable/shuffle" android:src="@drawable/shuffle"
@ -26,10 +29,6 @@
style="@style/toolbar_button" style="@style/toolbar_button"
android:src="@drawable/dicticon" android:src="@drawable/dicticon"
/> />
<ImageButton android:id="@+id/chat_button"
style="@style/toolbar_button"
android:src="@drawable/stat_notify_chat"
/>
<ImageButton android:id="@+id/values_button" <ImageButton android:id="@+id/values_button"
style="@style/toolbar_button" style="@style/toolbar_button"
android:src="@drawable/values" android:src="@drawable/values"

View file

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="toolbar_button"> <style name="toolbar_button">
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">64dp</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">64dp</item>
<item name="android:layout_weight">1</item> <item name="android:layout_weight">1</item>
</style> </style>
</resources> </resources>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="toolbar_button">
<item name="android:layout_width">72dp</item>
<item name="android:layout_height">72dp</item>
<item name="android:layout_weight">1</item>
</style>
</resources>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_version">4.4.108</string> <string name="app_version">4.4.109</string>
</resources> </resources>

View file

@ -2694,4 +2694,5 @@
<string name="dualpane_restart">Exiting app…</string> <string name="dualpane_restart">Exiting app…</string>
<string name="after_restart">This change will not take effect until <string name="after_restart">This change will not take effect until
you restart Crosswords.</string> you restart Crosswords.</string>
<string name="db_enabled_toast">Side-by-side mode ENABLED</string>
</resources> </resources>

View file

@ -38,9 +38,10 @@
</style> </style>
<style name="toolbar_button"> <style name="toolbar_button">
<item name="android:layout_width">@dimen/tb_button_width</item> <item name="android:layout_width">match_parent</item>
<item name="android:layout_height">@dimen/tb_button_height</item> <item name="android:layout_height">match_parent</item>
<item name="android:layout_weight">1</item> <item name="android:layout_weight">1</item>
<item name="android:scaleType">fitCenter</item>
</style> </style>
<style name="about_items"> <style name="about_items">

View file

@ -2302,4 +2302,5 @@
<string name="dualpane_restart">Gnitixe ppa…</string> <string name="dualpane_restart">Gnitixe ppa…</string>
<string name="after_restart">Siht egnahc lliw ton ekat tceffe litnu <string name="after_restart">Siht egnahc lliw ton ekat tceffe litnu
uoy tratser Sdrowssorc.</string> uoy tratser Sdrowssorc.</string>
<string name="db_enabled_toast">Edis-yb-edis edom DELBANE</string>
</resources> </resources>

View file

@ -2302,4 +2302,5 @@
<string name="dualpane_restart">EXITING APP…</string> <string name="dualpane_restart">EXITING APP…</string>
<string name="after_restart">THIS CHANGE WILL NOT TAKE EFFECT UNTIL <string name="after_restart">THIS CHANGE WILL NOT TAKE EFFECT UNTIL
YOU RESTART CROSSWORDS.</string> YOU RESTART CROSSWORDS.</string>
<string name="db_enabled_toast">SIDE-BY-SIDE MODE ENABLED</string>
</resources> </resources>

View file

@ -69,7 +69,9 @@ public class ABUtils {
public static boolean haveActionBar() 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: // http://stackoverflow.com/questions/10929579/how-to-check-if-android-phone-has-hardware-menu-button-in-android-2-1:

View file

@ -26,17 +26,30 @@ import android.util.AttributeSet;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.View; import android.view.View;
import android.view.View.MeasureSpec;
import android.graphics.Rect;
import junit.framework.Assert; import junit.framework.Assert;
public class BoardContainer extends ViewGroup { public class BoardContainer extends ViewGroup {
private static final int TBAR_PCT_HOR = 90; // If the ratio of height/width exceeds this, use portrait layout
private static final int TBAR_PCT_VERT = 85; private static final int PORTRAIT_THRESHHOLD = 105;
private static final int BOARD_PCT_VERT = 90;
private static final int BOARD_PCT_HOR = 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 boolean s_isPortrait = true; // initial assumption
private static int s_width = 0; private static int s_width = 0;
private static int s_height = 0; private static int s_height = 0;
private Rect m_boardBounds;
private Rect m_toolsBounds;
interface SizeChangeListener { interface SizeChangeListener {
void sizeChanged( int width, int height, boolean isPortrait ); void sizeChanged( int width, int height, boolean isPortrait );
} }
@ -59,23 +72,36 @@ public class BoardContainer extends ViewGroup {
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{ {
final int childCount = getChildCount(); int width = MeasureSpec.getSize( widthMeasureSpec );
Assert.assertTrue( 4 == childCount ); int height = MeasureSpec.getSize( heightMeasureSpec );
int width = View.MeasureSpec.getSize( widthMeasureSpec );
int height = View.MeasureSpec.getSize( heightMeasureSpec );
if ( 0 != width || 0 != height ) { if ( 0 != width || 0 != height ) {
setForPortrait( width, height ); setForPortrait( width, height );
}
for ( int ii = 0; ii < childCount; ii++ ) { figureBounds( 0, 0, width, height );
final View child = getChildAt( ii );
if ( GONE != child.getVisibility() ) { // Measure any toolbar first so we can take extra space for the
// Measure the child. // board
measureChild( child, widthMeasureSpec, heightMeasureSpec ); 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, m_toolsBounds );
}
} }
}
// Measure the board
measureChild( BOARD_INDX, m_boardBounds );
}
setMeasuredDimension( width, height ); setMeasuredDimension( width, height );
} }
@ -85,37 +111,39 @@ public class BoardContainer extends ViewGroup {
protected void onLayout( boolean changed, int left, int top, protected void onLayout( boolean changed, int left, int top,
int right, int bottom) int right, int bottom)
{ {
boolean haveTradeBar // If this isn't true, need to refigure the rects
= GONE != findViewById(R.id.exchange_buttons).getVisibility(); // Assert.assertTrue( 0 == left && 0 == top );
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;
}
// layout the board // layout the board
BoardView board = (BoardView)getChildAt( 0 ); layoutChild( BOARD_INDX, m_boardBounds );
board.layout( left, top, left + boardWidth, top + boardHt );
// The trade bar if ( 1 < getChildCount() ) {
if ( haveTradeBar ) { // The trade bar
LinearLayout exchButtons = (LinearLayout)getChildAt( 1 ); if ( haveTradeBar() ) {
Assert.assertTrue( exchButtons.getId() == R.id.exchange_buttons ); layoutChild( EXCH_INDX, m_toolsBounds );
exchButtons.layout( left, top + boardHt, right, bottom ); }
}
// Now one of the toolbars // Now one of the toolbars
View scrollView = getChildAt( s_isPortrait ? 3 : 2 ); layoutChild( s_isPortrait ? HBAR_INDX : VBAR_INDX, m_toolsBounds );
Assert.assertTrue( GONE != scrollView.getVisibility() ); }
if ( s_isPortrait ) { }
top += boardHt;
} else { private void measureChild( int index, Rect rect )
left += boardWidth; {
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( int index, Rect rect )
{
View child = getChildAt( index );
if ( GONE != child.getVisibility() ) {
child.layout( rect.left, rect.top, rect.right, rect.bottom );
} }
scrollView.layout( left, top, right, bottom );
} }
private void setForPortrait( final int width, final int height ) private void setForPortrait( final int width, final int height )
@ -123,7 +151,7 @@ public class BoardContainer extends ViewGroup {
if ( height != s_height || width != s_width ) { if ( height != s_height || width != s_width ) {
s_height = height; s_height = height;
s_width = width; s_width = width;
s_isPortrait = height > width; s_isPortrait = PORTRAIT_THRESHHOLD < (height*100) / width;
findViewById( R.id.tbar_parent_hor ) findViewById( R.id.tbar_parent_hor )
.setVisibility( s_isPortrait ? VISIBLE : GONE ); .setVisibility( s_isPortrait ? VISIBLE : GONE );
findViewById( R.id.tbar_parent_vert ) findViewById( R.id.tbar_parent_vert )
@ -133,6 +161,54 @@ public class BoardContainer extends ViewGroup {
} }
} }
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
m_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;
}
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()
{
boolean result = false;
if ( s_isPortrait && 1 < getChildCount() ) {
View bar = getChildAt( 1 );
result = null != bar && GONE != bar.getVisibility();
}
return result;
}
private static void callSCL() private static void callSCL()
{ {
if ( 0 != s_width || 0 != s_height ) { if ( 0 != s_width || 0 != s_height ) {

View file

@ -160,7 +160,9 @@ public class DelegateBase implements DlgClickNotify,
if ( null != ref ) { if ( null != ref ) {
result = ref.get(); result = ref.get();
} }
// DbgUtils.logdf( "%s.curThis() => " + result, this.toString() ); if ( this != result ) {
DbgUtils.logdf( "%s.curThis() => " + result, this.toString() );
}
return result; return result;
} }

View file

@ -65,12 +65,12 @@ public class FirstRunDialog {
view.getSettings().setJavaScriptEnabled( true ); // for surveymonkey view.getSettings().setJavaScriptEnabled( true ); // for surveymonkey
view.loadUrl("file:///android_asset/changes.html"); view.loadUrl("file:///android_asset/changes.html");
AlertDialog dialog = LocUtils.makeAlertBuilder( context ) LocUtils.makeAlertBuilder( context )
.setIcon(android.R.drawable.ic_menu_info_details) .setIcon(android.R.drawable.ic_menu_info_details)
.setTitle( R.string.changes_title ) .setTitle( R.string.changes_title )
.setView( view ) .setView( view )
.setPositiveButton( android.R.string.ok, null) .setPositiveButton( android.R.string.ok, null)
.create(); .create()
dialog.show(); .show();
} }
} }

View file

@ -954,19 +954,14 @@ public class GamesListDelegate extends ListDelegateBase
FirstRunDialog.show( m_activity ); FirstRunDialog.show( m_activity );
} }
s_firstShown = true; s_firstShown = true;
} } else if ( !XWPrefs.getPrefsBoolean( m_activity,
R.string.key_enable_dualpane,
} false )
&& XWPrefs.getIsTablet( m_activity ) ) {
// Combine with above when "true" removed
if ( true || isUpgrade ) {
if ( !XWPrefs.getPrefsBoolean( m_activity,
R.string.key_enable_dualpane, false )
&& XWPrefs.getIsTablet( m_activity ) ) {
makeConfirmThenBuilder(R.string.invite_dualpane, Action.ENABLE_DUALPANE) makeConfirmThenBuilder(R.string.invite_dualpane, Action.ENABLE_DUALPANE)
.setNAKey(R.string.key_notagain_dualpane) .setNAKey(R.string.key_notagain_dualpane)
.setPosButton(R.string.enable_dualpane) .setPosButton(R.string.enable_dualpane)
.setNegButton(R.string.button_later)
.show(); .show();
} }
} }
@ -989,6 +984,7 @@ public class GamesListDelegate extends ListDelegateBase
} }
} ); } );
updateField();
} // init } // init
@Override @Override

View file

@ -62,8 +62,8 @@ public class MainActivity extends XWActivity
protected void onCreate( Bundle savedInstanceState ) protected void onCreate( Bundle savedInstanceState )
{ {
m_dpEnabled = XWPrefs.dualpaneEnabled( this ); m_dpEnabled = XWPrefs.dualpaneEnabled( this );
if ( BuildConfig.DEBUG && m_dpEnabled ) { if ( m_dpEnabled ) {
Utils.showToast( this, "Side-by-side mode ENABLED" ); Utils.showToast( this, R.string.db_enabled_toast );
} }
m_dlgt = m_dpEnabled ? new DualpaneDelegate( this, savedInstanceState ) m_dlgt = m_dpEnabled ? new DualpaneDelegate( this, savedInstanceState )

View file

@ -1,6 +1,6 @@
/* -*- compile-command: "find-and-ant.sh debug install"; -*- */ /* -*- 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. * rights reserved.
* *
* This program is free software; you can redistribute it and/or * 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.util.AttributeSet;
import android.view.View; import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.LinearLayout; import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
public class NotAgainView extends LinearLayout { public class NotAgainView extends ScrollView {
public NotAgainView( Context cx, AttributeSet as ) { public NotAgainView( Context cx, AttributeSet as ) {
super( cx, as ); super( cx, as );

View file

@ -81,7 +81,7 @@ public class Toolbar implements BoardContainer.SizeChangeListener {
{ {
if ( m_visible != visible ) { if ( m_visible != visible ) {
m_visible = visible; m_visible = visible;
doShowHide( null ); doShowHide();
} }
} }
@ -134,10 +134,9 @@ public class Toolbar implements BoardContainer.SizeChangeListener {
// SizeChangeListener // SizeChangeListener
public void sizeChanged( int width, int height, boolean isPortrait ) public void sizeChanged( int width, int height, boolean isPortrait )
{ {
DbgUtils.logf( "Toolbar.sizeChanged(isPortrait=%b)", isPortrait );
tryAddListeners( m_onClickListeners ); tryAddListeners( m_onClickListeners );
tryAddListeners( m_onLongClickListeners ); tryAddListeners( m_onLongClickListeners );
doShowHide( new Boolean(isPortrait) ); doShowHide();
} }
private void tryAddListeners( Map<Buttons, Object> map ) private void tryAddListeners( Map<Buttons, Object> map )
@ -168,14 +167,10 @@ public class Toolbar implements BoardContainer.SizeChangeListener {
return success; return success;
} }
private void doShowHide( Boolean shouldBePortrait ) private void doShowHide()
{ {
// BoardContainer owns which scroller we'll use, and signals its boolean isPortrait = BoardContainer.getIsPortrait();
// choice by setting their visibility. We use the one that's visible. DbgUtils.logdf( "Toolbar.doShowHide(): isPortrait: %b", isPortrait );
boolean isPortrait = View.GONE != m_scrollHor.getVisibility();
DbgUtils.logf( "Toolbar.doShowHide(): isPortrait: %b", isPortrait );
Assert.assertTrue( null == shouldBePortrait
|| shouldBePortrait.equals(isPortrait) );
if ( null == m_layout ) { if ( null == m_layout ) {
m_layout = (LinearLayout)LocUtils.inflate( m_activity, R.layout.toolbar ); m_layout = (LinearLayout)LocUtils.inflate( m_activity, R.layout.toolbar );
@ -186,13 +181,12 @@ public class Toolbar implements BoardContainer.SizeChangeListener {
LinearLayout.HORIZONTAL : LinearLayout.VERTICAL ); LinearLayout.HORIZONTAL : LinearLayout.VERTICAL );
ViewGroup scroller = isPortrait ? m_scrollHor : m_scrollVert; ViewGroup scroller = isPortrait ? m_scrollHor : m_scrollVert;
Assert.assertNotNull( scroller );
if ( null != scroller ) { if ( null != scroller ) {
// Google's had reports of a crash adding second view // Google's had reports of a crash adding second view
scroller.removeAllViews(); scroller.removeAllViews();
scroller.addView( m_layout ); scroller.addView( m_layout );
}
m_layout.setVisibility( m_visible? View.VISIBLE : View.GONE ); scroller.setVisibility( m_visible? View.VISIBLE : View.GONE );
}
} }
} }

View file

@ -568,6 +568,11 @@ public class LocUtils {
} }
if ( null == lang ) { if ( null == lang ) {
lang = Locale.getDefault().getLanguage(); 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; s_curLang = lang;
} }

View file

@ -0,0 +1,38 @@
#!/bin/sh
set -e -u
usage() {
[ $# -ge 1 ] && echo "ERROR: $1"
echo "usage: $0" >&2
echo "Move small-device resources around so they build for normal ones" >&2
exit 1
}
checkFile() {
FILE=$1
[ -z "$(git ls-files -m $FILE)" ] || usage "$FILE is modified"
}
swapFiles() {
SRC_FILE=$1
DEST_DIR=$2
NAME=$(basename $SRC_FILE)
mv $DEST_DIR/$NAME /tmp/
mv $SRC_FILE $DEST_DIR
mv /tmp/$NAME $SRC_FILE
}
for DIR in layout menu ; do
for FILE in res/${DIR}-small/*.xml; do
checkFile $FILE
checkFile res/$DIR/$(basename $FILE)
done
done
for DIR in layout menu ; do
for FILE in res/${DIR}-small/*.xml; do
swapFiles $FILE res/$DIR
done
done