GuidedStepFragments: closer to ux guidlines

1. add left and right paddings for vertialgridview.
2. add rounded corner to ripple drawable for selectable item
3. add theme attribute guidedButtonActionsWidthWeight to adjust
   button actions column width
4. crop chevron icon's empty space at four sides
5. make the title font smaller (14sp)
6. adjust top and bottom padding of item to be 14dp and 13dp.
7. add 8dp vertical space between items.
8. add 2dp vertical space between title and description.

Bug: 30308816

Change-Id: I1241128f378f663b29d42850c3ec32da9b60de32
diff --git a/v17/leanback/res/drawable-hdpi/lb_ic_guidedactions_item_chevron.png b/v17/leanback/res/drawable-hdpi/lb_ic_guidedactions_item_chevron.png
deleted file mode 100644
index 733cb3a..0000000
--- a/v17/leanback/res/drawable-hdpi/lb_ic_guidedactions_item_chevron.png
+++ /dev/null
Binary files differ
diff --git a/v17/leanback/res/drawable-mdpi/lb_ic_guidedactions_item_chevron.png b/v17/leanback/res/drawable-mdpi/lb_ic_guidedactions_item_chevron.png
deleted file mode 100644
index b191f52..0000000
--- a/v17/leanback/res/drawable-mdpi/lb_ic_guidedactions_item_chevron.png
+++ /dev/null
Binary files differ
diff --git a/v17/leanback/res/drawable-v21/lb_selectable_item_rounded_rect.xml b/v17/leanback/res/drawable-v21/lb_selectable_item_rounded_rect.xml
new file mode 100644
index 0000000..41cf375
--- /dev/null
+++ b/v17/leanback/res/drawable-v21/lb_selectable_item_rounded_rect.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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="?android:attr/colorControlHighlight">
+    <item android:id="@android:id/mask">
+        <shape android:shape="rectangle">
+            <corners android:radius="3dp" />
+            <solid android:color="@android:color/white" />
+        </shape>
+    </item>
+</ripple>
diff --git a/v17/leanback/res/drawable-xhdpi/lb_ic_guidedactions_item_chevron.png b/v17/leanback/res/drawable-xhdpi/lb_ic_guidedactions_item_chevron.png
index ee67476..9797dd2 100644
--- a/v17/leanback/res/drawable-xhdpi/lb_ic_guidedactions_item_chevron.png
+++ b/v17/leanback/res/drawable-xhdpi/lb_ic_guidedactions_item_chevron.png
Binary files differ
diff --git a/v17/leanback/res/layout/lb_guidedbuttonactions.xml b/v17/leanback/res/layout/lb_guidedbuttonactions.xml
index 7631c91..5ca3fd5 100644
--- a/v17/leanback/res/layout/lb_guidedbuttonactions.xml
+++ b/v17/leanback/res/layout/lb_guidedbuttonactions.xml
@@ -20,7 +20,7 @@
     android:transitionName="guidedactions_root2"
     android:transitionGroup="false"
     android:layout_width="0dp"
-    android:layout_weight="1"
+    android:layout_weight="?attr/guidedButtonActionsWidthWeight"
     android:layout_height="match_parent">
 
     <android.support.v17.leanback.widget.NonOverlappingView
