@@ -2014,7 +2014,7 @@ protected int getTitleHeight() {
20142014 if (mWebView instanceof TitleBarDelegate ) {
20152015 return ((TitleBarDelegate ) mWebView ).getTitleHeight ();
20162016 }
2017- return mTitleBar != null ? mTitleBar . getHeight () : 0 ;
2017+ return 0 ;
20182018 }
20192019
20202020 /**
@@ -2945,50 +2945,6 @@ int pinLocY(int y) {
29452945 computeRealVerticalScrollRange () + getTitleHeight ());
29462946 }
29472947
2948- /**
2949- * A title bar which is embedded in this WebView, and scrolls along with it
2950- * vertically, but not horizontally.
2951- */
2952- private View mTitleBar ;
2953-
2954- /**
2955- * the title bar rendering gravity
2956- */
2957- private int mTitleGravity ;
2958-
2959- /**
2960- * Add or remove a title bar to be embedded into the WebView, and scroll
2961- * along with it vertically, while remaining in view horizontally. Pass
2962- * null to remove the title bar from the WebView, and return to drawing
2963- * the WebView normally without translating to account for the title bar.
2964- */
2965- public void setEmbeddedTitleBar (View v ) {
2966- if (mWebView instanceof TitleBarDelegate ) {
2967- ((TitleBarDelegate ) mWebView ).onSetEmbeddedTitleBar (v );
2968- }
2969- if (mTitleBar == v ) return ;
2970- if (mTitleBar != null ) {
2971- mWebView .removeView (mTitleBar );
2972- }
2973- if (null != v ) {
2974- mWebView .addView (v , new AbsoluteLayout .LayoutParams (
2975- ViewGroup .LayoutParams .MATCH_PARENT ,
2976- ViewGroup .LayoutParams .WRAP_CONTENT , 0 , 0 ));
2977- }
2978- mTitleBar = v ;
2979- }
2980-
2981- /**
2982- * Set where to render the embedded title bar
2983- * NO_GRAVITY at the top of the page
2984- * TOP at the top of the screen
2985- */
2986- public void setTitleBarGravity (int gravity ) {
2987- mTitleGravity = gravity ;
2988- // force refresh
2989- invalidate ();
2990- }
2991-
29922948 /**
29932949 * Given a distance in view space, convert it to content space. Note: this
29942950 * does not reflect translation, just scaling, so this should not be called
@@ -4187,7 +4143,7 @@ private boolean setContentScrollTo(int cx, int cy) {
41874143 // animate the title bar off screen slowly enough that the user can see
41884144 // it.
41894145 if (cx == 0 && cy == 1 && getScrollX () == 0 && getScrollY () == 0
4190- && mTitleBar != null ) {
4146+ && getTitleHeight () > 0 ) {
41914147 // FIXME: 100 should be defined somewhere as our max progress.
41924148 if (getProgress () < 100 ) {
41934149 // Wait to scroll the title bar off screen until the page has
@@ -4404,24 +4360,6 @@ public void run() {
44044360 }
44054361 }
44064362
4407- @ Override
4408- public boolean drawChild (Canvas canvas , View child , long drawingTime ) {
4409- if (child == mTitleBar ) {
4410- // When drawing the title bar, move it horizontally to always show
4411- // at the top of the WebView.
4412- mTitleBar .offsetLeftAndRight (getScrollX () - mTitleBar .getLeft ());
4413- int newTop = 0 ;
4414- if (mTitleGravity == Gravity .NO_GRAVITY ) {
4415- newTop = Math .min (0 , getScrollY ());
4416- } else if (mTitleGravity == Gravity .TOP ) {
4417- newTop = getScrollY ();
4418- }
4419- mTitleBar .setBottom (newTop + mTitleBar .getHeight ());
4420- mTitleBar .setTop (newTop );
4421- }
4422- return false ; // We never call invalidate(), so unconditionally returning false.
4423- }
4424-
44254363 private void drawContent (Canvas canvas ) {
44264364 if (mDrawHistory ) {
44274365 canvas .scale (mZoomManager .getScale (), mZoomManager .getScale ());
@@ -4586,9 +4524,8 @@ public void onDraw(Canvas canvas) {
45864524 .getUseWebViewBackgroundForOverscrollBackground ()) {
45874525 drawOverScrollBackground (canvas );
45884526 }
4589- if (mTitleBar != null ) {
4590- canvas .translate (0 , getTitleHeight ());
4591- }
4527+
4528+ canvas .translate (0 , getTitleHeight ());
45924529 drawContent (canvas );
45934530 canvas .restoreToCount (saveCount );
45944531
0 commit comments