lint warnings fixed
This commit is contained in:
parent
6aa5802dea
commit
545cdf2319
@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ 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
|
|
||||||
-->
|
|
||||||
|
|
||||||
<resources>
|
|
||||||
<string name="p_calc_functions">org.solovyev.android.calculator.CalculatorModel_functions</string>
|
|
||||||
<string name="p_calc_vars">org.solovyev.android.calculator.CalculatorModel_vars</string>
|
|
||||||
</resources>
|
|
@ -128,8 +128,8 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen
|
|||||||
|
|
||||||
final JsclMathEngine engine = JsclMathEngine.getInstance();
|
final JsclMathEngine engine = JsclMathEngine.getInstance();
|
||||||
this.calculatorEngine = new CalculatorEngineImpl(engine,
|
this.calculatorEngine = new CalculatorEngineImpl(engine,
|
||||||
new CalculatorVarsRegistry(engine.getConstantsRegistry(), new AndroidMathEntityDao<Var>(R.string.p_calc_vars, application, Vars.class)),
|
new CalculatorVarsRegistry(engine.getConstantsRegistry(), new AndroidMathEntityDao<Var>("org.solovyev.android.calculator.CalculatorModel_vars", application, Vars.class)),
|
||||||
new CalculatorFunctionsMathRegistry(engine.getFunctionsRegistry(), new AndroidMathEntityDao<AFunction>(R.string.p_calc_functions, application, Functions.class)),
|
new CalculatorFunctionsMathRegistry(engine.getFunctionsRegistry(), new AndroidMathEntityDao<AFunction>("org.solovyev.android.calculator.CalculatorModel_functions", application, Functions.class)),
|
||||||
new CalculatorOperatorsMathRegistry(engine.getOperatorsRegistry(), new AndroidMathEntityDao<MathPersistenceEntity>(null, application, null)),
|
new CalculatorOperatorsMathRegistry(engine.getOperatorsRegistry(), new AndroidMathEntityDao<MathPersistenceEntity>(null, application, null)),
|
||||||
new CalculatorPostfixFunctionsRegistry(engine.getPostfixFunctionsRegistry(), new AndroidMathEntityDao<MathPersistenceEntity>(null, application, null)),
|
new CalculatorPostfixFunctionsRegistry(engine.getPostfixFunctionsRegistry(), new AndroidMathEntityDao<MathPersistenceEntity>(null, application, null)),
|
||||||
this.lock);
|
this.lock);
|
||||||
|
@ -51,7 +51,7 @@ public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements Ma
|
|||||||
private static final String TAG = AndroidMathEntityDao.class.getSimpleName();
|
private static final String TAG = AndroidMathEntityDao.class.getSimpleName();
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private final Integer preferenceStringId;
|
private final String preferenceString;
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final Context context;
|
private final Context context;
|
||||||
@ -59,17 +59,17 @@ public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements Ma
|
|||||||
@Nullable
|
@Nullable
|
||||||
private final Class<? extends MathEntityPersistenceContainer<T>> persistenceContainerClass;
|
private final Class<? extends MathEntityPersistenceContainer<T>> persistenceContainerClass;
|
||||||
|
|
||||||
public AndroidMathEntityDao(@Nullable Integer preferenceStringId,
|
public AndroidMathEntityDao(@Nullable String preferenceString,
|
||||||
@Nonnull Application application,
|
@Nonnull Application application,
|
||||||
@Nullable Class<? extends MathEntityPersistenceContainer<T>> persistenceContainerClass) {
|
@Nullable Class<? extends MathEntityPersistenceContainer<T>> persistenceContainerClass) {
|
||||||
this.preferenceStringId = preferenceStringId;
|
this.preferenceString = preferenceString;
|
||||||
this.context = application;
|
this.context = application;
|
||||||
this.persistenceContainerClass = persistenceContainerClass;
|
this.persistenceContainerClass = persistenceContainerClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(@Nonnull MathEntityPersistenceContainer<T> container) {
|
public void save(@Nonnull MathEntityPersistenceContainer<T> container) {
|
||||||
if (preferenceStringId != null) {
|
if (preferenceString != null) {
|
||||||
final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
final SharedPreferences.Editor editor = settings.edit();
|
final SharedPreferences.Editor editor = settings.edit();
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements Ma
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.putString(context.getString(preferenceStringId), sw.toString());
|
editor.putString(preferenceString, sw.toString());
|
||||||
|
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
@ -90,11 +90,11 @@ public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements Ma
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public MathEntityPersistenceContainer<T> load() {
|
public MathEntityPersistenceContainer<T> load() {
|
||||||
if (persistenceContainerClass != null && preferenceStringId != null) {
|
if (persistenceContainerClass != null && preferenceString != null) {
|
||||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
|
||||||
if (preferences != null) {
|
if (preferences != null) {
|
||||||
final String value = preferences.getString(context.getString(preferenceStringId), null);
|
final String value = preferences.getString(preferenceString, null);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
final Serializer serializer = new Persister();
|
final Serializer serializer = new Persister();
|
||||||
try {
|
try {
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<item>@string/p_layout_simple</item>
|
<item>@string/p_layout_simple</item>
|
||||||
<item>@string/p_layout_simple_mobile</item>
|
<item>@string/p_layout_simple_mobile</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="p_layout_values">
|
<string-array name="p_layout_values" translatable="false">
|
||||||
<item>main_calculator</item>
|
<item>main_calculator</item>
|
||||||
<item>main_calculator_mobile</item>
|
<item>main_calculator_mobile</item>
|
||||||
<item>simple</item>
|
<item>simple</item>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<item>@string/p_metro_green_theme</item>
|
<item>@string/p_metro_green_theme</item>
|
||||||
<item>@string/p_metro_purple_theme</item>
|
<item>@string/p_metro_purple_theme</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="p_theme_values">
|
<string-array name="p_theme_values" translatable="false">
|
||||||
<item>default_theme</item>
|
<item>default_theme</item>
|
||||||
<item>violet_theme</item>
|
<item>violet_theme</item>
|
||||||
<item>light_blue_theme</item>
|
<item>light_blue_theme</item>
|
||||||
@ -43,13 +43,13 @@
|
|||||||
<item>@string/p_grouping_separator_apostrophe</item>
|
<item>@string/p_grouping_separator_apostrophe</item>
|
||||||
<item>@string/p_grouping_separator_space</item>
|
<item>@string/p_grouping_separator_space</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="p_grouping_separator_values">
|
<string-array name="p_grouping_separator_values" translatable="false">
|
||||||
<item>""</item>
|
<item>""</item>
|
||||||
<item>\'</item>
|
<item>\'</item>
|
||||||
<item>" "</item>
|
<item>" "</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="p_multiplication_sign_values">
|
<string-array name="p_multiplication_sign_values" translatable="false">
|
||||||
<item>"*"</item>
|
<item>"*"</item>
|
||||||
<item>"×"</item>
|
<item>"×"</item>
|
||||||
<item>"∙"</item>
|
<item>"∙"</item>
|
||||||
@ -59,7 +59,7 @@
|
|||||||
<item>@string/p_layout_calculator</item>
|
<item>@string/p_layout_calculator</item>
|
||||||
<item>@string/p_layout_simple</item>
|
<item>@string/p_layout_simple</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="p_layout_values">
|
<string-array name="p_layout_values" translatable="false">
|
||||||
<item>main_calculator</item>
|
<item>main_calculator</item>
|
||||||
<item>simple</item>
|
<item>simple</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@ -69,7 +69,7 @@
|
|||||||
<item>@string/p_calc_haptic_feedback_strength_middle</item>
|
<item>@string/p_calc_haptic_feedback_strength_middle</item>
|
||||||
<item>@string/p_calc_haptic_feedback_strength_long</item>
|
<item>@string/p_calc_haptic_feedback_strength_long</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="p_calc_haptic_feedback_duration_values">
|
<string-array name="p_calc_haptic_feedback_duration_values" translatable="false">
|
||||||
<item>30</item>
|
<item>30</item>
|
||||||
<item>60</item>
|
<item>60</item>
|
||||||
<item>100</item>
|
<item>100</item>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
<item>@string/p_grad</item>
|
<item>@string/p_grad</item>
|
||||||
<item>@string/p_turns</item>
|
<item>@string/p_turns</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="p_angle_units">
|
<string-array name="p_angle_units" translatable="false">
|
||||||
<item>deg</item>
|
<item>deg</item>
|
||||||
<item>rad</item>
|
<item>rad</item>
|
||||||
<item>grad</item>
|
<item>grad</item>
|
||||||
@ -94,7 +94,7 @@
|
|||||||
<item>@string/p_oct</item>
|
<item>@string/p_oct</item>
|
||||||
<item>@string/p_bin</item>
|
<item>@string/p_bin</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="p_numeral_bases">
|
<string-array name="p_numeral_bases" translatable="false">
|
||||||
<item>dec</item>
|
<item>dec</item>
|
||||||
<item>hex</item>
|
<item>hex</item>
|
||||||
<item>oct</item>
|
<item>oct</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user