This commit is contained in:
Sergey Solovyev
2012-11-18 15:20:01 +04:00
parent 96d937e74b
commit 5e357da74a
8 changed files with 40 additions and 33 deletions

View File

@@ -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);

View File

@@ -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;
}
}
/*