am 5c708046: (-s ours) am 6fa84baa: Import revised translations. DO NOT MERGE
* commit '5c708046f9bb743a5ef54650616ee2f9d11450fd':
Import revised translations. DO NOT MERGE
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9ddc7b5..440a141 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -59,7 +59,7 @@
android:label="@string/application_name"
android:launchMode="singleTask"
android:alwaysRetainTaskState="true"
- android:configChanges="orientation|keyboardHidden|keyboard"
+ android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
android:theme="@style/BrowserTheme"
android:hardwareAccelerated="false"
android:windowSoftInputMode="adjustResize" >
@@ -167,7 +167,7 @@
<activity android:name="AddBookmarkPage" android:label="Save bookmark"
android:theme="@style/DialogWhenLarge"
- android:configChanges="orientation|keyboardHidden"
+ android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="stateHidden|adjustPan">
<intent-filter>
<action android:name="android.intent.action.INSERT" />
diff --git a/res/drawable-hdpi/bg_bookmark_widget_holo.9.png b/res/drawable-hdpi/bg_bookmark_widget_holo.9.png
deleted file mode 100644
index adb57a4..0000000
--- a/res/drawable-hdpi/bg_bookmark_widget_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/bg_bookmarks_widget_holo.9.png b/res/drawable-hdpi/bg_bookmarks_widget_holo.9.png
new file mode 100644
index 0000000..4fd263f
--- /dev/null
+++ b/res/drawable-hdpi/bg_bookmarks_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/browser_widget_preview.png b/res/drawable-hdpi/browser_widget_preview.png
new file mode 100644
index 0000000..4ee806b
--- /dev/null
+++ b/res/drawable-hdpi/browser_widget_preview.png
Binary files differ
diff --git a/res/drawable-hdpi/browsertab_add_focused.png b/res/drawable-hdpi/browsertab_add_focused.png
new file mode 100644
index 0000000..1490a61
--- /dev/null
+++ b/res/drawable-hdpi/browsertab_add_focused.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_ic_back_bookmark_widget_holo_dark.png b/res/drawable-hdpi/btn_ic_back_bookmark_widget_holo_dark.png
deleted file mode 100644
index 5f975e5..0000000
--- a/res/drawable-hdpi/btn_ic_back_bookmark_widget_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/btn_ic_bookmark_bookmark_widget_holo_dark.png b/res/drawable-hdpi/btn_ic_bookmark_bookmark_widget_holo_dark.png
deleted file mode 100644
index 722f3b8..0000000
--- a/res/drawable-hdpi/btn_ic_bookmark_bookmark_widget_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_browser_bookmark_widget_holo.png b/res/drawable-hdpi/ic_browser_bookmark_widget_holo.png
deleted file mode 100644
index e583acd..0000000
--- a/res/drawable-hdpi/ic_browser_bookmark_widget_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_btn_copy.png b/res/drawable-hdpi/ic_btn_copy.png
deleted file mode 100644
index 847cf7e..0000000
--- a/res/drawable-hdpi/ic_btn_copy.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_btn_find.png b/res/drawable-hdpi/ic_btn_find.png
deleted file mode 100644
index 0da38a1..0000000
--- a/res/drawable-hdpi/ic_btn_find.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_btn_select_all.png b/res/drawable-hdpi/ic_btn_select_all.png
deleted file mode 100644
index 9545a53..0000000
--- a/res/drawable-hdpi/ic_btn_select_all.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_btn_stop_v2.png b/res/drawable-hdpi/ic_btn_stop_v2.png
deleted file mode 100644
index 2c97223..0000000
--- a/res/drawable-hdpi/ic_btn_stop_v2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_clear_search.png b/res/drawable-hdpi/ic_clear_search.png
deleted file mode 100644
index e8e67b4..0000000
--- a/res/drawable-hdpi/ic_clear_search.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_history_holo_dark.png b/res/drawable-hdpi/ic_history_holo_dark.png
deleted file mode 100644
index 7972a81..0000000
--- a/res/drawable-hdpi/ic_history_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_most_visited_holo_dark.png b/res/drawable-hdpi/ic_most_visited_holo_dark.png
deleted file mode 100644
index bbb0bf6..0000000
--- a/res/drawable-hdpi/ic_most_visited_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_pie_back.png b/res/drawable-hdpi/ic_pie_back.png
deleted file mode 100644
index 32b3ea7..0000000
--- a/res/drawable-hdpi/ic_pie_back.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_pie_bookmarks.png b/res/drawable-hdpi/ic_pie_bookmarks.png
deleted file mode 100644
index 2536856..0000000
--- a/res/drawable-hdpi/ic_pie_bookmarks.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_pie_close_tab.png b/res/drawable-hdpi/ic_pie_close_tab.png
deleted file mode 100644
index 108f8da..0000000
--- a/res/drawable-hdpi/ic_pie_close_tab.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_pie_forward.png b/res/drawable-hdpi/ic_pie_forward.png
deleted file mode 100644
index 4e5f08e..0000000
--- a/res/drawable-hdpi/ic_pie_forward.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_pie_more.png b/res/drawable-hdpi/ic_pie_more.png
deleted file mode 100644
index 0833ee2..0000000
--- a/res/drawable-hdpi/ic_pie_more.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_pie_new_tab.png b/res/drawable-hdpi/ic_pie_new_tab.png
deleted file mode 100644
index 18f49ef..0000000
--- a/res/drawable-hdpi/ic_pie_new_tab.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_pie_refresh.png b/res/drawable-hdpi/ic_pie_refresh.png
deleted file mode 100644
index f0a5d7a..0000000
--- a/res/drawable-hdpi/ic_pie_refresh.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_pie_search.png b/res/drawable-hdpi/ic_pie_search.png
deleted file mode 100644
index f1c8825..0000000
--- a/res/drawable-hdpi/ic_pie_search.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_pie_tabs.png b/res/drawable-hdpi/ic_pie_tabs.png
deleted file mode 100644
index b941285..0000000
--- a/res/drawable-hdpi/ic_pie_tabs.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_thumbnail_view_holo_dark.png b/res/drawable-hdpi/ic_thumbnail_view_holo_dark.png
new file mode 100644
index 0000000..514b7dc
--- /dev/null
+++ b/res/drawable-hdpi/ic_thumbnail_view_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/list_divider_vert.9.png b/res/drawable-hdpi/list_divider_vert.9.png
deleted file mode 100644
index d99730a..0000000
--- a/res/drawable-hdpi/list_divider_vert.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/page_indicator.png b/res/drawable-hdpi/page_indicator.png
deleted file mode 100644
index d00b900..0000000
--- a/res/drawable-hdpi/page_indicator.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/page_indicator_unselected2.png b/res/drawable-hdpi/page_indicator_unselected2.png
deleted file mode 100644
index a34fd2e..0000000
--- a/res/drawable-hdpi/page_indicator_unselected2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/qc_background_normal.png b/res/drawable-hdpi/qc_background_normal.png
new file mode 100644
index 0000000..fec04f2
--- /dev/null
+++ b/res/drawable-hdpi/qc_background_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/search_plate_browser.9.png b/res/drawable-hdpi/search_plate_browser.9.png
deleted file mode 100644
index cf0567b..0000000
--- a/res/drawable-hdpi/search_plate_browser.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/tab_nr.png b/res/drawable-hdpi/tab_nr.png
new file mode 100644
index 0000000..d9e74d5
--- /dev/null
+++ b/res/drawable-hdpi/tab_nr.png
Binary files differ
diff --git a/res/drawable-hdpi/text_field_results.9.png b/res/drawable-hdpi/text_field_results.9.png
deleted file mode 100644
index bd4bcc5..0000000
--- a/res/drawable-hdpi/text_field_results.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/thumbnail_bookmarks_widget_no_bookmark_holo.png b/res/drawable-hdpi/thumbnail_bookmarks_widget_no_bookmark_holo.png
new file mode 100644
index 0000000..9d55e98
--- /dev/null
+++ b/res/drawable-hdpi/thumbnail_bookmarks_widget_no_bookmark_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/url_bg_active.9.png b/res/drawable-hdpi/url_bg_active.9.png
new file mode 100644
index 0000000..479acb1
--- /dev/null
+++ b/res/drawable-hdpi/url_bg_active.9.png
Binary files differ
diff --git a/res/drawable-hdpi/url_bg_default.9.png b/res/drawable-hdpi/url_bg_default.9.png
new file mode 100644
index 0000000..7db9db4
--- /dev/null
+++ b/res/drawable-hdpi/url_bg_default.9.png
Binary files differ
diff --git a/res/drawable-hdpi/urlbar_bg.9.png b/res/drawable-hdpi/urlbar_bg.9.png
deleted file mode 100644
index c35383e..0000000
--- a/res/drawable-hdpi/urlbar_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/bg_bookmark_widget_holo.9.png b/res/drawable-mdpi/bg_bookmark_widget_holo.9.png
deleted file mode 100644
index d95f8d3..0000000
--- a/res/drawable-mdpi/bg_bookmark_widget_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/browser_widget_preview.png b/res/drawable-mdpi/browser_widget_preview.png
similarity index 100%
rename from res/drawable/browser_widget_preview.png
rename to res/drawable-mdpi/browser_widget_preview.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_ic_back_bookmark_widget_holo_dark.png b/res/drawable-mdpi/btn_ic_back_bookmark_widget_holo_dark.png
deleted file mode 100644
index d8697b8..0000000
--- a/res/drawable-mdpi/btn_ic_back_bookmark_widget_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/btn_ic_bookmark_bookmark_widget_holo_dark.png b/res/drawable-mdpi/btn_ic_bookmark_bookmark_widget_holo_dark.png
deleted file mode 100644
index 21a2cc3..0000000
--- a/res/drawable-mdpi/btn_ic_bookmark_bookmark_widget_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_browser_bookmark_widget_holo.png b/res/drawable-mdpi/ic_browser_bookmark_widget_holo.png
deleted file mode 100644
index 0d9e49d..0000000
--- a/res/drawable-mdpi/ic_browser_bookmark_widget_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_btn_copy.png b/res/drawable-mdpi/ic_btn_copy.png
deleted file mode 100644
index 2174368..0000000
--- a/res/drawable-mdpi/ic_btn_copy.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_btn_find.png b/res/drawable-mdpi/ic_btn_find.png
deleted file mode 100644
index 71bc61a..0000000
--- a/res/drawable-mdpi/ic_btn_find.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_btn_select_all.png b/res/drawable-mdpi/ic_btn_select_all.png
deleted file mode 100644
index 8ce8c8f..0000000
--- a/res/drawable-mdpi/ic_btn_select_all.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_btn_stop_v2.png b/res/drawable-mdpi/ic_btn_stop_v2.png
deleted file mode 100644
index 89f01e7..0000000
--- a/res/drawable-mdpi/ic_btn_stop_v2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_clear_search.png b/res/drawable-mdpi/ic_clear_search.png
deleted file mode 100644
index e8e67b4..0000000
--- a/res/drawable-mdpi/ic_clear_search.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_history_holo_dark.png b/res/drawable-mdpi/ic_history_holo_dark.png
deleted file mode 100644
index 44f2245..0000000
--- a/res/drawable-mdpi/ic_history_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_most_visited_holo_dark.png b/res/drawable-mdpi/ic_most_visited_holo_dark.png
deleted file mode 100644
index 52082bd..0000000
--- a/res/drawable-mdpi/ic_most_visited_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_pie_back.png b/res/drawable-mdpi/ic_pie_back.png
deleted file mode 100644
index daddaea..0000000
--- a/res/drawable-mdpi/ic_pie_back.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_pie_bookmarks.png b/res/drawable-mdpi/ic_pie_bookmarks.png
deleted file mode 100644
index ffa430d..0000000
--- a/res/drawable-mdpi/ic_pie_bookmarks.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_pie_close_tab.png b/res/drawable-mdpi/ic_pie_close_tab.png
deleted file mode 100644
index 62396f4..0000000
--- a/res/drawable-mdpi/ic_pie_close_tab.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_pie_forward.png b/res/drawable-mdpi/ic_pie_forward.png
deleted file mode 100644
index bd8dcac..0000000
--- a/res/drawable-mdpi/ic_pie_forward.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_pie_more.png b/res/drawable-mdpi/ic_pie_more.png
deleted file mode 100644
index c96c6a4..0000000
--- a/res/drawable-mdpi/ic_pie_more.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_pie_new_tab.png b/res/drawable-mdpi/ic_pie_new_tab.png
deleted file mode 100644
index 206675a..0000000
--- a/res/drawable-mdpi/ic_pie_new_tab.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_pie_refresh.png b/res/drawable-mdpi/ic_pie_refresh.png
deleted file mode 100644
index 5980f8b..0000000
--- a/res/drawable-mdpi/ic_pie_refresh.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_pie_search.png b/res/drawable-mdpi/ic_pie_search.png
deleted file mode 100644
index 6981697..0000000
--- a/res/drawable-mdpi/ic_pie_search.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_pie_tabs.png b/res/drawable-mdpi/ic_pie_tabs.png
deleted file mode 100644
index fda262a..0000000
--- a/res/drawable-mdpi/ic_pie_tabs.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_pie_web.png b/res/drawable-mdpi/ic_pie_web.png
deleted file mode 100644
index 86e41ff..0000000
--- a/res/drawable-mdpi/ic_pie_web.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_thumbnail_view_holo_dark.png b/res/drawable-mdpi/ic_thumbnail_view_holo_dark.png
new file mode 100644
index 0000000..95c674d
--- /dev/null
+++ b/res/drawable-mdpi/ic_thumbnail_view_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/list_divider_vert.9.png b/res/drawable-mdpi/list_divider_vert.9.png
deleted file mode 100644
index d99730a..0000000
--- a/res/drawable-mdpi/list_divider_vert.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/page_indicator.png b/res/drawable-mdpi/page_indicator.png
deleted file mode 100644
index 73c030a..0000000
--- a/res/drawable-mdpi/page_indicator.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/page_indicator_unselected2.png b/res/drawable-mdpi/page_indicator_unselected2.png
deleted file mode 100644
index 70818ee..0000000
--- a/res/drawable-mdpi/page_indicator_unselected2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/search_plate_browser.9.png b/res/drawable-mdpi/search_plate_browser.9.png
deleted file mode 100644
index 2370d9c..0000000
--- a/res/drawable-mdpi/search_plate_browser.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/text_field_results.9.png b/res/drawable-mdpi/text_field_results.9.png
deleted file mode 100644
index 167c42d..0000000
--- a/res/drawable-mdpi/text_field_results.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/urlbar_bg.9.png b/res/drawable-mdpi/urlbar_bg.9.png
deleted file mode 100644
index 18b49e7..0000000
--- a/res/drawable-mdpi/urlbar_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/url_selector.xml b/res/drawable/url_selector.xml
new file mode 100644
index 0000000..d4febe6
--- /dev/null
+++ b/res/drawable/url_selector.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:state_focused="true"
+ android:drawable="@drawable/url_bg_active" />
+ <item
+ android:state_focused="false"
+ android:drawable="@drawable/url_bg_default" />
+</selector>
\ No newline at end of file
diff --git a/res/layout-xlarge/history.xml b/res/layout-xlarge/history.xml
new file mode 100644
index 0000000..2d949e1
--- /dev/null
+++ b/res/layout-xlarge/history.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+>
+
+ <ViewStub
+ android:id="@+id/pref_stub"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:inflatedId="@+id/history" />
+
+ <TextView android:id="@android:id/empty"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:text="@string/empty_history"
+ android:visibility="gone"
+ />
+
+</FrameLayout>
diff --git a/res/layout/active_tabs.xml b/res/layout/active_tabs.xml
index 8b5fe9e..f9bd6b0 100644
--- a/res/layout/active_tabs.xml
+++ b/res/layout/active_tabs.xml
@@ -14,31 +14,41 @@
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:orientation="vertical"
- android:background="@color/black"
- >
- <RelativeLayout
- style="?android:attr/windowTitleBackgroundStyle"
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+
+ <Button
+ android:id="@+id/new_tab"
+ android:text="@string/new_tab"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
+
+ <Button
+ android:id="@+id/new_incognito_tab"
+ android:text="@string/new_incognito_tab"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:paddingLeft="0dip"
+ android:paddingRight="0dip" />
+
+ </LinearLayout>
+
+ <ListView
+ android:id="@android:id/list"
android:layout_width="match_parent"
- android:layout_height="?android:attr/windowTitleSize"
- >
- <TextView android:id="@android:id/title"
- style="?android:attr/windowTitleStyle"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@null"
- android:fadingEdge="horizontal"
- android:gravity="center_vertical"
- android:text="@string/active_tabs"
- />
- </RelativeLayout>
- <ListView android:id="@+id/list"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:cacheColorHint="@color/black"
- />
-</LinearLayout>
+ android:layout_height="match_parent"
+ android:listSelector="@drawable/bookmark_thumb_selector"
+ android:drawSelectorOnTop="true"
+ android:focusable="true"
+ android:focusableInTouchMode="true" />
+
+</merge>
diff --git a/res/layout/history.xml b/res/layout/history.xml
index f7d2c7c..f3adb51 100644
--- a/res/layout/history.xml
+++ b/res/layout/history.xml
@@ -19,11 +19,10 @@
android:layout_height="match_parent"
>
- <ViewStub
- android:id="@+id/pref_stub"
+ <ExpandableListView
+ android:id="@+id/history"
android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:inflatedId="@+id/history" />
+ android:layout_width="match_parent" />
<TextView android:id="@android:id/empty"
android:layout_width="wrap_content"
diff --git a/res/layout/preference_list_content.xml b/res/layout/preference_list_content.xml
new file mode 100644
index 0000000..ad3d64e
--- /dev/null
+++ b/res/layout/preference_list_content.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2011 The Android Open Source Project Licensed under the
+ Apache License, Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a copy of the
+ License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent">
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="0px"
+ android:layout_weight="1">
+
+ <LinearLayout
+ android:id="@+id/headers"
+ android:orientation="vertical"
+ android:layout_width="0px"
+ android:layout_height="match_parent"
+ android:layout_marginRight="@dimen/preference_screen_side_margin_negative"
+ android:layout_marginLeft="@dimen/preference_screen_side_margin"
+ android:layout_marginTop="32dp"
+ android:layout_marginBottom="32dp"
+ android:layout_weight="10">
+
+ <ListView android:id="@android:id/list"
+ android:layout_width="match_parent"
+ android:layout_height="0px"
+ android:layout_weight="1"
+ android:drawSelectorOnTop="false"
+ android:cacheColorHint="@android:color/transparent"
+ android:listPreferredItemHeight="48dp"
+ android:scrollbarAlwaysDrawVerticalTrack="true" />
+
+ <FrameLayout android:id="@+id/list_footer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="0" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/prefs_frame"
+ android:layout_width="0px"
+ android:layout_height="match_parent"
+ android:layout_weight="20"
+ android:layout_marginLeft="@dimen/preference_screen_side_margin"
+ android:layout_marginRight="@dimen/preference_screen_side_margin"
+ android:layout_marginTop="16dp"
+ android:layout_marginBottom="16dp"
+ android:background="?android:attr/detailsElementBackground"
+ android:orientation="vertical"
+ android:visibility="gone" >
+
+ <!-- Breadcrumb inserted here -->
+ <android.app.FragmentBreadCrumbs
+ android:id="@android:id/title"
+ android:layout_height="72dip"
+ android:layout_width="match_parent"
+ android:paddingTop="16dip"
+ android:paddingBottom="8dip"
+ android:gravity="center_vertical|left"
+ android:layout_marginLeft="48dip"
+ android:layout_marginRight="48dip"
+ />
+
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="1dip"
+ android:paddingLeft="32dip"
+ android:paddingRight="32dip"
+ android:src="#404040"
+ />
+ <android.preference.PreferenceFrameLayout android:id="@+id/prefs"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:layout_marginTop="-1dip"
+ />
+ </LinearLayout>
+ </LinearLayout>
+</LinearLayout>
diff --git a/res/layout/tab_view.xml b/res/layout/tab_view.xml
index 885f4cf..8ffb73d 100644
--- a/res/layout/tab_view.xml
+++ b/res/layout/tab_view.xml
@@ -20,42 +20,54 @@
android:layout_width="match_parent"
android:orientation="horizontal"
android:gravity="center_vertical"
+ android:paddingLeft="8dip"
+ android:paddingTop="4dip"
+ android:paddingBottom="4dip"
>
- <!-- This ImageView has the same width as the ImageView in
- tab_view_add_tab.xml. -->
- <ImageView android:id="@+id/favicon"
- android:layout_width="20dip"
- android:layout_height="20dip"
- android:layout_marginLeft="18dip"
- android:layout_marginRight="18dip"
- android:background="@drawable/fav_icn_background"
- android:padding="2dip"/>
- <LinearLayout
+ <RelativeLayout
+ android:id="@+id/list_item"
android:layout_width="0dip"
- android:layout_height="wrap_content"
android:layout_weight="1"
- android:orientation="vertical"
- >
- <TextView android:id="@+id/title"
+ android:layout_height="wrap_content"
+ android:background="@drawable/bookmark_list_favicon_bg">
+ <ImageView
+ android:id="@+id/thumb"
+ android:src="@drawable/thumbnail_bookmarks_widget_no_bookmark_holo"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/tab_view_thumbnail_height"
+ android:scaleType="fitXY"
+ android:cropToPadding="true" />
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:maxLines="1"
- android:singleLine="true"
- android:ellipsize="end"
- />
- <TextView android:id="@+id/url"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:maxLines="1"
- android:singleLine="true"
- android:ellipsize="end"
- />
- </LinearLayout>
+ android:layout_alignBottom="@id/thumb"
+ android:background="@color/tabViewTitleBackground">
+ <ImageView
+ android:id="@+id/favicon"
+ android:src="@drawable/app_web_browser_sm"
+ android:layout_width="@dimen/favicon_size"
+ android:layout_height="@dimen/favicon_size"
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="4dip"
+ android:layout_marginRight="8dip"
+ android:layout_marginTop="4dip"
+ android:layout_marginBottom="4dip"
+ android:scaleType="fitXY" />
+ <TextView
+ android:id="@+id/label"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:textSize="12sp"
+ android:typeface="sans"
+ android:textColor="@android:color/white" />
+ </LinearLayout>
+ </RelativeLayout>
<View android:id="@+id/divider"
- android:background="#ff313431"
- android:layout_width="1dip"
+ android:background="?android:attr/dividerVertical"
+ android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginLeft="8dip"
android:layout_marginTop="5dip"
@@ -64,10 +76,10 @@
<view class="com.android.browser.ActiveTabsPage$CloseHolder" android:id="@+id/close"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:paddingLeft="18dip"
- android:paddingRight="18dip"
- android:background="@drawable/close_background"
- android:src="@drawable/btn_close_window"
+ android:paddingLeft="12dip"
+ android:paddingRight="12dip"
+ android:background="@drawable/bookmark_thumb_selector"
+ android:src="@drawable/ic_close_window_holo_dark"
android:scaleType="center"
/>
</LinearLayout>
diff --git a/res/layout/tab_view_add_incognito_tab.xml b/res/layout/tab_view_add_incognito_tab.xml
deleted file mode 100644
index 43fcb43..0000000
--- a/res/layout/tab_view_add_incognito_tab.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:layout_width="match_parent"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- >
- <ImageView
- android:layout_width="40dip"
- android:layout_height="40dip"
- android:layout_marginLeft="8dip"
- android:layout_marginRight="8dip"
- android:src="@drawable/ic_new_window_holo_dark"/>
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:maxLines="1"
- android:singleLine="true"
- android:ellipsize="end"
- android:text="@string/new_incognito_tab"
- />
-</LinearLayout>
diff --git a/res/layout/tab_view_add_tab.xml b/res/layout/tab_view_add_tab.xml
deleted file mode 100644
index f4e0f02..0000000
--- a/res/layout/tab_view_add_tab.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:layout_width="match_parent"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- >
- <ImageView
- android:layout_width="40dip"
- android:layout_height="40dip"
- android:layout_marginLeft="8dip"
- android:layout_marginRight="8dip"
- android:src="@drawable/ic_new_window_holo_dark"/>
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:maxLines="1"
- android:singleLine="true"
- android:ellipsize="end"
- android:text="@string/new_tab"
- />
-</LinearLayout>
diff --git a/res/layout/title_bar.xml b/res/layout/title_bar.xml
index 99ac04d..e443ee5 100644
--- a/res/layout/title_bar.xml
+++ b/res/layout/title_bar.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright 2009, The Android Open Source Project
+ Copyright 2011, The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,13 +14,13 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/titlebar"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical" >
-
+ android:layout_height="wrap_content">
<LinearLayout
+ android:id="@+id/taburlbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
@@ -28,71 +28,120 @@
android:paddingLeft="4dip"
android:paddingRight="4dip"
android:paddingTop="2dip"
- android:paddingBottom="1dip"
- >
-
- <LinearLayout android:id="@+id/title_bg"
+ android:paddingBottom="2dip">
+ <LinearLayout
+ android:id="@+id/title_bg"
android:layout_width="0dip"
android:layout_weight="1.0"
- android:layout_height="48dip"
- android:layout_marginBottom="4dip"
+ android:layout_height="40dip"
android:gravity="center_vertical"
- android:orientation="horizontal"
- android:background="@drawable/url_background"
- >
- <ImageView android:id="@+id/favicon"
- android:layout_width="20dip"
- android:layout_height="20dip"
- />
- <ImageView android:id="@+id/lock"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="3dip"
- android:visibility="gone"
- />
- <com.android.browser.UrlInputView
- android:id="@+id/url_input"
- android:focusable="true"
- android:layout_width="0dip"
- android:layout_weight="1.0"
- android:layout_height="match_parent"
- android:layout_marginLeft="3dip"
- android:paddingLeft="0dip"
- android:paddingRight="0dip"
- android:background="@null"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:hint="@string/search_hint"
- android:singleLine="true"
- android:ellipsize="end"
- android:lines="1"
- android:scrollHorizontally="true"
- android:inputType="textUri"
- android:imeOptions="actionGo"
- style="@style/Suggestions" />
+ android:orientation="horizontal">
+ <ImageView
+ android:id="@+id/favicon"
+ android:layout_width="20dip"
+ android:layout_height="20dip" />
+ <ImageView
+ android:id="@+id/lock"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="2dip"
+ android:visibility="gone" />
+ <com.android.browser.UrlInputView
+ android:id="@+id/url"
+ android:focusable="true"
+ android:layout_width="0dip"
+ android:layout_weight="1.0"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="2dip"
+ android:paddingLeft="4dip"
+ android:paddingRight="4dip"
+ android:background="@drawable/url_selector"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:hint="@string/search_hint"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:lines="1"
+ android:scrollHorizontally="true"
+ android:inputType="textUri"
+ android:imeOptions="actionGo"
+ style="@style/Suggestions" />
</LinearLayout>
- <ImageButton
+ <ImageView
+ android:id="@+id/voice"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_voice_search_holo_dark"
+ android:visibility="gone" />
+ <ImageView
android:id="@+id/stop"
android:layout_width="wrap_content"
- android:layout_height="match_parent"
- style="@style/HoloButton"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
android:src="@drawable/ic_stop_holo_dark"
- android:visibility="gone"
- />
- <ImageButton
- android:id="@+id/bookmark"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- style="@style/HoloButton"
- android:src="@drawable/btn_imageview_star"
- />
+ android:visibility="gone" />
</LinearLayout>
-
+ <LinearLayout
+ android:id="@+id/autologin"
+ android:background="#FBF0A0"
+ android:gravity="center_vertical"
+ android:paddingTop="3dip"
+ android:visibility="gone"
+ android:layout_below="@+id/taburlbar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:text="@string/autologin_bar_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@android:color/primary_text_light"
+ android:paddingLeft="15dip"
+ android:paddingRight="15dip"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+ <Spinner
+ android:id="@+id/autologin_account"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ style="@android:style/Widget.Holo.Light.Spinner" />
+ <Button
+ android:id="@+id/autologin_login"
+ android:text="@string/autologin_bar_login_text"
+ style="@android:style/Widget.Holo.Light.Button"
+ android:layout_marginRight="15dip"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content" />
+ <ProgressBar
+ android:id="@+id/autologin_progress"
+ android:indeterminateOnly="true"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:visibility="gone" />
+ <TextView
+ android:id="@+id/autologin_error"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:textColor="#dd6826"
+ android:text="@string/autologin_bar_error"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:visibility="gone" />
+ <View
+ android:layout_width="2dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1" />
+ <ImageButton
+ android:id="@+id/autologin_close"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingRight="15dip"
+ android:background="@null"
+ android:src="@*android:drawable/btn_close" />
+ </LinearLayout>
<com.android.browser.PageProgressView
- android:id="@+id/progress_horizontal"
+ android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="22dip"
android:background="@null"
+ android:layout_below="@+id/taburlbar"
android:src="@drawable/progress"
android:layout_marginTop="-11dip"
android:visibility="gone" />
-</LinearLayout>
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/url_bar.xml b/res/layout/url_bar.xml
index 8743906..3864b7d 100644
--- a/res/layout/url_bar.xml
+++ b/res/layout/url_bar.xml
@@ -118,7 +118,7 @@
style="@style/HoloIcon"
android:visibility="gone" />
<com.android.browser.UrlInputView
- android:id="@+id/url_focused"
+ android:id="@+id/url"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="match_parent"
diff --git a/res/menu/bookmark.xml b/res/menu/bookmark.xml
index b761779..5517ab9 100644
--- a/res/menu/bookmark.xml
+++ b/res/menu/bookmark.xml
@@ -26,12 +26,15 @@
android:showAsAction="always" />
<item
android:id="@+id/thumbnail_view"
- android:title="@string/bookmark_thumbnail_view"/>
+ android:title="@string/bookmark_thumbnail_view"
+ android:icon="@drawable/ic_thumbnail_view_holo_dark" />
<item
android:id="@+id/list_view"
- android:title="@string/bookmark_list_view"/>
+ android:title="@string/bookmark_list_view"
+ android:icon="@drawable/ic_list_view_holo_dark" />
<item
android:id="@+id/preferences_menu_id"
android:title="@string/menu_preferences"
+ android:icon="@drawable/ic_settings_holo_dark"
android:alphabeticShortcut="p" />
</menu>
diff --git a/res/menu/browser.xml b/res/menu/browser.xml
index abe3716..d9e884b 100644
--- a/res/menu/browser.xml
+++ b/res/menu/browser.xml
@@ -15,55 +15,73 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <group android:id="@+id/MAIN_MENU">
- <item android:id="@+id/new_tab_menu_id"
- android:title="@string/new_tab"
- android:icon="@drawable/ic_menu_new_window"
- android:alphabeticShortcut="n" />
- <item android:id="@+id/bookmarks_menu_id"
- android:title="@string/bookmarks"
- android:alphabeticShortcut="b"
- android:icon="@drawable/ic_bookmarks_holo_dark" />
- <item android:id="@+id/active_tabs_menu_id"
- android:title="@string/active_tabs"
- android:icon="@drawable/ic_windows_holo_dark"
- android:alphabeticShortcut="t" />
- <item android:id="@+id/stop_reload_menu_id"
- android:alphabeticShortcut="r" />
- <item android:id="@+id/forward_menu_id"
- android:title="@string/forward"
- android:icon="@*android:drawable/ic_menu_forward" />
- <item android:id="@+id/add_bookmark_menu_id"
+ <group
+ android:id="@+id/MAIN_MENU">
+ <group
+ android:id="@+id/NAV_MENU">
+ <item
+ android:id="@+id/new_tab_menu_id"
+ android:title="@string/new_tab"
+ android:icon="@drawable/ic_menu_new_window"
+ android:alphabeticShortcut="n" />
+ <item
+ android:id="@+id/bookmarks_menu_id"
+ android:title="@string/bookmarks"
+ android:alphabeticShortcut="b"
+ android:icon="@drawable/ic_bookmarks_holo_dark" />
+ <item
+ android:id="@+id/active_tabs_menu_id"
+ android:title="@string/active_tabs"
+ android:icon="@drawable/ic_windows_holo_dark"
+ android:alphabeticShortcut="t" />
+ <item
+ android:id="@+id/stop_reload_menu_id"
+ android:alphabeticShortcut="r" />
+ <item
+ android:id="@+id/forward_menu_id"
+ android:title="@string/forward"
+ android:icon="@*android:drawable/ic_menu_forward" />
+ </group>
+ <item
+ android:id="@+id/add_bookmark_menu_id"
android:title="@string/save_to_bookmarks"
android:icon="@drawable/ic_bookmark_on_holo_dark"
android:alphabeticShortcut="d" />
- <item android:id="@+id/find_menu_id"
+ <item
+ android:id="@+id/find_menu_id"
android:title="@*android:string/find_on_page"
android:icon="@*android:drawable/ic_menu_find"
android:alphabeticShortcut="f" />
- <item android:id="@+id/share_page_menu_id"
+ <item
+ android:id="@+id/share_page_menu_id"
android:title="@string/share_page"
android:icon="@drawable/ic_share_holo_dark"
android:alphabeticShortcut="s" />
- <item android:id="@+id/save_webarchive_menu_id"
+ <item
+ android:id="@+id/save_webarchive_menu_id"
android:title="@string/menu_save_webarchive" />
- <item android:id="@+id/page_info_menu_id"
+ <item
+ android:id="@+id/page_info_menu_id"
android:title="@string/page_info"
android:icon="@drawable/ic_pageinfo_holo_dark"
android:alphabeticShortcut="g" />
- <item android:id="@+id/view_downloads_menu_id"
+ <item
+ android:id="@+id/view_downloads_menu_id"
android:title="@string/menu_view_download"
android:icon="@drawable/ic_downloads_holo_dark"
android:alphabeticShortcut="j" />
- <item android:id="@+id/preferences_menu_id"
+ <item
+ android:id="@+id/preferences_menu_id"
android:title="@string/menu_preferences"
android:icon="@drawable/ic_settings_holo_dark"
android:alphabeticShortcut="p" />
<!-- followings are debug only -->
- <item android:id="@+id/dump_nav_menu_id"
+ <item
+ android:id="@+id/dump_nav_menu_id"
android:title="@string/dump_nav"
android:visible="false" />
- <item android:id="@+id/dump_counters_menu_id"
+ <item
+ android:id="@+id/dump_counters_menu_id"
android:title="@string/dump_counters"
android:visible="false" />
</group>
diff --git a/res/raw/most_visited.ktpl b/res/raw/most_visited.ktpl
index 04b9eee..9a6e1b8 100644
--- a/res/raw/most_visited.ktpl
+++ b/res/raw/most_visited.ktpl
@@ -3,7 +3,7 @@
<html>
<head>
<title><%@ string/new_tab %></title>
-<meta name="viewport" content="width=device-width; initial-scale=1.0;" />
+<meta name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=0" />
<style type="text/css">
@@ -14,20 +14,19 @@
body {
text-align: center;
- margin: 16px auto;
+ margin: 0px auto;
padding: 0 8px 0 8px;
max-width: <%@ dimen/mv_max_width %>px;
}
-#most_visited h3 {
+h3 {
text-align: center;
- padding: 0;
- margin: 5px 0 5px 0px;
+ margin: 5px 0 5px 0;
}
.thumbwrap li {
display: inline-block;
- margin: 0 7px 15px 7px;
+ margin: 0 7px 12px 7px;
padding: 0;
}
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index 42219fa..f464f03 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -197,7 +197,7 @@
<string name="autofill_setup_dialog_negative_toast" msgid="6990737008936188620">"Notez que vous pouvez configurer la saisie automatique dans les paramètres du navigateur."</string>
<string name="disable_autofill" msgid="8305901059849400354">"Désactiver la saisie automatique"</string>
<string name="pref_privacy_security_title" msgid="3480313968942160914">"Confidentialité et sécurité"</string>
- <string name="pref_privacy_clear_cache" msgid="3380316479925886998">"Vider le cache"</string>
+ <string name="pref_privacy_clear_cache" msgid="3380316479925886998">"Effacer le cache"</string>
<string name="pref_privacy_clear_cache_summary" msgid="2216463577207991454">"Supprimer les bases de données et le contenu localement en cache"</string>
<string name="pref_privacy_clear_cache_dlg" msgid="5541011591300753881">"Les bases de données et le contenu mis localement en cache vont être supprimés."</string>
<string name="pref_privacy_cookies_title" msgid="6763274282214830526">"Cookies"</string>
diff --git a/res/values-land/dimensions.xml b/res/values-land/dimensions.xml
new file mode 100644
index 0000000..f3b1235
--- /dev/null
+++ b/res/values-land/dimensions.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2011 The Android Open Source Project Licensed under the
+ Apache License, Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a copy of the
+ License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+
+<resources>
+ <dimen name="preference_screen_side_margin">96dp</dimen>
+ <dimen name="preference_screen_side_margin_negative">-100dp</dimen>
+ <dimen name="preference_widget_width">72dp</dimen>
+</resources>
diff --git a/res/values-xlarge/dimensions.xml b/res/values-xlarge/dimensions.xml
index 2549818..eae9b0e 100644
--- a/res/values-xlarge/dimensions.xml
+++ b/res/values-xlarge/dimensions.xml
@@ -27,4 +27,12 @@
<dimen name="combo_paddingTop">50dip</dimen>
<dimen name="combo_paddingLeftRight">134dip</dimen>
<dimen name="combo_horizontalSpacing">20dip</dimen>
+ <dimen name="qc_radius_start">50dip</dimen>
+ <dimen name="qc_radius_increment">70dip</dimen>
+ <dimen name="qc_slop">15dip</dimen>
+ <dimen name="qc_touch_offset">15dip</dimen>
+ <dimen name="qc_tab_title_height">30dip</dimen>
+ <dimen name="qc_thumb_width">240dip</dimen>
+ <dimen name="qc_thumb_height">160dip</dimen>
+ <dimen name="qc_item_size">48dip</dimen>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 6a7c578..15a5c87 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -36,4 +36,5 @@
<color name="qcMenuBackground">#C0000000</color>
<color name="qc_normal">#C02447B2</color>
<color name="qc_selected">#D0102052</color>
+ <color name="tabViewTitleBackground">#D0000000</color>
</resources>
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index 99eb43e..38a7802 100644
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -30,21 +30,21 @@
<dimen name="widgetItemMinHeight">48dip</dimen>
<dimen name="favicon_size">16dip</dimen>
<dimen name="favicon_padded_size">20dip</dimen>
- <dimen name="qc_radius_start">50dip</dimen>
- <dimen name="qc_radius_increment">70dip</dimen>
- <dimen name="qc_slop">15dip</dimen>
+ <dimen name="qc_radius_start">30dip</dimen>
+ <dimen name="qc_radius_increment">60dip</dimen>
+ <dimen name="qc_slop">10dip</dimen>
<dimen name="qc_touch_offset">15dip</dimen>
<dimen name="qc_tab_title_height">30dip</dimen>
- <dimen name="qc_thumb_width">240dip</dimen>
- <dimen name="qc_thumb_height">160dip</dimen>
- <dimen name="qc_item_size">48dip</dimen>
+ <dimen name="qc_thumb_width">160dip</dimen>
+ <dimen name="qc_thumb_height">120dip</dimen>
+ <dimen name="qc_item_size">40dip</dimen>
<dimen name="bookmark_widget_thumb_size">32dip</dimen>
<dimen name="bookmark_widget_favicon_size">26dip</dimen>
- <!-- For the most visited page -->
- <dimen name="mv_max_width">830dp</dimen>
- <dimen name="mv_item_width">96dp</dimen>
- <dimen name="mv_item_width_portrait">96dp</dimen>
- <dimen name="mv_border_width">3dp</dimen>
+ <!-- For the most visited page (we use px as these are adjusted by the browser) -->
+ <dimen name="mv_max_width">830px</dimen>
+ <dimen name="mv_item_width">94px</dimen>
+ <dimen name="mv_item_width_portrait">80px</dimen>
+ <dimen name="mv_border_width">2px</dimen>
<dimen name="tab_padding_top">12dp</dimen>
<dimen name="tab_first_padding_left">12dp</dimen>
<dimen name="list_favicon_padding">5dip</dimen>
@@ -55,6 +55,13 @@
<dimen name="widgetVerticalSpacing">12dip</dimen>
<!-- For the combined Bookmarks History view -->
<dimen name="combo_paddingTop">10dip</dimen>
- <dimen name="combo_paddingLeftRight">16dip</dimen>
- <dimen name="combo_horizontalSpacing">8dip</dimen>
+ <dimen name="combo_paddingLeftRight">8dip</dimen>
+ <dimen name="combo_horizontalSpacing">6dip</dimen>
+ <dimen name="tab_view_thumbnail_height">76dip</dimen>
+ <!-- Preference activity side margins -->
+ <dimen name="preference_screen_side_margin">0dp</dimen>
+ <!-- Preference activity side margins negative-->
+ <dimen name="preference_screen_side_margin_negative">0dp</dimen>
+ <!-- Preference widget area width (to the left of the text) -->
+ <dimen name="preference_widget_width">56dp</dimen>
</resources>
diff --git a/res/xml-xlarge/lab_preferences.xml b/res/xml-xlarge/lab_preferences.xml
new file mode 100644
index 0000000..87383b0
--- /dev/null
+++ b/res/xml-xlarge/lab_preferences.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <CheckBoxPreference
+ android:key="enable_quick_controls"
+ android:defaultValue="false"
+ android:title="@string/pref_lab_quick_controls"
+ android:summary="@string/pref_lab_quick_controls_summary" />
+
+ <CheckBoxPreference
+ android:key="use_most_visited_homepage"
+ android:defaultValue="false"
+ android:title="@string/pref_lab_most_visited_homepage"
+ android:summary="@string/pref_lab_most_visited_homepage_summary" />
+
+ <CheckBoxPreference
+ android:key="use_instant_search"
+ android:defaultValue="false"
+ android:title="@string/pref_use_instant_search"
+ android:summary="@string/pref_use_instant_search_summary" />
+</PreferenceScreen>
diff --git a/res/xml/lab_preferences.xml b/res/xml/lab_preferences.xml
index 87383b0..b33052f 100644
--- a/res/xml/lab_preferences.xml
+++ b/res/xml/lab_preferences.xml
@@ -16,22 +16,14 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" >
-
<CheckBoxPreference
android:key="enable_quick_controls"
android:defaultValue="false"
android:title="@string/pref_lab_quick_controls"
android:summary="@string/pref_lab_quick_controls_summary" />
-
<CheckBoxPreference
android:key="use_most_visited_homepage"
android:defaultValue="false"
android:title="@string/pref_lab_most_visited_homepage"
android:summary="@string/pref_lab_most_visited_homepage_summary" />
-
- <CheckBoxPreference
- android:key="use_instant_search"
- android:defaultValue="false"
- android:title="@string/pref_use_instant_search"
- android:summary="@string/pref_use_instant_search_summary" />
</PreferenceScreen>
diff --git a/src/com/android/browser/ActiveTabsPage.java b/src/com/android/browser/ActiveTabsPage.java
index 664fd68..52d943f 100644
--- a/src/com/android/browser/ActiveTabsPage.java
+++ b/src/com/android/browser/ActiveTabsPage.java
@@ -18,62 +18,87 @@
import android.content.Context;
import android.graphics.Bitmap;
-import android.os.Handler;
+import android.text.TextUtils;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.widget.AbsListView;
import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
+import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
-import android.widget.ListView;
import android.widget.TextView;
-public class ActiveTabsPage extends LinearLayout {
+interface OnCloseTab {
+ void onCloseTab(int position);
+}
- private static final String LOGTAG = "TabPicker";
+public class ActiveTabsPage extends LinearLayout implements OnClickListener,
+ OnItemClickListener, OnCloseTab {
- private final LayoutInflater mFactory;
- private final UiController mUiController;
- private final TabControl mControl;
- private final TabsListAdapter mAdapter;
- private final ListView mListView;
+ private Context mContext;
+ private UiController mController;
+ private TabControl mTabControl;
+ private View mNewTab, mNewIncognitoTab;
+ private TabAdapter mAdapter;
+ private AbsListView mTabsList;
- public ActiveTabsPage(Context context, UiController control) {
+ public ActiveTabsPage(Context context, UiController controller) {
super(context);
- mUiController = control;
- mControl = control.getTabControl();
- mFactory = LayoutInflater.from(context);
- mFactory.inflate(R.layout.active_tabs, this);
- mListView = (ListView) findViewById(R.id.list);
- mAdapter = new TabsListAdapter();
- mListView.setAdapter(mAdapter);
- mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- public void onItemClick(AdapterView<?> parent, View view,
- int position, long id) {
- if (mControl.canCreateNewTab()) {
- position -= 2;
- }
- boolean needToAttach = false;
- if (position == -2) {
- // Create a new tab
- mUiController.openTabToHomePage();
- } else if (position == -1) {
- // Create a new incognito tab
- mUiController.openIncognitoTab();
- } else {
- // Open the corresponding tab
- // If the tab is the current one, switchToTab will
- // do nothing and return, so we need to make sure
- // it gets attached back to its mContentView in
- // removeActiveTabPage
- needToAttach = !mUiController.switchToTab(position);
- }
- mUiController.removeActiveTabsPage(needToAttach);
- }
- });
+ mContext = context;
+ mController = controller;
+ mTabControl = mController.getTabControl();
+ setOrientation(VERTICAL);
+ setBackgroundResource(R.drawable.bg_browser);
+ LayoutInflater inflate = LayoutInflater.from(mContext);
+ inflate.inflate(R.layout.active_tabs, this, true);
+ mNewTab = findViewById(R.id.new_tab);
+ mNewIncognitoTab = findViewById(R.id.new_incognito_tab);
+ mNewTab.setOnClickListener(this);
+ mNewIncognitoTab.setOnClickListener(this);
+ int visibility = mTabControl.canCreateNewTab() ? View.VISIBLE : View.GONE;
+ mNewTab.setVisibility(visibility);
+ mNewIncognitoTab.setVisibility(visibility);
+ mTabsList = (AbsListView) findViewById(android.R.id.list);
+ mAdapter = new TabAdapter(mContext, mTabControl);
+ mAdapter.setOnCloseListener(this);
+ mTabsList.setAdapter(mAdapter);
+ mTabsList.setOnItemClickListener(this);
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v == mNewTab) {
+ mController.openTabToHomePage();
+ } else if (v == mNewIncognitoTab) {
+ mController.openIncognitoTab();
+ }
+ mController.removeActiveTabsPage(false);
+ }
+
+ @Override
+ public void onItemClick(
+ AdapterView<?> parent, View view, int position, long id) {
+ boolean needToAttach = !mController.switchToTab(position);
+ mController.removeActiveTabsPage(needToAttach);
+ }
+
+ @Override
+ public void onCloseTab(int position) {
+ Tab tab = mTabControl.getTab(position);
+ if (tab != null) {
+ mController.closeTab(tab);
+ if (mTabControl.getTabCount() == 0) {
+ mController.openTabToHomePage();
+ mController.removeActiveTabsPage(false);
+ } else {
+ mAdapter.notifyDataSetChanged();
+ }
+ }
}
/**
@@ -81,7 +106,7 @@
* the parent to be pressed without being pressed itself. This way the line
* of a tab can be pressed, but the close button itself is not.
*/
- private static class CloseHolder extends ImageView {
+ public static class CloseHolder extends ImageView {
public CloseHolder(Context context, AttributeSet attrs) {
super(context, attrs);
}
@@ -96,118 +121,79 @@
}
}
- private class TabsListAdapter extends BaseAdapter {
- private boolean mNotified = true;
- private int mReturnedCount;
- private Handler mHandler = new Handler();
+ static class TabAdapter extends BaseAdapter implements OnClickListener {
+ LayoutInflater mInflater;
+ OnCloseTab mCloseListener;
+ TabControl mTabControl;
+
+ TabAdapter(Context context, TabControl tabs) {
+ mInflater = LayoutInflater.from(context);
+ mTabControl = tabs;
+ }
+
+ void setOnCloseListener(OnCloseTab listener) {
+ mCloseListener = listener;
+ }
+
+ @Override
+ public View getView(int position, View view, ViewGroup parent) {
+ if (view == null) {
+ view = mInflater.inflate(R.layout.tab_view, parent, false);
+ }
+ ImageView favicon = (ImageView) view.findViewById(R.id.favicon);
+ ImageView thumbnail = (ImageView) view.findViewById(R.id.thumb);
+ TextView title = (TextView) view.findViewById(R.id.label);
+ Tab tab = getItem(position);
+
+ String label = tab.getTitle();
+ if (TextUtils.isEmpty(label)) {
+ label = tab.getUrl();
+ }
+ title.setText(label);
+ Bitmap thumbnailBitmap = tab.getScreenshot();
+ if (thumbnailBitmap == null) {
+ thumbnail.setImageResource(R.drawable.browser_thumbnail);
+ } else {
+ thumbnail.setImageBitmap(thumbnailBitmap);
+ }
+ Bitmap faviconBitmap = tab.getFavicon();
+ if (tab.isPrivateBrowsingEnabled()) {
+ favicon.setImageResource(R.drawable.ic_incognito_holo_dark);
+ } else {
+ if (faviconBitmap == null) {
+ favicon.setImageResource(R.drawable.app_web_browser_sm);
+ } else {
+ favicon.setImageBitmap(faviconBitmap);
+ }
+ }
+ View close = view.findViewById(R.id.close);
+ close.setTag(position);
+ close.setOnClickListener(this);
+ return view;
+ }
+
+ @Override
+ public void onClick(View v) {
+ int position = (Integer) v.getTag();
+ if (mCloseListener != null) {
+ mCloseListener.onCloseTab(position);
+ }
+ }
+
+ @Override
public int getCount() {
- int count = mControl.getTabCount();
- if (mControl.canCreateNewTab()) {
- count += 2;
- }
- // XXX: This is a workaround to be more like a real adapter. Most
- // adapters call notifyDataSetChanged() whenever the internal data
- // has changed. Since TabControl is our internal data, we don't
- // know when that changes.
- //
- // Keep track of the last count we returned and whether we called
- // notifyDataSetChanged(). If we did not initiate a data set
- // change, and the count is different, send the notify and return
- // the old count.
- if (!mNotified && count != mReturnedCount) {
- notifyChange();
- return mReturnedCount;
- }
- mReturnedCount = count;
- mNotified = false;
- return count;
+ return mTabControl.getTabCount();
}
- public Object getItem(int position) {
- return null;
+
+ @Override
+ public Tab getItem(int position) {
+ return mTabControl.getTab(position);
}
+
+ @Override
public long getItemId(int position) {
return position;
}
- public int getViewTypeCount() {
- return 2;
- }
- public int getItemViewType(int position) {
- if (mControl.canCreateNewTab()) {
- position -= 2;
- }
- // Do not recycle the "add new tab" item.
- return position < 0 ? IGNORE_ITEM_VIEW_TYPE : 1;
- }
- public View getView(int position, View convertView, ViewGroup parent) {
- final int tabCount = mControl.getTabCount();
- if (mControl.canCreateNewTab()) {
- position -= 2;
- }
-
- if (convertView == null) {
- if (position == -2) {
- convertView = mFactory.inflate(R.layout.tab_view_add_tab, null);
- } else if (position == -1) {
- convertView = mFactory.inflate(R.layout.tab_view_add_incognito_tab, null);
- } else {
- convertView = mFactory.inflate(R.layout.tab_view, null);
- }
- }
-
- if (position >= 0) {
- TextView title =
- (TextView) convertView.findViewById(R.id.title);
- TextView url = (TextView) convertView.findViewById(R.id.url);
- ImageView favicon =
- (ImageView) convertView.findViewById(R.id.favicon);
- View close = convertView.findViewById(R.id.close);
- Tab tab = mControl.getTab(position);
- if (tab.getWebView() == null) {
- // This means that populatePickerData will have to use the
- // saved state.
- Log.w(LOGTAG, "Tab " + position + " has a null WebView and "
- + (tab.getSavedState() == null ? "null" : "non-null")
- + " saved state ");
- }
- if (tab.getTitle() == null || tab.getTitle().length() == 0) {
- Log.w(LOGTAG, "Tab " + position + " has no title. "
- + "Check above in the Logs to see whether it has a "
- + "null WebView or null WebHistoryItem");
- }
- title.setText(tab.getTitle());
- url.setText(tab.getUrl());
- Bitmap icon = tab.getFavicon();
- if (icon != null) {
- favicon.setImageBitmap(icon);
- } else {
- favicon.setImageResource(R.drawable.app_web_browser_sm);
- }
- final int closePosition = position;
- close.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- mUiController.closeTab(
- mControl.getTab(closePosition));
- if (tabCount == 1) {
- mUiController.openTabToHomePage();
- mUiController.removeActiveTabsPage(false);
- } else {
- mNotified = true;
- notifyDataSetChanged();
- }
- }
- });
- }
- return convertView;
- }
-
- void notifyChange() {
- mHandler.post(new Runnable() {
- public void run() {
- mNotified = true;
- notifyDataSetChanged();
- }
- });
- }
}
}
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 71346ae..2a03893 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -17,12 +17,10 @@
package com.android.browser;
import com.android.browser.Tab.LockIcon;
-import com.android.browser.UI.DropdownChangeListener;
-import android.animation.Animator;
-import android.animation.Animator.AnimatorListener;
import android.animation.ObjectAnimator;
import android.app.Activity;
+import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -122,6 +120,20 @@
mTitleShowing = false;
}
+ @Override
+ public WebView createWebView(boolean privateBrowsing) {
+ // Create a new WebView
+ BrowserWebView w = new BrowserWebView(mActivity, null,
+ android.R.attr.webViewStyle, privateBrowsing);
+ initWebViewSettings(w);
+ return w;
+ }
+
+ @Override
+ public WebView createSubWebView(boolean privateBrowsing) {
+ return createWebView(privateBrowsing);
+ }
+
/**
* common webview initialization
* @param w the webview to initialize
@@ -132,6 +144,10 @@
w.setMapTrackballToArrowKeys(false); // use trackball directly
// Enable the built-in zoom
w.getSettings().setBuiltInZoomControls(true);
+ boolean supportsMultiTouch = mActivity.getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
+ w.getSettings().setDisplayZoomControls(!supportsMultiTouch);
+ w.setExpandedTileBounds(true); // smoother scrolling
// Add this WebView to the settings observer list and update the
// settings
@@ -303,8 +319,6 @@
Log.w(LOGTAG, "mContainer is already attached to content in"
+ " attachTabToContentView!");
}
- mainView.setNextFocusUpId(R.id.url_focused);
- mainView.setNextFocusDownId(R.id.url_focused);
mUiController.attachSubWindow(tab);
}
@@ -398,6 +412,13 @@
mContentView.addView(container, COVER_SCREEN_PARAMS);
}
+ protected void refreshWebView() {
+ Tab tab = getActiveTab();
+ if ((tab != null) && (tab.getWebView() != null)) {
+ tab.getWebView().invalidate();
+ }
+ }
+
boolean canShowTitleBar() {
return !isTitleBarShowing()
&& !isActivityPaused()
@@ -429,19 +450,24 @@
}
@Override
- public void showVoiceTitleBar(String title) {
- getTitleBar().setInVoiceMode(true);
+ public void showVoiceTitleBar(String title, List<String> results) {
+ getTitleBar().setInVoiceMode(true, results);
getTitleBar().setDisplayTitle(title);
}
@Override
public void revertVoiceTitleBar(Tab tab) {
- getTitleBar().setInVoiceMode(false);
+ getTitleBar().setInVoiceMode(false, null);
String url = tab.getUrl();
getTitleBar().setDisplayTitle(url);
}
@Override
+ public void registerDropdownChangeListener(DropdownChangeListener d) {
+ getTitleBar().registerDropdownChangeListener(d);
+ }
+
+ @Override
public void showComboView(boolean startWithHistory, Bundle extras) {
if (mComboView != null) {
return;
@@ -455,8 +481,9 @@
FrameLayout wrapper =
(FrameLayout) mContentView.findViewById(R.id.webview_wrapper);
wrapper.setVisibility(View.GONE);
- hideTitleBar();
+ getTitleBar().stopEditingUrl();
dismissIME();
+ hideTitleBar();
if (mActiveTab != null) {
WebView web = mActiveTab.getWebView();
mActiveTab.putInBackground();
@@ -562,7 +589,9 @@
protected void updateNavigationState(Tab tab) {
}
- protected void updateAutoLogin(Tab tab, boolean animate) {}
+ protected void updateAutoLogin(Tab tab, boolean animate) {
+ getTitleBar().updateAutoLogin(tab, animate);
+ }
/**
* Update the lock icon to correspond to our latest state.
@@ -608,11 +637,6 @@
@Override
public void onActionModeFinished(boolean inLoad) {
- if (inLoad) {
- // the titlebar was removed when the CAB was shown
- // if the page is loading, show it again
- showTitleBar();
- }
}
// active tabs page
@@ -721,7 +745,23 @@
warning.show();
}
- @Override
- public void registerDropdownChangeListener(DropdownChangeListener d) {
+ protected void captureTab(final Tab tab) {
+ captureTab(tab,
+ (int) mActivity.getResources()
+ .getDimension(R.dimen.qc_thumb_width),
+ (int) mActivity.getResources()
+ .getDimension(R.dimen.qc_thumb_height));
}
+
+ protected void captureTab(final Tab tab, int width, int height) {
+ if ((tab == null) || (tab.getWebView() == null)) return;
+ Bitmap sshot = Controller.createScreenshot(tab, width, height);
+ tab.setScreenshot(sshot);
+ }
+
+ void showTitleBarAndEdit() {
+ showTitleBar();
+ getTitleBar().startEditingUrl(false);
+ }
+
}
diff --git a/src/com/android/browser/BrowserBookmarksAdapter.java b/src/com/android/browser/BrowserBookmarksAdapter.java
index 9e71077..201079c 100644
--- a/src/com/android/browser/BrowserBookmarksAdapter.java
+++ b/src/com/android/browser/BrowserBookmarksAdapter.java
@@ -20,7 +20,6 @@
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
-import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -31,7 +30,6 @@
class BrowserBookmarksAdapter extends CursorAdapter {
LayoutInflater mInflater;
int mCurrentView;
- Drawable mFaviconBackground;
/**
* Create a new BrowserBookmarksAdapter.
@@ -42,8 +40,6 @@
super(context, null, 0);
mInflater = LayoutInflater.from(context);
selectView(defaultView);
- float density = context.getResources().getDisplayMetrics().density;
- mFaviconBackground = BookmarkUtils.createListFaviconBackground(context);
}
@Override
@@ -101,9 +97,7 @@
} else {
favicon.setImageBitmap(faviconBitmap);
}
- //favicon.setBackgroundResource(R.drawable.bookmark_list_favicon_bg);
- // TODO: Switch to above instead of below once b/3353813 is fixed
- favicon.setBackgroundDrawable(mFaviconBackground);
+ favicon.setBackgroundResource(R.drawable.bookmark_list_favicon_bg);
}
}
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index de28d0d..88b8979 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -331,10 +331,15 @@
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- setHasOptionsMenu(true);
+ SharedPreferences prefs = PreferenceManager
+ .getDefaultSharedPreferences(getActivity());
+ prefs.registerOnSharedPreferenceChangeListener(this);
+ mCurrentView = prefs.getInt(PREF_SELECTED_VIEW, getDefaultView());
Bundle args = getArguments();
mDisableNewWindow = args == null ? false : args.getBoolean(EXTRA_DISABLE_WINDOW, false);
+
+ setHasOptionsMenu(true);
}
@Override
@@ -372,11 +377,6 @@
}
// Start the loaders
LoaderManager lm = getLoaderManager();
- SharedPreferences prefs = PreferenceManager
- .getDefaultSharedPreferences(getActivity());
- prefs.registerOnSharedPreferenceChangeListener(this);
- mCurrentView =
- prefs.getInt(PREF_SELECTED_VIEW, getDefaultView());
mAdapter = new BrowserBookmarksAdapter(getActivity(), mCurrentView);
lm.restartLoader(LOADER_BOOKMARKS, null, this);
diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java
index 44f358d..50bed36 100644
--- a/src/com/android/browser/BrowserHistoryPage.java
+++ b/src/com/android/browser/BrowserHistoryPage.java
@@ -59,6 +59,9 @@
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
+import android.widget.ExpandableListView;
+import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
+import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@@ -68,7 +71,7 @@
* days of viewing.
*/
public class BrowserHistoryPage extends Fragment
- implements LoaderCallbacks<Cursor> {
+ implements LoaderCallbacks<Cursor>, OnChildClickListener {
static final int LOADER_HISTORY = 1;
static final int LOADER_MOST_VISITED = 2;
@@ -82,6 +85,7 @@
ListView mGroupList, mChildList;
private ViewGroup mPrefsContainer;
private FragmentBreadCrumbs mFragmentBreadCrumbs;
+ private ExpandableListView mHistoryList;
// Implementation of WebIconDatabase.IconListener
class IconReceiver implements IconListener {
@@ -187,7 +191,7 @@
switch (loader.getId()) {
case LOADER_HISTORY: {
mAdapter.changeCursor(data);
- if (!mAdapter.isEmpty()
+ if (!mAdapter.isEmpty() && mGroupList != null
&& mGroupList.getCheckedItemPosition() == ListView.INVALID_POSITION) {
selectGroup(0);
}
@@ -229,26 +233,13 @@
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mRoot = inflater.inflate(R.layout.history, container, false);
- ViewStub stub = (ViewStub) mRoot.findViewById(R.id.pref_stub);
- stub.setLayoutResource(com.android.internal.R.layout.preference_list_content);
- stub.inflate();
- mGroupList = (ListView) mRoot.findViewById(android.R.id.list);
- mPrefsContainer = (ViewGroup) mRoot.findViewById(com.android.internal.R.id.prefs_frame);
- mFragmentBreadCrumbs = (FragmentBreadCrumbs) mRoot.findViewById(android.R.id.title);
- mFragmentBreadCrumbs.setMaxVisible(1);
- mFragmentBreadCrumbs.setActivity(getActivity());
- mPrefsContainer.setVisibility(View.VISIBLE);
mAdapter = new HistoryAdapter(getActivity());
- mGroupList.setAdapter(new HistoryGroupWrapper(mAdapter));
- mGroupList.setOnItemClickListener(mGroupItemClickListener);
- mGroupList.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
- mChildWrapper = new HistoryChildWrapper(mAdapter);
- mChildList = new ListView(getActivity());
- mChildList.setAdapter(mChildWrapper);
- mChildList.setOnItemClickListener(mChildItemClickListener);
- registerForContextMenu(mChildList);
- ViewGroup prefs = (ViewGroup) mRoot.findViewById(com.android.internal.R.id.prefs);
- prefs.addView(mChildList);
+ ViewStub stub = (ViewStub) mRoot.findViewById(R.id.pref_stub);
+ if (stub != null) {
+ inflateTwoPane(stub);
+ } else {
+ inflateSinglePane();
+ }
// Start the loaders
getLoaderManager().restartLoader(LOADER_HISTORY, null, this);
@@ -259,6 +250,34 @@
return mRoot;
}
+ private void inflateSinglePane() {
+ mHistoryList = (ExpandableListView) mRoot.findViewById(R.id.history);
+ mHistoryList.setAdapter(mAdapter);
+ mHistoryList.setOnChildClickListener(this);
+ registerForContextMenu(mHistoryList);
+ }
+
+ private void inflateTwoPane(ViewStub stub) {
+ stub.setLayoutResource(R.layout.preference_list_content);
+ stub.inflate();
+ mGroupList = (ListView) mRoot.findViewById(android.R.id.list);
+ mPrefsContainer = (ViewGroup) mRoot.findViewById(R.id.prefs_frame);
+ mFragmentBreadCrumbs = (FragmentBreadCrumbs) mRoot.findViewById(android.R.id.title);
+ mFragmentBreadCrumbs.setMaxVisible(1);
+ mFragmentBreadCrumbs.setActivity(getActivity());
+ mPrefsContainer.setVisibility(View.VISIBLE);
+ mGroupList.setAdapter(new HistoryGroupWrapper(mAdapter));
+ mGroupList.setOnItemClickListener(mGroupItemClickListener);
+ mGroupList.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
+ mChildWrapper = new HistoryChildWrapper(mAdapter);
+ mChildList = new ListView(getActivity());
+ mChildList.setAdapter(mChildWrapper);
+ mChildList.setOnItemClickListener(mChildItemClickListener);
+ registerForContextMenu(mChildList);
+ ViewGroup prefs = (ViewGroup) mRoot.findViewById(R.id.prefs);
+ prefs.addView(mChildList);
+ }
+
private OnItemClickListener mGroupItemClickListener = new OnItemClickListener() {
@Override
public void onItemClick(
@@ -279,6 +298,13 @@
};
@Override
+ public boolean onChildClick(ExpandableListView parent, View view,
+ int groupPosition, int childPosition, long id) {
+ mCallbacks.onUrlSelected(((HistoryItem) view).getUrl(), false);
+ return true;
+ }
+
+ @Override
public void onDestroy() {
super.onDestroy();
CombinedBookmarkHistoryView.getIconListenerSet().removeListener(mIconReceiver);
@@ -341,17 +367,30 @@
}
}
+ View getTargetView(ContextMenuInfo menuInfo) {
+ if (menuInfo instanceof AdapterContextMenuInfo) {
+ return ((AdapterContextMenuInfo) menuInfo).targetView;
+ }
+ if (menuInfo instanceof ExpandableListContextMenuInfo) {
+ return ((ExpandableListContextMenuInfo) menuInfo).targetView;
+ }
+ return null;
+ }
+
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
- AdapterContextMenuInfo i = (AdapterContextMenuInfo) menuInfo;
+
+ View targetView = getTargetView(menuInfo);
+ if (!(targetView instanceof HistoryItem)) {
+ return;
+ }
+ HistoryItem historyItem = (HistoryItem) targetView;
// Inflate the menu
Activity parent = getActivity();
MenuInflater inflater = parent.getMenuInflater();
inflater.inflate(R.menu.historycontext, menu);
- HistoryItem historyItem = (HistoryItem) i.targetView;
-
// Setup the header
if (mContextHeader == null) {
mContextHeader = new HistoryItem(parent, false);
@@ -382,12 +421,11 @@
@Override
public boolean onContextItemSelected(MenuItem item) {
- AdapterContextMenuInfo i =
- (AdapterContextMenuInfo) item.getMenuInfo();
- if (i == null) {
+ ContextMenuInfo menuInfo = item.getMenuInfo();
+ if (menuInfo == null) {
return false;
}
- HistoryItem historyItem = (HistoryItem) i.targetView;
+ HistoryItem historyItem = (HistoryItem) getTargetView(menuInfo);
String url = historyItem.getUrl();
String title = historyItem.getName();
Activity activity = getActivity();
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 357d1e9..9dc3c5f 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -193,7 +193,7 @@
public static final Uri RLZ_PROVIDER_URI = Uri.parse("content://" + RLZ_PROVIDER + "/");
// Set to true to enable some of the about:debug options
- public static final boolean DEV_BUILD = false;
+ public static final boolean DEV_BUILD = true;
private Controller mController;
diff --git a/src/com/android/browser/ScrollWebView.java b/src/com/android/browser/BrowserWebView.java
similarity index 92%
rename from src/com/android/browser/ScrollWebView.java
rename to src/com/android/browser/BrowserWebView.java
index 8c89e51..6111aa6 100644
--- a/src/com/android/browser/ScrollWebView.java
+++ b/src/com/android/browser/BrowserWebView.java
@@ -17,7 +17,6 @@
package com.android.browser;
import android.content.Context;
-import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@@ -28,14 +27,13 @@
/**
* Manage WebView scroll events
*/
-public class ScrollWebView extends WebView implements Runnable {
+public class BrowserWebView extends WebView implements Runnable {
private ScrollListener mScrollListener;
private boolean mIsCancelled;
private boolean mBackgroundRemoved = false;
private boolean mUserInitiated = false;
private TitleBarBase mTitleBar;
- private Bitmap mBitmap;
/**
* @param context
@@ -43,7 +41,7 @@
* @param defStyle
* @param javascriptInterfaces
*/
- public ScrollWebView(Context context, AttributeSet attrs, int defStyle,
+ public BrowserWebView(Context context, AttributeSet attrs, int defStyle,
Map<String, Object> javascriptInterfaces, boolean privateBrowsing) {
super(context, attrs, defStyle, javascriptInterfaces, privateBrowsing);
}
@@ -53,7 +51,7 @@
* @param attrs
* @param defStyle
*/
- public ScrollWebView(
+ public BrowserWebView(
Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) {
super(context, attrs, defStyle, privateBrowsing);
}
@@ -62,14 +60,14 @@
* @param context
* @param attrs
*/
- public ScrollWebView(Context context, AttributeSet attrs) {
+ public BrowserWebView(Context context, AttributeSet attrs) {
super(context, attrs);
}
/**
* @param context
*/
- public ScrollWebView(Context context) {
+ public BrowserWebView(Context context) {
super(context);
}
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index a028882..47b817c 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1056,14 +1056,21 @@
mActivity.startActivity(intent);
}
- public void activateVoiceSearchMode(String title) {
- mUi.showVoiceTitleBar(title);
+ @Override
+ public void activateVoiceSearchMode(String title, List<String> results) {
+ mUi.showVoiceTitleBar(title, results);
}
public void revertVoiceSearchMode(Tab tab) {
mUi.revertVoiceTitleBar(tab);
}
+ public boolean supportsVoiceSearch() {
+ SearchEngine searchEngine = BrowserSettings.getInstance()
+ .getSearchEngine();
+ return (searchEngine != null && searchEngine.supportsVoiceSearch());
+ }
+
public void showCustomView(Tab tab, View view,
WebChromeClient.CustomViewCallback callback) {
if (tab.inForeground()) {
@@ -1774,7 +1781,6 @@
// title bar once again.
mExtendedMenuOpen = false;
mUi.onExtendedMenuClosed(mInLoad);
- mUi.onOptionsMenuOpened();
}
}
} else {
diff --git a/src/com/android/browser/InstantSearchEngine.java b/src/com/android/browser/InstantSearchEngine.java
index 85e494a..6ff7db7 100644
--- a/src/com/android/browser/InstantSearchEngine.java
+++ b/src/com/android/browser/InstantSearchEngine.java
@@ -174,7 +174,12 @@
* visible tab.
*/
private void switchSearchboxIfNeeded() {
- final SearchBox searchBox = getCurrentWebview().getSearchBox();
+ final WebView current = getCurrentWebview();
+ if (current == null) {
+ return;
+ }
+
+ final SearchBox searchBox = current.getSearchBox();
if (searchBox != mSearchBox) {
if (mSearchBox != null) {
mSearchBox.removeSearchBoxListener(mListener);
@@ -188,7 +193,12 @@
}
private boolean isInstantPage() {
- String currentUrl = getCurrentWebview().getUrl();
+ final WebView current = getCurrentWebview();
+ if (current == null) {
+ return false;
+ }
+
+ final String currentUrl = current.getUrl();
if (currentUrl != null) {
Uri uri = Uri.parse(currentUrl);
@@ -210,7 +220,10 @@
mController.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
- getCurrentWebview().loadUrl(getInstantBaseUrl());
+ final WebView current = getCurrentWebview();
+ if (current != null) {
+ current.loadUrl(getInstantBaseUrl());
+ }
}
});
}
@@ -292,7 +305,12 @@
}
private int rescaleHeight(int height) {
- final float scale = getCurrentWebview().getScale();
+ final WebView current = getCurrentWebview();
+ if (current == null) {
+ return 0;
+ }
+
+ final float scale = current.getScale();
if (scale != 0) {
return (int) (height / scale);
}
@@ -306,8 +324,10 @@
if (rescaledHeight != mHeight) {
mHeight = rescaledHeight;
- mSearchBox.setDimensions(0, 0, 0, rescaledHeight);
- mSearchBox.onresize();
+ if (mSearchBox != null) {
+ mSearchBox.setDimensions(0, 0, 0, rescaledHeight);
+ mSearchBox.onresize();
+ }
}
}
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index f1939e4..42e2aff 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -19,6 +19,7 @@
import android.app.Activity;
import android.content.Context;
import android.graphics.PixelFormat;
+import android.os.Handler;
import android.util.Log;
import android.view.ActionMode;
import android.view.Gravity;
@@ -28,6 +29,7 @@
import android.view.View;
import android.view.WindowManager;
import android.webkit.WebView;
+import android.widget.FrameLayout;
/**
* Ui for regular phone screen sizes
@@ -36,9 +38,11 @@
private static final String LOGTAG = "PhoneUi";
- private TitleBar mTitleBar;
+ private TitleBarPhone mTitleBar;
private ActiveTabsPage mActiveTabsPage;
private TouchProxy mTitleOverlay;
+ private boolean mUseQuickControls;
+ private PieControl mPieControl;
boolean mExtendedMenuOpen;
boolean mOptionsMenuOpen;
@@ -49,11 +53,12 @@
*/
public PhoneUi(Activity browser, UiController controller) {
super(browser, controller);
- mTitleBar = new TitleBar(mActivity, mUiController, this);
+ mTitleBar = new TitleBarPhone(mActivity, mUiController, this);
// mTitleBar will be always be shown in the fully loaded mode on
// phone
mTitleBar.setProgress(100);
mActivity.getActionBar().hide();
+ setUseQuickControls(BrowserSettings.getInstance().useQuickControls());
}
@Override
@@ -62,23 +67,6 @@
mActivity.getActionBar().hide();
}
- // webview factory
-
- @Override
- public WebView createWebView(boolean privateBrowsing) {
- // Create a new WebView
- WebView w = new WebView(mActivity, null,
- android.R.attr.webViewStyle, privateBrowsing);
- initWebViewSettings(w);
- return w;
- }
-
- @Override
- public WebView createSubWebView(boolean privateBrowsing) {
- WebView web = createWebView(privateBrowsing);
- return web;
- }
-
// lifecycle
@Override
@@ -122,9 +110,16 @@
if (progress == 100) {
if (!mOptionsMenuOpen || !mExtendedMenuOpen) {
hideTitleBar();
+ if (mUseQuickControls) {
+ mTitleBar.setShowProgressOnly(false);
+ }
}
} else {
if (!mOptionsMenuOpen || mExtendedMenuOpen) {
+ if (mUseQuickControls && !mTitleBar.isEditingUrl()) {
+ mTitleBar.setShowProgressOnly(true);
+ setTitleGravity(Gravity.TOP);
+ }
showTitleBar();
}
}
@@ -132,28 +127,48 @@
}
@Override
- public void setActiveTab(Tab tab) {
- super.setActiveTab(tab);
- WebView view = tab.getWebView();
+ public void setActiveTab(final Tab tab) {
+ captureTab(mActiveTab);
+ super.setActiveTab(tab, true);
+ setActiveTab(tab, true);
+ }
+
+ @Override
+ void setActiveTab(Tab tab, boolean needsAttaching) {
+ BrowserWebView view = (BrowserWebView) tab.getWebView();
// TabControl.setCurrentTab has been called before this,
// so the tab is guaranteed to have a webview
if (view == null) {
Log.e(LOGTAG, "active tab with no webview detected");
return;
}
- view.setEmbeddedTitleBar(getTitleBar());
+ // Request focus on the top window.
+ if (mUseQuickControls) {
+ mPieControl.forceToTop(mContentView);
+ view.setScrollListener(null);
+ } else {
+ // check if title bar is already attached by animation
+ if (mTitleBar.getParent() == null) {
+ view.setEmbeddedTitleBar(mTitleBar);
+ }
+ }
if (tab.isInVoiceSearchMode()) {
- showVoiceTitleBar(tab.getVoiceDisplayTitle());
+ showVoiceTitleBar(tab.getVoiceDisplayTitle(), tab.getVoiceSearchResults());
} else {
revertVoiceTitleBar(tab);
}
+ updateLockIconToLatest(tab);
tab.getTopWindow().requestFocus();
}
@Override
protected void showTitleBar() {
if (canShowTitleBar()) {
- setTitleGravity(Gravity.TOP);
+ if (mUseQuickControls) {
+ mContentView.addView(mTitleBar);
+ } else {
+ setTitleGravity(Gravity.TOP);
+ }
super.showTitleBar();
}
}
@@ -161,7 +176,11 @@
@Override
protected void hideTitleBar() {
if (isTitleBarShowing()) {
- setTitleGravity(Gravity.NO_GRAVITY);
+ if (mUseQuickControls) {
+ mContentView.removeView(mTitleBar);
+ } else {
+ setTitleGravity(Gravity.NO_GRAVITY);
+ }
super.hideTitleBar();
}
}
@@ -175,6 +194,7 @@
@Override
public void showActiveTabsPage() {
+ captureTab(mActiveTab);
mActiveTabsPage = new ActiveTabsPage(mActivity, mUiController);
mTitleBar.setVisibility(View.GONE);
hideTitleBar();
@@ -232,7 +252,9 @@
@Override
public void onExtendedMenuClosed(boolean inLoad) {
mExtendedMenuOpen = false;
- showTitleBar();
+ if (!mUseQuickControls) {
+ showTitleBar();
+ }
}
@Override
@@ -255,6 +277,17 @@
}
@Override
+ public void onActionModeFinished(boolean inLoad) {
+ if (inLoad) {
+ if (mUseQuickControls) {
+ mTitleBar.setShowProgressOnly(true);
+ }
+ showTitleBar();
+ }
+ mActivity.getActionBar().hide();
+ }
+
+ @Override
public boolean dispatchKey(int code, KeyEvent event) {
return false;
}
@@ -287,4 +320,69 @@
return params;
}
}
+
+ @Override
+ protected void setTitleGravity(int gravity) {
+ if (mUseQuickControls) {
+ FrameLayout.LayoutParams lp =
+ (FrameLayout.LayoutParams) getTitleBar().getLayoutParams();
+ lp.gravity = gravity;
+ getTitleBar().setLayoutParams(lp);
+ } else {
+ super.setTitleGravity(gravity);
+ }
+ }
+
+ private void setUseQuickControls(boolean useQuickControls) {
+ mUseQuickControls = useQuickControls;
+ getTitleBar().setUseQuickControls(mUseQuickControls);
+ if (useQuickControls) {
+ mPieControl = new PieControl(mActivity, mUiController, this);
+ mPieControl.attachToContainer(mContentView);
+ Tab tab = getActiveTab();
+ if ((tab != null) && (tab.getWebView() != null)) {
+ tab.getWebView().setEmbeddedTitleBar(null);
+ }
+ } else {
+ mActivity.getActionBar().show();
+ if (mPieControl != null) {
+ mPieControl.removeFromContainer(mContentView);
+ }
+ WebView web = mTabControl.getCurrentWebView();
+ if (web != null) {
+ web.setEmbeddedTitleBar(mTitleBar);
+ }
+ setTitleGravity(Gravity.NO_GRAVITY);
+ }
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ if (mUseQuickControls) {
+ menu.setGroupVisible(R.id.NAV_MENU, false);
+ mPieControl.onMenuOpened(menu);
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ @Override
+ protected void captureTab(final Tab tab) {
+ if (mUseQuickControls) {
+ super.captureTab(tab);
+ } else {
+ captureTab(tab,
+ mActivity.getWindowManager().getDefaultDisplay().getWidth(),
+ (int) mActivity.getResources()
+ .getDimension(R.dimen.tab_view_thumbnail_height));
+ }
+ }
+
+ @Override
+ void showTitleBarAndEdit() {
+ mTitleBar.setShowProgressOnly(false);
+ super.showTitleBarAndEdit();
+ }
+
}
diff --git a/src/com/android/browser/PieControl.java b/src/com/android/browser/PieControl.java
index 38ed1bb..846811d 100644
--- a/src/com/android/browser/PieControl.java
+++ b/src/com/android/browser/PieControl.java
@@ -50,7 +50,7 @@
private Activity mActivity;
private UiController mUiController;
- private XLargeUi mUi;
+ private BaseUi mUi;
private PieMenu mPie;
private PieItem mBack;
private PieItem mForward;
@@ -66,7 +66,7 @@
private TextView mTabsCount;
private int mItemSize;
- public PieControl(Activity activity, UiController controller, XLargeUi ui) {
+ public PieControl(Activity activity, UiController controller, BaseUi ui) {
mActivity = activity;
mUiController = controller;
mUi = ui;
@@ -128,10 +128,10 @@
// level 2
mPie.addItem(mForward);
mPie.addItem(mRefresh);
+ mPie.addItem(mOptions);
mPie.addItem(mShowTabs);
mPie.addItem(mNewTab);
mPie.addItem(mClose);
- mPie.addItem(mOptions);
mPie.setController(this);
}
container.addView(mPie);
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 863fc95..87aca57 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -313,7 +313,9 @@
mVoiceSearchData.mLastVoiceSearchTitle
= mVoiceSearchData.mVoiceSearchResults.get(index);
if (mInForeground) {
- mWebViewController.activateVoiceSearchMode(mVoiceSearchData.mLastVoiceSearchTitle);
+ mWebViewController.activateVoiceSearchMode(
+ mVoiceSearchData.mLastVoiceSearchTitle,
+ mVoiceSearchData.mVoiceSearchResults);
}
if (mVoiceSearchData.mVoiceSearchHtmls != null) {
// When index was found it was already ensured that it was valid
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index 1d17cb3..c97fc71 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -16,7 +16,7 @@
package com.android.browser;
-import com.android.browser.ScrollWebView.ScrollListener;
+import com.android.browser.BrowserWebView.ScrollListener;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
deleted file mode 100644
index 686416c..0000000
--- a/src/com/android/browser/TitleBar.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.browser;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.speech.RecognizerIntent;
-import android.text.SpannableString;
-import android.text.Spanned;
-import android.text.TextUtils;
-import android.text.style.ImageSpan;
-import android.view.ContextMenu;
-import android.view.LayoutInflater;
-import android.view.MenuInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnFocusChangeListener;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-
-/**
- * This class represents a title bar for a particular "tab" or "window" in the
- * browser.
- */
-public class TitleBar extends TitleBarBase implements OnFocusChangeListener,
- OnClickListener {
-
- private Activity mActivity;
- private ImageButton mBookmarkButton;
- private PageProgressView mHorizontalProgress;
- private ImageButton mStopButton;
- private Drawable mBookmarkDrawable;
- private Drawable mVoiceDrawable;
- private boolean mInLoad;
- private Intent mVoiceSearchIntent;
- private ImageSpan mArcsSpan;
-
- public TitleBar(Activity activity, UiController controller, PhoneUi ui) {
- super(activity, controller, ui);
- LayoutInflater factory = LayoutInflater.from(activity);
- factory.inflate(R.layout.title_bar, this);
- mActivity = activity;
-
- mUrlInput = (UrlInputView) findViewById(R.id.url_input);
- mUrlInput.setCompoundDrawablePadding(5);
- mUrlInput.setContainer(this);
- mUrlInput.setSelectAllOnFocus(true);
- mUrlInput.setController(mUiController);
- mUrlInput.setUrlInputListener(this);
- mUrlInput.setOnFocusChangeListener(this);
-
- mLockIcon = (ImageView) findViewById(R.id.lock);
- mFavicon = (ImageView) findViewById(R.id.favicon);
- mStopButton = (ImageButton) findViewById(R.id.stop);
- mBookmarkButton = (ImageButton) findViewById(R.id.bookmark);
- mStopButton.setOnClickListener(this);
- mBookmarkButton.setOnClickListener(this);
-
- mHorizontalProgress = (PageProgressView) findViewById(
- R.id.progress_horizontal);
- mVoiceSearchIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
- mVoiceSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
- RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
- // This extra tells voice search not to send the application id in its
- // results intent - http://b/2546173
- //
- // TODO: Make a constant for this extra.
- mVoiceSearchIntent.putExtra("android.speech.extras.SEND_APPLICATION_ID_EXTRA",
- false);
- PackageManager pm = activity.getPackageManager();
- ResolveInfo ri = pm.resolveActivity(mVoiceSearchIntent,
- PackageManager.MATCH_DEFAULT_ONLY);
- Resources resources = getResources();
- if (ri == null) {
- mVoiceSearchIntent = null;
- } else {
- mVoiceDrawable = resources.getDrawable(
- android.R.drawable.ic_btn_speak_now);
- }
- mBookmarkDrawable = mBookmarkButton.getDrawable();
- mArcsSpan = new ImageSpan(activity, R.drawable.arcs,
- ImageSpan.ALIGN_BASELINE);
- }
-
- @Override
- public void createContextMenu(ContextMenu menu) {
- MenuInflater inflater = mActivity.getMenuInflater();
- inflater.inflate(R.menu.title_context, menu);
- mActivity.onCreateContextMenu(menu, this, null);
- }
-
- /**
- * Change the TitleBar to or from voice mode. If there is no package to
- * handle voice search, the TitleBar cannot be set to voice mode.
- */
- @Override
- void setInVoiceMode(boolean inVoiceMode) {
- if (mInVoiceMode == inVoiceMode) return;
- mInVoiceMode = inVoiceMode && mVoiceSearchIntent != null;
- Drawable titleDrawable;
- if (mInVoiceMode) {
- mBookmarkButton.setImageDrawable(mVoiceDrawable);
- mUrlInput.setEllipsize(null);
- mBookmarkButton.setVisibility(View.VISIBLE);
- mStopButton.setVisibility(View.GONE);
- } else {
- if (mInLoad) {
- mBookmarkButton.setVisibility(View.GONE);
- mStopButton.setVisibility(View.VISIBLE);
- } else {
- mBookmarkButton.setVisibility(View.VISIBLE);
- mStopButton.setVisibility(View.GONE);
- mBookmarkButton.setImageDrawable(mBookmarkDrawable);
- }
- mUrlInput.setEllipsize(TextUtils.TruncateAt.END);
- }
- mUrlInput.setSingleLine(!mInVoiceMode);
- }
-
- /**
- * Update the progress, from 0 to 100.
- */
- @Override
- void setProgress(int newProgress) {
- if (newProgress >= PROGRESS_MAX) {
- mHorizontalProgress.setVisibility(View.GONE);
- if (!mInVoiceMode) {
- mBookmarkButton.setImageDrawable(mBookmarkDrawable);
- mBookmarkButton.setVisibility(View.VISIBLE);
- mStopButton.setVisibility(View.GONE);
- }
- mInLoad = false;
- } else {
- mHorizontalProgress.setProgress(newProgress * PageProgressView.MAX_PROGRESS
- / PROGRESS_MAX);
- if (!mInLoad) {
- mHorizontalProgress.setVisibility(View.VISIBLE);
- if (!mInVoiceMode) {
- mBookmarkButton.setVisibility(View.GONE);
- mStopButton.setVisibility(View.VISIBLE);
- }
- mInLoad = true;
- }
- }
- }
-
- /**
- * Update the text displayed in the title bar.
- * @param title String to display. If null, the new tab string will be
- * shown.
- */
- @Override
- void setDisplayTitle(String title) {
- if (title == null) {
- mUrlInput.setText(R.string.new_tab);
- } else {
- if (mInVoiceMode) {
- // Add two spaces. The second one will be replaced with an
- // image, and the first one will put space between it and the
- // text
- SpannableString spannable = new SpannableString(title + " ");
- int end = spannable.length();
- spannable.setSpan(mArcsSpan, end - 1, end,
- Spanned.SPAN_MARK_POINT);
- mUrlInput.setText(spannable);
- } else {
- mUrlInput.setText(title);
- }
- }
- }
-
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- if (v == mUrlInput && hasFocus) {
- mActivity.closeOptionsMenu();
- }
- }
-
- @Override
- public void onClick(View v) {
- if (v == mStopButton) {
- mUiController.stopLoading();
- } else if (v == mBookmarkButton) {
- mUiController.bookmarkCurrentPage(AddBookmarkPage.DEFAULT_FOLDER_ID,
- true);
- }
- }
-
- @Override
- public void setCurrentUrlIsBookmark(boolean isBookmark) {
- mBookmarkButton.setActivated(isBookmark);
- }
-}
diff --git a/src/com/android/browser/TitleBarBase.java b/src/com/android/browser/TitleBarBase.java
index 46136db..d34d18d 100644
--- a/src/com/android/browser/TitleBarBase.java
+++ b/src/com/android/browser/TitleBarBase.java
@@ -16,7 +16,9 @@
package com.android.browser;
+import com.android.browser.UI.DropdownChangeListener;
import com.android.browser.UrlInputView.UrlInputListener;
+import com.android.browser.autocomplete.SuggestedTextController.TextChangeWatcher;
import android.app.SearchManager;
import android.content.Context;
@@ -29,16 +31,36 @@
import android.graphics.drawable.PaintDrawable;
import android.os.Bundle;
import android.speech.RecognizerResultsIntent;
+import android.text.TextUtils;
+import android.view.ContextThemeWrapper;
import android.view.Gravity;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnFocusChangeListener;
+import android.view.animation.Animation;
+import android.view.animation.Animation.AnimationListener;
+import android.view.animation.AnimationUtils;
+import android.webkit.WebView;
import android.widget.AbsoluteLayout;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ImageButton;
import android.widget.ImageView;
-import android.widget.LinearLayout;
+import android.widget.ProgressBar;
+import android.widget.RelativeLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import java.util.List;
/**
* Base class for a title bar used by the browser.
*/
-public class TitleBarBase extends LinearLayout implements UrlInputListener {
+public class TitleBarBase extends RelativeLayout
+ implements OnClickListener, OnFocusChangeListener, UrlInputListener,
+ TextChangeWatcher, DeviceAccountLogin.AutoLoginCallback {
protected static final int PROGRESS_MAX = 100;
@@ -49,9 +71,21 @@
protected Drawable mGenericFavicon;
protected UiController mUiController;
protected BaseUi mBaseUi;
+
protected UrlInputView mUrlInput;
protected boolean mInVoiceMode;
+ // Auto-login UI
+ protected View mAutoLogin;
+ protected Spinner mAutoLoginAccount;
+ protected Button mAutoLoginLogin;
+ protected ProgressBar mAutoLoginProgress;
+ protected TextView mAutoLoginError;
+ protected ImageButton mAutoLoginCancel;
+ protected DeviceAccountLogin mAutoLoginHandler;
+ protected ArrayAdapter<String> mAccountsAdapter;
+ protected boolean mUseQuickControls;
+
public TitleBarBase(Context context, UiController controller, BaseUi ui) {
super(context, null);
mUiController = controller;
@@ -60,8 +94,35 @@
R.drawable.app_web_browser_sm);
}
+ protected void initLayout(Context context, int layoutId) {
+ LayoutInflater factory = LayoutInflater.from(context);
+ factory.inflate(layoutId, this);
+
+ mUrlInput = (UrlInputView) findViewById(R.id.url);
+ mLockIcon = (ImageView) findViewById(R.id.lock);
+ mUrlInput.setUrlInputListener(this);
+ mUrlInput.setController(mUiController);
+ mUrlInput.setOnFocusChangeListener(this);
+ mUrlInput.setSelectAllOnFocus(true);
+ mUrlInput.addQueryTextWatcher(this);
+ mAutoLogin = findViewById(R.id.autologin);
+ mAutoLoginAccount = (Spinner) findViewById(R.id.autologin_account);
+ mAutoLoginLogin = (Button) findViewById(R.id.autologin_login);
+ mAutoLoginLogin.setOnClickListener(this);
+ mAutoLoginProgress = (ProgressBar) findViewById(R.id.autologin_progress);
+ mAutoLoginError = (TextView) findViewById(R.id.autologin_error);
+ mAutoLoginCancel = (ImageButton) mAutoLogin.findViewById(R.id.autologin_close);
+ mAutoLoginCancel.setOnClickListener(this);
+ }
+
+ protected void setupUrlInput() {
+ }
+
+ protected void setUseQuickControls(boolean use) {
+ mUseQuickControls = use;
+ }
+
/* package */ void setProgress(int newProgress) {}
- /* package */ void setDisplayTitle(String title) {}
/* package */ void setLock(Drawable d) {
assert mLockIcon != null;
@@ -90,10 +151,6 @@
mFavicon.setImageDrawable(d);
}
- /* package */ void setInVoiceMode(boolean inVoiceMode) {}
-
- /* package */ void setIncognitoMode(boolean incognito) {}
-
void setTitleGravity(int gravity) {
int newTop = 0;
if (gravity != Gravity.NO_GRAVITY) {
@@ -117,6 +174,181 @@
return getHeight();
}
+ protected void updateAutoLogin(Tab tab, boolean animate) {
+ DeviceAccountLogin login = tab.getDeviceAccountLogin();
+ if (login != null) {
+ mAutoLoginHandler = login;
+ ContextThemeWrapper wrapper = new ContextThemeWrapper(mContext,
+ android.R.style.Theme_Holo_Light);
+ mAccountsAdapter = new ArrayAdapter<String>(wrapper,
+ android.R.layout.simple_spinner_item, login.getAccountNames());
+ mAccountsAdapter.setDropDownViewResource(
+ android.R.layout.simple_spinner_dropdown_item);
+ mAutoLoginAccount.setAdapter(mAccountsAdapter);
+ mAutoLoginAccount.setSelection(0);
+ mAutoLoginAccount.setEnabled(true);
+ mAutoLoginLogin.setEnabled(true);
+ mAutoLoginProgress.setVisibility(View.GONE);
+ mAutoLoginError.setVisibility(View.GONE);
+ switch (login.getState()) {
+ case DeviceAccountLogin.PROCESSING:
+ mAutoLoginAccount.setEnabled(false);
+ mAutoLoginLogin.setEnabled(false);
+ mAutoLoginProgress.setVisibility(View.VISIBLE);
+ break;
+ case DeviceAccountLogin.FAILED:
+ mAutoLoginProgress.setVisibility(View.GONE);
+ mAutoLoginError.setVisibility(View.VISIBLE);
+ break;
+ case DeviceAccountLogin.INITIAL:
+ break;
+ default:
+ throw new IllegalStateException();
+ }
+ showAutoLogin(animate);
+ } else {
+ hideAutoLogin(animate);
+ }
+ }
+
+ protected void showAutoLogin(boolean animate) {
+ mAutoLogin.setVisibility(View.VISIBLE);
+ if (animate) {
+ mAutoLogin.startAnimation(AnimationUtils.loadAnimation(
+ getContext(), R.anim.autologin_enter));
+ }
+ }
+
+ protected void hideAutoLogin(boolean animate) {
+ mAutoLoginHandler = null;
+ if (animate) {
+ Animation anim = AnimationUtils.loadAnimation(
+ getContext(), R.anim.autologin_exit);
+ anim.setAnimationListener(new AnimationListener() {
+ @Override public void onAnimationEnd(Animation a) {
+ mAutoLogin.setVisibility(View.GONE);
+ mBaseUi.refreshWebView();
+ }
+ @Override public void onAnimationStart(Animation a) {}
+ @Override public void onAnimationRepeat(Animation a) {}
+ });
+ mAutoLogin.startAnimation(anim);
+ } else if (mAutoLogin.getAnimation() == null) {
+ mAutoLogin.setVisibility(View.GONE);
+ mBaseUi.refreshWebView();
+ }
+ }
+
+ @Override
+ public void loginFailed() {
+ mAutoLoginAccount.setEnabled(true);
+ mAutoLoginLogin.setEnabled(true);
+ mAutoLoginProgress.setVisibility(View.GONE);
+ mAutoLoginError.setVisibility(View.VISIBLE);
+ }
+
+
+ protected boolean inAutoLogin() {
+ return mAutoLoginHandler != null;
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (mAutoLoginCancel == v) {
+ if (mAutoLoginHandler != null) {
+ mAutoLoginHandler.cancel();
+ mAutoLoginHandler = null;
+ }
+ hideAutoLogin(true);
+ } else if (mAutoLoginLogin == v) {
+ if (mAutoLoginHandler != null) {
+ mAutoLoginAccount.setEnabled(false);
+ mAutoLoginLogin.setEnabled(false);
+ mAutoLoginProgress.setVisibility(View.VISIBLE);
+ mAutoLoginError.setVisibility(View.GONE);
+ mAutoLoginHandler.login(
+ mAutoLoginAccount.getSelectedItemPosition(), this);
+ }
+ }
+ }
+
+ @Override
+ public void onFocusChange(View view, boolean hasFocus) {
+ // if losing focus and not in touch mode, leave as is
+ if (hasFocus || view.isInTouchMode() || mUrlInput.needsUpdate()) {
+ setFocusState(hasFocus);
+ }
+ if (hasFocus) {
+ mUrlInput.forceIme();
+ if (mInVoiceMode) {
+ mUrlInput.forceFilter();
+ }
+ } else if (!mUrlInput.needsUpdate()) {
+ mUrlInput.dismissDropDown();
+ mUrlInput.hideIME();
+ if (mUrlInput.getText().length() == 0) {
+ Tab currentTab = mUiController.getTabControl().getCurrentTab();
+ if (currentTab != null) {
+ mUrlInput.setText(currentTab.getUrl(), false);
+ }
+ }
+ }
+ mUrlInput.clearNeedsUpdate();
+ }
+
+ protected void setFocusState(boolean focus) {
+ if (focus) {
+ updateSearchMode(false);
+ }
+ }
+
+ protected void updateSearchMode(boolean userEdited) {
+ setSearchMode(!userEdited || TextUtils.isEmpty(mUrlInput.getUserText()));
+ }
+
+ protected void setSearchMode(boolean voiceSearchEnabled) {}
+
+ boolean isEditingUrl() {
+ return mUrlInput.hasFocus();
+ }
+
+ void stopEditingUrl() {
+ mUrlInput.clearFocus();
+ }
+
+ void setDisplayTitle(String title) {
+ if (!isEditingUrl()) {
+ mUrlInput.setText(title, false);
+ }
+ }
+
+ // UrlInput text watcher
+
+ @Override
+ public void onTextChanged(String newText) {
+ if (mUrlInput.hasFocus()) {
+ // check if input field is empty and adjust voice search state
+ updateSearchMode(true);
+ // clear voice mode when user types
+ setInVoiceMode(false, null);
+ }
+ }
+
+ // voicesearch
+
+ public void setInVoiceMode(boolean voicemode, List<String> voiceResults) {
+ mInVoiceMode = voicemode;
+ mUrlInput.setVoiceResults(voiceResults);
+ }
+
+ void setIncognitoMode(boolean incognito) {
+ mUrlInput.setIncognitoMode(incognito);
+ }
+
+ void clearCompletions() {
+ mUrlInput.setSuggestedText(null);
+ }
+
// UrlInputListener implementation
/**
@@ -178,4 +410,33 @@
public void setCurrentUrlIsBookmark(boolean isBookmark) {
}
+ @Override
+ public boolean dispatchKeyEventPreIme(KeyEvent evt) {
+ if (evt.getKeyCode() == KeyEvent.KEYCODE_BACK) {
+ // catch back key in order to do slightly more cleanup than usual
+ mUrlInput.clearFocus();
+ return true;
+ }
+ return super.dispatchKeyEventPreIme(evt);
+ }
+
+ protected WebView getCurrentWebView() {
+ Tab t = mBaseUi.getActiveTab();
+ if (t != null) {
+ return t.getWebView();
+ } else {
+ return null;
+ }
+ }
+
+ void registerDropdownChangeListener(DropdownChangeListener d) {
+ mUrlInput.registerDropdownChangeListener(d);
+ }
+
+ /**
+ * called from the Ui when the user wants to edit
+ * @param clearInput clear the input field
+ */
+ void startEditingUrl(boolean clearInput) {};
+
}
diff --git a/src/com/android/browser/TitleBarPhone.java b/src/com/android/browser/TitleBarPhone.java
new file mode 100644
index 0000000..3edd831
--- /dev/null
+++ b/src/com/android/browser/TitleBarPhone.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.browser;
+
+import com.android.browser.autocomplete.SuggestedTextController.TextChangeWatcher;
+import com.android.browser.view.StopProgressView;
+
+import android.app.Activity;
+import android.content.Context;
+import android.view.ContextMenu;
+import android.view.MenuInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnFocusChangeListener;
+import android.view.ViewGroup;
+import android.widget.AbsoluteLayout;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.RelativeLayout.LayoutParams;
+
+import java.util.List;
+
+/**
+ * This class represents a title bar for a particular "tab" or "window" in the
+ * browser.
+ */
+public class TitleBarPhone extends TitleBarBase implements OnFocusChangeListener,
+ OnClickListener, TextChangeWatcher {
+
+ private Activity mActivity;
+ private ImageView mStopButton;
+ private PageProgressView mProgress;
+ private ImageView mVoiceButton;
+ private boolean mInLoad;
+ private View mContainer;
+ private boolean mHasLockIcon;
+
+ public TitleBarPhone(Activity activity, UiController controller, PhoneUi ui) {
+ super(activity, controller, ui);
+ mActivity = activity;
+ initLayout(activity, R.layout.title_bar);
+ }
+
+ @Override
+ protected void initLayout(Context context, int layoutId) {
+ super.initLayout(context, layoutId);
+ mContainer = findViewById(R.id.taburlbar);
+ mLockIcon = (ImageView) findViewById(R.id.lock);
+ mFavicon = (ImageView) findViewById(R.id.favicon);
+ mStopButton = (ImageView) findViewById(R.id.stop);
+ mStopButton.setOnClickListener(this);
+ mProgress = (PageProgressView) findViewById(R.id.progress);
+ mVoiceButton = (ImageView) findViewById(R.id.voice);
+ mVoiceButton.setOnClickListener(this);
+ setFocusState(false);
+ }
+
+ @Override
+ public int getEmbeddedHeight() {
+ int height = mContainer.getHeight();
+ return height;
+ }
+
+ @Override
+ public void createContextMenu(ContextMenu menu) {
+ MenuInflater inflater = mActivity.getMenuInflater();
+ inflater.inflate(R.menu.title_context, menu);
+ mActivity.onCreateContextMenu(menu, this, null);
+ }
+
+ @Override
+ public void setInVoiceMode(boolean voicemode, List<String> voiceResults) {
+ super.setInVoiceMode(voicemode, voiceResults);
+ }
+
+ @Override
+ protected void setSearchMode(boolean voiceSearchEnabled) {
+ boolean showvoicebutton = voiceSearchEnabled &&
+ mUiController.supportsVoiceSearch();
+ mVoiceButton.setVisibility(showvoicebutton ? View.VISIBLE :
+ View.GONE);
+ }
+
+ @Override
+ protected void setFocusState(boolean focus) {
+ super.setFocusState(focus);
+ if (focus) {
+ mHasLockIcon = (mLockIcon.getVisibility() == View.VISIBLE);
+ mFavicon.setVisibility(View.GONE);
+ mLockIcon.setVisibility(View.GONE);
+ mStopButton.setVisibility(View.GONE);
+ mVoiceButton.setVisibility(View.VISIBLE);
+ } else {
+ mFavicon.setVisibility(View.VISIBLE);
+ mLockIcon.setVisibility(mHasLockIcon ? View.VISIBLE : View.GONE);
+ if (mInLoad) {
+ mStopButton.setVisibility(View.VISIBLE);
+ } else {
+ mStopButton.setVisibility(View.GONE);
+ }
+ mVoiceButton.setVisibility(View.GONE);
+ }
+ }
+
+ /**
+ * Update the progress, from 0 to 100.
+ */
+ @Override
+ void setProgress(int newProgress) {
+ boolean blockvisuals = mUseQuickControls && isEditingUrl();
+ if (newProgress >= PROGRESS_MAX) {
+ mInLoad = false;
+ if (!blockvisuals) {
+ mProgress.setProgress(PageProgressView.MAX_PROGRESS);
+ mProgress.setVisibility(View.GONE);
+ }
+ setFocusState(mUrlInput.hasFocus());
+ } else {
+ if (!mInLoad) {
+ mInLoad = true;
+ if (!blockvisuals) {
+ mProgress.setVisibility(View.VISIBLE);
+ }
+ setFocusState(mUrlInput.hasFocus());
+ }
+ mProgress.setProgress(newProgress * PageProgressView.MAX_PROGRESS
+ / PROGRESS_MAX);
+ }
+ }
+
+ /**
+ * Update the text displayed in the title bar.
+ * @param title String to display. If null, the new tab string will be
+ * shown.
+ */
+ @Override
+ void setDisplayTitle(String title) {
+ if (title == null) {
+ mUrlInput.setText(R.string.new_tab);
+ } else {
+ mUrlInput.setText(title);
+ }
+ }
+
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (v == mUrlInput) {
+ if (hasFocus) {
+ mActivity.closeOptionsMenu();
+ }
+ }
+ super.onFocusChange(v, hasFocus);
+ if (mUseQuickControls && !hasFocus) {
+ mBaseUi.hideTitleBar();
+ }
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v == mStopButton) {
+ mUiController.stopLoading();
+ } else if (v == mVoiceButton) {
+ mUiController.startVoiceSearch();
+ } else {
+ super.onClick(v);
+ }
+ }
+
+ @Override
+ void startEditingUrl(boolean clearInput) {
+ // editing takes preference of progress
+ mContainer.setVisibility(View.VISIBLE);
+ if (!mUrlInput.hasFocus()) {
+ mUrlInput.requestFocus();
+ }
+ if (clearInput) {
+ mUrlInput.setText("");
+ } else if (mInVoiceMode) {
+ mUrlInput.showDropDown();
+ }
+ }
+
+ @Override
+ void setTitleGravity(int gravity) {
+ if (mUseQuickControls) {
+ FrameLayout.LayoutParams lp =
+ (FrameLayout.LayoutParams) getLayoutParams();
+ lp.gravity = gravity;
+ setLayoutParams(lp);
+ } else {
+ super.setTitleGravity(gravity);
+ }
+ }
+
+ @Override
+ protected void setUseQuickControls(boolean useQuickControls) {
+ mUseQuickControls = useQuickControls;
+ setLayoutParams(makeLayoutParams());
+ }
+
+ void setShowProgressOnly(boolean progress) {
+ if (progress && !inAutoLogin()) {
+ mContainer.setVisibility(View.GONE);
+ } else {
+ mContainer.setVisibility(View.VISIBLE);
+ }
+ }
+
+ private ViewGroup.LayoutParams makeLayoutParams() {
+ if (mUseQuickControls) {
+ return new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
+ LayoutParams.WRAP_CONTENT);
+ } else {
+ return new AbsoluteLayout.LayoutParams(
+ LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,
+ 0, 0);
+ }
+ }
+
+}
diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java
index 5f02002..4254046 100644
--- a/src/com/android/browser/TitleBarXLarge.java
+++ b/src/com/android/browser/TitleBarXLarge.java
@@ -16,37 +16,23 @@
package com.android.browser;
-import com.android.browser.UI.DropdownChangeListener;
import com.android.browser.autocomplete.SuggestedTextController.TextChangeWatcher;
-import com.android.browser.search.SearchEngine;
-import android.accounts.Account;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
-import android.view.ContextThemeWrapper;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.ViewGroup;
-import android.view.animation.Animation;
-import android.view.animation.Animation.AnimationListener;
-import android.view.animation.AnimationUtils;
import android.webkit.WebView;
import android.widget.AbsoluteLayout;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
-import android.widget.ProgressBar;
-import android.widget.Spinner;
-import android.widget.TextView;
import java.util.List;
@@ -62,13 +48,13 @@
private Drawable mStopDrawable;
private Drawable mReloadDrawable;
- private View mContainer;
+ private View mUrlContainer;
private ImageButton mBackButton;
private ImageButton mForwardButton;
private ImageView mStar;
private ImageView mUrlIcon;
private ImageView mSearchButton;
- private View mUrlContainer;
+ private View mContainer;
private View mGoButton;
private ImageView mStopButton;
private View mAllButton;
@@ -77,18 +63,8 @@
private PageProgressView mProgressView;
private Drawable mFocusDrawable;
private Drawable mUnfocusDrawable;
- // Auto-login UI
- private View mAutoLogin;
- private Spinner mAutoLoginAccount;
- private Button mAutoLoginLogin;
- private ProgressBar mAutoLoginProgress;
- private TextView mAutoLoginError;
- private ImageButton mAutoLoginCancel;
- private DeviceAccountLogin mAutoLoginHandler;
- private ArrayAdapter<String> mAccountsAdapter;
private boolean mInLoad;
- private boolean mUseQuickControls;
public TitleBarXLarge(Activity activity, UiController controller,
XLargeUi ui) {
@@ -102,7 +78,7 @@
mUnfocusDrawable = resources.getDrawable(
R.drawable.textfield_default_holo_dark);
mInVoiceMode = false;
- initLayout(activity);
+ initLayout(activity, R.layout.url_bar);
}
@Override
@@ -117,12 +93,11 @@
}
}
- private void initLayout(Context context) {
- LayoutInflater factory = LayoutInflater.from(context);
- factory.inflate(R.layout.url_bar, this);
+ @Override
+ protected void initLayout(Context context, int layoutId) {
+ super.initLayout(context, layoutId);
mContainer = findViewById(R.id.taburlbar);
- mUrlInput = (UrlInputView) findViewById(R.id.url_focused);
mAllButton = findViewById(R.id.all_btn);
// TODO: Change enabled states based on whether you can go
// back/forward. Probably should be done inside onPageStarted.
@@ -147,23 +122,7 @@
mGoButton.setOnClickListener(this);
mClearButton.setOnClickListener(this);
mVoiceSearch.setOnClickListener(this);
- mUrlInput.setUrlInputListener(this);
mUrlInput.setContainer(mUrlContainer);
- mUrlInput.setController(mUiController);
- mUrlInput.setOnFocusChangeListener(this);
- mUrlInput.setSelectAllOnFocus(true);
- mUrlInput.addQueryTextWatcher(this);
- mAutoLogin = findViewById(R.id.autologin);
- mAutoLoginAccount = (Spinner) findViewById(R.id.autologin_account);
- mAutoLoginLogin = (Button) findViewById(R.id.autologin_login);
- mAutoLoginLogin.setOnClickListener(this);
- mAutoLoginProgress =
- (ProgressBar) findViewById(R.id.autologin_progress);
- mAutoLoginError = (TextView) findViewById(R.id.autologin_error);
- mAutoLoginCancel =
- (ImageButton) mAutoLogin.findViewById(R.id.autologin_close);
- mAutoLoginCancel.setOnClickListener(this);
-
setFocusState(false);
}
@@ -179,67 +138,6 @@
}
}
- void updateAutoLogin(Tab tab, boolean animate) {
- DeviceAccountLogin login = tab.getDeviceAccountLogin();
- if (login != null) {
- mAutoLoginHandler = login;
- mAutoLogin.setVisibility(View.VISIBLE);
- ContextThemeWrapper wrapper = new ContextThemeWrapper(mContext,
- android.R.style.Theme_Holo_Light);
- mAccountsAdapter = new ArrayAdapter<String>(wrapper,
- android.R.layout.simple_spinner_item, login.getAccountNames());
- mAccountsAdapter.setDropDownViewResource(
- android.R.layout.simple_spinner_dropdown_item);
- mAutoLoginAccount.setAdapter(mAccountsAdapter);
- mAutoLoginAccount.setSelection(0);
- mAutoLoginAccount.setEnabled(true);
- mAutoLoginLogin.setEnabled(true);
- mAutoLoginProgress.setVisibility(View.GONE);
- mAutoLoginError.setVisibility(View.GONE);
- switch (login.getState()) {
- case DeviceAccountLogin.PROCESSING:
- mAutoLoginAccount.setEnabled(false);
- mAutoLoginLogin.setEnabled(false);
- mAutoLoginProgress.setVisibility(View.VISIBLE);
- break;
- case DeviceAccountLogin.FAILED:
- mAutoLoginProgress.setVisibility(View.GONE);
- mAutoLoginError.setVisibility(View.VISIBLE);
- break;
- case DeviceAccountLogin.INITIAL:
- break;
- default:
- throw new IllegalStateException();
- }
- if (mUseQuickControls) {
- mUi.showTitleBar();
- } else {
- if (animate) {
- mAutoLogin.startAnimation(AnimationUtils.loadAnimation(
- getContext(), R.anim.autologin_enter));
- }
- }
- } else {
- mAutoLoginHandler = null;
- if (mUseQuickControls) {
- mUi.hideTitleBar();
- mAutoLogin.setVisibility(View.GONE);
- mUi.refreshWebView();
- } else {
- if (animate) {
- hideAutoLogin();
- } else if (mAutoLogin.getAnimation() == null) {
- mAutoLogin.setVisibility(View.GONE);
- mUi.refreshWebView();
- }
- }
- }
- }
-
- boolean inAutoLogin() {
- return mAutoLoginHandler != null;
- }
-
private ViewGroup.LayoutParams makeLayoutParams() {
if (mUseQuickControls) {
return new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
@@ -260,7 +158,8 @@
return height;
}
- void setUseQuickControls(boolean useQuickControls) {
+ @Override
+ protected void setUseQuickControls(boolean useQuickControls) {
mUseQuickControls = useQuickControls;
setLayoutParams(makeLayoutParams());
}
@@ -312,6 +211,7 @@
* called from the Ui when the user wants to edit
* @param clearInput clear the input field
*/
+ @Override
void startEditingUrl(boolean clearInput) {
// editing takes preference of progress
mContainer.setVisibility(View.VISIBLE);
@@ -328,26 +228,24 @@
}
}
- boolean isEditingUrl() {
- return mUrlInput.hasFocus();
+ @Override
+ protected void showAutoLogin(boolean animate) {
+ if (mUseQuickControls) {
+ mUi.showTitleBar();
+ }
+ super.showAutoLogin(animate);
}
- void stopEditingUrl() {
- mUrlInput.clearFocus();
- }
-
- private void hideAutoLogin() {
- Animation anim = AnimationUtils.loadAnimation(
- getContext(), R.anim.autologin_exit);
- anim.setAnimationListener(new AnimationListener() {
- @Override public void onAnimationEnd(Animation a) {
- mAutoLogin.setVisibility(View.GONE);
- mUi.refreshWebView();
- }
- @Override public void onAnimationStart(Animation a) {}
- @Override public void onAnimationRepeat(Animation a) {}
- });
- mAutoLogin.startAnimation(anim);
+ @Override
+ protected void hideAutoLogin(boolean animate) {
+ mAutoLoginHandler = null;
+ if (mUseQuickControls) {
+ mUi.hideTitleBar();
+ mAutoLogin.setVisibility(View.GONE);
+ mUi.refreshWebView();
+ } else {
+ super.hideAutoLogin(animate);
+ }
}
@Override
@@ -374,33 +272,12 @@
clearOrClose();
} else if (mVoiceSearch == v) {
mUiController.startVoiceSearch();
- } else if (mAutoLoginCancel == v) {
- if (mAutoLoginHandler != null) {
- mAutoLoginHandler.cancel();
- mAutoLoginHandler = null;
- }
- hideAutoLogin();
- } else if (mAutoLoginLogin == v) {
- if (mAutoLoginHandler != null) {
- mAutoLoginAccount.setEnabled(false);
- mAutoLoginLogin.setEnabled(false);
- mAutoLoginProgress.setVisibility(View.VISIBLE);
- mAutoLoginError.setVisibility(View.GONE);
- mAutoLoginHandler.login(
- mAutoLoginAccount.getSelectedItemPosition(), this);
- }
+ } else {
+ super.onClick(v);
}
}
@Override
- public void loginFailed() {
- mAutoLoginAccount.setEnabled(true);
- mAutoLoginLogin.setEnabled(true);
- mAutoLoginProgress.setVisibility(View.GONE);
- mAutoLoginError.setVisibility(View.VISIBLE);
- }
-
- @Override
void setFavicon(Bitmap icon) { }
private void clearOrClose() {
@@ -413,10 +290,10 @@
}
}
- private void setFocusState(boolean focus) {
+ @Override
+ protected void setFocusState(boolean focus) {
+ super.setFocusState(focus);
if (focus) {
- mUrlInput.setDropDownWidth(mUrlContainer.getWidth());
- mUrlInput.setDropDownHorizontalOffset(-mUrlInput.getLeft());
mSearchButton.setVisibility(View.GONE);
mStar.setVisibility(View.GONE);
mClearButton.setVisibility(View.VISIBLE);
@@ -472,15 +349,15 @@
}
}
- private void updateSearchMode(boolean userEdited) {
+ @Override
+ protected void updateSearchMode(boolean userEdited) {
setSearchMode(!userEdited || TextUtils.isEmpty(mUrlInput.getUserText()));
}
- private void setSearchMode(boolean voiceSearchEnabled) {
- SearchEngine searchEngine = BrowserSettings.getInstance()
- .getSearchEngine();
+ @Override
+ protected void setSearchMode(boolean voiceSearchEnabled) {
boolean showvoicebutton = voiceSearchEnabled &&
- (searchEngine != null && searchEngine.supportsVoiceSearch());
+ mUiController.supportsVoiceSearch();
mVoiceSearch.setVisibility(showvoicebutton ? View.VISIBLE :
View.GONE);
mGoButton.setVisibility(voiceSearchEnabled ? View.GONE :
@@ -488,45 +365,14 @@
}
@Override
- /* package */ void setDisplayTitle(String title) {
- if (!isEditingUrl()) {
- mUrlInput.setText(title, false);
- }
- }
-
- // UrlInput text watcher
-
- @Override
- public void onTextChanged(String newText) {
- if (mUrlInput.hasFocus()) {
- // check if input field is empty and adjust voice search state
- updateSearchMode(true);
- // clear voice mode when user types
- setInVoiceMode(false, null);
- }
- }
-
- // voicesearch
-
- @Override
- public void setInVoiceMode(boolean voicemode) {
- setInVoiceMode(voicemode, null);
- }
-
public void setInVoiceMode(boolean voicemode, List<String> voiceResults) {
- mInVoiceMode = voicemode;
- mUrlInput.setVoiceResults(voiceResults);
+ super.setInVoiceMode(voicemode, voiceResults);
if (voicemode) {
mUrlIcon.setImageDrawable(mSearchButton.getDrawable());
}
}
@Override
- void setIncognitoMode(boolean incognito) {
- mUrlInput.setIncognitoMode(incognito);
- }
-
- @Override
public View focusSearch(View focused, int dir) {
if (FOCUS_DOWN == dir && hasFocus()) {
return getCurrentWebView();
@@ -534,30 +380,4 @@
return super.focusSearch(focused, dir);
}
- void clearCompletions() {
- mUrlInput.setSuggestedText(null);
- }
-
- @Override
- public boolean dispatchKeyEventPreIme(KeyEvent evt) {
- if (evt.getKeyCode() == KeyEvent.KEYCODE_BACK) {
- // catch back key in order to do slightly more cleanup than usual
- mUrlInput.clearFocus();
- return true;
- }
- return super.dispatchKeyEventPreIme(evt);
- }
-
- private WebView getCurrentWebView() {
- Tab t = mUi.getActiveTab();
- if (t != null) {
- return t.getWebView();
- } else {
- return null;
- }
- }
-
- void registerDropdownChangeListener(DropdownChangeListener d) {
- mUrlInput.registerDropdownChangeListener(d);
- }
}
diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java
index 368c829..40fc14a 100644
--- a/src/com/android/browser/UI.java
+++ b/src/com/android/browser/UI.java
@@ -85,7 +85,7 @@
public boolean isCustomViewShowing();
- public void showVoiceTitleBar(String title);
+ public void showVoiceTitleBar(String title, List<String> results);
public void revertVoiceTitleBar(Tab tab);
diff --git a/src/com/android/browser/UiController.java b/src/com/android/browser/UiController.java
index 65fa5f8..c22494b 100644
--- a/src/com/android/browser/UiController.java
+++ b/src/com/android/browser/UiController.java
@@ -60,6 +60,8 @@
void startVoiceSearch();
+ boolean supportsVoiceSearch();
+
void showVoiceSearchResults(String title);
void editUrl();
diff --git a/src/com/android/browser/WebViewController.java b/src/com/android/browser/WebViewController.java
index 6b44207..93ca410 100644
--- a/src/com/android/browser/WebViewController.java
+++ b/src/com/android/browser/WebViewController.java
@@ -31,6 +31,8 @@
import android.webkit.WebChromeClient;
import android.webkit.WebView;
+import java.util.List;
+
/**
* WebView aspect of the controller
*/
@@ -85,7 +87,7 @@
void onUserCanceledSsl(Tab tab);
- void activateVoiceSearchMode(String title);
+ void activateVoiceSearchMode(String title, List<String> results);
void revertVoiceSearchMode(Tab tab);
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index 8c34fc9..e19515e 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -16,15 +16,13 @@
package com.android.browser;
-import com.android.browser.ScrollWebView.ScrollListener;
+import com.android.browser.BrowserWebView.ScrollListener;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.ObjectAnimator;
import android.app.ActionBar;
import android.app.Activity;
-import android.content.pm.PackageManager;
-import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
@@ -149,23 +147,14 @@
@Override
public WebView createWebView(boolean privateBrowsing) {
// Create a new WebView
- ScrollWebView w = new ScrollWebView(mActivity, null,
- android.R.attr.webViewStyle, privateBrowsing);
- initWebViewSettings(w);
+ BrowserWebView w = (BrowserWebView) super.createWebView(privateBrowsing);
w.setScrollListener(this);
- boolean supportsMultiTouch = mActivity.getPackageManager()
- .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
- w.getSettings().setDisplayZoomControls(!supportsMultiTouch);
- w.setExpandedTileBounds(true); // smoother scrolling
return w;
}
@Override
public WebView createSubWebView(boolean privateBrowsing) {
- ScrollWebView web = (ScrollWebView) createWebView(privateBrowsing);
- // no scroll listener for subview
- web.setScrollListener(null);
- return web;
+ return super.createWebView(privateBrowsing);
}
@Override
@@ -174,7 +163,7 @@
}
void stopWebViewScrolling() {
- ScrollWebView web = (ScrollWebView) mUiController.getCurrentWebView();
+ BrowserWebView web = (BrowserWebView) mUiController.getCurrentWebView();
if (web != null) {
web.stopScroll();
}
@@ -225,7 +214,6 @@
public void setActiveTab(final Tab tab) {
cancelTitleBarAnimation(true);
mSkipTitleBarAnimations = true;
- stopEditingUrl();
if (mUseQuickControls) {
if (mActiveTab != null) {
captureTab(mActiveTab);
@@ -238,7 +226,7 @@
@Override
void setActiveTab(Tab tab, boolean needsAttaching) {
- ScrollWebView view = (ScrollWebView) tab.getWebView();
+ BrowserWebView view = (BrowserWebView) tab.getWebView();
// TabControl.setCurrentTab has been called before this,
// so the tab is guaranteed to have a webview
if (view == null) {
@@ -259,7 +247,7 @@
}
mTabBar.onSetActiveTab(tab);
if (tab.isInVoiceSearchMode()) {
- showVoiceTitleBar(tab.getVoiceDisplayTitle());
+ showVoiceTitleBar(tab.getVoiceDisplayTitle(), tab.getVoiceSearchResults());
} else {
revertVoiceTitleBar(tab);
}
@@ -267,14 +255,6 @@
tab.getTopWindow().requestFocus();
}
- public void captureTab(final Tab tab) {
- Bitmap sshot = Controller.createScreenshot(tab,
- (int) mActivity.getResources()
- .getDimension(R.dimen.qc_thumb_width),
- (int) mActivity.getResources()
- .getDimension(R.dimen.qc_thumb_height));
- tab.setScreenshot(sshot);
- }
@Override
public void updateTabs(List<Tab> tabs) {
@@ -311,10 +291,10 @@
mTitleBar.startEditingUrl(clearInput);
}
+ @Override
void showTitleBarAndEdit() {
mTitleBar.setShowProgressOnly(false);
- showTitleBar();
- mTitleBar.startEditingUrl(false);
+ super.showTitleBarAndEdit();
}
void stopEditingUrl() {
@@ -460,18 +440,6 @@
}
@Override
- protected void updateAutoLogin(Tab tab, boolean animate) {
- mTitleBar.updateAutoLogin(tab, animate);
- }
-
- protected void refreshWebView() {
- Tab tab = getActiveTab();
- if ((tab != null) && (tab.getWebView() != null)) {
- tab.getWebView().invalidate();
- }
- }
-
- @Override
public void setUrlTitle(Tab tab) {
super.setUrlTitle(tab);
mTabBar.onUrlAndTitle(tab, tab.getUrl(), tab.getTitle());
@@ -485,11 +453,7 @@
}
@Override
- public void showVoiceTitleBar(String title) {
- List<String> vsresults = null;
- if (getActiveTab() != null) {
- vsresults = getActiveTab().getVoiceSearchResults();
- }
+ public void showVoiceTitleBar(String title, List<String> vsresults) {
mTitleBar.setInVoiceMode(true, vsresults);
mTitleBar.setDisplayTitle(title);
}
@@ -550,11 +514,6 @@
}
@Override
- public void registerDropdownChangeListener(DropdownChangeListener d) {
- mTitleBar.registerDropdownChangeListener(d);
- }
-
- @Override
public boolean onPrepareOptionsMenu(Menu menu) {
if (mUseQuickControls) {
mPieControl.onMenuOpened(menu);
diff --git a/src/com/android/browser/preferences/LabPreferencesFragment.java b/src/com/android/browser/preferences/LabPreferencesFragment.java
index a06dc3e..88a9690 100644
--- a/src/com/android/browser/preferences/LabPreferencesFragment.java
+++ b/src/com/android/browser/preferences/LabPreferencesFragment.java
@@ -42,21 +42,25 @@
addPreferencesFromResource(R.xml.lab_preferences);
Preference e = findPreference(BrowserSettings.PREF_QUICK_CONTROLS);
- e.setOnPreferenceChangeListener(this);
+ if (e != null) {
+ e.setOnPreferenceChangeListener(this);
+ }
useInstantPref = findPreference(BrowserSettings.PREF_USE_INSTANT);
}
@Override
public void onResume() {
super.onResume();
- useInstantPref.setEnabled(false);
+ if (useInstantPref != null) {
+ useInstantPref.setEnabled(false);
- // Enable the "use instant" preference only if the selected
- // search engine is google.
- if (mBrowserSettings.getSearchEngine() != null) {
- final String currentName = mBrowserSettings.getSearchEngine().getName();
- if (SearchEngine.GOOGLE.equals(currentName)) {
- useInstantPref.setEnabled(true);
+ // Enable the "use instant" preference only if the selected
+ // search engine is google.
+ if (mBrowserSettings.getSearchEngine() != null) {
+ final String currentName = mBrowserSettings.getSearchEngine().getName();
+ if (SearchEngine.GOOGLE.equals(currentName)) {
+ useInstantPref.setEnabled(true);
+ }
}
}
}
diff --git a/src/com/android/browser/view/StopProgressView.java b/src/com/android/browser/view/StopProgressView.java
new file mode 100644
index 0000000..64fa5d0
--- /dev/null
+++ b/src/com/android/browser/view/StopProgressView.java
@@ -0,0 +1,98 @@
+
+package com.android.browser.view;
+
+import com.android.browser.R;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.widget.ProgressBar;
+
+
+public class StopProgressView extends ProgressBar {
+
+ Drawable mOverlayDrawable;
+ Drawable mProgressDrawable;
+ int mWidth;
+ int mHeight;
+
+ /**
+ * @param context
+ * @param attrs
+ * @param defStyle
+ * @param styleRes
+ */
+ public StopProgressView(Context context, AttributeSet attrs, int defStyle, int styleRes) {
+ super(context, attrs, defStyle, styleRes);
+ init(attrs);
+ }
+
+ /**
+ * @param context
+ * @param attrs
+ * @param defStyle
+ */
+ public StopProgressView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ init(attrs);
+ }
+
+ /**
+ * @param context
+ * @param attrs
+ */
+ public StopProgressView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init(attrs);
+ }
+
+ /**
+ * @param context
+ */
+ public StopProgressView(Context context) {
+ super(context);
+ init(null);
+ }
+
+ private void init(AttributeSet attrs) {
+ mProgressDrawable = getIndeterminateDrawable();
+ setImageDrawable(mContext.getResources()
+ .getDrawable(R.drawable.ic_stop_holo_dark));
+ }
+
+ public void hideProgress() {
+ setIndeterminateDrawable(null);
+ }
+
+ public void showProgress() {
+ setIndeterminateDrawable(mProgressDrawable);
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+ mWidth = (right - left) * 2 / 3;
+ mHeight = (bottom - top) * 2 / 3;
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ if (mOverlayDrawable != null) {
+ int l = (getWidth() - mWidth) / 2;
+ int t = (getHeight() - mHeight) / 2;
+ mOverlayDrawable.setBounds(l, t, l + mWidth, t + mHeight);
+ mOverlayDrawable.draw(canvas);
+ }
+ }
+
+ public Drawable getDrawable() {
+ return mOverlayDrawable;
+ }
+
+ public void setImageDrawable(Drawable d) {
+ mOverlayDrawable = d;
+ }
+
+}