Indicate selected menu item state in drawer (1/2)
Bug 28754805
Change-Id: Ie3aa9bab80266515b49ab33d75be4b188b7eb954
diff --git a/res/drawable-v21/drawer_item_background.xml b/res/drawable-v21/drawer_item_background.xml
new file mode 100644
index 0000000..cfc7761
--- /dev/null
+++ b/res/drawable-v21/drawer_item_background.xml
@@ -0,0 +1,27 @@
+<?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
+ -->
+
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="@color/nav_item_selected_background">
+ <item>
+ <selector>
+ <item android:drawable="@color/nav_item_selected_background" android:state_checked="true"/>
+ <item android:drawable="@android:color/transparent"/>
+ </selector>
+ </item>
+</ripple>
\ No newline at end of file
diff --git a/res/drawable/drawer_item_background.xml b/res/drawable/drawer_item_background.xml
new file mode 100644
index 0000000..3ffe041
--- /dev/null
+++ b/res/drawable/drawer_item_background.xml
@@ -0,0 +1,22 @@
+<?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
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_checked="true" android:drawable="@color/nav_item_selected_background"/>
+ <item android:drawable="@android:color/transparent" />
+</selector>
\ No newline at end of file
diff --git a/res/layout/contacts_drawer_activity.xml b/res/layout/contacts_drawer_activity.xml
index 008d4f5..ad68e84 100644
--- a/res/layout/contacts_drawer_activity.xml
+++ b/res/layout/contacts_drawer_activity.xml
@@ -57,6 +57,7 @@
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
+ app:itemBackground="@drawable/drawer_item_background"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"/>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 6a91140..8fa0e0d 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -21,6 +21,8 @@
<color name="action_bar_background">#0288d1</color>
+ <color name="nav_item_selected_background">#0f000000</color>
+
<color name="background_social_updates">#ffeeeeee</color>
<color name="action_bar_button_text_color">#FFFFFF</color>