diff --git a/v17/leanback/res/values-v21/drawables.xml b/v17/leanback/res/values-v21/drawables.xml
new file mode 100644
index 0000000..eaebf47
--- /dev/null
+++ b/v17/leanback/res/values-v21/drawables.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2014 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>
+
+    <item name="lb_selectable_item_background" type="drawable">@drawable/lb_selectable_item_rounded_rect</item>
+
+</resources>
diff --git a/v17/leanback/res/values/attrs.xml b/v17/leanback/res/values/attrs.xml
index 1ff51f7..0069ec8 100644
--- a/v17/leanback/res/values/attrs.xml
+++ b/v17/leanback/res/values/attrs.xml
@@ -459,12 +459,14 @@
              decoration when its action is disabled. Default is {@link
              android.support.v17.leanback.R.string#lb_guidedactions_item_disabled_chevron_alpha}. -->
         <attr name="guidedActionDisabledChevronAlpha" format="reference" />
-        <!-- Theme attribute used for the weight of actions.  Default is {@link
+        <!-- Theme attribute used for the width weight of actions in comparison to guidance area.  Default is {@link
              android.support.v17.leanback.R.string#lb_guidedactions_width_weight}. -->
         <attr name="guidedActionContentWidthWeight" format="reference" />
-        <!-- Theme attribute used for the weight of actions when there are two panels.  Default is {@link
+        <!-- Theme attribute used for the width weight of actions and button actions in comparison to guidance area.  Default is {@link
              android.support.v17.leanback.R.string#lb_guidedactions_width_weight_two_panels}. -->
         <attr name="guidedActionContentWidthWeightTwoPanels" format="reference" />
+        <!-- Theme attribute used for the width weight of button actions in compare to actions -->
+        <attr name="guidedButtonActionsWidthWeight" format="reference" />
         <!-- Theme attribute used in a GuidedActionsPresenter for the max lines of the title text
              view when the action's isMultilineDescription is set to false. Default is {@link
              android.support.v17.leanback.R.integer#lb_guidedactions_item_title_min_lines}. -->
diff --git a/v17/leanback/res/values/dimens.xml b/v17/leanback/res/values/dimens.xml
index f6ef557..e0a366a 100644
--- a/v17/leanback/res/values/dimens.xml
+++ b/v17/leanback/res/values/dimens.xml
@@ -241,11 +241,16 @@
     <!-- GuidedStepFragment -->
     <dimen name="lb_guidedstep_slide_ime_distance">-100dp</dimen>
 
-    <item name="lb_guidedactions_width_weight" format="float" type="string">0.666666667</item>
-    <item name="lb_guidedactions_width_weight_two_panels" format="float" type="string">1</item>
-    <dimen name="lb_guidedactions_section_shadow_width">16dp</dimen>
+    <dimen name="lb_guidedactions_list_padding_start">24dp</dimen>
+    <dimen name="lb_guidedactions_list_padding_end">24dp</dimen>
+
+    <item name="lb_guidedactions_width_weight" format="float" type="string">0.71428571428</item>
+    <item name="lb_guidedactions_width_weight_two_panels" format="float" type="string">1.191780822</item>
+    <item name="lb_guidedbuttonactions_width_weight" format="float" type="string">0.45</item>
+
+    <dimen name="lb_guidedactions_section_shadow_width">32dp</dimen>
     <dimen name="lb_guidedactions_elevation">12dp</dimen>
-    <dimen name="lb_guidedactions_vertical_padding">12dp</dimen>
+    <dimen name="lb_guidedactions_list_vertical_spacing">8dp</dimen>
 
     <item name="lb_guidedstep_height_weight" format="float" type="string">2.0</item>
     <item name="lb_guidedstep_height_weight_translucent" format="float" type="string">1.0</item>
@@ -259,14 +264,17 @@
 
     <dimen name="lb_guidedactions_item_text_width">248dp</dimen>
     <dimen name="lb_guidedactions_item_text_width_no_icon">284dp</dimen>
-    <dimen name="lb_guidedactions_item_min_height">64dp</dimen>
-    <dimen name="lb_guidedactions_item_start_padding">28dp</dimen>
-    <dimen name="lb_guidedactions_item_end_padding">28dp</dimen>
+    <dimen name="lb_guidedactions_item_start_padding">16dp</dimen>
+    <dimen name="lb_guidedactions_item_end_padding">16dp</dimen>
+    <dimen name="lb_guidedactions_item_top_padding">14dp</dimen>
+    <dimen name="lb_guidedactions_item_bottom_padding">13dp</dimen>
+    <dimen name="lb_guidedactions_vertical_padding">14dp</dimen>
     <dimen name="lb_guidedactions_item_delimiter_padding">4dp</dimen>
     <dimen name="lb_guidedactions_item_checkmark_diameter">16dp</dimen>
     <dimen name="lb_guidedactions_item_icon_width">32dp</dimen>
     <dimen name="lb_guidedactions_item_icon_height">32dp</dimen>
-    <dimen name="lb_guidedactions_item_title_font_size">18sp</dimen>
+    <dimen name="lb_guidedactions_item_title_font_size">14sp</dimen>
+    <dimen name="lb_guidedactions_item_space_between_title_and_description">2dp</dimen>
     <dimen name="lb_guidedactions_item_description_font_size">12sp</dimen>
     <dimen name="lb_guidedactions_sublist_bottom_margin">28dp</dimen>
 
diff --git a/v17/leanback/res/values/drawables.xml b/v17/leanback/res/values/drawables.xml
new file mode 100644
index 0000000..a97f0cc
--- /dev/null
+++ b/v17/leanback/res/values/drawables.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2014 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>
+
+    <item name="lb_selectable_item_background" type="drawable">?android:attr/selectableItemBackground</item>
+
+</resources>
diff --git a/v17/leanback/res/values/styles.xml b/v17/leanback/res/values/styles.xml
index 8bd9b79..491364e 100644
--- a/v17/leanback/res/values/styles.xml
+++ b/v17/leanback/res/values/styles.xml
@@ -571,6 +571,9 @@
         <item name="android:focusableInTouchMode">false</item>
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">match_parent</item>
+        <item name="verticalMargin">@dimen/lb_guidedactions_list_vertical_spacing</item>
+        <item name="android:paddingStart">@dimen/lb_guidedactions_list_padding_start</item>
+        <item name="android:paddingEnd">@dimen/lb_guidedactions_list_padding_end</item>
         <item name="focusOutEnd">false</item>
         <item name="focusOutFront">false</item>
     </style>
@@ -595,11 +598,10 @@
         <item name="android:foreground">?attr/guidedActionsSelectorDrawable</item>
         <item name="android:focusable">true</item>
         <item name="android:focusableInTouchMode">true</item>
-        <item name="android:minHeight">@dimen/lb_guidedactions_item_min_height</item>
-        <item name="android:paddingBottom">@dimen/lb_guidedactions_vertical_padding</item>
+        <item name="android:paddingBottom">@dimen/lb_guidedactions_item_bottom_padding</item>
         <item name="android:paddingStart">@dimen/lb_guidedactions_item_start_padding</item>
         <item name="android:paddingEnd">@dimen/lb_guidedactions_item_end_padding</item>
-        <item name="android:paddingTop">@dimen/lb_guidedactions_vertical_padding</item>
+        <item name="android:paddingTop">@dimen/lb_guidedactions_item_top_padding</item>
     </style>
 
     <!-- Style for an action's checkmark in a GuidedActionsStylist's default item layout. -->
@@ -650,6 +652,7 @@
         <item name="android:layout_height">wrap_content</item>
         <item name="android:alpha">@string/lb_guidedactions_item_unselected_description_text_alpha</item>
         <item name="android:ellipsize">end</item>
+        <item name="android:layout_marginTop">@dimen/lb_guidedactions_item_space_between_title_and_description</item>
         <item name="android:fontFamily">sans-serif-condensed</item>
         <item name="android:maxLines">@integer/lb_guidedactions_item_description_min_lines</item>
         <item name="android:textColor">@color/lb_guidedactions_item_unselected_text_color</item>
@@ -660,8 +663,8 @@
 
     <!-- Style for an action's chevron in a GuidedActionsStylist's default item layout. -->
     <style name="Widget.Leanback.GuidedActionItemChevronStyle">
-        <item name="android:layout_width">wrap_content</item>
-        <item name="android:layout_height">wrap_content</item>
+        <item name="android:layout_width">12dp</item>
+        <item name="android:layout_height">12dp</item>
         <item name="android:layout_gravity">center</item>
         <item name="android:layout_marginStart">@dimen/lb_guidedactions_item_delimiter_padding</item>
         <item name="android:scaleType">fitCenter</item>
diff --git a/v17/leanback/res/values/themes.xml b/v17/leanback/res/values/themes.xml
index cf3cbef..cae45ac 100644
--- a/v17/leanback/res/values/themes.xml
+++ b/v17/leanback/res/values/themes.xml
@@ -167,7 +167,7 @@
         <item name="guidedActionsElevation">@dimen/lb_guidedactions_elevation</item>
         <item name="guidedActionsBackground">@color/lb_guidedactions_background</item>
         <item name="guidedActionsBackgroundDark">@color/lb_guidedactions_background_dark</item>
-        <item name="guidedActionsSelectorDrawable">?android:attr/selectableItemBackground</item>
+        <item name="guidedActionsSelectorDrawable">@drawable/lb_selectable_item_background</item>
         <item name="guidedActionsListStyle">@style/Widget.Leanback.GuidedActionsListStyle</item>
         <item name="guidedSubActionsListStyle">@style/Widget.Leanback.GuidedSubActionsListStyle</item>
         <item name="guidedButtonActionsListStyle">@style/Widget.Leanback.GuidedButtonActionsListStyle</item>
@@ -186,6 +186,7 @@
         <item name="guidedActionDisabledChevronAlpha">@string/lb_guidedactions_item_disabled_chevron_alpha</item>
         <item name="guidedActionContentWidthWeight">@string/lb_guidedactions_width_weight</item>
         <item name="guidedActionContentWidthWeightTwoPanels">@string/lb_guidedactions_width_weight_two_panels</item>
+        <item name="guidedButtonActionsWidthWeight">@string/lb_guidedbuttonactions_width_weight</item>
         <item name="guidedActionTitleMinLines">@integer/lb_guidedactions_item_title_min_lines</item>
         <item name="guidedActionTitleMaxLines">@integer/lb_guidedactions_item_title_max_lines</item>
         <item name="guidedActionDescriptionMinLines">@integer/lb_guidedactions_item_description_min_lines</item>
@@ -209,4 +210,5 @@
         <item name="onboardingStartButtonStyle">@style/Widget.Leanback.OnboardingStartButtonStyle</item>
         <item name="onboardingLogoStyle">@style/Widget.Leanback.OnboardingLogoStyle</item>
     </style>
+
 </resources>