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) { |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame^] | 190 | if (mIsFixedTitleBar) |
| 191 | return; |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 192 | Tab tab = mBaseUi.getActiveTab(); |
| 193 | WebView view = tab != null ? tab.getWebView() : null; |
| 194 | if (view != null) |
Vivek Sekhar | e337acf | 2015-04-02 21:00:48 -0700 | [diff] [blame] | 195 | view.updateTopControls(true, true, animate); |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 199 | /** |
| 200 | * Update the progress, from 0 to 100. |
| 201 | */ |
| 202 | public void setProgress(int newProgress) { |
| 203 | if (newProgress >= PROGRESS_MAX) { |
| 204 | mProgress.setProgress(PageProgressView.MAX_PROGRESS); |
| 205 | mProgress.setVisibility(View.GONE); |
| 206 | mInLoad = false; |
| 207 | mNavBar.onProgressStopped(); |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 208 | //onPageFinished |
Vivek Sekhar | d4de616 | 2015-07-21 15:01:45 -0700 | [diff] [blame^] | 209 | enableTopControls(true); |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 210 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 211 | } else { |
| 212 | if (!mInLoad) { |
| 213 | mProgress.setVisibility(View.VISIBLE); |
| 214 | mInLoad = true; |
| 215 | mNavBar.onProgressStarted(); |
Kulanthaivel Palanichamy | 7794268 | 2014-10-28 11:52:06 -0700 | [diff] [blame] | 216 | mProgress.onProgressStarted(); |
Tarun Nainani | 8eb0091 | 2014-07-17 12:28:32 -0700 | [diff] [blame] | 217 | //onPageStarted |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 218 | } |
| 219 | mProgress.setProgress(newProgress * PageProgressView.MAX_PROGRESS |
| 220 | / PROGRESS_MAX); |
Vivek Sekhar | e337acf | 2015-04-02 21:00:48 -0700 | [diff] [blame] | 221 | showTopControls(false); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 222 | } |
| 223 | } |
| 224 | |
| 225 | public int getEmbeddedHeight() { |
Vivek Sekhar | 3bec6a3 | 2014-10-22 17:03:42 -0700 | [diff] [blame] | 226 | if (mIsFixedTitleBar) return 0; |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 227 | return calculateEmbeddedHeight(); |
| 228 | } |
| 229 | |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 230 | public boolean isFixed() { |
| 231 | return mIsFixedTitleBar; |
| 232 | } |
| 233 | |
| 234 | int calculateEmbeddedHeight() { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 235 | int height = mNavBar.getHeight(); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 236 | return height; |
| 237 | } |
| 238 | |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 239 | public boolean wantsToBeVisible() { |
Bijan Amirzada | 289e1e6 | 2014-04-15 11:53:48 -0700 | [diff] [blame] | 240 | return (mSnapshotBar != null && mSnapshotBar.getVisibility() == View.VISIBLE |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 241 | && mSnapshotBar.isAnimating()); |
| 242 | } |
| 243 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 244 | public boolean isEditingUrl() { |
| 245 | return mNavBar.isEditingUrl(); |
| 246 | } |
| 247 | |
| 248 | public WebView getCurrentWebView() { |
| 249 | Tab t = mBaseUi.getActiveTab(); |
| 250 | if (t != null) { |
| 251 | return t.getWebView(); |
| 252 | } else { |
| 253 | return null; |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | public PageProgressView getProgressView() { |
| 258 | return mProgress; |
| 259 | } |
| 260 | |
| 261 | public NavigationBarBase getNavigationBar() { |
| 262 | return mNavBar; |
| 263 | } |
| 264 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 265 | public boolean isInLoad() { |
| 266 | return mInLoad; |
| 267 | } |
| 268 | |
| 269 | private ViewGroup.LayoutParams makeLayoutParams() { |
Michael Kolb | 4923c22 | 2012-04-02 16:18:36 -0700 | [diff] [blame] | 270 | return new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, |
| 271 | LayoutParams.WRAP_CONTENT); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | @Override |
Panos Thomas | 752ce59 | 2014-10-16 13:00:35 -0700 | [diff] [blame] | 275 | public boolean requestFocus(int direction, Rect previouslyFocusedRect) { |
| 276 | return mBaseUi.isCustomViewShowing() ? false : |
| 277 | super.requestFocus(direction, previouslyFocusedRect); |
| 278 | } |
| 279 | |
| 280 | @Override |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 281 | public View focusSearch(View focused, int dir) { |
John Reck | fcb6095 | 2012-05-30 09:45:28 -0700 | [diff] [blame] | 282 | WebView web = getCurrentWebView(); |
John Reck | d70419a | 2012-05-30 16:09:17 -0700 | [diff] [blame] | 283 | if (FOCUS_DOWN == dir && hasFocus() && web != null |
John Reck | fcb6095 | 2012-05-30 09:45:28 -0700 | [diff] [blame] | 284 | && web.hasFocusable() && web.getParent() != null) { |
| 285 | return web; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 286 | } |
| 287 | return super.focusSearch(focused, dir); |
| 288 | } |
| 289 | |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 290 | public void onTabDataChanged(Tab tab) { |
Ben Murdoch | d51bb57 | 2011-08-17 20:42:02 +0100 | [diff] [blame] | 291 | if (mSnapshotBar != null) { |
| 292 | mSnapshotBar.onTabDataChanged(tab); |
| 293 | } |
| 294 | |
Ze G Riande | 2a675c2 | 2015-06-03 11:15:24 -0700 | [diff] [blame] | 295 | if (tab.isSnapshot() || tab.isDistilled()) { |
Ben Murdoch | d51bb57 | 2011-08-17 20:42:02 +0100 | [diff] [blame] | 296 | inflateSnapshotBar(); |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 297 | mSnapshotBar.setVisibility(VISIBLE); |
| 298 | mNavBar.setVisibility(GONE); |
Ze G Riande | 2a675c2 | 2015-06-03 11:15:24 -0700 | [diff] [blame] | 299 | if (tab.isDistilled()) { |
| 300 | mSnapshotBar.setTitle(tab.getWebView().getTitle()); |
| 301 | mSnapshotBar.setDate(tab.getNonDistilledUrl()); |
| 302 | mSnapshotBar.setSnapshoticonVisibility(View.GONE); |
| 303 | mSnapshotBar.setFaviconVisibility(View.GONE); |
| 304 | mSnapshotBar.setReadericonVisibility(View.VISIBLE); |
| 305 | } else { |
| 306 | mSnapshotBar.setSnapshoticonVisibility(View.VISIBLE); |
| 307 | mSnapshotBar.setFaviconVisibility(View.VISIBLE); |
| 308 | mSnapshotBar.setReadericonVisibility(View.GONE); |
| 309 | } |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 310 | } else { |
Ben Murdoch | d51bb57 | 2011-08-17 20:42:02 +0100 | [diff] [blame] | 311 | if (mSnapshotBar != null) { |
| 312 | mSnapshotBar.setVisibility(GONE); |
| 313 | } |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 314 | mNavBar.setVisibility(VISIBLE); |
| 315 | } |
| 316 | } |
| 317 | |
Michael Kolb | 4923c22 | 2012-04-02 16:18:36 -0700 | [diff] [blame] | 318 | public void onScrollChanged() { |
John Reck | 2711fab | 2012-05-18 21:38:59 -0700 | [diff] [blame] | 319 | if (!mShowing && !mIsFixedTitleBar) { |
Michael Kolb | 4923c22 | 2012-04-02 16:18:36 -0700 | [diff] [blame] | 320 | setTranslationY(getVisibleTitleHeight() - getEmbeddedHeight()); |
| 321 | } |
| 322 | } |
| 323 | |
John Reck | 1cc1d1d | 2012-09-04 18:13:51 -0700 | [diff] [blame] | 324 | public void onResume() { |
| 325 | setFixedTitleBar(); |
| 326 | } |
| 327 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 328 | } |