summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Vasilinetc <sergeyv@google.com>2016-07-01 20:58:40 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-07-01 20:58:41 +0000
commit1d3a08ba89da78050fbea31709f2ac85a36f9932 (patch)
tree560b0681a07aad3f7d05a969656dd92e6e054503
parentbba727d8ee399673a2900ac5e9463aa31cfae98e (diff)
parentde396b32898807a077a3b5e7667898e56dd3bb4d (diff)
Merge "UiBench: add NavigationDrawerActivity."
-rw-r--r--tests/UiBench/Android.mk3
-rw-r--r--tests/UiBench/AndroidManifest.xml10
-rw-r--r--tests/UiBench/build.gradle3
-rw-r--r--tests/UiBench/res/drawable/ic_menu_camera.xml27
-rw-r--r--tests/UiBench/res/drawable/ic_menu_gallery.xml24
-rw-r--r--tests/UiBench/res/drawable/ic_menu_manage.xml24
-rw-r--r--tests/UiBench/res/drawable/ic_menu_send.xml24
-rw-r--r--tests/UiBench/res/drawable/ic_menu_share.xml24
-rw-r--r--tests/UiBench/res/drawable/ic_menu_slideshow.xml24
-rw-r--r--tests/UiBench/res/drawable/side_nav_bar.xml24
-rw-r--r--tests/UiBench/res/layout/activity_navigation_drawer.xml39
-rw-r--r--tests/UiBench/res/layout/app_bar_navigation_drawer.xml35
-rw-r--r--tests/UiBench/res/layout/nav_header_navigation_drawer.xml47
-rw-r--r--tests/UiBench/res/menu/activity_navigation_drawer_drawer.xml45
-rw-r--r--tests/UiBench/res/values/dimens.xml19
-rw-r--r--tests/UiBench/res/values/strings.xml19
-rw-r--r--tests/UiBench/res/values/styles.xml23
-rw-r--r--tests/UiBench/src/com/android/test/uibench/NavigationDrawerActivity.java53
18 files changed, 466 insertions, 1 deletions
diff --git a/tests/UiBench/Android.mk b/tests/UiBench/Android.mk
index 0e678cde9c70..f65d10986268 100644
--- a/tests/UiBench/Android.mk
+++ b/tests/UiBench/Android.mk
@@ -10,17 +10,20 @@ LOCAL_SRC_FILES := $(call all-java-files-under,src)
# regressions are reflected in test data
LOCAL_RESOURCE_DIR := \
$(LOCAL_PATH)/res \
+ frameworks/support/design/res \
frameworks/support/v7/appcompat/res \
frameworks/support/v7/cardview/res \
frameworks/support/v7/recyclerview/res
LOCAL_AAPT_FLAGS := \
--auto-add-overlay \
+ --extra-packages android.support.design \
--extra-packages android.support.v7.appcompat \
--extra-packages android.support.v7.cardview \
--extra-packages android.support.v7.recyclerview
LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-design \
android-support-v4 \
android-support-v7-appcompat \
android-support-v7-cardview \
diff --git a/tests/UiBench/AndroidManifest.xml b/tests/UiBench/AndroidManifest.xml
index 9c230f51c05c..97b42161d08a 100644
--- a/tests/UiBench/AndroidManifest.xml
+++ b/tests/UiBench/AndroidManifest.xml
@@ -180,5 +180,15 @@
</intent-filter>
</activity>
+ <!-- Navigation Drawer -->
+ <activity
+ android:name=".NavigationDrawerActivity"
+ android:label="Navigation Drawer Activity"
+ android:theme="@style/NoActionBar">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.android.test.uibench.TEST" />
+ </intent-filter>
+ </activity>
</application>
</manifest>
diff --git a/tests/UiBench/build.gradle b/tests/UiBench/build.gradle
index 0b5c20625237..03ef7f106de5 100644
--- a/tests/UiBench/build.gradle
+++ b/tests/UiBench/build.gradle
@@ -14,7 +14,7 @@ android {
buildToolsVersion "23.0.3"
defaultConfig {
- minSdkVersion 14
+ minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
@@ -35,4 +35,5 @@ dependencies {
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
+ compile 'com.android.support:design:23.0.1'
}
diff --git a/tests/UiBench/res/drawable/ic_menu_camera.xml b/tests/UiBench/res/drawable/ic_menu_camera.xml
new file mode 100644
index 000000000000..189ef97c24a7
--- /dev/null
+++ b/tests/UiBench/res/drawable/ic_menu_camera.xml
@@ -0,0 +1,27 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
+</vector>
diff --git a/tests/UiBench/res/drawable/ic_menu_gallery.xml b/tests/UiBench/res/drawable/ic_menu_gallery.xml
new file mode 100644
index 000000000000..d41f2502f1d2
--- /dev/null
+++ b/tests/UiBench/res/drawable/ic_menu_gallery.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z"/>
+</vector>
diff --git a/tests/UiBench/res/drawable/ic_menu_manage.xml b/tests/UiBench/res/drawable/ic_menu_manage.xml
new file mode 100644
index 000000000000..f81e0f91ea17
--- /dev/null
+++ b/tests/UiBench/res/drawable/ic_menu_manage.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9 -2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9 4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1 0.1,-1.4z"/>
+</vector> \ No newline at end of file
diff --git a/tests/UiBench/res/drawable/ic_menu_send.xml b/tests/UiBench/res/drawable/ic_menu_send.xml
new file mode 100644
index 000000000000..0d86c76f7df9
--- /dev/null
+++ b/tests/UiBench/res/drawable/ic_menu_send.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
+</vector>
diff --git a/tests/UiBench/res/drawable/ic_menu_share.xml b/tests/UiBench/res/drawable/ic_menu_share.xml
new file mode 100644
index 000000000000..b3e6ff195119
--- /dev/null
+++ b/tests/UiBench/res/drawable/ic_menu_share.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
+</vector>
diff --git a/tests/UiBench/res/drawable/ic_menu_slideshow.xml b/tests/UiBench/res/drawable/ic_menu_slideshow.xml
new file mode 100644
index 000000000000..d79950b2a99b
--- /dev/null
+++ b/tests/UiBench/res/drawable/ic_menu_slideshow.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M4,6H2v14c0,1.1 0.9,2 2,2h14v-2H4V6zm16,-4H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zm-8,12.5v-9l6,4.5 -6,4.5z"/>
+</vector>
diff --git a/tests/UiBench/res/drawable/side_nav_bar.xml b/tests/UiBench/res/drawable/side_nav_bar.xml
new file mode 100644
index 000000000000..59f4cf3762f5
--- /dev/null
+++ b/tests/UiBench/res/drawable/side_nav_bar.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <gradient
+ android:angle="135"
+ android:centerColor="#4CAF50"
+ android:endColor="#2E7D32"
+ android:startColor="#81C784"
+ android:type="linear"/>
+</shape> \ No newline at end of file
diff --git a/tests/UiBench/res/layout/activity_navigation_drawer.xml b/tests/UiBench/res/layout/activity_navigation_drawer.xml
new file mode 100644
index 000000000000..8d4bfafd8dd8
--- /dev/null
+++ b/tests/UiBench/res/layout/activity_navigation_drawer.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<android.support.v4.widget.DrawerLayout
+ android:id="@+id/drawer_layout"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true">
+
+ <include
+ layout="@layout/app_bar_navigation_drawer"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+
+ <android.support.design.widget.NavigationView
+ android:id="@+id/nav_view"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="start"
+ android:fitsSystemWindows="true"
+ app:headerLayout="@layout/nav_header_navigation_drawer"
+ app:menu="@menu/activity_navigation_drawer_drawer"/>
+
+</android.support.v4.widget.DrawerLayout>
diff --git a/tests/UiBench/res/layout/app_bar_navigation_drawer.xml b/tests/UiBench/res/layout/app_bar_navigation_drawer.xml
new file mode 100644
index 000000000000..ede2a566987b
--- /dev/null
+++ b/tests/UiBench/res/layout/app_bar_navigation_drawer.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<android.support.design.widget.CoordinatorLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true">
+
+ <android.support.design.widget.AppBarLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
+
+ <android.support.v7.widget.Toolbar
+ android:id="@+id/toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ android:background="?attr/colorPrimary"/>
+ </android.support.design.widget.AppBarLayout>
+
+</android.support.design.widget.CoordinatorLayout>
diff --git a/tests/UiBench/res/layout/nav_header_navigation_drawer.xml b/tests/UiBench/res/layout/nav_header_navigation_drawer.xml
new file mode 100644
index 000000000000..789f2912541c
--- /dev/null
+++ b/tests/UiBench/res/layout/nav_header_navigation_drawer.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="160dp"
+ android:background="@drawable/side_nav_bar"
+ android:gravity="bottom"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/default_spacing"
+ android:paddingLeft="@dimen/default_spacing"
+ android:paddingRight="@dimen/default_spacing"
+ android:paddingTop="@dimen/default_spacing"
+ android:theme="@style/ThemeOverlay.AppCompat.Dark">
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/default_spacing"
+ android:src="@android:drawable/sym_def_app_icon"/>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/default_spacing"
+ android:text="UiBench"
+ android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="hwui-team@google.com"/>
+
+</LinearLayout>
diff --git a/tests/UiBench/res/menu/activity_navigation_drawer_drawer.xml b/tests/UiBench/res/menu/activity_navigation_drawer_drawer.xml
new file mode 100644
index 000000000000..9bb785d25cf9
--- /dev/null
+++ b/tests/UiBench/res/menu/activity_navigation_drawer_drawer.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <group android:checkableBehavior="single">
+ <item
+ android:icon="@drawable/ic_menu_camera"
+ android:title="Import"/>
+ <item
+ android:icon="@drawable/ic_menu_gallery"
+ android:title="Gallery"/>
+ <item
+ android:icon="@drawable/ic_menu_slideshow"
+ android:title="Slideshow"/>
+ <item
+ android:icon="@drawable/ic_menu_manage"
+ android:title="Tools"/>
+ </group>
+
+ <item android:title="Communicate">
+ <menu>
+ <item
+ android:icon="@drawable/ic_menu_share"
+ android:title="Share"/>
+ <item
+ android:icon="@drawable/ic_menu_send"
+ android:title="Send"/>
+ </menu>
+ </item>
+
+</menu>
diff --git a/tests/UiBench/res/values/dimens.xml b/tests/UiBench/res/values/dimens.xml
new file mode 100644
index 000000000000..099da77f9eda
--- /dev/null
+++ b/tests/UiBench/res/values/dimens.xml
@@ -0,0 +1,19 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="default_spacing">16dp</dimen>
+</resources>
diff --git a/tests/UiBench/res/values/strings.xml b/tests/UiBench/res/values/strings.xml
new file mode 100644
index 000000000000..e9fdc8aafb71
--- /dev/null
+++ b/tests/UiBench/res/values/strings.xml
@@ -0,0 +1,19 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <string name="navigation_drawer_open">Open navigation drawer</string>
+ <string name="navigation_drawer_close">Close navigation drawer</string>
+</resources>
diff --git a/tests/UiBench/res/values/styles.xml b/tests/UiBench/res/values/styles.xml
new file mode 100644
index 000000000000..26552a2a961d
--- /dev/null
+++ b/tests/UiBench/res/values/styles.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <style name="NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
+ <item name="windowActionBar">false</item>
+ <item name="windowNoTitle">true</item>
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ </style>
+</resources>
diff --git a/tests/UiBench/src/com/android/test/uibench/NavigationDrawerActivity.java b/tests/UiBench/src/com/android/test/uibench/NavigationDrawerActivity.java
new file mode 100644
index 000000000000..1d68767b2db2
--- /dev/null
+++ b/tests/UiBench/src/com/android/test/uibench/NavigationDrawerActivity.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.test.uibench;
+
+import android.os.Bundle;
+import android.support.design.widget.NavigationView;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.support.v7.app.ActionBarDrawerToggle;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.MenuItem;
+
+public class NavigationDrawerActivity extends AppCompatActivity
+ implements NavigationView.OnNavigationItemSelectedListener {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_navigation_drawer);
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
+ ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
+ this, drawer, toolbar, R.string.navigation_drawer_open,
+ R.string.navigation_drawer_close);
+ drawer.setDrawerListener(toggle);
+ toggle.syncState();
+
+ NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
+ navigationView.setNavigationItemSelectedListener(this);
+ }
+
+ @Override
+ public boolean onNavigationItemSelected(MenuItem item) {
+ DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
+ drawer.closeDrawer(GravityCompat.START);
+ return true;
+ }
+}