Wizard changes

This commit is contained in:
serso
2015-02-01 18:05:59 +01:00
parent f2320fbe8a
commit a56756e8ce
10 changed files with 39 additions and 11 deletions

View File

@@ -77,7 +77,7 @@ public class ActivityUi extends BaseUi {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
theme = Preferences.Gui.getTheme(preferences);
activity.setTheme(theme.getThemeId());
activity.setTheme(theme.getThemeId(activity));
this.layout = Preferences.Gui.getLayout(preferences);

View File

@@ -22,15 +22,18 @@
package org.solovyev.android.calculator;
import android.app.Activity;
import android.content.SharedPreferences;
import jscl.AngleUnit;
import jscl.NumeralBase;
import org.solovyev.android.calculator.math.MathType;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
import org.solovyev.android.calculator.wizard.WizardActivity;
import org.solovyev.android.prefs.*;
import org.solovyev.android.view.VibratorContainer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
@@ -123,6 +126,14 @@ public final class Preferences {
@Nonnull
public Integer getThemeId() {
return getThemeId(null);
}
@Nonnull
public Integer getThemeId(@Nullable Activity activity) {
if (activity instanceof WizardActivity) {
return R.style.Theme_Wizard;
}
return themeId;
}
}

View File

@@ -30,11 +30,6 @@ import org.solovyev.android.calculator.R;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
* Date: 6/16/13
* Time: 9:17 PM
*/
enum CalculatorWizardStep implements org.solovyev.android.wizard.WizardStep {
welcome(WelcomeWizardStep.class, R.string.cpp_wizard_welcome_title, R.string.cpp_wizard_start),

View File

@@ -3,11 +3,13 @@ package org.solovyev.android.calculator.wizard;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.solovyev.android.calculator.R;
import org.solovyev.android.wizard.Wizard;
import org.solovyev.android.wizard.WizardFlow;
import org.solovyev.android.wizard.WizardStep;
@@ -58,11 +60,13 @@ public abstract class WizardFragment extends Fragment implements View.OnClickLis
prevButton.setOnClickListener(this);
}
final WizardFlow flow = getWizardActivity().getFlow();
final Wizard wizard = getWizardActivity().getWizard();
final WizardFlow flow = wizard.getFlow();
final boolean canGoNext = flow.getNextStep(step) != null;
final boolean canGoPrev = flow.getPrevStep(step) != null;
final boolean firstTimeWizard = TextUtils.equals(wizard.getName(), CalculatorWizards.FIRST_TIME_WIZARD);
if (canGoNext) {
if (canGoPrev) {
if (canGoPrev || !firstTimeWizard) {
setupNextButton(R.string.acl_wizard_next);
} else {
setupNextButton(R.string.acl_wizard_start);
@@ -74,7 +78,9 @@ public abstract class WizardFragment extends Fragment implements View.OnClickLis
if (canGoPrev) {
setupPrevButton(R.string.acl_wizard_back);
} else {
setupPrevButton(R.string.wizard_skip);
if (firstTimeWizard) {
setupPrevButton(R.string.wizard_skip);
}
}
return view;
@@ -83,11 +89,13 @@ public abstract class WizardFragment extends Fragment implements View.OnClickLis
protected final void setupNextButton(int textResId) {
assert nextButton != null;
nextButton.setText(textResId);
nextButton.setVisibility(View.VISIBLE);
}
protected final void setupPrevButton(int textResId) {
assert prevButton != null;
prevButton.setText(textResId);
prevButton.setVisibility(View.VISIBLE);
}
@LayoutRes