diff options
author | Yuli Huang <yuli@google.com> | 2011-09-14 01:16:55 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-14 01:16:55 -0700 |
commit | 5eea58a345d419c6eda16e4500413192e78f848f (patch) | |
tree | 195e518771f2a587dfb6da681b8400cd3e882838 /src/com | |
parent | 4694f2097b7bd59c050369722ac3ce787c18ccb4 (diff) | |
parent | 72963d1288aa082e8a0497cb7acc1c15d95b0233 (diff) | |
download | android_packages_apps_Snap-5eea58a345d419c6eda16e4500413192e78f848f.tar.gz android_packages_apps_Snap-5eea58a345d419c6eda16e4500413192e78f848f.tar.bz2 android_packages_apps_Snap-5eea58a345d419c6eda16e4500413192e78f848f.zip |
Merge "Fix b/5182741: Add 'Edit' title in the action-bar."
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/gallery3d/photoeditor/ActionBar.java | 12 |
1 files changed, 12 insertions, 0 deletions
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. */ |