method extracted

This commit is contained in:
Sergey Solovyev 2013-06-25 23:08:01 +04:00
parent 6c578d7d09
commit bba654f378

View File

@ -86,10 +86,29 @@ public final class CalculatorWizardActivity extends SherlockFragmentActivity {
initTitle(); initTitle();
initNextButton(); initNextButton();
initFinishButton();
initPrevButton(); 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() { private void initTitle() {
setTitle(step.getTitleResId()); setTitle(step.getTitleResId());
} }
@ -115,22 +134,9 @@ public final class CalculatorWizardActivity extends SherlockFragmentActivity {
private void initNextButton() { private void initNextButton() {
final WizardStep nextStep = flow.getNextStep(step); final WizardStep nextStep = flow.getNextStep(step);
if (nextStep == null) { if (nextStep == null) {
finishButton.setVisibility(VISIBLE);
finishButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (tryGoNext()) {
finishFlow();
}
}
});
nextButton.setVisibility(GONE); nextButton.setVisibility(GONE);
nextButton.setOnClickListener(null); nextButton.setOnClickListener(null);
} else { } else {
finishButton.setVisibility(GONE);
finishButton.setOnClickListener(null);
nextButton.setVisibility(VISIBLE); nextButton.setVisibility(VISIBLE);
nextButton.setOnClickListener(new View.OnClickListener() { nextButton.setOnClickListener(new View.OnClickListener() {
@Override @Override