SupportLeanbackDemo: add example finishGuidedStepFragments()
and popBackStackToGuidedStepFragment() Change-Id: I747673f886bebf5ccc81b8f686c801ede4b5ac0b
This commit is contained in:
@@ -173,7 +173,7 @@ public class GuidedStepActivity extends Activity {
|
|||||||
if (action.getId() == CONTINUE) {
|
if (action.getId() == CONTINUE) {
|
||||||
GuidedStepFragment.add(fm, new SecondStepFragment(), android.R.id.content);
|
GuidedStepFragment.add(fm, new SecondStepFragment(), android.R.id.content);
|
||||||
} else {
|
} else {
|
||||||
getActivity().finish();
|
finishGuidedStepFragments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,15 +348,17 @@ public class GuidedStepActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) {
|
public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) {
|
||||||
addAction(actions, CONTINUE, "Done", "All finished");
|
addAction(actions, CONTINUE, "Done", "All finished");
|
||||||
addAction(actions, BACK, "Back", "Forgot something...");
|
addAction(actions, BACK, "Start Over", "Let's try this again...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuidedActionClicked(GuidedAction action) {
|
public void onGuidedActionClicked(GuidedAction action) {
|
||||||
if (action.getId() == CONTINUE) {
|
if (action.getId() == CONTINUE) {
|
||||||
getActivity().finish();
|
finishGuidedStepFragments();
|
||||||
} else {
|
} else {
|
||||||
getFragmentManager().popBackStack();
|
// pop 4, 3, 2
|
||||||
|
popBackStackToGuidedStepFragment(SecondStepFragment.class,
|
||||||
|
FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ public class GuidedStepSupportActivity extends FragmentActivity {
|
|||||||
if (action.getId() == CONTINUE) {
|
if (action.getId() == CONTINUE) {
|
||||||
GuidedStepSupportFragment.add(fm, new SecondStepFragment(), android.R.id.content);
|
GuidedStepSupportFragment.add(fm, new SecondStepFragment(), android.R.id.content);
|
||||||
} else {
|
} else {
|
||||||
getActivity().finish();
|
finishGuidedStepSupportFragments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,15 +350,17 @@ public class GuidedStepSupportActivity extends FragmentActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) {
|
public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) {
|
||||||
addAction(actions, CONTINUE, "Done", "All finished");
|
addAction(actions, CONTINUE, "Done", "All finished");
|
||||||
addAction(actions, BACK, "Back", "Forgot something...");
|
addAction(actions, BACK, "Start Over", "Let's try this again...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuidedActionClicked(GuidedAction action) {
|
public void onGuidedActionClicked(GuidedAction action) {
|
||||||
if (action.getId() == CONTINUE) {
|
if (action.getId() == CONTINUE) {
|
||||||
getActivity().finish();
|
finishGuidedStepSupportFragments();
|
||||||
} else {
|
} else {
|
||||||
getFragmentManager().popBackStack();
|
// pop 4, 3, 2
|
||||||
|
popBackStackToGuidedStepSupportFragment(SecondStepFragment.class,
|
||||||
|
FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user