Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbarAnimationDelegate.java

Issue 2024173003: [Custom Tabs] Fix a bug that security icon might show for http (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbarAnimationDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbarAnimationDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbarAnimationDelegate.java
index 583779551655080c97e76db0105ceb21873e514b..5025ff19494bc0c33ffc4315c349a7afe0aba702 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbarAnimationDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbarAnimationDelegate.java
@@ -33,6 +33,7 @@ class CustomTabToolbarAnimationDelegate {
private static final int CUSTOM_TAB_TOOLBAR_FADE_DURATION_MS = 150;
private final View mSecurityButton;
+ private final View mTitleUrlContainer;
private final AnimatorSet mSecurityButtonShowAnimator;
private final AnimatorSet mSecurityButtonHideAnimator;
@@ -46,6 +47,7 @@ class CustomTabToolbarAnimationDelegate {
*/
CustomTabToolbarAnimationDelegate(View securityButton, final View titleUrlContainer) {
mSecurityButton = securityButton;
+ mTitleUrlContainer = titleUrlContainer;
mSecurityButtonShowAnimator = new AnimatorSet();
int securityButtonWidth = securityButton.getResources()
@@ -155,22 +157,25 @@ class CustomTabToolbarAnimationDelegate {
}
/**
- * Starts the animation to show the security button. Will do nothing if the button is already
- * visible.
+ * Starts the animation to show the security button.
*/
void showSecurityButton() {
- if (mSecurityButton.getVisibility() == View.VISIBLE) return;
- if (mSecurityButtonShowAnimator.isRunning()) mSecurityButtonShowAnimator.cancel();
+ if (mSecurityButtonShowAnimator.isStarted()) return;
mSecurityButtonShowAnimator.start();
}
/**
- * Starts the animation to hide the security button. Will do nothing if the button is not
- * visible.
+ * Starts the animation to hide the security button.
*/
void hideSecurityButton() {
- if (mSecurityButton.getVisibility() == View.GONE) return;
- if (mSecurityButtonHideAnimator.isRunning()) return;
+ // An optimization for the case that show and hide are called almost at the same time.
+ if (mSecurityButtonShowAnimator.isStarted()
+ && mSecurityButton.getVisibility() == View.GONE) {
+ mSecurityButtonShowAnimator.cancel();
+ mTitleUrlContainer.setTranslationX(0);
+ return;
+ }
+ if (mSecurityButtonHideAnimator.isStarted()) return;
mSecurityButtonHideAnimator.start();
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698