diff options
author | Romain Guy <romainguy@google.com> | 2011-01-27 12:06:29 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-01-27 12:06:29 -0800 |
commit | e398956c248808b95aa3d81403c3ba3884670199 (patch) | |
tree | de64c0076f2e0c3cf9afd7e02dee5b2d63660420 /src/com/android/browser/TabScrollView.java | |
parent | 02dd4e94bfb4fa3f8827190ccccc9bf2a836ee8e (diff) | |
download | packages_apps_browser-e398956c248808b95aa3d81403c3ba3884670199.zip packages_apps_browser-e398956c248808b95aa3d81403c3ba3884670199.tar.gz packages_apps_browser-e398956c248808b95aa3d81403c3ba3884670199.tar.bz2 |
Correctly invalidate the tabs when scrolling them.
Bug #3398549
Change-Id: I577dc5ec1a60040c427c676661f0610daf27a952
Diffstat (limited to 'src/com/android/browser/TabScrollView.java')
-rw-r--r-- | src/com/android/browser/TabScrollView.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/com/android/browser/TabScrollView.java b/src/com/android/browser/TabScrollView.java index 09dddee..d0648b7 100644 --- a/src/com/android/browser/TabScrollView.java +++ b/src/com/android/browser/TabScrollView.java @@ -28,7 +28,6 @@ import android.widget.LinearLayout; */ public class TabScrollView extends HorizontalScrollView { - private Context mContext; private LinearLayout mContentView; private int mSelected; private int mAnimationDuration; @@ -62,13 +61,12 @@ public class TabScrollView extends HorizontalScrollView { } private void init(Context ctx) { - mContext = ctx; mAnimationDuration = ctx.getResources().getInteger( R.integer.tab_animation_duration); mTabOverlap = (int) ctx.getResources().getDimension(R.dimen.tab_overlap); setHorizontalScrollBarEnabled(false); setOverScrollMode(OVER_SCROLL_NEVER); - mContentView = new TabLayout(mContext); + mContentView = new TabLayout(ctx); mContentView.setOrientation(LinearLayout.HORIZONTAL); mContentView.setLayoutParams( new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); @@ -189,6 +187,21 @@ public class TabScrollView extends HorizontalScrollView { return getScrollX(); } + @Override + protected void onScrollChanged(int l, int t, int oldl, int oldt) { + super.onScrollChanged(l, t, oldl, oldt); + + // TabViews base their drawing based on their absolute position within the + // window. When hardware accelerated, we need to recreate their display list + // when they scroll + if (isHardwareAccelerated()) { + int count = mContentView.getChildCount(); + for (int i = 0; i < count; i++) { + mContentView.getChildAt(i).invalidate(); + } + } + } + class TabLayout extends LinearLayout { public TabLayout(Context context) { |