remove url bar indicator from tabs

       Bug: 4987410

Change-Id: If7105b4fc8e6d34712a59c4e775925d959a5ee6e
diff --git a/src/com/android/browser/BrowserWebView.java b/src/com/android/browser/BrowserWebView.java
index 55dd24a..80f4a53 100644
--- a/src/com/android/browser/BrowserWebView.java
+++ b/src/com/android/browser/BrowserWebView.java
@@ -20,7 +20,6 @@
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.util.AttributeSet;
-import android.view.MotionEvent;
 import android.view.View;
 import android.webkit.WebView;
 
@@ -31,12 +30,9 @@
 /**
  * Manage WebView scroll events
  */
-public class BrowserWebView extends WebView implements Runnable {
+public class BrowserWebView extends WebView {
 
-    private ScrollListener mScrollListener;
-    private boolean mIsCancelled;
     private boolean mBackgroundRemoved = false;
-    private boolean mUserInitiated = false;
     private TitleBarBase mTitleBar;
     private int mCaptureSize;
     private Bitmap mCapture;
@@ -104,13 +100,6 @@
         return (mTitleBar != null) ? mTitleBar.getEmbeddedHeight() : 0;
     }
 
-    // scroll runnable implementation
-    public void run() {
-        if (!mIsCancelled && (mScrollListener != null)) {
-            mScrollListener.onScroll(getVisibleTitleHeight(), mUserInitiated);
-        }
-    }
-
     void hideEmbeddedTitleBar() {
         scrollBy(0, getVisibleTitleHeight());
     }
@@ -119,53 +108,12 @@
     public void setEmbeddedTitleBar(final View title) {
         super.setEmbeddedTitleBar(title);
         mTitleBar = (TitleBarBase) title;
-        if (title != null && mScrollListener != null) {
-            // allow the scroll listener to initialize its state
-            post(this);
-        }
     }
 
     public boolean hasTitleBar() {
         return (mTitleBar != null);
     }
 
-    @Override
-    public boolean onTouchEvent(MotionEvent evt) {
-        if (MotionEvent.ACTION_DOWN == evt.getActionMasked()) {
-            mUserInitiated = true;
-        } else if (MotionEvent.ACTION_UP == evt.getActionMasked()
-                || (MotionEvent.ACTION_CANCEL == evt.getActionMasked())) {
-            mUserInitiated = false;
-        }
-        return super.onTouchEvent(evt);
-    }
-
-    @Override
-    public void stopScroll() {
-        mIsCancelled = true;
-        super.stopScroll();
-    }
-
-    @Override
-    protected void onScrollChanged(int l, final int t, int ol, int ot) {
-        super.onScrollChanged(l, t, ol, ot);
-        if (!mIsCancelled) {
-            post(this);
-        } else {
-            mIsCancelled = false;
-        }
-    }
-
-    void setScrollListener(ScrollListener l) {
-        mScrollListener = l;
-    }
-
-    // callback for scroll events
-
-    interface ScrollListener {
-        public void onScroll(int visibleTitleHeight, boolean userInitiated);
-    }
-
     protected Bitmap capture() {
         if (mCapture == null) return null;
         Canvas c = new Canvas(mCapture);
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index 8584afa..b2c2af8 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -16,8 +16,6 @@
 
 package com.android.browser;
 
-import com.android.browser.BrowserWebView.ScrollListener;
-
 import android.animation.Animator;
 import android.animation.Animator.AnimatorListener;
 import android.animation.AnimatorSet;
@@ -43,7 +41,6 @@
 import android.view.MenuInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
-import android.webkit.WebView;
 import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
@@ -56,8 +53,7 @@
 /**
  * tabbed title bar for xlarge screen browser
  */
-public class TabBar extends LinearLayout
-        implements ScrollListener, OnClickListener {
+public class TabBar extends LinearLayout implements OnClickListener {
 
     private static final int PROGRESS_MAX = 100;
 
@@ -235,60 +231,6 @@
         mUi.showTitleBar();
     }
 
-    void showTitleBarIndicator(boolean show) {
-        Tab tab = mTabControl.getCurrentTab();
-        if (tab != null && !tab.isSnapshot()) {
-            TabView tv = mTabMap.get(tab);
-            if (tv != null) {
-                tv.showIndicator(show);
-            }
-        }
-    }
-
-    boolean showsTitleBarIndicator() {
-        Tab tab = mTabControl.getCurrentTab();
-        if (tab != null) {
-            TabView tv = mTabMap.get(tab);
-            if (tv != null) {
-                return tv.showsIndicator();
-            }
-        }
-        return false;
-    }
-
-    // callback after fake titlebar is shown
-    void onShowTitleBar() {
-        showTitleBarIndicator(false);
-    }
-
-    // callback after fake titlebar is hidden
-    void onHideTitleBar() {
-        Tab tab = mTabControl.getCurrentTab();
-        WebView w = tab.getWebView();
-        if (w != null) {
-            showTitleBarIndicator(w.getVisibleTitleHeight() == 0);
-        }
-    }
-
-    // webview scroll listener
-
-    @Override
-    public void onScroll(int visibleTitleHeight, boolean userInitiated) {
-        if (mUseQuickControls) return;
-        // isLoading is using the current tab, which initially might not be set yet
-        if (mTabControl.getCurrentTab() != null) {
-            if (visibleTitleHeight == 0 && !mUi.isTitleBarShowing()) {
-                if (!showsTitleBarIndicator()) {
-                    showTitleBarIndicator(true);
-                }
-            } else {
-                if (showsTitleBarIndicator()) {
-                    showTitleBarIndicator(false);
-                }
-            }
-        }
-    }
-
     @Override
     public void createContextMenu(ContextMenu menu) {
         MenuInflater inflater = mActivity.getMenuInflater();
@@ -319,7 +261,6 @@
         Tab mTab;
         View mTabContent;
         TextView mTitle;
-        View mIndicator;
         View mIncognito;
         View mSnapshot;
         ImageView mIconView;
@@ -353,33 +294,12 @@
             mClose.setOnClickListener(this);
             mIncognito = mTabContent.findViewById(R.id.incognito);
             mSnapshot = mTabContent.findViewById(R.id.snapshot);
-            mIndicator = mTabContent.findViewById(R.id.chevron);
             mSelected = false;
             mInLoad = false;
             // update the status
             updateFromTab();
         }
 
-        void showIndicator(boolean show) {
-            if (mSelected) {
-                mIndicator.setVisibility(show ? View.VISIBLE : View.GONE);
-                LayoutParams lp = (LinearLayout.LayoutParams) getLayoutParams();
-                if (show) {
-                    lp.width = mTabWidthSelected + mIndicator.getWidth();
-                } else {
-                    lp.width = mTabWidthSelected;
-                }
-                lp.height =  LayoutParams.MATCH_PARENT;
-                setLayoutParams(lp);
-            } else {
-                mIndicator.setVisibility(View.GONE);
-            }
-        }
-
-        boolean showsIndicator() {
-            return (mIndicator.getVisibility() == View.VISIBLE);
-        }
-
         @Override
         public void onClick(View v) {
             if (v == mClose) {
@@ -412,7 +332,6 @@
         public void setActivated(boolean selected) {
             mSelected = selected;
             mClose.setVisibility(mSelected ? View.VISIBLE : View.GONE);
-            mIndicator.setVisibility(View.GONE);
             mTitle.setTextAppearance(mActivity, mSelected ?
                     R.style.TabTitleSelected : R.style.TabTitleUnselected);
             setHorizontalFadingEdgeEnabled(!mSelected);
@@ -623,12 +542,6 @@
         TabView tv = mTabMap.get(tab);
         if (tv != null) {
             tv.setProgress(tv.mTab.getLoadProgress());
-            // update the scroll state
-            WebView webview = tab.getWebView();
-            if (webview != null) {
-                int h = webview.getVisibleTitleHeight();
-                onScroll(h, true);
-            }
         }
     }
 
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index 81a6edb..6fcfab7 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -28,14 +28,12 @@
 import android.webkit.WebChromeClient.CustomViewCallback;
 import android.webkit.WebView;
 
-import com.android.browser.BrowserWebView.ScrollListener;
-
 import java.util.List;
 
 /**
  * Ui for xlarge screen sizes
  */
-public class XLargeUi extends BaseUi implements ScrollListener {
+public class XLargeUi extends BaseUi {
 
     private static final String LOGTAG = "XLargeUi";
 
@@ -69,14 +67,6 @@
         mActionBar.setCustomView(mTabBar);
     }
 
-    @Override
-    public void onSetWebView(Tab tab, WebView v) {
-        super.onSetWebView(tab, v);
-        if (v != null) {
-            ((BrowserWebView) v).setScrollListener(this);
-        }
-    }
-
     public void showComboView(ComboViews startWith, Bundle extras) {
         super.showComboView(startWith, extras);
         if (mUseQuickControls) {
@@ -142,11 +132,6 @@
         hideTitleBar();
     }
 
-    @Override
-    public void onScroll(int visibleTitleHeight, boolean userInitiated) {
-        mTabBar.onScroll(visibleTitleHeight, userInitiated);
-    }
-
     void stopWebViewScrolling() {
         BrowserWebView web = (BrowserWebView) mUiController.getCurrentWebView();
         if (web != null) {
@@ -194,14 +179,11 @@
         // Request focus on the top window.
         if (mUseQuickControls) {
             mPieControl.forceToTop(mContentView);
-            view.setScrollListener(null);
-            mTabBar.showTitleBarIndicator(false);
         } else {
             // check if title bar is already attached by animation
             if (mTitleBar.getParent() == null && !tab.isSnapshot()) {
                 view.setEmbeddedTitleBar(mTitleBar);
             }
-            view.setScrollListener(this);
         }
         mTabBar.onSetActiveTab(tab);
         if (tab.isInVoiceSearchMode()) {
@@ -256,14 +238,12 @@
     protected void showTitleBar() {
         if (canShowTitleBar()) {
             mTitleBar.show();
-            mTabBar.onShowTitleBar();
         }
     }
 
     @Override
     protected void hideTitleBar() {
         if (isTitleBarShowing()) {
-            mTabBar.onHideTitleBar();
             mTitleBar.hide();
         }
     }