summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/TabBar.java
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2011-05-18 09:23:04 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-05-18 09:23:04 -0700
commite755c575712cfee4aa558df7fcd5defe97927f2b (patch)
treece22a510b0c9b70b80a3591e1b27dce3a4fd1f9f /src/com/android/browser/TabBar.java
parent1617b123ee4f5468d1b3cf605d84c7dc616b42e1 (diff)
parent2649380163039804809d38612e490f02dd14f169 (diff)
downloadandroid_packages_apps_Gello-e755c575712cfee4aa558df7fcd5defe97927f2b.tar.gz
android_packages_apps_Gello-e755c575712cfee4aa558df7fcd5defe97927f2b.tar.bz2
android_packages_apps_Gello-e755c575712cfee4aa558df7fcd5defe97927f2b.zip
am 26493801: am 5358c83a: Merge "adjust tab width for screen size" into honeycomb-mr2
* commit '2649380163039804809d38612e490f02dd14f169': adjust tab width for screen size
Diffstat (limited to 'src/com/android/browser/TabBar.java')
-rw-r--r--src/com/android/browser/TabBar.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index a574d26f..6c3949ac 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -24,6 +24,7 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
@@ -65,8 +66,8 @@ public class TabBar extends LinearLayout
private TabControl mTabControl;
private XLargeUi mUi;
- private final int mTabWidthSelected;
- private final int mTabWidthUnselected;
+ private int mTabWidthSelected;
+ private int mTabWidthUnselected;
private TabScrollView mTabs;
@@ -138,6 +139,16 @@ public class TabBar extends LinearLayout
mFocusPaint.setColor(res.getColor(R.color.tabFocusHighlight));
}
+ @Override
+ public void onConfigurationChanged(Configuration config) {
+ super.onConfigurationChanged(config);
+ Resources res = mActivity.getResources();
+ mTabWidthSelected = (int) res.getDimension(R.dimen.tab_width_selected);
+ mTabWidthUnselected = (int) res.getDimension(R.dimen.tab_width_unselected);
+ // force update of tab bar
+ mTabs.updateLayout();
+ }
+
void setUseQuickControls(boolean useQuickControls) {
mUseQuickControls = useQuickControls;
mNewTab.setVisibility(mUseQuickControls ? View.GONE
@@ -404,12 +415,16 @@ public class TabBar extends LinearLayout
R.style.TabTitleSelected : R.style.TabTitleUnselected);
setHorizontalFadingEdgeEnabled(!mSelected);
super.setActivated(selected);
+ updateLayoutParams();
+ setFocusable(!selected);
+ postInvalidate();
+ }
+
+ public void updateLayoutParams() {
LayoutParams lp = (LinearLayout.LayoutParams) getLayoutParams();
- lp.width = selected ? mTabWidthSelected : mTabWidthUnselected;
+ lp.width = mSelected ? mTabWidthSelected : mTabWidthUnselected;
lp.height = LayoutParams.MATCH_PARENT;
setLayoutParams(lp);
- setFocusable(!selected);
- postInvalidate();
}
void setDisplayTitle(String title) {