From d8008953800f9da0c0e0667fcc4c82213b8c597d Mon Sep 17 00:00:00 2001 From: Sergey Solovyev Date: Tue, 25 Jun 2013 23:09:59 +0400 Subject: [PATCH] Wizard -> Wizards --- .../calculator/CalculatorActivity.java | 7 +++--- .../CalculatorPreferencesActivity.java | 4 ++-- .../calculator/wizard/AppWizardFlow.java | 4 ++-- .../wizard/CalculatorWizardActivity.java | 12 +++++----- .../wizard/{Wizard.java => Wizards.java} | 4 ++-- .../wizard/CalculatorWizardActivityTest.java | 24 +++++++++---------- 6 files changed, 27 insertions(+), 28 deletions(-) rename android-app/src/main/java/org/solovyev/android/calculator/wizard/{Wizard.java => Wizards.java} (98%) diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java index 7d8e9d7a..cf57c14f 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java @@ -21,7 +21,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewConfiguration; import android.view.Window; -import android.view.WindowManager; import android.widget.Button; import android.widget.TextView; import com.actionbarsherlock.app.ActionBar; @@ -45,9 +44,9 @@ import static android.os.Build.VERSION_CODES.GINGERBREAD_MR1; import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static org.solovyev.android.calculator.CalculatorPreferences.Gui.preventScreenFromFading; -import static org.solovyev.android.calculator.wizard.Wizard.FIRST_TIME_WIZARD; -import static org.solovyev.android.calculator.wizard.Wizard.isWizardFinished; -import static org.solovyev.android.calculator.wizard.Wizard.isWizardStarted; +import static org.solovyev.android.calculator.wizard.Wizards.FIRST_TIME_WIZARD; +import static org.solovyev.android.calculator.wizard.Wizards.isWizardFinished; +import static org.solovyev.android.calculator.wizard.Wizards.isWizardStarted; public class CalculatorActivity extends SherlockFragmentActivity implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEventListener { diff --git a/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPreferencesActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPreferencesActivity.java index 4baf63ed..be9c9950 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPreferencesActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPreferencesActivity.java @@ -27,7 +27,7 @@ import org.solovyev.android.ads.AdsController; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.model.AndroidCalculatorEngine; import org.solovyev.android.calculator.wizard.CalculatorWizardActivity; -import org.solovyev.android.calculator.wizard.Wizard; +import org.solovyev.android.calculator.wizard.Wizards; import org.solovyev.android.msg.AndroidMessage; import org.solovyev.android.view.VibratorContainer; import org.solovyev.common.msg.Message; @@ -60,7 +60,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im restartWizardPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - CalculatorWizardActivity.startWizard(Wizard.DEFAULT_WIZARD_FLOW, CalculatorPreferencesActivity.this); + CalculatorWizardActivity.startWizard(Wizards.DEFAULT_WIZARD_FLOW, CalculatorPreferencesActivity.this); return true; } }); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/wizard/AppWizardFlow.java b/android-app/src/main/java/org/solovyev/android/calculator/wizard/AppWizardFlow.java index 6fdeaf36..e930c5c2 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/wizard/AppWizardFlow.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/wizard/AppWizardFlow.java @@ -5,8 +5,8 @@ import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; -import static org.solovyev.android.calculator.wizard.Wizard.DEFAULT_WIZARD_FLOW; -import static org.solovyev.android.calculator.wizard.Wizard.FIRST_TIME_WIZARD; +import static org.solovyev.android.calculator.wizard.Wizards.DEFAULT_WIZARD_FLOW; +import static org.solovyev.android.calculator.wizard.Wizards.FIRST_TIME_WIZARD; import static org.solovyev.android.calculator.wizard.WizardStep.welcome; /** 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 c51c285c..64a0fd4d 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 @@ -14,8 +14,8 @@ import javax.annotation.Nonnull; import static android.view.View.GONE; import static android.view.View.VISIBLE; -import static org.solovyev.android.calculator.wizard.Wizard.FLOW; -import static org.solovyev.android.calculator.wizard.Wizard.STEP; +import static org.solovyev.android.calculator.wizard.Wizards.FLOW; +import static org.solovyev.android.calculator.wizard.Wizards.STEP; /** * User: serso @@ -64,7 +64,7 @@ public final class CalculatorWizardActivity extends SherlockFragmentActivity { stepName = savedInstanceState.getString(STEP); } - flow = Wizard.getWizardFlow(wizardName != null ? wizardName : Wizard.FIRST_TIME_WIZARD); + flow = Wizards.getWizardFlow(wizardName != null ? wizardName : Wizards.FIRST_TIME_WIZARD); WizardStep step = null; if(stepName != null) { @@ -155,7 +155,7 @@ public final class CalculatorWizardActivity extends SherlockFragmentActivity { void finishFlow(boolean forceFinish) { if (flow != null && step != null) { - Wizard.saveWizardFinished(flow, step, forceFinish); + Wizards.saveWizardFinished(flow, step, forceFinish); } finish(); } @@ -236,7 +236,7 @@ public final class CalculatorWizardActivity extends SherlockFragmentActivity { super.onPause(); if (flow != null && step != null) { - Wizard.saveLastWizardStep(flow, step); + Wizards.saveLastWizardStep(flow, step); } } @@ -280,7 +280,7 @@ public final class CalculatorWizardActivity extends SherlockFragmentActivity { public static void continueWizard(@Nonnull String name, @Nonnull Context context) { final Intent intent = createLaunchIntent(name, context); - final String step = Wizard.getLastSavedWizardStepName(name); + final String step = Wizards.getLastSavedWizardStepName(name); if (step != null) { intent.putExtra(STEP, step); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/wizard/Wizard.java b/android-app/src/main/java/org/solovyev/android/calculator/wizard/Wizards.java similarity index 98% rename from android-app/src/main/java/org/solovyev/android/calculator/wizard/Wizard.java rename to android-app/src/main/java/org/solovyev/android/calculator/wizard/Wizards.java index b29806ca..230aaca3 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/wizard/Wizard.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/wizard/Wizards.java @@ -15,7 +15,7 @@ import static org.solovyev.android.calculator.wizard.AppWizardFlow.newFirstTimeW * Date: 6/16/13 * Time: 9:23 PM */ -public final class Wizard { +public final class Wizards { public static final String FIRST_TIME_WIZARD = "first-wizard"; public static final String DEFAULT_WIZARD_FLOW = "app-wizard"; @@ -23,7 +23,7 @@ public final class Wizard { static final String FLOW_FINISHED = "flow_finished"; static final String STEP = "step"; - private Wizard() { + private Wizards() { throw new AssertionError(); } diff --git a/android-app/src/test/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivityTest.java b/android-app/src/test/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivityTest.java index e3db8abc..e3b561f3 100644 --- a/android-app/src/test/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivityTest.java +++ b/android-app/src/test/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivityTest.java @@ -44,7 +44,7 @@ public class CalculatorWizardActivityTest { @Test public void testShouldBeFirstTimeWizardByDefault() throws Exception { - assertEquals(Wizard.FIRST_TIME_WIZARD, activity.getFlow().getName()); + assertEquals(Wizards.FIRST_TIME_WIZARD, activity.getFlow().getName()); } @Test @@ -65,7 +65,7 @@ public class CalculatorWizardActivityTest { activity = controller.get(); assertNotNull(activity.getFlow()); - assertEquals(Wizard.FIRST_TIME_WIZARD, activity.getFlow().getName()); + assertEquals(Wizards.FIRST_TIME_WIZARD, activity.getFlow().getName()); assertNotNull(activity.getStep()); assertEquals(choose_mode, activity.getStep()); } @@ -74,11 +74,11 @@ public class CalculatorWizardActivityTest { public void testCreate() throws Exception { final Intent intent = new Intent(); intent.setClass(activity, CalculatorWizardActivity.class); - intent.putExtra(Wizard.FLOW, Wizard.DEFAULT_WIZARD_FLOW); + intent.putExtra(Wizards.FLOW, Wizards.DEFAULT_WIZARD_FLOW); controller = Robolectric.buildActivity(CalculatorWizardActivity.class).withIntent(intent); controller.create(); activity = controller.get(); - assertEquals(Wizard.DEFAULT_WIZARD_FLOW, activity.getFlow().getName()); + assertEquals(Wizards.DEFAULT_WIZARD_FLOW, activity.getFlow().getName()); assertEquals(activity.getFlow().getFirstStep(), activity.getStep()); final Bundle outState1 = new Bundle(); @@ -87,7 +87,7 @@ public class CalculatorWizardActivityTest { controller = Robolectric.buildActivity(CalculatorWizardActivity.class); activity = controller.get(); controller.create(outState1); - assertEquals(Wizard.DEFAULT_WIZARD_FLOW, activity.getFlow().getName()); + assertEquals(Wizards.DEFAULT_WIZARD_FLOW, activity.getFlow().getName()); assertEquals(activity.getFlow().getFirstStep(), activity.getStep()); } @@ -123,7 +123,7 @@ public class CalculatorWizardActivityTest { @Test public void testShouldStartWizardActivityAfterStart() throws Exception { final ShadowActivity shadowActivity = Robolectric.shadowOf(controller.get()); - startWizard(Wizard.DEFAULT_WIZARD_FLOW, shadowActivity.getApplicationContext()); + startWizard(Wizards.DEFAULT_WIZARD_FLOW, shadowActivity.getApplicationContext()); assertNotNull(shadowActivity.getNextStartedActivity()); } @@ -159,25 +159,25 @@ public class CalculatorWizardActivityTest { @Test public void testShouldSaveLastWizardStateOnPause() throws Exception { - assertNull(Wizard.getLastSavedWizardStepName(activity.getFlow().getName())); + assertNull(Wizards.getLastSavedWizardStepName(activity.getFlow().getName())); activity.setStep(WizardStep.drag_button_step); activity.onPause(); - assertEquals(WizardStep.drag_button_step.getName(), Wizard.getLastSavedWizardStepName(activity.getFlow().getName())); + assertEquals(WizardStep.drag_button_step.getName(), Wizards.getLastSavedWizardStepName(activity.getFlow().getName())); } @Test public void testShouldSaveFinishedIfLastStep() throws Exception { - assertFalse(Wizard.isWizardFinished(activity.getFlow().getName())); + assertFalse(Wizards.isWizardFinished(activity.getFlow().getName())); setLastStep(); activity.finishFlow(); - assertTrue(Wizard.isWizardFinished(activity.getFlow().getName())); + assertTrue(Wizards.isWizardFinished(activity.getFlow().getName())); } @Test public void testShouldNotSaveFinishedIfNotLastStep() throws Exception { - assertFalse(Wizard.isWizardFinished(activity.getFlow().getName())); + assertFalse(Wizards.isWizardFinished(activity.getFlow().getName())); setFirstStep(); activity.finishFlow(); - assertFalse(Wizard.isWizardFinished(activity.getFlow().getName())); + assertFalse(Wizards.isWizardFinished(activity.getFlow().getName())); } }