summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPankaj Garg <pgarg@codeaurora.org>2014-11-07 17:33:41 -0800
committerWebTech Code Review <code-review@localhost>2014-11-26 10:30:10 -0800
commit49b7925ec66faf5015fdd1862eada2978ddd5fde (patch)
treee43ee53fe74f629317c2dd5e5702e8a5f496178a
parentaa42e9f7002450bb759d9bc5e2540deb88b97fa1 (diff)
downloadandroid_packages_apps_Gello-49b7925ec66faf5015fdd1862eada2978ddd5fde.tar.gz
android_packages_apps_Gello-49b7925ec66faf5015fdd1862eada2978ddd5fde.tar.bz2
android_packages_apps_Gello-49b7925ec66faf5015fdd1862eada2978ddd5fde.zip
Updates to SWE browser's options menu
- Changed the contents of the menu - Iconified frequently used items - Changes to layout and menu animation - Removed popup menu from History and Bookmarks page -- Added buttons to these pages to replace menu items - Updated icons used in popup menu - Added menu option to save link to homepage - Add bookmark icon color depicts if bookmark exists Change-Id: I37226506737647367f71159f1a439cc3fca4ae03
-rw-r--r--res/drawable-xxhdpi/ic_action_add_incognito_active.pngbin0 -> 2542 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_add_incognito_disabled.pngbin0 -> 2490 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_add_incognito_normal.pngbin0 -> 2589 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_add_tab_active.pngbin0 -> 411 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_add_tab_disabled.pngbin0 -> 408 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_add_tab_normal.pngbin0 -> 408 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_bookmark_active.pngbin0 -> 2672 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_bookmark_checked.pngbin0 -> 1464 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_bookmark_disabled.pngbin0 -> 2524 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_bookmark_normal.pngbin0 -> 2664 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_history_backward_active.pngbin0 -> 1100 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_history_backward_disabled.pngbin0 -> 835 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_history_backward_normal.pngbin0 -> 1106 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_history_forward_active.pngbin0 -> 1019 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_history_forward_disabled.pngbin0 -> 838 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_history_forward_normal.pngbin0 -> 1010 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_reload_active.pngbin0 -> 2099 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_reload_disabled.pngbin0 -> 2139 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_reload_normal.pngbin0 -> 2159 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_share_active.pngbin0 -> 1288 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_share_disabled.pngbin0 -> 1299 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_share_normal.pngbin0 -> 1289 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_stop_active.pngbin0 -> 1033 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_stop_disabled.pngbin0 -> 1018 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_stop_normal.pngbin0 -> 1025 bytes
-rw-r--r--res/drawable/ic_action_add_incognito.xml44
-rw-r--r--res/drawable/ic_action_add_tab.xml44
-rw-r--r--res/drawable/ic_action_bookmark.xml47
-rw-r--r--res/drawable/ic_action_history_backward.xml44
-rw-r--r--res/drawable/ic_action_history_forward.xml44
-rw-r--r--res/drawable/ic_action_reload.xml44
-rw-r--r--res/drawable/ic_action_share.xml44
-rw-r--r--res/drawable/ic_action_stop.xml44
-rw-r--r--res/layout/bookmarks.xml65
-rw-r--r--res/layout/four_button_menu_item.xml28
-rw-r--r--res/layout/history.xml49
-rw-r--r--res/layout/menu_item.xml18
-rw-r--r--res/layout/one_button_plus_menu_item.xml31
-rw-r--r--res/layout/three_button_menu_item.xml17
-rw-r--r--res/layout/three_button_plus_menu_item.xml56
-rw-r--r--res/layout/two_button_menu_item.xml31
-rw-r--r--res/layout/two_button_plus_menu_item.xml39
-rw-r--r--res/menu/browser.xml137
-rwxr-xr-xres/values/dimensions.xml14
-rw-r--r--res/values/ids.xml1
-rw-r--r--res/values/integers.xml1
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/values/styles.xml13
-rw-r--r--src/com/android/browser/ActivityController.java1
-rw-r--r--src/com/android/browser/BrowserActivity.java6
-rw-r--r--src/com/android/browser/BrowserBookmarksPage.java51
-rw-r--r--src/com/android/browser/BrowserHistoryPage.java25
-rw-r--r--src/com/android/browser/Controller.java162
-rw-r--r--src/com/android/browser/NavScreen.java13
-rw-r--r--src/com/android/browser/NavigationBarPhone.java1
-rw-r--r--src/com/android/browser/PhoneUi.java34
-rw-r--r--src/com/android/browser/appmenu/AppMenu.java46
-rw-r--r--src/com/android/browser/appmenu/AppMenuAdapter.java156
-rw-r--r--src/com/android/browser/appmenu/AppMenuButtonHelper.java15
-rw-r--r--src/com/android/browser/appmenu/AppMenuDragHelper.java8
-rw-r--r--src/com/android/browser/appmenu/AppMenuHandler.java27
-rw-r--r--src/com/android/browser/appmenu/AppMenuItemIcon.java2
-rw-r--r--src/com/android/browser/appmenu/AppMenuObserver.java2
-rw-r--r--src/com/android/browser/appmenu/AppMenuPropertiesDelegate.java2
-rw-r--r--src/com/android/browser/stub/NullController.java2
65 files changed, 1118 insertions, 292 deletions
diff --git a/res/drawable-xxhdpi/ic_action_add_incognito_active.png b/res/drawable-xxhdpi/ic_action_add_incognito_active.png
new file mode 100644
index 00000000..fc2316ce
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_add_incognito_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_add_incognito_disabled.png b/res/drawable-xxhdpi/ic_action_add_incognito_disabled.png
new file mode 100644
index 00000000..39319852
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_add_incognito_disabled.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_add_incognito_normal.png b/res/drawable-xxhdpi/ic_action_add_incognito_normal.png
new file mode 100644
index 00000000..783f11bd
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_add_incognito_normal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_add_tab_active.png b/res/drawable-xxhdpi/ic_action_add_tab_active.png
new file mode 100644
index 00000000..d7e01fa3
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_add_tab_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_add_tab_disabled.png b/res/drawable-xxhdpi/ic_action_add_tab_disabled.png
new file mode 100644
index 00000000..a31420bb
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_add_tab_disabled.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_add_tab_normal.png b/res/drawable-xxhdpi/ic_action_add_tab_normal.png
new file mode 100644
index 00000000..468a6916
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_add_tab_normal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_bookmark_active.png b/res/drawable-xxhdpi/ic_action_bookmark_active.png
new file mode 100644
index 00000000..74711e1b
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_bookmark_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_bookmark_checked.png b/res/drawable-xxhdpi/ic_action_bookmark_checked.png
new file mode 100644
index 00000000..808fa5af
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_bookmark_checked.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_bookmark_disabled.png b/res/drawable-xxhdpi/ic_action_bookmark_disabled.png
new file mode 100644
index 00000000..5f7f0333
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_bookmark_disabled.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_bookmark_normal.png b/res/drawable-xxhdpi/ic_action_bookmark_normal.png
new file mode 100644
index 00000000..cfbdb6cd
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_bookmark_normal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_history_backward_active.png b/res/drawable-xxhdpi/ic_action_history_backward_active.png
new file mode 100644
index 00000000..4baf3c48
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_history_backward_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_history_backward_disabled.png b/res/drawable-xxhdpi/ic_action_history_backward_disabled.png
new file mode 100644
index 00000000..657d98f3
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_history_backward_disabled.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_history_backward_normal.png b/res/drawable-xxhdpi/ic_action_history_backward_normal.png
new file mode 100644
index 00000000..aa213e40
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_history_backward_normal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_history_forward_active.png b/res/drawable-xxhdpi/ic_action_history_forward_active.png
new file mode 100644
index 00000000..78e5ada1
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_history_forward_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_history_forward_disabled.png b/res/drawable-xxhdpi/ic_action_history_forward_disabled.png
new file mode 100644
index 00000000..ea58281e
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_history_forward_disabled.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_history_forward_normal.png b/res/drawable-xxhdpi/ic_action_history_forward_normal.png
new file mode 100644
index 00000000..cda9c343
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_history_forward_normal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_reload_active.png b/res/drawable-xxhdpi/ic_action_reload_active.png
new file mode 100644
index 00000000..ec63ddae
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_reload_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_reload_disabled.png b/res/drawable-xxhdpi/ic_action_reload_disabled.png
new file mode 100644
index 00000000..b4a554d5
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_reload_disabled.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_reload_normal.png b/res/drawable-xxhdpi/ic_action_reload_normal.png
new file mode 100644
index 00000000..a017453c
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_reload_normal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_share_active.png b/res/drawable-xxhdpi/ic_action_share_active.png
new file mode 100644
index 00000000..b7cfdb06
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_share_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_share_disabled.png b/res/drawable-xxhdpi/ic_action_share_disabled.png
new file mode 100644
index 00000000..edba3957
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_share_disabled.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_share_normal.png b/res/drawable-xxhdpi/ic_action_share_normal.png
new file mode 100644
index 00000000..2ed118ac
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_share_normal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_stop_active.png b/res/drawable-xxhdpi/ic_action_stop_active.png
new file mode 100644
index 00000000..ad0db49a
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_stop_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_stop_disabled.png b/res/drawable-xxhdpi/ic_action_stop_disabled.png
new file mode 100644
index 00000000..a525fbd7
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_stop_disabled.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_stop_normal.png b/res/drawable-xxhdpi/ic_action_stop_normal.png
new file mode 100644
index 00000000..74591929
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_stop_normal.png
Binary files differ
diff --git a/res/drawable/ic_action_add_incognito.xml b/res/drawable/ic_action_add_incognito.xml
new file mode 100644
index 00000000..f4132c60
--- /dev/null
+++ b/res/drawable/ic_action_add_incognito.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2014, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_enabled="true" android:state_pressed="true"
+ android:drawable="@drawable/ic_action_add_incognito_active" />
+
+ <item android:state_enabled="true" android:state_selected="true"
+ android:drawable="@drawable/ic_action_add_incognito_active" />
+
+ <item android:state_enabled="false"
+ android:drawable="@drawable/ic_action_add_incognito_disabled" />
+
+ <item android:drawable="@drawable/ic_action_add_incognito_normal" />
+
+</selector>
diff --git a/res/drawable/ic_action_add_tab.xml b/res/drawable/ic_action_add_tab.xml
new file mode 100644
index 00000000..bb0b8f80
--- /dev/null
+++ b/res/drawable/ic_action_add_tab.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2014, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_enabled="true" android:state_pressed="true"
+ android:drawable="@drawable/ic_action_add_tab_active" />
+
+ <item android:state_enabled="true" android:state_selected="true"
+ android:drawable="@drawable/ic_action_add_tab_active" />
+
+ <item android:state_enabled="false"
+ android:drawable="@drawable/ic_action_add_tab_disabled" />
+
+ <item android:drawable="@drawable/ic_action_add_tab_normal" />
+
+</selector>
diff --git a/res/drawable/ic_action_bookmark.xml b/res/drawable/ic_action_bookmark.xml
new file mode 100644
index 00000000..bdce2c74
--- /dev/null
+++ b/res/drawable/ic_action_bookmark.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2014, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_enabled="true" android:state_pressed="true"
+ android:drawable="@drawable/ic_action_bookmark_active" />
+
+ <item android:state_enabled="true" android:state_checked="true"
+ android:drawable="@drawable/ic_action_bookmark_checked" />
+
+ <item android:state_enabled="true" android:state_selected="true"
+ android:drawable="@drawable/ic_action_bookmark_checked" />
+
+ <item android:state_enabled="false"
+ android:drawable="@drawable/ic_action_bookmark_disabled" />
+
+ <item android:drawable="@drawable/ic_action_bookmark_normal" />
+
+</selector>
diff --git a/res/drawable/ic_action_history_backward.xml b/res/drawable/ic_action_history_backward.xml
new file mode 100644
index 00000000..8557d76c
--- /dev/null
+++ b/res/drawable/ic_action_history_backward.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2014, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_enabled="true" android:state_pressed="true"
+ android:drawable="@drawable/ic_action_history_backward_active" />
+
+ <item android:state_enabled="true" android:state_selected="true"
+ android:drawable="@drawable/ic_action_history_backward_active" />
+
+ <item android:state_enabled="false"
+ android:drawable="@drawable/ic_action_history_backward_disabled" />
+
+ <item android:drawable="@drawable/ic_action_history_backward_normal" />
+
+</selector>
diff --git a/res/drawable/ic_action_history_forward.xml b/res/drawable/ic_action_history_forward.xml
new file mode 100644
index 00000000..00e79253
--- /dev/null
+++ b/res/drawable/ic_action_history_forward.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2014, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_enabled="true" android:state_pressed="true"
+ android:drawable="@drawable/ic_action_history_forward_active" />
+
+ <item android:state_enabled="true" android:state_selected="true"
+ android:drawable="@drawable/ic_action_history_forward_active" />
+
+ <item android:state_enabled="false"
+ android:drawable="@drawable/ic_action_history_forward_disabled" />
+
+ <item android:drawable="@drawable/ic_action_history_forward_normal" />
+
+</selector>
diff --git a/res/drawable/ic_action_reload.xml b/res/drawable/ic_action_reload.xml
new file mode 100644
index 00000000..77cd12bf
--- /dev/null
+++ b/res/drawable/ic_action_reload.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2014, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_enabled="true" android:state_pressed="true"
+ android:drawable="@drawable/ic_action_reload_active" />
+
+ <item android:state_enabled="true" android:state_selected="true"
+ android:drawable="@drawable/ic_action_reload_active" />
+
+ <item android:state_enabled="false"
+ android:drawable="@drawable/ic_action_reload_disabled" />
+
+ <item android:drawable="@drawable/ic_action_reload_normal" />
+
+</selector>
diff --git a/res/drawable/ic_action_share.xml b/res/drawable/ic_action_share.xml
new file mode 100644
index 00000000..ab997e87
--- /dev/null
+++ b/res/drawable/ic_action_share.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2014, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_enabled="true" android:state_pressed="true"
+ android:drawable="@drawable/ic_action_share_active" />
+
+ <item android:state_enabled="true" android:state_selected="true"
+ android:drawable="@drawable/ic_action_share_active" />
+
+ <item android:state_enabled="false"
+ android:drawable="@drawable/ic_action_share_disabled" />
+
+ <item android:drawable="@drawable/ic_action_share_normal" />
+
+</selector>
diff --git a/res/drawable/ic_action_stop.xml b/res/drawable/ic_action_stop.xml
new file mode 100644
index 00000000..bda0783a
--- /dev/null
+++ b/res/drawable/ic_action_stop.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2014, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_enabled="true" android:state_pressed="true"
+ android:drawable="@drawable/ic_action_stop_active" />
+
+ <item android:state_enabled="true" android:state_selected="true"
+ android:drawable="@drawable/ic_action_stop_active" />
+
+ <item android:state_enabled="false"
+ android:drawable="@drawable/ic_action_stop_disabled" />
+
+ <item android:drawable="@drawable/ic_action_stop_normal" />
+
+</selector>
diff --git a/res/layout/bookmarks.xml b/res/layout/bookmarks.xml
index 09b442ec..02a5a97d 100644
--- a/res/layout/bookmarks.xml
+++ b/res/layout/bookmarks.xml
@@ -13,26 +13,55 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-<FrameLayout
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingTop="@dimen/combo_paddingTop">
- <com.android.browser.view.BookmarkExpandableView
- android:id="@+id/grid"
+ android:orientation="vertical"
+ >
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="90"
+ android:paddingTop="@dimen/combo_paddingTop">
+ <com.android.browser.view.BookmarkExpandableView
+ android:id="@+id/grid"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_horizontal"
+ android:childDivider="@android:color/transparent"
+ android:divider="@android:color/transparent"
+ android:dividerHeight="0dp" />
+ <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_bookmarks_folder"
+ android:visibility="gone" />
+ </FrameLayout>
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center_horizontal"
- android:childDivider="@android:color/transparent"
- android:divider="@android:color/transparent"
- android:dividerHeight="0dp" />
- <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_bookmarks_folder"
- android:visibility="gone" />
-</FrameLayout>
+ android:layout_weight="10"
+ android:layout_alignParentBottom="true" >
+
+ <Button
+ android:id="@+id/add_bookmark_button"
+ android:text="@string/add_new_bookmark"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ />
+ <Button
+ android:id="@+id/new_bmfolder_button"
+ android:text="@string/new_folder"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ />
+ </LinearLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout/four_button_menu_item.xml b/res/layout/four_button_menu_item.xml
index f1b2fd6e..edefb537 100644
--- a/res/layout/four_button_menu_item.xml
+++ b/res/layout/four_button_menu_item.xml
@@ -12,35 +12,45 @@
<ImageButton
android:id="@+id/button_one"
- android:layout_width="59dp"
+ android:layout_width="0dp"
android:layout_height="match_parent"
+ android:layout_weight="24"
+ android:paddingStart="11dp"
android:paddingEnd="11dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
- android:scaleType="center" />
+ android:scaleType="center"
+ />
<ImageButton
android:id="@+id/button_two"
- android:layout_width="70dp"
+ android:layout_width="0dp"
android:layout_height="match_parent"
+ android:layout_weight="24"
android:paddingStart="11dp"
android:paddingEnd="11dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
- android:scaleType="center" />
+ android:scaleType="center"
+ />
<ImageButton
android:id="@+id/button_three"
- android:layout_width="70dp"
+ android:layout_width="0dp"
android:layout_height="match_parent"
+ android:layout_weight="24"
android:paddingStart="11dp"
android:paddingEnd="11dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
- android:scaleType="center" />
+ android:scaleType="center"
+ />
<ImageButton
android:id="@+id/button_four"
- android:layout_width="59dp"
+ android:layout_width="0dp"
android:layout_height="match_parent"
+ android:layout_weight="24"
android:paddingStart="11dp"
+ android:paddingEnd="11dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
- android:scaleType="center" />
-</LinearLayout> \ No newline at end of file
+ android:scaleType="center"
+ />
+</LinearLayout>
diff --git a/res/layout/history.xml b/res/layout/history.xml
index f3adb519..53f70dc1 100644
--- a/res/layout/history.xml
+++ b/res/layout/history.xml
@@ -14,23 +14,44 @@
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
->
+ android:orientation="vertical" >
- <ExpandableListView
- android:id="@+id/history"
- android:layout_height="match_parent"
- android:layout_width="match_parent" />
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_weight="90"
+ android:layout_height="match_parent" >
- <TextView android:id="@android:id/empty"
- android:layout_width="wrap_content"
+ <ExpandableListView
+ android:id="@+id/history"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent" />
+
+ <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>
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:text="@string/empty_history"
- android:visibility="gone"
- />
+ android:layout_weight="10"
+ android:layout_alignParentBottom="true" >
+
+ <Button
+ android:id="@+id/clear_history_button"
+ android:text="@string/clear_history"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ />
+ </LinearLayout>
-</FrameLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout/menu_item.xml b/res/layout/menu_item.xml
index 66bbb829..7247ee1c 100644
--- a/res/layout/menu_item.xml
+++ b/res/layout/menu_item.xml
@@ -13,20 +13,30 @@
android:background="?android:attr/listChoiceBackgroundIndicator">
<TextView
android:id="@+id/menu_item_text"
- android:textAppearance="?android:attr/textAppearanceLargePopupMenu"
+ android:textAppearance="?android:attr/textAppearanceSmallPopupMenu"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:gravity="center_vertical"
android:singleLine="true"
- android:paddingEnd="9dp" />
+ android:paddingLeft="16dp"
+ android:paddingEnd="9dp"
+ />
<view
- class="org.chromium.chrome.browser.appmenu.AppMenuItemIcon"
+ class="com.android.browser.appmenu.AppMenuItemIcon"
android:id="@+id/menu_item_icon"
android:layout_weight="0"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
- android:gravity="center_vertical" />
+ android:gravity="center_vertical"
+ />
+ <CheckBox
+ android:id="@+id/menu_item_checkbox"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:tint="@color/black"
+ android:visible="false"
+ android:clickable="true" />
</LinearLayout>
diff --git a/res/layout/one_button_plus_menu_item.xml b/res/layout/one_button_plus_menu_item.xml
new file mode 100644
index 00000000..278611cc
--- /dev/null
+++ b/res/layout/one_button_plus_menu_item.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2014 The Chromium Authors. All rights reserved.
+
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:layout_gravity="top|start"
+ android:orientation="horizontal">
+
+ <ImageButton
+ android:id="@+id/button_one"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="90"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ />
+
+ <ImageButton
+ android:id="@+id/button_two"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="6"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ />
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout/three_button_menu_item.xml b/res/layout/three_button_menu_item.xml
index 5fb2d781..1895e434 100644
--- a/res/layout/three_button_menu_item.xml
+++ b/res/layout/three_button_menu_item.xml
@@ -14,23 +14,26 @@
android:id="@+id/button_one"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_weight="32"
android:background="?android:attr/listChoiceBackgroundIndicator"
- android:scaleType="center" />
+ android:scaleType="center"
+ />
<ImageButton
android:id="@+id/button_two"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_weight="32"
android:background="?android:attr/listChoiceBackgroundIndicator"
- android:scaleType="center" />
+ android:scaleType="center"
+ />
<ImageButton
android:id="@+id/button_three"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_weight="32"
android:background="?android:attr/listChoiceBackgroundIndicator"
- android:scaleType="center" />
-</LinearLayout> \ No newline at end of file
+ android:scaleType="center"
+ />
+</LinearLayout>
diff --git a/res/layout/three_button_plus_menu_item.xml b/res/layout/three_button_plus_menu_item.xml
new file mode 100644
index 00000000..e0cc23bf
--- /dev/null
+++ b/res/layout/three_button_plus_menu_item.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2014 The Chromium Authors. All rights reserved.
+
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:layout_gravity="top|start"
+ android:orientation="horizontal">
+
+ <ImageButton
+ android:id="@+id/button_one"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="30"
+ android:paddingStart="11dp"
+ android:paddingEnd="11dp"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ />
+
+ <ImageButton
+ android:id="@+id/button_two"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="30"
+ android:paddingStart="11dp"
+ android:paddingEnd="11dp"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ />
+
+ <ImageButton
+ android:id="@+id/button_three"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="30"
+ android:paddingStart="11dp"
+ android:paddingEnd="11dp"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ />
+
+ <ImageButton
+ android:id="@+id/button_four"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="6"
+ android:paddingStart="11dp"
+ android:paddingEnd="11dp"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ android:tint="@color/black" />
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout/two_button_menu_item.xml b/res/layout/two_button_menu_item.xml
new file mode 100644
index 00000000..a2fc4164
--- /dev/null
+++ b/res/layout/two_button_menu_item.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2014 The Chromium Authors. All rights reserved.
+
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:layout_gravity="top|start"
+ android:orientation="horizontal">
+
+ <ImageButton
+ android:id="@+id/button_one"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="48"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ />
+
+ <ImageButton
+ android:id="@+id/button_two"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="48"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ />
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout/two_button_plus_menu_item.xml b/res/layout/two_button_plus_menu_item.xml
new file mode 100644
index 00000000..ae47f531
--- /dev/null
+++ b/res/layout/two_button_plus_menu_item.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2014 The Chromium Authors. All rights reserved.
+
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:layout_gravity="top|start"
+ android:orientation="horizontal">
+
+ <ImageButton
+ android:id="@+id/button_one"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="45"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ />
+
+ <ImageButton
+ android:id="@+id/button_two"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="45"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ />
+
+ <ImageButton
+ android:id="@+id/button_three"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="6"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/res/menu/browser.xml b/res/menu/browser.xml
index 72f51ffe..32dc6caa 100644
--- a/res/menu/browser.xml
+++ b/res/menu/browser.xml
@@ -17,96 +17,101 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group
android:id="@+id/MAIN_MENU">
- <item
- android:id="@+id/homepage_menu_id"
- android:title="@string/go_home"
- android:alphabeticShortcut="&#32;" />
+
<group
android:id="@+id/NAV_MENU"
android:visible="@bool/menu_show_navigation">
- <item
- android:id="@+id/stop_reload_menu_id"
- android:alphabeticShortcut="r" />
- <item
- android:id="@+id/forward_menu_id"
- android:title="@string/forward"
- android:icon="@drawable/ic_menu_forward" />
+ <item>
+ <menu>
+ <item
+ android:id="@+id/forward_menu_id"
+ android:icon="@drawable/ic_action_history_forward"
+ android:title="@string/forward"/>
+ <item
+ android:id="@+id/bookmark_this_page_id"
+ android:icon="@drawable/ic_action_bookmark"
+ android:title="@string/save_to_bookmarks"/>
+ <item
+ android:id="@+id/stop_reload_menu_id"
+ android:icon="@drawable/ic_action_stop"
+ android:title="@string/stop"
+ android:visible="false"/>
+ </menu>
+ </item>
</group>
- <item
- android:id="@+id/back_menu_id"
- android:title="@string/back" />
- <item
- android:id="@+id/new_tab_menu_id"
- android:title="@string/new_tab"
- android:icon="@drawable/ic_new_window_holo_dark"
- android:showAsAction="never"
- android:alphabeticShortcut="n" />
- <item
- android:id="@+id/incognito_menu_id"
- android:title="@string/new_incognito_tab"
- android:icon="@drawable/ic_new_incognito_holo_dark" />
+
+ <item>
+ <menu>
+ <item
+ android:id="@+id/new_tab_menu_id"
+ android:title="@string/new_tab"
+ android:icon="@drawable/ic_action_add_tab" />
+ <item
+ android:id="@+id/incognito_menu_id"
+ android:title="@string/new_incognito_tab"
+ android:icon="@drawable/ic_action_add_incognito" />
+
+<!--
+ <item
+ android:id="@+id/close_other_tabs_id"
+ android:title="@string/close_other_tabs"
+ android:icon="@drawable/ic_tab_close" />
+-->
+ </menu>
+ </item>
+
<item
android:id="@+id/bookmarks_menu_id"
android:title="@string/bookmarks"
- android:icon="@drawable/ic_bookmarks_holo_dark"
android:showAsAction="never" />
<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"
- android:visible="@bool/menu_show_bookmarks" />
+ android:id="@+id/history_menu_id"
+ android:title="@string/tab_history" />
+ <item
+ android:id="@+id/snapshots_menu_id"
+ android:title="@string/tab_snapshots"
+ android:visible="false" />
+ <item
+ android:id="@+id/find_menu_id"
+ android:title="@string/find_on_page"/>
+
<group
android:id="@+id/LIVE_MENU">
<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/find_menu_id"
- android:title="@string/find_on_page"/>
- <item
android:id="@+id/ua_desktop_menu_id"
android:checkable="true"
android:title="@string/ua_switcher_desktop" />
- </group>
- <group
- android:id="@+id/OFFLINE_READING">
- <item
+ <item
android:id="@+id/save_snapshot_menu_id"
android:title="@string/menu_save_snapshot" />
+ <item
+ android:id="@+id/add_to_homescreen"
+ android:title="@string/add_to_homescreen" />
+ <item
+ android:id="@+id/share_page_menu_id"
+ android:title="@string/share_page" />
</group>
+
<group
- android:id="@+id/SNAPSHOT_MENU">
+ android:id="@+id/SNAPSHOT_MENU"
+ android:visible="false">
<item
android:id="@+id/snapshot_go_live"
android:title="@string/snapshot_go_live" />
</group>
- <group
- android:id="@+id/COMBO_MENU">
- <item
- android:id="@+id/close_other_tabs_id"
- android:title="@string/close_other_tabs" />
- <item
- android:id="@+id/history_menu_id"
- android:title="@string/tab_history"
- android:alphabeticShortcut="h" />
- <item
- android:id="@+id/snapshots_menu_id"
- android:title="@string/tab_snapshots" />
- </group>
- <item
- android:id="@+id/page_info_menu_id"
- android:title="@string/page_info" />
<item
android:id="@+id/preferences_menu_id"
android:title="@string/menu_preferences"
- android:icon="@drawable/ic_settings_holo_dark"
android:alphabeticShortcut="p" />
- <item
- android:id="@+id/exit_menu_id"
- android:title="@string/exit" />
+
+ <group
+ android:id="@+id/QRD_MENU"
+ android:visible="false">
+ <item
+ android:id="@+id/exit_menu_id"
+ android:title="@string/exit" />
+ </group>
+
<item
android:id="@+id/about_menu_id"
android:title="@string/about" />
@@ -141,7 +146,9 @@
android:alphabeticShortcut="7" />
<item android:id="@+id/window_eight_menu_id"
android:alphabeticShortcut="8" />
+<!--
<item android:id="@+id/back_menu_id" />
+-->
<item android:id="@+id/goto_menu_id"
android:alphabeticShortcut="l" />
<item android:id="@+id/close_menu_id"
@@ -156,11 +163,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="@drawable/ic_menu_stop"
+ android:icon="@drawable/ic_action_stop"
android:visible="false" />
<item android:id="@+id/reload_menu_id"
android:title="@string/reload"
- android:icon="@drawable/ic_menu_refresh"
+ android:icon="@drawable/ic_action_reload"
android:visible="false" />
</menu>
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index 3d425080..6741b267 100755
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -58,7 +58,7 @@
<!-- Preference widget area width (to the left of the text) -->
<dimen name="preference_widget_width">56dp</dimen>
<dimen name="nav_tab_spacing">8dp</dimen>
- <dimen name="menu_width">240dip</dimen>
+ <dimen name="menu_width">258dp</dimen>
<dimen name="menu_height">32dip</dimen>
<dimen name="toolbar_height">52dip</dimen>
<dimen name="tab_thumbnail_width">240dip</dimen>
@@ -70,4 +70,16 @@
<dimen name="nav_tab_text_small">14sp</dimen>
<dimen name="suggest_item_padding">8dp</dimen>
<dimen name="progress_bar_margin">-11dip</dimen>
+
+ <!-- Custom Menu dimensions -->
+ <dimen name="menu_negative_software_vertical_offset">0dp</dimen>
+ <!-- The amount to fade the edges of the menu to indicate more content is available
+ via scrolling. -->
+ <dimen name="menu_vertical_fade_distance">15dp</dimen>
+
+ <!-- Menu button dragging related dimensions -->
+ <dimen name="auto_scroll_full_velocity">500dp</dimen>
+ <dimen name="edge_swipe_in_slop">25dp</dimen>
+ <dimen name="edge_swipe_in_additional_slop">50dp</dimen>
+ <dimen name="edge_swipe_out_slop">18dp</dimen>
</resources>
diff --git a/res/values/ids.xml b/res/values/ids.xml
index 211b02fb..dfe4b3f7 100644
--- a/res/values/ids.xml
+++ b/res/values/ids.xml
@@ -22,4 +22,5 @@
<item type="id" name="tab_view" />
<item type="id" name="position" />
<item type="id" name="load_object" />
+ <item type="id" name="menu_item_enter_anim_id" />
</resources>
diff --git a/res/values/integers.xml b/res/values/integers.xml
index 9fd97b23..0ce7ea75 100644
--- a/res/values/integers.xml
+++ b/res/values/integers.xml
@@ -31,4 +31,5 @@
<!-- The duration of the titlebar animation in millisecs -->
<integer name="titlebar_animation_duration">200</integer>
<integer name="netswitch_type_remind">1</integer>
+ <item type="fraction" format="fraction" name="menu_animation_pivot_x">95%</item>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 61f4c36a..67134a19 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -238,6 +238,8 @@
<string name="copy_page_url">Copy page URL</string>
<!-- Menu item -->
<string name="share_page">Share page</string>
+ <!-- Menu item for saving link to homescreen -->
+ <string name="add_to_homescreen">Add to homescreen</string>
<!-- Menu item for saving a page for offline reading. This is a view-only snapshot of the page. [CHAR LIMIT=50] -->
<string name="menu_save_snapshot">Save for offline reading</string>
<!-- Dialog message that is shown while saving a page for offline reading. [CHAR LIMIT=50] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 17c5eb20..751451a3 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -93,4 +93,17 @@
<item name="android:imeOptions">flagNoExtractUi|actionNext</item>
<item name="android:singleLine">true</item>
</style>
+ <style name="OverflowMenuThemeBase" parent="BrowserTheme">
+ <item name="android:popupBackground">@null</item>
+ <item name="android:listDivider">@null</item>
+ <item name="android:listPreferredItemHeightSmall">48dp</item>
+ <item name="android:listPreferredItemPaddingStart">16dp</item>
+ <item name="android:listPreferredItemPaddingEnd">16dp</item>
+ <item name="android:textSize">16sp</item>
+ </style>
+ <style name="OverflowMenuTheme" parent="OverflowMenuThemeBase" />
+ <style name="OverflowMenuAnim">
+ <item name="android:windowEnterAnimation">@anim/menu_enter</item>
+ <item name="android:windowExitAnimation">@anim/menu_exit</item>
+ </style>
</resources>
diff --git a/src/com/android/browser/ActivityController.java b/src/com/android/browser/ActivityController.java
index ac248b8d..817857ac 100644
--- a/src/com/android/browser/ActivityController.java
+++ b/src/com/android/browser/ActivityController.java
@@ -71,4 +71,5 @@ public interface ActivityController {
boolean dispatchGenericMotionEvent(MotionEvent ev);
+ void invalidateOptionsMenu();
}
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 351cb964..3b95ee90 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -297,9 +297,9 @@ public class BrowserActivity extends Activity implements ViewTreeObserver.OnPreD
}
@Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- return mController.onCreateOptionsMenu(menu);
+ public void invalidateOptionsMenu() {
+ super.invalidateOptionsMenu();
+ mController.invalidateOptionsMenu();
}
@Override
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index 16eae77b..7abe07bb 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -45,6 +45,7 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.Button;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.Toast;
@@ -169,31 +170,6 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte
}
}
- //add for carrier feature which adds new bookmark/folder function.
- @Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- super.onCreateOptionsMenu(menu, inflater);
- inflater.inflate(R.menu.bookmark, menu);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- final Activity activity = getActivity();
- if (item.getItemId() == R.id.add_bookmark_menu_id) {
- Intent intent = new Intent(activity, AddBookmarkPage.class);
- intent.putExtra(BrowserContract.Bookmarks.URL, "http://");
- intent.putExtra(BrowserContract.Bookmarks.TITLE, "");
- intent.putExtra(BrowserContract.Bookmarks.PARENT, mCurrentFolderId);
- activity.startActivity(intent);
- }
- if (item.getItemId() == R.id.new_bmfolder_menu_id) {
- Intent intent = new Intent(activity, AddBookmarkFolder.class);
- intent.putExtra(BrowserContract.Bookmarks.PARENT, mCurrentFolderId);
- activity.startActivity(intent);
- }
- return super.onOptionsItemSelected(item);
- }
-
@Override
public boolean onContextItemSelected(MenuItem item) {
if (!(item.getMenuInfo() instanceof BookmarkContextMenuInfo)) {
@@ -373,7 +349,6 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte
}
Bundle args = getArguments();
mDisableNewWindow = args == null ? false : args.getBoolean(EXTRA_DISABLE_WINDOW, false);
- setHasOptionsMenu(true);
if (mCallbacks == null && getActivity() instanceof CombinedBookmarksCallbacks) {
mCallbacks = new CombinedBookmarksCallbackWrapper(
(CombinedBookmarksCallbacks) getActivity());
@@ -423,6 +398,7 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
+ final Activity activity = getActivity();
mRoot = inflater.inflate(R.layout.bookmarks, container, false);
mEmptyView = mRoot.findViewById(android.R.id.empty);
@@ -432,6 +408,28 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte
mGrid.setBreadcrumbController(this);
setEnableContextMenu(mEnableContextMenu);
+ Button btn = (Button) mRoot.findViewById(R.id.add_bookmark_button);
+ btn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent intent = new Intent(activity, AddBookmarkPage.class);
+ intent.putExtra(BrowserContract.Bookmarks.URL, "http://");
+ intent.putExtra(BrowserContract.Bookmarks.TITLE, "");
+ intent.putExtra(BrowserContract.Bookmarks.PARENT, mCurrentFolderId);
+ activity.startActivity(intent);
+ }
+ });
+
+ btn = (Button) mRoot.findViewById(R.id.new_bmfolder_button);
+ btn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent intent = new Intent(activity, AddBookmarkFolder.class);
+ intent.putExtra(BrowserContract.Bookmarks.PARENT, mCurrentFolderId);
+ activity.startActivity(intent);
+ }
+ });
+
// Start the loaders
LoaderManager lm = getLoaderManager();
lm.restartLoader(LOADER_ACCOUNTS, null, this);
@@ -604,7 +602,6 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte
mGrid.setColumnWidthFromLayout(R.layout.bookmark_thumbnail);
int paddingTop = (int) res.getDimension(R.dimen.combo_paddingTop);
mRoot.setPadding(0, paddingTop, 0, 0);
- getActivity().invalidateOptionsMenu();
}
/**
diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java
index fa25acad..193d0408 100644
--- a/src/com/android/browser/BrowserHistoryPage.java
+++ b/src/com/android/browser/BrowserHistoryPage.java
@@ -51,6 +51,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
+import android.widget.Button;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
import android.widget.ExpandableListView.OnChildClickListener;
@@ -196,8 +197,6 @@ public class BrowserHistoryPage extends Fragment
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- setHasOptionsMenu(true);
-
Bundle args = getArguments();
mDisableNewWindow = args.getBoolean(BrowserBookmarksPage.EXTRA_DISABLE_WINDOW, false);
int mvlimit = getResources().getInteger(R.integer.most_visits_limit);
@@ -216,6 +215,13 @@ public class BrowserHistoryPage extends Fragment
} else {
inflateSinglePane();
}
+ Button btn = (Button) mRoot.findViewById(R.id.clear_history_button);
+ btn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ promptToClearHistory();
+ }
+ });
// Start the loaders
getLoaderManager().restartLoader(LOADER_HISTORY, null, this);
@@ -285,12 +291,6 @@ public class BrowserHistoryPage extends Fragment
getLoaderManager().destroyLoader(LOADER_MOST_VISITED);
}
- @Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- super.onCreateOptionsMenu(menu, inflater);
- inflater.inflate(R.menu.history, menu);
- }
-
void promptToClearHistory() {
final ContentResolver resolver = getActivity().getContentResolver();
final ClearHistoryTask clear = new ClearHistoryTask(resolver);
@@ -310,15 +310,6 @@ public class BrowserHistoryPage extends Fragment
dialog.show();
}
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- if (item.getItemId() == R.id.clear_history_menu_id) {
- promptToClearHistory();
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-
static class ClearHistoryTask extends Thread {
ContentResolver mResolver;
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 292a46db..b0657c96 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -79,6 +79,8 @@ import android.view.WindowManager;
import android.webkit.MimeTypeMap;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient.CustomViewCallback;
+import android.widget.Button;
+import android.widget.EditText;
import android.widget.Toast;
import org.codeaurora.swe.CookieManager;
@@ -103,6 +105,8 @@ import com.android.browser.platformsupport.BrowserContract.Images;
import com.android.browser.provider.BrowserProvider2.Thumbnails;
import com.android.browser.provider.SnapshotProvider.Snapshots;
import com.android.browser.reflect.ReflectHelper;
+import com.android.browser.appmenu.AppMenuHandler;
+import com.android.browser.appmenu.AppMenuPropertiesDelegate;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -123,7 +127,8 @@ import java.util.Map;
* Controller for browser
*/
public class Controller
- implements WebViewController, UiController, ActivityController {
+ implements WebViewController, UiController, ActivityController,
+ AppMenuPropertiesDelegate {
private static final String LOGTAG = "Controller";
private static final String SEND_APP_ID_EXTRA =
@@ -206,6 +211,9 @@ public class Controller
private boolean mMenuIsDown;
+ private boolean mWasInPageLoad = false;
+ private AppMenuHandler mAppMenuHandler;
+
// For select and find, we keep track of the ActionMode so that
// finish() can be called as desired.
private ActionMode mActionMode;
@@ -275,6 +283,7 @@ public class Controller
mNetworkHandler = new NetworkStateHandler(mActivity, this);
mHomepageHandler = new HomepageHandler(browser, this);
+ mAppMenuHandler = new AppMenuHandler(browser, this, R.menu.browser);
}
@Override
@@ -654,6 +663,7 @@ public class Controller
mConfigChanged = true;
// update the menu in case of a locale change
mActivity.invalidateOptionsMenu();
+ mAppMenuHandler.hideAppMenu();
if (mOptionsMenuOpen) {
mActivity.closeOptionsMenu();
mHandler.sendMessageDelayed(mHandler.obtainMessage(OPEN_MENU), 100);
@@ -973,8 +983,14 @@ public class Controller
// any sub frames so calls to onProgressChanges may continue after
// onPageFinished has executed)
if (tab.inPageLoad()) {
+ mWasInPageLoad = true;
+ updateInLoadMenuItems(mCachedMenu, tab);
+ } else if (mWasInPageLoad) {
+ mWasInPageLoad = false;
updateInLoadMenuItems(mCachedMenu, tab);
- } else if (mActivityPaused && pauseWebViewTimers(tab)) {
+ }
+
+ if (mActivityPaused && pauseWebViewTimers(tab)) {
// pause the WebView timer and release the wake lock if it is
// finished while BrowserActivity is in pause state.
releaseWakeLock();
@@ -1001,7 +1017,10 @@ public class Controller
// still loading
// updating the progress and
// update the menu items.
+ mWasInPageLoad = false;
updateInLoadMenuItems(mCachedMenu, tab);
+ } else {
+ mWasInPageLoad = true;
}
}
mUi.onProgressChanged(tab);
@@ -1780,10 +1799,22 @@ public class Controller
dest.setIcon(src.getIcon());
dest.setTitle(src.getTitle());
}
+ mActivity.invalidateOptionsMenu();
+ }
+
+ public void invalidateOptionsMenu() {
+ mAppMenuHandler.invalidateAppMenu();
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
+ // Software menu key (toolbar key)
+ mAppMenuHandler.showAppMenu(mActivity.findViewById(R.id.more_browser_settings), false, false);
+ return true;
+ }
+
+ @Override
+ public void prepareMenu(Menu menu) {
updateInLoadMenuItems(menu, getCurrentTab());
// hold on to the menu reference here; it is used by the page callbacks
// to update the menu based on loading state
@@ -1809,12 +1840,53 @@ public class Controller
break;
}
mCurrentMenuState = mMenuState;
- return mUi.onPrepareOptionsMenu(menu);
+ mUi.onPrepareOptionsMenu(menu);
+ }
+
+ private void setMenuItemVisibility(Menu menu, int id,
+ boolean visibility) {
+ MenuItem item = menu.findItem(id);
+ if (item != null) {
+ item.setVisible(visibility);
+ }
+ }
+
+ private int lookupBookmark(String title, String url) {
+ final ContentResolver cr = getActivity().getContentResolver();
+
+ Cursor cursor = cr.query(BrowserContract.Bookmarks.CONTENT_URI,
+ BookmarksLoader.PROJECTION,
+ "title = ? OR url = ?",
+ new String[] {
+ title, url
+ },
+ null);
+
+ if (cursor == null) {
+ return 0;
+ }
+
+ return cursor.getCount();
+ }
+
+ private void resetMenuItems(Menu menu) {
+ setMenuItemVisibility(menu, R.id.history_menu_id, true);
+ setMenuItemVisibility(menu, R.id.find_menu_id, true);
+
+ WebView w = getCurrentTopWebView();
+ MenuItem bookmark_icon = menu.findItem(R.id.bookmark_this_page_id);
+
+ String title = w.getTitle();
+ String url = w.getUrl();
+ if (title != null && url != null && lookupBookmark(title, url) > 0) {
+ bookmark_icon.setChecked(true);
+ } else {
+ bookmark_icon.setChecked(false);
+ }
}
@Override
public void updateMenuState(Tab tab, Menu menu) {
- boolean canGoBack = false;
boolean canGoForward = false;
boolean isDesktopUa = false;
boolean isLive = false;
@@ -1822,33 +1894,20 @@ public class Controller
// items defined in res/menu/browser.xml should be enabled
boolean isLiveScheme = false;
boolean isPageFinished = false;
- boolean isSavable = false;
+
+ resetMenuItems(menu);
+
if (tab != null) {
- canGoBack = tab.canGoBack();
canGoForward = tab.canGoForward();
isDesktopUa = mSettings.hasDesktopUseragent(tab.getWebView());
isLive = !tab.isSnapshot();
isLiveScheme = UrlUtils.isLiveScheme(tab.getWebView().getUrl());
- isPageFinished = tab.getPageFinishedStatus();
- isSavable = tab.getWebView().isSavable();
+ isPageFinished = (tab.getPageFinishedStatus() || !tab.inPageLoad());
}
- final MenuItem back = menu.findItem(R.id.back_menu_id);
- back.setEnabled(canGoBack);
-
- final MenuItem home = menu.findItem(R.id.homepage_menu_id);
final MenuItem forward = menu.findItem(R.id.forward_menu_id);
forward.setEnabled(canGoForward);
- final MenuItem source = menu.findItem(isInLoad() ? R.id.stop_menu_id
- : R.id.reload_menu_id);
- final MenuItem dest = menu.findItem(R.id.stop_reload_menu_id);
- if (source != null && dest != null) {
- dest.setTitle(source.getTitle());
- dest.setIcon(source.getIcon());
- }
- menu.setGroupVisible(R.id.NAV_MENU, isLive);
-
// decide whether to show the share link option
PackageManager pm = mActivity.getPackageManager();
Intent send = new Intent(Intent.ACTION_SEND);
@@ -1866,8 +1925,13 @@ public class Controller
final MenuItem uaSwitcher = menu.findItem(R.id.ua_desktop_menu_id);
uaSwitcher.setChecked(isDesktopUa);
menu.setGroupVisible(R.id.LIVE_MENU, isLive && isLiveScheme);
+ menu.setGroupVisible(R.id.NAV_MENU, isLive && isLiveScheme);
+ setMenuItemVisibility(menu, R.id.find_menu_id, isLive && isLiveScheme);
menu.setGroupVisible(R.id.SNAPSHOT_MENU, !isLive);
- menu.setGroupEnabled(R.id.OFFLINE_READING, isLive && isLiveScheme && isPageFinished && isSavable);
+ setMenuItemVisibility(menu, R.id.add_to_homescreen,
+ isLive && isLiveScheme && isPageFinished);
+ setMenuItemVisibility(menu, R.id.save_snapshot_menu_id,
+ isLive && isLiveScheme && isPageFinished);
// history and snapshots item are the members of COMBO menu group,
// so if show history item, only make snapshots item invisible.
menu.findItem(R.id.snapshots_menu_id).setVisible(false);
@@ -1901,10 +1965,6 @@ public class Controller
openIncognitoTab();
break;
- case R.id.close_other_tabs_id:
- closeOtherTabs();
- break;
-
case R.id.goto_menu_id:
editUrl();
break;
@@ -1921,7 +1981,7 @@ public class Controller
bookmarksOrHistoryPicker(ComboViews.Snapshots);
break;
- case R.id.add_bookmark_menu_id:
+ case R.id.bookmark_this_page_id:
bookmarkCurrentPage();
break;
@@ -1938,10 +1998,6 @@ public class Controller
}
break;
- case R.id.back_menu_id:
- getCurrentTab().goBack();
- break;
-
case R.id.forward_menu_id:
getCurrentTab().goForward();
break;
@@ -2068,6 +2124,34 @@ public class Controller
builder.create().show();
break;
+ case R.id.add_to_homescreen:
+ final WebView w = getCurrentTopWebView();
+ final EditText input = new EditText(getContext());
+ input.setText(w.getTitle());
+ new AlertDialog.Builder(getContext())
+ .setTitle("Add to homescreen")
+ .setMessage("Title")
+ .setView(input)
+ .setPositiveButton("Add", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ mActivity.sendBroadcast(BookmarkUtils.createAddToHomeIntent(
+ getContext(),
+ w.getUrl(),
+ input.getText().toString(),
+ w.getViewportBitmap(),
+ w.getFavicon()));
+
+ mActivity.startActivity(new Intent(Intent.ACTION_MAIN)
+ .addCategory(Intent.CATEGORY_HOME));
+ }})
+ .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ // Do nothing.
+ }
+ })
+ .show();
+ break;
+
default:
return false;
}
@@ -3130,6 +3214,13 @@ public class Controller
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_MENU && event.getRepeatCount() == 0) {
+ // Hardware menu key
+ mAppMenuHandler.showAppMenu(mActivity.findViewById(R.id.more_browser_settings),
+ true, false);
+ return true;
+ }
+
boolean noModifiers = event.hasNoModifiers();
// Even if MENU is already held down, we need to call to super to open
// the IME on long press.
@@ -3359,4 +3450,13 @@ public class Controller
return mBlockEvents;
}
+ @Override
+ public boolean shouldShowAppMenu() {
+ return true;
+ }
+
+ @Override
+ public int getMenuThemeResourceId() {
+ return R.style.OverflowMenuTheme;
+ }
}
diff --git a/src/com/android/browser/NavScreen.java b/src/com/android/browser/NavScreen.java
index b11cc4a0..64243e32 100644
--- a/src/com/android/browser/NavScreen.java
+++ b/src/com/android/browser/NavScreen.java
@@ -80,12 +80,13 @@ public class NavScreen extends RelativeLayout
}
protected void showMenu() {
- PopupMenu popup = new PopupMenu(getContext(), mMore);
- Menu menu = popup.getMenu();
- popup.getMenuInflater().inflate(R.menu.browser, menu);
- mUiController.updateMenuState(mUiController.getCurrentTab(), menu);
- popup.setOnMenuItemClickListener(this);
- popup.show();
+ if (mUiController instanceof Controller) {
+ PopupMenu popup = new PopupMenu(getContext(), mMore);
+ Menu menu = popup.getMenu();
+
+ Controller controller = (Controller) mUiController;
+ controller.onPrepareOptionsMenu(menu);
+ }
}
@Override
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index 076e4ada..fe5ca281 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -192,7 +192,6 @@ public class NavigationBarPhone extends NavigationBarBase implements
Menu menu = mPopupMenu.getMenu();
if (activity.onPrepareOptionsMenu(menu)) {
mOverflowMenuShowing = true;
- mPopupMenu.show();
}
}
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index a2799b39..ca478c20 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -160,42 +160,32 @@ public class PhoneUi extends BaseUi {
return true;
}
+ private void setMenuItemVisibility(Menu menu, int id,
+ boolean visibility) {
+ MenuItem item = menu.findItem(id);
+ if (item != null) {
+ item.setVisible(visibility);
+ }
+ }
+
@Override
public void updateMenuState(Tab tab, Menu menu) {
MenuItem bm = menu.findItem(R.id.bookmarks_menu_id);
if (bm != null) {
bm.setVisible(!showingNavScreen());
}
- MenuItem abm = menu.findItem(R.id.add_bookmark_menu_id);
- if (abm != null) {
- abm.setVisible((tab != null) && !tab.isSnapshot() && !showingNavScreen());
- }
MenuItem info = menu.findItem(R.id.page_info_menu_id);
if (info != null) {
info.setVisible(false);
}
- MenuItem newtab = menu.findItem(R.id.new_tab_menu_id);
- if (newtab != null) {
- newtab.setVisible(false);
- }
- MenuItem incognito = menu.findItem(R.id.incognito_menu_id);
- if (incognito != null) {
- incognito.setVisible(showingNavScreen());
- }
- MenuItem closeOthers = menu.findItem(R.id.close_other_tabs_id);
- if (closeOthers != null) {
- boolean isLastTab = true;
- if (tab != null) {
- isLastTab = (mTabControl.getTabCount() <= 1);
- }
- closeOthers.setEnabled(!isLastTab);
- }
+
if (showingNavScreen()) {
+ setMenuItemVisibility(menu, R.id.history_menu_id, false);
+ setMenuItemVisibility(menu, R.id.find_menu_id, false);
menu.setGroupVisible(R.id.LIVE_MENU, false);
- menu.setGroupVisible(R.id.OFFLINE_READING, false);
+ setMenuItemVisibility(menu, R.id.save_snapshot_menu_id, false);
menu.setGroupVisible(R.id.SNAPSHOT_MENU, false);
menu.setGroupVisible(R.id.NAV_MENU, false);
- menu.setGroupVisible(R.id.COMBO_MENU, true);
}
}
diff --git a/src/com/android/browser/appmenu/AppMenu.java b/src/com/android/browser/appmenu/AppMenu.java
index 3f3ac689..a0ff7107 100644
--- a/src/com/android/browser/appmenu/AppMenu.java
+++ b/src/com/android/browser/appmenu/AppMenu.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.chrome.browser.appmenu;
+package com.android.browser.appmenu;
import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -26,7 +26,7 @@ import android.widget.PopupWindow;
import android.widget.PopupWindow.OnDismissListener;
import org.chromium.base.SysUtils;
-import org.chromium.chrome.R;
+import com.android.browser.R;
import java.util.ArrayList;
import java.util.List;
@@ -112,13 +112,7 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
// drawable here even though our style says @null we should use this padding instead...
Drawable originalBgDrawable = mPopup.getBackground();
- // Need to explicitly set the background here. Relying on it being set in the style caused
- // an incorrectly drawn background.
- if (isByHardwareButton) {
- mPopup.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.menu_bg));
- } else {
- mPopup.setBackgroundDrawable(
- context.getResources().getDrawable(R.drawable.edge_menu_bg));
+ if (!isByHardwareButton) {
mPopup.setAnimationStyle(R.style.OverflowMenuAnim);
}
@@ -189,6 +183,30 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
}
}
+ public void invalidate(Context context, Menu menu) {
+ assert(mMenu == menu);
+ // Extract visible items from the Menu.
+ int numItems = mMenu.size();
+ List<MenuItem> menuItems = new ArrayList<MenuItem>();
+ for (int i = 0; i < numItems; ++i) {
+ MenuItem item = mMenu.getItem(i);
+ if (item.isVisible()) {
+ menuItems.add(item);
+ }
+ }
+
+ boolean showMenuButton = !mIsByHardwareButton;
+ if (!SHOW_SW_MENU_BUTTON) showMenuButton = false;
+
+ mAdapter = new AppMenuAdapter(
+ this, menuItems, LayoutInflater.from(context), showMenuButton);
+ mPopup.setAdapter(mAdapter);
+
+ mPopup.show();
+ mPopup.getListView().setItemsCanFocus(true);
+ mPopup.getListView().setOnKeyListener(this);
+ }
+
private void setPopupOffset(
ListPopupWindow popup, int screenRotation, Rect appRect, Rect padding) {
int[] anchorLocation = new int[2];
@@ -202,10 +220,10 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
switch (screenRotation) {
case Surface.ROTATION_0:
case Surface.ROTATION_180:
- horizontalOffset += (appRect.width() - mPopup.getWidth()) / 2;
+ horizontalOffset += (appRect.width() - popup.getWidth()) / 2;
break;
case Surface.ROTATION_90:
- horizontalOffset += appRect.width() - mPopup.getWidth();
+ horizontalOffset += appRect.width() - popup.getWidth();
break;
case Surface.ROTATION_270:
break;
@@ -216,7 +234,8 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
popup.setHorizontalOffset(horizontalOffset);
// The menu is displayed above the anchored view, so shift the menu up by the bottom
// padding of the background.
- popup.setVerticalOffset(-padding.bottom);
+ int verticalOffset = appRect.height() - popup.getHeight() + padding.bottom;
+ popup.setVerticalOffset(verticalOffset);
} else {
// The menu is displayed over and below the anchored view, so shift the menu up by the
// height of the anchor view.
@@ -321,7 +340,8 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
padding.top + padding.bottom);
}
} else {
- mPopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
+ mPopup.setHeight(numMenuItems * (mItemRowHeight + mItemDividerHeight) +
+ padding.top + padding.bottom);
}
}
diff --git a/src/com/android/browser/appmenu/AppMenuAdapter.java b/src/com/android/browser/appmenu/AppMenuAdapter.java
index 2b60292c..6a8cdb4c 100644
--- a/src/com/android/browser/appmenu/AppMenuAdapter.java
+++ b/src/com/android/browser/appmenu/AppMenuAdapter.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.chrome.browser.appmenu;
+package com.android.browser.appmenu;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -15,6 +15,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
+import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
@@ -22,7 +23,7 @@ import android.widget.ListView;
import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
-import org.chromium.chrome.R;
+import com.android.browser.R;
import org.chromium.ui.base.LocalizationUtils;
import org.chromium.ui.interpolators.BakedBezierInterpolator;
@@ -32,7 +33,7 @@ import java.util.List;
* ListAdapter to customize the view of items in the list.
*/
class AppMenuAdapter extends BaseAdapter {
- private static final int VIEW_TYPE_COUNT = 5;
+ private static final int VIEW_TYPE_COUNT = 9;
/**
* Regular Android menu item that contains a title and an icon if icon is specified.
@@ -44,18 +45,34 @@ class AppMenuAdapter extends BaseAdapter {
*/
private static final int TITLE_BUTTON_MENU_ITEM = 1;
/**
+ * Menu item that has one button plus menu button. Every one of these buttons is displayed as an icon.
+ */
+ private static final int ONE_BUTTON_PLUS_MENU_ITEM = 2;
+ /**
+ * Menu item that has two buttons. Every one of these buttons is displayed as an icon.
+ */
+ private static final int TWO_BUTTON_MENU_ITEM = 3;
+ /**
+ * Menu item that has two buttons plus menu. Every one of these buttons is displayed as an icon.
+ */
+ private static final int TWO_BUTTON_PLUS_MENU_ITEM = 4;
+ /**
* Menu item that has three buttons. Every one of these buttons is displayed as an icon.
*/
- private static final int THREE_BUTTON_MENU_ITEM = 2;
+ private static final int THREE_BUTTON_MENU_ITEM = 5;
+ /**
+ * Menu item that has three buttons plus menu. Every one of these buttons is displayed as an icon.
+ */
+ private static final int THREE_BUTTON_PLUS_MENU_ITEM = 6;
/**
* Menu item that has four buttons. Every one of these buttons is displayed as an icon.
*/
- private static final int FOUR_BUTTON_MENU_ITEM = 3;
+ private static final int FOUR_BUTTON_MENU_ITEM = 7;
/**
* Menu item that has two buttons, the first one is a title and the second is a menu icon.
* This is similar to {@link #TITLE_BUTTON_MENU_ITEM} but has some slight layout differences.
*/
- private static final int MENU_BUTTON_MENU_ITEM = 4;
+ private static final int MENU_BUTTON_MENU_ITEM = 8;
/** MenuItem Animation Constants */
private static final int ENTER_ITEM_DURATION_MS = 350;
@@ -100,14 +117,21 @@ class AppMenuAdapter extends BaseAdapter {
MenuItem item = getItem(position);
boolean hasMenuButton = mShowMenuButton && position == 0;
int viewCount = item.hasSubMenu() ? item.getSubMenu().size() : 1;
- if (hasMenuButton) viewCount++;
if (viewCount == 4) {
return FOUR_BUTTON_MENU_ITEM;
} else if (viewCount == 3) {
+ if (hasMenuButton) {
+ return THREE_BUTTON_PLUS_MENU_ITEM;
+ }
return THREE_BUTTON_MENU_ITEM;
} else if (viewCount == 2) {
- return hasMenuButton ? MENU_BUTTON_MENU_ITEM : TITLE_BUTTON_MENU_ITEM;
+ if (hasMenuButton) {
+ return TWO_BUTTON_PLUS_MENU_ITEM;
+ }
+ return TWO_BUTTON_MENU_ITEM;
+ } else if (hasMenuButton) {
+ return ONE_BUTTON_PLUS_MENU_ITEM;
}
return STANDARD_MENU_ITEM;
}
@@ -137,6 +161,7 @@ class AppMenuAdapter extends BaseAdapter {
convertView = mInflater.inflate(R.layout.menu_item, parent, false);
holder.text = (TextView) convertView.findViewById(R.id.menu_item_text);
holder.image = (AppMenuItemIcon) convertView.findViewById(R.id.menu_item_icon);
+ holder.checkbox = (CheckBox) convertView.findViewById(R.id.menu_item_checkbox);
convertView.setTag(holder);
convertView.setTag(R.id.menu_item_enter_anim_id,
buildStandardItemEnterAnimator(convertView, position));
@@ -154,7 +179,15 @@ class AppMenuAdapter extends BaseAdapter {
Drawable icon = item.getIcon();
holder.image.setImageDrawable(icon);
holder.image.setVisibility(icon == null ? View.GONE : View.VISIBLE);
- holder.image.setChecked(item.isChecked());
+
+ holder.checkbox.setVisibility(item.isCheckable() ? View.VISIBLE : View.GONE);
+ holder.checkbox.setChecked(item.isChecked());
+ holder.checkbox.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mAppMenu.onItemClick(item);
+ }
+ });
holder.text.setText(item.getTitle());
boolean isEnabled = item.isEnabled();
@@ -164,6 +197,65 @@ class AppMenuAdapter extends BaseAdapter {
convertView.setEnabled(isEnabled);
break;
}
+ case ONE_BUTTON_PLUS_MENU_ITEM: {
+ TwoButtonMenuItemViewHolder holder = null;
+ if (convertView == null) {
+ holder = new TwoButtonMenuItemViewHolder();
+ convertView = mInflater.inflate(R.layout.one_button_plus_menu_item, parent, false);
+ holder.buttons[0] = (ImageButton) convertView.findViewById(R.id.button_one);
+ holder.buttons[1] = (ImageButton) convertView.findViewById(R.id.button_two);
+ convertView.setTag(holder);
+ convertView.setTag(R.id.menu_item_enter_anim_id,
+ buildIconItemEnterAnimator(holder.buttons, hasMenuButton));
+ } else {
+ holder = (TwoButtonMenuItemViewHolder) convertView.getTag();
+ }
+ setupImageButton(holder.buttons[0], item.getSubMenu().getItem(0));
+ setupMenuButton(holder.buttons[1]);
+ convertView.setFocusable(false);
+ convertView.setEnabled(false);
+ break;
+ }
+ case TWO_BUTTON_MENU_ITEM: {
+ TwoButtonMenuItemViewHolder holder = null;
+ if (convertView == null) {
+ holder = new TwoButtonMenuItemViewHolder();
+ convertView = mInflater.inflate(R.layout.two_button_menu_item, parent, false);
+ holder.buttons[0] = (ImageButton) convertView.findViewById(R.id.button_one);
+ holder.buttons[1] = (ImageButton) convertView.findViewById(R.id.button_two);
+ convertView.setTag(holder);
+ convertView.setTag(R.id.menu_item_enter_anim_id,
+ buildIconItemEnterAnimator(holder.buttons, hasMenuButton));
+ } else {
+ holder = (TwoButtonMenuItemViewHolder) convertView.getTag();
+ }
+ setupImageButton(holder.buttons[0], item.getSubMenu().getItem(0));
+ setupImageButton(holder.buttons[1], item.getSubMenu().getItem(1));
+ convertView.setFocusable(false);
+ convertView.setEnabled(false);
+ break;
+ }
+ case TWO_BUTTON_PLUS_MENU_ITEM: {
+ ThreeButtonMenuItemViewHolder holder = null;
+ if (convertView == null) {
+ holder = new ThreeButtonMenuItemViewHolder();
+ convertView = mInflater.inflate(R.layout.two_button_plus_menu_item, parent, false);
+ holder.buttons[0] = (ImageButton) convertView.findViewById(R.id.button_one);
+ holder.buttons[1] = (ImageButton) convertView.findViewById(R.id.button_two);
+ holder.buttons[2] = (ImageButton) convertView.findViewById(R.id.button_three);
+ convertView.setTag(holder);
+ convertView.setTag(R.id.menu_item_enter_anim_id,
+ buildIconItemEnterAnimator(holder.buttons, hasMenuButton));
+ } else {
+ holder = (ThreeButtonMenuItemViewHolder) convertView.getTag();
+ }
+ setupImageButton(holder.buttons[0], item.getSubMenu().getItem(0));
+ setupImageButton(holder.buttons[1], item.getSubMenu().getItem(1));
+ setupMenuButton(holder.buttons[2]);
+ convertView.setFocusable(false);
+ convertView.setEnabled(false);
+ break;
+ }
case THREE_BUTTON_MENU_ITEM: {
ThreeButtonMenuItemViewHolder holder = null;
if (convertView == null) {
@@ -180,12 +272,31 @@ class AppMenuAdapter extends BaseAdapter {
}
setupImageButton(holder.buttons[0], item.getSubMenu().getItem(0));
setupImageButton(holder.buttons[1], item.getSubMenu().getItem(1));
- if (hasMenuButton) {
- setupMenuButton(holder.buttons[3]);
+ setupImageButton(holder.buttons[2], item.getSubMenu().getItem(2));
+ convertView.setFocusable(false);
+ convertView.setEnabled(false);
+ break;
+ }
+ case THREE_BUTTON_PLUS_MENU_ITEM: {
+ FourButtonMenuItemViewHolder holder = null;
+ if (convertView == null) {
+ holder = new FourButtonMenuItemViewHolder();
+ convertView = mInflater.inflate(R.layout.three_button_plus_menu_item, parent, false);
+ holder.buttons[0] = (ImageButton) convertView.findViewById(R.id.button_one);
+ holder.buttons[1] = (ImageButton) convertView.findViewById(R.id.button_two);
+ holder.buttons[2] = (ImageButton) convertView.findViewById(R.id.button_three);
+ holder.buttons[3] = (ImageButton) convertView.findViewById(R.id.button_four);
+ convertView.setTag(holder);
+ convertView.setTag(R.id.menu_item_enter_anim_id,
+ buildIconItemEnterAnimator(holder.buttons, hasMenuButton));
} else {
- setupImageButton(holder.buttons[2], item.getSubMenu().getItem(2));
+ holder = (FourButtonMenuItemViewHolder) convertView.getTag();
}
+ setupImageButton(holder.buttons[0], item.getSubMenu().getItem(0));
+ setupImageButton(holder.buttons[1], item.getSubMenu().getItem(1));
+ setupImageButton(holder.buttons[2], item.getSubMenu().getItem(2));
+ setupMenuButton(holder.buttons[3]);
convertView.setFocusable(false);
convertView.setEnabled(false);
break;
@@ -208,11 +319,7 @@ class AppMenuAdapter extends BaseAdapter {
setupImageButton(holder.buttons[0], item.getSubMenu().getItem(0));
setupImageButton(holder.buttons[1], item.getSubMenu().getItem(1));
setupImageButton(holder.buttons[2], item.getSubMenu().getItem(2));
- if (hasMenuButton) {
- setupMenuButton(holder.buttons[3]);
- } else {
- setupImageButton(holder.buttons[3], item.getSubMenu().getItem(3));
- }
+ setupImageButton(holder.buttons[3], item.getSubMenu().getItem(3));
convertView.setFocusable(false);
convertView.setEnabled(false);
break;
@@ -274,6 +381,7 @@ class AppMenuAdapter extends BaseAdapter {
button.setContentDescription(item.getTitle());
button.setEnabled(item.isEnabled());
button.setFocusable(item.isEnabled());
+ button.setSelected(item.isChecked());
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -283,8 +391,7 @@ class AppMenuAdapter extends BaseAdapter {
}
private void setupMenuButton(ImageButton button) {
- button.setImageResource(R.drawable.btn_menu_pressed);
- button.setContentDescription(button.getResources().getString(R.string.menu_dismiss_btn));
+ button.setImageResource(R.drawable.ic_menu_overflow);
button.setEnabled(true);
button.setFocusable(true);
button.setOnClickListener(new OnClickListener() {
@@ -294,10 +401,6 @@ class AppMenuAdapter extends BaseAdapter {
}
});
- // Set the button layout to make it properly line up with any underlying menu button
- ApiCompatibilityUtils.setPaddingRelative(
- button, (int) (MENU_BUTTON_START_PADDING_DP * mDpToPx), 0, 0, 0);
- button.getLayoutParams().width = (int) (MENU_BUTTON_WIDTH_DP * mDpToPx);
button.setScaleType(ScaleType.CENTER);
}
@@ -339,7 +442,7 @@ class AppMenuAdapter extends BaseAdapter {
* @return The {@link Animator}.
*/
private Animator buildIconItemEnterAnimator(final ImageView[] views, boolean skipLastItem) {
- final boolean rtl = LocalizationUtils.isLayoutRtl();
+ final boolean rtl = false; //LocalizationUtils.isLayoutRtl();
final float offsetXPx = ENTER_STANDARD_ITEM_OFFSET_X_DP * mDpToPx * (rtl ? -1.f : 1.f);
final int maxViewsToAnimate = views.length - (skipLastItem ? 1 : 0);
@@ -379,6 +482,11 @@ class AppMenuAdapter extends BaseAdapter {
static class StandardMenuItemViewHolder {
public TextView text;
public AppMenuItemIcon image;
+ public CheckBox checkbox;
+ }
+
+ static class TwoButtonMenuItemViewHolder {
+ public ImageButton[] buttons = new ImageButton[2];
}
static class ThreeButtonMenuItemViewHolder {
diff --git a/src/com/android/browser/appmenu/AppMenuButtonHelper.java b/src/com/android/browser/appmenu/AppMenuButtonHelper.java
index a63e2a51..364183a9 100644
--- a/src/com/android/browser/appmenu/AppMenuButtonHelper.java
+++ b/src/com/android/browser/appmenu/AppMenuButtonHelper.java
@@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.chrome.browser.appmenu;
+package com.android.browser.appmenu;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
-import org.chromium.chrome.browser.UmaBridge;
-
/**
* A helper class for a menu button to decide when to show the app menu and forward touch
* events.
@@ -46,10 +44,6 @@ public class AppMenuButtonHelper implements OnTouchListener {
private boolean showAppMenu(boolean startDragging) {
if (!mMenuHandler.isAppMenuShowing() &&
mMenuHandler.showAppMenu(mMenuButton, false, startDragging)) {
- // Initial start dragging can be canceled in case if it was just single tap.
- // So we only record non-dragging here, and will deal with those dragging cases in
- // AppMenuDragHelper class.
- if (!startDragging) UmaBridge.usingMenu(false, false);
if (mOnAppMenuShownListener != null) {
mOnAppMenuShownListener.run();
@@ -94,13 +88,6 @@ public class AppMenuButtonHelper implements OnTouchListener {
default:
}
- // If user starts to drag on this menu button, ACTION_DOWN and all the subsequent touch
- // events are received here. We need to forward this event to the app menu to handle
- // dragging correctly.
- AppMenuDragHelper dragHelper = mMenuHandler.getAppMenuDragHelper();
- if (dragHelper != null) {
- isTouchEventConsumed |= dragHelper.handleDragging(event);
- }
return isTouchEventConsumed;
}
} \ No newline at end of file
diff --git a/src/com/android/browser/appmenu/AppMenuDragHelper.java b/src/com/android/browser/appmenu/AppMenuDragHelper.java
index 44e642af..ee2a8c75 100644
--- a/src/com/android/browser/appmenu/AppMenuDragHelper.java
+++ b/src/com/android/browser/appmenu/AppMenuDragHelper.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.chrome.browser.appmenu;
+package com.android.browser.appmenu;
import android.animation.TimeAnimator;
import android.annotation.SuppressLint;
@@ -18,8 +18,7 @@ import android.widget.LinearLayout;
import android.widget.ListPopupWindow;
import android.widget.ListView;
-import org.chromium.chrome.R;
-import org.chromium.chrome.browser.UmaBridge;
+import com.android.browser.R;
import java.util.ArrayList;
@@ -158,7 +157,6 @@ class AppMenuDragHelper {
if (!mIsSingleTapUpHappened) {
mGestureSingleTapDetector.onTouchEvent(event);
if (mIsSingleTapUpHappened) {
- UmaBridge.usingMenu(false, false);
finishDragging();
}
}
@@ -182,7 +180,6 @@ class AppMenuDragHelper {
didPerformClick = menuItemAction(roundedRawX, roundedRawY, itemAction);
if (eventActionMasked == MotionEvent.ACTION_UP && !didPerformClick) {
- UmaBridge.usingMenu(false, true);
mAppMenu.dismiss();
} else if (eventActionMasked == MotionEvent.ACTION_MOVE) {
// Auto scrolling on the top or the bottom of the listView.
@@ -245,7 +242,6 @@ class AppMenuDragHelper {
break;
case ITEM_ACTION_PERFORM:
if (shouldPerform) {
- UmaBridge.usingMenu(false, true);
itemView.performClick();
didPerformClick = true;
}
diff --git a/src/com/android/browser/appmenu/AppMenuHandler.java b/src/com/android/browser/appmenu/AppMenuHandler.java
index 4e2c465f..94a429a7 100644
--- a/src/com/android/browser/appmenu/AppMenuHandler.java
+++ b/src/com/android/browser/appmenu/AppMenuHandler.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.chrome.browser.appmenu;
+package com.android.browser.appmenu;
import android.app.Activity;
import android.content.res.TypedArray;
@@ -17,8 +17,6 @@ import android.widget.PopupMenu;
import com.google.common.annotations.VisibleForTesting;
-import org.chromium.chrome.browser.UmaBridge;
-
import java.util.ArrayList;
/**
@@ -34,6 +32,7 @@ public class AppMenuHandler {
private final AppMenuPropertiesDelegate mDelegate;
private final Activity mActivity;
+ private boolean mInvalidateInProgress = false;
/**
* Constructs an AppMenuHandler object.
@@ -107,13 +106,27 @@ public class AppMenuHandler {
Point pt = new Point();
mActivity.getWindowManager().getDefaultDisplay().getSize(pt);
mAppMenu.show(wrapper, anchorView, isByHardwareButton, rotation, appRect, pt.y);
- mAppMenuDragHelper.onShow(startDragging);
- UmaBridge.menuShow();
return true;
}
+ public void invalidateAppMenu() {
+ if (!isAppMenuShowing()) return;
+ if (mInvalidateInProgress) return;
+
+ mInvalidateInProgress = true;
+
+ assert(mMenu != null);
+ assert(mAppMenu != null);
+ mDelegate.prepareMenu(mMenu);
+
+ ContextThemeWrapper wrapper = new ContextThemeWrapper(mActivity,
+ mDelegate.getMenuThemeResourceId());
+
+ mAppMenu.invalidate(wrapper, mMenu);
+ mInvalidateInProgress = false;
+ }
+
void appMenuDismissed() {
- mAppMenuDragHelper.finishDragging();
}
/**
@@ -132,7 +145,7 @@ public class AppMenuHandler {
}
AppMenuDragHelper getAppMenuDragHelper() {
- return mAppMenuDragHelper;
+ return null;
}
/**
diff --git a/src/com/android/browser/appmenu/AppMenuItemIcon.java b/src/com/android/browser/appmenu/AppMenuItemIcon.java
index eddcc0da..ceecf10b 100644
--- a/src/com/android/browser/appmenu/AppMenuItemIcon.java
+++ b/src/com/android/browser/appmenu/AppMenuItemIcon.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.chrome.browser.appmenu;
+package com.android.browser.appmenu;
import android.content.Context;
import android.util.AttributeSet;
diff --git a/src/com/android/browser/appmenu/AppMenuObserver.java b/src/com/android/browser/appmenu/AppMenuObserver.java
index c133bc38..febca8ff 100644
--- a/src/com/android/browser/appmenu/AppMenuObserver.java
+++ b/src/com/android/browser/appmenu/AppMenuObserver.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.chrome.browser.appmenu;
+package com.android.browser.appmenu;
/**
* Allows monitoring of application menu actions.
diff --git a/src/com/android/browser/appmenu/AppMenuPropertiesDelegate.java b/src/com/android/browser/appmenu/AppMenuPropertiesDelegate.java
index 00dcdfcc..e094a826 100644
--- a/src/com/android/browser/appmenu/AppMenuPropertiesDelegate.java
+++ b/src/com/android/browser/appmenu/AppMenuPropertiesDelegate.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.chrome.browser.appmenu;
+package com.android.browser.appmenu;
import android.view.Menu;
diff --git a/src/com/android/browser/stub/NullController.java b/src/com/android/browser/stub/NullController.java
index 149fe4ef..1df77db3 100644
--- a/src/com/android/browser/stub/NullController.java
+++ b/src/com/android/browser/stub/NullController.java
@@ -149,4 +149,6 @@ public class NullController implements ActivityController {
return false;
}
+ public void invalidateOptionsMenu() {}
+
}