GuidedStepFragment: two columns actions

Duplicated action methods into another copy.

The weight of actions width is controlled through theme:
guidedActionContentWidthWeight, guidedActionContentWidthWeightTwoPanels.
When there is one column: actions take 40% of screen width.
When there are two columns: actions take 50% of screen width.

Two actions backgrounds are controlled through theme:
guidedActionsBackground, guidedButtonActionsBackground.

b/24979563

Change-Id: I96486921c39693771c243b18ef9897aa750c65cb
diff --git a/v17/leanback/api/current.txt b/v17/leanback/api/current.txt
index 37f1ed4..c331a21 100644
--- a/v17/leanback/api/current.txt
+++ b/v17/leanback/api/current.txt
@@ -207,23 +207,32 @@
     method public static int addAsRoot(android.app.Activity, android.support.v17.leanback.app.GuidedStepFragment, int);
     method public android.support.v17.leanback.widget.GuidedAction findActionById(long);
     method public int findActionPositionById(long);
+    method public android.support.v17.leanback.widget.GuidedAction findButtonActionById(long);
+    method public int findButtonActionPositionById(long);
     method public void finishGuidedStepFragments();
     method public java.lang.String generateStackEntryName();
     method public static java.lang.String generateStackEntryName(int, java.lang.Class);
     method public android.view.View getActionItemView(int);
     method public java.util.List<android.support.v17.leanback.widget.GuidedAction> getActions();
+    method public android.view.View getButtonActionItemView(int);
+    method public java.util.List<android.support.v17.leanback.widget.GuidedAction> getButtonActions();
     method protected int getContainerIdForBackground();
     method public static android.support.v17.leanback.app.GuidedStepFragment getCurrentGuidedStepFragment(android.app.FragmentManager);
     method public android.support.v17.leanback.widget.GuidanceStylist getGuidanceStylist();
     method public android.support.v17.leanback.widget.GuidedActionsStylist getGuidedActionsStylist();
+    method public android.support.v17.leanback.widget.GuidedActionsStylist getGuidedButtonActionsStylist();
     method public static java.lang.String getGuidedStepFragmentClassName(java.lang.String);
     method public int getSelectedActionPosition();
+    method public int getSelectedButtonActionPosition();
     method public int getUiStyle();
     method public static boolean isUiStyleDefault(java.lang.String);
     method public static boolean isUiStyleEntrance(java.lang.String);
     method public void notifyActionChanged(int);
+    method public void notifyButtonActionChanged(int);
     method public void onCreateActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>, android.os.Bundle);
     method public android.support.v17.leanback.widget.GuidedActionsStylist onCreateActionsStylist();
+    method public void onCreateButtonActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>, android.os.Bundle);
+    method public android.support.v17.leanback.widget.GuidedActionsStylist onCreateButtonActionsStylist();
     method public android.support.v17.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle);
     method public android.support.v17.leanback.widget.GuidanceStylist onCreateGuidanceStylist();
     method public void onGuidedActionClicked(android.support.v17.leanback.widget.GuidedAction);
@@ -235,7 +244,9 @@
     method public int onProvideTheme();
     method public void popBackStackToGuidedStepFragment(java.lang.Class, int);
     method public void setActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>);
+    method public void setButtonActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>);
     method public void setSelectedActionPosition(int);
+    method public void setSelectedButtonActionPosition(int);
     method public void setUiStyle(int);
     field public static final java.lang.String EXTRA_UI_STYLE = "uiStyle";
     field public static final int UI_STYLE_ACTIVITY_ROOT = 2; // 0x2
@@ -255,23 +266,32 @@
     method public static int addAsRoot(android.support.v4.app.FragmentActivity, android.support.v17.leanback.app.GuidedStepSupportFragment, int);
     method public android.support.v17.leanback.widget.GuidedAction findActionById(long);
     method public int findActionPositionById(long);
+    method public android.support.v17.leanback.widget.GuidedAction findButtonActionById(long);
+    method public int findButtonActionPositionById(long);
     method public void finishGuidedStepSupportFragments();
     method public java.lang.String generateStackEntryName();
     method public static java.lang.String generateStackEntryName(int, java.lang.Class);
     method public android.view.View getActionItemView(int);
     method public java.util.List<android.support.v17.leanback.widget.GuidedAction> getActions();
+    method public android.view.View getButtonActionItemView(int);
+    method public java.util.List<android.support.v17.leanback.widget.GuidedAction> getButtonActions();
     method protected int getContainerIdForBackground();
     method public static android.support.v17.leanback.app.GuidedStepSupportFragment getCurrentGuidedStepSupportFragment(android.support.v4.app.FragmentManager);
     method public android.support.v17.leanback.widget.GuidanceStylist getGuidanceStylist();
     method public android.support.v17.leanback.widget.GuidedActionsStylist getGuidedActionsStylist();
+    method public android.support.v17.leanback.widget.GuidedActionsStylist getGuidedButtonActionsStylist();
     method public static java.lang.String getGuidedStepSupportFragmentClassName(java.lang.String);
     method public int getSelectedActionPosition();
+    method public int getSelectedButtonActionPosition();
     method public int getUiStyle();
     method public static boolean isUiStyleDefault(java.lang.String);
     method public static boolean isUiStyleEntrance(java.lang.String);
     method public void notifyActionChanged(int);
+    method public void notifyButtonActionChanged(int);
     method public void onCreateActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>, android.os.Bundle);
     method public android.support.v17.leanback.widget.GuidedActionsStylist onCreateActionsStylist();
+    method public void onCreateButtonActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>, android.os.Bundle);
+    method public android.support.v17.leanback.widget.GuidedActionsStylist onCreateButtonActionsStylist();
     method public android.support.v17.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle);
     method public android.support.v17.leanback.widget.GuidanceStylist onCreateGuidanceStylist();
     method public void onGuidedActionClicked(android.support.v17.leanback.widget.GuidedAction);
@@ -283,7 +303,9 @@
     method public int onProvideTheme();
     method public void popBackStackToGuidedStepSupportFragment(java.lang.Class, int);
     method public void setActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>);
+    method public void setButtonActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>);
     method public void setSelectedActionPosition(int);
+    method public void setSelectedButtonActionPosition(int);
     method public void setUiStyle(int);
     field public static final java.lang.String EXTRA_UI_STYLE = "uiStyle";
     field public static final int UI_STYLE_ACTIVITY_ROOT = 2; // 0x2
@@ -966,6 +988,7 @@
     method public android.widget.ImageView getIconView();
     method public android.widget.TextView getTitleView();
     method public android.view.View onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.support.v17.leanback.widget.GuidanceStylist.Guidance);
+    method public void onDestroyView();
     method public void onImeAppearing(java.util.List<android.animation.Animator>);
     method public void onImeDisappearing(java.util.List<android.animation.Animator>);
     method public int onProvideLayoutId();
