summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2009-09-25 15:22:08 -0400
committerLeon Scroggins <scroggo@google.com>2009-09-25 15:22:08 -0400
commitb94bf27370329abb27e5e33b493d6edb5662b36e (patch)
tree68f1550c10eec25c67e3c80aaa16ade336416430 /src/com/android
parent88eddc7b7253328d9eb34c24a3f470c926b5aa15 (diff)
downloadpackages_apps_Browser-b94bf27370329abb27e5e33b493d6edb5662b36e.zip
packages_apps_Browser-b94bf27370329abb27e5e33b493d6edb5662b36e.tar.gz
packages_apps_Browser-b94bf27370329abb27e5e33b493d6edb5662b36e.tar.bz2
Only draw the fake title bar's shadow if the webview is not scrolled.
Fixes http://b/issue?id=2142575 Change-Id: I1b29cf6b7fcf89e6c7ebbb967a46434424d6ba54
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/browser/BrowserActivity.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index b1a3abe..91d4fd1 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -84,6 +84,7 @@ import android.text.IClipboard;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.text.util.Regex;
+import android.util.AttributeSet;
import android.util.Log;
import android.view.ContextMenu;
import android.view.Gravity;
@@ -954,6 +955,36 @@ public class BrowserActivity extends Activity
return true;
}
+ /**
+ * Special class used exclusively for the shadow drawn underneath the fake
+ * title bar. The shadow does not need to be drawn if the WebView
+ * underneath is scrolled to the top, because it will draw directly on top
+ * of the embedded shadow.
+ */
+ private static class Shadow extends View {
+ private WebView mWebView;
+
+ public Shadow(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public void setWebView(WebView view) {
+ mWebView = view;
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ // In general onDraw is the method to override, but we care about
+ // whether or not the background gets drawn, which happens in draw()
+ if (mWebView == null || mWebView.getScrollY() > getHeight()) {
+ super.draw(canvas);
+ }
+ // Need to invalidate so that if the scroll position changes, we
+ // still draw as appropriate.
+ invalidate();
+ }
+ }
+
private void showFakeTitleBar() {
final View decor = getWindow().peekDecorView();
if (mFakeTitleBar == null && mActiveTabsPage == null
@@ -995,6 +1026,9 @@ public class BrowserActivity extends Activity
mFakeTitleBarHolder = (ViewGroup) LayoutInflater.from(this)
.inflate(R.layout.title_bar_bg, null);
}
+ Shadow shadow = (Shadow) mFakeTitleBarHolder.findViewById(
+ R.id.shadow);
+ shadow.setWebView(mainView);
mFakeTitleBarHolder.addView(mFakeTitleBar, 0, mFakeTitleBarParams);
manager.addView(mFakeTitleBarHolder, params);
}