@@ -2011,7 +2011,7 @@ protected int getTitleHeight() {
20112011 if (mWebView instanceof TitleBarDelegate ) {
20122012 return ((TitleBarDelegate ) mWebView ).getTitleHeight ();
20132013 }
2014- return mTitleBar != null ? mTitleBar . getHeight () : 0 ;
2014+ return 0 ;
20152015 }
20162016
20172017 /**
@@ -2942,50 +2942,6 @@ int pinLocY(int y) {
29422942 computeRealVerticalScrollRange () + getTitleHeight ());
29432943 }
29442944
2945- /**
2946- * A title bar which is embedded in this WebView, and scrolls along with it
2947- * vertically, but not horizontally.
2948- */
2949- private View mTitleBar ;
2950-
2951- /**
2952- * the title bar rendering gravity
2953- */
2954- private int mTitleGravity ;
2955-
2956- /**
2957- * Add or remove a title bar to be embedded into the WebView, and scroll
2958- * along with it vertically, while remaining in view horizontally. Pass
2959- * null to remove the title bar from the WebView, and return to drawing
2960- * the WebView normally without translating to account for the title bar.
2961- */
2962- public void setEmbeddedTitleBar (View v ) {
2963- if (mWebView instanceof TitleBarDelegate ) {
2964- ((TitleBarDelegate ) mWebView ).onSetEmbeddedTitleBar (v );
2965- }
2966- if (mTitleBar == v ) return ;
2967- if (mTitleBar != null ) {
2968- mWebView .removeView (mTitleBar );
2969- }
2970- if (null != v ) {
2971- mWebView .addView (v , new AbsoluteLayout .LayoutParams (
2972- ViewGroup .LayoutParams .MATCH_PARENT ,
2973- ViewGroup .LayoutParams .WRAP_CONTENT , 0 , 0 ));
2974- }
2975- mTitleBar = v ;
2976- }
2977-
2978- /**
2979- * Set where to render the embedded title bar
2980- * NO_GRAVITY at the top of the page
2981- * TOP at the top of the screen
2982- */
2983- public void setTitleBarGravity (int gravity ) {
2984- mTitleGravity = gravity ;
2985- // force refresh
2986- invalidate ();
2987- }
2988-
29892945 /**
29902946 * Given a distance in view space, convert it to content space. Note: this
29912947 * does not reflect translation, just scaling, so this should not be called
@@ -4184,7 +4140,7 @@ private boolean setContentScrollTo(int cx, int cy) {
41844140 // animate the title bar off screen slowly enough that the user can see
41854141 // it.
41864142 if (cx == 0 && cy == 1 && getScrollX () == 0 && getScrollY () == 0
4187- && mTitleBar != null ) {
4143+ && getTitleHeight () > 0 ) {
41884144 // FIXME: 100 should be defined somewhere as our max progress.
41894145 if (getProgress () < 100 ) {
41904146 // Wait to scroll the title bar off screen until the page has
@@ -4401,24 +4357,6 @@ public void run() {
44014357 }
44024358 }
44034359
4404- @ Override
4405- public boolean drawChild (Canvas canvas , View child , long drawingTime ) {
4406- if (child == mTitleBar ) {
4407- // When drawing the title bar, move it horizontally to always show
4408- // at the top of the WebView.
4409- mTitleBar .offsetLeftAndRight (getScrollX () - mTitleBar .getLeft ());
4410- int newTop = 0 ;
4411- if (mTitleGravity == Gravity .NO_GRAVITY ) {
4412- newTop = Math .min (0 , getScrollY ());
4413- } else if (mTitleGravity == Gravity .TOP ) {
4414- newTop = getScrollY ();
4415- }
4416- mTitleBar .setBottom (newTop + mTitleBar .getHeight ());
4417- mTitleBar .setTop (newTop );
4418- }
4419- return false ; // We never call invalidate(), so unconditionally returning false.
4420- }
4421-
44224360 private void drawContent (Canvas canvas ) {
44234361 if (mDrawHistory ) {
44244362 canvas .scale (mZoomManager .getScale (), mZoomManager .getScale ());
@@ -4583,9 +4521,8 @@ public void onDraw(Canvas canvas) {
45834521 .getUseWebViewBackgroundForOverscrollBackground ()) {
45844522 drawOverScrollBackground (canvas );
45854523 }
4586- if (mTitleBar != null ) {
4587- canvas .translate (0 , getTitleHeight ());
4588- }
4524+
4525+ canvas .translate (0 , getTitleHeight ());
45894526 drawContent (canvas );
45904527 canvas .restoreToCount (saveCount );
45914528
0 commit comments