diff --git a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorFixableError.java b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorFixableError.java index 6ba533d6..5d898311 100644 --- a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorFixableError.java +++ b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorFixableError.java @@ -20,6 +20,20 @@ public enum CalculatorFixableError { public void fix() { CalculatorLocatorImpl.getInstance().getPreferenceService().setAngleUnits(AngleUnit.rad); } + }, + + preferred_numeral_base() { + @Override + public void fix() { + CalculatorLocatorImpl.getInstance().getPreferenceService().setPreferredNumeralBase(); + } + }, + + preferred_angle_units() { + @Override + public void fix() { + CalculatorLocatorImpl.getInstance().getPreferenceService().setPreferredAngleUnits(); + } }; @NotNull diff --git a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java index 3f1a6c2a..191a471a 100644 --- a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java +++ b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java @@ -163,6 +163,8 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { @NotNull String expression, @Nullable MessageRegistry mr) { + CalculatorLocatorImpl.getInstance().getPreferenceService().checkPreferredPreferences(false); + PreparedExpression preparedExpression = null; try { diff --git a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorPreferenceService.java b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorPreferenceService.java index ca6a5d70..0d012015 100644 --- a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorPreferenceService.java +++ b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorPreferenceService.java @@ -1,6 +1,7 @@ package org.solovyev.android.calculator; import jscl.AngleUnit; +import jscl.NumeralBase; import org.jetbrains.annotations.NotNull; /** @@ -10,5 +11,11 @@ import org.jetbrains.annotations.NotNull; */ public interface CalculatorPreferenceService { + void setPreferredAngleUnits(); void setAngleUnits(@NotNull AngleUnit angleUnit); + + void setPreferredNumeralBase(); + void setNumeralBase(@NotNull NumeralBase numeralBase); + + void checkPreferredPreferences(boolean force); } diff --git a/calculatorpp/res/layout/calculation_messages_dialog.xml b/calculatorpp/res/layout/calculator_messages_dialog.xml similarity index 100% rename from calculatorpp/res/layout/calculation_messages_dialog.xml rename to calculatorpp/res/layout/calculator_messages_dialog.xml diff --git a/calculatorpp/res/layout/calculation_messages_dialog_message.xml b/calculatorpp/res/layout/calculator_messages_dialog_message.xml similarity index 83% rename from calculatorpp/res/layout/calculation_messages_dialog_message.xml rename to calculatorpp/res/layout/calculator_messages_dialog_message.xml index 65dd3e3b..ce34cfcd 100644 --- a/calculatorpp/res/layout/calculation_messages_dialog_message.xml +++ b/calculatorpp/res/layout/calculator_messages_dialog_message.xml @@ -8,13 +8,15 @@ + a:layout_weight="5" + a:layout_gravity="top|left"/>