tweak toolbar layout to fit better

This commit is contained in:
Eric House 2016-08-18 12:00:18 -07:00
parent 2a8ce27ca9
commit c4d7626ae1
3 changed files with 7 additions and 15 deletions

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="toolbar_button">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
</style>
</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

@ -35,8 +35,8 @@ public class BoardContainer extends ViewGroup {
// If the ratio of height/width exceeds this, use portrait layout // If the ratio of height/width exceeds this, use portrait layout
private static final int PORTRAIT_THRESHHOLD = 105; private static final int PORTRAIT_THRESHHOLD = 105;
private static final int BOARD_PCT_HOR = 90; private static final int BOARD_PCT_VERT = 90;
private static final int BOARD_PCT_VERT = 85; private static final int BOARD_PCT_HOR = 85;
private static final int BOARD_INDX = 0; private static final int BOARD_INDX = 0;
private static final int EXCH_INDX = 1; private static final int EXCH_INDX = 1;
@ -157,8 +157,8 @@ public class BoardContainer extends ViewGroup {
private Rect[] figureBounds( int left, int top, int width, int height ) private Rect[] figureBounds( int left, int top, int width, int height )
{ {
int boardHeight = ( haveTradeBar() || s_isPortrait) int boardHeight = ( haveTradeBar() || s_isPortrait)
? height * BOARD_PCT_HOR / 100 : height; ? height * (BOARD_PCT_VERT) / 100 : height;
int boardWidth = s_isPortrait ? width : width * BOARD_PCT_VERT / 100; int boardWidth = s_isPortrait ? width : (width * BOARD_PCT_HOR) / 100;
// board // board
Rect boardBounds = new Rect( left, top, left + boardWidth, Rect boardBounds = new Rect( left, top, left + boardWidth,