John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Bijan Amirzada | 41242f2 | 2014-03-21 12:12:18 -0700 | [diff] [blame] | 17 | package com.android.browser; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 18 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 19 | import android.content.Context; |
Michael Kolb | 57059a8 | 2012-04-30 14:32:03 -0700 | [diff] [blame] | 20 | import android.content.res.Configuration; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 21 | import android.content.res.Resources; |
Panos Thomas | 752ce59 | 2014-10-16 13:00:35 -0700 | [diff] [blame] | 22 | import android.graphics.Rect; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 23 | import android.view.LayoutInflater; |
| 24 | import android.view.View; |
| 25 | import android.view.ViewGroup; |
Ben Murdoch | d51bb57 | 2011-08-17 20:42:02 +0100 | [diff] [blame] | 26 | import android.view.ViewStub; |
Kulanthaivel Palanichamy | 846bb0f | 2014-12-02 13:50:34 -0800 | [diff] [blame] | 27 | import android.view.ViewTreeObserver; |
John Reck | 1cc1d1d | 2012-09-04 18:13:51 -0700 | [diff] [blame] | 28 | import android.view.accessibility.AccessibilityManager; |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame] | 29 | |
| 30 | import org.codeaurora.swe.BrowserCommandLine; |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 31 | import org.codeaurora.swe.WebView; |
| 32 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 33 | import android.widget.FrameLayout; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * Base class for a title bar used by the browser. |
| 37 | */ |
Kulanthaivel Palanichamy | 846bb0f | 2014-12-02 13:50:34 -0800 | [diff] [blame] | 38 | public class TitleBar extends FrameLayout implements ViewTreeObserver.OnPreDrawListener { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 39 | |
| 40 | private static final int PROGRESS_MAX = 100; |
| 41 | private static final float ANIM_TITLEBAR_DECELERATE = 2.5f; |
| 42 | |
| 43 | private UiController mUiController; |
| 44 | private BaseUi mBaseUi; |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 45 | private FrameLayout mContentView; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 46 | private PageProgressView mProgress; |
John Reck | 1cc1d1d | 2012-09-04 18:13:51 -0700 | [diff] [blame] | 47 | private AccessibilityManager mAccessibilityManager; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 48 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 49 | private NavigationBarBase mNavBar; |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 50 | private SnapshotBar mSnapshotBar; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 51 | |
| 52 | //state |
| 53 | private boolean mShowing; |
| 54 | private boolean mInLoad; |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 55 | private boolean mIsFixedTitleBar; |
Kulanthaivel Palanichamy | 846bb0f | 2014-12-02 13:50:34 -0800 | [diff] [blame] | 56 | private float mCurrentTranslationY; |
| 57 | private boolean mUpdateTranslationY = false; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 58 | |
| 59 | public TitleBar(Context context, UiController controller, BaseUi ui, |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 60 | FrameLayout contentView) { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 61 | super(context, null); |
| 62 | mUiController = controller; |
| 63 | mBaseUi = ui; |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 64 | mContentView = contentView; |
John Reck | 1cc1d1d | 2012-09-04 18:13:51 -0700 | [diff] [blame] | 65 | mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 66 | initLayout(context); |
John Reck | 0f9aaeb | 2012-05-23 14:40:19 -0700 | [diff] [blame] | 67 | setFixedTitleBar(); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | private void initLayout(Context context) { |
| 71 | LayoutInflater factory = LayoutInflater.from(context); |
| 72 | factory.inflate(R.layout.title_bar, this); |
| 73 | mProgress = (PageProgressView) findViewById(R.id.progress); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 74 | mNavBar = (NavigationBarBase) findViewById(R.id.taburlbar); |
| 75 | mNavBar.setTitleBar(this); |
Ben Murdoch | d51bb57 | 2011-08-17 20:42:02 +0100 | [diff] [blame] | 76 | } |
| 77 | |
Ben Murdoch | d51bb57 | 2011-08-17 20:42:02 +0100 | [diff] [blame] | 78 | private void inflateSnapshotBar() { |
| 79 | if (mSnapshotBar != null) { |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | ViewStub stub = (ViewStub) findViewById(R.id.snapshotbar_stub); |
| 84 | mSnapshotBar = (SnapshotBar) stub.inflate(); |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 85 | mSnapshotBar.setTitleBar(this); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 86 | } |
| 87 | |
Michael Kolb | 57059a8 | 2012-04-30 14:32:03 -0700 | [diff] [blame] | 88 | @Override |
| 89 | protected void onConfigurationChanged(Configuration config) { |
| 90 | super.onConfigurationChanged(config); |
John Reck | 0f9aaeb | 2012-05-23 14:40:19 -0700 | [diff] [blame] | 91 | setFixedTitleBar(); |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | @Override |
| 95 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| 96 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
Vivek Sekhar | 8a66078 | 2014-10-27 17:00:53 -0700 | [diff] [blame] | 97 | mBaseUi.setContentViewMarginTop(0); |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 98 | } |
| 99 | |
Kulanthaivel Palanichamy | 846bb0f | 2014-12-02 13:50:34 -0800 | [diff] [blame] | 100 | @Override |
| 101 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) { |
| 102 | super.onLayout(changed, left, top, right, bottom); |
| 103 | |
| 104 | mCurrentTranslationY = this.getTranslationY(); |
| 105 | if (mCurrentTranslationY < 0) { |
| 106 | mUpdateTranslationY = true; |
| 107 | this.setTranslationY(0); |
| 108 | |
| 109 | final ViewTreeObserver observer = this.getViewTreeObserver(); |
| 110 | observer.addOnPreDrawListener(this); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | @Override |
| 115 | public boolean onPreDraw() { |
| 116 | if (mUpdateTranslationY) { |
| 117 | this.setTranslationY(mCurrentTranslationY); |
| 118 | mUpdateTranslationY = false; |
| 119 | } |
| 120 | final ViewTreeObserver observer = this.getViewTreeObserver(); |
| 121 | observer.removeOnPreDrawListener(this); |
| 122 | return true; |
| 123 | } |
| 124 | |
John Reck | 0f9aaeb | 2012-05-23 14:40:19 -0700 | [diff] [blame] | 125 | private void setFixedTitleBar() { |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame] | 126 | boolean isFixed = !getContext().getResources().getBoolean(R.bool.hide_title) || |
| 127 | BrowserCommandLine.hasSwitch(BrowserSwitches.DISABLE_TOP_CONTROLS); |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 128 | |
Vivek Sekhar | 8057214 | 2014-12-01 10:54:22 -0800 | [diff] [blame] | 129 | isFixed |= mAccessibilityManager.isEnabled() && |
| 130 | mAccessibilityManager.isTouchExplorationEnabled(); |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 131 | // If getParent() returns null, we are initializing |
| 132 | ViewGroup parent = (ViewGroup)getParent(); |
| 133 | if (mIsFixedTitleBar == isFixed && parent != null) return; |
| 134 | mIsFixedTitleBar = isFixed; |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame] | 135 | showTopControls(false); |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 136 | if (parent != null) { |
| 137 | parent.removeView(this); |
| 138 | } |
Vivek Sekhar | 8a66078 | 2014-10-27 17:00:53 -0700 | [diff] [blame] | 139 | mContentView.addView(this, makeLayoutParams()); |
| 140 | mBaseUi.setContentViewMarginTop(0); |
Michael Kolb | 57059a8 | 2012-04-30 14:32:03 -0700 | [diff] [blame] | 141 | } |
| 142 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 143 | public BaseUi getUi() { |
| 144 | return mBaseUi; |
| 145 | } |
| 146 | |
| 147 | public UiController getUiController() { |
| 148 | return mUiController; |
| 149 | } |
| 150 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 151 | void setShowProgressOnly(boolean progress) { |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 152 | if (progress && !wantsToBeVisible()) { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 153 | mNavBar.setVisibility(View.GONE); |
| 154 | } else { |
| 155 | mNavBar.setVisibility(View.VISIBLE); |
| 156 | } |
| 157 | } |
| 158 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 159 | boolean isShowing() { |
| 160 | return mShowing; |
| 161 | } |
| 162 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 163 | private int getVisibleTitleHeight() { |
| 164 | Tab tab = mBaseUi.getActiveTab(); |
| 165 | WebView webview = tab != null ? tab.getWebView() : null; |
| 166 | return webview != null ? webview.getVisibleTitleHeight() : 0; |
| 167 | } |
| 168 | |
Vivek Sekhar | e337acf | 2015-04-02 21:00:48 -0700 | [diff] [blame] | 169 | protected void hideTopControls(boolean animate) { |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame] | 170 | if (mIsFixedTitleBar) |
| 171 | return; |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 172 | Tab tab = mBaseUi.getActiveTab(); |
| 173 | WebView view = tab != null ? tab.getWebView() : null; |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame] | 174 | if (view != null) { |
Vivek Sekhar | e337acf | 2015-04-02 21:00:48 -0700 | [diff] [blame] | 175 | view.updateTopControls(true, false, animate); |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame] | 176 | } |
| 177 | mShowing = false; |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 178 | } |
| 179 | |
Vivek Sekhar | e337acf | 2015-04-02 21:00:48 -0700 | [diff] [blame] | 180 | protected void showTopControls(boolean animate) { |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 181 | Tab tab = mBaseUi.getActiveTab(); |
| 182 | WebView view = tab != null ? tab.getWebView() : null; |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame] | 183 | if (view != null) { |
Vivek Sekhar | e337acf | 2015-04-02 21:00:48 -0700 | [diff] [blame] | 184 | view.updateTopControls(false, true, animate); |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame] | 185 | } |
| 186 | mShowing = true; |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 187 | } |
| 188 | |
Vivek Sekhar | e337acf | 2015-04-02 21:00:48 -0700 | [diff] [blame] | 189 | protected void enableTopControls(boolean animate) { |
Pankaj Garg | 8d2e98f | 2015-08-07 10:01:49 -0700 | [diff] [blame] | 190 | if (mIsFixedTitleBar || mNavBar.getTrustLevel() == SiteTileView.TRUST_AVOID |
| 191 | || mNavBar.getTrustLevel() == SiteTileView.TRUST_UNTRUSTED) |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame] | 192 | return; |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 193 | Tab tab = mBaseUi.getActiveTab(); |
| 194 | WebView view = tab != null ? tab.getWebView() : null; |
| 195 | if (view != null) |
Vivek Sekhar | e337acf | 2015-04-02 21:00:48 -0700 | [diff] [blame] | 196 | view.updateTopControls(true, true, animate); |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 200 | /** |
| 201 | * Update the progress, from 0 to 100. |
| 202 | */ |
| 203 | public void setProgress(int newProgress) { |
| 204 | if (newProgress >= PROGRESS_MAX) { |
| 205 | mProgress.setProgress(PageProgressView.MAX_PROGRESS); |
| 206 | mProgress.setVisibility(View.GONE); |
| 207 | mInLoad = false; |
| 208 | mNavBar.onProgressStopped(); |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 209 | //onPageFinished |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame] | 210 | enableTopControls(true); |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 211 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 212 | } else { |
| 213 | if (!mInLoad) { |
| 214 | mProgress.setVisibility(View.VISIBLE); |
| 215 | mInLoad = true; |
| 216 | mNavBar.onProgressStarted(); |
Kulanthaivel Palanichamy | 7794268 | 2014-10-28 11:52:06 -0700 | [diff] [blame] | 217 | mProgress.onProgressStarted(); |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 218 | //onPageStarted |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 219 | } |
| 220 | mProgress.setProgress(newProgress * PageProgressView.MAX_PROGRESS |
| 221 | / PROGRESS_MAX); |
Vivek Sekhar | e337acf | 2015-04-02 21:00:48 -0700 | [diff] [blame] | 222 | showTopControls(false); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 223 | } |
| 224 | } |
| 225 | |
| 226 | public int getEmbeddedHeight() { |
Vivek Sekhar | 3bec6a3 | 2014-10-22 17:03:42 -0700 | [diff] [blame] | 227 | if (mIsFixedTitleBar) return 0; |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 228 | return calculateEmbeddedHeight(); |
| 229 | } |
| 230 | |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 231 | public boolean isFixed() { |
| 232 | return mIsFixedTitleBar; |
| 233 | } |
| 234 | |
| 235 | int calculateEmbeddedHeight() { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 236 | int height = mNavBar.getHeight(); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 237 | return height; |
| 238 | } |
| 239 | |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 240 | public boolean wantsToBeVisible() { |
Bijan Amirzada | 289e1e6 | 2014-04-15 11:53:48 -0700 | [diff] [blame] | 241 | return (mSnapshotBar != null && mSnapshotBar.getVisibility() == View.VISIBLE |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 242 | && mSnapshotBar.isAnimating()); |
| 243 | } |
| 244 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 245 | public boolean isEditingUrl() { |
| 246 | return mNavBar.isEditingUrl(); |
| 247 | } |
| 248 | |
| 249 | public WebView getCurrentWebView() { |
| 250 | Tab t = mBaseUi.getActiveTab(); |
| 251 | if (t != null) { |
| 252 | return t.getWebView(); |
| 253 | } else { |
| 254 | return null; |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | public PageProgressView getProgressView() { |
| 259 | return mProgress; |
| 260 | } |
| 261 | |
| 262 | public NavigationBarBase getNavigationBar() { |
| 263 | return mNavBar; |
| 264 | } |
| 265 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 266 | public boolean isInLoad() { |
| 267 | return mInLoad; |
| 268 | } |
| 269 | |
| 270 | private ViewGroup.LayoutParams makeLayoutParams() { |
Michael Kolb | 4923c22 | 2012-04-02 16:18:36 -0700 | [diff] [blame] | 271 | return new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, |
| 272 | LayoutParams.WRAP_CONTENT); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | @Override |
Panos Thomas | 752ce59 | 2014-10-16 13:00:35 -0700 | [diff] [blame] | 276 | public boolean requestFocus(int direction, Rect previouslyFocusedRect) { |
| 277 | return mBaseUi.isCustomViewShowing() ? false : |
| 278 | super.requestFocus(direction, previouslyFocusedRect); |
| 279 | } |
| 280 | |
| 281 | @Override |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 282 | public View focusSearch(View focused, int dir) { |
John Reck | fcb6095 | 2012-05-30 09:45:28 -0700 | [diff] [blame] | 283 | WebView web = getCurrentWebView(); |
John Reck | d70419a | 2012-05-30 16:09:17 -0700 | [diff] [blame] | 284 | if (FOCUS_DOWN == dir && hasFocus() && web != null |
John Reck | fcb6095 | 2012-05-30 09:45:28 -0700 | [diff] [blame] | 285 | && web.hasFocusable() && web.getParent() != null) { |
| 286 | return web; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 287 | } |
| 288 | return super.focusSearch(focused, dir); |
| 289 | } |
| 290 | |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 291 | public void onTabDataChanged(Tab tab) { |
Ben Murdoch | d51bb57 | 2011-08-17 20:42:02 +0100 | [diff] [blame] | 292 | if (mSnapshotBar != null) { |
| 293 | mSnapshotBar.onTabDataChanged(tab); |
| 294 | } |
| 295 | |
Ze G Riande | 2a675c2 | 2015-06-03 11:15:24 -0700 | [diff] [blame] | 296 | if (tab.isSnapshot() || tab.isDistilled()) { |
Ben Murdoch | d51bb57 | 2011-08-17 20:42:02 +0100 | [diff] [blame] | 297 | inflateSnapshotBar(); |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 298 | mSnapshotBar.setVisibility(VISIBLE); |
| 299 | mNavBar.setVisibility(GONE); |
Ze G Riande | 2a675c2 | 2015-06-03 11:15:24 -0700 | [diff] [blame] | 300 | if (tab.isDistilled()) { |
| 301 | mSnapshotBar.setTitle(tab.getWebView().getTitle()); |
| 302 | mSnapshotBar.setDate(tab.getNonDistilledUrl()); |
| 303 | mSnapshotBar.setSnapshoticonVisibility(View.GONE); |
| 304 | mSnapshotBar.setFaviconVisibility(View.GONE); |
| 305 | mSnapshotBar.setReadericonVisibility(View.VISIBLE); |
| 306 | } else { |
| 307 | mSnapshotBar.setSnapshoticonVisibility(View.VISIBLE); |
Sagar Dhawan | 9023614 | 2015-07-24 14:16:38 -0700 | [diff] [blame] | 308 | mSnapshotBar.setFaviconVisibility(View.GONE); // Snapshot Tabs don't have a Favicon |
Ze G Riande | 2a675c2 | 2015-06-03 11:15:24 -0700 | [diff] [blame] | 309 | mSnapshotBar.setReadericonVisibility(View.GONE); |
| 310 | } |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 311 | } else { |
Ben Murdoch | d51bb57 | 2011-08-17 20:42:02 +0100 | [diff] [blame] | 312 | if (mSnapshotBar != null) { |
| 313 | mSnapshotBar.setVisibility(GONE); |
| 314 | } |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 315 | mNavBar.setVisibility(VISIBLE); |
| 316 | } |
| 317 | } |
| 318 | |
Michael Kolb | 4923c22 | 2012-04-02 16:18:36 -0700 | [diff] [blame] | 319 | public void onScrollChanged() { |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 320 | if (!mShowing && !mIsFixedTitleBar) { |
Michael Kolb | 4923c22 | 2012-04-02 16:18:36 -0700 | [diff] [blame] | 321 | setTranslationY(getVisibleTitleHeight() - getEmbeddedHeight()); |
| 322 | } |
| 323 | } |
| 324 | |
John Reck | 1cc1d1d | 2012-09-04 18:13:51 -0700 | [diff] [blame] | 325 | public void onResume() { |
| 326 | setFixedTitleBar(); |
| 327 | } |
| 328 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 329 | } |