number formatting is working now

This commit is contained in:
Sergey Solovyev
2013-06-28 00:02:30 +04:00
parent c91d57a92c
commit 8d15db4c3f
25 changed files with 301 additions and 273 deletions

View File

@@ -173,13 +173,13 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem
}
private void updateEditorState(@Nonnull Context context, @Nonnull RemoteViews views, @Nonnull CalculatorEditorViewState editorState) {
String text = editorState.getText();
final CharSequence text = editorState.getTextAsCharSequence();
CharSequence newText = text;
int selection = editorState.getSelection();
if (selection >= 0 && selection <= text.length()) {
// inject cursor
newText = Html.fromHtml(text.substring(0, selection) + "<font color=\"#" + getCursorColor(context) + "\">|</font>" + text.substring(selection));
newText = Html.fromHtml(text.subSequence(0, selection) + "<font color=\"#" + getCursorColor(context) + "\">|</font>" + text.subSequence(selection, text.length()));
}
Locator.getInstance().getNotifier().showDebugMessage(TAG, "New editor state: " + text);
views.setTextViewText(R.id.calculator_editor, newText);