From d7318bbc172056ae2cdf44e10946baefb0823c6d Mon Sep 17 00:00:00 2001 From: serso Date: Sat, 20 Feb 2016 13:25:08 +0100 Subject: [PATCH] Remove "mobile" layouts from settings --- .../calculator/CalculatorActivity.java | 22 ++--- .../android/calculator/DisplayFragment.java | 7 +- .../android/calculator/DisplayView.java | 7 -- .../android/calculator/EditorFragment.java | 7 +- .../android/calculator/KeyboardFragment.java | 7 +- .../android/calculator/Preferences.java | 62 ++++++------- .../calculator/keyboard/BaseKeyboardUi.java | 31 +++---- .../keyboard/PartialKeyboardUi.java | 25 ++---- .../calculator/wizard/CalculatorLayout.java | 81 ----------------- .../calculator/wizard/CalculatorMode.java | 63 +++++-------- .../wizard/CalculatorWizardStep.java | 8 -- .../wizard/ChooseLayoutWizardStep.java | 88 ------------------- app/src/main/res/values-large/arrays.xml | 38 -------- 13 files changed, 74 insertions(+), 372 deletions(-) delete mode 100644 app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorLayout.java delete mode 100644 app/src/main/java/org/solovyev/android/calculator/wizard/ChooseLayoutWizardStep.java delete mode 100644 app/src/main/res/values-large/arrays.xml diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java index 6cb47de7..60d16e82 100644 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java @@ -154,26 +154,16 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference @Override public void onCreate(@Nullable Bundle savedInstanceState) { - final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); - final Preferences.Gui.Layout layout = Preferences.Gui.layout.getPreferenceNoError(preferences); - ui.setLayoutId(layout.layoutId); + ui.setLayoutId(R.layout.main_calculator); super.onCreate(savedInstanceState); - if (isMultiPane()) { - ui.addTab(this, FragmentTab.history, null, R.id.main_second_pane); - ui.addTab(this, FragmentTab.saved_history, null, R.id.main_second_pane); - ui.addTab(this, FragmentTab.variables, null, R.id.main_second_pane); - ui.addTab(this, FragmentTab.functions, null, R.id.main_second_pane); - ui.addTab(this, FragmentTab.operators, null, R.id.main_second_pane); + final ActionBar actionBar = getSupportActionBar(); + if (Build.VERSION.SDK_INT <= GINGERBREAD_MR1 || (Build.VERSION.SDK_INT >= ICE_CREAM_SANDWICH && hasPermanentMenuKey())) { + actionBar.hide(); } else { - final ActionBar actionBar = getSupportActionBar(); - if (Build.VERSION.SDK_INT <= GINGERBREAD_MR1 || (Build.VERSION.SDK_INT >= ICE_CREAM_SANDWICH && hasPermanentMenuKey())) { - actionBar.hide(); - } else { - actionBar.setDisplayShowTitleEnabled(false); - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); - } + actionBar.setDisplayShowTitleEnabled(false); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); } ButterKnife.bind(this); diff --git a/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java b/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java index 9705bd4b..6f0309cb 100644 --- a/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java @@ -96,12 +96,7 @@ public class DisplayFragment extends BaseFragment implements View.OnClickListene @Nonnull @Override protected FragmentUi createUi() { - final Preferences.Gui.Layout layout = Preferences.Gui.getLayout(preferences); - if (!layout.optimized) { - return new FragmentUi(R.layout.cpp_app_display_mobile, R.string.result); - } else { - return new FragmentUi(R.layout.cpp_app_display, R.string.result); - } + return new FragmentUi(R.layout.cpp_app_display, R.string.result); } @Override diff --git a/app/src/main/java/org/solovyev/android/calculator/DisplayView.java b/app/src/main/java/org/solovyev/android/calculator/DisplayView.java index 359d6daf..82f42da7 100644 --- a/app/src/main/java/org/solovyev/android/calculator/DisplayView.java +++ b/app/src/main/java/org/solovyev/android/calculator/DisplayView.java @@ -68,13 +68,6 @@ public class DisplayView extends AutoResizeTextView { setMinTextSize(applyDimension(COMPLEX_UNIT_SP, 10, resources.getDisplayMetrics())); // make text scrollable if it doesn't fit setMovementMethod(ScrollingMovementMethod.getInstance()); - if (context instanceof Service) { - return; - } - final Preferences.Gui.Layout layout = Preferences.Gui.getLayout(App.getPreferences()); - if (!layout.optimized) { - setTextSize(resources.getDimensionPixelSize(R.dimen.cpp_display_text_size_mobile)); - } } @Nonnull diff --git a/app/src/main/java/org/solovyev/android/calculator/EditorFragment.java b/app/src/main/java/org/solovyev/android/calculator/EditorFragment.java index 89b94a57..2d5591d2 100644 --- a/app/src/main/java/org/solovyev/android/calculator/EditorFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/EditorFragment.java @@ -65,12 +65,7 @@ public class EditorFragment extends BaseFragment { @Nonnull @Override protected FragmentUi createUi() { - final Preferences.Gui.Layout layout = Preferences.Gui.getLayout(preferences); - if (!layout.optimized) { - return new FragmentUi(R.layout.cpp_app_editor_mobile, R.string.editor); - } else { - return new FragmentUi(R.layout.cpp_app_editor, R.string.editor); - } + return new FragmentUi(R.layout.cpp_app_editor, R.string.editor); } @Override diff --git a/app/src/main/java/org/solovyev/android/calculator/KeyboardFragment.java b/app/src/main/java/org/solovyev/android/calculator/KeyboardFragment.java index 8dd16bce..515a7de5 100644 --- a/app/src/main/java/org/solovyev/android/calculator/KeyboardFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/KeyboardFragment.java @@ -59,12 +59,7 @@ public class KeyboardFragment extends BaseFragment { @Nonnull @Override protected FragmentUi createUi() { - final Preferences.Gui.Layout layout = Preferences.Gui.getLayout(preferences); - if (!layout.optimized) { - return new FragmentUi(R.layout.cpp_app_keyboard_mobile); - } else { - return new FragmentUi(R.layout.cpp_app_keyboard); - } + return new FragmentUi(R.layout.cpp_app_keyboard); } @Override diff --git a/app/src/main/java/org/solovyev/android/calculator/Preferences.java b/app/src/main/java/org/solovyev/android/calculator/Preferences.java index 24635d68..2199e39d 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Preferences.java +++ b/app/src/main/java/org/solovyev/android/calculator/Preferences.java @@ -22,11 +22,6 @@ package org.solovyev.android.calculator; -import static org.solovyev.android.Android.isPhoneModel; -import static org.solovyev.android.DeviceModel.samsung_galaxy_s; -import static org.solovyev.android.DeviceModel.samsung_galaxy_s_2; -import static org.solovyev.android.prefs.IntegerPreference.DEF_VALUE; - import android.app.Application; import android.content.ContentResolver; import android.content.Context; @@ -39,28 +34,26 @@ import android.support.annotation.LayoutRes; import android.support.annotation.StyleRes; import android.util.SparseArray; import android.view.ContextThemeWrapper; - +import jscl.AngleUnit; +import jscl.NumeralBase; import org.solovyev.android.Check; import org.solovyev.android.calculator.language.Languages; import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.preferences.PurchaseDialogActivity; import org.solovyev.android.calculator.wizard.WizardActivity; -import org.solovyev.android.prefs.BooleanPreference; -import org.solovyev.android.prefs.IntegerPreference; -import org.solovyev.android.prefs.NumberToStringPreference; -import org.solovyev.android.prefs.Preference; -import org.solovyev.android.prefs.StringPreference; - -import jscl.AngleUnit; -import jscl.NumeralBase; +import org.solovyev.android.prefs.*; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.text.DecimalFormatSymbols; import java.util.EnumMap; import java.util.Locale; import java.util.Map; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import static org.solovyev.android.Android.isPhoneModel; +import static org.solovyev.android.DeviceModel.samsung_galaxy_s; +import static org.solovyev.android.DeviceModel.samsung_galaxy_s_2; +import static org.solovyev.android.prefs.IntegerPreference.DEF_VALUE; public final class Preferences { @@ -77,12 +70,18 @@ public final class Preferences { setInitialDefaultValues(application, preferences, editor); editor.apply(); } else if (version > 143) { + // FIXME: 2016-02-20 use correct version + final SharedPreferences.Editor editor = preferences.edit(); if (!Gui.vibrateOnKeypress.isSet(preferences)) { - final SharedPreferences.Editor editor = preferences.edit(); //noinspection deprecation Gui.vibrateOnKeypress.putPreference(editor, Gui.hapticFeedback.getPreference(preferences) > 0); - editor.apply(); } + Gui.Layout layout = Gui.layout.getPreference(preferences); + //noinspection deprecation + if (layout == Gui.Layout.main_cellphone || layout == Gui.Layout.main_calculator_mobile || layout == Gui.Layout.simple_mobile) { + Gui.layout.putDefault(editor); + } + editor.apply(); } } @@ -115,10 +114,6 @@ public final class Preferences { Gui.theme.tryPutDefault(preferences, editor); Gui.layout.tryPutDefault(preferences, editor); - //noinspection deprecation - if (Gui.layout.getPreference(preferences) == Gui.Layout.main_cellphone) { - Gui.layout.putDefault(editor); - } Gui.feedbackWindowShown.tryPutDefault(preferences, editor); Gui.showReleaseNotes.tryPutDefault(preferences, editor); Gui.usePrevAsBack.tryPutDefault(preferences, editor); @@ -354,23 +349,18 @@ public final class Preferences { } public enum Layout { - main_calculator(R.layout.main_calculator, true), - main_calculator_mobile(R.layout.main_calculator_mobile, false), + main_calculator, + simple, // not used anymore @Deprecated - main_cellphone(R.layout.main_calculator, true), - - simple(R.layout.main_calculator, true), - simple_mobile(R.layout.main_calculator_mobile, false); - - public final int layoutId; - public final boolean optimized; - - Layout(int layoutId, boolean optimized) { - this.layoutId = layoutId; - this.optimized = optimized; - } + main_cellphone, + // not used anymore + @Deprecated + main_calculator_mobile, + // not used anymore + @Deprecated + simple_mobile; } public static final class TextColor { diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java index 920d225f..84da56b5 100644 --- a/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java +++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java @@ -1,13 +1,5 @@ package org.solovyev.android.calculator.keyboard; -import static android.view.HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING; -import static android.view.HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING; -import static android.view.HapticFeedbackConstants.KEYBOARD_TAP; -import static org.solovyev.android.calculator.App.cast; -import static org.solovyev.android.calculator.App.getScreenMetrics; -import static org.solovyev.android.calculator.Preferences.Gui.Layout.simple; -import static org.solovyev.android.calculator.Preferences.Gui.Layout.simple_mobile; - import android.app.Activity; import android.app.Application; import android.content.SharedPreferences; @@ -19,14 +11,8 @@ import android.util.TypedValue; import android.view.View; import android.widget.ImageView; import android.widget.TextView; - import org.solovyev.android.Views; -import org.solovyev.android.calculator.BaseUi; -import org.solovyev.android.calculator.Calculator; -import org.solovyev.android.calculator.Editor; -import org.solovyev.android.calculator.Keyboard; -import org.solovyev.android.calculator.Preferences; -import org.solovyev.android.calculator.PreferredPreferences; +import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.buttons.CppSpecialButton; import org.solovyev.android.calculator.view.ScreenMetrics; import org.solovyev.android.views.Adjuster; @@ -35,11 +21,16 @@ import org.solovyev.android.views.dragbutton.DragButton; import org.solovyev.android.views.dragbutton.DragDirection; import org.solovyev.android.views.dragbutton.SimpleDragListener; +import javax.annotation.Nonnull; +import javax.inject.Inject; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.inject.Inject; +import static android.view.HapticFeedbackConstants.*; +import static org.solovyev.android.calculator.App.cast; +import static org.solovyev.android.calculator.App.getScreenMetrics; +import static org.solovyev.android.calculator.Preferences.Gui.Layout.simple; +import static org.solovyev.android.calculator.Preferences.Gui.Layout.simple_mobile; public abstract class BaseKeyboardUi implements SharedPreferences.OnSharedPreferenceChangeListener, SimpleDragListener.DragProcessor, View.OnClickListener { @@ -85,7 +76,7 @@ public abstract class BaseKeyboardUi implements SharedPreferences.OnSharedPrefer orientation = Views.getScreenOrientation(activity); layout = Preferences.Gui.layout.getPreferenceNoError(preferences); - textSize = layout.optimized ? 0 : calculateTextSize(); + textSize = calculateTextSize(); } protected final void prepareButton(@Nullable ImageView button) { @@ -118,9 +109,7 @@ public abstract class BaseKeyboardUi implements SharedPreferences.OnSharedPrefer prepareButton((View) button); button.setOnDragListener(listener); BaseUi.setFont(button, typeface); - if (textSize > 0) { - button.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); - } + button.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); Adjuster.adjustText(button, TEXT_SCALE); } diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java index dda74bd9..44b88e15 100644 --- a/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java +++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java @@ -1,12 +1,5 @@ package org.solovyev.android.calculator.keyboard; -import static org.solovyev.android.calculator.Engine.Preferences.numeralBase; -import static org.solovyev.android.calculator.Preferences.Gui.showEqualsButton; -import static org.solovyev.android.calculator.Preferences.Gui.vibrateOnKeypress; -import static org.solovyev.android.views.dragbutton.DragDirection.down; -import static org.solovyev.android.views.dragbutton.DragDirection.left; -import static org.solovyev.android.views.dragbutton.DragDirection.up; - import android.app.Activity; import android.app.Application; import android.content.SharedPreferences; @@ -20,10 +13,11 @@ import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.ImageButton; - +import butterknife.Bind; +import butterknife.ButterKnife; +import jscl.NumeralBase; import org.solovyev.android.Check; import org.solovyev.android.calculator.ActivityLauncher; -import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.Engine; import org.solovyev.android.calculator.Preferences; import org.solovyev.android.calculator.R; @@ -34,13 +28,14 @@ import org.solovyev.android.views.dragbutton.DirectionDragButton; import org.solovyev.android.views.dragbutton.DragButton; import org.solovyev.android.views.dragbutton.DragDirection; -import butterknife.Bind; -import butterknife.ButterKnife; -import jscl.NumeralBase; - import javax.annotation.Nonnull; import javax.inject.Inject; +import static org.solovyev.android.calculator.Engine.Preferences.numeralBase; +import static org.solovyev.android.calculator.Preferences.Gui.showEqualsButton; +import static org.solovyev.android.calculator.Preferences.Gui.vibrateOnKeypress; +import static org.solovyev.android.views.dragbutton.DragDirection.*; + public class PartialKeyboardUi extends BaseKeyboardUi { @Nullable @@ -90,10 +85,6 @@ public class PartialKeyboardUi extends BaseKeyboardUi { if (equalsButton == null) { return; } - final boolean large = App.isLargeScreen() && Preferences.Gui.getLayout(preferences).optimized; - if (large) { - return; - } if (orientation != Configuration.ORIENTATION_PORTRAIT && Preferences.Gui.autoOrientation.getPreference(preferences)) { return; } diff --git a/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorLayout.java b/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorLayout.java deleted file mode 100644 index fe426d9c..00000000 --- a/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorLayout.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.calculator.wizard; - -import android.content.SharedPreferences; - -import org.solovyev.android.calculator.Preferences; -import org.solovyev.android.calculator.R; - -import javax.annotation.Nonnull; - -import static org.solovyev.android.calculator.Preferences.Gui.Layout.main_calculator; -import static org.solovyev.android.calculator.Preferences.Gui.Layout.main_calculator_mobile; - -/** - * User: serso - * Date: 6/19/13 - * Time: 12:39 AM - */ -enum CalculatorLayout { - - big_buttons(R.string.cpp_wizard_layout_big_buttons) { - @Override - protected void apply(@Nonnull SharedPreferences preferences) { - Preferences.Gui.layout.putPreference(preferences, main_calculator_mobile); - } - }, - - optimized(R.string.cpp_wizard_layout_optimized) { - @Override - protected void apply(@Nonnull SharedPreferences preferences) { - Preferences.Gui.layout.putPreference(preferences, main_calculator); - } - }; - - private final int nameResId; - - CalculatorLayout(int nameResId) { - this.nameResId = nameResId; - } - - @Nonnull - static CalculatorLayout getDefaultLayout() { - return big_buttons; - } - - @Nonnull - static CalculatorLayout fromGuiLayout(@Nonnull Preferences.Gui.Layout layout) { - if (layout.optimized) { - return optimized; - } else { - return big_buttons; - } - } - - int getNameResId() { - return nameResId; - } - - protected abstract void apply(@Nonnull SharedPreferences preferences); -} diff --git a/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorMode.java b/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorMode.java index 598a30f9..96192c91 100644 --- a/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorMode.java +++ b/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorMode.java @@ -23,63 +23,46 @@ package org.solovyev.android.calculator.wizard; import android.content.SharedPreferences; - +import jscl.AngleUnit; import org.solovyev.android.calculator.Engine; import org.solovyev.android.calculator.Preferences; -import org.solovyev.android.calculator.R; import javax.annotation.Nonnull; -import jscl.AngleUnit; - import static org.solovyev.android.calculator.Preferences.Gui.Layout.main_calculator; -import static org.solovyev.android.calculator.Preferences.Gui.Layout.main_calculator_mobile; -/** - * User: serso - * Date: 6/17/13 - * Time: 9:30 PM - */ enum CalculatorMode { - simple(R.string.cpp_wizard_mode_simple) { + simple() { @Override protected void apply(@Nonnull SharedPreferences preferences) { - final Preferences.Gui.Layout layout = Preferences.Gui.layout.getPreference(preferences); - if (layout.optimized) { - Preferences.Gui.layout.putPreference(preferences, Preferences.Gui.Layout.simple); - } else { - Preferences.Gui.layout.putPreference(preferences, Preferences.Gui.Layout.simple_mobile); - } - Preferences.Calculations.preferredAngleUnits.putPreference(preferences, AngleUnit.deg); - Engine.Preferences.angleUnit.putPreference(preferences, AngleUnit.deg); - Engine.Preferences.Output.scientificNotation.putPreference(preferences, false); - Engine.Preferences.Output.round.putPreference(preferences, true); + final SharedPreferences.Editor editor = preferences.edit(); + + Preferences.Gui.layout.putPreference(editor, Preferences.Gui.Layout.simple); + Preferences.Calculations.preferredAngleUnits.putPreference(editor, AngleUnit.deg); + Engine.Preferences.angleUnit.putPreference(editor, AngleUnit.deg); + Engine.Preferences.Output.scientificNotation.putPreference(editor, false); + Engine.Preferences.Output.round.putPreference(editor, true); + + editor.apply(); } }, - engineer(R.string.cpp_wizard_mode_engineer) { + engineer() { @Override protected void apply(@Nonnull SharedPreferences preferences) { - final Preferences.Gui.Layout layout = Preferences.Gui.layout.getPreference(preferences); - if (layout.optimized) { - Preferences.Gui.layout.putPreference(preferences, main_calculator); - } else { - Preferences.Gui.layout.putPreference(preferences, main_calculator_mobile); - } - Preferences.Calculations.preferredAngleUnits.putPreference(preferences, AngleUnit.rad); - Engine.Preferences.angleUnit.putPreference(preferences, AngleUnit.rad); - Engine.Preferences.Output.scientificNotation.putPreference(preferences, true); - Engine.Preferences.Output.round.putPreference(preferences, false); + final SharedPreferences.Editor editor = preferences.edit(); + + Preferences.Gui.layout.putPreference(editor, main_calculator); + Preferences.Calculations.preferredAngleUnits.putPreference(editor, AngleUnit.rad); + Engine.Preferences.angleUnit.putPreference(editor, AngleUnit.rad); + Engine.Preferences.Output.scientificNotation.putPreference(editor, true); + Engine.Preferences.Output.round.putPreference(editor, false); + + editor.apply(); } }; - private final int nameResId; - - CalculatorMode(int nameResId) { - this.nameResId = nameResId; - } - @Nonnull static CalculatorMode getDefaultMode() { return engineer; @@ -100,9 +83,5 @@ enum CalculatorMode { } } - int getNameResId() { - return nameResId; - } - protected abstract void apply(@Nonnull SharedPreferences preferences); } diff --git a/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardStep.java b/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardStep.java index bf5d886c..79fbec59 100644 --- a/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardStep.java +++ b/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardStep.java @@ -25,7 +25,6 @@ package org.solovyev.android.calculator.wizard; import android.os.Bundle; import android.support.v4.app.Fragment; -import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.R; import javax.annotation.Nonnull; @@ -34,13 +33,6 @@ import javax.annotation.Nullable; enum CalculatorWizardStep implements org.solovyev.android.wizard.WizardStep { welcome(WelcomeWizardStep.class, R.string.cpp_wizard_welcome_title, R.string.cpp_wizard_start), - - choose_layout(ChooseLayoutWizardStep.class, R.string.cpp_wizard_layout_title) { - @Override - public boolean isVisible() { - return App.isLargeScreen(); - } - }, choose_mode(ChooseModeWizardStep.class, R.string.cpp_wizard_mode_title), choose_theme(ChooseThemeWizardStep.class, R.string.cpp_wizard_theme_title), on_screen_calculator(OnScreenCalculatorWizardStep.class, R.string.cpp_wizard_onscreen_calculator_title), diff --git a/app/src/main/java/org/solovyev/android/calculator/wizard/ChooseLayoutWizardStep.java b/app/src/main/java/org/solovyev/android/calculator/wizard/ChooseLayoutWizardStep.java deleted file mode 100644 index 3cfdc7cc..00000000 --- a/app/src/main/java/org/solovyev/android/calculator/wizard/ChooseLayoutWizardStep.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.calculator.wizard; - -import android.os.Bundle; -import android.view.View; -import android.widget.AdapterView; -import android.widget.ImageView; -import android.widget.Spinner; -import org.solovyev.android.calculator.App; -import org.solovyev.android.calculator.Preferences; -import org.solovyev.android.calculator.R; - -import javax.annotation.Nonnull; - -import static org.solovyev.android.calculator.wizard.CalculatorLayout.big_buttons; -import static org.solovyev.android.calculator.wizard.CalculatorLayout.optimized; - -/** - * User: serso - * Date: 6/19/13 - * Time: 12:33 AM - */ -public class ChooseLayoutWizardStep extends WizardFragment implements AdapterView.OnItemSelectedListener { - - private ImageView image; - - @Override - protected int getViewResId() { - return R.layout.cpp_wizard_step_choose_layout; - } - - @Override - public void onViewCreated(View root, Bundle savedInstanceState) { - super.onViewCreated(root, savedInstanceState); - - final CalculatorLayout layout = CalculatorLayout.fromGuiLayout(Preferences.Gui.layout.getPreference(App.getPreferences())); - - image = (ImageView) root.findViewById(R.id.wizard_layout_image); - final Spinner spinner = (Spinner) root.findViewById(R.id.wizard_layout_spinner); - spinner.setAdapter(WizardArrayAdapter.create(getActivity(), R.array.cpp_layouts)); - spinner.setSelection(layout == big_buttons ? 0 : 1); - spinner.setOnItemSelectedListener(this); - - updateImage(layout); - } - - private void updateImage(@Nonnull CalculatorLayout layout) { - image.setImageResource(layout == big_buttons ? R.drawable.layout_big_buttons : R.drawable.layout_optimized); - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - } - - @Override - public void onItemSelected(AdapterView parent, View view, int position, long id) { - final CalculatorLayout layout = position == 0 ? big_buttons : optimized; - layout.apply(App.getPreferences()); - updateImage(layout); - } - - @Override - public void onNothingSelected(AdapterView parent) { - - } -} diff --git a/app/src/main/res/values-large/arrays.xml b/app/src/main/res/values-large/arrays.xml deleted file mode 100644 index 5523feed..00000000 --- a/app/src/main/res/values-large/arrays.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - @string/p_layout_calculator - @string/p_layout_calculator_mobile - @string/p_layout_simple - @string/p_layout_simple_mobile - - - main_calculator - main_calculator_mobile - simple - simple_mobile - - - \ No newline at end of file