diff options
author | Adam Powell <adamp@google.com> | 2011-05-19 15:02:50 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2011-05-19 15:38:27 -0700 |
commit | dacbb746c99bd80bd618f1ba14eaa5a969e3b148 (patch) | |
tree | 545200490c43573b409cb35f1b228b93b0617aa7 /core/java | |
parent | 146a0b4522db2d782953a464fe63adcd7e1569c2 (diff) | |
download | frameworks_base-dacbb746c99bd80bd618f1ba14eaa5a969e3b148.zip frameworks_base-dacbb746c99bd80bd618f1ba14eaa5a969e3b148.tar.gz frameworks_base-dacbb746c99bd80bd618f1ba14eaa5a969e3b148.tar.bz2 |
DO NOT MERGE Action bar config changes
Handle action bar padding on configuration changes when the app
handles these changes itself.
Change-Id: I044da9253a0be6b4bbabdc12891b6d4786725afa
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/com/android/internal/widget/ActionBarView.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java index cc51911..891557d 100644 --- a/core/java/com/android/internal/widget/ActionBarView.java +++ b/core/java/com/android/internal/widget/ActionBarView.java @@ -28,6 +28,8 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Configuration; +import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.text.TextUtils; @@ -980,6 +982,21 @@ public class ActionBarView extends ViewGroup { } @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + // Make sure we reload positioning elements that may change with configuration. + Resources res = getContext().getResources(); + final int imagePadding = res.getDimensionPixelSize( + com.android.internal.R.dimen.action_bar_home_image_padding); + final int upMargin = res.getDimensionPixelSize( + com.android.internal.R.dimen.action_bar_home_up_margin); + mIconView.setPadding(imagePadding, getPaddingTop(), imagePadding, getPaddingBottom()); + ((LayoutParams) mUpView.getLayoutParams()).rightMargin = upMargin; + mUpView.requestLayout(); + } + + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { measureChildWithMargins(mUpView, widthMeasureSpec, 0, heightMeasureSpec, 0); final LayoutParams upLp = (LayoutParams) mUpView.getLayoutParams(); |