Fixes dut library update
This commit is contained in:
parent
cf9a609d6b
commit
f909b49c7c
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:range="http://schemas.android.com/apk/res/org.solovyev.android.calculator">
|
xmlns:range="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
a:key="@string/p_calc_ad_free_key"
|
a:key="@string/p_calc_ad_free_key"
|
||||||
@ -26,7 +26,7 @@
|
|||||||
a:title="@string/c_calc_round_result_title"
|
a:title="@string/c_calc_round_result_title"
|
||||||
a:defaultValue="true"/>
|
a:defaultValue="true"/>
|
||||||
|
|
||||||
<org.solovyev.android.prefs.NumberPickerDialogPreference
|
<org.solovyev.android.prefs.IntegerPickerDialogPreference
|
||||||
a:key="@string/p_calc_result_precision_key"
|
a:key="@string/p_calc_result_precision_key"
|
||||||
a:title="@string/p_calc_result_precision_title"
|
a:title="@string/p_calc_result_precision_title"
|
||||||
a:summary="@string/c_calc_result_precision_summary"
|
a:summary="@string/c_calc_result_precision_summary"
|
||||||
@ -57,7 +57,7 @@
|
|||||||
a:summary="@string/c_numeral_bases_summary"
|
a:summary="@string/c_numeral_bases_summary"
|
||||||
a:entryValues="@array/p_numeral_bases"/>
|
a:entryValues="@array/p_numeral_bases"/>
|
||||||
|
|
||||||
<org.solovyev.android.prefs.NumberPickerDialogPreference
|
<org.solovyev.android.prefs.IntegerPickerDialogPreference
|
||||||
a:key="@string/p_calc_max_calculation_time_key"
|
a:key="@string/p_calc_max_calculation_time_key"
|
||||||
a:title="@string/p_calc_max_calculation_time_title"
|
a:title="@string/p_calc_max_calculation_time_title"
|
||||||
a:summary="@string/p_calc_max_calculation_time_summary"
|
a:summary="@string/p_calc_max_calculation_time_summary"
|
||||||
|
@ -31,7 +31,6 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.AndroidUtils;
|
||||||
import org.solovyev.android.FontSizeAdjuster;
|
import org.solovyev.android.FontSizeAdjuster;
|
||||||
import org.solovyev.android.LocalBinder;
|
import org.solovyev.android.LocalBinder;
|
||||||
import org.solovyev.android.ResourceCache;
|
|
||||||
import org.solovyev.android.calculator.about.CalculatorReleaseNotesActivity;
|
import org.solovyev.android.calculator.about.CalculatorReleaseNotesActivity;
|
||||||
import org.solovyev.android.calculator.history.CalculatorHistory;
|
import org.solovyev.android.calculator.history.CalculatorHistory;
|
||||||
import org.solovyev.android.calculator.history.CalculatorHistoryState;
|
import org.solovyev.android.calculator.history.CalculatorHistoryState;
|
||||||
@ -52,6 +51,11 @@ import org.solovyev.common.math.Point2d;
|
|||||||
import org.solovyev.common.text.StringUtils;
|
import org.solovyev.common.text.StringUtils;
|
||||||
import org.solovyev.common.history.HistoryAction;
|
import org.solovyev.common.history.HistoryAction;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CalculatorActivity extends Activity implements FontSizeAdjuster, SharedPreferences.OnSharedPreferenceChangeListener, ServiceConnection {
|
public class CalculatorActivity extends Activity implements FontSizeAdjuster, SharedPreferences.OnSharedPreferenceChangeListener, ServiceConnection {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ -122,8 +126,6 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceCache.instance.initCaptions(CalculatorApplication.getInstance(), R.string.class);
|
|
||||||
|
|
||||||
billingObserver = new CalculatorBillingObserver(this);
|
billingObserver = new CalculatorBillingObserver(this);
|
||||||
BillingController.registerObserver(billingObserver);
|
BillingController.registerObserver(billingObserver);
|
||||||
|
|
||||||
@ -381,7 +383,28 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh
|
|||||||
private synchronized void setOnDragListeners(@NotNull SimpleOnDragListener.Preferences dragPreferences, @NotNull SharedPreferences preferences) {
|
private synchronized void setOnDragListeners(@NotNull SimpleOnDragListener.Preferences dragPreferences, @NotNull SharedPreferences preferences) {
|
||||||
final OnDragListener onDragListener = new OnDragListenerVibrator(newOnDragListener(new DigitButtonDragProcessor(calculatorModel), dragPreferences), vibrator, preferences);
|
final OnDragListener onDragListener = new OnDragListenerVibrator(newOnDragListener(new DigitButtonDragProcessor(calculatorModel), dragPreferences), vibrator, preferences);
|
||||||
|
|
||||||
for (Integer dragButtonId : ResourceCache.instance.getDragButtonIds()) {
|
final List<Integer> dragButtonIds = new ArrayList<Integer>();
|
||||||
|
final List<Integer> buttonIds = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
for (Field field : R.id.class.getDeclaredFields()) {
|
||||||
|
int modifiers = field.getModifiers();
|
||||||
|
if (Modifier.isFinal(modifiers) && Modifier.isStatic(modifiers)) {
|
||||||
|
try {
|
||||||
|
int viewId = field.getInt(R.id.class);
|
||||||
|
final View view = this.findViewById(viewId);
|
||||||
|
if (view instanceof DragButton) {
|
||||||
|
dragButtonIds.add(viewId);
|
||||||
|
}
|
||||||
|
if (view instanceof Button) {
|
||||||
|
buttonIds.add(viewId);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
Log.e(R.id.class.getName(), e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Integer dragButtonId : dragButtonIds) {
|
||||||
((DragButton) findViewById(dragButtonId)).setOnDragListener(onDragListener);
|
((DragButton) findViewById(dragButtonId)).setOnDragListener(onDragListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -469,8 +492,6 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh
|
|||||||
dialogShown = showSpecialWindow(preferences, CalculatorPreferences.Gui.notesppAnnounceShown, R.layout.notespp_announce, R.id.notespp_announce);
|
dialogShown = showSpecialWindow(preferences, CalculatorPreferences.Gui.notesppAnnounceShown, R.layout.notespp_announce, R.id.notespp_announce);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceCache.instance.initCaptions(this, R.id.class);
|
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ import android.text.method.LinkMovementMethod;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.AndroidUtils;
|
||||||
import org.solovyev.android.ResourceCache;
|
|
||||||
import org.solovyev.android.calculator.CalculatorActivity;
|
import org.solovyev.android.calculator.CalculatorActivity;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.common.text.StringUtils;
|
import org.solovyev.common.text.StringUtils;
|
||||||
|
@ -15,6 +15,8 @@ import jscl.math.operator.Operator;
|
|||||||
import jscl.text.ParseInterruptedException;
|
import jscl.text.ParseInterruptedException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.solovyev.android.calculator.CalculatorApplication;
|
||||||
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||||
import org.solovyev.android.prefs.BooleanPreference;
|
import org.solovyev.android.prefs.BooleanPreference;
|
||||||
import org.solovyev.android.prefs.Preference;
|
import org.solovyev.android.prefs.Preference;
|
||||||
@ -227,10 +229,10 @@ public enum CalculatorEngine {
|
|||||||
evalException.setObject(new CalculatorEvalException(e, e, jsclExpression));
|
evalException.setObject(new CalculatorEvalException(e, e, jsclExpression));
|
||||||
} catch (ArithmeticException e) {
|
} catch (ArithmeticException e) {
|
||||||
//System.out.println(e.getMessage());
|
//System.out.println(e.getMessage());
|
||||||
parseException.setObject(new CalculatorParseException(Messages.msg_1, jsclExpression, e.getMessage()));
|
parseException.setObject(new CalculatorParseException(R.string.msg_1, CalculatorApplication.getInstance(), jsclExpression, e.getMessage()));
|
||||||
} catch (StackOverflowError e) {
|
} catch (StackOverflowError e) {
|
||||||
//System.out.println(StringUtils.fromStackTrace(e.getStackTrace()));
|
//System.out.println(StringUtils.fromStackTrace(e.getStackTrace()));
|
||||||
parseException.setObject(new CalculatorParseException(Messages.msg_2, jsclExpression));
|
parseException.setObject(new CalculatorParseException(R.string.msg_2, CalculatorApplication.getInstance(), jsclExpression));
|
||||||
} catch (jscl.text.ParseException e) {
|
} catch (jscl.text.ParseException e) {
|
||||||
//System.out.println(e.getMessage());
|
//System.out.println(e.getMessage());
|
||||||
parseException.setObject(new CalculatorParseException(e));
|
parseException.setObject(new CalculatorParseException(e));
|
||||||
@ -276,11 +278,11 @@ public enum CalculatorEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (calculationResultLocal == null) {
|
if (calculationResultLocal == null) {
|
||||||
throw new CalculatorParseException(Messages.msg_3, jsclExpression);
|
throw new CalculatorParseException(R.string.msg_3, CalculatorApplication.getInstance(), jsclExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new CalculatorParseException(Messages.msg_4, jsclExpression);
|
throw new CalculatorParseException(R.string.msg_4, CalculatorApplication.getInstance(), jsclExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Generic genericResult = calculationResult.getObject();
|
final Generic genericResult = calculationResult.getObject();
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
package org.solovyev.android.calculator.model;
|
package org.solovyev.android.calculator.model;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.msg.AndroidMessage;
|
import org.solovyev.android.msg.AndroidMessage;
|
||||||
@ -38,14 +39,14 @@ public class CalculatorParseException extends SersoException implements Message
|
|||||||
this.position = jsclParseException.getPosition();
|
this.position = jsclParseException.getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CalculatorParseException(@NotNull String messageId, @Nullable Integer position, @NotNull String expression, Object... parameters) {
|
public CalculatorParseException(@NotNull Integer messageId, @NotNull Application application, @Nullable Integer position, @NotNull String expression, Object... parameters) {
|
||||||
this.message = new AndroidMessage(messageId, MessageType.error, parameters);
|
this.message = new AndroidMessage(messageId, MessageType.error, application, parameters);
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CalculatorParseException(@NotNull String messageId, @NotNull String expression, Object... parameters) {
|
public CalculatorParseException(@NotNull Integer messageId, @NotNull Application application, @NotNull String expression, Object... parameters) {
|
||||||
this(messageId, null, expression, parameters);
|
this(messageId, application, null, expression, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -8,6 +8,8 @@ package org.solovyev.android.calculator.model;
|
|||||||
|
|
||||||
import jscl.math.function.IConstant;
|
import jscl.math.function.IConstant;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.solovyev.android.calculator.CalculatorApplication;
|
||||||
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.common.StartsWithFinder;
|
import org.solovyev.common.StartsWithFinder;
|
||||||
import org.solovyev.android.calculator.math.MathType;
|
import org.solovyev.android.calculator.math.MathType;
|
||||||
import org.solovyev.common.collections.CollectionsUtils;
|
import org.solovyev.common.collections.CollectionsUtils;
|
||||||
@ -73,7 +75,7 @@ public class ToJsclTextProcessor implements TextProcessor<PreparedExpression, St
|
|||||||
if (mathTypeBefore != null &&
|
if (mathTypeBefore != null &&
|
||||||
(mathTypeBefore.getMathType() == MathType.function || mathTypeBefore.getMathType() == MathType.operator) &&
|
(mathTypeBefore.getMathType() == MathType.function || mathTypeBefore.getMathType() == MathType.operator) &&
|
||||||
CollectionsUtils.find(MathType.openGroupSymbols, startsWithFinder) != null) {
|
CollectionsUtils.find(MathType.openGroupSymbols, startsWithFinder) != null) {
|
||||||
throw new CalculatorParseException(Messages.msg_5, i, s, mathTypeBefore.getMatch());
|
throw new CalculatorParseException(R.string.msg_5, CalculatorApplication.getInstance(), i, s, mathTypeBefore.getMatch());
|
||||||
}
|
}
|
||||||
|
|
||||||
i = mathTypeResult.processToJscl(result, i);
|
i = mathTypeResult.processToJscl(result, i);
|
||||||
@ -84,7 +86,7 @@ public class ToJsclTextProcessor implements TextProcessor<PreparedExpression, St
|
|||||||
@NotNull
|
@NotNull
|
||||||
private static PreparedExpression replaceVariables(@NotNull final String s, int depth, @NotNull List<IConstant> undefinedVars) throws CalculatorParseException {
|
private static PreparedExpression replaceVariables(@NotNull final String s, int depth, @NotNull List<IConstant> undefinedVars) throws CalculatorParseException {
|
||||||
if (depth >= MAX_DEPTH) {
|
if (depth >= MAX_DEPTH) {
|
||||||
throw new CalculatorParseException(Messages.msg_6, s);
|
throw new CalculatorParseException(R.string.msg_6, CalculatorApplication.getInstance(), s);
|
||||||
} else {
|
} else {
|
||||||
depth++;
|
depth++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user