Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove or Add Steps Conditionally #283

Open
1 of 3 tasks
Tarcisiofl opened this issue Jun 6, 2019 · 1 comment
Open
1 of 3 tasks

Remove or Add Steps Conditionally #283

Tarcisiofl opened this issue Jun 6, 2019 · 1 comment

Comments

@Tarcisiofl
Copy link

Tarcisiofl commented Jun 6, 2019

Make sure these boxes are checked before submitting your issue - thank you!

  • Check in the issue tracker whether
    this issue wasn't already reported.
  • If it's a bug report check that clear steps to reproduce,
    stacktrace, expected behaviour and other needed details are provided.
  • Feature requests contain a description of the feature
    you're requesting as well as a brief scenario explaining
    under what circumstances this might be useful.

I have a step wizard with 8 steps, and the last step is a summary of everything where the user can click on each information and go direct to this step.
Therefore, when the user select some specific services on the 4 step. I need to show or hide 3 further steps.

However, I cannot find a good way to implement this behavior.

case 0:
                final CompanyFragment client = new CompanyFragment();
                Bundle bClient = new Bundle();
                bClient.putInt(CURRENT_STEP_POSITION_KEY, position);
                client.setArguments(bClient);
                return client;
case 1:
                final BuildingFragment building = new BuildingFragment();
                Bundle bBuilding = new Bundle();
                bBuilding.putInt(CURRENT_STEP_POSITION_KEY, position);
                building.setArguments(bBuilding);
                return building;
case 2:
                final ShiftFragment shift = new ShiftFragment();
                Bundle bShift = new Bundle();
                bShift.putInt(CURRENT_STEP_POSITION_KEY, position);
                shift.setArguments(bShift);
                return shift;
case 3:
                final ServiceFragment service = new ServiceFragment();
                Bundle bService = new Bundle();
                bService.putInt(CURRENT_STEP_POSITION_KEY, position);
                service.setArguments(bService);
                return service;
case 4:
                final ServiceDetailsFragment serviceDetails = new ServiceDetailsFragment();
                Bundle bServiceDetails = new Bundle();
                bServiceDetails.putInt(CURRENT_STEP_POSITION_KEY, position);
                serviceDetails.setArguments(bServiceDetails);
                return serviceDetails;
case 5:
                final CarrierFragment carrier = new CarrierFragment();
                Bundle bCarrier = new Bundle();
                bCarrier.putInt(CURRENT_STEP_POSITION_KEY, position);
                carrier.setArguments(bCarrier);
                return carrier;
case 6:
                final VehicleFragment vehicle = new VehicleFragment();
                Bundle bVehicle = new Bundle();
                bVehicle.putInt(CURRENT_STEP_POSITION_KEY, position);
                vehicle.setArguments(bVehicle);
                return vehicle;
case 7:
                final PlateFragment plate = new PlateFragment();
                Bundle bPlate = new Bundle();
                bPlate.putInt(CURRENT_STEP_POSITION_KEY, position);
                plate.setArguments(bPlate);
                return plate;
case 8:
                final SummaryFragment summary = new SummaryFragment();
                Bundle bSummary = new Bundle();
                bSummary.putInt(CURRENT_STEP_POSITION_KEY, position);
                summary.setArguments(bSummary);
                return summary;

I need to hide the case 5, 6 and 7.

@Tarcisiofl Tarcisiofl changed the title How to set getCallback()? getCallback() NullPointerException Jun 6, 2019
@Tarcisiofl Tarcisiofl changed the title getCallback() NullPointerException Remove or Add Steps Conditionally Jun 7, 2019
@hyuni
Copy link

hyuni commented Dec 25, 2020

Hi

I solved a similar situation through setAdapter(adapter, step).

// in adapter
val stepList = mutableListOf(step1, step2)
val conditionList = listOf(step3, step4)
var isCondition : Boolean = false 

// set codition
fun setCondition(isCondition: Boolean) {
  this.isCondition = isCondition
  if (isCondition) {
     stepList.addAll(conditionList)
  } else {
     stepList.removeAll(conditionList
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants