summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Powell <adamp@google.com> 2011-06-23 14:39:05 -0700
committer Adam Powell <adamp@google.com> 2011-06-23 16:56:07 -0700
commitc8b0b005cb616deb9646f2c2b995890fa9530f94 (patch)
tree0f303776388e4050971dc6e8a3eae9b32e16e275
parent2a0879149187ee9500687f248f4e662943c8cdb3 (diff)
Fix bug 4771354 - Phone landscape action bar subtitle slightly cut off
on the bottom Let action bar title sizes adapt for restricted space in landscape. Fix home spacing for tablets to eliminate redundant layout. Change-Id: If38a43d87ca1aebf96b5d7adfdb1cf36c41ec07e
-rw-r--r--core/java/com/android/internal/widget/ActionBarView.java14
-rw-r--r--core/res/res/layout-large/action_bar_home.xml39
-rw-r--r--core/res/res/layout/action_bar_home.xml4
-rw-r--r--core/res/res/layout/action_menu_item_layout.xml8
-rw-r--r--core/res/res/values-land/dimens.xml4
-rw-r--r--core/res/res/values-large/dimens.xml6
-rw-r--r--core/res/res/values-sw600dp/dimens.xml13
-rw-r--r--core/res/res/values/dimens.xml4
-rw-r--r--core/res/res/values/styles.xml2
9 files changed, 36 insertions, 58 deletions
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 6204b4eb19ff..8d75dff3168d 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -50,7 +50,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.Window;
-import android.view.View.MeasureSpec;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -649,7 +648,7 @@ public class ActionBarView extends AbsActionBarView {
}
}
}
-
+
private void initTitle() {
if (mTitleLayout == null) {
LayoutInflater inflater = LayoutInflater.from(getContext());
@@ -1162,13 +1161,14 @@ public class ActionBarView extends AbsActionBarView {
protected void onLayout(boolean changed, int l, int t, int r, int b) {
final int vCenter = (b - t) / 2;
int width = r - l;
+ int upOffset = 0;
if (mUpView.getVisibility() != GONE) {
final LayoutParams upLp = (LayoutParams) mUpView.getLayoutParams();
final int upHeight = mUpView.getMeasuredHeight();
final int upWidth = mUpView.getMeasuredWidth();
- final int upTop = t + vCenter - upHeight / 2;
- mUpView.layout(l, upTop, l + upWidth, upTop + upHeight);
- final int upOffset = upLp.leftMargin + upWidth + upLp.rightMargin;
+ final int upTop = vCenter - upHeight / 2;
+ mUpView.layout(0, upTop, upWidth, upTop + upHeight);
+ upOffset = upLp.leftMargin + upWidth + upLp.rightMargin;
width -= upOffset;
l += upOffset;
}
@@ -1176,8 +1176,8 @@ public class ActionBarView extends AbsActionBarView {
final int iconHeight = mIconView.getMeasuredHeight();
final int iconWidth = mIconView.getMeasuredWidth();
final int hCenter = (r - l) / 2;
- final int iconLeft = l + iconLp.leftMargin + hCenter - iconWidth / 2;
- final int iconTop = t + iconLp.topMargin + vCenter - iconHeight / 2;
+ final int iconLeft = upOffset + Math.max(iconLp.leftMargin, hCenter - iconWidth / 2);
+ final int iconTop = Math.max(iconLp.topMargin, vCenter - iconHeight / 2);
mIconView.layout(iconLeft, iconTop, iconLeft + iconWidth, iconTop + iconHeight);
}
}
diff --git a/core/res/res/layout-large/action_bar_home.xml b/core/res/res/layout-large/action_bar_home.xml
deleted file mode 100644
index 86580bc3e531..000000000000
--- a/core/res/res/layout-large/action_bar_home.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<view xmlns:android="http://schemas.android.com/apk/res/android"
- class="com.android.internal.widget.ActionBarView$HomeView"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:background="?android:attr/selectableItemBackground" >
- <ImageView android:id="@android:id/up"
- android:src="?android:attr/homeAsUpIndicator"
- android:layout_gravity="center_vertical|left"
- android:visibility="gone"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="-12dip" />
- <ImageView android:id="@android:id/home"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingLeft="16dip"
- android:paddingRight="16dip"
- android:paddingTop="4dip"
- android:paddingBottom="4dip"
- android:adjustViewBounds="true"
- android:layout_gravity="center"
- android:scaleType="fitCenter" />
-</view>
diff --git a/core/res/res/layout/action_bar_home.xml b/core/res/res/layout/action_bar_home.xml
index 835e039cc1cd..9612710c853c 100644
--- a/core/res/res/layout/action_bar_home.xml
+++ b/core/res/res/layout/action_bar_home.xml
@@ -30,8 +30,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dip"
- android:paddingTop="@dimen/action_bar_icon_vertical_padding"
- android:paddingBottom="@dimen/action_bar_icon_vertical_padding"
+ android:layout_marginTop="@android:dimen/action_bar_icon_vertical_padding"
+ android:layout_marginBottom="@android:dimen/action_bar_icon_vertical_padding"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="fitCenter" />
diff --git a/core/res/res/layout/action_menu_item_layout.xml b/core/res/res/layout/action_menu_item_layout.xml
index 4206dcb6137d..a8f0c22f9626 100644
--- a/core/res/res/layout/action_menu_item_layout.xml
+++ b/core/res/res/layout/action_menu_item_layout.xml
@@ -29,10 +29,10 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"
- android:paddingTop="@dimen/action_bar_icon_vertical_padding"
- android:paddingBottom="@dimen/action_bar_icon_vertical_padding"
- android:paddingLeft="4dip"
- android:paddingRight="4dip"
+ android:layout_marginTop="4dip"
+ android:layout_marginBottom="4dip"
+ android:layout_marginLeft="4dip"
+ android:layout_marginRight="4dip"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:background="@null"
diff --git a/core/res/res/values-land/dimens.xml b/core/res/res/values-land/dimens.xml
index 4dd93346a38d..c500fd31870b 100644
--- a/core/res/res/values-land/dimens.xml
+++ b/core/res/res/values-land/dimens.xml
@@ -33,6 +33,10 @@
<dimen name="action_bar_default_height">40dip</dimen>
<!-- Vertical padding around action bar icons. -->
<dimen name="action_bar_icon_vertical_padding">4dip</dimen>
+ <!-- Text size for action bar titles -->
+ <dimen name="action_bar_title_text_size">16dp</dimen>
+ <!-- Text size for action bar subtitles -->
+ <dimen name="action_bar_subtitle_text_size">12dp</dimen>
<!-- Size of clock font in LockScreen on Unsecure unlock screen. -->
<dimen name="keyguard_lockscreen_clock_font_size">80sp</dimen>
diff --git a/core/res/res/values-large/dimens.xml b/core/res/res/values-large/dimens.xml
index 55eb1458f81b..4f49135e566e 100644
--- a/core/res/res/values-large/dimens.xml
+++ b/core/res/res/values-large/dimens.xml
@@ -43,10 +43,4 @@
<!-- Preference UI dimensions for larger screens. -->
<dimen name="preference_widget_width">56dp</dimen>
- <!-- The maximum number of action buttons that should be permitted within
- an action bar/action mode. This will be used to determine how many
- showAsAction="ifRoom" items can fit. "always" items can override this. -->
- <integer name="max_action_buttons">5</integer>
- <!-- Default height of an action bar. -->
- <dimen name="action_bar_default_height">56dip</dimen>
</resources>
diff --git a/core/res/res/values-sw600dp/dimens.xml b/core/res/res/values-sw600dp/dimens.xml
index 150b6d4c137a..9ffe6b1e5a2a 100644
--- a/core/res/res/values-sw600dp/dimens.xml
+++ b/core/res/res/values-sw600dp/dimens.xml
@@ -25,6 +25,19 @@
<!-- Size of the giant number (unread count) in the notifications -->
<dimen name="status_bar_content_number_size">48sp</dimen>
+ <!-- The maximum number of action buttons that should be permitted within
+ an action bar/action mode. This will be used to determine how many
+ showAsAction="ifRoom" items can fit. "always" items can override this. -->
+ <integer name="max_action_buttons">5</integer>
+ <!-- Default height of an action bar. -->
+ <dimen name="action_bar_default_height">56dip</dimen>
+ <!-- Vertical padding around action bar icons. -->
+ <dimen name="action_bar_icon_vertical_padding">4dip</dimen>
+ <!-- Text size for action bar titles -->
+ <dimen name="action_bar_title_text_size">18dp</dimen>
+ <!-- Text size for action bar subtitles -->
+ <dimen name="action_bar_subtitle_text_size">14dp</dimen>
+
<!-- Size of clock font in LockScreen. -->
<dimen name="keyguard_pattern_unlock_clock_font_size">98sp</dimen>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 9933b6ff376b..a5e5f7097f23 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -119,6 +119,10 @@
<dimen name="action_bar_default_height">48dip</dimen>
<!-- Vertical padding around action bar icons. -->
<dimen name="action_bar_icon_vertical_padding">8dip</dimen>
+ <!-- Text size for action bar titles -->
+ <dimen name="action_bar_title_text_size">18dp</dimen>
+ <!-- Text size for action bar subtitles -->
+ <dimen name="action_bar_subtitle_text_size">14dp</dimen>
<!-- Size of clock font in LockScreen on Unsecure unlock screen. -->
<dimen name="keyguard_lockscreen_clock_font_size">80sp</dimen>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 67be63ed15ba..5244b74fa492 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1296,10 +1296,12 @@
<style name="TextAppearance.Holo.Widget.ActionBar.Title"
parent="TextAppearance.Holo.Medium">
+ <item name="android:textSize">@android:dimen/action_bar_title_text_size</item>
</style>
<style name="TextAppearance.Holo.Widget.ActionBar.Subtitle"
parent="TextAppearance.Holo.Small">
+ <item name="android:textSize">@android:dimen/action_bar_subtitle_text_size</item>
</style>
<style name="TextAppearance.Holo.Widget.ActionMode">