SupportLeanbackShowcase: Provided context for calls to

GuidedAction.Builder

GuidedActions were created without the activity argument in the old
version; updated the API calls to use their context within the fragment.

Change-Id: I4b3433f9e0cdfe5fa84a56a78413c219fbc4d939
This commit is contained in:
Keyvan Amiri
2016-02-05 10:51:52 -08:00
parent 8369074daf
commit 329cd510f0
5 changed files with 16 additions and 16 deletions

View File

@@ -43,20 +43,20 @@ public class WizardExample1stStepFragment extends WizardExampleBaseStepFragment
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
GuidedAction action = new GuidedAction.Builder()
GuidedAction action = new GuidedAction.Builder(getActivity())
.id(ACTION_ID_BUY_HD)
.title(getString(R.string.wizard_example_rent_hd))
.title(R.string.wizard_example_rent_hd)
.editable(false)
.description(mMovie.getPriceHd() + " " +
getString(R.string.wizard_example_watch_hd))
.build();
actions.add(action);
action = new GuidedAction.Builder()
action = new GuidedAction.Builder(getActivity())
.id(ACTION_ID_BUY_SD)
.title(getString(R.string.wizard_example_rent_sd))
.editable(false)
.description(mMovie.getPriceSd() + " " +
getString(R.string.wizard_example_watch_sd))
R.string.wizard_example_watch_sd)
.build();
actions.add(action);
}

View File

@@ -60,18 +60,18 @@ public class WizardExample2ndStepFragment extends WizardExampleBaseStepFragment
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
boolean rentHighDefinition = getArguments().getBoolean(ARG_HD);
GuidedAction action = new GuidedAction.Builder()
GuidedAction action = new GuidedAction.Builder(getActivity())
.id(ACTION_ID_CONFIRM)
.title(getString(R.string.wizard_example_rent))
.title(R.string.wizard_example_rent)
.description(rentHighDefinition ? mMovie.getPriceHd() : mMovie.getPriceSd())
.editable(false)
.build();
actions.add(action);
action = new GuidedAction.Builder()
action = new GuidedAction.Builder(getActivity())
.id(ACTION_ID_PAYMENT_METHOD)
.title(getString(R.string.wizard_example_payment_method))
.title(R.string.wizard_example_payment_method)
.editTitle("")
.description(getString(R.string.wizard_example_input_credit))
.description(R.string.wizard_example_input_credit)
.editable(true)
.build();
actions.add(action);

View File

@@ -78,9 +78,9 @@ public class WizardExample3rdStepFragment extends WizardExampleBaseStepFragment
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
GuidedAction action = new GuidedAction.Builder()
GuidedAction action = new GuidedAction.Builder(getActivity())
.id(ACTION_ID_PROCESSING)
.title(getString(R.string.wizard_example_processing))
.title(R.string.wizard_example_processing)
.infoOnly(true)
.build();
actions.add(action);

View File

@@ -44,16 +44,16 @@ public class WizardExample4thStepFragment extends WizardExampleBaseStepFragment
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
GuidedAction action = new GuidedAction.Builder()
GuidedAction action = new GuidedAction.Builder(getActivity())
.id(ACTION_ID_WATCH)
.editable(false)
.title(getString(R.string.wizard_example_watch_now))
.title(R.string.wizard_example_watch_now)
.build();
actions.add(action);
action = new GuidedAction.Builder()
action = new GuidedAction.Builder(getActivity())
.id(ACTION_ID_LATER)
.editable(false)
.title(getString(R.string.wizard_example_later))
.title(R.string.wizard_example_later)
.build();
actions.add(action);
}

View File

@@ -76,7 +76,7 @@
<item name="imageCardViewBadgeStyle">@style/MovieCardBadgeStyle</item>
<item name="imageCardViewContentStyle">@style/MovieCardContentStyle</item>
</style>
<!-- Theme corresponding to the MovieCardBasicStyle -->
<style name="MovieCardBasicTheme" parent="MovieCardCompleteTheme">
<item name="imageCardViewContentStyle">@style/MovieCardContentGoneStyle</item>