@@ -1070,6 +1093,7 @@
     method public android.view.View onCreateView(android.view.LayoutInflater, android.view.ViewGroup);
     method public android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder onCreateViewHolder(android.view.ViewGroup);
     method public android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder onCreateViewHolder(android.view.ViewGroup, int);
+    method public void onDestroyView();
     method protected void onEditingModeChange(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, android.support.v17.leanback.widget.GuidedAction, boolean);
     method public void onImeAppearing(java.util.List<android.animation.Animator>);
     method public void onImeDisappearing(java.util.List<android.animation.Animator>);
diff --git a/v17/leanback/res/layout/lb_guidedactions.xml b/v17/leanback/res/layout/lb_guidedactions.xml
index f1a4d2a..77fd6fc1 100644
--- a/v17/leanback/res/layout/lb_guidedactions.xml
+++ b/v17/leanback/res/layout/lb_guidedactions.xml
@@ -16,22 +16,25 @@
 -->
 <!-- Layout for the settings list fragment -->
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
+    android:layout_width="0dp"
+    android:layout_weight="1"
     android:layout_height="match_parent">
 
-    <android.support.v17.leanback.widget.NonOverlappingRelativeLayout
-        android:id="@+id/guidedactions_background"
-        android:transitionGroup="true"
-        style="?attr/guidedActionsContainerStyle" />
-
-    <android.support.v17.leanback.widget.NonOverlappingFrameLayout
-        android:id="@+id/guidedactions_selector"
-        android:transitionGroup="true"
-        style="?attr/guidedActionsSelectorStyle" />
+    <android.support.v17.leanback.widget.NonOverlappingView
+        android:id="@+id/guided_button_actions_background"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:visibility="gone"
+        android:background="?attr/guidedButtonActionsBackground" />
 
     <android.support.v17.leanback.widget.VerticalGridView
         android:transitionGroup="true"
         android:id="@+id/guidedactions_list"
         style="?attr/guidedActionsListStyle" />
 
+    <android.support.v17.leanback.widget.NonOverlappingFrameLayout
+        android:id="@+id/guidedactions_selector"
+        android:transitionGroup="true"
+        style="?attr/guidedActionsSelectorStyle" />
+
 </RelativeLayout>
diff --git a/v17/leanback/res/layout/lb_guidedstep_fragment.xml b/v17/leanback/res/layout/lb_guidedstep_fragment.xml
index 15b3081..36504fe 100644
--- a/v17/leanback/res/layout/lb_guidedstep_fragment.xml
+++ b/v17/leanback/res/layout/lb_guidedstep_fragment.xml
@@ -15,25 +15,46 @@
      limitations under the License.
 -->
 <!-- Layout for the frame of a 2 pane actions fragment. -->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/content_frame"
+    android:orientation="horizontal"
     android:layout_width="match_parent"
     android:layout_height="match_parent" >
 
     <android.support.v17.leanback.widget.NonOverlappingFrameLayout
         android:id="@+id/content_fragment"
-        android:layout_width="@dimen/lb_guidedstep_guidance_section_width"
+        android:layout_toStartOf="@+id/action_fragment"
+        android:layout_width="0dp"
+        android:layout_weight="1"
         android:layout_height="match_parent"
         android:layout_alignParentStart="true" />
 
-    <FrameLayout
-        android:id="@+id/action_fragment"
-        android:layout_toEndOf="@+id/content_fragment"
+    <android.support.v17.leanback.widget.NonOverlappingFrameLayout
+        android:id="@+id/action_fragment_root"
+        android:orientation="horizontal"
         android:clipToPadding="false"
         android:clipChildren="false"
         android:paddingLeft="@dimen/lb_guidedactions_section_shadow_width"
-        android:layout_width="match_parent"
+        android:layout_width="0dp"
+        android:layout_weight="?attr/guidedActionContentWidthWeight"
         android:layout_height="match_parent"
-        android:layout_alignParentEnd="true" />
+        android:layout_alignParentEnd="true"
+    >
+        <android.support.v17.leanback.widget.NonOverlappingView
+            android:id="@+id/action_fragment_background"
+            android:orientation="horizontal"
+            android:outlineProvider="paddedBounds"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="?attr/guidedActionsBackground"
+            android:elevation="@dimen/lb_guidedactions_elevation" />
 
-</RelativeLayout>
\ No newline at end of file
+        <android.support.v17.leanback.widget.NonOverlappingLinearLayout
+            android:id="@+id/action_fragment"
+            android:orientation="horizontal"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:elevation="@dimen/lb_guidedactions_elevation" />
+    </android.support.v17.leanback.widget.NonOverlappingFrameLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/v17/leanback/res/transition-v21/lb_guidedstep_activity_enter.xml b/v17/leanback/res/transition-v21/lb_guidedstep_activity_enter.xml
index d2d7afa..c711679 100644
--- a/v17/leanback/res/transition-v21/lb_guidedstep_activity_enter.xml
+++ b/v17/leanback/res/transition-v21/lb_guidedstep_activity_enter.xml
@@ -32,7 +32,8 @@
       android:duration="350"
       android:slideEdge="right">
         <targets>
-            <target android:targetId="@id/guidedactions_background" />
+            <target android:targetId="@id/action_fragment_background" />
+            <target android:targetId="@id/guided_button_actions_background" />
             <target android:targetId="@id/guidedactions_selector" />
             <target android:targetId="@id/guidedactions_list" />
         </targets>
