From 8cb3c51b16dc4aa9aea1a252eb59d6b5cbb33af3 Mon Sep 17 00:00:00 2001 From: Yuli Huang Date: Wed, 14 Sep 2011 15:00:33 +0800 Subject: Fix b/5182741: Add 'Edit' title in the action-bar. Change-Id: I3964bfcb23818f2f3f8364475f74b401f7eed097 --- res/layout/photoeditor_main.xml | 5 ++++- res/values-sw320dp/photoeditor_dimens.xml | 2 +- res/values-sw600dp/photoeditor_dimens.xml | 2 +- res/values-sw800dp/photoeditor_dimens.xml | 2 +- src/com/android/gallery3d/photoeditor/ActionBar.java | 12 ++++++++++++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/res/layout/photoeditor_main.xml b/res/layout/photoeditor_main.xml index dd7551ff6..ed4841ab3 100644 --- a/res/layout/photoeditor_main.xml +++ b/res/layout/photoeditor_main.xml @@ -63,7 +63,10 @@ - + diff --git a/res/values-sw320dp/photoeditor_dimens.xml b/res/values-sw320dp/photoeditor_dimens.xml index cde3fe9ed..c0f523fcc 100755 --- a/res/values-sw320dp/photoeditor_dimens.xml +++ b/res/values-sw320dp/photoeditor_dimens.xml @@ -16,7 +16,7 @@ 11sp - 98sp + 98dp 72dp 2dp 12dp diff --git a/res/values-sw600dp/photoeditor_dimens.xml b/res/values-sw600dp/photoeditor_dimens.xml index 285420a55..413347d31 100755 --- a/res/values-sw600dp/photoeditor_dimens.xml +++ b/res/values-sw600dp/photoeditor_dimens.xml @@ -16,7 +16,7 @@ 14sp - 120sp + 120dp 90dp 2dp 12dp diff --git a/res/values-sw800dp/photoeditor_dimens.xml b/res/values-sw800dp/photoeditor_dimens.xml index 8cce1bad6..3b054ceb4 100755 --- a/res/values-sw800dp/photoeditor_dimens.xml +++ b/res/values-sw800dp/photoeditor_dimens.xml @@ -16,7 +16,7 @@ 15sp - 138sp + 138dp 100dp 3dp 18dp diff --git a/src/com/android/gallery3d/photoeditor/ActionBar.java b/src/com/android/gallery3d/photoeditor/ActionBar.java index 52dfb0bd7..32eb79274 100644 --- a/src/com/android/gallery3d/photoeditor/ActionBar.java +++ b/src/com/android/gallery3d/photoeditor/ActionBar.java @@ -72,6 +72,18 @@ public class ActionBar extends RelativeLayout implements FilterStack.StackListen }; } + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) { + super.onLayout(changed, l, t, r, b); + + // Show action-bar title only when there's still room for it; otherwise, hide it. + int width = 0; + for (int i = 0; i < getChildCount(); i++) { + width += getChildAt(i).getWidth(); + } + findViewById(R.id.action_bar_title).setVisibility(((width > r - l)) ? INVISIBLE: VISIBLE); + } + /** * Initializes with a non-null ActionBarListener. */ -- cgit v1.2.3