From 6da7c85dbfaf40262ace74a0584a64390f54ddac Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 16 Aug 2016 11:01:46 -0700 Subject: [PATCH] use custom layout for board/toolbar relationship Correct or not, this is my solution to the circular problem of how to choose a vertical or horizontal toolbar before beginning the layout of the board and toolbar. Adding a new custom container that holds the board, toolbar(s) and tile exchange buttons and uses the ratio of its own dimensions to choose which toolbar to show. Also drive toolbar initialization from the layout process because when started from BoardDelegate it now tries to install button listeners too early. --- xwords4/android/XWords4/archive/R.java | 4 +- xwords4/android/XWords4/res/layout/board.xml | 95 ++++++----- .../android/XWords4/res/layout/toolbar.xml | 2 +- .../eehouse/android/xw4/BoardContainer.java | 157 ++++++++++++++++++ .../eehouse/android/xw4/BoardDelegate.java | 14 +- .../org/eehouse/android/xw4/BoardView.java | 12 +- .../org/eehouse/android/xw4/DelegateBase.java | 24 --- .../org/eehouse/android/xw4/MainActivity.java | 15 -- .../src/org/eehouse/android/xw4/Toolbar.java | 126 +++++++++----- 9 files changed, 302 insertions(+), 147 deletions(-) create mode 100644 xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardContainer.java diff --git a/xwords4/android/XWords4/archive/R.java b/xwords4/android/XWords4/archive/R.java index 3f4c41e2a..1ca140bba 100644 --- a/xwords4/android/XWords4/archive/R.java +++ b/xwords4/android/XWords4/archive/R.java @@ -277,8 +277,8 @@ public final class R { public static final int smart_robot=0x7f0c0044; public static final int state=0x7f0c0051; public static final int summary=0x7f0c0064; - public static final int tbar_parent_hor=0x7f0c0007; - public static final int tbar_parent_vert=0x7f0c0008; + public static final int tbar_parent_hor=0x7f0c0008; + public static final int tbar_parent_vert=0x7f0c0007; public static final int text_item=0x7f0c0056; public static final int text_item2=0x7f0c0057; public static final int thumbnail=0x7f0c004e; diff --git a/xwords4/android/XWords4/res/layout/board.xml b/xwords4/android/XWords4/res/layout/board.xml index 1a8ab193c..8cdd4237c 100644 --- a/xwords4/android/XWords4/res/layout/board.xml +++ b/xwords4/android/XWords4/res/layout/board.xml @@ -1,58 +1,57 @@ - - - + - -