diff options
author | Leon Scroggins <scroggo@google.com> | 2009-08-07 12:03:34 -0400 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2009-08-07 16:19:06 -0400 |
commit | 64b80f3efd95d7b5192731e995ccde79c4c6c11f (patch) | |
tree | baf0b8d25359d7bbcd8db6548e02ccb9bfaa9827 | |
parent | 5b4b8f1d53b2b71ad65d51eec377119d94611662 (diff) | |
download | packages_apps_Browser-64b80f3efd95d7b5192731e995ccde79c4c6c11f.zip packages_apps_Browser-64b80f3efd95d7b5192731e995ccde79c4c6c11f.tar.gz packages_apps_Browser-64b80f3efd95d7b5192731e995ccde79c4c6c11f.tar.bz2 |
No load home page.
Rather than load a home page, bring up the browser/new tabs
displaying the bookmarks page, with a search bar that can be
clicked to open the omnibox. Also rearrange the menu. Fix for
http://b/issue?id=2018524
-rw-r--r-- | res/drawable/search.9.png | bin | 0 -> 2054 bytes | |||
-rw-r--r-- | res/layout/tabs.xml | 51 | ||||
-rw-r--r-- | res/menu/browser.xml | 14 | ||||
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/com/android/browser/BrowserActivity.java | 43 | ||||
-rw-r--r-- | src/com/android/browser/CombinedBookmarkHistoryActivity.java | 12 |
6 files changed, 74 insertions, 48 deletions
diff --git a/res/drawable/search.9.png b/res/drawable/search.9.png Binary files differnew file mode 100644 index 0000000..037e8f0 --- /dev/null +++ b/res/drawable/search.9.png diff --git a/res/layout/tabs.xml b/res/layout/tabs.xml index 4fa102b..908dd43 100644 --- a/res/layout/tabs.xml +++ b/res/layout/tabs.xml @@ -13,29 +13,40 @@ See the License for the specific language governing permissions and limitations under the License. --> - -<TabHost xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@android:id/tabhost" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" android:layout_width="fill_parent" - android:layout_height="fill_parent"> - - <LinearLayout - android:orientation="vertical" + android:layout_height="fill_parent" + > + <TextView android:id="@+id/search" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="@drawable/search" + android:singleLine="true" + /> + <TabHost + android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> - <TabWidget android:id="@android:id/tabs" + <LinearLayout + android:orientation="vertical" android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:paddingLeft="1dip" - android:paddingRight="1dip" - android:paddingTop="4dip" - /> + android:layout_height="fill_parent"> - <FrameLayout android:id="@android:id/tabcontent" - android:layout_width="fill_parent" - android:layout_height="0dip" - android:layout_weight="1" - /> - </LinearLayout> -</TabHost>
\ No newline at end of file + <TabWidget android:id="@android:id/tabs" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:paddingLeft="1dip" + android:paddingRight="1dip" + android:paddingTop="4dip" + /> + + <FrameLayout android:id="@android:id/tabcontent" + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1" + /> + </LinearLayout> + </TabHost> +</LinearLayout> diff --git a/res/menu/browser.xml b/res/menu/browser.xml index 088fb6e..32217eb 100644 --- a/res/menu/browser.xml +++ b/res/menu/browser.xml @@ -20,17 +20,17 @@ android:title="@string/goto_dot" android:alphabeticShortcut="l" android:icon="@android:drawable/ic_menu_search"/> - <item android:id="@+id/bookmarks_menu_id" - android:title="@string/bookmarks" - android:alphabeticShortcut="b" - android:icon="@drawable/ic_menu_bookmark" /> + <item android:id="@+id/stop_reload_menu_id" + android:alphabeticShortcut="r" /> <item android:id="@+id/windows_menu_id" android:title="@string/view_tabs" android:alphabeticShortcut="t" android:titleCondensed="@string/view_tabs_condensed" android:icon="@drawable/ic_menu_windows" /> - <item android:id="@+id/stop_reload_menu_id" - android:alphabeticShortcut="r" /> + <item android:id="@+id/back_menu_id" + android:title="@string/back" + android:drawable="@*android:drawable/ic_menu_back" + android:alphabeticShortcut="j" /> <item android:id="@+id/forward_menu_id" android:title="@string/forward" android:alphabeticShortcut="k" @@ -57,8 +57,6 @@ android:visible="false" /> </group> <group android:id="@+id/MAIN_SHORTCUT_MENU" android:visible="false"> - <item android:id="@+id/back_menu_id" - android:alphabeticShortcut="j" /> <item android:id="@+id/close_menu_id" android:alphabeticShortcut="w" /> <item android:id="@+id/homepage_menu_id" diff --git a/res/values/strings.xml b/res/values/strings.xml index fb4295c..eeb9f11 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -122,6 +122,8 @@ <string name="stop">Stop</string> <!-- Menu item to reload or refresh the current page. --> <string name="reload">Refresh</string> + <!-- Menu item to go back to the previous page --> + <string name="back">Back</string> <!-- Menu item to go to the next page (only useful if the user has previously hit back.) --> <string name="forward">Forward</string> <!-- Button label to confirm saving a bookmark. --> diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index 68ccf79..0bac3ea 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -833,7 +833,7 @@ public class BrowserActivity extends Activity if (urlData.isEmpty()) { if (mSettings.isLoginInitialized()) { - webView.loadUrl(mSettings.getHomePage()); + bookmarksOrHistoryPicker(false); } else { waitForCredentials(); } @@ -1590,20 +1590,13 @@ public class BrowserActivity extends Activity } switch (item.getItemId()) { // -- Main menu - case R.id.goto_menu_id: { - String url = getTopWindow().getUrl(); - startSearch(mSettings.getHomePage().equals(url) ? null : url, true, - createGoogleSearchSourceBundle(GOOGLE_SEARCH_SOURCE_GOTO), false); - } - break; - - case R.id.bookmarks_menu_id: + case R.id.goto_menu_id: bookmarksOrHistoryPicker(false); break; case R.id.windows_menu_id: if (mTabControl.getTabCount() == 1) { - openTabAndShow(mSettings.getHomePage(), null, false, null); + openTabAndShow(EMPTY_URL_DATA, null, false, null); } else { tabPicker(true, mTabControl.getCurrentIndex(), false); } @@ -2078,8 +2071,10 @@ public class BrowserActivity extends Activity // Load the url after the AnimatingView has captured the picture. This // prevents any bad layout or bad scale from being used during // animation. - if (!urlData.isEmpty()) { - dismissSubWindow(tab); + dismissSubWindow(tab); + if (urlData.isEmpty()) { + bookmarksOrHistoryPicker(false); + } else { urlData.loadIn(tab.getWebView()); } map.put("msg", msg); @@ -2143,7 +2138,9 @@ public class BrowserActivity extends Activity // If the tab overview is up and there are animations, just load // the url. if (mTabOverview != null && mAnimationCount > 0) { - if (!urlData.isEmpty()) { + if (urlData.isEmpty()) { + bookmarksOrHistoryPicker(false); + } else { // We should not have a msg here since onCreateWindow // checks the animation count and every other caller passes // null. @@ -2168,7 +2165,7 @@ public class BrowserActivity extends Activity sendAnimateFromOverview(tab, true, urlData, delay, msg); return tab; } - } else if (!urlData.isEmpty()) { + } else { // We should not have a msg here. assert msg == null; if (mTabOverview != null && mAnimationCount == 0) { @@ -2177,8 +2174,12 @@ public class BrowserActivity extends Activity } else { // Get rid of the subwindow if it exists dismissSubWindow(currentTab); - // Load the given url. - urlData.loadIn(currentTab.getWebView()); + if (!urlData.isEmpty()) { + // Load the given url. + urlData.loadIn(currentTab.getWebView()); + } else { + bookmarksOrHistoryPicker(false); + } } } return currentTab; @@ -2665,7 +2666,7 @@ public class BrowserActivity extends Activity // Send a message to open a new tab. mHandler.sendMessageDelayed( mHandler.obtainMessage(OPEN_TAB_AND_SHOW, - mSettings.getHomePage()), delay); + null), delay); } } @@ -4613,6 +4614,8 @@ public class BrowserActivity extends Activity sendAnimateFromOverview(newTab, false, EMPTY_URL_DATA, TAB_OVERVIEW_DELAY, null); } + } else if (intent.getBooleanExtra("open_search", false)) { + onSearchRequested(); } else { final TabControl.Tab currentTab = mTabControl.getCurrentTab(); @@ -4671,8 +4674,8 @@ public class BrowserActivity extends Activity // was clicked on. if (mTabControl.getTabCount() == 0) { current = mTabControl.createNewTab(); - sendAnimateFromOverview(current, true, new UrlData( - mSettings.getHomePage()), TAB_OVERVIEW_DELAY, null); + sendAnimateFromOverview(current, true, EMPTY_URL_DATA, + TAB_OVERVIEW_DELAY, null); } else { final int index = position > 0 ? (position - 1) : 0; current = mTabControl.getTab(index); @@ -4706,7 +4709,7 @@ public class BrowserActivity extends Activity // NEW_TAB means that the "New Tab" cell was clicked on. if (index == ImageGrid.NEW_TAB) { - openTabAndShow(mSettings.getHomePage(), null, false, null); + openTabAndShow(EMPTY_URL_DATA, null, false, null); } else { sendAnimateFromOverview(mTabControl.getTab(index), false, EMPTY_URL_DATA, 0, null); diff --git a/src/com/android/browser/CombinedBookmarkHistoryActivity.java b/src/com/android/browser/CombinedBookmarkHistoryActivity.java index 7162c88..e5af46c 100644 --- a/src/com/android/browser/CombinedBookmarkHistoryActivity.java +++ b/src/com/android/browser/CombinedBookmarkHistoryActivity.java @@ -80,6 +80,18 @@ public class CombinedBookmarkHistoryActivity extends TabActivity super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.tabs); + + TextView searchBar = (TextView) findViewById(R.id.search); + searchBar.setText(getIntent().getStringExtra("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(); + } + }); + getTabHost().setOnTabChangedListener(this); Bundle extras = getIntent().getExtras(); |