Copy AppMenu framework from Chrome
- copied AppMenu framework files from
org.chromium.chrom.browser.appmenu
commit-id: fdb3ea17e8436e028e320b1a752249d36423483d
Change-Id: I01e9106cd4107fadee6951c13b7e6ac2329d98e4
diff --git a/res/anim/menu_enter.xml b/res/anim/menu_enter.xml
new file mode 100644
index 0000000..e6c4936
--- /dev/null
+++ b/res/anim/menu_enter.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false">
+ <scale android:interpolator="@interpolator/transform_curve_interpolator"
+ android:fromXScale="0"
+ android:toXScale="1"
+ android:fromYScale="0"
+ android:toYScale="1"
+ android:pivotX="@fraction/menu_animation_pivot_x"
+ android:pivotY="5%"
+ android:duration="200" />
+ <alpha android:interpolator="@android:anim/linear_interpolator"
+ android:fromAlpha="0" android:toAlpha="1"
+ android:duration="200" />
+ <translate android:interpolator="@interpolator/transform_curve_interpolator"
+ android:fromYDelta="@dimen/menu_negative_software_vertical_offset"
+ android:toYDelta="0"
+ android:duration="200" />
+</set>
\ No newline at end of file
diff --git a/res/anim/menu_exit.xml b/res/anim/menu_exit.xml
new file mode 100644
index 0000000..5a2a93d
--- /dev/null
+++ b/res/anim/menu_exit.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false">
+ <scale android:interpolator="@interpolator/fade_out_curve_interpolator"
+ android:fromXScale="1"
+ android:toXScale="0.5"
+ android:fromYScale="1"
+ android:toYScale="0.5"
+ android:pivotX="@fraction/menu_animation_pivot_x"
+ android:pivotY="5%"
+ android:duration="150" />
+ <alpha android:interpolator="@interpolator/fade_out_curve_interpolator"
+ android:fromAlpha="1"
+ android:toAlpha="0"
+ android:duration="150" />
+</set>
\ No newline at end of file
diff --git a/res/interpolator/fade_out_curve_interpolator.xml b/res/interpolator/fade_out_curve_interpolator.xml
new file mode 100644
index 0000000..36cda25
--- /dev/null
+++ b/res/interpolator/fade_out_curve_interpolator.xml
@@ -0,0 +1,7 @@
+<?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.
+-->
+
+<decelerateInterpolator xmlns:android="http://schemas.android.com/apk/res/android" />
diff --git a/res/interpolator/transform_curve_interpolator.xml b/res/interpolator/transform_curve_interpolator.xml
new file mode 100644
index 0000000..a0da2ea
--- /dev/null
+++ b/res/interpolator/transform_curve_interpolator.xml
@@ -0,0 +1,7 @@
+<?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.
+-->
+
+<accelerateDecelerateInterpolator xmlns:android="http://schemas.android.com/apk/res/android" />
diff --git a/res/layout/four_button_menu_item.xml b/res/layout/four_button_menu_item.xml
new file mode 100644
index 0000000..f1b2fd6
--- /dev/null
+++ b/res/layout/four_button_menu_item.xml
@@ -0,0 +1,46 @@
+<?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="59dp"
+ android:layout_height="match_parent"
+ android:paddingEnd="11dp"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center" />
+
+ <ImageButton
+ android:id="@+id/button_two"
+ android:layout_width="70dp"
+ android:layout_height="match_parent"
+ android:paddingStart="11dp"
+ android:paddingEnd="11dp"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center" />
+
+ <ImageButton
+ android:id="@+id/button_three"
+ android:layout_width="70dp"
+ android:layout_height="match_parent"
+ android:paddingStart="11dp"
+ android:paddingEnd="11dp"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center" />
+
+ <ImageButton
+ android:id="@+id/button_four"
+ android:layout_width="59dp"
+ android:layout_height="match_parent"
+ android:paddingStart="11dp"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center" />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/menu_item.xml b/res/layout/menu_item.xml
new file mode 100644
index 0000000..66bbb82
--- /dev/null
+++ b/res/layout/menu_item.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2011 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.
+-->
+<!-- Layout for each item in the menu popup -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:background="?android:attr/listChoiceBackgroundIndicator">
+ <TextView
+ android:id="@+id/menu_item_text"
+ android:textAppearance="?android:attr/textAppearanceLargePopupMenu"
+ 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" />
+ <view
+ class="org.chromium.chrome.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" />
+</LinearLayout>
diff --git a/res/layout/three_button_menu_item.xml b/res/layout/three_button_menu_item.xml
new file mode 100644
index 0000000..5fb2d78
--- /dev/null
+++ b/res/layout/three_button_menu_item.xml
@@ -0,0 +1,36 @@
+<?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="1"
+ 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="1"
+ 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="1"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:scaleType="center" />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/title_button_menu_item.xml b/res/layout/title_button_menu_item.xml
new file mode 100644
index 0000000..15c3fe3
--- /dev/null
+++ b/res/layout/title_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">
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="start"
+ android:layout_weight="1"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="9dp"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceLargePopupMenu" />
+
+ <ImageButton
+ android:id="@+id/button"
+ android:layout_width="48dp"
+ android:layout_height="match_parent"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:padding="10dp"
+ android:scaleType="fitCenter" />
+
+</LinearLayout>
\ No newline at end of file