diff --git a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayImpl.java b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayImpl.java index a5318509..6ec34bb6 100644 --- a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayImpl.java +++ b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayImpl.java @@ -13,10 +13,7 @@ import static org.solovyev.android.calculator.CalculatorEventType.*; public class CalculatorDisplayImpl implements CalculatorDisplay { @NotNull - private volatile CalculatorEventData lastCalculatorEventData; - - @NotNull - private final Object lastCalculatorEventDataLock = new Object(); + private final CalculatorEventHolder lastEvent; @Nullable private CalculatorDisplayView view; @@ -32,7 +29,7 @@ public class CalculatorDisplayImpl implements CalculatorDisplay { public CalculatorDisplayImpl(@NotNull Calculator calculator) { this.calculator = calculator; - this.lastCalculatorEventData = CalculatorUtils.createFirstEventDataId(); + this.lastEvent = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId()); this.calculator.addCalculatorEventListener(this); } @@ -91,9 +88,7 @@ public class CalculatorDisplayImpl implements CalculatorDisplay { @Override @NotNull public CalculatorEventData getLastEventData() { - synchronized (lastCalculatorEventDataLock) { - return lastCalculatorEventData; - } + return lastEvent.getLastEventData(); } @Override @@ -102,18 +97,9 @@ public class CalculatorDisplayImpl implements CalculatorDisplay { @Nullable Object data) { if (calculatorEventType.isOfType(calculation_result, calculation_failed, calculation_cancelled, conversion_result, conversion_failed)) { - boolean processEvent = false; - boolean sameSequence = false; + final CalculatorEventHolder.Result result = lastEvent.apply(calculatorEventData); - synchronized (lastCalculatorEventDataLock) { - if (calculatorEventData.isAfter(lastCalculatorEventData)) { - sameSequence = calculatorEventData.isSameSequence(lastCalculatorEventData); - lastCalculatorEventData = calculatorEventData; - processEvent = true; - } - } - - if (processEvent) { + if (result.isNewAfter()) { switch (calculatorEventType) { case conversion_failed: processConversationFailed((CalculatorConversionEventData) calculatorEventData, (ConversionFailure) data); diff --git a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorEditorImpl.java b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorEditorImpl.java index f9162d49..570a119f 100644 --- a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorEditorImpl.java +++ b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorEditorImpl.java @@ -26,12 +26,16 @@ public class CalculatorEditorImpl implements CalculatorEditor { @NotNull private final Calculator calculator; + @NotNull + private final CalculatorEventHolder lastEventHolder; + @NotNull private final CursorControlAdapter cursorControlAdapter = new CursorControlAdapter(this); public CalculatorEditorImpl(@NotNull Calculator calculator) { this.calculator = calculator; this.calculator.addCalculatorEventListener(this); + this.lastEventHolder = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId()); } @Override @@ -80,12 +84,16 @@ public class CalculatorEditorImpl implements CalculatorEditor { public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { - switch (calculatorEventType) { - case use_history_state: - final CalculatorHistoryState calculatorHistoryState = (CalculatorHistoryState)data; - final EditorHistoryState editorState = calculatorHistoryState.getEditorState(); - this.setText(StringUtils.getNotEmpty(editorState.getText(), ""), editorState.getCursorPosition()); - break; + final CalculatorEventHolder.Result result = lastEventHolder.apply(calculatorEventData); + + if (result.isNewAfter()) { + switch (calculatorEventType) { + case use_history_state: + final CalculatorHistoryState calculatorHistoryState = (CalculatorHistoryState)data; + final EditorHistoryState editorState = calculatorHistoryState.getEditorState(); + this.setText(StringUtils.getNotEmpty(editorState.getText(), ""), editorState.getCursorPosition()); + break; + } } } diff --git a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java new file mode 100644 index 00000000..59c7cca6 --- /dev/null +++ b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java @@ -0,0 +1,70 @@ +package org.solovyev.android.calculator; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * User: serso + * Date: 10/9/12 + * Time: 9:59 PM + */ +public class CalculatorEventHolder { + + @NotNull + private volatile CalculatorEventData lastEventData; + + public CalculatorEventHolder(@NotNull CalculatorEventData lastEventData) { + this.lastEventData = lastEventData; + } + + @NotNull + public synchronized CalculatorEventData getLastEventData() { + return lastEventData; + } + + @NotNull + public synchronized Result apply(@NotNull CalculatorEventData newEventData) { + final Result result = new Result(lastEventData, newEventData); + + if (result.isNewAfter()) { + this.lastEventData = newEventData; + } + + return result; + } + + public static class Result { + + @NotNull + private final CalculatorEventData lastEventData; + + @NotNull + private final CalculatorEventData newEventData; + + @Nullable + private Boolean after = null; + + @Nullable + private Boolean sameSequence = null; + + public Result(@NotNull CalculatorEventData lastEventData, + @NotNull CalculatorEventData newEventData) { + this.lastEventData = lastEventData; + this.newEventData = newEventData; + } + + public boolean isNewAfter() { + if (after == null) { + after = newEventData.isAfter(lastEventData); + } + return after; + } + + public boolean isSameSequence() { + if (sameSequence == null) { + sameSequence = newEventData.isSameSequence(lastEventData); + } + return sameSequence; + } + } +} diff --git a/calculatorpp-core/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java b/calculatorpp-core/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java index 9cf2c346..46230c8f 100644 --- a/calculatorpp-core/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java +++ b/calculatorpp-core/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java @@ -1,138 +1,144 @@ -package org.solovyev.android.calculator; - -import jscl.JsclMathEngine; -import junit.framework.Assert; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.mockito.Mockito; -import org.solovyev.android.calculator.history.CalculatorHistory; -import org.solovyev.android.calculator.jscl.JsclOperation; - -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -/** - * User: serso - * Date: 10/7/12 - * Time: 8:40 PM - */ -public class CalculatorTestUtils { - - // in seconds - public static final int TIMEOUT = 1000; - - public static void staticSetUp() throws Exception { - CalculatorLocatorImpl.getInstance().init(new CalculatorImpl(), newCalculatorEngine(), Mockito.mock(CalculatorClipboard.class), Mockito.mock(CalculatorNotifier.class), Mockito.mock(CalculatorHistory.class)); - CalculatorLocatorImpl.getInstance().getEngine().init(); - } - - @NotNull - static CalculatorEngineImpl newCalculatorEngine() { - final MathEntityDao mathEntityDao = Mockito.mock(MathEntityDao.class); - - final JsclMathEngine jsclEngine = JsclMathEngine.getInstance(); - - final CalculatorVarsRegistry varsRegistry = new CalculatorVarsRegistry(jsclEngine.getConstantsRegistry(), mathEntityDao); - final CalculatorFunctionsMathRegistry functionsRegistry = new CalculatorFunctionsMathRegistry(jsclEngine.getFunctionsRegistry(), mathEntityDao); - final CalculatorOperatorsMathRegistry operatorsRegistry = new CalculatorOperatorsMathRegistry(jsclEngine.getOperatorsRegistry(), mathEntityDao); - final CalculatorPostfixFunctionsRegistry postfixFunctionsRegistry = new CalculatorPostfixFunctionsRegistry(jsclEngine.getPostfixFunctionsRegistry(), mathEntityDao); - - return new CalculatorEngineImpl(jsclEngine, varsRegistry, functionsRegistry, operatorsRegistry, postfixFunctionsRegistry, null); - } - - public static void assertEval(@NotNull String expected, @NotNull String expression) { - assertEval(expected, expression, JsclOperation.numeric); - } - - public static void assertEval(@NotNull String expected, @NotNull String expression, @NotNull JsclOperation operation) { - final Calculator calculator = CalculatorLocatorImpl.getInstance().getCalculator(); - - CalculatorLocatorImpl.getInstance().getDisplay().setViewState(CalculatorDisplayViewStateImpl.newDefaultInstance()); - - final CountDownLatch latch = new CountDownLatch(1); - final TestCalculatorEventListener calculatorEventListener = new TestCalculatorEventListener(latch); - try { - calculator.addCalculatorEventListener(calculatorEventListener); - calculatorEventListener.setCalculatorEventData(calculator.evaluate(operation, expression)); - - if (latch.await(TIMEOUT, TimeUnit.SECONDS)) { - Assert.assertNotNull(calculatorEventListener.getResult()); - Assert.assertEquals(expected, calculatorEventListener.getResult().getText()); - } else { - Assert.fail("Too long wait for: " + expression); - } - - } catch (InterruptedException e) { - throw new RuntimeException(e); - } finally { - calculator.removeCalculatorEventListener(calculatorEventListener); - } - } - - public static void assertError(@NotNull String expression) { - assertError(expression, JsclOperation.numeric); - } - - private static final class TestCalculatorEventListener implements CalculatorEventListener { - - @Nullable - private CalculatorEventData calculatorEventData; - - @NotNull - private final CountDownLatch latch; - - @Nullable - private volatile CalculatorDisplayViewState result = null; - - public TestCalculatorEventListener(@NotNull CountDownLatch latch) { - this.latch = latch; - } - - public void setCalculatorEventData(@Nullable CalculatorEventData calculatorEventData) { - this.calculatorEventData = calculatorEventData; - } - - @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { - if ( this.calculatorEventData != null && calculatorEventData.isSameSequence(this.calculatorEventData) ) { - if ( calculatorEventType == CalculatorEventType.display_state_changed ) { - final CalculatorDisplayChangeEventData displayChange = (CalculatorDisplayChangeEventData)data; - - result = displayChange.getNewValue(); - - latch.countDown(); - } - } - } - - @Nullable - public CalculatorDisplayViewState getResult() { - return result; - } - } - - public static void assertError(@NotNull String expression, @NotNull JsclOperation operation) { - final Calculator calculator = CalculatorLocatorImpl.getInstance().getCalculator(); - - CalculatorLocatorImpl.getInstance().getDisplay().setViewState(CalculatorDisplayViewStateImpl.newDefaultInstance()); - - final CountDownLatch latch = new CountDownLatch(1); - final TestCalculatorEventListener calculatorEventListener = new TestCalculatorEventListener(latch); - try { - calculator.addCalculatorEventListener(calculatorEventListener); - calculatorEventListener.setCalculatorEventData(calculator.evaluate(operation, expression)); - - if (latch.await(TIMEOUT, TimeUnit.SECONDS)) { - Assert.assertNotNull(calculatorEventListener.getResult()); - Assert.assertFalse(calculatorEventListener.getResult().isValid()); - } else { - Assert.fail("Too long wait for: " + expression); - } - - } catch (InterruptedException e) { - throw new RuntimeException(e); - } finally { - calculator.removeCalculatorEventListener(calculatorEventListener); - } - } -} +package org.solovyev.android.calculator; + +import jscl.JsclMathEngine; +import junit.framework.Assert; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.mockito.Mockito; +import org.solovyev.android.calculator.history.CalculatorHistory; +import org.solovyev.android.calculator.jscl.JsclOperation; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +/** + * User: serso + * Date: 10/7/12 + * Time: 8:40 PM + */ +public class CalculatorTestUtils { + + // in seconds + public static final int TIMEOUT = 1; + + public static void staticSetUp() throws Exception { + CalculatorLocatorImpl.getInstance().init(new CalculatorImpl(), newCalculatorEngine(), Mockito.mock(CalculatorClipboard.class), Mockito.mock(CalculatorNotifier.class), Mockito.mock(CalculatorHistory.class)); + CalculatorLocatorImpl.getInstance().getEngine().init(); + } + + @NotNull + static CalculatorEngineImpl newCalculatorEngine() { + final MathEntityDao mathEntityDao = Mockito.mock(MathEntityDao.class); + + final JsclMathEngine jsclEngine = JsclMathEngine.getInstance(); + + final CalculatorVarsRegistry varsRegistry = new CalculatorVarsRegistry(jsclEngine.getConstantsRegistry(), mathEntityDao); + final CalculatorFunctionsMathRegistry functionsRegistry = new CalculatorFunctionsMathRegistry(jsclEngine.getFunctionsRegistry(), mathEntityDao); + final CalculatorOperatorsMathRegistry operatorsRegistry = new CalculatorOperatorsMathRegistry(jsclEngine.getOperatorsRegistry(), mathEntityDao); + final CalculatorPostfixFunctionsRegistry postfixFunctionsRegistry = new CalculatorPostfixFunctionsRegistry(jsclEngine.getPostfixFunctionsRegistry(), mathEntityDao); + + return new CalculatorEngineImpl(jsclEngine, varsRegistry, functionsRegistry, operatorsRegistry, postfixFunctionsRegistry, null); + } + + public static void assertEval(@NotNull String expected, @NotNull String expression) { + assertEval(expected, expression, JsclOperation.numeric); + } + + public static void assertEval(@NotNull String expected, @NotNull String expression, @NotNull JsclOperation operation) { + final Calculator calculator = CalculatorLocatorImpl.getInstance().getCalculator(); + + CalculatorLocatorImpl.getInstance().getDisplay().setViewState(CalculatorDisplayViewStateImpl.newDefaultInstance()); + + final CountDownLatch latch = new CountDownLatch(1); + final TestCalculatorEventListener calculatorEventListener = new TestCalculatorEventListener(latch); + try { + calculator.addCalculatorEventListener(calculatorEventListener); + + calculatorEventListener.setCalculatorEventData(calculator.evaluate(operation, expression)); + + if (latch.await(TIMEOUT, TimeUnit.SECONDS)) { + Assert.assertNotNull(calculatorEventListener.getResult()); + Assert.assertEquals(expected, calculatorEventListener.getResult().getText()); + } else { + Assert.fail("Too long wait for: " + expression); + } + + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + calculator.removeCalculatorEventListener(calculatorEventListener); + } + } + + public static void assertError(@NotNull String expression) { + assertError(expression, JsclOperation.numeric); + } + + private static final class TestCalculatorEventListener implements CalculatorEventListener { + + @Nullable + private CalculatorEventData calculatorEventData; + + @NotNull + private final CountDownLatch latch; + + @Nullable + private volatile CalculatorDisplayViewState result = null; + + public TestCalculatorEventListener(@NotNull CountDownLatch latch) { + this.latch = latch; + } + + public void setCalculatorEventData(@Nullable CalculatorEventData calculatorEventData) { + this.calculatorEventData = calculatorEventData; + } + + @Override + public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + if ( this.calculatorEventData != null && calculatorEventData.isSameSequence(this.calculatorEventData) ) { + if (calculatorEventType == CalculatorEventType.display_state_changed) { + final CalculatorDisplayChangeEventData displayChange = (CalculatorDisplayChangeEventData) data; + + result = displayChange.getNewValue(); + + try { + // need to sleep a little bit as await + new CountDownLatch(1).await(100, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + } + latch.countDown(); + } + } + } + + @Nullable + public CalculatorDisplayViewState getResult() { + return result; + } + } + + public static void assertError(@NotNull String expression, @NotNull JsclOperation operation) { + final Calculator calculator = CalculatorLocatorImpl.getInstance().getCalculator(); + + CalculatorLocatorImpl.getInstance().getDisplay().setViewState(CalculatorDisplayViewStateImpl.newDefaultInstance()); + + final CountDownLatch latch = new CountDownLatch(1); + final TestCalculatorEventListener calculatorEventListener = new TestCalculatorEventListener(latch); + try { + calculator.addCalculatorEventListener(calculatorEventListener); + calculatorEventListener.setCalculatorEventData(calculator.evaluate(operation, expression)); + + if (latch.await(TIMEOUT, TimeUnit.SECONDS)) { + Assert.assertNotNull(calculatorEventListener.getResult()); + Assert.assertFalse(calculatorEventListener.getResult().isValid()); + } else { + Assert.fail("Too long wait for: " + expression); + } + + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + calculator.removeCalculatorEventListener(calculatorEventListener); + } + } +} diff --git a/calculatorpp/AndroidManifest.xml b/calculatorpp/AndroidManifest.xml index c0a69309..cc958a9c 100644 --- a/calculatorpp/AndroidManifest.xml +++ b/calculatorpp/AndroidManifest.xml @@ -1,6 +1,5 @@ - + @@ -9,7 +8,7 @@ - + @@ -21,7 +20,7 @@ - + @@ -38,7 +37,7 @@ - + @@ -51,11 +50,7 @@ - + \ No newline at end of file diff --git a/calculatorpp/misc/res/kb_facebook.png b/calculatorpp/misc/res/kb_facebook.png new file mode 100644 index 00000000..d7def6ba Binary files /dev/null and b/calculatorpp/misc/res/kb_facebook.png differ diff --git a/calculatorpp/misc/res/kb_facebook_icon.png b/calculatorpp/misc/res/kb_facebook_icon.png new file mode 100644 index 00000000..3cd69338 Binary files /dev/null and b/calculatorpp/misc/res/kb_facebook_icon.png differ diff --git a/calculatorpp/pom.xml b/calculatorpp/pom.xml index 408c8e4a..532073a5 100644 --- a/calculatorpp/pom.xml +++ b/calculatorpp/pom.xml @@ -295,7 +295,7 @@ - true + false diff --git a/calculatorpp/res/drawable-hdpi/kb_facebook.png b/calculatorpp/res/drawable-hdpi/kb_facebook.png new file mode 100644 index 00000000..6af63acf Binary files /dev/null and b/calculatorpp/res/drawable-hdpi/kb_facebook.png differ diff --git a/calculatorpp/res/drawable-large-hdpi/kb_facebook.png b/calculatorpp/res/drawable-large-hdpi/kb_facebook.png new file mode 100644 index 00000000..194c8425 Binary files /dev/null and b/calculatorpp/res/drawable-large-hdpi/kb_facebook.png differ diff --git a/calculatorpp/res/drawable-ldpi/kb_facebook.png b/calculatorpp/res/drawable-ldpi/kb_facebook.png new file mode 100644 index 00000000..bb6591ff Binary files /dev/null and b/calculatorpp/res/drawable-ldpi/kb_facebook.png differ diff --git a/calculatorpp/res/drawable-mdpi/kb_facebook.png b/calculatorpp/res/drawable-mdpi/kb_facebook.png new file mode 100644 index 00000000..194c8425 Binary files /dev/null and b/calculatorpp/res/drawable-mdpi/kb_facebook.png differ diff --git a/calculatorpp/res/drawable-xhdpi/kb_facebook.png b/calculatorpp/res/drawable-xhdpi/kb_facebook.png new file mode 100644 index 00000000..8555071e Binary files /dev/null and b/calculatorpp/res/drawable-xhdpi/kb_facebook.png differ diff --git a/calculatorpp/res/drawable-xlarge-hdpi/kb_facebook.png b/calculatorpp/res/drawable-xlarge-hdpi/kb_facebook.png new file mode 100644 index 00000000..8555071e Binary files /dev/null and b/calculatorpp/res/drawable-xlarge-hdpi/kb_facebook.png differ diff --git a/calculatorpp/res/layout/calc_donate_button.xml b/calculatorpp/res/layout/calc_donate_button.xml index a6d6d3f3..9b15654a 100644 --- a/calculatorpp/res/layout/calc_donate_button.xml +++ b/calculatorpp/res/layout/calc_donate_button.xml @@ -1,13 +1,13 @@ - - - - - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/calculatorpp/res/layout/donate.xml b/calculatorpp/res/layout/donate.xml deleted file mode 100644 index b6cfeef7..00000000 --- a/calculatorpp/res/layout/donate.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/calculatorpp/res/values-es/text_about.xml b/calculatorpp/res/values-es/text_about.xml index 31caf4ee..980fe912 100644 --- a/calculatorpp/res/values-es/text_about.xml +++ b/calculatorpp/res/values-es/text_about.xml @@ -12,7 +12,7 @@ Este programa es Open Source:\nTodo el código fuente puede encontrarse en\nhttp://github.com\n\n Para más información, por favor,\ncontacte con el autor al mail\nse.solovyev@gmail.com\n o visite\nhttp://se.solovyev.org\n\n - Si desea apoyar el proyecto,\npuede hacer una donación vía\n\nhttp://paypal.com\n\n + Si desea apoyar el proyecto\n\n Si le gusta la aplicación\nvalórela con 5 estrellas en\nGoogle Play\n\n Gracias a las personas que han traducido Calculadora++ a los diferentes idiomas:\n Español - Jordi Luna\n diff --git a/calculatorpp/res/values-es/text_donate.xml b/calculatorpp/res/values-es/text_donate.xml deleted file mode 100644 index d34a4787..00000000 --- a/calculatorpp/res/values-es/text_donate.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Donar - - Puede dar las gracias por mail al autor de este programa\n\n - se.solovyev@gmail.com\n\n - donar dinero a través de\n\nhttp://paypal.com\n\n - o evaluar el programa con 5 estrellas en\n\nGoogle Play\n - - - \ No newline at end of file diff --git a/calculatorpp/res/values-it/text_about.xml b/calculatorpp/res/values-it/text_about.xml index d69247f8..80267985 100644 --- a/calculatorpp/res/values-it/text_about.xml +++ b/calculatorpp/res/values-it/text_about.xml @@ -12,7 +12,7 @@ Questo programma è open source:\ntutto il codice può essere trovato su\nhttp://github.com\n\n Per ulteriori informazioni contatta\nl\'autore via email\nse.solovyev@gmail.com \no visita\nhttp://se.solovyev.org\n\n - Se vuoi aiutare il progetto\npuoi effettuare una donazione via\nhttp://paypal.com\n\n + Se vuoi aiutare il progetto\n\n Se ti piace l\'applicazione\nvota 5 stelle nel\nGoogle Play\n\n Grazie a persone che traducono Calculator++ in diverse lingue:\n Italiano - Gabriele Ravanetti\n diff --git a/calculatorpp/res/values-it/text_donate.xml b/calculatorpp/res/values-it/text_donate.xml deleted file mode 100644 index 1ac37f79..00000000 --- a/calculatorpp/res/values-it/text_donate.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Dona - - Puoi ringraziare l\'autore di questo programma per email\n\n - se.solovyev@gmail.com\n\n - o donando su\n\nhttp://paypal.com\n\n - oppure votando l\'applicazione con 5 stelle nell\'\n\nGoogle Play - - - \ No newline at end of file diff --git a/calculatorpp/res/values-ru/text_about.xml b/calculatorpp/res/values-ru/text_about.xml index f5566381..ad8eef97 100644 --- a/calculatorpp/res/values-ru/text_about.xml +++ b/calculatorpp/res/values-ru/text_about.xml @@ -9,12 +9,11 @@ О программе Copyright (c) 2009-2011\n\nПрограмма создана\nserso aka se.solovyev\n\n - Сайт приложения: http://calculatorpp.com/forum/\n\n + Сайт приложения: http://facebook.com/calculatorpp\n\n Эта программа с открытыми исходным кодом:\nон может быть найден на \nhttp://github.com\n\n За подробной информацией, пожалуйста,\nобращайтесь на почту\nse.solovyev@gmail.com\n или посетите сайт \nhttp://se.solovyev.org\n\n - Если вы хотите поддержать проект материально\nвы можете купить специальную опцию из настроек приложения\n - перевести средства через \nhttp://paypal.com\n\n + Если вы хотите поддержать проект материально\nвы можете купить специальную опцию из настроек приложения\n\n Если вам понравилось приложение -\nпоставьте 5 звёздочек в\nGoogle Play\n\n Спасибо тем, кто переводил Калькулятор++:\n на итальянский - Gabriele Ravanetti\n @@ -169,7 +168,7 @@ От разработчика:\n\n - Я рад сообщить, что у Калькулятора++ появился собственный форум: http://calculatorpp.com/forum/.\n + Я рад сообщить, что у Калькулятора++ появился собственный форум: http://facebook.com/calculatorpp.\n Здесь вы можете найти всю последнюю информацию о приложении, узнать об известных проблемах и внести свои предложения.\n Для входа вы можете использовать аккаунт социальной сети (Facebook, Twitter или Google).\n\n 1. Добавлены кнопки управления масштаб на графике\n diff --git a/calculatorpp/res/values-ru/text_donate.xml b/calculatorpp/res/values-ru/text_donate.xml deleted file mode 100644 index 0e501e29..00000000 --- a/calculatorpp/res/values-ru/text_donate.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Пожертвовать - - Вы можете отблагодарить автора по почте\n\n - se.solovyev@gmail.com\n\n - купить специальную опцию из настроек приложения\n\n - пожертвовать денег через\n\nhttp://paypal.com\n\n - или поставить 5 звёздочек в\n\nGoogle Play - - - \ No newline at end of file diff --git a/calculatorpp/res/values-ru/text_strings.xml b/calculatorpp/res/values-ru/text_strings.xml index 49abe69d..22bc4c9a 100644 --- a/calculatorpp/res/values-ru/text_strings.xml +++ b/calculatorpp/res/values-ru/text_strings.xml @@ -1,229 +1,229 @@ - - - - - - Калькулятор++ - Калькулятор++ Free - Кальк++ - Настройки - Ошибка - Результат скопирован в буфер! - Настройки - Помощь - Переменные и константы - - Основные настройки - Настройки вычислений - Настройки внешнего вида - Другие настройки - Настройки кнопок - - - Вниз - Вверх - Перезапуск - - назад - вперёд - - - вставить - переменные - - Копировать - Построить график - График - - Подсветка выражений - Округление результата - Включает/выключает округление результата - Результат в научной форме - Если включено - результат будет всегда записан в научной форме (12.34E-12) - Точность результата - Максимальное время вычисления - Если вычисления превысят установленный предел - калькулятор остановится с ошибкой - Выход - Добавить - Отмена - Сохранить - Удалить - Да - Нет - Подтверждение удаления - Вы действительно хотите удалить переменную \'%s\'? - Имя - Значение - Описание - Создать переменную - Редактировать переменную - - Значение должно либо оставаться пустым либо быть числом! - Имя переменной не может быть зарезервированным системным именем! - Переменная с таким именем уже существует! - Имя переменной не валидно: им ядолжно начинаться с буквы, может содержать буквы, цифры и знак подчёркивания. - Системная переменная не может быть изменена! - - Введите новое выражение - Нажмите для копирования - Продолжить - История - M - История пуста! - История - Символ \'%s\' не допустим в названии переменной! - - Единицы измерения углов - Градусы - Радианы - Грады - Обороты - Устанавливает единицы измерения углов. - - Системы счисления - Устанавливает систему счисления для всех вводимых чисел. - Десятичная - Шестнадцатеричная - Восьмиричная - Бинарная - - Тема оформления - Серая - Фиолетовая - Голубая - Метро Синяя (По умолчанию) - Метро Зелёная - Метро Фиолетовая - Точность результата(все вычисления производятся максимально точно) - Включает/выключает подсветку синтаксиса в поле редактирования калькулятора - Устанавливает тему оформления приложения - Очистить историю - Следующие константы не определены: {0}! - - Не использовать разделитель разрядов - Апостроф (\') - Пробел ( ) - Разделитель разрядов - Устанавливает разделитель разрядов числа - Знак произведения - Устанавливает знак произведения - - Раскладка - Научная (телефон) - Научная - Простая - Устанавливает раскладку кнопок - - Отклик на нажатие - Включает/выключает вибрацию по нажатию клавиши - - Маленькая - Средняя - Большая - - Длительность отклика - Длительность вибрации по нажатию клавиши - - Невозможно создать пустую константу! - Результат не допустим! - - График - От - До - - Длина свайпа для клавиш - Устанавливает длину свайпа для клавиш которые поддерживают дополнительные действия по свайпу - - Комментарий - Сохранено - Не сохранено - Выражение скопировано в буфер! - Статус: - Комментарий: - Использовать - Исп. - Копировать выражение - Копировать результат - Значение - Сохранено (см. вкладку \'Сохранённая история\') - Комментарий - Сохранить - Изменить - Изменить - Сохранённая история - - История уже была сохранена! - История должна быть сохранена перед редактированием! - История успешно удалена! - История успешно сохранена! - - Копировать описание - Копировать значение - - Приветствие - Спасибо за выбор Калькулятора++!\n\nКалькулятор++ - это мощный инструмент для проведения ежедневных расчётов.\n\nДля избавление от рекламы и поддержки проекта вы можете воспользоваться специальной опцией доступной из настроек приложения.\n\nПеред началом работы рекомендуется прочитать FAQ и подсказки для использования всех возможностей программы (нажмите Меню, затем Помощь) - - Показывать примечания к выпуску - Определяет показывать или нет всплывающее окно с примечаниями к выпуску после обновления новой версии - - Устанавливает поведение по нажатию на кнопку Назад - Использовать кнопку назад как назад по истории - - Информация о покупках будет обновлена с сервера - Очистить информация о покупках - - Внимание - Ошибка - Биллинг не поддерживается: вы должны иметь Google Checkout аккаунт привязанный в вашему Google аккаунту и должны быть подключены к интернету. - - Поддержать проект - И убрать рекламу - - Опция уже была куплена! - Покупаем… - Очищаем… - - Отзыв - Вы используете Калькулятор++ некоторое время\n - и для нас важно узнать ваше мнение о приложении.\n\n - Пожалуйста, оцените Калькулятор++ \nна Google Play,\n оставьте комментарий или \nобсудите приложение \nна нашем форуме - - - Хорошие новости - я только что выпустил новое приложение под Андроид под названием Заметки++.\n - Если вы заинтересованы в быстром и удобном способе оставлять заметки пройдите по ссылке и попробуйте Заметки++! - - - Единицы измерения углов изменены на \'%s\'! - Система счисления изменена на \'%s\'! - Перевод величин - - Перевести в… - - Перевести в hex - Перевести в bin - Перевести в dec - - Редактор - Результат - Другие - Производные/Интегралы - Калькулятор++ обнаружил ошибку… - Отчёт об ошибке в Калькуляторе++ - - К сожалению, Калькулятор++ был остановлен ошибкой.\n\n - Для того чтобы исправить, её нам необходима некоторая информация. Мы рекомендуем вам послать этот отчёт об ошибке (после нажатия кнопки \'Да\' вы увидите всю передаваемую информацию в новом окне).\n\n - Хотите лы вы послать отчёт об ошибке? - - Настройки графика - - Интерполировать график - Если включено - при построении графика будет использована интерполяция - Цвет вещественной части графика - Устанавливает цвет вещественной части графика - Цвет мнимой части графика - Устанавливает цвет мнимой части графика + + + + + + Калькулятор++ + Калькулятор++ Free + Кальк++ + Настройки + Ошибка + Результат скопирован в буфер! + Настройки + Помощь + Переменные и константы + + Основные настройки + Настройки вычислений + Настройки внешнего вида + Другие настройки + Настройки кнопок + + + Вниз + Вверх + Перезапуск + + назад + вперёд + + + вставить + переменные + + Копировать + Построить график + График + + Подсветка выражений + Округление результата + Включает/выключает округление результата + Результат в научной форме + Если включено - результат будет всегда записан в научной форме (12.34E-12) + Точность результата + Максимальное время вычисления + Если вычисления превысят установленный предел - калькулятор остановится с ошибкой + Выход + Добавить + Отмена + Сохранить + Удалить + Да + Нет + Подтверждение удаления + Вы действительно хотите удалить переменную \'%s\'? + Имя + Значение + Описание + Создать переменную + Редактировать переменную + + Значение должно либо оставаться пустым либо быть числом! + Имя переменной не может быть зарезервированным системным именем! + Переменная с таким именем уже существует! + Имя переменной не валидно: им ядолжно начинаться с буквы, может содержать буквы, цифры и знак подчёркивания. + Системная переменная не может быть изменена! + + Введите новое выражение + Нажмите для копирования + Продолжить + История + M + История пуста! + История + Символ \'%s\' не допустим в названии переменной! + + Единицы измерения углов + Градусы + Радианы + Грады + Обороты + Устанавливает единицы измерения углов. + + Системы счисления + Устанавливает систему счисления для всех вводимых чисел. + Десятичная + Шестнадцатеричная + Восьмиричная + Бинарная + + Тема оформления + Серая + Фиолетовая + Голубая + Метро Синяя (По умолчанию) + Метро Зелёная + Метро Фиолетовая + Точность результата(все вычисления производятся максимально точно) + Включает/выключает подсветку синтаксиса в поле редактирования калькулятора + Устанавливает тему оформления приложения + Очистить историю + Следующие константы не определены: {0}! + + Не использовать разделитель разрядов + Апостроф (\') + Пробел ( ) + Разделитель разрядов + Устанавливает разделитель разрядов числа + Знак произведения + Устанавливает знак произведения + + Раскладка + Научная (телефон) + Научная + Простая + Устанавливает раскладку кнопок + + Отклик на нажатие + Включает/выключает вибрацию по нажатию клавиши + + Маленькая + Средняя + Большая + + Длительность отклика + Длительность вибрации по нажатию клавиши + + Невозможно создать пустую константу! + Результат не допустим! + + График + От + До + + Длина свайпа для клавиш + Устанавливает длину свайпа для клавиш которые поддерживают дополнительные действия по свайпу + + Комментарий + Сохранено + Не сохранено + Выражение скопировано в буфер! + Статус: + Комментарий: + Использовать + Исп. + Копировать выражение + Копировать результат + Значение + Сохранено (см. вкладку \'Сохранённая история\') + Комментарий + Сохранить + Изменить + Изменить + Сохранённая история + + История уже была сохранена! + История должна быть сохранена перед редактированием! + История успешно удалена! + История успешно сохранена! + + Копировать описание + Копировать значение + + Приветствие + Спасибо за выбор Калькулятора++!\n\nКалькулятор++ - это мощный инструмент для проведения ежедневных расчётов.\n\nДля избавление от рекламы и поддержки проекта вы можете воспользоваться специальной опцией доступной из настроек приложения.\n\nПеред началом работы рекомендуется прочитать FAQ и подсказки для использования всех возможностей программы (нажмите Меню, затем Помощь) + + Показывать примечания к выпуску + Определяет показывать или нет всплывающее окно с примечаниями к выпуску после обновления новой версии + + Устанавливает поведение по нажатию на кнопку Назад + Использовать кнопку назад как назад по истории + + Информация о покупках будет обновлена с сервера + Очистить информация о покупках + + Внимание + Ошибка + Биллинг не поддерживается: вы должны иметь Google Checkout аккаунт привязанный в вашему Google аккаунту и должны быть подключены к интернету. + + Поддержать проект + И убрать рекламу + + Опция уже была куплена! + Покупаем… + Очищаем… + + Отзыв + Вы используете Калькулятор++ некоторое время\n + и для нас важно узнать ваше мнение о приложении.\n\n + Пожалуйста, оцените Калькулятор++ \nна Google Play,\n оставьте комментарий или \nобсудите приложение \nв Facebook + + + Хорошие новости - я только что выпустил новое приложение под Андроид под названием Заметки++.\n + Если вы заинтересованы в быстром и удобном способе оставлять заметки пройдите по ссылке и попробуйте Заметки++! + + + Единицы измерения углов изменены на \'%s\'! + Система счисления изменена на \'%s\'! + Перевод величин + + Перевести в… + + Перевести в hex + Перевести в bin + Перевести в dec + + Редактор + Результат + Другие + Производные/Интегралы + Калькулятор++ обнаружил ошибку… + Отчёт об ошибке в Калькуляторе++ + + К сожалению, Калькулятор++ был остановлен ошибкой.\n\n + Для того чтобы исправить, её нам необходима некоторая информация. Мы рекомендуем вам послать этот отчёт об ошибке (после нажатия кнопки \'Да\' вы увидите всю передаваемую информацию в новом окне).\n\n + Хотите лы вы послать отчёт об ошибке? + + Настройки графика + + Интерполировать график + Если включено - при построении графика будет использована интерполяция + Цвет вещественной части графика + Устанавливает цвет вещественной части графика + Цвет мнимой части графика + Устанавливает цвет мнимой части графика \ No newline at end of file diff --git a/calculatorpp/res/values-uk/text_about.xml b/calculatorpp/res/values-uk/text_about.xml index a2702811..e4a9d126 100644 --- a/calculatorpp/res/values-uk/text_about.xml +++ b/calculatorpp/res/values-uk/text_about.xml @@ -9,12 +9,11 @@ Про програму Copyright (c) 2009-2011\n\nСтворено serso aka se.solovyev\n\n - Сайт програми: http://calculatorpp.com/forum/\n\n + Сайт програми: http://facebook.com/calculatorpp\n\n Ця програма з відкритим вихідним кодом:\nйого можна знайти на \nhttp://github.com\n\n За детальною інформацією, будь ласка, звертайтеся до автора на пошту\nse.solovyev@gmail.com \nабо відвідайте сайт\nhttp://se.solovyev.org\n\n - Якщо хочете підтримати проект фінансово,\nто ви можете купити спеціальну опцію у налаштуваннях програми\n - переказати гроші через \nhttp://paypal.com\n\n + Якщо хочете підтримати проект фінансово,\nто ви можете купити спеціальну опцію у налаштуваннях програми\n\n Якщо вам сподобалася програма,\n то оцініть її у 5 зірочок на\nGoogle Play\n\n Дякую усім, хто переклав Калькулятор++ на інші мови:\n італійську - Gabriele Ravanetti\n @@ -168,7 +167,7 @@ Від розробника:\n\n - Я радий повідомити Вас, що запустив форум для Калькулятор++: http://calculatorpp.com/forum/.\n + Я радий повідомити Вас, що запустив форум для Калькулятор++: http://facebook.com/calculatorpp.\n Тут ви можете знайти усю останню інформацію про програму, дізнатися про відомі проблеми та внести свої пропозиції.\n Для входу ви можете скористатися обліковим записом соціальної мережі (Facebook, Twitter or Google are supported).\n\n 1. Додано кнопки управління масштабом на графіку\n diff --git a/calculatorpp/res/values-uk/text_donate.xml b/calculatorpp/res/values-uk/text_donate.xml deleted file mode 100644 index 7f7b9ad4..00000000 --- a/calculatorpp/res/values-uk/text_donate.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Пожертви - - Ви можете подякувати автору цієї програми по пошті\n\n - se.solovyev@gmail.com\n\n - купити спеціальну опцію у налаштуваннях програми\n\n - пожертвувати гроші через \n\nhttp://paypal.com\n\n - або оцінити її у 5 зірочок на \n\nGoogle Play - - - diff --git a/calculatorpp/res/values-uk/text_strings.xml b/calculatorpp/res/values-uk/text_strings.xml index 189029b9..01a08ed2 100644 --- a/calculatorpp/res/values-uk/text_strings.xml +++ b/calculatorpp/res/values-uk/text_strings.xml @@ -190,7 +190,7 @@ Зворотній зв’язок Ви вже використовуєте Калькулятор++ деякий час \n і для нас важливо знати вашу думку про програму.\n\n - Будь ласка, оцініть Калькулятор++ \nна Google Play,\n залиште коментар або \nобговоріть програму \nна нашому форумі + Будь ласка, оцініть Калькулятор++ \nна Google Play,\n залиште коментар або \nобговоріть програму \nна Facebook Одиниці виміру кутів змінено на \'%s\'! diff --git a/calculatorpp/res/values-zh-rtw/text_about.xml b/calculatorpp/res/values-zh-rtw/text_about.xml index 6d70459b..4f3f6777 100644 --- a/calculatorpp/res/values-zh-rtw/text_about.xml +++ b/calculatorpp/res/values-zh-rtw/text_about.xml @@ -9,12 +9,11 @@ 關於 Copyright (c) 2009-2011\n\nCreated by serso aka se.solovyev\n\n - 程式網站: http://calculatorpp.com/forum/\n\n + 程式網站: http://facebook.com/calculatorpp\n\n 此程式為開放源碼軟體:\n原始碼位於\nhttp://github.com\n\n 如果您需要更多資訊\n請寄信至作者信箱\nse.solovyev@gmail.com \n或是造訪\nhttp://se.solovyev.org\n\n 如果您想要支持此專案\n\n您可以從程式設定頁面中購買一個特別的選項\n\n - 捐款到\nhttp://paypal.com\n\n 如果您喜歡這個程式\n請在 Google Play 中將它評等為五顆星\n\n 感謝以下 Calculator++ 的翻譯者:\n 義大利文 - Gabriele Ravanetti\n @@ -166,7 +165,7 @@ 來自開發者的訊息:\n\n - 我很高興可以通知您, 我創立了一個 Calculator++ 的論壇: http://calculatorpp.com/forum/.\n + 我很高興可以通知您, 我創立了一個 Calculator++ 的論壇: http://facebook.com/calculatorpp.\n 您可以在這裡找到程式最新的資訊、檢查已知問題、提報錯誤和建議新功能.\n 您可以使用常用社群網站的帳號登入 (可用 Facebook, Twitter 和 Google).\n\n 1. 在繪圖介面上顯示縮放按鈕\n diff --git a/calculatorpp/res/values-zh-rtw/text_donate.xml b/calculatorpp/res/values-zh-rtw/text_donate.xml deleted file mode 100644 index 861e9622..00000000 --- a/calculatorpp/res/values-zh-rtw/text_donate.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - 捐款 - - 您可以向此程式的作者表達謝意, 透過 e-mail:\n\n - se.solovyev@gmail.com\n\n - 購買設定選單中的選項\n\n - 透過以下連結捐款\n\nhttp://paypal.com\n\n - 或是將此程式評等為五顆星:\n\nGoogle Play - - - diff --git a/calculatorpp/res/values-zh-rtw/text_strings.xml b/calculatorpp/res/values-zh-rtw/text_strings.xml index 38a232a9..982a4802 100644 --- a/calculatorpp/res/values-zh-rtw/text_strings.xml +++ b/calculatorpp/res/values-zh-rtw/text_strings.xml @@ -190,7 +190,7 @@ 回饋 您已使用 Calculator++ 一段時間了 \n 我們很希望可以瞭解您對這個軟體的意見.\n\n - 請在 Google Play 上評等 Calculator++,\n 留下評論訊息 \n或是在 我們的論壇 上討論. + 請在 Google Play 上評等 Calculator++,\n 留下評論訊息 \n或是在 Facebook 上討論. 好消息 - 我剛發行了一個新的 Android 應用程式, 叫做 Notes++.\n diff --git a/calculatorpp/res/values/text_about.xml b/calculatorpp/res/values/text_about.xml index f223f2be..19bf7fbe 100644 --- a/calculatorpp/res/values/text_about.xml +++ b/calculatorpp/res/values/text_about.xml @@ -9,12 +9,11 @@ About Copyright (c) 2009-2011\n\nCreated by serso aka se.solovyev\n\n - Application web site: http://calculatorpp.com/forum/\n\n + Application web site: http://facebook.com/calculatorpp\n\n This program is open source:\nall source code can be found on\nhttp://github.com\n\n 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\n\nyou can buy a special option from application preferences\n\n - donate money via\nhttp://paypal.com\n\n If you like the application\nrank it with 5 stars in\nGoogle Play\n\n Thanks to people who translate Calculator++ in different languages:\n Italian - Gabriele Ravanetti\n @@ -168,7 +167,7 @@ Note from developer:\n\n - I\'m glad to inform you that I\'ve started a forum for Calculator++: http://calculatorpp.com/forum/.\n + I\'m glad to inform you that I\'ve started a forum for Calculator++: http://facebook.com/calculatorpp.\n Here you can find latest information about application, check for known issues, submit bugs or suggest new features.\n You can use your social account to login (Facebook, Twitter or Google are supported).\n\n 1. Zoom buttons on graph plotter\n diff --git a/calculatorpp/res/values/text_donate.xml b/calculatorpp/res/values/text_donate.xml deleted file mode 100644 index 1fb8d7b7..00000000 --- a/calculatorpp/res/values/text_donate.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Donate - - You can thank the author of this program by email\n\n - se.solovyev@gmail.com\n\n - buying a special option from application preferences\n\n - donating money via\n\nhttp://paypal.com\n\n - or setting 5 stars in\n\nGoogle Play - - - \ No newline at end of file diff --git a/calculatorpp/res/values/text_strings.xml b/calculatorpp/res/values/text_strings.xml index c165fe46..d2e91965 100644 --- a/calculatorpp/res/values/text_strings.xml +++ b/calculatorpp/res/values/text_strings.xml @@ -1,229 +1,229 @@ - - - - - - Calculator++ - Calculator++ Free - Calc++ - Settings - Error - Result copied to clipboard! - Settings - Help - Variables And Constants - - Main settings - Calculation settings - Appearance settings - Other settings - Drag buttons settings - - - Down - Up - Restart - - undo - redo - C - clear - paste - vars - - Copy - Plot graph - Graph - - Highlight expressions - Round result - Toggles rounding of the result - Always scientific notation - If turned on forces to use only scientific notation of output (12.34E-12) - Precision of result - Maximum calculation time - If calculations exceed specified limit - calculator halts with error - Exit - Add - Cancel - Save - Remove - Yes - No - Removal confirmation - Do you really want to delete \'%s\' variable? - Name - Value - Description - Create variable - Edit variable - - Value must be either number or empty! - Variable name clashes with function name! - Variable with same name already exists! - Name of constant is not valid: name must start with letter, can contain letters, digits and underscore. - System variable cannot be changed! - - Enter new expression - Press to copy - Continue - History - M - History is empty! - History - Character \'%s\' is not accepted in variable name! - - Angle Units - Degrees - Radians - Gradians - Turns - Defines the default units for angles. - - Numeral systems - Defines the default numeral system for all input numbers. - Decimal - Hexadecimal - Octal - Binary - - Theme - Grey - Violet - Light Blue - Metro Blue (Default) - Metro Green - Metro Purple - Precision of result value (all calculations are done with maximum precision regardless of the value of this option) - Toggles colouring and styling in calculator editor - Sets the theme for calculator - Clear history - Next constants are undefined: {0}! - - No grouping separator - Apostrophe (\') - Space ( ) - Grouping separator - Sets grouping separator - Multiplication sign - Sets multiplication sign - - Layout - Scientific (cellphone) - Scientific - Simple - Sets layout of buttons - - Haptic feedback - Toggles vibration on button click - - Short - Middle - Long - - Haptic feedback duration - Duration vibration on button click - - Unable to create empty constant! - Current result is not valid! - - Graph - From - To - - Swipe distance for buttons - Sets swipe distance for buttons that support additional swipe actions - - Comment - Saved - Not saved - Expression copied to the clipboard! - Status: - Comment: - Use - Use - Copy expression - Copy result - Value - Saved (see \'Saved history\' tab) - Comment - Save history - Modify history - Modify - Saved history - - History was already saved! - History must be saved before editing! - History was successfully removed! - History was successfully saved! - - Copy description - Copy value - - Thank you for choosing Calculator++!\n\nCalculator++ is a powerful tool for making everyday calculations.\n\nTo remove the ads and support the project you can use special option from application settings.\n\nIt\'s highly recommended to read the FAQ and hints before the work to use all the features of application (press Menu button and then Help) - Welcome - - Show release notes - Defines if release notes popup window should appear after update to the new version - - Defines the behaviour of the Back button - Use Back button as history prev - - Billing information will be reloaded from the server - Clear billing information - - Warning - Error - Billing is not supported: you must have Google Checkout account linked to your Google account and must be connected to the internet. - - Support the project - And remove the advertisement - - Ad free option has been already purchased! - Purchasing… - Clearing… - - Feedback - You have been using Calculator++ for some time \n - and it\'s important for us to know your opinion about application.\n\n - Please rate Calculator++ \non Google Play,\n leave a comment or \ndiscuss application \non our forum - - - Good news - I just released new application for Android called Notes++.\n - If you\'re interesting in fast and easy way of making notes please follow the link and try Notes++! - - - Angle units changed to \'%s\'! - Numeral base changed to \'%s\'! - Conversion tool - - Convert to… - - Convert to hex - Convert to bin - Convert to dec - - Editor - Result - Other - Derivatives/Integrals - Calculator++ has crashed… - Calculator++ crash report - - Unfortunately, Calculator++ has crashed.\n\n - In order to fix the problem we need some information about it. It\'s highly recommended to send crash report via email (after pressing \'Ok\' button you will see all sent data in the new window).\n\n - Do you want to send crash report? - - Graph preferences - - Interpolate function\'s graph - If checked cubic interpolation will be used in function graph drawing - Color of real part of functions graph - Sets color of real part functions graph - Color of imaginary part of functions graph - Sets color of imaginary part functions graph + + + + + + Calculator++ + Calculator++ Free + Calc++ + Settings + Error + Result copied to clipboard! + Settings + Help + Variables And Constants + + Main settings + Calculation settings + Appearance settings + Other settings + Drag buttons settings + + + Down + Up + Restart + + undo + redo + C + clear + paste + vars + + Copy + Plot graph + Graph + + Highlight expressions + Round result + Toggles rounding of the result + Always scientific notation + If turned on forces to use only scientific notation of output (12.34E-12) + Precision of result + Maximum calculation time + If calculations exceed specified limit - calculator halts with error + Exit + Add + Cancel + Save + Remove + Yes + No + Removal confirmation + Do you really want to delete \'%s\' variable? + Name + Value + Description + Create variable + Edit variable + + Value must be either number or empty! + Variable name clashes with function name! + Variable with same name already exists! + Name of constant is not valid: name must start with letter, can contain letters, digits and underscore. + System variable cannot be changed! + + Enter new expression + Press to copy + Continue + History + M + History is empty! + History + Character \'%s\' is not accepted in variable name! + + Angle Units + Degrees + Radians + Gradians + Turns + Defines the default units for angles. + + Numeral systems + Defines the default numeral system for all input numbers. + Decimal + Hexadecimal + Octal + Binary + + Theme + Grey + Violet + Light Blue + Metro Blue (Default) + Metro Green + Metro Purple + Precision of result value (all calculations are done with maximum precision regardless of the value of this option) + Toggles colouring and styling in calculator editor + Sets the theme for calculator + Clear history + Next constants are undefined: {0}! + + No grouping separator + Apostrophe (\') + Space ( ) + Grouping separator + Sets grouping separator + Multiplication sign + Sets multiplication sign + + Layout + Scientific (cellphone) + Scientific + Simple + Sets layout of buttons + + Haptic feedback + Toggles vibration on button click + + Short + Middle + Long + + Haptic feedback duration + Duration vibration on button click + + Unable to create empty constant! + Current result is not valid! + + Graph + From + To + + Swipe distance for buttons + Sets swipe distance for buttons that support additional swipe actions + + Comment + Saved + Not saved + Expression copied to the clipboard! + Status: + Comment: + Use + Use + Copy expression + Copy result + Value + Saved (see \'Saved history\' tab) + Comment + Save history + Modify history + Modify + Saved history + + History was already saved! + History must be saved before editing! + History was successfully removed! + History was successfully saved! + + Copy description + Copy value + + Thank you for choosing Calculator++!\n\nCalculator++ is a powerful tool for making everyday calculations.\n\nTo remove the ads and support the project you can use special option from application settings.\n\nIt\'s highly recommended to read the FAQ and hints before the work to use all the features of application (press Menu button and then Help) + Welcome + + Show release notes + Defines if release notes popup window should appear after update to the new version + + Defines the behaviour of the Back button + Use Back button as history prev + + Billing information will be reloaded from the server + Clear billing information + + Warning + Error + Billing is not supported: you must have Google Checkout account linked to your Google account and must be connected to the internet. + + Support the project + And remove the advertisement + + Ad free option has been already purchased! + Purchasing… + Clearing… + + Feedback + You have been using Calculator++ for some time \n + and it\'s important for us to know your opinion about application.\n\n + Please rate Calculator++ \non Google Play,\n leave a comment or \ndiscuss application \non Facebook + + + Good news - I just released new application for Android called Notes++.\n + If you\'re interesting in fast and easy way of making notes please follow the link and try Notes++! + + + Angle units changed to \'%s\'! + Numeral base changed to \'%s\'! + Conversion tool + + Convert to… + + Convert to hex + Convert to bin + Convert to dec + + Editor + Result + Other + Derivatives/Integrals + Calculator++ has crashed… + Calculator++ crash report + + Unfortunately, Calculator++ has crashed.\n\n + In order to fix the problem we need some information about it. It\'s highly recommended to send crash report via email (after pressing \'Ok\' button you will see all sent data in the new window).\n\n + Do you want to send crash report? + + Graph preferences + + Interpolate function\'s graph + If checked cubic interpolation will be used in function graph drawing + Color of real part of functions graph + Sets color of real part functions graph + Color of imaginary part of functions graph + Sets color of imaginary part functions graph \ No newline at end of file diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java index 9317c901..3520cc9a 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java @@ -1,200 +1,167 @@ -/* - * Copyright (c) 2009-2011. Created by serso aka se.solovyev. - * For more information, please, contact se.solovyev@gmail.com - */ - -package org.solovyev.android.calculator; - -import android.content.Context; -import android.graphics.Color; -import android.os.Handler; -import android.text.Editable; -import android.text.Html; -import android.text.TextWatcher; -import android.util.AttributeSet; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.solovyev.android.calculator.text.TextProcessor; -import org.solovyev.android.calculator.view.TextHighlighter; -import org.solovyev.android.view.AutoResizeTextView; -import org.solovyev.common.text.StringUtils; - -/** - * User: serso - * Date: 9/17/11 - * Time: 10:58 PM - */ -public class AndroidCalculatorDisplayView extends AutoResizeTextView implements CalculatorDisplayView { - - /* - ********************************************************************** - * - * STATIC FIELDS - * - ********************************************************************** - */ - - @NotNull - private final static TextProcessor textHighlighter = new TextHighlighter(Color.WHITE, false); - - /* - ********************************************************************** - * - * FIELDS - * - ********************************************************************** - */ - - @NotNull - private volatile CalculatorDisplayViewState state = CalculatorDisplayViewStateImpl.newDefaultInstance(); - - private volatile boolean viewStateChange = false; - - @NotNull - private final Object lock = new Object(); - - @NotNull - private final Handler handler = new Handler(); - - private volatile boolean initialized = false; - - /* - ********************************************************************** - * - * CONSTRUCTORS - * - ********************************************************************** - */ - - public AndroidCalculatorDisplayView(Context context) { - super(context); - this.addTextChangedListener(new TextWatcherImpl()); - } - - public AndroidCalculatorDisplayView(Context context, AttributeSet attrs) { - super(context, attrs); - this.addTextChangedListener(new TextWatcherImpl()); - - } - - public AndroidCalculatorDisplayView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - this.addTextChangedListener(new TextWatcherImpl()); - } - - /* - ********************************************************************** - * - * METHODS - * - ********************************************************************** - */ - - - @Override - public void setState(@NotNull final CalculatorDisplayViewState state) { - final CharSequence text = prepareText(state.getStringResult(), state.isValid()); - - handler.post(new Runnable() { - @Override - public void run() { - synchronized (lock) { - try { - viewStateChange = true; - - AndroidCalculatorDisplayView.this.state = state; - if (state.isValid()) { - setTextColor(getResources().getColor(R.color.default_text_color)); - setText(text); - - adjustTextSize(); - - } else { - // update text in order to get rid of HTML tags - setText(getText().toString()); - setTextColor(getResources().getColor(R.color.display_error_text_color)); - - // error messages are never shown -> just greyed out text (error message will be shown on click) - //setText(state.getErrorMessage()); - //redraw(); - } - } finally { - viewStateChange = false; - } - } - } - }); - } - - @NotNull - @Override - public CalculatorDisplayViewState getState() { - synchronized (lock) { - return this.state; - } - } - - @Nullable - private static CharSequence prepareText(@Nullable String text, boolean valid) { - CharSequence result; - - if (valid && text != null) { - - //Log.d(this.getClass().getName(), text); - - try { - final TextHighlighter.Result processedText = textHighlighter.process(text); - text = processedText.toString(); - result = Html.fromHtml(text); - } catch (CalculatorParseException e) { - result = text; - } - } else { - result = text; - } - - return result; - } - - private void adjustTextSize() { - // todo serso: think where to move it (keep in mind org.solovyev.android.view.AutoResizeTextView.resetTextSize()) - setAddEllipsis(false); - setMinTextSize(10); - resizeText(); - } - - - public void handleTextChange(Editable s) { - synchronized (lock) { - if (!viewStateChange) { - // external text change => need to notify display - // todo serso: implement - } - } - } - - public synchronized void init(@NotNull Context context) { - if (!initialized) { - this.setOnClickListener(new CalculatorDisplayOnClickListener(context)); - - this.initialized = true; - } - } - - private final class TextWatcherImpl implements TextWatcher { - - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - } - - @Override - public void afterTextChanged(Editable s) { - handleTextChange(s); - } - } -} +/* + * Copyright (c) 2009-2011. Created by serso aka se.solovyev. + * For more information, please, contact se.solovyev@gmail.com + */ + +package org.solovyev.android.calculator; + +import android.content.Context; +import android.graphics.Color; +import android.os.Handler; +import android.text.Html; +import android.util.AttributeSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.solovyev.android.calculator.text.TextProcessor; +import org.solovyev.android.calculator.view.TextHighlighter; +import org.solovyev.android.view.AutoResizeTextView; + +/** + * User: serso + * Date: 9/17/11 + * Time: 10:58 PM + */ +public class AndroidCalculatorDisplayView extends AutoResizeTextView implements CalculatorDisplayView { + + /* + ********************************************************************** + * + * STATIC FIELDS + * + ********************************************************************** + */ + + @NotNull + private final static TextProcessor textHighlighter = new TextHighlighter(Color.WHITE, false); + + /* + ********************************************************************** + * + * FIELDS + * + ********************************************************************** + */ + + @NotNull + private volatile CalculatorDisplayViewState state = CalculatorDisplayViewStateImpl.newDefaultInstance(); + + private volatile boolean viewStateChange = false; + + @NotNull + private final Object lock = new Object(); + + @NotNull + private final Handler handler = new Handler(); + + private volatile boolean initialized = false; + + /* + ********************************************************************** + * + * CONSTRUCTORS + * + ********************************************************************** + */ + + public AndroidCalculatorDisplayView(Context context) { + super(context); + } + + public AndroidCalculatorDisplayView(Context context, AttributeSet attrs) { + super(context, attrs); + + } + + public AndroidCalculatorDisplayView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + /* + ********************************************************************** + * + * METHODS + * + ********************************************************************** + */ + + + @Override + public void setState(@NotNull final CalculatorDisplayViewState state) { + final CharSequence text = prepareText(state.getStringResult(), state.isValid()); + + handler.post(new Runnable() { + @Override + public void run() { + synchronized (lock) { + try { + viewStateChange = true; + + AndroidCalculatorDisplayView.this.state = state; + if (state.isValid()) { + setTextColor(getResources().getColor(R.color.default_text_color)); + setText(text); + + adjustTextSize(); + + } else { + // update text in order to get rid of HTML tags + setText(getText().toString()); + setTextColor(getResources().getColor(R.color.display_error_text_color)); + + // error messages are never shown -> just greyed out text (error message will be shown on click) + //setText(state.getErrorMessage()); + //redraw(); + } + } finally { + viewStateChange = false; + } + } + } + }); + } + + @NotNull + @Override + public CalculatorDisplayViewState getState() { + synchronized (lock) { + return this.state; + } + } + + @Nullable + private static CharSequence prepareText(@Nullable String text, boolean valid) { + CharSequence result; + + if (valid && text != null) { + + //Log.d(this.getClass().getName(), text); + + try { + final TextHighlighter.Result processedText = textHighlighter.process(text); + text = processedText.toString(); + result = Html.fromHtml(text); + } catch (CalculatorParseException e) { + result = text; + } + } else { + result = text; + } + + return result; + } + + private void adjustTextSize() { + // todo serso: think where to move it (keep in mind org.solovyev.android.view.AutoResizeTextView.resetTextSize()) + setAddEllipsis(false); + setMinTextSize(10); + resizeText(); + } + + public synchronized void init(@NotNull Context context) { + if (!initialized) { + this.setOnClickListener(new CalculatorDisplayOnClickListener(context)); + + this.initialized = true; + } + } +} diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java index 1d079a26..a1fe904b 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java @@ -130,10 +130,6 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar dialogShown = showSpecialWindow(preferences, CalculatorPreferences.Gui.feedbackWindowShown, R.layout.feedback, R.id.feedbackText, context); } } - - if (!dialogShown) { - dialogShown = showSpecialWindow(preferences, CalculatorPreferences.Gui.notesppAnnounceShown, R.layout.notespp_announce, R.id.notespp_announce, context); - } } private static boolean showSpecialWindow(@NotNull SharedPreferences preferences, @NotNull Preference specialWindowShownPref, int layoutId, int textViewId, @NotNull Context context) { @@ -316,8 +312,8 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar } @SuppressWarnings({"UnusedDeclaration"}) - public void donateButtonClickHandler(@NotNull View v) { - CalculatorApplication.showDonationDialog(this); + public void likeButtonClickHandler(@NotNull View v) { + CalculatorApplication.likeButtonPressed(this); } } \ No newline at end of file diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java index c215bb9c..e6ae4735 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java @@ -1,16 +1,10 @@ package org.solovyev.android.calculator; -import android.app.AlertDialog; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.preference.PreferenceManager; -import android.text.method.LinkMovementMethod; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.TextView; import net.robotmedia.billing.BillingController; import org.acra.ACRA; import org.acra.ReportingInteractionMode; @@ -25,6 +19,8 @@ import org.solovyev.android.calculator.model.AndroidCalculatorEngine; * Date: 12/1/11 * Time: 1:21 PM */ +/*@ReportsCrashes(formKey = "dEhDaW1nZU1qcFdsVUpiSnhON0c0ZHc6MQ", + mode = ReportingInteractionMode.TOAST)*/ @ReportsCrashes(formKey = "", mailTo = "se.solovyev+programming+calculatorpp+crashes@gmail.com", mode = ReportingInteractionMode.DIALOG, @@ -33,7 +29,15 @@ import org.solovyev.android.calculator.model.AndroidCalculatorEngine; resDialogText = R.string.crash_dialog_text) public class CalculatorApplication extends android.app.Application { - private static final String paypalDonateUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=se%2esolovyev%40gmail%2ecom&lc=RU&item_name=Android%20Calculator¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"; + /* + ********************************************************************** + * + * CONSTANTS + * + ********************************************************************** + */ + + public static final String FACEBOOK_APP_URL = "http://www.facebook.com/calculatorpp"; public static final String AD_FREE_PRODUCT_ID = "ad_free"; public static final String AD_FREE_P_KEY = "org.solovyev.android.calculator_ad_free"; @@ -43,14 +47,25 @@ public class CalculatorApplication extends android.app.Application { @NotNull private static CalculatorApplication instance; + /* + ********************************************************************** + * + * CONSTRUCTORS + * + ********************************************************************** + */ + public CalculatorApplication() { instance = this; } - @NotNull - public static CalculatorApplication getInstance() { - return instance; - } + /* + ********************************************************************** + * + * METHODS + * + ********************************************************************** + */ @Override public void onCreate() { @@ -86,11 +101,10 @@ public class CalculatorApplication extends android.app.Application { } }); - BillingController.registerObserver(new CalculatorBillingObserver(this)); + // init billing controller BillingController.checkBillingSupported(this); - } private void setTheme(@NotNull SharedPreferences preferences) { @@ -98,29 +112,6 @@ public class CalculatorApplication extends android.app.Application { setTheme(theme.getThemeId()); } - public static void showDonationDialog(@NotNull final Context context) { - final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE); - final View view = layoutInflater.inflate(R.layout.donate, null); - - final TextView donate = (TextView) view.findViewById(R.id.donateText); - donate.setMovementMethod(LinkMovementMethod.getInstance()); - - final AlertDialog.Builder builder = new AlertDialog.Builder(context) - .setCancelable(true) - .setNegativeButton(R.string.c_cancel, null) - .setPositiveButton(R.string.c_donate, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - final Intent i = new Intent(Intent.ACTION_VIEW); - i.setData(Uri.parse(paypalDonateUrl)); - context.startActivity(i); - } - }) - .setView(view); - - builder.create().show(); - } - @NotNull public CalculatorActivityHelper createActivityHelper(int layoutResId, @NotNull String logTag) { return new CalculatorActivityHelperImpl(layoutResId, logTag); @@ -140,4 +131,20 @@ public class CalculatorApplication extends android.app.Application { return new CalculatorFragmentHelperImpl(layoutId, titleResId, listenersOnCreate); } + /* + ********************************************************************** + * + * STATIC + * + ********************************************************************** + */ + + @NotNull + public static CalculatorApplication getInstance() { + return instance; + } + + public static void likeButtonPressed(@NotNull final Context context) { + context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(FACEBOOK_APP_URL))); + } } diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/LoggingBillingObserver.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/LoggingBillingObserver.java new file mode 100644 index 00000000..5cbe4a1a --- /dev/null +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/LoggingBillingObserver.java @@ -0,0 +1,50 @@ +package org.solovyev.android.calculator; + +import android.app.PendingIntent; +import android.util.Log; +import net.robotmedia.billing.IBillingObserver; +import net.robotmedia.billing.ResponseCode; +import net.robotmedia.billing.model.Transaction; +import org.jetbrains.annotations.NotNull; + +/** +* User: serso +* Date: 10/10/12 +* Time: 12:27 AM +*/ +class LoggingBillingObserver implements IBillingObserver { + @Override + public void onCheckBillingSupportedResponse(boolean supported) { + Log.d("CalculatorppBilling", "onCheckBillingSupportedResponse"); + } + + @Override + public void onPurchaseIntentOK(@NotNull String productId, @NotNull PendingIntent purchaseIntent) { + Log.d("CalculatorppBilling", "onPurchaseIntentOK"); + } + + @Override + public void onPurchaseIntentFailure(@NotNull String productId, @NotNull ResponseCode responseCode) { + Log.d("CalculatorppBilling", "onPurchaseIntentFailure"); + } + + @Override + public void onPurchaseStateChanged(@NotNull String productId, @NotNull Transaction.PurchaseState state) { + Log.d("CalculatorppBilling", "onPurchaseStateChanged"); + } + + @Override + public void onRequestPurchaseResponse(@NotNull String productId, @NotNull ResponseCode response) { + Log.d("CalculatorppBilling", "onRequestPurchaseResponse"); + } + + @Override + public void onTransactionsRestored() { + Log.d("CalculatorppBilling", "onTransactionsRestored"); + } + + @Override + public void onErrorRestoreTransactions(@NotNull ResponseCode responseCode) { + Log.d("CalculatorppBilling", "onErrorRestoreTransactions"); + } +} diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFragment.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFragment.java index 7ca52fc8..181c1bd2 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFragment.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFragment.java @@ -87,7 +87,7 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul private Input input; @NotNull - private CalculatorEventData lastCalculatorEventData = CalculatorUtils.createFirstEventDataId(); + private final CalculatorEventHolder lastEventHolder = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId()); private int bgColor; @@ -355,13 +355,12 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable final Object data) { if (calculatorEventType.isOfType(CalculatorEventType.display_state_changed)) { if (!preparedInput.isFromInputArgs()) { - if (calculatorEventData.isAfter(this.lastCalculatorEventData)) { - this.lastCalculatorEventData = calculatorEventData; + final CalculatorEventHolder.Result result = this.lastEventHolder.apply(calculatorEventData); + if (result.isNewAfter()) { this.preparedInput = prepareInputFromDisplay(((CalculatorDisplayChangeEventData) data).getNewValue(), null); createChart(); - uiHandler.post(new Runnable() { @Override public void run() { @@ -372,6 +371,7 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul } }); } + } } }