smooth navscreen animation
Change-Id: I87bfba8a18a1aaeffa95d15e4ddb4313dd2752d9
diff --git a/src/com/android/browser/BrowserWebView.java b/src/com/android/browser/BrowserWebView.java
index 6111aa6..9be9ad9 100644
--- a/src/com/android/browser/BrowserWebView.java
+++ b/src/com/android/browser/BrowserWebView.java
@@ -17,6 +17,8 @@
package com.android.browser;
import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@@ -34,6 +36,7 @@
private boolean mBackgroundRemoved = false;
private boolean mUserInitiated = false;
private TitleBarBase mTitleBar;
+ private Bitmap mCapture;
/**
* @param context
@@ -72,6 +75,12 @@
}
@Override
+ protected void onSizeChanged(int w, int h, int ow, int oh) {
+ super.onSizeChanged(w, h, ow, oh);
+ mCapture = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
+ }
+
+ @Override
protected int getTitleHeight() {
return (mTitleBar != null) ? mTitleBar.getEmbeddedHeight() : 0;
}
@@ -138,6 +147,14 @@
public void onScroll(int visibleTitleHeight, boolean userInitiated);
}
+ protected Bitmap capture() {
+ if (mCapture == null) return null;
+ Canvas c = new Canvas(mCapture);
+ c.translate(-getScrollX(), -(getScrollY() + getVisibleTitleHeight()));
+ onDraw(c);
+ return mCapture;
+ }
+
@Override
protected void onDraw(android.graphics.Canvas c) {
super.onDraw(c);