diff --git a/samples/SupportLeanbackDemos/AndroidManifest.xml b/samples/SupportLeanbackDemos/AndroidManifest.xml
index daaf5bf20..a17b1a95e 100644
--- a/samples/SupportLeanbackDemos/AndroidManifest.xml
+++ b/samples/SupportLeanbackDemos/AndroidManifest.xml
@@ -98,6 +98,16 @@
android:windowSoftInputMode="adjustResize"
android:exported="true" />
+
+
+
+
diff --git a/samples/SupportLeanbackDemos/generatev4.py b/samples/SupportLeanbackDemos/generatev4.py
index 4e32d5703..febc078dd 100755
--- a/samples/SupportLeanbackDemos/generatev4.py
+++ b/samples/SupportLeanbackDemos/generatev4.py
@@ -16,6 +16,7 @@
import os
import sys
+import getopt
def write_java_head(tofile, name):
tofile.write("/* This file is auto-generated from {}.java. DO NOT MODIFY. */\n\n".format(name))
@@ -36,6 +37,20 @@ for line in file:
file.close()
outfile.close()
+file = open('src/com/example/android/leanback/GuidedStepHalfScreenActivity.java', 'r')
+outfile = open('src/com/example/android/leanback/GuidedStepSupportHalfScreenActivity.java', 'w')
+write_java_head(outfile, "GuidedStepHalfScreenActivity")
+for line in file:
+ line = line.replace('android.app.Fragment', 'android.support.v4.app.Fragment')
+ line = line.replace('android.app.Activity', 'android.support.v4.app.FragmentActivity')
+ line = line.replace('GuidedStepFragment', 'GuidedStepSupportFragment')
+ line = line.replace('GuidedStepActivity', 'GuidedStepSupportActivity')
+ line = line.replace('GuidedStepHalfScreenActivity', 'GuidedStepSupportHalfScreenActivity')
+ line = line.replace('extends Activity', 'extends FragmentActivity')
+ outfile.write(line)
+file.close()
+outfile.close()
+
file = open('src/com/example/android/leanback/BrowseFragment.java', 'r')
outfile = open('src/com/example/android/leanback/BrowseSupportFragment.java', 'w')
write_java_head(outfile, "BrowseFragment")
@@ -49,6 +64,7 @@ for line in file:
line = line.replace('DetailsActivity', 'DetailsSupportActivity')
line = line.replace('SearchActivity', 'SearchSupportActivity')
line = line.replace('RowsActivity', 'RowsSupportActivity')
+ line = line.replace('GuidedStepHalfScreenActivity', 'GuidedStepSupportHalfScreenActivity')
outfile.write(line)
file.close()
outfile.close()
diff --git a/samples/SupportLeanbackDemos/res/values/strings.xml b/samples/SupportLeanbackDemos/res/values/strings.xml
index 7b98e07f6..34a0b5f99 100644
--- a/samples/SupportLeanbackDemos/res/values/strings.xml
+++ b/samples/SupportLeanbackDemos/res/values/strings.xml
@@ -46,8 +46,10 @@
Vertical Grid(support version)
VerticalGridSupportFragment test
Guided Step
+ Guided Step Half Screen
GuidedStepFragment test
Guided Step(support version)
+ Guided Step Half Screen(support version)
GuidedStepSupportFragment test
Browse Error
BrowseError test
diff --git a/samples/SupportLeanbackDemos/res/values/themes.xml b/samples/SupportLeanbackDemos/res/values/themes.xml
index 1fdf46bf5..1a87f9492 100644
--- a/samples/SupportLeanbackDemos/res/values/themes.xml
+++ b/samples/SupportLeanbackDemos/res/values/themes.xml
@@ -35,4 +35,6 @@
+
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java
index 93110a961..d9cd73112 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java
@@ -16,7 +16,6 @@ package com.example.android.leanback;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v4.app.ActivityOptionsCompat;
import android.support.v17.leanback.app.GuidedStepFragment;
import android.support.v17.leanback.widget.ArrayObjectAdapter;
import android.support.v17.leanback.widget.HeaderItem;
@@ -28,6 +27,7 @@ import android.support.v17.leanback.widget.OnItemViewSelectedListener;
import android.support.v17.leanback.widget.Presenter;
import android.support.v17.leanback.widget.Row;
import android.support.v17.leanback.widget.RowPresenter;
+import android.support.v4.app.ActivityOptionsCompat;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -111,8 +111,8 @@ public class BrowseFragment extends android.support.v17.leanback.app.BrowseFragm
listRowAdapter.add(new PhotoItem("This is a test", "Only a test", R.drawable.gallery_photo_2));
listRowAdapter.add(new PhotoItem("Android TV", "by Google", R.drawable.gallery_photo_3));
listRowAdapter.add(new PhotoItem("Leanback", R.drawable.gallery_photo_4));
- listRowAdapter.add(new PhotoItem("Hello world", R.drawable.gallery_photo_5));
- listRowAdapter.add(new PhotoItem("This is a test", "Open GuidedStepFragment", R.drawable.gallery_photo_6));
+ listRowAdapter.add(new PhotoItem("GuidedStep (Slide left/right)", R.drawable.gallery_photo_5));
+ listRowAdapter.add(new PhotoItem("GuidedStep (Slide bottom up)", "Open GuidedStepFragment", R.drawable.gallery_photo_6));
listRowAdapter.add(new PhotoItem("Android TV", "open RowsActivity", R.drawable.gallery_photo_7));
listRowAdapter.add(new PhotoItem("Leanback", "open BrowseActivity", R.drawable.gallery_photo_8));
HeaderItem header = new HeaderItem(i, "Row " + i);
@@ -130,9 +130,13 @@ public class BrowseFragment extends android.support.v17.leanback.app.BrowseFragm
Bundle bundle;
if (((PhotoItem) item).getImageResourceId() == R.drawable.gallery_photo_6) {
GuidedStepFragment.add(getFragmentManager(),
- new GuidedStepActivity.FirstStepFragment(),
+ new GuidedStepHalfScreenActivity.FirstStepFragment(),
R.id.lb_guidedstep_host);
return;
+ } else if (((PhotoItem) item).getImageResourceId() == R.drawable.gallery_photo_5) {
+ GuidedStepFragment.add(getFragmentManager(),
+ new GuidedStepActivity.FirstStepFragment(), R.id.lb_guidedstep_host);
+ return;
} else if ( ((PhotoItem) item).getImageResourceId() == R.drawable.gallery_photo_8) {
intent = new Intent(getActivity(), BrowseActivity.class);
bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity())
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseSupportFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseSupportFragment.java
index 50a07a3ba..2321178b2 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseSupportFragment.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseSupportFragment.java
@@ -18,7 +18,6 @@ package com.example.android.leanback;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v4.app.ActivityOptionsCompat;
import android.support.v17.leanback.app.GuidedStepSupportFragment;
import android.support.v17.leanback.widget.ArrayObjectAdapter;
import android.support.v17.leanback.widget.HeaderItem;
@@ -30,6 +29,7 @@ import android.support.v17.leanback.widget.OnItemViewSelectedListener;
import android.support.v17.leanback.widget.Presenter;
import android.support.v17.leanback.widget.Row;
import android.support.v17.leanback.widget.RowPresenter;
+import android.support.v4.app.ActivityOptionsCompat;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -113,8 +113,8 @@ public class BrowseSupportFragment extends android.support.v17.leanback.app.Brow
listRowAdapter.add(new PhotoItem("This is a test", "Only a test", R.drawable.gallery_photo_2));
listRowAdapter.add(new PhotoItem("Android TV", "by Google", R.drawable.gallery_photo_3));
listRowAdapter.add(new PhotoItem("Leanback", R.drawable.gallery_photo_4));
- listRowAdapter.add(new PhotoItem("Hello world", R.drawable.gallery_photo_5));
- listRowAdapter.add(new PhotoItem("This is a test", "Open GuidedStepSupportFragment", R.drawable.gallery_photo_6));
+ listRowAdapter.add(new PhotoItem("GuidedStep (Slide left/right)", R.drawable.gallery_photo_5));
+ listRowAdapter.add(new PhotoItem("GuidedStep (Slide bottom up)", "Open GuidedStepSupportFragment", R.drawable.gallery_photo_6));
listRowAdapter.add(new PhotoItem("Android TV", "open RowsSupportActivity", R.drawable.gallery_photo_7));
listRowAdapter.add(new PhotoItem("Leanback", "open BrowseSupportActivity", R.drawable.gallery_photo_8));
HeaderItem header = new HeaderItem(i, "Row " + i);
@@ -132,9 +132,13 @@ public class BrowseSupportFragment extends android.support.v17.leanback.app.Brow
Bundle bundle;
if (((PhotoItem) item).getImageResourceId() == R.drawable.gallery_photo_6) {
GuidedStepSupportFragment.add(getFragmentManager(),
- new GuidedStepSupportActivity.FirstStepFragment(),
+ new GuidedStepSupportHalfScreenActivity.FirstStepFragment(),
R.id.lb_guidedstep_host);
return;
+ } else if (((PhotoItem) item).getImageResourceId() == R.drawable.gallery_photo_5) {
+ GuidedStepSupportFragment.add(getFragmentManager(),
+ new GuidedStepSupportActivity.FirstStepFragment(), R.id.lb_guidedstep_host);
+ return;
} else if ( ((PhotoItem) item).getImageResourceId() == R.drawable.gallery_photo_8) {
intent = new Intent(getActivity(), BrowseSupportActivity.class);
bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity())
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepActivity.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepActivity.java
index 1c199e053..c4e0d0093 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepActivity.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepActivity.java
@@ -24,12 +24,12 @@ import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v17.leanback.app.GuidedStepFragment;
-import android.support.v17.leanback.widget.GuidedAction;
-import android.support.v17.leanback.widget.GuidedDatePickerAction;
-import android.support.v17.leanback.widget.GuidedActionsStylist;
import android.support.v17.leanback.widget.GuidanceStylist;
import android.support.v17.leanback.widget.GuidanceStylist.Guidance;
+import android.support.v17.leanback.widget.GuidedAction;
+import android.support.v17.leanback.widget.GuidedActionsStylist;
import android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder;
+import android.support.v17.leanback.widget.GuidedDatePickerAction;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Log;
@@ -172,6 +172,7 @@ public class GuidedStepActivity extends Activity {
}
public static class FirstStepFragment extends GuidedStepFragment {
+
@Override
public int onProvideTheme() {
return R.style.Theme_Example_Leanback_GuidedStep_First;
@@ -208,7 +209,6 @@ public class GuidedStepActivity extends Activity {
finishGuidedStepFragments();
}
}
-
}
static ArrayList sCards = new ArrayList();
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepHalfScreenActivity.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepHalfScreenActivity.java
new file mode 100644
index 000000000..4e8b33f82
--- /dev/null
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepHalfScreenActivity.java
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+
+package com.example.android.leanback;
+
+import android.app.Activity;
+import android.app.FragmentManager;
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.support.v17.leanback.app.GuidedStepFragment;
+import android.support.v17.leanback.widget.GuidanceStylist;
+import android.support.v17.leanback.widget.GuidanceStylist.Guidance;
+import android.support.v17.leanback.widget.GuidedAction;
+import android.util.Log;
+
+import java.util.List;
+
+/**
+ * Activity that showcases different aspects of GuidedStepFragments in half
+ * screen mode. This is achieved by setting the theme for this activity
+ * to {@code Theme.Example.Leanback.GuidedStep.Half}.
+ */
+public class GuidedStepHalfScreenActivity extends Activity {
+ private static final String TAG = "leanback.GuidedStepSupportHalfScreenActivity";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ Log.v(TAG, "onCreate");
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.guided_step_activity);
+ GuidedStepFragment.addAsRoot(this, new FirstStepFragment(), R.id.lb_guidedstep_host);
+ }
+
+ public static class FirstStepFragment extends GuidedStepFragment {
+
+ @Override
+ public Guidance onCreateGuidance(Bundle savedInstanceState) {
+ String title = getString(R.string.guidedstep_first_title);
+ String breadcrumb = getString(R.string.guidedstep_first_breadcrumb);
+ String description = getString(R.string.guidedstep_first_description);
+ Drawable icon = getActivity().getResources().getDrawable(R.drawable.ic_main_icon);
+ return new Guidance(title, description, breadcrumb, icon);
+ }
+
+ @Override
+ public void onCreateActions(List actions, Bundle savedInstanceState) {
+ Context context = getActivity();
+ actions.add(new GuidedAction.Builder(context)
+ .clickAction(GuidedAction.ACTION_ID_CONTINUE)
+ .description("Just do it")
+ .build());
+ actions.add(new GuidedAction.Builder(context)
+ .clickAction(GuidedAction.ACTION_ID_CANCEL)
+ .description("Never mind")
+ .build());
+ }
+
+ public FirstStepFragment() {
+ setEntranceTransitionType(GuidedStepFragment.SLIDE_FROM_BOTTOM);
+ }
+
+ /**
+ * This fragment could be used by an activity using theme
+ * {@code Theme.Leanback.GuidedStep.Half} or something else (BrowseActivity).
+ * In order to provide a consistent half screen experience under
+ * both scenarios, we override onProvideTheme method.
+ */
+ @Override
+ public int onProvideTheme() {
+ return R.style.Theme_Example_Leanback_GuidedStep_Half;
+ }
+
+ @Override
+ public void onGuidedActionClicked(GuidedAction action) {
+ FragmentManager fm = getFragmentManager();
+ if (action.getId() == GuidedAction.ACTION_ID_CONTINUE) {
+ GuidedStepFragment.add(fm, new SecondStepFragment(), R.id.lb_guidedstep_host);
+ } else if (action.getId() == GuidedAction.ACTION_ID_CANCEL){
+ finishGuidedStepFragments();
+ }
+ }
+ }
+
+ public static class SecondStepFragment extends GuidedStepFragment {
+
+ @Override
+ public int onProvideTheme() {
+ return R.style.Theme_Example_Leanback_GuidedStep_Half;
+ }
+
+ @Override
+ public Guidance onCreateGuidance(Bundle savedInstanceState) {
+ String title = getString(R.string.guidedstep_second_title);
+ String breadcrumb = getString(R.string.guidedstep_second_breadcrumb);
+ String description = getString(R.string.guidedstep_second_description);
+ Drawable icon = getActivity().getResources().getDrawable(R.drawable.ic_main_icon);
+ return new Guidance(title, description, breadcrumb, icon);
+ }
+
+ @Override
+ public void onCreateActions(List actions, Bundle savedInstanceState) {
+ Context context = getActivity();
+ actions.add(new GuidedAction.Builder(context)
+ .clickAction(GuidedAction.ACTION_ID_FINISH)
+ .description("Done")
+ .build());
+ actions.add(new GuidedAction.Builder(context)
+ .clickAction(GuidedAction.ACTION_ID_CANCEL)
+ .description("Never mind")
+ .build());
+ }
+
+ @Override
+ public void onCreateButtonActions(List actions, Bundle savedInstanceState) {
+ actions.add(new GuidedAction.Builder(getActivity())
+ .clickAction(GuidedAction.ACTION_ID_CANCEL)
+ .description("Cancel")
+ .build());
+ }
+
+ @Override
+ public void onGuidedActionClicked(GuidedAction action) {
+ FragmentManager fm = getFragmentManager();
+ fm.popBackStack();
+ }
+ }
+}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepSupportActivity.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepSupportActivity.java
index 0e527d92a..09eed7922 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepSupportActivity.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepSupportActivity.java
@@ -26,12 +26,12 @@ import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v17.leanback.app.GuidedStepSupportFragment;
-import android.support.v17.leanback.widget.GuidedAction;
-import android.support.v17.leanback.widget.GuidedDatePickerAction;
-import android.support.v17.leanback.widget.GuidedActionsStylist;
import android.support.v17.leanback.widget.GuidanceStylist;
import android.support.v17.leanback.widget.GuidanceStylist.Guidance;
+import android.support.v17.leanback.widget.GuidedAction;
+import android.support.v17.leanback.widget.GuidedActionsStylist;
import android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder;
+import android.support.v17.leanback.widget.GuidedDatePickerAction;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Log;
@@ -174,6 +174,7 @@ public class GuidedStepSupportActivity extends FragmentActivity {
}
public static class FirstStepFragment extends GuidedStepSupportFragment {
+
@Override
public int onProvideTheme() {
return R.style.Theme_Example_Leanback_GuidedStep_First;
@@ -210,7 +211,6 @@ public class GuidedStepSupportActivity extends FragmentActivity {
finishGuidedStepSupportFragments();
}
}
-
}
static ArrayList sCards = new ArrayList();
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepSupportHalfScreenActivity.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepSupportHalfScreenActivity.java
new file mode 100644
index 000000000..388a559fc
--- /dev/null
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepSupportHalfScreenActivity.java
@@ -0,0 +1,143 @@
+/* This file is auto-generated from GuidedStepHalfScreenActivity.java. DO NOT MODIFY. */
+
+/*
+ * 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.
+ */
+
+package com.example.android.leanback;
+
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentManager;
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.support.v17.leanback.app.GuidedStepSupportFragment;
+import android.support.v17.leanback.widget.GuidanceStylist;
+import android.support.v17.leanback.widget.GuidanceStylist.Guidance;
+import android.support.v17.leanback.widget.GuidedAction;
+import android.util.Log;
+
+import java.util.List;
+
+/**
+ * Activity that showcases different aspects of GuidedStepSupportFragments in half
+ * screen mode. This is achieved by setting the theme for this activity
+ * to {@code Theme.Example.Leanback.GuidedStep.Half}.
+ */
+public class GuidedStepSupportHalfScreenActivity extends FragmentActivity {
+ private static final String TAG = "leanback.GuidedStepSupportHalfScreenActivity";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ Log.v(TAG, "onCreate");
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.guided_step_activity);
+ GuidedStepSupportFragment.addAsRoot(this, new FirstStepFragment(), R.id.lb_guidedstep_host);
+ }
+
+ public static class FirstStepFragment extends GuidedStepSupportFragment {
+
+ @Override
+ public Guidance onCreateGuidance(Bundle savedInstanceState) {
+ String title = getString(R.string.guidedstep_first_title);
+ String breadcrumb = getString(R.string.guidedstep_first_breadcrumb);
+ String description = getString(R.string.guidedstep_first_description);
+ Drawable icon = getActivity().getResources().getDrawable(R.drawable.ic_main_icon);
+ return new Guidance(title, description, breadcrumb, icon);
+ }
+
+ @Override
+ public void onCreateActions(List actions, Bundle savedInstanceState) {
+ Context context = getActivity();
+ actions.add(new GuidedAction.Builder(context)
+ .clickAction(GuidedAction.ACTION_ID_CONTINUE)
+ .description("Just do it")
+ .build());
+ actions.add(new GuidedAction.Builder(context)
+ .clickAction(GuidedAction.ACTION_ID_CANCEL)
+ .description("Never mind")
+ .build());
+ }
+
+ public FirstStepFragment() {
+ setEntranceTransitionType(GuidedStepSupportFragment.SLIDE_FROM_BOTTOM);
+ }
+
+ /**
+ * This fragment could be used by an activity using theme
+ * {@code Theme.Leanback.GuidedStep.Half} or something else (BrowseActivity).
+ * In order to provide a consistent half screen experience under
+ * both scenarios, we override onProvideTheme method.
+ */
+ @Override
+ public int onProvideTheme() {
+ return R.style.Theme_Example_Leanback_GuidedStep_Half;
+ }
+
+ @Override
+ public void onGuidedActionClicked(GuidedAction action) {
+ FragmentManager fm = getFragmentManager();
+ if (action.getId() == GuidedAction.ACTION_ID_CONTINUE) {
+ GuidedStepSupportFragment.add(fm, new SecondStepFragment(), R.id.lb_guidedstep_host);
+ } else if (action.getId() == GuidedAction.ACTION_ID_CANCEL){
+ finishGuidedStepSupportFragments();
+ }
+ }
+ }
+
+ public static class SecondStepFragment extends GuidedStepSupportFragment {
+
+ @Override
+ public int onProvideTheme() {
+ return R.style.Theme_Example_Leanback_GuidedStep_Half;
+ }
+
+ @Override
+ public Guidance onCreateGuidance(Bundle savedInstanceState) {
+ String title = getString(R.string.guidedstep_second_title);
+ String breadcrumb = getString(R.string.guidedstep_second_breadcrumb);
+ String description = getString(R.string.guidedstep_second_description);
+ Drawable icon = getActivity().getResources().getDrawable(R.drawable.ic_main_icon);
+ return new Guidance(title, description, breadcrumb, icon);
+ }
+
+ @Override
+ public void onCreateActions(List actions, Bundle savedInstanceState) {
+ Context context = getActivity();
+ actions.add(new GuidedAction.Builder(context)
+ .clickAction(GuidedAction.ACTION_ID_FINISH)
+ .description("Done")
+ .build());
+ actions.add(new GuidedAction.Builder(context)
+ .clickAction(GuidedAction.ACTION_ID_CANCEL)
+ .description("Never mind")
+ .build());
+ }
+
+ @Override
+ public void onCreateButtonActions(List actions, Bundle savedInstanceState) {
+ actions.add(new GuidedAction.Builder(getActivity())
+ .clickAction(GuidedAction.ACTION_ID_CANCEL)
+ .description("Cancel")
+ .build());
+ }
+
+ @Override
+ public void onGuidedActionClicked(GuidedAction action) {
+ FragmentManager fm = getFragmentManager();
+ fm.popBackStack();
+ }
+ }
+}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/MainActivity.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/MainActivity.java
index c8af4b0ca..b26ebd536 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/MainActivity.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/MainActivity.java
@@ -20,13 +20,16 @@ import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import android.support.v4.app.ActivityOptionsCompat;
import android.support.v17.leanback.app.GuidedStepFragment;
-import android.support.v17.leanback.widget.GuidedAction;
import android.support.v17.leanback.widget.GuidanceStylist.Guidance;
+import android.support.v17.leanback.widget.GuidedAction;
+import android.support.v4.app.ActivityOptionsCompat;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
/**
* Activity that allows navigation among the demo activities.
@@ -41,10 +44,10 @@ public class MainActivity extends Activity {
mGuidedStepFragment = new StepFragment();
GuidedStepFragment.addAsRoot(this, mGuidedStepFragment, android.R.id.content);
-
}
public static class StepFragment extends GuidedStepFragment {
+
@Override
public Guidance onCreateGuidance(Bundle savedInstanceState) {
String title = getString(R.string.main_title);
@@ -83,6 +86,11 @@ public class MainActivity extends Activity {
R.string.guidedstep_description);
addAction(actions, GuidedStepSupportActivity.class, R.string.guidedstepsupport,
R.string.guidedstepsupport_description);
+ addAction(actions, GuidedStepHalfScreenActivity.class, R.string.guidedstephalfscreen,
+ R.string.guidedstep_description);
+ addAction(actions, GuidedStepSupportHalfScreenActivity.class,
+ R.string.guidedstepsupporthalfscreen,
+ R.string.guidedstep_description);
addAction(actions, BrowseErrorActivity.class, R.string.browseerror,
R.string.browseerror_description);
addAction(actions, BrowseErrorSupportActivity.class, R.string.browseerror_support,