From e26e1a6b6c4ec4df56dc4ab1e4c534411d2e210f Mon Sep 17 00:00:00 2001 From: Sergey Solovyev Date: Thu, 27 Oct 2011 11:35:35 +0400 Subject: [PATCH] history changes --- res/layout/calc_history_button.xml | 2 +- res/values-ru/strings.xml | 4 +-- res/values/strings.xml | 6 ++-- .../android/calculator/CalculatorModel.java | 35 +++++++++++++------ .../android/view/widgets/ColorButton.java | 10 ++++++ 5 files changed, 41 insertions(+), 16 deletions(-) diff --git a/res/layout/calc_history_button.xml b/res/layout/calc_history_button.xml index 3b70e78e..57a5de5e 100644 --- a/res/layout/calc_history_button.xml +++ b/res/layout/calc_history_button.xml @@ -11,7 +11,7 @@ a:text="@string/c_history_button" calc:textUp="@string/c_undo" calc:textDown="@string/c_redo" - calc:hTextPosition="0.33" + calc:hTextPosition="0.25" style="?controlButtonStyle" a:textStyle="bold" a:onClick="historyButtonClickHandler"/> \ No newline at end of file diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 2a845c7f..cdb22f0e 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -27,7 +27,7 @@ За подробной информацией, пожалуйста,\nобращайтесь на почту\nse.solovyev@gmail.com\n или посетите сайт \nhttp://se.solovyev.org\n\n Если вы хотите поддержать проект материально\nвы можете сделать это через \nhttp://paypal.com\n\n - Если вам понравилось приложение - поставте 5 звёздочек в андроид.маркете + Если вам понравилось приложение -\nпоставте 5 звёздочек в\nандроид.маркете назад @@ -78,7 +78,7 @@ пожертвовать денег через\n\n http://paypal.com\n\n - или поставить 5 звёздочек в андроид.маркете + или поставить 5 звёздочек в\n\nандроид.маркете История diff --git a/res/values/strings.xml b/res/values/strings.xml index cd7480c6..d7fcd38c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -28,7 +28,7 @@ For more information please\ncontact the author by email\nse.solovyev@gmail.com \nor visit\nhttp://se.solovyev.org\n\n If you want to support the project\nyou can donate money via\nhttp://paypal.com\n\n - If you like the application rank it with 5 stars in android.market + If you like the application\nrank it with 5 stars in\nandroid.market undo @@ -79,8 +79,8 @@ Donate You can thank the author of this program by email\n\n se.solovyev@gmail.com\n\n - donating money via\n\nhttp://paypal.com\n - or setting 5 stars in android.market + donating money via\n\nhttp://paypal.com\n\n + or setting 5 stars in\n\nandroid.market History M diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorModel.java b/src/main/java/org/solovyev/android/calculator/CalculatorModel.java index d9f9b5a6..e7a22584 100644 --- a/src/main/java/org/solovyev/android/calculator/CalculatorModel.java +++ b/src/main/java/org/solovyev/android/calculator/CalculatorModel.java @@ -135,15 +135,20 @@ public enum CalculatorModel implements CursorControl, HistoryControl pendingOperation = new MutableObject(); - private void evaluate(boolean delayEvaluate, @NotNull final String expression, @NotNull final JsclOperation operation) { - final CalculatorHistoryState historyState = getCurrentHistoryState(); + private void evaluate(boolean delayEvaluate, @NotNull final String expression, @NotNull final JsclOperation operation, @Nullable CalculatorHistoryState historyState) { + final CalculatorHistoryState localHistoryState; + if (historyState == null) { + localHistoryState = getCurrentHistoryState(); + } else { + localHistoryState = historyState; + } pendingOperation.setObject(new Runnable() { @Override @@ -155,7 +160,7 @@ public enum CalculatorModel implements CursorControl, HistoryControl