Changes
This commit is contained in:
@@ -120,7 +120,7 @@ public class CalculatorActivityLauncher {
|
||||
context.startActivity(intent);
|
||||
}
|
||||
} else {
|
||||
CalculatorLocatorImpl.getInstance().getNotifier().showMessage(R.string.not_valid_result, MessageType.error);
|
||||
CalculatorLocatorImpl.getInstance().getNotifier().showMessage(R.string.c_value_is_not_a_number, MessageType.error);
|
||||
}
|
||||
} else {
|
||||
CalculatorLocatorImpl.getInstance().getNotifier().showMessage(R.string.empty_var_error, MessageType.error);
|
||||
|
@@ -118,8 +118,15 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
|
||||
}
|
||||
|
||||
public static boolean isValidValue(@NotNull String value) {
|
||||
// now every string might be constant
|
||||
return true;
|
||||
try {
|
||||
final PreparedExpression expression = ToJsclTextProcessor.getInstance().process(value);
|
||||
final List<IConstant> constants = expression.getUndefinedVars();
|
||||
return constants.isEmpty();
|
||||
} catch (RuntimeException e) {
|
||||
return true;
|
||||
} catch (CalculatorParseException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user