From: Leon Scroggins Date: Mon, 17 Aug 2009 16:04:20 +0000 (-0400) Subject: Bring up search directly from the Go page. X-Git-Tag: android-x86-2.2~137^2~174 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=dc975422;p=android-x86%2Fpackages-apps-Browser.git Bring up search directly from the Go page. 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 --- diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index f059d6a..766691e 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -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(); diff --git a/src/com/android/browser/CombinedBookmarkHistoryActivity.java b/src/com/android/browser/CombinedBookmarkHistoryActivity.java index e5af46c..1fc05f0 100644 --- a/src/com/android/browser/CombinedBookmarkHistoryActivity.java +++ b/src/com/android/browser/CombinedBookmarkHistoryActivity.java @@ -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); } });