OSDN Git Service

Show the new tab when creating it from the bookmarks/history.
authorPatrick Scott <phanna@android.com>
Tue, 14 Jul 2009 14:49:22 +0000 (10:49 -0400)
committerPatrick Scott <phanna@android.com>
Tue, 14 Jul 2009 14:53:30 +0000 (10:53 -0400)
When we are in the tab picker and a new tab is created from bookmarks/history,
show the new tab in the picker and then animate to it. Only do this for the
"open tabs in background" setting since openTab() will show the tab if that
setting is false.

We animate to the new tab because we currently don't have a way to show the new
tab in the tab picker with updated picker data (title and url in particular).
So instead of showing a blank tab, animate to the tab. Once the animations have
been redesigned and the code refactored, this will hopefully get better.

src/com/android/browser/BrowserActivity.java
src/com/android/browser/TabControl.java

index 30c8c3d..43f1acd 100644 (file)
@@ -4514,7 +4514,17 @@ public class BrowserActivity extends Activity
                     String data = intent.getAction();
                     Bundle extras = intent.getExtras();
                     if (extras != null && extras.getBoolean("new_window", false)) {
-                        openTab(data);
+                        final TabControl.Tab newTab = openTab(data);
+                        if (mSettings.openInBackground() &&
+                                newTab != null && mTabOverview != null) {
+                            mTabControl.populatePickerData(newTab);
+                            mTabControl.setCurrentTab(newTab);
+                            mTabOverview.add(newTab);
+                            mTabOverview.setCurrentIndex(
+                                    mTabControl.getCurrentIndex());
+                            sendAnimateFromOverview(newTab, false,
+                                    EMPTY_URL_DATA, TAB_OVERVIEW_DELAY, null);
+                        }
                     } else {
                         final TabControl.Tab currentTab =
                                 mTabControl.getCurrentTab();
index bdb57fa..274598a 100644 (file)
@@ -1066,6 +1066,11 @@ class TabControl {
         data.mScale = w.getScale();
         data.mScrollX = w.getScrollX();
         data.mScrollY = w.getScrollY();
+
+        // Remember the old picture if possible.
+        if (t.mPickerData != null) {
+            data.mPicture = t.mPickerData.mPicture;
+        }
         t.mPickerData = data;
     }