Implement ComboView for Bookmarks, History and SavedPages
- Replaces ComboViewActivity for PhoneUi.
- Lives as part of the BrowserActivity's ViewTree.
- Avoids construction of ComboViewActivity everytime the bookmarks screen is opened.
Change-Id: Ic7042de731a4cc2107a297c9f7d4356bc2c30f2e
diff --git a/res/anim/combo_view_enter.xml b/res/anim/combo_view_enter.xml
new file mode 100644
index 0000000..b0e2369
--- /dev/null
+++ b/res/anim/combo_view_enter.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (c) 2015, 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.
+ *
+ -->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:interpolator="@android:anim/decelerate_interpolator">
+ <translate android:fromYDelta="25%" android:toYDelta="0"
+ android:duration="@android:integer/config_shortAnimTime"/>
+ <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_shortAnimTime" />
+</set>
diff --git a/res/anim/combo_view_exit.xml b/res/anim/combo_view_exit.xml
new file mode 100644
index 0000000..22dd129
--- /dev/null
+++ b/res/anim/combo_view_exit.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (c) 2015, 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.
+ *
+ -->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:interpolator="@android:anim/accelerate_interpolator">
+ <translate android:fromYDelta="0" android:toYDelta="50%"
+ android:duration="@android:integer/config_shortAnimTime"/>
+ <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:duration="@android:integer/config_shortAnimTime" />
+</set>
diff --git a/res/layout/combo_view.xml b/res/layout/combo_view.xml
new file mode 100644
index 0000000..81e08c9
--- /dev/null
+++ b/res/layout/combo_view.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (c) 2015, 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.
+ *
+ */
+-->
+
+<com.android.browser.ComboView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/white"
+ android:orientation="vertical">
+
+ <android.support.v4.view.ViewPager
+ android:id="@+id/combo_view_pager"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+
+</com.android.browser.ComboView>
diff --git a/res/layout/custom_screen.xml b/res/layout/custom_screen.xml
index df5c0f7..acc63a4 100644
--- a/res/layout/custom_screen.xml
+++ b/res/layout/custom_screen.xml
@@ -25,5 +25,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
+ <ViewStub
+ android:id="@+id/combo_view_stub"
+ android:layout="@layout/combo_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
</merge>
diff --git a/res/layout/nav_tab_view.xml b/res/layout/nav_tab_view.xml
index c2f8f1a..1fde789 100644
--- a/res/layout/nav_tab_view.xml
+++ b/res/layout/nav_tab_view.xml
@@ -54,7 +54,7 @@
<!-- Preview Image -->
<ImageView
- android:id="@+id/tab_view"
+ android:id="@+id/tab_preview"
android:layout_width="@dimen/nav_tab_width"
android:layout_height="@dimen/nav_tab_height"
android:paddingStart="2dip"
diff --git a/res/layout/tab.xml b/res/layout/tab.xml
index 69baf56..8bf3327 100755
--- a/res/layout/tab.xml
+++ b/res/layout/tab.xml
@@ -21,7 +21,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
- android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
diff --git a/res/values-sw600dp-v17/styles.xml b/res/values-sw600dp-v17/styles.xml
index bcfb749..84b17b5 100644
--- a/res/values-sw600dp-v17/styles.xml
+++ b/res/values-sw600dp-v17/styles.xml
@@ -21,7 +21,7 @@
<item name="android:windowActionBar">true</item>
<item name="android:windowNoTitle">false</item>
<!--<item name="android:windowActionModeOverlay">true</item>-->
- <item name="android:actionBarStyle">@style/ActionBarStyle</item>
+ <item name="android:actionBarStyle">@style/LightActionBarStyle</item>
<item name="android:actionBarSize">56dip</item>
</style>
diff --git a/res/values-v17/styles.xml b/res/values-v17/styles.xml
index 61be170..899a15b 100644
--- a/res/values-v17/styles.xml
+++ b/res/values-v17/styles.xml
@@ -44,11 +44,12 @@
<style name="BrowserTheme" parent="@style/BrowserBase">
<item name="android:windowBackground">@color/browser_window_background</item>
-
- <item name="android:windowActionBar">false</item>
- <item name="android:windowNoTitle">true</item>
+ <item name="android:windowActionBar">true</item>
+ <item name="android:windowActionBarOverlay">true</item>
+ <item name="android:windowNoTitle">false</item>
+ <item name="android:actionBarStyle">@style/LightActionBarStyle</item>
+ <item name="android:actionBarTabBarStyle">@style/LightActionBarTabBarStyle</item>
<item name="android:windowActionModeOverlay">true</item>
- <item name="android:actionBarStyle">@style/ActionBarStyle</item>
<item name="android:actionBarSize">56dip</item>
<item name="android:popupMenuStyle">@style/PopupMenuStyle</item>
</style>
@@ -75,15 +76,15 @@
<style name="SettingsTheme" parent="@style/BrowserBase">
</style>
- <style name="ComboViewActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
+ <style name="LightActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@color/comboViewActionBarColor</item>
</style>
- <style name="ComboViewActionBarTabBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.TabBar">
+ <style name="LightActionBarTabBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.TabBar">
<item name="android:background">@color/comboViewActionBarColor</item>
</style>
<style name="ComboViewTheme" parent="@style/BrowserBase">
- <item name="android:actionBarStyle">@style/ComboViewActionBarStyle</item>
- <item name="android:actionBarTabBarStyle">@style/ComboViewActionBarTabBarStyle</item>
+ <item name="android:actionBarStyle">@style/LightActionBarStyle</item>
+ <item name="android:actionBarTabBarStyle">@style/LightActionBarTabBarStyle</item>
</style>
<style name="NavButton">
diff --git a/res/values/ids.xml b/res/values/ids.xml
index dfe4b3f..3cca4a0 100644
--- a/res/values/ids.xml
+++ b/res/values/ids.xml
@@ -23,4 +23,5 @@
<item type="id" name="position" />
<item type="id" name="load_object" />
<item type="id" name="menu_item_enter_anim_id" />
+ <item type="id" name="combo_view_container" />
</resources>