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

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

Issue 2623583002: Fix title and url animation for media in CCT (Closed)
Patch Set: Changed to stateful Created 3 years, 11 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 | « chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java ('k') | 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/CustomTabToolbar.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
index 7b4249ea04dbdd05fd1fb983977fdd19cf72f0c4..8bbaf2785cb8b8803f1f9faa0da26a3ea0646dad 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
@@ -109,6 +109,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
private static final int STATE_DOMAIN_ONLY = 0;
private static final int STATE_TITLE_ONLY = 1;
private static final int STATE_DOMAIN_AND_TITLE = 2;
+ private static final int STATE_DOMAIN_AND_TITLE_NO_ANIM = 3;
private View mLocationBarFrameLayout;
private View mTitleUrlContainer;
@@ -259,6 +260,8 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
@Override
public void setShowTitle(boolean showTitle) {
+ if (mState == STATE_DOMAIN_AND_TITLE_NO_ANIM) return;
+
if (showTitle) {
mState = STATE_DOMAIN_AND_TITLE;
mAnimDelegate.prepareTitleAnim(mUrlBar, mTitleBar);
@@ -382,7 +385,25 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
}
}
- if (mUrlBar.setUrl(url, displayText)) {
+ boolean showUrl = true;
+
+ // For media viewer, title animation is disabled. Hence, set the URL and title bars to their
+ // final size.
+ if (mState == STATE_DOMAIN_AND_TITLE_NO_ANIM) {
+ mUrlBar.setTextSize(TypedValue.COMPLEX_UNIT_PX,
+ getResources().getDimension(R.dimen.custom_tabs_url_text_size));
+ mTitleBar.setTextSize(TypedValue.COMPLEX_UNIT_PX,
+ getResources().getDimension(R.dimen.custom_tabs_title_text_size));
+ mUrlBar.setVisibility(View.VISIBLE);
+ mTitleBar.setVisibility(View.VISIBLE);
+
+ // Show both url and title at the same time, or none if not available yet.
+ if (TextUtils.isEmpty(getCurrentTab().getTitle())) {
Ian Wen 2017/01/10 20:04:52 How can we guarantee that the urlbar will be shown
+ showUrl = false;
+ }
+ }
+
+ if (showUrl && mUrlBar.setUrl(url, displayText)) {
mUrlBar.deEmphasizeUrl();
mUrlBar.emphasizeUrl();
}
@@ -426,6 +447,10 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
R.color.progress_bar_foreground));
}
}
+
+ if (mState == STATE_DOMAIN_AND_TITLE_NO_ANIM) {
+ getProgressBar().setVisibility(View.INVISIBLE);
+ }
}
private void updateButtonsTint() {
@@ -486,6 +511,10 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
WindowAndroid windowAndroid) {
}
+ public void disableTitleAnimation() {
Ian Wen 2017/01/10 20:04:52 javadoc on public method. Besides, I would move th
+ mState = STATE_DOMAIN_AND_TITLE_NO_ANIM;
+ }
+
private int getSecurityLevel() {
if (getCurrentTab() == null) return ConnectionSecurityLevel.NONE;
return getCurrentTab().getSecurityLevel();
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698