1 // CHECKSTYLE:OFF Generated code 2 /* This file is auto-generated from GuidedStepActivity.java. DO NOT MODIFY. */ 3 4 /* 5 * Copyright (C) 2014 The Android Open Source Project 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20 package com.example.android.leanback; 21 22 import android.support.v4.app.FragmentActivity; 23 import android.support.v4.app.Fragment; 24 import android.support.v4.app.FragmentManager; 25 import android.content.Context; 26 import android.content.res.Configuration; 27 import android.graphics.drawable.Drawable; 28 import android.os.Bundle; 29 import android.support.v17.leanback.app.GuidedStepSupportFragment; 30 import android.support.v17.leanback.widget.GuidanceStylist; 31 import android.support.v17.leanback.widget.GuidanceStylist.Guidance; 32 import android.support.v17.leanback.widget.GuidedAction; 33 import android.support.v17.leanback.widget.GuidedActionsStylist; 34 import android.support.v17.leanback.widget.GuidedDatePickerAction; 35 import android.support.v4.content.res.ResourcesCompat; 36 import android.text.InputType; 37 import android.text.TextUtils; 38 import android.util.Log; 39 import android.view.LayoutInflater; 40 import android.view.View; 41 import android.view.ViewGroup; 42 import android.view.inputmethod.EditorInfo; 43 44 import java.util.ArrayList; 45 import java.util.Calendar; 46 import java.util.List; 47 48 /** 49 * Activity that showcases different aspects of GuidedStepSupportFragments. 50 */ 51 public class GuidedStepSupportActivity extends FragmentActivity { 52 53 private static final int BACK = 2; 54 55 private static final int FIRST_NAME = 3; 56 private static final int LAST_NAME = 4; 57 private static final int PASSWORD = 5; 58 private static final int PAYMENT = 6; 59 private static final int NEW_PAYMENT = 7; 60 private static final int PAYMENT_EXPIRE = 8; 61 62 private static final long RADIO_ID_BASE = 0; 63 private static final long CHECKBOX_ID_BASE = 100; 64 65 private static final long DEFAULT_OPTION = RADIO_ID_BASE; 66 67 private static final String[] OPTION_NAMES = { "Option A", "Option B", "Option C" }; 68 private static final String[] OPTION_DESCRIPTIONS = { "Here's one thing you can do", 69 "Here's another thing you can do", "Here's one more thing you can do" }; 70 71 private static final String TAG = GuidedStepSupportActivity.class.getSimpleName(); 72 73 @Override 74 protected void onCreate(Bundle savedInstanceState) { 75 Log.v(TAG, "onCreate"); 76 super.onCreate(savedInstanceState); 77 setContentView(R.layout.guided_step_activity); 78 if (savedInstanceState == null) { 79 GuidedStepSupportFragment.addAsRoot(this, new FirstStepFragment(), R.id.lb_guidedstep_host); 80 } 81 } 82 83 @Override 84 public void onConfigurationChanged(Configuration newConfig) { 85 Log.v(TAG, "onConfigurationChanged"); 86 super.onConfigurationChanged(newConfig); 87 } 88 89 @Override 90 protected void onSaveInstanceState(Bundle outState) { 91 Log.v(TAG, "onSaveInstanceState"); 92 super.onSaveInstanceState(outState); 93 } 94 95 @Override 96 protected void onRestoreInstanceState(Bundle savedInstanceState) { 97 Log.v(TAG, "onRestoreInstanceState"); 98 super.onRestoreInstanceState(savedInstanceState); 99 } 100 101 private static GuidedAction addAction(List<GuidedAction> actions, long id, String title, 102 String desc) { 103 GuidedAction action; 104 actions.add(action = new GuidedAction.Builder(null) 105 .id(id) 106 .title(title) 107 .description(desc) 108 .build()); 109 return action; 110 } 111 112 private static GuidedAction addAction(List<GuidedAction> actions, long id, String title, 113 String desc, List<GuidedAction> subActions) { 114 GuidedAction action; 115 actions.add(action = new GuidedAction.Builder(null) 116 .id(id) 117 .title(title) 118 .description(desc) 119 .subActions(subActions) 120 .build()); 121 return action; 122 } 123 124 private static GuidedAction addEditableAction(Context context, List<GuidedAction> actions, 125 long id, String title, String desc) { 126 GuidedAction action; 127 actions.add(action = new GuidedAction.Builder(context) 128 .id(id) 129 .title(title) 130 .description(desc) 131 .editable(true) 132 .icon(R.drawable.lb_ic_search_mic) 133 .build()); 134 return action; 135 } 136 137 private static GuidedAction addEditableAction(List<GuidedAction> actions, long id, String title, 138 String editTitle, String desc) { 139 GuidedAction action; 140 actions.add(action = new GuidedAction.Builder(null) 141 .id(id) 142 .title(title) 143 .editTitle(editTitle) 144 .description(desc) 145 .editable(true) 146 .build()); 147 return action; 148 } 149 150 private static GuidedAction addEditableAction(List<GuidedAction> actions, long id, String title, 151 String editTitle, int editInputType, String desc, String editDesc) { 152 GuidedAction action; 153 actions.add(action = new GuidedAction.Builder(null) 154 .id(id) 155 .title(title) 156 .editTitle(editTitle) 157 .editInputType(editInputType) 158 .description(desc) 159 .editDescription(editDesc) 160 .editable(true) 161 .build()); 162 return action; 163 } 164 165 private static GuidedDatePickerAction addDatePickerAction(List<GuidedAction> actions, long id, 166 String title) { 167 GuidedDatePickerAction action; 168 actions.add(action = new GuidedDatePickerAction.Builder(null) 169 .id(id) 170 .title(title) 171 .datePickerFormat("MY") 172 .build()); 173 return action; 174 } 175 176 private static GuidedAction addEditableDescriptionAction(List<GuidedAction> actions, long id, 177 String title, String desc, String editDescription, int descriptionEditInputType) { 178 GuidedAction action; 179 actions.add(action = new GuidedAction.Builder(null) 180 .id(id) 181 .title(title) 182 .description(desc) 183 .editDescription(editDescription) 184 .descriptionEditInputType(descriptionEditInputType) 185 .descriptionEditable(true) 186 .build()); 187 return action; 188 } 189 190 private static GuidedAction addCheckedAction(List<GuidedAction> actions, long id, 191 String title, String desc, int checkSetId) { 192 GuidedAction action; 193 actions.add(action = new GuidedAction.Builder(null) 194 .id(id) 195 .title(title) 196 .description(desc) 197 .checkSetId(checkSetId) 198 .build()); 199 return action; 200 } 201 202 public static class FirstStepFragment extends GuidedStepSupportFragment { 203 204 @Override 205 public int onProvideTheme() { 206 return R.style.Theme_Example_Leanback_GuidedStep_First; 207 } 208 209 @Override 210 public Guidance onCreateGuidance(Bundle savedInstanceState) { 211 String title = getString(R.string.guidedstep_first_title); 212 String breadcrumb = getString(R.string.guidedstep_first_breadcrumb); 213 String description = getString(R.string.guidedstep_first_description); 214 final Context context = getActivity(); 215 Drawable icon = ResourcesCompat.getDrawable(context.getResources(), 216 R.drawable.ic_main_icon, context.getTheme()); 217 return new Guidance(title, description, breadcrumb, icon); 218 } 219 220 @Override 221 public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) { 222 Context context = getActivity(); 223 actions.add(new GuidedAction.Builder(context) 224 .clickAction(GuidedAction.ACTION_ID_CONTINUE) 225 .description("Let's do it") 226 .build()); 227 actions.add(new GuidedAction.Builder(context) 228 .clickAction(GuidedAction.ACTION_ID_CANCEL) 229 .description("Never mind") 230 .build()); 231 } 232 233 @Override 234 public void onGuidedActionClicked(GuidedAction action) { 235 FragmentManager fm = getFragmentManager(); 236 if (action.getId() == GuidedAction.ACTION_ID_CONTINUE) { 237 GuidedStepSupportFragment.add(fm, new SecondStepFragment(), R.id.lb_guidedstep_host); 238 } else if (action.getId() == GuidedAction.ACTION_ID_CANCEL){ 239 finishGuidedStepSupportFragments(); 240 } 241 } 242 } 243 244 public interface NewPaymentFragmentTarget { 245 void onNewPaymentFragmentStarted(); 246 void onNewPaymentAdded(int selection); 247 } 248 249 static ArrayList<String> sCards = new ArrayList<String>(); 250 static int sSelectedCard = -1; 251 static { 252 sCards.add("Visa-1234"); 253 sCards.add("Master-4321"); 254 } 255 256 public static class NewPaymentStepFragment extends GuidedStepSupportFragment { 257 258 NewPaymentFragmentTarget mNewPaymentTarget; 259 260 @Override 261 public void onCreate(Bundle savedInstance) { 262 super.onCreate(savedInstance); 263 Fragment targetFragment = getTargetFragment(); 264 if (targetFragment instanceof NewPaymentFragmentTarget) { 265 mNewPaymentTarget = ((NewPaymentFragmentTarget) targetFragment); 266 mNewPaymentTarget.onNewPaymentFragmentStarted(); 267 } 268 } 269 270 @Override 271 public Guidance onCreateGuidance(Bundle savedInstanceState) { 272 String title = getString(R.string.guidedstep_newpayment_title); 273 String breadcrumb = getString(R.string.guidedstep_newpayment_breadcrumb); 274 String description = getString(R.string.guidedstep_newpayment_description); 275 final Context context = getActivity(); 276 Drawable icon = ResourcesCompat.getDrawable(context.getResources(), 277 R.drawable.ic_main_icon, context.getTheme()); 278 return new Guidance(title, description, breadcrumb, icon); 279 } 280 281 @Override 282 public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) { 283 addEditableAction(actions, NEW_PAYMENT, "Input credit card number", "", 284 InputType.TYPE_CLASS_NUMBER, 285 "Input credit card number", "Input credit card number"); 286 addDatePickerAction(actions, PAYMENT_EXPIRE, "Exp:"); 287 } 288 289 @Override 290 public void onCreateButtonActions(List<GuidedAction> actions, Bundle savedInstanceState) { 291 Context context = getActivity(); 292 actions.add(new GuidedAction.Builder(context).clickAction(GuidedAction.ACTION_ID_OK) 293 .build()); 294 actions.get(actions.size() - 1).setEnabled(false); 295 } 296 297 @Override 298 public void onGuidedActionClicked(GuidedAction action) { 299 if (action.getId() == GuidedAction.ACTION_ID_OK) { 300 CharSequence desc = findActionById(NEW_PAYMENT).getDescription(); 301 String cardNumber = desc.subSequence(desc.length() - 4, desc.length()).toString(); 302 String card; 303 if ((Integer.parseInt(cardNumber) & 1) == 0) { 304 card = "Visa "+cardNumber; 305 } else { 306 card = "Master "+cardNumber; 307 } 308 int selection = sCards.size(); 309 sCards.add(card); 310 if (mNewPaymentTarget != null) { 311 mNewPaymentTarget.onNewPaymentAdded(selection); 312 } 313 popBackStackToGuidedStepSupportFragment(NewPaymentStepFragment.class, 314 FragmentManager.POP_BACK_STACK_INCLUSIVE); 315 } 316 } 317 318 @Override 319 public long onGuidedActionEditedAndProceed(GuidedAction action) { 320 if (action.getId() == NEW_PAYMENT) { 321 CharSequence editTitle = action.getEditTitle(); 322 if (isCardNumberValid(editTitle)) { 323 editTitle = editTitle.subSequence(editTitle.length() - 4, editTitle.length()); 324 action.setDescription("Visa XXXX-XXXX-XXXX-" + editTitle); 325 updateOkButton(isExpDateValid(findActionById(PAYMENT_EXPIRE))); 326 return GuidedAction.ACTION_ID_NEXT; 327 } else if (editTitle.length() == 0) { 328 action.setDescription("Input credit card number"); 329 updateOkButton(false); 330 return GuidedAction.ACTION_ID_CURRENT; 331 } else { 332 action.setDescription("Error credit card number"); 333 updateOkButton(false); 334 return GuidedAction.ACTION_ID_CURRENT; 335 } 336 } else if (action.getId() == PAYMENT_EXPIRE) { 337 updateOkButton(isExpDateValid(action) && 338 isCardNumberValid(findActionById(NEW_PAYMENT).getEditTitle())); 339 } 340 return GuidedAction.ACTION_ID_NEXT; 341 } 342 343 boolean isCardNumberValid(CharSequence number) { 344 return TextUtils.isDigitsOnly(number) && number.length() == 16; 345 } 346 347 boolean isExpDateValid(GuidedAction action) { 348 long date = ((GuidedDatePickerAction) action).getDate(); 349 Calendar c = Calendar.getInstance(); 350 c.setTimeInMillis(date); 351 return Calendar.getInstance().before(c); 352 } 353 354 void updateOkButton(boolean enabled) { 355 findButtonActionById(GuidedAction.ACTION_ID_OK).setEnabled(enabled); 356 notifyButtonActionChanged(findButtonActionPositionById(GuidedAction.ACTION_ID_OK)); 357 } 358 } 359 360 public static class SecondStepFragment extends GuidedStepSupportFragment 361 implements NewPaymentFragmentTarget { 362 363 364 boolean mExpandPaymentListInOnCreateView; 365 366 @Override 367 public void onNewPaymentAdded(int selection) { 368 // if a new payment is added, we dont need expand the sub actions list. 369 mExpandPaymentListInOnCreateView = false; 370 sSelectedCard = selection; 371 updatePaymentAction(findActionById(PAYMENT)); 372 findButtonActionById(GuidedAction.ACTION_ID_CONTINUE).setEnabled(sSelectedCard != -1); 373 } 374 375 @Override 376 public void onNewPaymentFragmentStarted() { 377 // if a new payment fragment is opened, when come back we should expand the payment 378 // sub actions list unless user created a new payment in onNewPaymentAdded 379 mExpandPaymentListInOnCreateView = true; 380 } 381 382 @Override 383 public GuidedActionsStylist onCreateActionsStylist() { 384 return new GuidedActionsStylist() { 385 @Override 386 protected void setupImeOptions(GuidedActionsStylist.ViewHolder vh, 387 GuidedAction action) { 388 if (action.getId() == PASSWORD) { 389 vh.getEditableDescriptionView().setImeActionLabel("Confirm!", 390 EditorInfo.IME_ACTION_DONE); 391 } else { 392 super.setupImeOptions(vh, action); 393 } 394 } 395 }; 396 } 397 398 @Override 399 public Guidance onCreateGuidance(Bundle savedInstanceState) { 400 String title = getString(R.string.guidedstep_second_title); 401 String breadcrumb = getString(R.string.guidedstep_second_breadcrumb); 402 String description = getString(R.string.guidedstep_second_description); 403 final Context context = getActivity(); 404 Drawable icon = ResourcesCompat.getDrawable(context.getResources(), 405 R.drawable.ic_main_icon, context.getTheme()); 406 return new Guidance(title, description, breadcrumb, icon); 407 } 408 409 @Override 410 public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) { 411 addEditableAction(getActivity(), actions, FIRST_NAME, "Pat", "Your first name"); 412 addEditableAction(getActivity(), actions, LAST_NAME, "Smith", "Your last name"); 413 List<GuidedAction> subActions = new ArrayList<GuidedAction>(); 414 updatePaymentAction(addAction(actions, PAYMENT, "Select Payment", "", subActions)); 415 addEditableDescriptionAction(actions, PASSWORD, "Password", "", "", 416 InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); 417 } 418 419 @Override 420 public void onCreateButtonActions(List<GuidedAction> actions, Bundle savedInstanceState) { 421 actions.add(new GuidedAction.Builder(getActivity()) 422 .clickAction(GuidedAction.ACTION_ID_CONTINUE) 423 .description("Continue") 424 .enabled(isPasswordValid() && isPaymentValid()) 425 .build()); 426 } 427 428 @Override 429 public void onGuidedActionClicked(GuidedAction action) { 430 if (action.getId() == GuidedAction.ACTION_ID_CONTINUE) { 431 FragmentManager fm = getFragmentManager(); 432 GuidedStepSupportFragment.add(fm, new ThirdStepFragment(), R.id.lb_guidedstep_host); 433 } 434 } 435 436 void updatePaymentAction(GuidedAction paymentAction) { 437 List<GuidedAction> subActions = paymentAction.getSubActions(); 438 subActions.clear(); 439 for (int i = 0; i < sCards.size(); i++) { 440 addCheckedAction(subActions, -1, sCards.get(i), "", 441 GuidedAction.DEFAULT_CHECK_SET_ID); 442 if (i == sSelectedCard) { 443 subActions.get(i).setChecked(true); 444 } 445 } 446 addAction(subActions, NEW_PAYMENT, "Add New Card", ""); 447 paymentAction.setDescription(sSelectedCard == -1 ? "" : sCards.get(sSelectedCard)); 448 } 449 450 @Override 451 public long onGuidedActionEditedAndProceed(GuidedAction action) { 452 if (action.getId() == PASSWORD) { 453 CharSequence password = action.getEditDescription(); 454 if (password.length() > 0) { 455 if (isPaymentValid()) { 456 updateContinue(true); 457 return GuidedAction.ACTION_ID_NEXT; 458 } else { 459 updateContinue(false); 460 return GuidedAction.ACTION_ID_CURRENT; 461 } 462 } else { 463 updateContinue(false); 464 return GuidedAction.ACTION_ID_CURRENT; 465 } 466 } 467 return GuidedAction.ACTION_ID_NEXT; 468 } 469 470 @Override 471 public boolean onSubGuidedActionClicked(GuidedAction action) { 472 if (action.isChecked()) { 473 String payment = action.getTitle().toString(); 474 for (int i = 0; i < sCards.size(); i++) { 475 if (payment.equals(sCards.get(i))) { 476 sSelectedCard = i; 477 findActionById(PAYMENT).setDescription(payment); 478 notifyActionChanged(findActionPositionById(PAYMENT)); 479 updateContinue(isPasswordValid()); 480 break; 481 } 482 } 483 return true; 484 } else { 485 FragmentManager fm = getFragmentManager(); 486 NewPaymentStepFragment newPaymentFragment = new NewPaymentStepFragment(); 487 newPaymentFragment.setTargetFragment(this, 0); 488 GuidedStepSupportFragment.add(fm, newPaymentFragment, R.id.lb_guidedstep_host); 489 return false; 490 } 491 } 492 493 @Override 494 public View onCreateView(LayoutInflater inflater, ViewGroup container, 495 Bundle savedInstanceState) { 496 View view = super.onCreateView(inflater, container, savedInstanceState); 497 if (mExpandPaymentListInOnCreateView) { 498 expandAction(findActionById(PAYMENT), false); 499 } 500 return view; 501 } 502 503 boolean isPaymentValid() { 504 CharSequence paymentType = findActionById(PAYMENT).getDescription(); 505 return (paymentType.length() >= 4 && 506 paymentType.subSequence(0, 4).toString().equals("Visa")) || 507 (paymentType.length() >= 6 && 508 paymentType.subSequence(0, 6).toString().equals("Master")); 509 } 510 511 boolean isPasswordValid() { 512 return findActionById(PASSWORD).getEditDescription().length() > 0; 513 } 514 515 void updateContinue(boolean enabled) { 516 findButtonActionById(GuidedAction.ACTION_ID_CONTINUE).setEnabled(enabled); 517 notifyButtonActionChanged(findButtonActionPositionById( 518 GuidedAction.ACTION_ID_CONTINUE)); 519 } 520 } 521 522 public static class ThirdStepFragment extends GuidedStepSupportFragment { 523 524 private long mSelectedOption = DEFAULT_OPTION; 525 526 @Override 527 public Guidance onCreateGuidance(Bundle savedInstanceState) { 528 String title = getString(R.string.guidedstep_third_title); 529 String breadcrumb = getString(R.string.guidedstep_third_breadcrumb); 530 String description = getString(R.string.guidedstep_third_description); 531 final Context context = getActivity(); 532 Drawable icon = ResourcesCompat.getDrawable(context.getResources(), 533 R.drawable.ic_main_icon, context.getTheme()); 534 return new Guidance(title, description, breadcrumb, icon); 535 } 536 537 @Override 538 public GuidanceStylist onCreateGuidanceStylist() { 539 return new GuidanceStylist() { 540 @Override 541 public int onProvideLayoutId() { 542 return R.layout.guidedstep_second_guidance; 543 } 544 }; 545 } 546 547 @Override 548 public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) { 549 String desc = "The description can be quite long as well. " 550 + "Just be sure to set multilineDescription to true in the GuidedAction." 551 + "For testing purpose we make this line even longer since " 552 + "multilineDescriptionMinLines will be set to 2."; 553 actions.add(new GuidedAction.Builder(getActivity()) 554 .title("Note that Guided Actions can have titles that are quite long.") 555 .description(desc) 556 .multilineDescription(true) 557 .infoOnly(true) 558 .enabled(true) 559 .focusable(false) 560 .build()); 561 for (int i = 0; i < OPTION_NAMES.length; i++) { 562 addCheckedAction(actions, RADIO_ID_BASE + i, OPTION_NAMES[i], 563 OPTION_DESCRIPTIONS[i], GuidedAction.DEFAULT_CHECK_SET_ID); 564 if (i == DEFAULT_OPTION) { 565 actions.get(actions.size() -1).setChecked(true); 566 } 567 } 568 for (int i = 0; i < OPTION_NAMES.length; i++) { 569 addCheckedAction(actions, CHECKBOX_ID_BASE + i, OPTION_NAMES[i], 570 OPTION_DESCRIPTIONS[i], GuidedAction.CHECKBOX_CHECK_SET_ID); 571 } 572 } 573 574 @Override 575 public void onCreateButtonActions(List<GuidedAction> actions, Bundle savedInstanceState) { 576 actions.add(new GuidedAction.Builder(getActivity()) 577 .clickAction(GuidedAction.ACTION_ID_CONTINUE) 578 .build()); 579 } 580 581 @Override 582 public void onGuidedActionClicked(GuidedAction action) { 583 if (action.getId() == GuidedAction.ACTION_ID_CONTINUE) { 584 FragmentManager fm = getFragmentManager(); 585 FourthStepFragment f = new FourthStepFragment(); 586 Bundle arguments = new Bundle(); 587 arguments.putLong(FourthStepFragment.EXTRA_OPTION, mSelectedOption); 588 f.setArguments(arguments); 589 GuidedStepSupportFragment.add(fm, f, R.id.lb_guidedstep_host); 590 } else if (action.getCheckSetId() == GuidedAction.DEFAULT_CHECK_SET_ID) { 591 mSelectedOption = action.getId(); 592 } 593 } 594 595 } 596 597 public static class FourthStepFragment extends GuidedStepSupportFragment { 598 public static final String EXTRA_OPTION = "extra_option"; 599 600 public FourthStepFragment() { 601 } 602 603 public long getOption() { 604 Bundle b = getArguments(); 605 if (b == null) return 0; 606 return b.getLong(EXTRA_OPTION, 0); 607 } 608 609 @Override 610 public Guidance onCreateGuidance(Bundle savedInstanceState) { 611 String title = getString(R.string.guidedstep_fourth_title); 612 String breadcrumb = getString(R.string.guidedstep_fourth_breadcrumb); 613 String description = "You chose: " + OPTION_NAMES[(int) getOption()]; 614 final Context context = getActivity(); 615 Drawable icon = ResourcesCompat.getDrawable(context.getResources(), 616 R.drawable.ic_main_icon, context.getTheme()); 617 return new Guidance(title, description, breadcrumb, icon); 618 } 619 620 @Override 621 public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) { 622 actions.add(new GuidedAction.Builder(getActivity()) 623 .clickAction(GuidedAction.ACTION_ID_FINISH) 624 .description("All Done...") 625 .build()); 626 addAction(actions, BACK, "Start Over", "Let's try this again..."); 627 } 628 629 @Override 630 public void onGuidedActionClicked(GuidedAction action) { 631 if (action.getId() == GuidedAction.ACTION_ID_FINISH) { 632 finishGuidedStepSupportFragments(); 633 } else if (action.getId() == BACK) { 634 // pop 4, 3, 2 635 popBackStackToGuidedStepSupportFragment(SecondStepFragment.class, 636 FragmentManager.POP_BACK_STACK_INCLUSIVE); 637 } 638 } 639 640 } 641 642 } 643