diff --git a/android-app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivity.java index 9e15b1e3..46030449 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivity.java @@ -86,10 +86,29 @@ public final class CalculatorWizardActivity extends SherlockFragmentActivity { initTitle(); initNextButton(); + initFinishButton(); initPrevButton(); } } + private void initFinishButton() { + final WizardStep nextStep = flow.getNextStep(step); + if (nextStep == null) { + finishButton.setVisibility(VISIBLE); + finishButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (tryGoNext()) { + finishFlow(); + } + } + }); + } else { + finishButton.setVisibility(GONE); + finishButton.setOnClickListener(null); + } + } + private void initTitle() { setTitle(step.getTitleResId()); } @@ -115,22 +134,9 @@ public final class CalculatorWizardActivity extends SherlockFragmentActivity { private void initNextButton() { final WizardStep nextStep = flow.getNextStep(step); if (nextStep == null) { - finishButton.setVisibility(VISIBLE); - finishButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (tryGoNext()) { - finishFlow(); - } - } - }); - nextButton.setVisibility(GONE); nextButton.setOnClickListener(null); } else { - finishButton.setVisibility(GONE); - finishButton.setOnClickListener(null); - nextButton.setVisibility(VISIBLE); nextButton.setOnClickListener(new View.OnClickListener() { @Override