summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-03-14 11:29:56 -0700
committerJohn Reck <jreck@google.com>2011-03-14 11:51:18 -0700
commit6e8d2e9d32bc03ecd5ee2efffb0df260d10533d4 (patch)
tree990bbc0297a298c49a6648843f970f235fb39dfe /src
parent74830e168f578bb511240f95d373667565f0623f (diff)
downloadpackages_apps_Browser-6e8d2e9d32bc03ecd5ee2efffb0df260d10533d4.zip
packages_apps_Browser-6e8d2e9d32bc03ecd5ee2efffb0df260d10533d4.tar.gz
packages_apps_Browser-6e8d2e9d32bc03ecd5ee2efffb0df260d10533d4.tar.bz2
Fix tab switching corner cases
Bug: 4089739 This fixes the issue where the url bar can get in a state where it is visible regardless of scrolling or tab switching. Change-Id: Id33e4766ecfb1470187de1c79135881050ec8f74
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/XLargeUi.java59
1 files changed, 39 insertions, 20 deletions
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index 9023f17..991798f 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -51,6 +51,7 @@ public class XLargeUi extends BaseUi implements ScrollListener {
private TitleBarXLarge mTitleBar;
private Animator mTitleBarAnimator;
+ private boolean mSkipTitleBarAnimations;
private boolean mUseQuickControls;
private PieControl mPieControl;
@@ -224,6 +225,8 @@ public class XLargeUi extends BaseUi implements ScrollListener {
@Override
public void setActiveTab(final Tab tab) {
+ cancelTitleBarAnimation(true);
+ mSkipTitleBarAnimations = true;
if (mUseQuickControls) {
if (mActiveTab != null) {
captureTab(mActiveTab);
@@ -231,6 +234,7 @@ public class XLargeUi extends BaseUi implements ScrollListener {
}
super.setActiveTab(tab, true);
setActiveTab(tab, true);
+ mSkipTitleBarAnimations = false;
}
@Override
@@ -281,8 +285,11 @@ public class XLargeUi extends BaseUi implements ScrollListener {
@Override
public void removeTab(Tab tab) {
+ cancelTitleBarAnimation(true);
+ mSkipTitleBarAnimations = true;
super.removeTab(tab);
mTabBar.onRemoveTab(tab);
+ mSkipTitleBarAnimations = false;
}
protected void onRemoveTabCompleted(Tab tab) {
@@ -321,18 +328,18 @@ public class XLargeUi extends BaseUi implements ScrollListener {
if (mUseQuickControls) {
mContentView.addView(mTitleBar);
} else {
- if (mTitleBarAnimator != null) {
- mTitleBarAnimator.cancel();
- }
- int visibleHeight = getVisibleTitleHeight();
- float startPos = (-mTitleBar.getEmbeddedHeight() + visibleHeight);
- if (mTitleBar.getTranslationY() != 0) {
- startPos = Math.max(startPos, mTitleBar.getTranslationY());
+ if (!mSkipTitleBarAnimations) {
+ cancelTitleBarAnimation(false);
+ int visibleHeight = getVisibleTitleHeight();
+ float startPos = (-mTitleBar.getEmbeddedHeight() + visibleHeight);
+ if (mTitleBar.getTranslationY() != 0) {
+ startPos = Math.max(startPos, mTitleBar.getTranslationY());
+ }
+ mTitleBarAnimator = ObjectAnimator.ofFloat(mTitleBar,
+ "translationY",
+ startPos, 0);
+ mTitleBarAnimator.start();
}
- mTitleBarAnimator = ObjectAnimator.ofFloat(mTitleBar,
- "translationY",
- startPos, 0);
- mTitleBarAnimator.start();
setTitleGravity(Gravity.TOP);
}
super.showTitleBar();
@@ -347,20 +354,32 @@ public class XLargeUi extends BaseUi implements ScrollListener {
if (mUseQuickControls) {
mContentView.removeView(mTitleBar);
} else {
- if (mTitleBarAnimator != null) {
- mTitleBarAnimator.cancel();
+ if (!mSkipTitleBarAnimations) {
+ cancelTitleBarAnimation(false);
+ int visibleHeight = getVisibleTitleHeight();
+ mTitleBarAnimator = ObjectAnimator.ofFloat(mTitleBar,
+ "translationY", mTitleBar.getTranslationY(),
+ (-mTitleBar.getEmbeddedHeight() + visibleHeight));
+ mTitleBarAnimator.addListener(mHideTileBarAnimatorListener);
+ mTitleBarAnimator.start();
+ } else {
+ setTitleGravity(Gravity.NO_GRAVITY);
}
- int visibleHeight = getVisibleTitleHeight();
- mTitleBarAnimator = ObjectAnimator.ofFloat(mTitleBar,
- "translationY", mTitleBar.getTranslationY(),
- (-mTitleBar.getEmbeddedHeight() + visibleHeight));
- mTitleBarAnimator.addListener(mHideTileBarAnimatorListener);
- mTitleBarAnimator.start();
}
super.hideTitleBar();
}
}
+ private void cancelTitleBarAnimation(boolean reset) {
+ if (mTitleBarAnimator != null) {
+ mTitleBarAnimator.cancel();
+ mTitleBarAnimator = null;
+ }
+ if (reset) {
+ mTitleBar.setTranslationY(0);
+ }
+ }
+
private int getVisibleTitleHeight() {
WebView webview = mActiveTab != null ? mActiveTab.getWebView() : null;
return webview != null ? webview.getVisibleTitleHeight() : 0;
@@ -382,8 +401,8 @@ public class XLargeUi extends BaseUi implements ScrollListener {
public void onAnimationEnd(Animator animation) {
if (!mWasCanceled) {
mTitleBar.setTranslationY(0);
- setTitleGravity(Gravity.NO_GRAVITY);
}
+ setTitleGravity(Gravity.NO_GRAVITY);
}
@Override