diff options
71 files changed, 361 insertions, 259 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 8ccb634..ebec23a 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -38,6 +38,7 @@ android:label="@string/application_name" android:icon="@drawable/ic_launcher_browser" android:backupAgent=".BrowserBackupAgent" + android:hardwareAccelerated="false" android:taskAffinity="android.task.browser" > <provider android:name="BrowserProvider" @@ -193,7 +194,7 @@ android:resource="@xml/bookmarks_searchable" /> </activity> - <activity android:name="AddBookmarkPage" android:label="Save bookmark" android:theme="@android:style/Theme.Dialog" + <activity android:name="AddBookmarkPage" android:label="Save bookmark" android:theme="@style/Dialog.Holo" android:configChanges="orientation|keyboardHidden" android:windowSoftInputMode="stateHidden"> <intent-filter> <action android:name="android.intent.action.INSERT" /> diff --git a/res/drawable-mdpi/bookmark_dialog_bg.9.png b/res/drawable-mdpi/bookmark_dialog_bg.9.png Binary files differnew file mode 100644 index 0000000..f169daa --- /dev/null +++ b/res/drawable-mdpi/bookmark_dialog_bg.9.png diff --git a/res/drawable-mdpi/button_selected.png b/res/drawable-mdpi/button_selected.png Binary files differdeleted file mode 100644 index 4fd1aa3..0000000 --- a/res/drawable-mdpi/button_selected.png +++ /dev/null diff --git a/res/drawable-mdpi/cab_bg.9.png b/res/drawable-mdpi/cab_bg.9.png Binary files differnew file mode 100644 index 0000000..caf404f --- /dev/null +++ b/res/drawable-mdpi/cab_bg.9.png diff --git a/res/drawable-mdpi/dialog_full.9.png b/res/drawable-mdpi/dialog_full.9.png Binary files differnew file mode 100644 index 0000000..2c9027b --- /dev/null +++ b/res/drawable-mdpi/dialog_full.9.png diff --git a/res/drawable-mdpi/empty_bookmark_image.png b/res/drawable-mdpi/empty_bookmark_image.png Binary files differnew file mode 100644 index 0000000..7e79f35 --- /dev/null +++ b/res/drawable-mdpi/empty_bookmark_image.png diff --git a/res/drawable-mdpi/fav_incognito.png b/res/drawable-mdpi/fav_incognito.png Binary files differnew file mode 100644 index 0000000..6a120b9 --- /dev/null +++ b/res/drawable-mdpi/fav_incognito.png diff --git a/res/drawable-mdpi/ic_arrow_left.png b/res/drawable-mdpi/ic_arrow_left.png Binary files differdeleted file mode 100644 index 58fd2ca..0000000 --- a/res/drawable-mdpi/ic_arrow_left.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_arrow_right.png b/res/drawable-mdpi/ic_arrow_right.png Binary files differdeleted file mode 100644 index aaf3fde..0000000 --- a/res/drawable-mdpi/ic_arrow_right.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_back_normal.png b/res/drawable-mdpi/ic_back_normal.png Binary files differnew file mode 100644 index 0000000..7e09a94 --- /dev/null +++ b/res/drawable-mdpi/ic_back_normal.png diff --git a/res/drawable-mdpi/ic_bookmarks_history_normal.png b/res/drawable-mdpi/ic_bookmarks_history_normal.png Binary files differnew file mode 100644 index 0000000..60a7b4a --- /dev/null +++ b/res/drawable-mdpi/ic_bookmarks_history_normal.png diff --git a/res/drawable-mdpi/ic_favorite_on_normal.png b/res/drawable-mdpi/ic_favorite_on_normal.png Binary files differnew file mode 100644 index 0000000..bd239e8 --- /dev/null +++ b/res/drawable-mdpi/ic_favorite_on_normal.png diff --git a/res/drawable-mdpi/ic_forward_normal.png b/res/drawable-mdpi/ic_forward_normal.png Binary files differnew file mode 100644 index 0000000..f306403 --- /dev/null +++ b/res/drawable-mdpi/ic_forward_normal.png diff --git a/res/drawable-mdpi/ic_menu_archive_normal.png b/res/drawable-mdpi/ic_menu_archive_normal.png Binary files differnew file mode 100644 index 0000000..40f25a4 --- /dev/null +++ b/res/drawable-mdpi/ic_menu_archive_normal.png diff --git a/res/drawable-mdpi/ic_menu_downloads.png b/res/drawable-mdpi/ic_menu_downloads.png Binary files differdeleted file mode 100644 index fff5022..0000000 --- a/res/drawable-mdpi/ic_menu_downloads.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_menu_downloads_normal.png b/res/drawable-mdpi/ic_menu_downloads_normal.png Binary files differnew file mode 100644 index 0000000..37b6b75 --- /dev/null +++ b/res/drawable-mdpi/ic_menu_downloads_normal.png diff --git a/res/drawable-mdpi/ic_menu_findonpage_normal.png b/res/drawable-mdpi/ic_menu_findonpage_normal.png Binary files differnew file mode 100644 index 0000000..bea6e44 --- /dev/null +++ b/res/drawable-mdpi/ic_menu_findonpage_normal.png diff --git a/res/drawable-mdpi/ic_menu_incognito_normal.png b/res/drawable-mdpi/ic_menu_incognito_normal.png Binary files differnew file mode 100644 index 0000000..2e78dc6 --- /dev/null +++ b/res/drawable-mdpi/ic_menu_incognito_normal.png diff --git a/res/drawable-mdpi/ic_menu_new_window.png b/res/drawable-mdpi/ic_menu_new_window.png Binary files differindex 7fb9948..c767979 100644 --- a/res/drawable-mdpi/ic_menu_new_window.png +++ b/res/drawable-mdpi/ic_menu_new_window.png diff --git a/res/drawable-mdpi/ic_menu_pageinfo.png b/res/drawable-mdpi/ic_menu_pageinfo.png Binary files differdeleted file mode 100644 index c04f0e3..0000000 --- a/res/drawable-mdpi/ic_menu_pageinfo.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_menu_pageinfo_normal.png b/res/drawable-mdpi/ic_menu_pageinfo_normal.png Binary files differnew file mode 100644 index 0000000..3422e98 --- /dev/null +++ b/res/drawable-mdpi/ic_menu_pageinfo_normal.png diff --git a/res/drawable-mdpi/ic_menu_settings.png b/res/drawable-mdpi/ic_menu_settings.png Binary files differdeleted file mode 100644 index 7a642d6..0000000 --- a/res/drawable-mdpi/ic_menu_settings.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_menu_settings_normal.png b/res/drawable-mdpi/ic_menu_settings_normal.png Binary files differnew file mode 100644 index 0000000..bd2c30a --- /dev/null +++ b/res/drawable-mdpi/ic_menu_settings_normal.png diff --git a/res/drawable-mdpi/ic_menu_share.png b/res/drawable-mdpi/ic_menu_share.png Binary files differdeleted file mode 100644 index ea2b672..0000000 --- a/res/drawable-mdpi/ic_menu_share.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_menu_share_normal.png b/res/drawable-mdpi/ic_menu_share_normal.png Binary files differnew file mode 100644 index 0000000..4410baa --- /dev/null +++ b/res/drawable-mdpi/ic_menu_share_normal.png diff --git a/res/drawable-mdpi/ic_pressed.png b/res/drawable-mdpi/ic_pressed.png Binary files differnew file mode 100644 index 0000000..dccdc83 --- /dev/null +++ b/res/drawable-mdpi/ic_pressed.png diff --git a/res/drawable-mdpi/ic_refresh_normal.png b/res/drawable-mdpi/ic_refresh_normal.png Binary files differnew file mode 100644 index 0000000..f8ce51d --- /dev/null +++ b/res/drawable-mdpi/ic_refresh_normal.png diff --git a/res/drawable-mdpi/ic_reload.png b/res/drawable-mdpi/ic_reload.png Binary files differdeleted file mode 100644 index ec0c238..0000000 --- a/res/drawable-mdpi/ic_reload.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_search_category_bookmark.png b/res/drawable-mdpi/ic_search_category_bookmark.png Binary files differindex d228408..4b3bd2d 100755..100644 --- a/res/drawable-mdpi/ic_search_category_bookmark.png +++ b/res/drawable-mdpi/ic_search_category_bookmark.png diff --git a/res/drawable-mdpi/ic_search_category_browser.png b/res/drawable-mdpi/ic_search_category_browser.png Binary files differdeleted file mode 100644 index da8d4e3..0000000 --- a/res/drawable-mdpi/ic_search_category_browser.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_search_category_history.png b/res/drawable-mdpi/ic_search_category_history.png Binary files differindex 12cd51c..1a3fc98 100755..100644 --- a/res/drawable-mdpi/ic_search_category_history.png +++ b/res/drawable-mdpi/ic_search_category_history.png diff --git a/res/drawable-mdpi/ic_search_catgeory_browser.png b/res/drawable-mdpi/ic_search_catgeory_browser.png Binary files differnew file mode 100644 index 0000000..d721425 --- /dev/null +++ b/res/drawable-mdpi/ic_search_catgeory_browser.png diff --git a/res/drawable-mdpi/ic_search_normal.png b/res/drawable-mdpi/ic_search_normal.png Binary files differnew file mode 100644 index 0000000..e1fa6d3 --- /dev/null +++ b/res/drawable-mdpi/ic_search_normal.png diff --git a/res/drawable-mdpi/ic_star.png b/res/drawable-mdpi/ic_star.png Binary files differdeleted file mode 100644 index 20a40de..0000000 --- a/res/drawable-mdpi/ic_star.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_stop.png b/res/drawable-mdpi/ic_stop.png Binary files differdeleted file mode 100644 index 7ee56e9..0000000 --- a/res/drawable-mdpi/ic_stop.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_stop_normal.png b/res/drawable-mdpi/ic_stop_normal.png Binary files differnew file mode 100644 index 0000000..6bd22f9 --- /dev/null +++ b/res/drawable-mdpi/ic_stop_normal.png diff --git a/res/drawable-mdpi/ic_tab_close.png b/res/drawable-mdpi/ic_tab_close.png Binary files differnew file mode 100644 index 0000000..2f23842 --- /dev/null +++ b/res/drawable-mdpi/ic_tab_close.png diff --git a/res/drawable-mdpi/progress.9.png b/res/drawable-mdpi/progress.9.png Binary files differnew file mode 100644 index 0000000..08de04c --- /dev/null +++ b/res/drawable-mdpi/progress.9.png diff --git a/res/drawable-mdpi/tab_selected_bg.9.png b/res/drawable-mdpi/tab_selected_bg.9.png Binary files differindex b843242..2004313 100644 --- a/res/drawable-mdpi/tab_selected_bg.9.png +++ b/res/drawable-mdpi/tab_selected_bg.9.png diff --git a/res/drawable-mdpi/tab_unselected_bg.9.png b/res/drawable-mdpi/tab_unselected_bg.9.png Binary files differindex 872117a..5d483e0 100644 --- a/res/drawable-mdpi/tab_unselected_bg.9.png +++ b/res/drawable-mdpi/tab_unselected_bg.9.png diff --git a/res/drawable-mdpi/tabbar_bg.9.png b/res/drawable-mdpi/tabbar_bg.9.png Binary files differnew file mode 100644 index 0000000..bb9928d --- /dev/null +++ b/res/drawable-mdpi/tabbar_bg.9.png diff --git a/res/drawable-mdpi/text_field.9.png b/res/drawable-mdpi/text_field.9.png Binary files differnew file mode 100644 index 0000000..92de7c8 --- /dev/null +++ b/res/drawable-mdpi/text_field.9.png diff --git a/res/drawable-mdpi/text_field_focused.9.png b/res/drawable-mdpi/text_field_focused.9.png Binary files differnew file mode 100644 index 0000000..6e84bb3 --- /dev/null +++ b/res/drawable-mdpi/text_field_focused.9.png diff --git a/res/drawable-mdpi/text_field_results.9.png b/res/drawable-mdpi/text_field_results.9.png Binary files differnew file mode 100644 index 0000000..5d08fe9 --- /dev/null +++ b/res/drawable-mdpi/text_field_results.9.png diff --git a/res/drawable-mdpi/urlbar_bg.9.png b/res/drawable-mdpi/urlbar_bg.9.png Binary files differnew file mode 100644 index 0000000..eccf41b --- /dev/null +++ b/res/drawable-mdpi/urlbar_bg.9.png diff --git a/res/drawable/browserbarbutton.xml b/res/drawable/browserbarbutton.xml index 5c9eca0..d3eebbe 100644 --- a/res/drawable/browserbarbutton.xml +++ b/res/drawable/browserbarbutton.xml @@ -16,6 +16,6 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" - android:drawable="@drawable/button_bg_selected" /> + android:drawable="@drawable/ic_pressed" /> <item android:state_pressed="false" android:drawable="@drawable/clear" /> </selector> diff --git a/res/drawable/button_bg_selected.xml b/res/drawable/button_bg_selected.xml index 17c1fc3..d0c677b 100644 --- a/res/drawable/button_bg_selected.xml +++ b/res/drawable/button_bg_selected.xml @@ -12,7 +12,7 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="oval"> + android:shape="rectangle"> <solid android:color="#ff4d83ba" /> </shape>
\ No newline at end of file diff --git a/res/drawable/ic_menu_hideurl.png b/res/drawable/ic_menu_hideurl.png Binary files differdeleted file mode 100644 index 571457b..0000000 --- a/res/drawable/ic_menu_hideurl.png +++ /dev/null diff --git a/res/drawable/ic_menu_showurl.png b/res/drawable/ic_menu_showurl.png Binary files differdeleted file mode 100644 index 4b346a8..0000000 --- a/res/drawable/ic_menu_showurl.png +++ /dev/null diff --git a/res/drawable/progress.xml b/res/drawable/progress.xml deleted file mode 100644 index fd89317..0000000 --- a/res/drawable/progress.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 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. ---> -<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> -<!-- - <item android:id="@android:id/background"> - <shape> - <solid android:color="#804d83ba"/> - </shape> - </item> - --> - <item android:id="@android:id/progress"> - <clip> - <shape> - <solid android:color="#804d83ba"/> - </shape> - </clip> - </item> - -</layer-list> diff --git a/res/drawable/tab_background.xml b/res/drawable/tab_background.xml index 65db25e..8e1881e 100644 --- a/res/drawable/tab_background.xml +++ b/res/drawable/tab_background.xml @@ -14,9 +14,13 @@ limitations under the License. --> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_selected="true" - android:drawable="@drawable/tab_selected_bg" /> - <item android:state_selected="false" - android:drawable="@drawable/tab_unselected_bg" /> +<selector + xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:state_selected="true" + android:drawable="@drawable/tab_selected_bg" /> + <item + android:state_selected="false" + android:drawable="@drawable/tab_unselected_bg"> + </item> </selector> diff --git a/res/drawable/textfield_nostroke.xml b/res/drawable/textfield_nostroke.xml deleted file mode 100644 index 2945056..0000000 --- a/res/drawable/textfield_nostroke.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 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. ---> - -<shape xmlns:android="http://schemas.android.com/apk/res/android"> - <solid android:color="#ffd0d0d0"/> - <stroke android:width="1dp" android:color="#ff94b73f"/> - <padding android:left="9dp" android:top="9dp" - android:right="9dp" android:bottom="9dp" /> -</shape> diff --git a/res/drawable/textfield_stroke.xml b/res/drawable/textfield_stroke.xml deleted file mode 100644 index 4d4c74e..0000000 --- a/res/drawable/textfield_stroke.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 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. ---> - -<shape xmlns:android="http://schemas.android.com/apk/res/android"> - <solid android:color="#ffffffff"/> - <stroke android:width="3dp" android:color="#ff94b73f"/> - <padding android:left="9dp" android:top="9dp" - android:right="9dp" android:bottom="9dp" /> -</shape> diff --git a/res/layout/browser_add_bookmark.xml b/res/layout/browser_add_bookmark.xml index e8a08a4..f15caf2 100644 --- a/res/layout/browser_add_bookmark.xml +++ b/res/layout/browser_add_bookmark.xml @@ -80,7 +80,6 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="#c6c3c6" android:minHeight="54dip" android:orientation="horizontal" android:paddingTop="4dip" diff --git a/res/layout/browser_add_bookmark_const_url.xml b/res/layout/browser_add_bookmark_const_url.xml index c6603f4..6a6d78f 100644 --- a/res/layout/browser_add_bookmark_const_url.xml +++ b/res/layout/browser_add_bookmark_const_url.xml @@ -53,15 +53,13 @@ android:layout_width="250dip" android:gravity="fill_horizontal" android:inputType="textCapSentences" - android:selectAllOnFocus="true" - android:textAppearance="?android:attr/textAppearanceMedium" /> + android:selectAllOnFocus="true" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="#c6c3c6" android:minHeight="54dip" android:orientation="horizontal" android:paddingTop="4dip" diff --git a/res/layout/tab_bar.xml b/res/layout/tab_bar.xml index 0b3fae1..7967307 100644 --- a/res/layout/tab_bar.xml +++ b/res/layout/tab_bar.xml @@ -14,21 +14,13 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tabbarcontent" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="48dip" style="@style/ActionBarStyle" android:orientation="horizontal"> - <ImageButton - android:id="@+id/showurl" - android:src="@drawable/ic_menu_showurl" - android:layout_width="48dip" - android:layout_height="48dip" - android:layout_marginLeft="3dip" - android:background="@drawable/browserbarbutton" - android:visibility="gone" /> <com.android.browser.TabScrollView android:id="@+id/tabs" android:layout_width="0dp" - android:layout_height="48dip" + android:layout_height="match_parent" android:layout_weight="1.0" android:orientation="horizontal" /> </LinearLayout> diff --git a/res/layout/tab_title.xml b/res/layout/tab_title.xml index d3d5176..a2da03d 100644 --- a/res/layout/tab_title.xml +++ b/res/layout/tab_title.xml @@ -12,45 +12,50 @@ --> <merge xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="0dip" - android:layout_weight="1.0" + android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="horizontal" - android:background="@drawable/tab_background" > + android:background="@drawable/tab_background"> <ImageView android:id="@+id/incognito" - android:layout_width="36dip" - android:layout_height="36dip" + android:layout_width="16dip" + android:layout_height="16dip" android:layout_marginLeft="3dip" - android:src="@drawable/ic_menu_incognito" + android:gravity="center_vertical" + android:src="@drawable/fav_incognito" android:visibility="gone" /> <ImageView android:id="@+id/favicon" android:layout_width="20dip" android:layout_height="20dip" - android:layout_marginLeft="3dip" /> + android:layout_marginLeft="16dip" /> <ImageView android:id="@+id/lock" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="6dip" + android:layout_marginLeft="16dip" android:visibility="gone" /> <TextView android:id="@+id/title" android:layout_height="match_parent" android:layout_width="0dip" android:layout_weight="1.0" - android:layout_marginLeft="3dip" + android:layout_marginLeft="16dip" android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="@color/black" - android:gravity="center_vertical|center_horizontal" - android:singleLine="true" - android:ellipsize="end" /> - <ImageView + android:textColor="@color/white" + android:gravity="center_vertical" + android:scrollHorizontally="true" + android:fadingEdge="horizontal" + android:fadingEdgeLength="24dip" + android:lines="1" + android:singleLine="true" /> + <ImageButton android:id="@+id/close" + android:background="@drawable/browserbarbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="6dip" - android:src="@drawable/btn_close_window" /> + android:layout_marginLeft="16dip" + android:layout_marginRight="16dip" + android:src="@drawable/ic_tab_close" /> </merge> diff --git a/res/layout/url_bar.xml b/res/layout/url_bar.xml index a8e5a8d..29a6462 100644 --- a/res/layout/url_bar.xml +++ b/res/layout/url_bar.xml @@ -19,95 +19,92 @@ <LinearLayout android:id="@+id/taburlbar" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="48dip" android:orientation="horizontal" - android:background="#ffdddddd" - android:paddingLeft="6dip" - android:paddingRight="6dip" - android:paddingTop="2dip" - android:paddingBottom="2dip"> + android:background="@drawable/urlbar_bg" + > <ImageButton android:id="@+id/back" - android:src="@drawable/ic_arrow_left" + android:src="@drawable/ic_back_normal" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="6dip" + style="@style/HoloButton" android:background="@drawable/browserbarbutton" /> <ImageButton android:id="@+id/forward" - android:src="@drawable/ic_arrow_right" + android:src="@drawable/ic_forward_normal" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="6dip" + style="@style/HoloButton" android:background="@drawable/browserbarbutton" /> + <ImageView + android:id="@+id/stop" + android:background="@drawable/browserbarbutton" + android:layout_width="wrap_content" + android:layout_height="match_parent" + style="@style/HoloButton" + android:gravity="center_vertical" + android:src="@drawable/ic_stop_normal" /> + <ImageButton + android:id="@+id/all_btn" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:scaleType="center" + style="@style/HoloButton" + android:background="@drawable/browserbarbutton" + android:src="@drawable/ic_bookmarks_history_normal" /> <LinearLayout android:id="@+id/urlbar" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1.0" - android:orientation="horizontal" - android:background="#ffffffff"> + android:orientation="horizontal" > <ImageButton android:id="@+id/star" - android:src="@drawable/ic_star" + android:src="@drawable/ic_favorite_on_normal" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginLeft="6dip" + style="@style/HoloButton" android:background="@drawable/browserbarbutton" /> <ImageView android:id="@+id/lock" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="6dip" + style="@style/HoloIcon" android:visibility="gone" /> <com.android.browser.UrlInputView android:id="@+id/editurl" android:layout_width="0dip" android:layout_weight="1.0" android:layout_height="match_parent" - android:layout_marginLeft="6dip" + android:background="@null" + android:paddingLeft="16dip" + android:paddingRight="16dip" android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="@color/black" android:hint="@string/search_hint" android:gravity="center_vertical" android:singleLine="true" android:ellipsize="end" android:lines="1" android:scrollHorizontally="true" - android:background="@null" android:inputType="textUri" android:imeOptions="actionGo" /> - <ImageView - android:id="@+id/stop" - android:background="@drawable/browserbarbutton" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginLeft="6dip" - android:gravity="center_vertical" - android:src="@drawable/ic_stop" /> <ImageButton android:id="@+id/search" - android:src="@drawable/ic_btn_find" + android:src="@drawable/ic_search_normal" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" - android:layout_marginLeft="6dip" - android:layout_marginRight="6dip" + style="@style/HoloButton" android:background="@drawable/browserbarbutton" /> </LinearLayout> - <ImageButton - android:id="@+id/all_btn" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:scaleType="center" - android:layout_marginLeft="6dip" - android:background="@drawable/browserbarbutton" - android:src="@drawable/ic_pages" /> </LinearLayout> - <ImageView + <com.android.browser.PageProgressView android:id="@+id/progress" android:layout_width="match_parent" - android:layout_height="8dip" - android:src="@drawable/progress" + android:layout_height="22dip" + android:background = "@null" + android:src = "@drawable/progress" + android:layout_marginTop="-11dip" android:visibility="gone" /> </LinearLayout> diff --git a/res/menu-xlarge/browser.xml b/res/menu-xlarge/browser.xml index 12a8a13..cf29351 100644 --- a/res/menu-xlarge/browser.xml +++ b/res/menu-xlarge/browser.xml @@ -23,28 +23,29 @@ android:alphabeticShortcut="n" /> <item android:id="@+id/incognito_menu_id" android:title="@string/incognito_tab" - android:icon="@drawable/ic_menu_incognito" /> + android:icon="@drawable/ic_menu_incognito_normal" /> <item android:id="@+id/find_menu_id" android:title="@*android:string/find_on_page" - android:icon="@*android:drawable/ic_menu_find" + android:icon="@drawable/ic_menu_findonpage_normal" android:alphabeticShortcut="f" /> <item android:id="@+id/share_page_menu_id" android:title="@string/share_page" - android:icon="@drawable/ic_menu_share" + android:icon="@drawable/ic_menu_share_normal" android:alphabeticShortcut="s" /> <item android:id="@+id/page_info_menu_id" android:title="@string/page_info" - android:icon="@drawable/ic_menu_pageinfo" + android:icon="@drawable/ic_menu_pageinfo_normal" android:alphabeticShortcut="g" /> <item android:id="@+id/view_downloads_menu_id" android:title="@string/menu_view_download" - android:icon="@drawable/ic_menu_downloads" + android:icon="@drawable/ic_menu_downloads_normal" android:alphabeticShortcut="d" /> <item android:id="@+id/preferences_menu_id" android:title="@string/menu_preferences" - android:icon="@drawable/ic_menu_settings" + android:icon="@drawable/ic_menu_settings_normal" android:alphabeticShortcut="p" /> <item android:id="@+id/save_webarchive_menu_id" + android:icon="@drawable/ic_menu_archive_normal" android:title="@string/menu_save_webarchive" /> <!-- followings are debug only --> <item android:id="@+id/dump_nav_menu_id" diff --git a/res/drawable/tab_unselected.xml b/res/menu/bookmark_shortcut.xml index 1f22ae1..67cbddf 100644 --- a/res/drawable/tab_unselected.xml +++ b/res/menu/bookmark_shortcut.xml @@ -4,9 +4,9 @@ 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. @@ -14,9 +14,12 @@ limitations under the License. --> -<shape xmlns:android="http://schemas.android.com/apk/res/android"> - <solid android:color="#00000000"/> - <stroke android:width="3dp" android:color="#ff404040"/> - <padding android:left="9dp" android:top="9dp" - android:right="9dp" android:bottom="9dp" /> -</shape> +<menu + xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:id="@+id/add_bookmark_menu_id" + android:title="@string/save_to_bookmarks" /> + <item + android:id="@+id/shortcut_to_home_menu_id" + android:title="@string/create_shortcut_bookmark" /> +</menu> diff --git a/res/menu/browser.xml b/res/menu/browser.xml index 2c237a6..6b119e1 100644 --- a/res/menu/browser.xml +++ b/res/menu/browser.xml @@ -23,7 +23,7 @@ <item android:id="@+id/bookmarks_menu_id" android:title="@string/bookmarks" android:alphabeticShortcut="b" - android:icon="@drawable/ic_menu_bookmarks" + android:icon="@drawable/ic_bookmarks_history_normal" /> <item android:id="@+id/active_tabs_menu_id" android:title="@string/active_tabs" @@ -34,33 +34,34 @@ <item android:id="@+id/forward_menu_id" android:title="@string/forward" android:alphabeticShortcut="k" - android:icon="@*android:drawable/ic_menu_forward" /> + android:icon="@drawable/ic_forward_normal" /> <item android:id="@+id/add_bookmark_menu_id" android:title="@string/save_to_bookmarks" android:icon="@drawable/ic_menu_add_bookmark" android:alphabeticShortcut="a" /> <item android:id="@+id/find_menu_id" android:title="@*android:string/find_on_page" - android:icon="@*android:drawable/ic_menu_find" + android:icon="@drawable/ic_menu_findonpage_normal" android:alphabeticShortcut="f" /> <item android:id="@+id/share_page_menu_id" android:title="@string/share_page" - android:icon="@drawable/ic_menu_share" + android:icon="@drawable/ic_menu_share_normal" android:alphabeticShortcut="s" /> <item android:id="@+id/page_info_menu_id" android:title="@string/page_info" - android:icon="@drawable/ic_menu_pageinfo" + android:icon="@drawable/ic_menu_pageinfo_normal" android:alphabeticShortcut="g" /> <item android:id="@+id/view_downloads_menu_id" android:title="@string/menu_view_download" - android:icon="@drawable/ic_menu_downloads" + android:icon="@drawable/ic_menu_downloads_normal" android:alphabeticShortcut="d" /> <item android:id="@+id/preferences_menu_id" android:title="@string/menu_preferences" - android:icon="@drawable/ic_menu_settings" + android:icon="@drawable/ic_menu_settings_normal" android:alphabeticShortcut="p" /> <item android:id="@+id/save_webarchive_menu_id" - android:title="@string/menu_save_webarchive" /> + android:title="@string/menu_save_webarchive" + android:icon="@drawable/ic_menu_archive_normal" /> <!-- followings are debug only --> <item android:id="@+id/dump_nav_menu_id" android:title="@string/dump_nav" @@ -104,11 +105,11 @@ <!-- these items are toggled in and out of @+id/stop_reload_menu_id --> <item android:id="@+id/stop_menu_id" android:title="@string/stop" - android:icon="@*android:drawable/ic_menu_stop" + android:icon="@drawable/ic_stop_normal" android:visible="false" /> <item android:id="@+id/reload_menu_id" android:title="@string/reload" - android:icon="@*android:drawable/ic_menu_refresh" + android:icon="@drawable/ic_refresh_normal" android:visible="false" /> </menu> diff --git a/res/values-xlarge/styles.xml b/res/values-xlarge/styles.xml index fc6adc5..28d2f28 100644 --- a/res/values-xlarge/styles.xml +++ b/res/values-xlarge/styles.xml @@ -18,13 +18,23 @@ */ --> <resources> - <style name="BrowserTheme" parent="@android:Theme.Black"> + <style name="BrowserTheme" parent="@android:Theme.Holo"> <item name="android:windowBackground">@color/white</item> <item name="android:colorBackground">#FFFFFFFF</item> <item name="android:windowActionBar">true</item> <item name="android:windowNoTitle">false</item> <item name="android:windowActionBarStyle">@style/ActionBarStyle</item> <item name="android:windowContentOverlay">@null</item> + <item name="android:actionModeBackground">@drawable/cab_bg</item> + </style> + <style name="Dialog.Holo" parent="android:Theme.Holo"> + <item name="android:windowFrame">@null</item> + <item name="android:windowBackground">@drawable/dialog_full</item> + <item name="android:windowIsFloating">true</item> + <item name="android:windowContentOverlay">@null</item> + <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item> + <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item> + <item name="android:colorBackgroundCacheHint">@null</item> </style> <style name="BookmarkTheme" parent="@android:Theme.Panel"> <item name="android:windowBackground">@color/black</item> @@ -33,7 +43,6 @@ <item name="android:windowContentOverlay">@null</item> </style> <style name="ActionBarStyle"> - <item name="android:background">#ffdddddd</item> <item name="android:height">48dip</item> <item name="android:padding">0dip</item> <item name="android:displayOptions">hideHome</item> diff --git a/res/values/colors.xml b/res/values/colors.xml index 68bf253..95105e1 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -32,7 +32,8 @@ <color name="white">#ffffffff</color> <color name="black">#ff000000</color> - + <color name="tab_title_selected">#ffffffff</color> + <color name="tab_title_unselected">#ff808080</color> <color name="geolocation_permissions_prompt_background">#ffdddddd</color> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index fadb16e..933cff1 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -129,11 +129,11 @@ <string name="http">http://</string> <!-- Menu item that opens a dialog to save a bookmark for the current page, also displayed as the title of the dialog used for adding a bookmark --> - <string name="save_to_bookmarks">Add to Bookmarks</string> + <string name="save_to_bookmarks">Bookmark this page</string> <!-- Menu item on the bookmarks page, to edit an existing bookmark --> <string name="edit_bookmark">Edit bookmark</string> <!-- Context menu item to create a shortcut to the bookmark on the desktop --> - <string name="create_shortcut_bookmark">Add to Home</string> + <string name="create_shortcut_bookmark">Add shortcut to home</string> <!-- Context menu item to open the currently highlighted bookmark --> <string name="open_bookmark">Open</string> <!-- Menu item to remove the currently highlighted bookmark--> diff --git a/res/values/styles.xml b/res/values/styles.xml index 09dbff1..acfbe97 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -18,12 +18,13 @@ */ --> <resources> - <style name="BrowserTheme" parent="@android:Theme.Black"> - <item name="android:windowBackground">@color/white</item> - <item name="android:colorBackground">#FFFFFFFF</item> + <style name="BrowserTheme" parent="@android:Theme.Holo"> <item name="android:windowNoTitle">true</item> <item name="android:windowContentOverlay">@null</item> </style> + <style name="ActionBar" parent="@android:style/ActionBar"> + <item name="android:background">@color/black</item> + </style> <style name="BookmarkTheme" parent="@android:Theme.Black"> <item name="android:windowNoTitle">true</item> <item name="android:windowContentOverlay">@null</item> @@ -36,5 +37,20 @@ <item name="android:windowEnterAnimation">@anim/title_bar_enter</item> <item name="android:windowExitAnimation">@anim/title_bar_exit</item> </style> + <style name="HoloIcon"> + <item name="android:paddingLeft">16dip</item> + <item name="android:paddingRight">16dip</item> + </style> + <style name="HoloButton" parent="@style/HoloIcon"> + <item name="android:background">@drawable/browserbarbutton</item> + </style> + <style name="TabTitleSelected" parent="@android:style/TextAppearance.Small"> + <item name="android:textColor">@color/tab_title_selected</item> + <item name="android:textStyle">bold</item> + </style> + <style name="TabTitleUnselected" parent="@android:style/TextAppearance.Small"> + <item name="android:textColor">@color/tab_title_unselected</item> + <item name="android:textStyle">normal</item> + </style> </resources> diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index 7890485..e6cb473 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -23,6 +23,7 @@ import com.android.common.speech.LoggingEvents; import android.app.ActionBar; import android.app.Activity; import android.app.AlertDialog; +import android.app.Dialog; import android.app.ProgressDialog; import android.app.SearchManager; import android.content.ActivityNotFoundException; @@ -105,6 +106,7 @@ import android.webkit.WebView; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.LinearLayout; +import android.widget.PopupMenu; import android.widget.TextView; import android.widget.Toast; @@ -126,7 +128,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class BrowserActivity extends Activity - implements View.OnCreateContextMenuListener, DownloadListener { + implements View.OnCreateContextMenuListener, DownloadListener, + PopupMenu.OnMenuItemClickListener { /* Define some aliases to make these debugging flags easier to refer to. * This file imports android.provider.Browser, so we can't just refer to "Browser.DEBUG". @@ -226,6 +229,8 @@ public class BrowserActivity extends Activity mTitleBar.setProgress(100); mFakeTitleBar = new TitleBarXLarge(this); ActionBar actionBar = getActionBar(); + actionBar.setBackgroundDrawable(getResources(). + getDrawable(R.drawable.tabbar_bg)); mTabBar = new TabBar(this, mTabControl, (TitleBarXLarge) mFakeTitleBar); actionBar.setCustomNavigationMode(mTabBar); // disable built in zoom controls @@ -3869,45 +3874,70 @@ public class BrowserActivity extends Activity } - /* package*/ void promptAddOrInstallBookmark() { + /* package */ void promptAddOrInstallBookmark(View anchor) { + PopupMenu popup = new PopupMenu(this, anchor); + popup.getMenuInflater().inflate(R.menu.bookmark_shortcut, popup.getMenu()); + popup.setOnMenuItemClickListener(this); + popup.show(); + } + + /** + * popup menu item click listener + * @param item + */ + public boolean onMenuItemClick(MenuItem item) { + switch(item.getItemId()) { + case R.id.add_bookmark_menu_id: + bookmarkCurrentPage(); + return true; + case R.id.shortcut_to_home_menu_id: + Tab current = mTabControl.getCurrentTab(); + current.populatePickerData(); + String touchIconUrl = mTabControl.getCurrentWebView().getTouchIconUrl(); + if (touchIconUrl != null) { + // Download the touch icon for this site then save + // it to the + // homescreen. + Bundle b = new Bundle(); + b.putString("url", current.getUrl()); + b.putString("title", current.getTitle()); + b.putParcelable("favicon", current.getFavicon()); + Message msg = mHandler.obtainMessage(TOUCH_ICON_DOWNLOADED); + msg.setData(b); + new DownloadTouchIcon(BrowserActivity.this, msg, + mTabControl.getCurrentWebView().getSettings().getUserAgentString()) + .execute(touchIconUrl); + } else { + // add to homescreen, can do it immediately as there + // is no touch + // icon. + showSaveToHomescreenDialog( + current.getUrl(), current.getTitle(), null, current.getFavicon()); + } + return true; + default: + return false; + } + } + + /* package */Dialog makeAddOrInstallDialog() { final Tab current = mTabControl.getCurrentTab(); Resources resources = getResources(); - CharSequence[] choices = { - resources.getString(R.string.save_to_bookmarks), - resources.getString(R.string.create_shortcut_bookmark) - }; + CharSequence[] choices = + {resources.getString(R.string.save_to_bookmarks), + resources.getString(R.string.create_shortcut_bookmark)}; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.add_new_bookmark); builder.setItems(choices, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int item) { - if (item == 0) { - bookmarkCurrentPage(); - } else if (item == 1) { - current.populatePickerData(); - String touchIconUrl = mTabControl.getCurrentWebView().getTouchIconUrl(); - if (touchIconUrl != null) { - // Download the touch icon for this site then save it to the - // homescreen. - Bundle b = new Bundle(); - b.putString("url", current.getUrl()); - b.putString("title", current.getTitle()); - b.putParcelable("favicon", current.getFavicon()); - Message msg = mHandler.obtainMessage(TOUCH_ICON_DOWNLOADED); - msg.setData(b); - new DownloadTouchIcon(BrowserActivity.this, msg, - mTabControl.getCurrentWebView().getSettings() - .getUserAgentString()).execute(touchIconUrl); - } else { - // add to homescreen, can do it immediately as there is no touch - // icon. - showSaveToHomescreenDialog(current.getUrl(), current.getTitle(), - null, current.getFavicon()); - } - } - } + public void onClick(DialogInterface dialog, int item) { + if (item == 0) { + bookmarkCurrentPage(); + } else if (item == 1) { + } + } }); - builder.create().show(); + return builder.create(); } /** diff --git a/src/com/android/browser/PageProgressView.java b/src/com/android/browser/PageProgressView.java new file mode 100644 index 0000000..183566a --- /dev/null +++ b/src/com/android/browser/PageProgressView.java @@ -0,0 +1,94 @@ + +/* + * Copyright (C) 2010 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.content.Context; +import android.graphics.Canvas; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.widget.ImageView; + +/** + * + */ +public class PageProgressView extends ImageView { + + private int mProgress; + private int mMaxProgress; + private Rect mBounds; + + /** + * @param context + * @param attrs + * @param defStyle + */ + public PageProgressView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + init(context); + } + + /** + * @param context + * @param attrs + */ + public PageProgressView(Context context, AttributeSet attrs) { + super(context, attrs); + init(context); + } + + /** + * @param context + */ + public PageProgressView(Context context) { + super(context); + init(context); + } + + private void init(Context ctx) { + mMaxProgress = 10000; + mBounds = new Rect(0,0,0,0); + mProgress = 0; + } + + @Override + public void onLayout(boolean f, int l, int t, int r, int b) { + mBounds.left = 0; + mBounds.right = (r - l) * mProgress / mMaxProgress; + mBounds.top = 0; + mBounds.bottom = b-t; + } + + void setMaxProgress(int max) { + mMaxProgress = max; + } + + void setProgress(int progress) { + mProgress = progress; + mBounds.right = getWidth()*mProgress/mMaxProgress; + invalidate(); + } + + @Override + public void onDraw(Canvas canvas) { +// super.onDraw(canvas); + Drawable d = getDrawable(); + d.setBounds(mBounds); + d.draw(canvas); + } + +} diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java index 3d8a44f..cf0f27c 100644 --- a/src/com/android/browser/TabBar.java +++ b/src/com/android/browser/TabBar.java @@ -55,13 +55,9 @@ public class TabBar extends LinearLayout private final int mTabWidthSelected; private final int mTabWidthUnselected; - private final Drawable mShowUrlDrawable; - private final Drawable mHideUrlDrawable; - private TitleBarXLarge mTitleBar; private TabScrollView mTabs; - private ImageButton mShowUrlButton; private TabControl mControl; private Map<Tab, TabViewData> mTabMap; @@ -76,8 +72,6 @@ public class TabBar extends LinearLayout Resources res = context.getResources(); mTabWidthSelected = (int) res.getDimension(R.dimen.tab_width_selected); mTabWidthUnselected = (int) res.getDimension(R.dimen.tab_width_unselected); - mShowUrlDrawable = res.getDrawable(R.drawable.ic_menu_showurl); - mHideUrlDrawable = res.getDrawable(R.drawable.ic_menu_hideurl); mTitleBar = titlebar; mTitleBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, @@ -90,13 +84,10 @@ public class TabBar extends LinearLayout LayoutInflater factory = LayoutInflater.from(context); factory.inflate(R.layout.tab_bar, this); mTabs = (TabScrollView) findViewById(R.id.tabs); - mShowUrlButton = (ImageButton) findViewById(R.id.showurl); // TODO: Change enabled states based on whether you can go // back/forward. Probably should be done inside onPageStarted. - mShowUrlButton.setOnClickListener(this); - // build tabs int tabcount = mControl.getTabCount(); for (int i = 0; i < tabcount; i++) { @@ -113,15 +104,7 @@ public class TabBar extends LinearLayout } public void onClick(View view) { - if (mShowUrlButton == view) { - if (mShowUrlMode) { - showUrlBar(); - } else if (!isLoading()) { - ScrollWebView swv = (ScrollWebView) mControl.getCurrentWebView(); - swv.hideEmbeddedTitleBar(); - mBrowserActivity.hideFakeTitleBar(); - } - } else if (mTabs.getSelectedTab() == view) { + if (mTabs.getSelectedTab() == view) { if (mBrowserActivity.isFakeTitleBarShowing() && !isLoading()) { mBrowserActivity.hideFakeTitleBar(); } else { @@ -145,8 +128,6 @@ public class TabBar extends LinearLayout private void setShowUrlMode(boolean showUrl) { mShowUrlMode = showUrl; - Drawable newDrawable = mShowUrlMode ? mShowUrlDrawable : mHideUrlDrawable; - mShowUrlButton.setImageDrawable(newDrawable); } // callback after fake titlebar is shown @@ -272,7 +253,10 @@ public class TabBar extends LinearLayout public void setSelected(boolean selected) { mSelected = selected; mClose.setVisibility(mSelected ? View.VISIBLE : View.GONE); - mTitle.setTextColor(mSelected ? Color.BLACK : Color.GRAY); + mTitle.setTextAppearance(mBrowserActivity, mSelected ? + R.style.TabTitleSelected : R.style.TabTitleUnselected); + setHorizontalFadingEdgeEnabled(!mSelected); + setFadingEdgeLength(50); super.setSelected(selected); setLayoutParams(new LayoutParams(selected ? mTabWidthSelected : mTabWidthUnselected, diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java index f45025d..bbb55ad 100644 --- a/src/com/android/browser/TitleBar.java +++ b/src/com/android/browser/TitleBar.java @@ -205,7 +205,7 @@ public class TitleBar extends TitleBarBase { } else if (mInLoad) { mBrowserActivity.stopLoading(); } else { - mBrowserActivity.promptAddOrInstallBookmark(); + mBrowserActivity.promptAddOrInstallBookmark(button); } button.setPressed(false); } else if (mTitleBg.isPressed()) { diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java index a7957ab..e305c07 100644 --- a/src/com/android/browser/TitleBarXLarge.java +++ b/src/com/android/browser/TitleBarXLarge.java @@ -16,42 +16,51 @@ package com.android.browser; +import com.android.browser.UrlInputView.UrlInputListener; + +import android.app.AlertDialog; import android.app.SearchManager; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.res.Resources; import android.graphics.Bitmap; +import android.graphics.Color; import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.os.Message; 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.ImageView; -import com.android.browser.UrlInputView.UrlInputListener; - /** * tabbed title bar for xlarge screen browser */ public class TitleBarXLarge extends TitleBarBase - implements UrlInputListener, OnClickListener { + implements UrlInputListener, OnClickListener, OnFocusChangeListener { private static final int PROGRESS_MAX = 100; private BrowserActivity mBrowserActivity; private Drawable mStopDrawable; private Drawable mReloadDrawable; - private Drawable mProgressDrawable; + private Drawable mFocusDrawable; + private Drawable mUnFocusDrawable; + private View mContainer; private View mBackButton; private View mForwardButton; private View mStar; private View mSearchButton; + private View mInputContainer; private ImageView mStopButton; private View mAllButton; - private ImageView mProgressView; + private PageProgressView mProgressView; private UrlInputView mUrlView; private boolean mInLoad; @@ -59,13 +68,14 @@ public class TitleBarXLarge extends TitleBarBase super(context); mBrowserActivity = context; Resources resources = context.getResources(); - mStopDrawable = resources.getDrawable(R.drawable.ic_stop); - mReloadDrawable = resources.getDrawable(R.drawable.ic_reload); + mStopDrawable = resources.getDrawable(R.drawable.ic_stop_normal); + mReloadDrawable = resources.getDrawable(R.drawable.ic_refresh_normal); + mFocusDrawable = resources.getDrawable(R.drawable.text_field_results); + mUnFocusDrawable = resources.getDrawable(R.drawable.text_field); rebuildLayout(context, true); } private void rebuildLayout(Context context, boolean rebuildData) { - removeAllViews(); LayoutInflater factory = LayoutInflater.from(context); factory.inflate(R.layout.url_bar, this); @@ -80,8 +90,8 @@ public class TitleBarXLarge extends TitleBarBase mStopButton = (ImageView) findViewById(R.id.stop); mSearchButton = findViewById(R.id.search); mLockIcon = (ImageView) findViewById(R.id.lock); - mProgressView = (ImageView) findViewById(R.id.progress); - mProgressDrawable = mProgressView.getDrawable(); + mProgressView = (PageProgressView) findViewById(R.id.progress); + mInputContainer = findViewById(R.id.urlbar); mBackButton.setOnClickListener(this); mForwardButton.setOnClickListener(this); @@ -90,6 +100,15 @@ public class TitleBarXLarge extends TitleBarBase mStopButton.setOnClickListener(this); mSearchButton.setOnClickListener(this); mUrlView.setUrlInputListener(this); + mUrlView.setOnFocusChangeListener(this); + mInputContainer.setBackgroundDrawable(mUnFocusDrawable); + mUrlView.setTextColor(Color.GRAY); + + } + + public void onFocusChange(View v, boolean hasFocus) { + mInputContainer.setBackgroundDrawable(hasFocus ? mFocusDrawable : mUnFocusDrawable); + mUrlView.setTextColor(hasFocus ? Color.BLACK : Color.GRAY); } @Override @@ -99,7 +118,7 @@ public class TitleBarXLarge extends TitleBarBase } else if (mForwardButton == v) { mBrowserActivity.getTopWindow().goForward(); } else if (mStar == v) { - mBrowserActivity.promptAddOrInstallBookmark(); + mBrowserActivity.promptAddOrInstallBookmark(mStar); } else if (mAllButton == v) { mBrowserActivity.bookmarksOrHistoryPicker(false, false); } else if (mSearchButton == v) { @@ -174,7 +193,7 @@ public class TitleBarXLarge extends TitleBarBase mInLoad = true; mStopButton.setImageDrawable(mStopDrawable); } - mProgressDrawable.setLevel(newProgress*10000/PROGRESS_MAX); + mProgressView.setProgress(newProgress*10000/PROGRESS_MAX); } } diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java index 77d7daf..9ae464b 100644 --- a/src/com/android/browser/UrlInputView.java +++ b/src/com/android/browser/UrlInputView.java @@ -22,8 +22,10 @@ import android.content.Context; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.view.View.OnFocusChangeListener; import android.view.ViewGroup; @@ -47,7 +49,8 @@ public class UrlInputView extends AutoCompleteTextView private UrlInputListener mListener; private InputMethodManager mInputManager; private SuggestionsAdapter mAdapter; - private Drawable mFocusDrawable; + + private OnFocusChangeListener mWrappedFocusListener; public UrlInputView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); @@ -65,16 +68,21 @@ public class UrlInputView extends AutoCompleteTextView } private void init(Context ctx) { - mFocusDrawable = ctx.getResources().getDrawable(R.drawable.textfield_stroke); mInputManager = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); setOnEditorActionListener(this); - setOnFocusChangeListener(this); + super.setOnFocusChangeListener(this); final ContentResolver cr = mContext.getContentResolver(); mAdapter = new SuggestionsAdapter(mContext, BrowserProvider.getBookmarksSuggestions(cr, null)); setAdapter(mAdapter); setOnItemClickListener(this); - setSelectAllOnFocus(true); + setSelectAllOnFocus(false); + + } + + @Override + public void setOnFocusChangeListener(OnFocusChangeListener focusListener) { + mWrappedFocusListener = focusListener; } @Override @@ -82,15 +90,30 @@ public class UrlInputView extends AutoCompleteTextView finishInput(getText().toString()); return true; } - + + @Override + public boolean onTouchEvent(MotionEvent evt) { + + if ((evt.getAction() == MotionEvent.ACTION_DOWN) && !this.hasFocus()) { + Log.i("test","onTouch"); + selectAll(); + requestFocus(); + return true; + } else { + return super.onTouchEvent(evt); + } + } + @Override public void onFocusChange(View v, boolean hasFocus) { - setBackgroundDrawable(hasFocus ? mFocusDrawable : null); if (hasFocus) { forceIme(); } else { finishInput(null); } + if (mWrappedFocusListener != null) { + mWrappedFocusListener.onFocusChange(v, hasFocus); + } } @Override @@ -110,6 +133,7 @@ public class UrlInputView extends AutoCompleteTextView private void finishInput(String url) { this.dismissDropDown(); + this.setSelection(0,0); mInputManager.hideSoftInputFromWindow(getWindowToken(), 0); if (url == null) { mListener.onDismiss(); |