diff --git a/v17/leanback/res/values/attrs.xml b/v17/leanback/res/values/attrs.xml
index 551e3f4..6aa0c7e 100644
--- a/v17/leanback/res/values/attrs.xml
+++ b/v17/leanback/res/values/attrs.xml
@@ -348,12 +348,18 @@
              selector is animated in at activity start. Default is {@link
              android.support.v17.leanback.R.animator#lb_guidedactions_selector_hide}. -->
         <attr name="guidedActionsSelectorHideAnimation" format="reference" />
-        <!-- Theme attribute for the style of the container in a GuidedActionsPresenter. Default is
-             {@link android.support.v17.leanback.R.style#Widget_Leanback_GuidedActionsContainerStyle}. -->
-        <attr name="guidedActionsContainerStyle" format="reference" />
         <!-- Theme attribute for the style of the item selector in a GuidedActionsPresenter. Default is
              {@link android.support.v17.leanback.R.style#Widget_Leanback_GuidedActionsSelectorStyle}. -->
         <attr name="guidedActionsSelectorStyle" format="reference" />
+
+        <!-- Theme attribute for the background of GuidedActions. Default is
+             {@link android.support.v17.leanback.R.color#lb_guidedactions_background}.-->
+        <attr name="guidedActionsBackground" format="reference" />
+
+        <!-- Theme attribute for the background of Button GuidedActions. Default is
+             {@link android.support.v17.leanback.R.color#lb_guidedbuttonactions_background}.-->
+        <attr name="guidedButtonActionsBackground" format="reference" />
+
         <!-- Theme attribute for the style of the list in a GuidedActionsPresenter. Default is
              {@link android.support.v17.leanback.R.style#Widget_Leanback_GuidedActionsListStyle}.-->
         <attr name="guidedActionsListStyle" format="reference" />
@@ -411,14 +417,12 @@
              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 in a GuidedActionsPresenter for the width of the text area of
-             a single action when there is an icon present. Default is {@link
-             android.support.v17.leanback.R.dimen#lb_guidedactions_item_text_width}. -->
-        <attr name="guidedActionContentWidth" format="reference" />
-        <!-- Theme attribute used in a GuidedActionsPresenter for the width of the text area of
-             a single action when there is no icon present. Default is {@link
-             android.support.v17.leanback.R.dimen#lb_guidedactions_item_text_width_no_icon}. -->
-        <attr name="guidedActionContentWidthNoIcon" format="reference" />
+        <!-- Theme attribute used for the weight of actions.  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
+             android.support.v17.leanback.R.string#lb_guidedactions_width_weight_two_panels}. -->
+        <attr name="guidedActionContentWidthWeightTwoPanels" 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/colors.xml b/v17/leanback/res/values/colors.xml
index e63c58b..8863a18 100644
--- a/v17/leanback/res/values/colors.xml
+++ b/v17/leanback/res/values/colors.xml
@@ -71,6 +71,7 @@
 
     <!-- refactor naming here -->
     <color name="lb_guidedactions_background">#FF111111</color>
+    <color name="lb_guidedbuttonactions_background">#FF080808</color>
     <color name="lb_guidedactions_selector_color">#26FFFFFF</color>
     <color name="lb_guidedactions_item_unselected_text_color">#FFF1F1F1</color>
     <!-- end refactor naming -->
diff --git a/v17/leanback/res/values/dimens.xml b/v17/leanback/res/values/dimens.xml
index 7f15fd2..f5f42f2 100644
--- a/v17/leanback/res/values/dimens.xml
+++ b/v17/leanback/res/values/dimens.xml
@@ -224,7 +224,6 @@
     <dimen name="lb_rounded_rect_corner_radius">2dp</dimen>
 
     <!-- GuidedStepFragment -->
-    <dimen name="lb_guidedstep_guidance_section_width">576dp</dimen>
     <dimen name="lb_guidedstep_slide_start_distance">-200dp</dimen>
     <dimen name="lb_guidedstep_slide_end_distance">200dp</dimen>
     <dimen name="lb_guidedstep_slide_ime_distance">-100dp</dimen>
@@ -232,7 +231,8 @@
     <dimen name="lb_guidance_entry_translationX">-120dp</dimen>
 
     <dimen name="lb_guidedactions_entry_translationX">384dp</dimen>
-    <dimen name="lb_guidedactions_section_width">384dp</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_elevation">12dp</dimen>
     <dimen name="lb_guidedactions_selector_min_height">8dp</dimen>
diff --git a/v17/leanback/res/values/styles.xml b/v17/leanback/res/values/styles.xml
index e5182b3..0e5b0b6 100644
--- a/v17/leanback/res/values/styles.xml
+++ b/v17/leanback/res/values/styles.xml
@@ -422,28 +422,16 @@
         <item name="android:scaleType">fitCenter</item>
     </style>
 
-    <!-- Style for the container view in a GuidedActionsStylist's default layout. -->
-    <style name="Widget.Leanback.GuidedActionsContainerStyle">
-        <item name="android:elevation">@dimen/lb_guidedactions_elevation</item>
-        <item name="android:layout_width">@dimen/lb_guidedactions_section_width</item>
-        <item name="android:layout_height">match_parent</item>
-        <item name="android:layout_alignParentEnd">true</item>
-        <item name="android:background">@color/lb_guidedactions_background</item>
-    </style>
-
     <!-- Style for the selector view in a GuidedActionsStylist's default layout. -->
     <style name="Widget.Leanback.GuidedActionsSelectorStyle">
-        <item name="android:elevation">@dimen/lb_guidedactions_elevation</item>
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">@dimen/lb_guidedactions_selector_min_height</item>
         <item name="android:layout_centerVertical">true</item>
-        <item name="android:alpha">0</item>
         <item name="android:background">@color/lb_guidedactions_selector_color</item>
     </style>
 
     <!-- Style for the vertical grid of actions in a GuidedActionsStylist's default layout. -->
     <style name="Widget.Leanback.GuidedActionsListStyle">
-        <item name="android:elevation">@dimen/lb_guidedactions_elevation</item>
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">match_parent</item>
         <item name="android:focusable">true</item>
@@ -485,7 +473,7 @@
 
     <!-- Style for an action's text content in a GuidedActionsStylist's default item layout. -->
     <style name="Widget.Leanback.GuidedActionItemContentStyle">
-        <item name="android:layout_width">0dp</item>
+        <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">wrap_content</item>
         <item name="android:layout_gravity">start|center_vertical</item>
         <item name="android:layout_weight">1</item>
diff --git a/v17/leanback/res/values/themes.xml b/v17/leanback/res/values/themes.xml
index 2e47e56..2af6b3b 100644
--- a/v17/leanback/res/values/themes.xml
+++ b/v17/leanback/res/values/themes.xml
@@ -129,7 +129,8 @@
         <item name="guidanceBreadcrumbStyle">@style/Widget.Leanback.GuidanceBreadcrumbStyle</item>
         <item name="guidanceDescriptionStyle">@style/Widget.Leanback.GuidanceDescriptionStyle</item>
 
-        <item name="guidedActionsContainerStyle">@style/Widget.Leanback.GuidedActionsContainerStyle</item>
+        <item name="guidedActionsBackground">@color/lb_guidedactions_background</item>
+        <item name="guidedButtonActionsBackground">@color/lb_guidedbuttonactions_background</item>
         <item name="guidedActionsSelectorStyle">@style/Widget.Leanback.GuidedActionsSelectorStyle</item>
         <item name="guidedActionsListStyle">@style/Widget.Leanback.GuidedActionsListStyle</item>
         <item name="guidedActionsSelectorShowAnimation">@animator/lb_guidedactions_selector_show</item>
@@ -149,8 +150,8 @@
         <item name="guidedActionUnpressedAnimation">@animator/lb_guidedactions_item_unpressed</item>
         <item name="guidedActionEnabledChevronAlpha">@string/lb_guidedactions_item_enabled_chevron_alpha</item>
         <item name="guidedActionDisabledChevronAlpha">@string/lb_guidedactions_item_disabled_chevron_alpha</item>
-        <item name="guidedActionContentWidth">@dimen/lb_guidedactions_item_text_width</item>
-        <item name="guidedActionContentWidthNoIcon">@dimen/lb_guidedactions_item_text_width_no_icon</item>
+        <item name="guidedActionContentWidthWeight">@string/lb_guidedactions_width_weight</item>
+        <item name="guidedActionContentWidthWeightTwoPanels">@string/lb_guidedactions_width_weight_two_panels</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>
diff --git a/v17/leanback/src/android/support/v17/leanback/app/GuidedStepFragment.java b/v17/leanback/src/android/support/v17/leanback/app/GuidedStepFragment.java
index 3fd0127..f5bf497 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/GuidedStepFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/GuidedStepFragment.java
@@ -33,6 +33,7 @@
 import android.support.v17.leanback.widget.GuidedActionsStylist;
 import android.support.v17.leanback.widget.VerticalGridView;
 import android.support.v4.app.ActivityCompat;
+import android.support.v7.widget.RecyclerView;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.TypedValue;
@@ -44,6 +45,7 @@
 import android.view.ViewTreeObserver;
 import android.widget.ImageView;
 import android.widget.RelativeLayout;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import java.util.ArrayList;
@@ -121,6 +123,10 @@
  *
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedStepTheme
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedStepBackground
+ * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionContentWidthWeight
+ * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionContentWidthWeightTwoPanels
+ * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionsBackground
+ * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedButtonActionsBackground
  * @see GuidanceStylist
  * @see GuidanceStylist.Guidance
  * @see GuidedAction
@@ -205,10 +211,13 @@
     private ContextThemeWrapper mThemeWrapper;
     private GuidanceStylist mGuidanceStylist;
     private GuidedActionsStylist mActionsStylist;
+    private GuidedActionsStylist mButtonActionsStylist;
     private GuidedActionAdapter mAdapter;
-    private VerticalGridView mListView;
+    private GuidedActionAdapter mButtonAdapter;
     private List<GuidedAction> mActions = new ArrayList<GuidedAction>();
+    private List<GuidedAction> mButtonActions = new ArrayList<GuidedAction>();
     private int mSelectedIndex = -1;
+    private int mButtonSelectedIndex = -1;
 
     public GuidedStepFragment() {
         // We need to supply the theme before any potential call to onInflate in order
@@ -216,6 +225,7 @@
         mTheme = onProvideTheme();
         mGuidanceStylist = onCreateGuidanceStylist();
         mActionsStylist = onCreateActionsStylist();
+        mButtonActionsStylist = onCreateButtonActionsStylist();
         onProvideFragmentTransitions();
     }
 
@@ -238,6 +248,15 @@
     }
 
     /**
+     * Creates the presenter used to style a sided actions panel for button only.
+     * The default implementation returns a basic GuidedActionsStylist.
+     * @return The GuidedActionsStylist used in this fragment.
+     */
+    public GuidedActionsStylist onCreateButtonActionsStylist() {
+        return new GuidedActionsStylist();
+    }
+
+    /**
      * Returns the theme used for styling the fragment. The default returns -1, indicating that the
      * host Activity's theme should be used.
      * @return The theme resource ID of the theme to use in this fragment, or -1 to use the
@@ -269,6 +288,16 @@
     }
 
     /**
+     * Fills out the set of actions shown at right available to the user. This hook is called during
+     * {@link #onCreate}. The default leaves the list of actions empty; subclasses may override.
+     * @param actions A non-null, empty list ready to be populated.
+     * @param savedInstanceState The saved instance state from onCreate.
+     */
+    public void onCreateButtonActions(@NonNull List<GuidedAction> actions,
+            Bundle savedInstanceState) {
+    }
+
+    /**
      * Callback invoked when an action is taken by the user. Subclasses should override in
      * order to act on the user's decisions.
      * @param action The chosen action.
@@ -502,6 +531,99 @@
     }
 
     /**
+     * Returns the list of button GuidedActions that the user may take in this fragment.
+     * @return The list of button GuidedActions for this fragment.
+     */
+    public List<GuidedAction> getButtonActions() {
+        return mButtonActions;
+    }
+
+    /**
+     * Find button GuidedAction by Id.
+     * @param id  Id of the button action to search.
+     * @return  GuidedAction object or null if not found.
+     */
+    public GuidedAction findButtonActionById(long id) {
+        int index = findButtonActionPositionById(id);
+        return index >= 0 ? mButtonActions.get(index) : null;
+    }
+
+    /**
+     * Find button GuidedAction position in array by Id.
+     * @param id  Id of the button action to search.
+     * @return  position of GuidedAction object in array or -1 if not found.
+     */
+    public int findButtonActionPositionById(long id) {
+        if (mButtonActions != null) {
+            for (int i = 0; i < mButtonActions.size(); i++) {
+                GuidedAction action = mButtonActions.get(i);
+                if (mButtonActions.get(i).getId() == id) {
+                    return i;
+                }
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Returns the GuidedActionsStylist that displays the button actions the user may take.
+     * @return The GuidedActionsStylist for this fragment.
+     */
+    public GuidedActionsStylist getGuidedButtonActionsStylist() {
+        return mButtonActionsStylist;
+    }
+
+    /**
+     * Sets the list of button GuidedActions that the user may take in this fragment.
+     * @param actions The list of button GuidedActions for this fragment.
+     */
+    public void setButtonActions(List<GuidedAction> actions) {
+        mButtonActions = actions;
+        if (mButtonAdapter != null) {
+            mButtonAdapter.setActions(mButtonActions);
+        }
+    }
+
+    /**
+     * Notify an button action has changed and update its UI.
+     * @param position Position of the button GuidedAction in array.
+     */
+    public void notifyButtonActionChanged(int position) {
+        if (mButtonAdapter != null) {
+            mButtonAdapter.notifyItemChanged(position);
+        }
+    }
+
+    /**
+     * Returns the view corresponding to the button action at the indicated position in the list of
+     * actions for this fragment.
+     * @param position The integer position of the button action of interest.
+     * @return The View corresponding to the button action at the indicated position, or null if
+     * that action is not currently onscreen.
+     */
+    public View getButtonActionItemView(int position) {
+        final RecyclerView.ViewHolder holder = mButtonActionsStylist.getActionsGridView()
+                    .findViewHolderForPosition(position);
+        return holder == null ? null : holder.itemView;
+    }
+
+    /**
+     * Scrolls the action list to the position indicated, selecting that button action's view.
+     * @param position The integer position of the button action of interest.
+     */
+    public void setSelectedButtonActionPosition(int position) {
+        mButtonActionsStylist.getActionsGridView().setSelectedPosition(position);
+    }
+
+    /**
+     * Returns the position if the currently selected button GuidedAction.
+     * @return position The integer position of the currently selected button action.
+     */
+    public int getSelectedButtonActionPosition() {
+        return mButtonActionsStylist.getActionsGridView().getSelectedPosition();
+    }
+
+    /**
      * Returns the list of GuidedActions that the user may take in this fragment.
      * @return The list of GuidedActions for this fragment.
      */
@@ -565,7 +687,9 @@
      * action is not currently onscreen.
      */
     public View getActionItemView(int position) {
-        return mListView.findViewHolderForPosition(position).itemView;
+        final RecyclerView.ViewHolder holder = mActionsStylist.getActionsGridView()
+                    .findViewHolderForPosition(position);
+        return holder == null ? null : holder.itemView;
     }
 
     /**
@@ -573,7 +697,7 @@
      * @param position The integer position of the action of interest.
      */
     public void setSelectedActionPosition(int position) {
-        mListView.setSelectedPosition(position);
+        mActionsStylist.getActionsGridView().setSelectedPosition(position);
     }
 
     /**
@@ -581,7 +705,7 @@
      * @return position The integer position of the currently selected action.
      */
     public int getSelectedActionPosition() {
-        return mListView.getSelectedPosition();
+        return mActionsStylist.getActionsGridView().getSelectedPosition();
     }
 
     /**
@@ -602,18 +726,25 @@
         if (Build.VERSION.SDK_INT >= 21) {
             if (getUiStyle() == UI_STYLE_DEFAULT) {
                 Object enterTransition = TransitionHelper.createFadeAndShortSlide(Gravity.END);
-                TransitionHelper.exclude(enterTransition, R.id.guidedactions_background, true);
+                TransitionHelper.exclude(enterTransition, R.id.action_fragment_background, true);
+                TransitionHelper.exclude(enterTransition, R.id.guided_button_actions_background,
+                        true);
                 TransitionHelper.exclude(enterTransition, R.id.guidedactions_selector, true);
                 TransitionHelper.setEnterTransition(this, enterTransition);
                 Object exitTransition = TransitionHelper.createFadeAndShortSlide(Gravity.START);
-                TransitionHelper.exclude(exitTransition, R.id.guidedactions_background, true);
+                TransitionHelper.exclude(exitTransition, R.id.action_fragment_background, true);
+                TransitionHelper.exclude(exitTransition, R.id.guided_button_actions_background,
+                        true);
                 TransitionHelper.exclude(exitTransition, R.id.guidedactions_selector, true);
                 TransitionHelper.setExitTransition(this, exitTransition);
             } else if (getUiStyle() == UI_STYLE_ENTRANCE) {
                 Object enterTransition = TransitionHelper.createFadeAndShortSlide(Gravity.END |
                         Gravity.START);
                 TransitionHelper.include(enterTransition, R.id.content_fragment);
-                TransitionHelper.include(enterTransition, R.id.action_fragment);
+                TransitionHelper.include(enterTransition, R.id.action_fragment_background);
+                TransitionHelper.include(enterTransition, R.id.guided_button_actions_background);
+                TransitionHelper.include(enterTransition, R.id.guidedactions_selector);
+                TransitionHelper.include(enterTransition, R.id.guidedactions_list);
                 TransitionHelper.setEnterTransition(this, enterTransition);
                 // exit transition is unchanged, same as UI_STYLE_DEFAULT
             } else if (getUiStyle() == UI_STYLE_ACTIVITY_ROOT) {
@@ -753,8 +884,23 @@
                 mSelectedIndex = state.getInt(EXTRA_ACTION_SELECTED_INDEX, -1);
             }
         }
-        mActions.clear();
-        onCreateActions(mActions, savedInstanceState);
+        ArrayList<GuidedAction> actions = new ArrayList<GuidedAction>();
+        onCreateActions(actions, savedInstanceState);
+        setActions(actions);
+        ArrayList<GuidedAction> buttonActions = new ArrayList<GuidedAction>();
+        onCreateButtonActions(buttonActions, savedInstanceState);
+        setButtonActions(buttonActions);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onDestroyView() {
+        mGuidanceStylist.onDestroyView();
+        mActionsStylist.onDestroyView();
+        mButtonActionsStylist.onDestroyView();
+        super.onDestroyView();
     }
 
     /**
@@ -779,6 +925,13 @@
         View actionsView = mActionsStylist.onCreateView(inflater, actionContainer);
         actionContainer.addView(actionsView);
 
+        View buttonActionsView = mButtonActionsStylist.onCreateView(inflater, actionContainer);
+        actionContainer.addView(buttonActionsView);
+        View bg = buttonActionsView.findViewById(R.id.guided_button_actions_background);
+        if (bg != null) {
+            bg.setVisibility(View.VISIBLE);
+        }
+
         GuidedActionAdapter.EditListener editListener = new GuidedActionAdapter.EditListener() {
 
                 @Override
@@ -797,17 +950,44 @@
                 }
         };
 
-        mAdapter = new GuidedActionAdapter(mActions, this, this, editListener, mActionsStylist);
+        mAdapter = new GuidedActionAdapter(mActions, this, this, editListener,
+                mActionsStylist);
+        mButtonAdapter = new GuidedActionAdapter(mButtonActions, this, this, editListener,
+                mButtonActionsStylist);
 
-        mListView = mActionsStylist.getActionsGridView();
-        mListView.setAdapter(mAdapter);
+        mActionsStylist.getActionsGridView().setAdapter(mAdapter);
+        mButtonActionsStylist.getActionsGridView().setAdapter(mButtonAdapter);
+        if (mButtonActions.size() == 0) {
+            buttonActionsView.setVisibility(View.GONE);
+        } else {
+            Context ctx = mThemeWrapper != null ? mThemeWrapper : getActivity();
+            TypedValue typedValue = new TypedValue();
+            if (ctx.getTheme().resolveAttribute(R.attr.guidedActionContentWidthWeightTwoPanels,
+                    typedValue, true)) {
+                View actionsRoot = v.findViewById(R.id.action_fragment_root);
+                float weight = typedValue.getFloat();
+                LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) actionsRoot
+                        .getLayoutParams();
+                lp.weight = weight;
+                actionsRoot.setLayoutParams(lp);
+            }
+        }
+
         int pos = (mSelectedIndex >= 0 && mSelectedIndex < mActions.size()) ?
                 mSelectedIndex : getFirstCheckedAction();
-        mListView.setSelectedPosition(pos);
+        setSelectedActionPosition(pos);
+
+        setSelectedButtonActionPosition(0);
 
         return v;
     }
 
+    @Override
+    public void onResume() {
+        super.onResume();
+        mActionsStylist.getActionsGridView().requestFocus();
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -815,7 +995,8 @@
     public void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
         outState.putInt(EXTRA_ACTION_SELECTED_INDEX,
-                (mListView != null) ? getSelectedActionPosition() : mSelectedIndex);
+                (mActionsStylist.getActionsGridView() != null) ?
+                        getSelectedActionPosition() : mSelectedIndex);
     }
 
     private static boolean isGuidedStepTheme(Context context) {
@@ -927,9 +1108,11 @@
         if (entering) {
             mGuidanceStylist.onImeAppearing(animators);
             mActionsStylist.onImeAppearing(animators);
+            mButtonActionsStylist.onImeAppearing(animators);
         } else {
             mGuidanceStylist.onImeDisappearing(animators);
             mActionsStylist.onImeDisappearing(animators);
+            mButtonActionsStylist.onImeDisappearing(animators);
         }
         AnimatorSet set = new AnimatorSet();
         set.playTogether(animators);
diff --git a/v17/leanback/src/android/support/v17/leanback/app/GuidedStepSupportFragment.java b/v17/leanback/src/android/support/v17/leanback/app/GuidedStepSupportFragment.java
index fcd5103..5fb8521 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/GuidedStepSupportFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/GuidedStepSupportFragment.java
@@ -35,6 +35,7 @@
 import android.support.v17.leanback.widget.GuidedActionsStylist;
 import android.support.v17.leanback.widget.VerticalGridView;
 import android.support.v4.app.ActivityCompat;
+import android.support.v7.widget.RecyclerView;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.TypedValue;
@@ -46,6 +47,7 @@
 import android.view.ViewTreeObserver;
 import android.widget.ImageView;
 import android.widget.RelativeLayout;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import java.util.ArrayList;
@@ -123,6 +125,10 @@
  *
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedStepTheme
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedStepBackground
+ * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionContentWidthWeight
+ * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionContentWidthWeightTwoPanels
+ * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionsBackground
+ * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedButtonActionsBackground
  * @see GuidanceStylist
  * @see GuidanceStylist.Guidance
  * @see GuidedAction
@@ -207,10 +213,13 @@
     private ContextThemeWrapper mThemeWrapper;
     private GuidanceStylist mGuidanceStylist;
     private GuidedActionsStylist mActionsStylist;
+    private GuidedActionsStylist mButtonActionsStylist;
     private GuidedActionAdapter mAdapter;
-    private VerticalGridView mListView;
+    private GuidedActionAdapter mButtonAdapter;
     private List<GuidedAction> mActions = new ArrayList<GuidedAction>();
+    private List<GuidedAction> mButtonActions = new ArrayList<GuidedAction>();
     private int mSelectedIndex = -1;
+    private int mButtonSelectedIndex = -1;
 
     public GuidedStepSupportFragment() {
         // We need to supply the theme before any potential call to onInflate in order
@@ -218,6 +227,7 @@
         mTheme = onProvideTheme();
         mGuidanceStylist = onCreateGuidanceStylist();
         mActionsStylist = onCreateActionsStylist();
+        mButtonActionsStylist = onCreateButtonActionsStylist();
         onProvideFragmentTransitions();
     }
 
@@ -240,6 +250,15 @@
     }
 
     /**
+     * Creates the presenter used to style a sided actions panel for button only.
+     * The default implementation returns a basic GuidedActionsStylist.
+     * @return The GuidedActionsStylist used in this fragment.
+     */
+    public GuidedActionsStylist onCreateButtonActionsStylist() {
+        return new GuidedActionsStylist();
+    }
+
+    /**
      * Returns the theme used for styling the fragment. The default returns -1, indicating that the
      * host Activity's theme should be used.
      * @return The theme resource ID of the theme to use in this fragment, or -1 to use the
@@ -271,6 +290,16 @@
     }
 
     /**
+     * Fills out the set of actions shown at right available to the user. This hook is called during
+     * {@link #onCreate}. The default leaves the list of actions empty; subclasses may override.
+     * @param actions A non-null, empty list ready to be populated.
+     * @param savedInstanceState The saved instance state from onCreate.
+     */
+    public void onCreateButtonActions(@NonNull List<GuidedAction> actions,
+            Bundle savedInstanceState) {
+    }
+
+    /**
      * Callback invoked when an action is taken by the user. Subclasses should override in
      * order to act on the user's decisions.
      * @param action The chosen action.
@@ -504,6 +533,99 @@
     }
 
     /**
+     * Returns the list of button GuidedActions that the user may take in this fragment.
+     * @return The list of button GuidedActions for this fragment.
+     */
+    public List<GuidedAction> getButtonActions() {
+        return mButtonActions;
+    }
+
+    /**
+     * Find button GuidedAction by Id.
+     * @param id  Id of the button action to search.
+     * @return  GuidedAction object or null if not found.
+     */
+    public GuidedAction findButtonActionById(long id) {
+        int index = findButtonActionPositionById(id);
+        return index >= 0 ? mButtonActions.get(index) : null;
+    }
+
+    /**
+     * Find button GuidedAction position in array by Id.
+     * @param id  Id of the button action to search.
+     * @return  position of GuidedAction object in array or -1 if not found.
+     */
+    public int findButtonActionPositionById(long id) {
+        if (mButtonActions != null) {
+            for (int i = 0; i < mButtonActions.size(); i++) {
+                GuidedAction action = mButtonActions.get(i);
+                if (mButtonActions.get(i).getId() == id) {
+                    return i;
+                }
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Returns the GuidedActionsStylist that displays the button actions the user may take.
+     * @return The GuidedActionsStylist for this fragment.
+     */
+    public GuidedActionsStylist getGuidedButtonActionsStylist() {
+        return mButtonActionsStylist;
+    }
+
+    /**
+     * Sets the list of button GuidedActions that the user may take in this fragment.
+     * @param actions The list of button GuidedActions for this fragment.
+     */
+    public void setButtonActions(List<GuidedAction> actions) {
+        mButtonActions = actions;
+        if (mButtonAdapter != null) {
+            mButtonAdapter.setActions(mButtonActions);
+        }
+    }
+
+    /**
+     * Notify an button action has changed and update its UI.
+     * @param position Position of the button GuidedAction in array.
+     */
+    public void notifyButtonActionChanged(int position) {
+        if (mButtonAdapter != null) {
+            mButtonAdapter.notifyItemChanged(position);
+        }
+    }
+
+    /**
+     * Returns the view corresponding to the button action at the indicated position in the list of
+     * actions for this fragment.
+     * @param position The integer position of the button action of interest.
+     * @return The View corresponding to the button action at the indicated position, or null if
+     * that action is not currently onscreen.
+     */
+    public View getButtonActionItemView(int position) {
+        final RecyclerView.ViewHolder holder = mButtonActionsStylist.getActionsGridView()
+                    .findViewHolderForPosition(position);
+        return holder == null ? null : holder.itemView;
+    }
+
+    /**
+     * Scrolls the action list to the position indicated, selecting that button action's view.
+     * @param position The integer position of the button action of interest.
+     */
+    public void setSelectedButtonActionPosition(int position) {
+        mButtonActionsStylist.getActionsGridView().setSelectedPosition(position);
+    }
+
+    /**
+     * Returns the position if the currently selected button GuidedAction.
+     * @return position The integer position of the currently selected button action.
+     */
+    public int getSelectedButtonActionPosition() {
+        return mButtonActionsStylist.getActionsGridView().getSelectedPosition();
+    }
+
+    /**
      * Returns the list of GuidedActions that the user may take in this fragment.
      * @return The list of GuidedActions for this fragment.
      */
@@ -567,7 +689,9 @@
      * action is not currently onscreen.
      */
     public View getActionItemView(int position) {
-        return mListView.findViewHolderForPosition(position).itemView;
+        final RecyclerView.ViewHolder holder = mActionsStylist.getActionsGridView()
+                    .findViewHolderForPosition(position);
+        return holder == null ? null : holder.itemView;
     }
 
     /**
@@ -575,7 +699,7 @@
      * @param position The integer position of the action of interest.
      */
     public void setSelectedActionPosition(int position) {
-        mListView.setSelectedPosition(position);
+        mActionsStylist.getActionsGridView().setSelectedPosition(position);
     }
 
     /**
@@ -583,7 +707,7 @@
      * @return position The integer position of the currently selected action.
      */
     public int getSelectedActionPosition() {
-        return mListView.getSelectedPosition();
+        return mActionsStylist.getActionsGridView().getSelectedPosition();
     }
 
     /**
@@ -604,18 +728,25 @@
         if (Build.VERSION.SDK_INT >= 21) {
             if (getUiStyle() == UI_STYLE_DEFAULT) {
                 Object enterTransition = TransitionHelper.createFadeAndShortSlide(Gravity.END);
-                TransitionHelper.exclude(enterTransition, R.id.guidedactions_background, true);
+                TransitionHelper.exclude(enterTransition, R.id.action_fragment_background, true);
+                TransitionHelper.exclude(enterTransition, R.id.guided_button_actions_background,
+                        true);
                 TransitionHelper.exclude(enterTransition, R.id.guidedactions_selector, true);
                 TransitionHelper.setEnterTransition(this, enterTransition);
                 Object exitTransition = TransitionHelper.createFadeAndShortSlide(Gravity.START);
-                TransitionHelper.exclude(exitTransition, R.id.guidedactions_background, true);
+                TransitionHelper.exclude(exitTransition, R.id.action_fragment_background, true);
+                TransitionHelper.exclude(exitTransition, R.id.guided_button_actions_background,
+                        true);
                 TransitionHelper.exclude(exitTransition, R.id.guidedactions_selector, true);
                 TransitionHelper.setExitTransition(this, exitTransition);
             } else if (getUiStyle() == UI_STYLE_ENTRANCE) {
                 Object enterTransition = TransitionHelper.createFadeAndShortSlide(Gravity.END |
                         Gravity.START);
                 TransitionHelper.include(enterTransition, R.id.content_fragment);
-                TransitionHelper.include(enterTransition, R.id.action_fragment);
+                TransitionHelper.include(enterTransition, R.id.action_fragment_background);
+                TransitionHelper.include(enterTransition, R.id.guided_button_actions_background);
+                TransitionHelper.include(enterTransition, R.id.guidedactions_selector);
+                TransitionHelper.include(enterTransition, R.id.guidedactions_list);
                 TransitionHelper.setEnterTransition(this, enterTransition);
                 // exit transition is unchanged, same as UI_STYLE_DEFAULT
             } else if (getUiStyle() == UI_STYLE_ACTIVITY_ROOT) {
@@ -755,8 +886,23 @@
                 mSelectedIndex = state.getInt(EXTRA_ACTION_SELECTED_INDEX, -1);
             }
         }
-        mActions.clear();
-        onCreateActions(mActions, savedInstanceState);
+        ArrayList<GuidedAction> actions = new ArrayList<GuidedAction>();
+        onCreateActions(actions, savedInstanceState);
+        setActions(actions);
+        ArrayList<GuidedAction> buttonActions = new ArrayList<GuidedAction>();
+        onCreateButtonActions(buttonActions, savedInstanceState);
+        setButtonActions(buttonActions);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onDestroyView() {
+        mGuidanceStylist.onDestroyView();
+        mActionsStylist.onDestroyView();
+        mButtonActionsStylist.onDestroyView();
+        super.onDestroyView();
     }
 
     /**
@@ -781,6 +927,13 @@
         View actionsView = mActionsStylist.onCreateView(inflater, actionContainer);
         actionContainer.addView(actionsView);
 
+        View buttonActionsView = mButtonActionsStylist.onCreateView(inflater, actionContainer);
+        actionContainer.addView(buttonActionsView);
+        View bg = buttonActionsView.findViewById(R.id.guided_button_actions_background);
+        if (bg != null) {
+            bg.setVisibility(View.VISIBLE);
+        }
+
         GuidedActionAdapter.EditListener editListener = new GuidedActionAdapter.EditListener() {
 
                 @Override
@@ -799,17 +952,44 @@
                 }
         };
 
-        mAdapter = new GuidedActionAdapter(mActions, this, this, editListener, mActionsStylist);
+        mAdapter = new GuidedActionAdapter(mActions, this, this, editListener,
+                mActionsStylist);
+        mButtonAdapter = new GuidedActionAdapter(mButtonActions, this, this, editListener,
+                mButtonActionsStylist);
 
-        mListView = mActionsStylist.getActionsGridView();
-        mListView.setAdapter(mAdapter);
+        mActionsStylist.getActionsGridView().setAdapter(mAdapter);
+        mButtonActionsStylist.getActionsGridView().setAdapter(mButtonAdapter);
+        if (mButtonActions.size() == 0) {
+            buttonActionsView.setVisibility(View.GONE);
+        } else {
+            Context ctx = mThemeWrapper != null ? mThemeWrapper : getActivity();
+            TypedValue typedValue = new TypedValue();
+            if (ctx.getTheme().resolveAttribute(R.attr.guidedActionContentWidthWeightTwoPanels,
+                    typedValue, true)) {
+                View actionsRoot = v.findViewById(R.id.action_fragment_root);
+                float weight = typedValue.getFloat();
+                LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) actionsRoot
+                        .getLayoutParams();
+                lp.weight = weight;
+                actionsRoot.setLayoutParams(lp);
+            }
+        }
+
         int pos = (mSelectedIndex >= 0 && mSelectedIndex < mActions.size()) ?
                 mSelectedIndex : getFirstCheckedAction();
-        mListView.setSelectedPosition(pos);
+        setSelectedActionPosition(pos);
+
+        setSelectedButtonActionPosition(0);
 
         return v;
     }
 
+    @Override
+    public void onResume() {
+        super.onResume();
+        mActionsStylist.getActionsGridView().requestFocus();
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -817,7 +997,8 @@
     public void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
         outState.putInt(EXTRA_ACTION_SELECTED_INDEX,
-                (mListView != null) ? getSelectedActionPosition() : mSelectedIndex);
+                (mActionsStylist.getActionsGridView() != null) ?
+                        getSelectedActionPosition() : mSelectedIndex);
     }
 
     private static boolean isGuidedStepTheme(Context context) {
@@ -929,9 +1110,11 @@
         if (entering) {
             mGuidanceStylist.onImeAppearing(animators);
             mActionsStylist.onImeAppearing(animators);
+            mButtonActionsStylist.onImeAppearing(animators);
         } else {
             mGuidanceStylist.onImeDisappearing(animators);
             mActionsStylist.onImeDisappearing(animators);
+            mButtonActionsStylist.onImeDisappearing(animators);
         }
         AnimatorSet set = new AnimatorSet();
         set.playTogether(animators);
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/GuidanceStylist.java b/v17/leanback/src/android/support/v17/leanback/widget/GuidanceStylist.java
index fd05b8e..3485e93 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/GuidanceStylist.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/GuidanceStylist.java
@@ -173,6 +173,12 @@
     }
 
     /**
+     * Called when destroy the View created by GuidanceStylist.
+     */
+    public void onDestroyView() {
+    }
+
+    /**
      * Provides the resource ID of the layout defining the guidance view. Subclasses may override
      * to provide their own customized layouts. The base implementation returns
      * {@link android.support.v17.leanback.R.layout#lb_guidance}. If overridden, the substituted
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java
index fc43d53..076dc11 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java
@@ -91,7 +91,6 @@
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedStepImeDisappearingAnimation
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionsSelectorShowAnimation
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionsSelectorHideAnimation
- * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionsContainerStyle
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionsSelectorStyle
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionsListStyle
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionItemContainerStyle
@@ -107,8 +106,6 @@
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionUnpressedAnimation
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionEnabledChevronAlpha
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionDisabledChevronAlpha
- * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionContentWidth
- * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionContentWidthNoIcon
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionTitleMinLines
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionTitleMaxLines
  * @attr ref android.support.v17.leanback.R.styleable#LeanbackGuidedStepTheme_guidedActionDescriptionMinLines
@@ -253,8 +250,6 @@
     private float mDisabledDescriptionAlpha;
     private float mEnabledChevronAlpha;
     private float mDisabledChevronAlpha;
-    private int mContentWidth;
-    private int mContentWidthNoIcon;
     private int mTitleMinLines;
     private int mTitleMaxLines;
     private int mDescriptionMinLines;
@@ -291,27 +286,10 @@
             }
         }
 
-        mActionsGridView.requestFocusFromTouch();
-
         if (mSelectorView != null) {
             // ALlow focus to move to other views
             mActionsGridView.getViewTreeObserver().addOnGlobalFocusChangeListener(
-                    new ViewTreeObserver.OnGlobalFocusChangeListener() {
-                        private boolean mChildFocused;
-
-                        @Override
-                        public void onGlobalFocusChanged(View oldFocus, View newFocus) {
-                            View focusedChild = mActionsGridView.getFocusedChild();
-                            if (focusedChild == null) {
-                                mSelectorView.setVisibility(View.INVISIBLE);
-                                mChildFocused = false;
-                            } else if (!mChildFocused) {
-                                mChildFocused = true;
-                                mSelectorView.setVisibility(View.VISIBLE);
-                                updateSelectorView(focusedChild);
-                            }
-                        }
-                    });
+                    mGlobalFocusChangeListener);
         }
 
         // Cache widths, chevron alpha values, max and min text lines, etc
@@ -319,8 +297,6 @@
         TypedValue val = new TypedValue();
         mEnabledChevronAlpha = getFloat(ctx, val, R.attr.guidedActionEnabledChevronAlpha);
         mDisabledChevronAlpha = getFloat(ctx, val, R.attr.guidedActionDisabledChevronAlpha);
-        mContentWidth = getDimension(ctx, val, R.attr.guidedActionContentWidth);
-        mContentWidthNoIcon = getDimension(ctx, val, R.attr.guidedActionContentWidthNoIcon);
         mTitleMinLines = getInteger(ctx, val, R.attr.guidedActionTitleMinLines);
         mTitleMaxLines = getInteger(ctx, val, R.attr.guidedActionTitleMaxLines);
         mDescriptionMinLines = getInteger(ctx, val, R.attr.guidedActionDescriptionMinLines);
@@ -339,6 +315,43 @@
         return mMainView;
     }
 
+    final ViewTreeObserver.OnGlobalFocusChangeListener mGlobalFocusChangeListener =
+            new ViewTreeObserver.OnGlobalFocusChangeListener() {
+        private boolean mChildFocused;
+
+        @Override
+        public void onGlobalFocusChanged(View oldFocus, View newFocus) {
+            final View focusedChild = mActionsGridView.getFocusedChild();
+            if (focusedChild == null) {
+                mSelectorView.setVisibility(View.INVISIBLE);
+                mChildFocused = false;
+            } else if (!mChildFocused) {
+                mChildFocused = true;
+                mSelectorView.setVisibility(View.VISIBLE);
+                // Change Selector size in a post Runnable, doing it directly in
+                // GlobalFocusChangeListener does not trigger the layout pass.
+                mSelectorView.post(new Runnable() {
+                    public void run() {
+                        int height = focusedChild.getHeight();
+                        LayoutParams lp = mSelectorView.getLayoutParams();
+                        lp.height = height;
+                        mSelectorView.setLayoutParams(lp);
+                    }
+                });
+            }
+        }
+    };
+
+    /**
+     * Called when destroy the View created by GuidedActionsStylist.
+     */
+    public void onDestroyView() {
+        if (mSelectorView != null) {
+            mActionsGridView.getViewTreeObserver().removeOnGlobalFocusChangeListener(
+                    mGlobalFocusChangeListener);
+        }
+    }
+
     /**
      * Returns the VerticalGridView that displays the list of GuidedActions.
      * @return The VerticalGridView for this presenter.
@@ -468,18 +481,8 @@
             vh.mCheckmarkView.setVisibility(action.isChecked() ? View.VISIBLE : View.INVISIBLE);
         }
 
-        if (vh.mContentView != null) {
-            ViewGroup.LayoutParams contentLp = vh.mContentView.getLayoutParams();
-            if (setIcon(vh.mIconView, action)) {
-                contentLp.width = mContentWidth;
-            } else {
-                contentLp.width = mContentWidthNoIcon;
-            }
-            vh.mContentView.setLayoutParams(contentLp);
-        }
-
         if (vh.mChevronView != null) {
-            vh.mChevronView.setVisibility(action.hasNext() ? View.VISIBLE : View.INVISIBLE);
+            vh.mChevronView.setVisibility(action.hasNext() ? View.VISIBLE : View.GONE);
             vh.mChevronView.setAlpha(action.isEnabled() ? mEnabledChevronAlpha :
                     mDisabledChevronAlpha);
         }
@@ -646,15 +649,6 @@
      * ==========================================
      */
 
-    private void updateSelectorView(View focusedChild) {
-        // Display the selector view.
-        int height = focusedChild.getHeight();
-        LayoutParams lp = mSelectorView.getLayoutParams();
-        lp.height = height;
-        mSelectorView.setLayoutParams(lp);
-        mSelectorView.setAlpha(1f);
-    }
-
     private float getFloat(Context ctx, TypedValue typedValue, int attrId) {
         ctx.getTheme().resolveAttribute(attrId, typedValue, true);
         // Android resources don't have a native float type, so we have to use strings.