From 1adf0307932f3933be792e631612ea1a2fd4e6e2 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 11 Oct 2011 10:58:12 -0700 Subject: Fix crash with qc Bug: 5439827 Change-Id: Ic561a5c7689410dd917e01c27e9b454a8722f957 --- src/com/android/browser/NavScreen.java | 3 ++- src/com/android/browser/NavTabScroller.java | 2 +- src/com/android/browser/PhoneUi.java | 30 ++++++++++++++++------------- 3 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/com/android/browser/NavScreen.java b/src/com/android/browser/NavScreen.java index 45b1dcc..14b1e84 100644 --- a/src/com/android/browser/NavScreen.java +++ b/src/com/android/browser/NavScreen.java @@ -110,7 +110,8 @@ public class NavScreen extends RelativeLayout } public void refreshAdapter() { - mAdapter.notifyDataSetChanged(); + mScroller.handleDataChanged( + mUiController.getTabControl().getTabPosition(mUi.getActiveTab())); } private void init() { diff --git a/src/com/android/browser/NavTabScroller.java b/src/com/android/browser/NavTabScroller.java index 8251928..1dfddff 100644 --- a/src/com/android/browser/NavTabScroller.java +++ b/src/com/android/browser/NavTabScroller.java @@ -213,7 +213,7 @@ public class NavTabScroller extends ScrollerView { handleDataChanged(INVALID_POSITION); } - protected void handleDataChanged(int newscroll) { + void handleDataChanged(int newscroll) { int scroll = getScrollValue(); if (mGapAnimator != null) { mGapAnimator.cancel(); diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java index ddb4e0e..d39909e 100644 --- a/src/com/android/browser/PhoneUi.java +++ b/src/com/android/browser/PhoneUi.java @@ -324,8 +324,7 @@ public class PhoneUi extends BaseUi { mAnimScreen = new AnimScreen(mActivity); } mAnimScreen.set(getTitleBar(), getWebView()); - final View animView = mAnimScreen.mMain; - mCustomViewContainer.addView(animView, COVER_SCREEN_PARAMS); + mCustomViewContainer.addView(mAnimScreen.mMain, COVER_SCREEN_PARAMS); mCustomViewContainer.setVisibility(View.VISIBLE); mCustomViewContainer.bringToFront(); int fromLeft = 0; @@ -356,7 +355,8 @@ public class PhoneUi extends BaseUi { 1f, 0f); ObjectAnimator sx = ObjectAnimator.ofFloat(mAnimScreen, "scaleFactor", 1f, scaleFactor); - ObjectAnimator blend1 = ObjectAnimator.ofFloat(mAnimScreen.mMain, "alpha", 1, 0); + ObjectAnimator blend1 = ObjectAnimator.ofFloat(mAnimScreen.mMain, + "alpha", 1f, 0f); blend1.setDuration(100); inanim.playTogether(tx, ty, tr, tb, sx, title); @@ -364,7 +364,7 @@ public class PhoneUi extends BaseUi { set1.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator anim) { - mCustomViewContainer.removeView(animView); + mCustomViewContainer.removeView(mAnimScreen.mMain); finishAnimationIn(); mUiController.setBlockEvents(false); } @@ -512,15 +512,19 @@ public class PhoneUi extends BaseUi { } public void set(TitleBar tbar, WebView web) { - if (mTitleBarBitmap == null - || mTitleBarBitmap.getWidth() != tbar.getWidth() - || mTitleBarBitmap.getHeight() != tbar.getEmbeddedHeight()) { - mTitleBarBitmap = Bitmap.createBitmap(tbar.getWidth(), - tbar.getEmbeddedHeight(), Bitmap.Config.RGB_565); + if (tbar.getWidth() > 0 && tbar.getEmbeddedHeight() > 0) { + if (mTitleBarBitmap == null + || mTitleBarBitmap.getWidth() != tbar.getWidth() + || mTitleBarBitmap.getHeight() != tbar.getEmbeddedHeight()) { + mTitleBarBitmap = Bitmap.createBitmap(tbar.getWidth(), + tbar.getEmbeddedHeight(), Bitmap.Config.RGB_565); + } + Canvas c = new Canvas(mTitleBarBitmap); + tbar.draw(c); + c.setBitmap(null); + } else { + mTitleBarBitmap = null; } - Canvas c = new Canvas(mTitleBarBitmap); - tbar.draw(c); - c.setBitmap(null); mTitle.setImageBitmap(mTitleBarBitmap); mTitle.setVisibility(View.VISIBLE); int h = web.getHeight() - tbar.getEmbeddedHeight(); @@ -530,7 +534,7 @@ public class PhoneUi extends BaseUi { mContentBitmap = Bitmap.createBitmap(web.getWidth(), h, Bitmap.Config.RGB_565); } - c.setBitmap(mContentBitmap); + Canvas c = new Canvas(mContentBitmap); int tx = web.getScrollX(); int ty = web.getScrollY(); c.translate(-tx, -ty - tbar.getEmbeddedHeight()); -- cgit v1.1