OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.compositor.bottombar.readermode; | 5 package org.chromium.chrome.browser.compositor.bottombar.readermode; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 | 8 |
9 import org.chromium.chrome.R; | 9 import org.chromium.chrome.R; |
10 import org.chromium.chrome.browser.compositor.LayerTitleCache; | 10 import org.chromium.chrome.browser.compositor.LayerTitleCache; |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 public float getOffsetY() { | 304 public float getOffsetY() { |
305 // Do not attempt to auto-hide the reader mode bar if the toolbar is les
s than a certain | 305 // Do not attempt to auto-hide the reader mode bar if the toolbar is les
s than a certain |
306 // height. | 306 // height. |
307 boolean shouldAutoHide = getToolbarHeight() >= getBarHeightPeeking(); | 307 boolean shouldAutoHide = getToolbarHeight() >= getBarHeightPeeking(); |
308 // This will cause the reader mode bar to behave like the top controls;
sliding out of | 308 // This will cause the reader mode bar to behave like the top controls;
sliding out of |
309 // view as the page scrolls. | 309 // view as the page scrolls. |
310 return super.getOffsetY() + (shouldAutoHide ? getTopControlsOffsetDp() :
0.0f); | 310 return super.getOffsetY() + (shouldAutoHide ? getTopControlsOffsetDp() :
0.0f); |
311 } | 311 } |
312 | 312 |
313 @Override | 313 @Override |
314 public void onSizeChanged(float width, float height) { | 314 public void onLayoutChanged(float width, float height, float visibleViewport
OffsetY) { |
315 super.onSizeChanged(width, height); | 315 super.onLayoutChanged(width, height, visibleViewportOffsetY); |
316 if (mManagerDelegate != null) { | 316 if (mManagerDelegate != null) { |
317 mManagerDelegate.onSizeChanged(); | 317 mManagerDelegate.onLayoutChanged(); |
318 } | 318 } |
319 } | 319 } |
320 | 320 |
321 @Override | 321 @Override |
322 protected float calculateBasePageDesiredOffset() { | 322 protected float calculateBasePageDesiredOffset() { |
323 return -getToolbarHeight(); | 323 return -getToolbarHeight(); |
324 } | 324 } |
325 | 325 |
326 // =========================================================================
=================== | 326 // =========================================================================
=================== |
327 // ReaderModeBarControl | 327 // ReaderModeBarControl |
(...skipping 28 matching lines...) Expand all Loading... |
356 /** | 356 /** |
357 * Destroys the ReaderModeBarControl. | 357 * Destroys the ReaderModeBarControl. |
358 */ | 358 */ |
359 protected void destroyReaderModeBarControl() { | 359 protected void destroyReaderModeBarControl() { |
360 if (mReaderModeBarControl != null) { | 360 if (mReaderModeBarControl != null) { |
361 mReaderModeBarControl.destroy(); | 361 mReaderModeBarControl.destroy(); |
362 mReaderModeBarControl = null; | 362 mReaderModeBarControl = null; |
363 } | 363 } |
364 } | 364 } |
365 } | 365 } |
OLD | NEW |