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.omnibox; | 5 package org.chromium.chrome.browser.omnibox; |
6 | 6 |
7 import android.animation.Animator; | 7 import android.animation.Animator; |
8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
9 import android.animation.ObjectAnimator; | 9 import android.animation.ObjectAnimator; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 boolean showBookmarkButton = | 270 boolean showBookmarkButton = |
271 mShouldShowButtonsWhenUnfocused && shouldShowPageActionButtons()
; | 271 mShouldShowButtonsWhenUnfocused && shouldShowPageActionButtons()
; |
272 mBookmarkButton.setVisibility(showBookmarkButton ? View.VISIBLE : View.G
ONE); | 272 mBookmarkButton.setVisibility(showBookmarkButton ? View.VISIBLE : View.G
ONE); |
273 | 273 |
274 boolean showSaveOfflineButton = | 274 boolean showSaveOfflineButton = |
275 mShouldShowButtonsWhenUnfocused && shouldShowSaveOfflineButton()
; | 275 mShouldShowButtonsWhenUnfocused && shouldShowSaveOfflineButton()
; |
276 mSaveOfflineButton.setVisibility(showSaveOfflineButton ? View.VISIBLE :
View.GONE); | 276 mSaveOfflineButton.setVisibility(showSaveOfflineButton ? View.VISIBLE :
View.GONE); |
277 if (showSaveOfflineButton) mSaveOfflineButton.setEnabled(isSaveOfflineBu
ttonEnabled()); | 277 if (showSaveOfflineButton) mSaveOfflineButton.setEnabled(isSaveOfflineBu
ttonEnabled()); |
278 | 278 |
279 if (!mShouldShowButtonsWhenUnfocused) { | 279 if (!mShouldShowButtonsWhenUnfocused) { |
280 updateMicButtonVisiblity(mUrlFocusChangePercent); | 280 updateMicButtonVisibility(mUrlFocusChangePercent); |
281 } else { | 281 } else { |
282 mMicButton.setVisibility(shouldShowMicButton() ? View.VISIBLE : View
.GONE); | 282 mMicButton.setVisibility(shouldShowMicButton() ? View.VISIBLE : View
.GONE); |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 @Override | 286 @Override |
287 protected void updateLayoutParams() { | 287 protected void updateLayoutParams() { |
288 // Calculate the bookmark/delete button margins. | 288 // Calculate the bookmark/delete button margins. |
289 int lastButtonSpace; | 289 int lastButtonSpace; |
290 if (mSaveOfflineButton.getVisibility() == View.VISIBLE) { | 290 if (mSaveOfflineButton.getVisibility() == View.VISIBLE) { |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 return !(mUrlBar.hasFocus() || mUrlFocusChangeInProgress); | 577 return !(mUrlBar.hasFocus() || mUrlFocusChangeInProgress); |
578 } | 578 } |
579 | 579 |
580 private boolean shouldShowMicButton() { | 580 private boolean shouldShowMicButton() { |
581 // If the download UI is enabled, the mic button should be only be shown
when the url bar | 581 // If the download UI is enabled, the mic button should be only be shown
when the url bar |
582 // is focused. | 582 // is focused. |
583 return isVoiceSearchEnabled() && mNativeInitialized | 583 return isVoiceSearchEnabled() && mNativeInitialized |
584 && (mUrlBar.hasFocus() || mUrlFocusChangeInProgress); | 584 && (mUrlBar.hasFocus() || mUrlFocusChangeInProgress); |
585 } | 585 } |
586 } | 586 } |
OLD | NEW |