From 5d6ea3d58edbaafcfa88cae44338e7d825f3d182 Mon Sep 17 00:00:00 2001 From: serso Date: Tue, 9 Oct 2012 18:03:16 +0400 Subject: [PATCH] fixes --- calculatorpp/res/values/text_strings.xml | 452 +++++++++--------- calculatorpp/res/xml/plot_preferences.xml | 48 +- calculatorpp/res/xml/preferences.xml | 364 +++++++------- .../calculator/CalculatorApplication.java | 3 +- .../calculator/CalculatorPreferences.java | 306 ++++++------ .../about/CalculatorReleaseNotesFragment.java | 6 +- .../view/NumeralBaseConverterDialog.java | 13 +- 7 files changed, 608 insertions(+), 584 deletions(-) diff --git a/calculatorpp/res/values/text_strings.xml b/calculatorpp/res/values/text_strings.xml index 9fe32f65..2f04e192 100644 --- a/calculatorpp/res/values/text_strings.xml +++ b/calculatorpp/res/values/text_strings.xml @@ -1,225 +1,229 @@ - - - - - - Calculator++ - Calculator++ Free - Calc++ - Settings - Error - Result copied to clipboard! - Settings - Help - Variables And Constants - - Main settings - Calculation settings - Appearance settings - Other settings - Drag buttons settings - - - Down - Up - Restart - - undo - redo - C - clear - paste - vars - - Copy - Plot graph - Graph - - Highlight expressions - Round result - Toggles rounding of the result - Always scientific notation - If turned on forces to use only scientific notation of output (12.34E-12) - Precision of result - Maximum calculation time - If calculations exceed specified limit - calculator halts with error - Exit - Add - Cancel - Save - Remove - Yes - No - Removal confirmation - Do you really want to delete \'%s\' variable? - Name - Value - Description - Create variable - Edit variable - - Value must be either number or empty! - Variable name clashes with function name! - Variable with same name already exists! - Name of constant is not valid: name must start with letter, can contain letters, digits and underscore. - System variable cannot be changed! - - Enter new expression - Press to copy - Continue - History - M - History is empty! - History - Character \'%s\' is not accepted in variable name! - - Angle Units - Degrees - Radians - Gradians - Turns - Defines the default units for angles. - - Numeral systems - Defines the default numeral system for all input numbers. - Decimal - Hexadecimal - Octal - Binary - - Theme - Grey - Violet - Light Blue - Metro Blue (Default) - Metro Green - Metro Purple - Precision of result value (all calculations are done with maximum precision regardless of the value of this option) - Toggles colouring and styling in calculator editor - Sets the theme for calculator - Clear history - Next constants are undefined: {0}! - - No grouping separator - Apostrophe (\') - Space ( ) - Grouping separator - Sets grouping separator - Multiplication sign - Sets multiplication sign - - Layout - Scientific (cellphone) - Scientific - Simple - Sets layout of buttons - - Haptic feedback - Toggles vibration on button click - - Short - Middle - Long - - Haptic feedback duration - Duration vibration on button click - - Unable to create empty constant! - Current result is not valid! - - Graph - From - To - - Swipe distance for buttons - Sets swipe distance for buttons that support additional swipe actions - - Comment - Saved - Not saved - Expression copied to the clipboard! - Status: - Comment: - Use - Use - Copy expression - Copy result - Value - Saved (see \'Saved history\' tab) - Comment - Save history - Modify history - Modify - Saved history - - History was already saved! - History must be saved before editing! - History was successfully removed! - History was successfully saved! - - Copy description - Copy value - - Thank you for choosing Calculator++!\n\nCalculator++ is a powerful tool for making everyday calculations.\n\nTo remove the ads and support the project you can use special option from application settings.\n\nIt\'s highly recommended to read the FAQ and hints before the work to use all the features of application (press Menu button and then Help) - Welcome - - Show release notes - Defines if release notes popup window should appear after update to the new version - - Defines the behaviour of the Back button - Use Back button as history prev - - Billing information will be reloaded from the server - Clear billing information - - Warning - Error - Billing is not supported: you must have Google Checkout account linked to your Google account and must be connected to the internet. - - Support the project - And remove the advertisement - - Ad free option has been already purchased! - Purchasing… - Clearing… - - Feedback - You have been using Calculator++ for some time \n - and it\'s important for us to know your opinion about application.\n\n - Please rate Calculator++ \non Google Play,\n leave a comment or \ndiscuss application \non our forum - - - Good news - I just released new application for Android called Notes++.\n - If you\'re interesting in fast and easy way of making notes please follow the link and try Notes++! - - - Angle units changed to \'%s\'! - Numeral base changed to \'%s\'! - Conversion tool - - Convert to… - - Convert to hex - Convert to bin - Convert to dec - - Editor - Result - Other - Derivatives/Integrals - Calculator++ has been crashed… - Calculator++ crash report - - Unfortunately, Calculator++ has been crashed.\n\n - In order to fix the problem we need some information about it. It\'s highly recommended to send crash report via email (after pressing \'Ok\' button you will see all sent data in the new window).\n\n - Do you want to send crash report? - - Graph preferences - If checked complex graph will be plotted - Show complex graph - + + + + + + Calculator++ + Calculator++ Free + Calc++ + Settings + Error + Result copied to clipboard! + Settings + Help + Variables And Constants + + Main settings + Calculation settings + Appearance settings + Other settings + Drag buttons settings + + + Down + Up + Restart + + undo + redo + C + clear + paste + vars + + Copy + Plot graph + Graph + + Highlight expressions + Round result + Toggles rounding of the result + Always scientific notation + If turned on forces to use only scientific notation of output (12.34E-12) + Precision of result + Maximum calculation time + If calculations exceed specified limit - calculator halts with error + Exit + Add + Cancel + Save + Remove + Yes + No + Removal confirmation + Do you really want to delete \'%s\' variable? + Name + Value + Description + Create variable + Edit variable + + Value must be either number or empty! + Variable name clashes with function name! + Variable with same name already exists! + Name of constant is not valid: name must start with letter, can contain letters, digits and underscore. + System variable cannot be changed! + + Enter new expression + Press to copy + Continue + History + M + History is empty! + History + Character \'%s\' is not accepted in variable name! + + Angle Units + Degrees + Radians + Gradians + Turns + Defines the default units for angles. + + Numeral systems + Defines the default numeral system for all input numbers. + Decimal + Hexadecimal + Octal + Binary + + Theme + Grey + Violet + Light Blue + Metro Blue (Default) + Metro Green + Metro Purple + Precision of result value (all calculations are done with maximum precision regardless of the value of this option) + Toggles colouring and styling in calculator editor + Sets the theme for calculator + Clear history + Next constants are undefined: {0}! + + No grouping separator + Apostrophe (\') + Space ( ) + Grouping separator + Sets grouping separator + Multiplication sign + Sets multiplication sign + + Layout + Scientific (cellphone) + Scientific + Simple + Sets layout of buttons + + Haptic feedback + Toggles vibration on button click + + Short + Middle + Long + + Haptic feedback duration + Duration vibration on button click + + Unable to create empty constant! + Current result is not valid! + + Graph + From + To + + Swipe distance for buttons + Sets swipe distance for buttons that support additional swipe actions + + Comment + Saved + Not saved + Expression copied to the clipboard! + Status: + Comment: + Use + Use + Copy expression + Copy result + Value + Saved (see \'Saved history\' tab) + Comment + Save history + Modify history + Modify + Saved history + + History was already saved! + History must be saved before editing! + History was successfully removed! + History was successfully saved! + + Copy description + Copy value + + Thank you for choosing Calculator++!\n\nCalculator++ is a powerful tool for making everyday calculations.\n\nTo remove the ads and support the project you can use special option from application settings.\n\nIt\'s highly recommended to read the FAQ and hints before the work to use all the features of application (press Menu button and then Help) + Welcome + + Show release notes + Defines if release notes popup window should appear after update to the new version + + Defines the behaviour of the Back button + Use Back button as history prev + + Billing information will be reloaded from the server + Clear billing information + + Warning + Error + Billing is not supported: you must have Google Checkout account linked to your Google account and must be connected to the internet. + + Support the project + And remove the advertisement + + Ad free option has been already purchased! + Purchasing… + Clearing… + + Feedback + You have been using Calculator++ for some time \n + and it\'s important for us to know your opinion about application.\n\n + Please rate Calculator++ \non Google Play,\n leave a comment or \ndiscuss application \non our forum + + + Good news - I just released new application for Android called Notes++.\n + If you\'re interesting in fast and easy way of making notes please follow the link and try Notes++! + + + Angle units changed to \'%s\'! + Numeral base changed to \'%s\'! + Conversion tool + + Convert to… + + Convert to hex + Convert to bin + Convert to dec + + Editor + Result + Other + Derivatives/Integrals + Calculator++ has crashed… + Calculator++ crash report + + Unfortunately, Calculator++ has crashed.\n\n + In order to fix the problem we need some information about it. It\'s highly recommended to send crash report via email (after pressing \'Ok\' button you will see all sent data in the new window).\n\n + Do you want to send crash report? + + Graph preferences + + Interpolate function\'s graph + Color of real part of functions graph + Sets color of real part functions graph + Color of imaginary part of functions graph + Sets color of imaginary part functions graph + \ No newline at end of file diff --git a/calculatorpp/res/xml/plot_preferences.xml b/calculatorpp/res/xml/plot_preferences.xml index 896b5838..f9796c35 100644 --- a/calculatorpp/res/xml/plot_preferences.xml +++ b/calculatorpp/res/xml/plot_preferences.xml @@ -1,22 +1,28 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/calculatorpp/res/xml/preferences.xml b/calculatorpp/res/xml/preferences.xml index 0a3bc1fd..66141e9e 100644 --- a/calculatorpp/res/xml/preferences.xml +++ b/calculatorpp/res/xml/preferences.xml @@ -1,188 +1,178 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java index 8dd7ef8c..0e50c82a 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java @@ -57,6 +57,7 @@ public class CalculatorApplication extends android.app.Application { ACRA.init(this); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); + CalculatorPreferences.setDefaultValues(preferences); setTheme(preferences); @@ -84,8 +85,6 @@ public class CalculatorApplication extends android.app.Application { return CalculatorSecurity.getPK(); } }); - - CalculatorPreferences.setDefaultValues(preferences); } private void setTheme(@NotNull SharedPreferences preferences) { diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorPreferences.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorPreferences.java index 587e4d04..070e7fb2 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorPreferences.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorPreferences.java @@ -1,142 +1,164 @@ -package org.solovyev.android.calculator; - -import android.content.SharedPreferences; -import org.jetbrains.annotations.NotNull; -import org.solovyev.android.AndroidUtils; -import org.solovyev.android.calculator.math.MathType; -import org.solovyev.android.calculator.model.AndroidCalculatorEngine; -import org.solovyev.android.calculator.plot.GraphLineColor; -import org.solovyev.android.prefs.BooleanPreference; -import org.solovyev.android.prefs.IntegerPreference; -import org.solovyev.android.prefs.Preference; -import org.solovyev.android.prefs.StringPreference; - -import java.text.DecimalFormatSymbols; -import java.util.Locale; - -/** - * User: serso - * Date: 4/20/12 - * Time: 12:42 PM - */ -public final class CalculatorPreferences { - - private CalculatorPreferences() { - throw new AssertionError(); - } - - public static final Preference appVersion = new IntegerPreference("application.version", -1); - public static final Preference appOpenedCounter = new IntegerPreference("app_opened_counter", 0); - - public static class Gui { - - public static final Preference theme = StringPreference.newInstance("org.solovyev.android.calculator.CalculatorActivity_calc_theme", Theme.metro_blue_theme, Theme.class); - public static final Preference layout = StringPreference.newInstance("org.solovyev.android.calculator.CalculatorActivity_calc_layout", Layout.main_calculator, Layout.class); - public static final Preference feedbackWindowShown = new BooleanPreference("feedback_window_shown", false); - public static final Preference notesppAnnounceShown = new BooleanPreference("notespp_announce_shown", false); - public static final Preference showReleaseNotes = new BooleanPreference("org.solovyev.android.calculator.CalculatorActivity_show_release_notes", true); - public static final Preference 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); - - @NotNull - public static Theme getTheme(@NotNull SharedPreferences preferences) { - return theme.getPreferenceNoError(preferences); - } - - public static enum Theme { - - default_theme(ThemeType.other, R.style.default_theme), - violet_theme(ThemeType.other, R.style.violet_theme), - light_blue_theme(ThemeType.other, R.style.light_blue_theme), - metro_blue_theme(ThemeType.metro, R.style.metro_blue_theme), - metro_purple_theme(ThemeType.metro, R.style.metro_purple_theme), - metro_green_theme(ThemeType.metro, R.style.metro_green_theme); - - @NotNull - private final ThemeType themeType; - - @NotNull - private final Integer themeId; - - Theme(@NotNull ThemeType themeType, Integer themeId) { - this.themeType = themeType; - this.themeId = themeId; - } - - @NotNull - public ThemeType getThemeType() { - return themeType; - } - - @NotNull - public Integer getThemeId() { - return themeId; - } - } - - public static enum ThemeType { - metro, - other - } - - public static enum Layout { - main_calculator(R.layout.main_calculator), - main_cellphone(R.layout.main_cellphone), - simple(R.layout.main_calculator); - - private final int layoutId; - - Layout(int layoutId) { - this.layoutId = layoutId; - } - - public int getLayoutId() { - return layoutId; - } - } - } - - public static class Graph { - public static final Preference interpolate = new BooleanPreference("graph_interpolate", true); - public static final Preference lineColorReal = StringPreference.newInstance("graph_line_color_real", GraphLineColor.white, GraphLineColor.class); - public static final Preference lineColorImag = StringPreference.newInstance("graph_line_color_imag", GraphLineColor.blue, GraphLineColor.class); - - } - - - static void setDefaultValues(@NotNull SharedPreferences preferences) { - if (!AndroidCalculatorEngine.Preferences.groupingSeparator.isSet(preferences)) { - final Locale locale = Locale.getDefault(); - if (locale != null) { - final DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(locale); - int index = MathType.grouping_separator.getTokens().indexOf(String.valueOf(decimalFormatSymbols.getGroupingSeparator())); - final String groupingSeparator; - if (index >= 0) { - groupingSeparator = MathType.grouping_separator.getTokens().get(index); - } else { - groupingSeparator = " "; - } - - AndroidCalculatorEngine.Preferences.groupingSeparator.putPreference(preferences, groupingSeparator); - } - } - - if (!AndroidCalculatorEngine.Preferences.angleUnit.isSet(preferences)) { - AndroidCalculatorEngine.Preferences.angleUnit.putDefault(preferences); - } - - if (!AndroidCalculatorEngine.Preferences.numeralBase.isSet(preferences)) { - AndroidCalculatorEngine.Preferences.numeralBase.putDefault(preferences); - } - - if (!AndroidCalculatorEngine.Preferences.multiplicationSign.isSet(preferences)) { - if ( AndroidUtils.isPhoneModel(AndroidUtils.PhoneModel.samsung_galaxy_s) || AndroidUtils.isPhoneModel(AndroidUtils.PhoneModel.samsung_galaxy_s_2) ) { - // workaround ofr samsung galaxy s phones - AndroidCalculatorEngine.Preferences.multiplicationSign.putPreference(preferences, "*"); - } - } - } - -} +package org.solovyev.android.calculator; + +import android.content.SharedPreferences; +import org.jetbrains.annotations.NotNull; +import org.solovyev.android.AndroidUtils; +import org.solovyev.android.calculator.math.MathType; +import org.solovyev.android.calculator.model.AndroidCalculatorEngine; +import org.solovyev.android.calculator.plot.GraphLineColor; +import org.solovyev.android.prefs.BooleanPreference; +import org.solovyev.android.prefs.IntegerPreference; +import org.solovyev.android.prefs.Preference; +import org.solovyev.android.prefs.StringPreference; + +import java.text.DecimalFormatSymbols; +import java.util.Locale; + +/** + * User: serso + * Date: 4/20/12 + * Time: 12:42 PM + */ +public final class CalculatorPreferences { + + private CalculatorPreferences() { + throw new AssertionError(); + } + + public static final Preference appVersion = new IntegerPreference("application.version", -1); + public static final Preference appOpenedCounter = new IntegerPreference("app_opened_counter", 0); + + public static class Gui { + + public static final Preference theme = StringPreference.newInstance("org.solovyev.android.calculator.CalculatorActivity_calc_theme", Theme.metro_blue_theme, Theme.class); + public static final Preference layout = StringPreference.newInstance("org.solovyev.android.calculator.CalculatorActivity_calc_layout", Layout.main_calculator, Layout.class); + public static final Preference feedbackWindowShown = new BooleanPreference("feedback_window_shown", false); + public static final Preference notesppAnnounceShown = new BooleanPreference("notespp_announce_shown", false); + public static final Preference showReleaseNotes = new BooleanPreference("org.solovyev.android.calculator.CalculatorActivity_show_release_notes", true); + public static final Preference 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); + + @NotNull + public static Theme getTheme(@NotNull SharedPreferences preferences) { + return theme.getPreferenceNoError(preferences); + } + + public static enum Theme { + + default_theme(ThemeType.other, R.style.default_theme), + violet_theme(ThemeType.other, R.style.violet_theme), + light_blue_theme(ThemeType.other, R.style.light_blue_theme), + metro_blue_theme(ThemeType.metro, R.style.metro_blue_theme), + metro_purple_theme(ThemeType.metro, R.style.metro_purple_theme), + metro_green_theme(ThemeType.metro, R.style.metro_green_theme); + + @NotNull + private final ThemeType themeType; + + @NotNull + private final Integer themeId; + + Theme(@NotNull ThemeType themeType, Integer themeId) { + this.themeType = themeType; + this.themeId = themeId; + } + + @NotNull + public ThemeType getThemeType() { + return themeType; + } + + @NotNull + public Integer getThemeId() { + return themeId; + } + } + + public static enum ThemeType { + metro, + other + } + + public static enum Layout { + main_calculator(R.layout.main_calculator), + main_cellphone(R.layout.main_cellphone), + simple(R.layout.main_calculator); + + private final int layoutId; + + Layout(int layoutId) { + this.layoutId = layoutId; + } + + public int getLayoutId() { + return layoutId; + } + } + } + + public static class Graph { + public static final Preference interpolate = new BooleanPreference("graph_interpolate", true); + public static final Preference lineColorReal = StringPreference.newInstance("graph_line_color_real", GraphLineColor.white, GraphLineColor.class); + public static final Preference lineColorImag = StringPreference.newInstance("graph_line_color_imag", GraphLineColor.blue, GraphLineColor.class); + } + + + static void setDefaultValues(@NotNull SharedPreferences preferences) { + if (!AndroidCalculatorEngine.Preferences.groupingSeparator.isSet(preferences)) { + final Locale locale = Locale.getDefault(); + if (locale != null) { + final DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(locale); + int index = MathType.grouping_separator.getTokens().indexOf(String.valueOf(decimalFormatSymbols.getGroupingSeparator())); + final String groupingSeparator; + if (index >= 0) { + groupingSeparator = MathType.grouping_separator.getTokens().get(index); + } else { + groupingSeparator = " "; + } + + AndroidCalculatorEngine.Preferences.groupingSeparator.putPreference(preferences, groupingSeparator); + } + } + + if (!AndroidCalculatorEngine.Preferences.angleUnit.isSet(preferences)) { + AndroidCalculatorEngine.Preferences.angleUnit.putDefault(preferences); + } + + if (!AndroidCalculatorEngine.Preferences.numeralBase.isSet(preferences)) { + AndroidCalculatorEngine.Preferences.numeralBase.putDefault(preferences); + } + + if (!AndroidCalculatorEngine.Preferences.multiplicationSign.isSet(preferences)) { + if ( AndroidUtils.isPhoneModel(AndroidUtils.PhoneModel.samsung_galaxy_s) || AndroidUtils.isPhoneModel(AndroidUtils.PhoneModel.samsung_galaxy_s_2) ) { + // workaround ofr samsung galaxy s phones + AndroidCalculatorEngine.Preferences.multiplicationSign.putPreference(preferences, "*"); + } + } + + applyDefaultPreference(preferences, Gui.theme); + applyDefaultPreference(preferences, Gui.layout); + applyDefaultPreference(preferences, Gui.feedbackWindowShown); + applyDefaultPreference(preferences, Gui.notesppAnnounceShown); + applyDefaultPreference(preferences, Gui.showReleaseNotes); + applyDefaultPreference(preferences, Gui.usePrevAsBack); + applyDefaultPreference(preferences, Gui.showEqualsButton); + applyDefaultPreference(preferences, Gui.autoOrientation); + applyDefaultPreference(preferences, Gui.hideNumeralBaseDigits); + applyDefaultPreference(preferences, Gui.theme); + applyDefaultPreference(preferences, Gui.theme); + + applyDefaultPreference(preferences, Graph.interpolate); + applyDefaultPreference(preferences, Graph.lineColorImag); + applyDefaultPreference(preferences, Graph.lineColorReal); + + } + + private static void applyDefaultPreference(@NotNull SharedPreferences preferences, @NotNull Preference preference) { + if (!preference.isSet(preferences)) { + preference.putDefault(preferences); + } + } + +} diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/about/CalculatorReleaseNotesFragment.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/about/CalculatorReleaseNotesFragment.java index 480b92e3..24c9b8ad 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/about/CalculatorReleaseNotesFragment.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/about/CalculatorReleaseNotesFragment.java @@ -14,7 +14,7 @@ import android.view.View; import android.widget.TextView; import org.jetbrains.annotations.NotNull; import org.solovyev.android.AndroidUtils; -import org.solovyev.android.calculator.CalculatorActivity; +import org.solovyev.android.calculator.CalculatorApplication; import org.solovyev.android.calculator.CalculatorFragment; import org.solovyev.android.calculator.R; import org.solovyev.common.text.StringUtils; @@ -50,9 +50,9 @@ public class CalculatorReleaseNotesFragment extends CalculatorFragment { final StringBuilder result = new StringBuilder(); final String releaseNotesForTitle = context.getString(R.string.c_release_notes_for_title); - final int version = AndroidUtils.getAppVersionCode(context, CalculatorActivity.class.getPackage().getName()); + final int version = AndroidUtils.getAppVersionCode(context, CalculatorApplication.class.getPackage().getName()); - final TextHelper textHelper = new TextHelper(context.getResources(), R.class.getPackage().getName()); + final TextHelper textHelper = new TextHelper(context.getResources(), CalculatorApplication.class.getPackage().getName()); boolean first = true; for ( int i = version; i >= minVersion; i-- ) { diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/view/NumeralBaseConverterDialog.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/view/NumeralBaseConverterDialog.java index b94e930e..5bcaaf6f 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/view/NumeralBaseConverterDialog.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/view/NumeralBaseConverterDialog.java @@ -6,12 +6,15 @@ import android.view.View; import android.view.WindowManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.solovyev.android.calculator.*; +import org.solovyev.android.calculator.CalculatorLocatorImpl; +import org.solovyev.android.calculator.CalculatorParseException; +import org.solovyev.android.calculator.R; +import org.solovyev.android.calculator.ToJsclTextProcessor; import org.solovyev.android.calculator.units.CalculatorNumeralBase; -import org.solovyev.math.units.Unit; -import org.solovyev.math.units.UnitImpl; import org.solovyev.common.MutableObject; import org.solovyev.common.text.StringUtils; +import org.solovyev.math.units.Unit; +import org.solovyev.math.units.UnitImpl; import java.util.Arrays; @@ -64,8 +67,8 @@ public class NumeralBaseConverterDialog { public void onClick(@NotNull Unit fromUnits, @NotNull Unit toUnits) { String toUnitsValue = toUnits.getValue(); - if (!toUnits.getUnitType().equals(AndroidNumeralBase.valueOf(CalculatorLocatorImpl.getInstance().getEngine().getNumeralBase()))) { - toUnitsValue = ((AndroidNumeralBase) toUnits.getUnitType()).getNumeralBase().getJsclPrefix() + toUnitsValue; + if (!toUnits.getUnitType().equals(CalculatorNumeralBase.valueOf(CalculatorLocatorImpl.getInstance().getEngine().getNumeralBase()))) { + toUnitsValue = ((CalculatorNumeralBase) toUnits.getUnitType()).getNumeralBase().getJsclPrefix() + toUnitsValue; } CalculatorLocatorImpl.getInstance().getKeyboard().digitButtonPressed(toUnitsValue);