diff options
author | Michael Kolb <kolby@google.com> | 2011-07-01 15:33:56 -0700 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2011-07-01 16:04:00 -0700 |
commit | b14ff2febe4b6a07a73c875858437c89cf43fc72 (patch) | |
tree | 40198325874a00d61f36423fbfe78170eca8effc | |
parent | 2bc8042224be51966d748b870768ec1b376a1621 (diff) | |
download | packages_apps_browser-b14ff2febe4b6a07a73c875858437c89cf43fc72.zip packages_apps_browser-b14ff2febe4b6a07a73c875858437c89cf43fc72.tar.gz packages_apps_browser-b14ff2febe4b6a07a73c875858437c89cf43fc72.tar.bz2 |
remove url bar indicator from tabs
Bug: 4987410
Change-Id: If7105b4fc8e6d34712a59c4e775925d959a5ee6e
-rw-r--r-- | res/drawable-hdpi/ic_chevron.png | bin | 539 -> 0 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_chevron.png | bin | 451 -> 0 bytes | |||
-rw-r--r-- | res/layout/tab_title.xml | 7 | ||||
-rw-r--r-- | src/com/android/browser/BrowserWebView.java | 54 | ||||
-rw-r--r-- | src/com/android/browser/TabBar.java | 89 | ||||
-rw-r--r-- | src/com/android/browser/XLargeUi.java | 22 |
6 files changed, 3 insertions, 169 deletions
diff --git a/res/drawable-hdpi/ic_chevron.png b/res/drawable-hdpi/ic_chevron.png Binary files differdeleted file mode 100644 index 6dc842f..0000000 --- a/res/drawable-hdpi/ic_chevron.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_chevron.png b/res/drawable-mdpi/ic_chevron.png Binary files differdeleted file mode 100644 index 786899a..0000000 --- a/res/drawable-mdpi/ic_chevron.png +++ /dev/null diff --git a/res/layout/tab_title.xml b/res/layout/tab_title.xml index fcae2bc..7ac2ba0 100644 --- a/res/layout/tab_title.xml +++ b/res/layout/tab_title.xml @@ -17,13 +17,6 @@ android:gravity="center_vertical" android:orientation="horizontal"> <ImageView - android:id="@+id/chevron" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:gravity="center_vertical" - android:src="@drawable/ic_chevron" - android:visibility="gone" /> - <ImageView android:id="@+id/incognito" android:layout_width="wrap_content" android:layout_height="match_parent" 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.content.Context; 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 @@ import java.util.Map; /** * 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 @@ public class BrowserWebView extends WebView implements Runnable { 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 class BrowserWebView extends WebView implements Runnable { 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.LayoutInflater; 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 @@ import java.util.Map; /** * 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 @@ public class TabBar extends LinearLayout 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 @@ public class TabBar extends LinearLayout Tab mTab; View mTabContent; TextView mTitle; - View mIndicator; View mIncognito; View mSnapshot; ImageView mIconView; @@ -353,33 +294,12 @@ public class TabBar extends LinearLayout 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 class TabBar extends LinearLayout 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 @@ public class TabBar extends LinearLayout 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.view.View; 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 @@ public class XLargeUi extends BaseUi implements ScrollListener { 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 @@ public class XLargeUi extends BaseUi implements ScrollListener { 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 @@ public class XLargeUi extends BaseUi implements ScrollListener { // 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 @@ public class XLargeUi extends BaseUi implements ScrollListener { protected void showTitleBar() { if (canShowTitleBar()) { mTitleBar.show(); - mTabBar.onShowTitleBar(); } } @Override protected void hideTitleBar() { if (isTitleBarShowing()) { - mTabBar.onHideTitleBar(); mTitleBar.hide(); } } |