OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.toolbar; | 5 package org.chromium.chrome.browser.toolbar; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.graphics.Canvas; | 8 import android.graphics.Canvas; |
9 import android.graphics.Rect; | 9 import android.graphics.Rect; |
10 import android.graphics.drawable.Drawable; | 10 import android.graphics.drawable.Drawable; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } | 307 } |
308 | 308 |
309 super.updateToolbarBackground(visualState); | 309 super.updateToolbarBackground(visualState); |
310 } | 310 } |
311 | 311 |
312 @Override | 312 @Override |
313 protected boolean shouldHideEndToolbarButtons() { | 313 protected boolean shouldHideEndToolbarButtons() { |
314 return mShouldHideEndToolbarButtons; | 314 return mShouldHideEndToolbarButtons; |
315 } | 315 } |
316 | 316 |
| 317 @Override |
| 318 protected void onHomeButtonUpdate(boolean homeButtonEnabled) { |
| 319 // Intentionally does not call super. Chrome Home does not support a hom
e button. |
| 320 } |
| 321 |
317 /** | 322 /** |
318 * Sets the height and title text appearance of the provided toolbar so that
its style is | 323 * Sets the height and title text appearance of the provided toolbar so that
its style is |
319 * consistent with BottomToolbarPhone. | 324 * consistent with BottomToolbarPhone. |
320 * @param otherToolbar The other {@link Toolbar} to style. | 325 * @param otherToolbar The other {@link Toolbar} to style. |
321 */ | 326 */ |
322 public void setOtherToolbarStyle(Toolbar otherToolbar) { | 327 public void setOtherToolbarStyle(Toolbar otherToolbar) { |
323 // Android's Toolbar class typically changes its height based on device
orientation. | 328 // Android's Toolbar class typically changes its height based on device
orientation. |
324 // BottomToolbarPhone has a fixed height. Update |toolbar| to match. | 329 // BottomToolbarPhone has a fixed height. Update |toolbar| to match. |
325 otherToolbar.getLayoutParams().height = getHeight(); | 330 otherToolbar.getLayoutParams().height = getHeight(); |
326 | 331 |
327 // Android Toolbar action buttons are aligned based on the minimum heigh
t. | 332 // Android Toolbar action buttons are aligned based on the minimum heigh
t. |
328 int extraTopMargin = getExtraTopMargin(); | 333 int extraTopMargin = getExtraTopMargin(); |
329 otherToolbar.setMinimumHeight(getHeight() - extraTopMargin); | 334 otherToolbar.setMinimumHeight(getHeight() - extraTopMargin); |
330 | 335 |
331 otherToolbar.setTitleTextAppearance( | 336 otherToolbar.setTitleTextAppearance( |
332 otherToolbar.getContext(), R.style.BottomSheetContentTitle); | 337 otherToolbar.getContext(), R.style.BottomSheetContentTitle); |
333 ApiCompatibilityUtils.setPaddingRelative(otherToolbar, | 338 ApiCompatibilityUtils.setPaddingRelative(otherToolbar, |
334 ApiCompatibilityUtils.getPaddingStart(otherToolbar), | 339 ApiCompatibilityUtils.getPaddingStart(otherToolbar), |
335 otherToolbar.getPaddingTop() + extraTopMargin, | 340 otherToolbar.getPaddingTop() + extraTopMargin, |
336 ApiCompatibilityUtils.getPaddingEnd(otherToolbar), otherToolbar.
getPaddingBottom()); | 341 ApiCompatibilityUtils.getPaddingEnd(otherToolbar), otherToolbar.
getPaddingBottom()); |
337 | 342 |
338 otherToolbar.requestLayout(); | 343 otherToolbar.requestLayout(); |
339 } | 344 } |
340 } | 345 } |
OLD | NEW |