diff options
author | Michael Kolb <kolby@google.com> | 2011-03-09 17:15:28 -0800 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2011-03-09 17:15:34 -0800 |
commit | f26289291f421f07396fa210574938e76e88a6dc (patch) | |
tree | cd268331fc534869869195cf60f01964963341cf /src/com | |
parent | 208f1948017c10cccc52d97355f7fb79bbddc186 (diff) | |
download | packages_apps_Browser-f26289291f421f07396fa210574938e76e88a6dc.zip packages_apps_Browser-f26289291f421f07396fa210574938e76e88a6dc.tar.gz packages_apps_Browser-f26289291f421f07396fa210574938e76e88a6dc.tar.bz2 |
remove tab switch animation
Bug: 4052162
due to problems in webview rendering, the blending
animation can cause some annoying flicker
this change backs out the blending animation
Change-Id: I532fc01b79a6285f332a002c7515e759d377fd64
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/browser/ScrollWebView.java | 43 | ||||
-rw-r--r-- | src/com/android/browser/XLargeUi.java | 58 |
2 files changed, 10 insertions, 91 deletions
diff --git a/src/com/android/browser/ScrollWebView.java b/src/com/android/browser/ScrollWebView.java index 2ee2ac0..8c89e51 100644 --- a/src/com/android/browser/ScrollWebView.java +++ b/src/com/android/browser/ScrollWebView.java @@ -18,7 +18,6 @@ package com.android.browser; import android.content.Context; import android.graphics.Bitmap; -import android.graphics.Paint; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; @@ -36,9 +35,7 @@ public class ScrollWebView extends WebView implements Runnable { private boolean mBackgroundRemoved = false; private boolean mUserInitiated = false; private TitleBarBase mTitleBar; - private boolean mDrawCached = false; private Bitmap mBitmap; - private Paint mCachePaint = new Paint(); /** * @param context @@ -137,46 +134,22 @@ public class ScrollWebView extends WebView implements Runnable { mScrollListener = l; } - @Override - public void invalidate() { - if (!mDrawCached) { - super.invalidate(); - } - } - // callback for scroll events interface ScrollListener { public void onScroll(int visibleTitleHeight, boolean userInitiated); } - void setDrawCached(boolean cached) { - if (cached == mDrawCached) return; - if (cached) { - buildDrawingCache(); - mBitmap = getDrawingCache(false); - mDrawCached = (mBitmap != null); - } else { - mDrawCached = false; - mBitmap = null; - destroyDrawingCache(); - } - } - @Override protected void onDraw(android.graphics.Canvas c) { - if (mDrawCached) { - c.drawBitmap(mBitmap, getScrollX(), getScrollY(), mCachePaint); - } else { - super.onDraw(c); - if (!mBackgroundRemoved && getRootView().getBackground() != null) { - mBackgroundRemoved = true; - post(new Runnable() { - public void run() { - getRootView().setBackgroundDrawable(null); - } - }); - } + super.onDraw(c); + if (!mBackgroundRemoved && getRootView().getBackground() != null) { + mBackgroundRemoved = true; + post(new Runnable() { + public void run() { + getRootView().setBackgroundDrawable(null); + } + }); } } diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java index debb763..892b118 100644 --- a/src/com/android/browser/XLargeUi.java +++ b/src/com/android/browser/XLargeUi.java @@ -18,14 +18,9 @@ package com.android.browser; import com.android.browser.ScrollWebView.ScrollListener; -import android.animation.Animator; -import android.animation.Animator.AnimatorListener; -import android.animation.ObjectAnimator; import android.app.ActionBar; import android.app.Activity; import android.content.pm.PackageManager; -import android.graphics.Bitmap; -import android.graphics.Canvas; import android.os.Bundle; import android.os.Handler; import android.util.Log; @@ -54,7 +49,6 @@ public class XLargeUi extends BaseUi implements ScrollListener { private boolean mUseQuickControls; private PieControl mPieControl; - private boolean mInAnimation = false; private Handler mHandler; /** @@ -221,56 +215,8 @@ public class XLargeUi extends BaseUi implements ScrollListener { @Override public void setActiveTab(final Tab tab) { - if (mInAnimation) return; - if ((tab != mActiveTab) && (mActiveTab != null)) { - mInAnimation = true; - // animate between the two - final ScrollWebView fromWV = (ScrollWebView) mActiveTab.getWebView(); - fromWV.setDrawCached(true); - fromWV.setEmbeddedTitleBar(null); - final ScrollWebView toWV = (ScrollWebView) tab.getWebView(); - if (!mUseQuickControls) { - if (mTitleBar.getParent() == null) { - toWV.setEmbeddedTitleBar(mTitleBar); - } - } - toWV.setDrawCached(true); - attachTabToContentView(tab); - super.setActiveTab(tab, false); - ObjectAnimator transition = ObjectAnimator.ofFloat( - toWV, "alpha", 0f, 1f); - transition.setDuration(mActivity.getResources() - .getInteger(R.integer.tabFadeDuration)); - transition.addListener(new AnimatorListener() { - @Override - public void onAnimationCancel(Animator animation) { - fromWV.setDrawCached(false); - toWV.setDrawCached(false); - setActiveTab(tab, false); - mInAnimation = false; - } - - @Override - public void onAnimationEnd(Animator animation) { - fromWV.setDrawCached(false); - toWV.setDrawCached(false); - setActiveTab(tab, false); - mInAnimation = false; - } - - @Override - public void onAnimationRepeat(Animator animation) { - } - - @Override - public void onAnimationStart(Animator animation) { - } - }); - transition.start(); - } else { - super.setActiveTab(tab, true); - setActiveTab(tab, true); - } + super.setActiveTab(tab, true); + setActiveTab(tab, true); } @Override |