From 6ed16bb26a0ee94a800965d82b9d794ba216ed4d Mon Sep 17 00:00:00 2001 From: Sergey Solovyev Date: Mon, 23 Apr 2012 11:31:23 +0400 Subject: [PATCH] Hide numeral base preference --- calculatorpp/res/values-ru/text_preferences.xml | 3 +++ calculatorpp/res/values-uk/text_preferences.xml | 3 +++ calculatorpp/res/values/text_preferences.xml | 3 +++ calculatorpp/res/xml/preferences.xml | 7 +++++++ .../android/calculator/CalculatorPreferences.java | 1 + .../android/calculator/NumeralBaseButtons.java | 11 ++++++++--- 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/calculatorpp/res/values-ru/text_preferences.xml b/calculatorpp/res/values-ru/text_preferences.xml index 2e8c8a67..683aabbc 100644 --- a/calculatorpp/res/values-ru/text_preferences.xml +++ b/calculatorpp/res/values-ru/text_preferences.xml @@ -4,4 +4,7 @@ Показывать клавишу равно Если включено, то клавиша равно будет показана + + Не показывать цифры из других систем счисления + Если включено, то цифры из других систем счисления будут спрятаны \ No newline at end of file diff --git a/calculatorpp/res/values-uk/text_preferences.xml b/calculatorpp/res/values-uk/text_preferences.xml index 2e8c8a67..683aabbc 100644 --- a/calculatorpp/res/values-uk/text_preferences.xml +++ b/calculatorpp/res/values-uk/text_preferences.xml @@ -4,4 +4,7 @@ Показывать клавишу равно Если включено, то клавиша равно будет показана + + Не показывать цифры из других систем счисления + Если включено, то цифры из других систем счисления будут спрятаны \ No newline at end of file diff --git a/calculatorpp/res/values/text_preferences.xml b/calculatorpp/res/values/text_preferences.xml index 955341ae..8f440c2f 100644 --- a/calculatorpp/res/values/text_preferences.xml +++ b/calculatorpp/res/values/text_preferences.xml @@ -4,4 +4,7 @@ Show equals button If turned on equals button is shown + + Hide other numeral base digits + If turned on other numeral base digits base will be hidden \ No newline at end of file diff --git a/calculatorpp/res/xml/preferences.xml b/calculatorpp/res/xml/preferences.xml index 1d334547..5a279369 100644 --- a/calculatorpp/res/xml/preferences.xml +++ b/calculatorpp/res/xml/preferences.xml @@ -148,6 +148,13 @@ a:summary="@string/c_show_equals_button_summary" a:defaultValue="true"/> + + + usePrevAsBack = new BooleanPreference("org.solovyev.android.calculator.CalculatorActivity_use_back_button_as_prev", false); public static final Preference showEqualsButton = new BooleanPreference("showEqualsButton", true); public static final Preference autoOrientation = new BooleanPreference("autoOrientation", true); + public static final Preference hideNumeralBaseDigits = new BooleanPreference("hideNumeralBaseDigits", true); public static enum Theme { diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/NumeralBaseButtons.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/NumeralBaseButtons.java index c2b7d088..ffc6b4d7 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/NumeralBaseButtons.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/NumeralBaseButtons.java @@ -13,7 +13,7 @@ import org.solovyev.android.calculator.model.CalculatorEngine; */ public class NumeralBaseButtons { - public synchronized void toggleNumericDigits(@NotNull Activity activity, @NotNull NumeralBase currentNumeralBase) { + private synchronized void toggleNumericDigits(@NotNull Activity activity, @NotNull NumeralBase currentNumeralBase) { for (NumeralBase numeralBase : NumeralBase.values()) { if ( currentNumeralBase != numeralBase ) { AndroidNumeralBase.valueOf(numeralBase).toggleButtons(false, activity); @@ -24,7 +24,12 @@ public class NumeralBaseButtons { } public synchronized void toggleNumericDigits(@NotNull Activity activity, @NotNull SharedPreferences preferences) { - final NumeralBase nb = CalculatorEngine.Preferences.numeralBase.getPreference(preferences); - this.toggleNumericDigits(activity, nb); + if (CalculatorPreferences.Gui.hideNumeralBaseDigits.getPreference(preferences)) { + final NumeralBase nb = CalculatorEngine.Preferences.numeralBase.getPreference(preferences); + this.toggleNumericDigits(activity, nb); + } else { + // set HEX to show all digits + AndroidNumeralBase.valueOf(NumeralBase.hex).toggleButtons(true, activity); + } } }