OSDN Git Service

Bring up search directly from the Go page.
authorLeon Scroggins <scroggo@google.com>
Mon, 17 Aug 2009 16:04:20 +0000 (12:04 -0400)
committerLeon Scroggins <scroggo@google.com>
Mon, 17 Aug 2009 16:57:54 +0000 (12:57 -0400)
Rather than returning to BrowserActivity to bring up search, bring
it up directly from the Go page.  This means that hitting back from
search will take you to the Go page (if you reached search from
the Go page).  Fixes http://b/issue?id=2042017

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

index f059d6a..766691e 100644 (file)
@@ -3811,8 +3811,6 @@ public class BrowserActivity extends Activity
                                 mTitleBar.setCurrentTab(newIndex);
                             }
                         }
-                    } else if (intent.getBooleanExtra("open_search", false)) {
-                        onSearchRequested();
                     } else {
                         final TabControl.Tab currentTab =
                                 mTabControl.getCurrentTab();
index e5af46c..1fc05f0 100644 (file)
@@ -17,6 +17,7 @@
 package com.android.browser;
 
 import android.app.Activity;
+import android.app.SearchManager;
 import android.app.TabActivity;
 import android.content.ContentResolver;
 import android.content.Intent;
@@ -82,13 +83,21 @@ public class CombinedBookmarkHistoryActivity extends TabActivity
         setContentView(R.layout.tabs);
 
         TextView searchBar = (TextView) findViewById(R.id.search);
-        searchBar.setText(getIntent().getStringExtra("url"));
+        String url = getIntent().getStringExtra("url");
+        // Check to see if the current page is the homepage.
+        // This works without calling loadFromDb because BrowserActivity has
+        // already done it for us.
+        if (BrowserSettings.getInstance().getHomePage().equals(url)) {
+            url = null;
+        }
+        searchBar.setText(url);
+        final String pageUrl = url;
         searchBar.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
-                Intent openSearchIntent = new Intent();
-                openSearchIntent.putExtra("open_search", true);
-                setResult(RESULT_OK, openSearchIntent);
-                finish();
+                Bundle bundle = new Bundle();
+                bundle.putString(SearchManager.SOURCE,
+                        BrowserActivity.GOOGLE_SEARCH_SOURCE_SEARCHKEY);
+                startSearch(pageUrl, true, bundle, false);
             }
         });