| 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 cbf639e3c542072cd6bdd422e4932b9e7e6770aa..17505bbf3926cda814e7c42a57b5c2842df4d182 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
|
| @@ -15,7 +15,6 @@ import android.graphics.drawable.Drawable;
|
| import android.text.TextUtils;
|
| import android.util.AttributeSet;
|
| import android.util.Pair;
|
| -import android.util.TypedValue;
|
| import android.view.KeyEvent;
|
| import android.view.MotionEvent;
|
| import android.view.View;
|
| @@ -60,6 +59,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
|
| private ImageView mSecurityButton;
|
| private ImageButton mCustomActionButton;
|
| private int mSecurityIconType;
|
| + private boolean mShouldShowTitle;
|
| private boolean mUseDarkColors;
|
| private ImageButton mCloseButton;
|
|
|
| @@ -88,9 +88,9 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
|
| mSecurityButton = (ImageButton) findViewById(R.id.security_button);
|
| mSecurityIconType = ConnectionSecurityLevel.NONE;
|
| mCustomActionButton = (ImageButton) findViewById(R.id.action_button);
|
| + mCustomActionButton.setOnLongClickListener(this);
|
| mCloseButton = (ImageButton) findViewById(R.id.close_button);
|
| mCloseButton.setOnLongClickListener(this);
|
| - mCustomActionButton.setOnLongClickListener(this);
|
| mAnimDelegate = new CustomTabToolbarAnimationDelegate(mSecurityButton, mTitleUrlContainer);
|
| }
|
|
|
| @@ -186,11 +186,8 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
|
|
|
| @Override
|
| public void setShowTitle(boolean showTitle) {
|
| - int titleVisibility = showTitle ? VISIBLE : GONE;
|
| - int urlTextSizeId = showTitle
|
| - ? R.dimen.custom_tabs_url_text_size : R.dimen.location_bar_url_text_size;
|
| - mTitleBar.setVisibility(titleVisibility);
|
| - mUrlBar.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(urlTextSizeId));
|
| + mShouldShowTitle = showTitle;
|
| + if (mShouldShowTitle) mAnimDelegate.prepareTitleAnim(mUrlBar, mTitleBar);
|
| }
|
|
|
| @Override
|
| @@ -200,6 +197,13 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
|
| mTitleBar.setText("");
|
| return;
|
| }
|
| +
|
| + // It takes some time to parse the title of the webcontent, and before that Tab#getTitle
|
| + // always return the url. We postpone the title animation until the title is authentic.
|
| + if (mShouldShowTitle && !TextUtils.equals(currentTab.getTitle(), currentTab.getUrl())) {
|
| + mAnimDelegate.startTitleAnimation(getContext());
|
| + }
|
| +
|
| mTitleBar.setText(currentTab.getTitle());
|
| }
|
|
|
|
|