add tab switch animations
Bug: 3446585
Bug: 3281140
Cross fade between the current and the new tab
Change-Id: I403e40b02e3f77806dc5ed3ebecd01afc508f68f
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index bca999d..93b0ec8 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -18,6 +18,8 @@
import com.android.browser.Tab.LockIcon;
+import android.animation.Animator;
+import android.animation.Animator.AnimatorListener;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.res.Configuration;
@@ -67,7 +69,7 @@
Activity mActivity;
UiController mUiController;
TabControl mTabControl;
- private Tab mActiveTab;
+ protected Tab mActiveTab;
private InputMethodManager mInputManager;
private Drawable mSecLockIcon;
@@ -220,12 +222,18 @@
}
@Override
- public void setActiveTab(Tab tab) {
+ public void setActiveTab(final Tab tab) {
+ setActiveTab(tab, true);
+ }
+
+ void setActiveTab(Tab tab, boolean needsAttaching) {
if ((tab != mActiveTab) && (mActiveTab != null)) {
removeTabFromContentView(mActiveTab);
}
mActiveTab = tab;
- attachTabToContentView(tab);
+ if (needsAttaching) {
+ attachTabToContentView(tab);
+ }
setShouldShowErrorConsole(tab, mUiController.shouldShowErrorConsole());
onTabDataChanged(tab);
onProgressChanged(tab);
@@ -259,7 +267,7 @@
attachTabToContentView(tab);
}
- private void attachTabToContentView(Tab tab) {
+ protected void attachTabToContentView(Tab tab) {
if ((tab == null) || (tab.getWebView() == null)) {
return;
}