diff --git a/android-app/res/layout/unit_converter.xml b/android-app-core/res/layout/unit_converter.xml
similarity index 100%
rename from android-app/res/layout/unit_converter.xml
rename to android-app-core/res/layout/unit_converter.xml
diff --git a/android-app-widget/res/layout/widget_app_button.xml b/android-app-core/res/layout/widget_app_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_app_button.xml
rename to android-app-core/res/layout/widget_app_button.xml
diff --git a/android-app-widget/res/layout/widget_clear_button.xml b/android-app-core/res/layout/widget_clear_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_clear_button.xml
rename to android-app-core/res/layout/widget_clear_button.xml
diff --git a/android-app-widget/res/layout/widget_copy_button.xml b/android-app-core/res/layout/widget_copy_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_copy_button.xml
rename to android-app-core/res/layout/widget_copy_button.xml
diff --git a/android-app-widget/res/layout/widget_division_button.xml b/android-app-core/res/layout/widget_division_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_division_button.xml
rename to android-app-core/res/layout/widget_division_button.xml
diff --git a/android-app-widget/res/layout/widget_dot_button.xml b/android-app-core/res/layout/widget_dot_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_dot_button.xml
rename to android-app-core/res/layout/widget_dot_button.xml
diff --git a/android-app-widget/res/layout/widget_eight_digit_button.xml b/android-app-core/res/layout/widget_eight_digit_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_eight_digit_button.xml
rename to android-app-core/res/layout/widget_eight_digit_button.xml
diff --git a/android-app-widget/res/layout/widget_equals_button.xml b/android-app-core/res/layout/widget_equals_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_equals_button.xml
rename to android-app-core/res/layout/widget_equals_button.xml
diff --git a/android-app-widget/res/layout/widget_erase_button.xml b/android-app-core/res/layout/widget_erase_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_erase_button.xml
rename to android-app-core/res/layout/widget_erase_button.xml
diff --git a/android-app-widget/res/layout/widget_five_digit_button.xml b/android-app-core/res/layout/widget_five_digit_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_five_digit_button.xml
rename to android-app-core/res/layout/widget_five_digit_button.xml
diff --git a/android-app-widget/res/layout/widget_four_digit_button.xml b/android-app-core/res/layout/widget_four_digit_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_four_digit_button.xml
rename to android-app-core/res/layout/widget_four_digit_button.xml
diff --git a/android-app-widget/res/layout/widget_functions_button.xml b/android-app-core/res/layout/widget_functions_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_functions_button.xml
rename to android-app-core/res/layout/widget_functions_button.xml
diff --git a/android-app-widget/res/layout/widget_history_button.xml b/android-app-core/res/layout/widget_history_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_history_button.xml
rename to android-app-core/res/layout/widget_history_button.xml
diff --git a/android-app-widget/res/layout/widget_keyboard.xml b/android-app-core/res/layout/widget_keyboard.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_keyboard.xml
rename to android-app-core/res/layout/widget_keyboard.xml
diff --git a/android-app-widget/res/layout/widget_left_button.xml b/android-app-core/res/layout/widget_left_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_left_button.xml
rename to android-app-core/res/layout/widget_left_button.xml
diff --git a/android-app-widget/res/layout/widget_like_button.xml b/android-app-core/res/layout/widget_like_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_like_button.xml
rename to android-app-core/res/layout/widget_like_button.xml
diff --git a/android-app-widget/res/layout/widget_multiplication_button.xml b/android-app-core/res/layout/widget_multiplication_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_multiplication_button.xml
rename to android-app-core/res/layout/widget_multiplication_button.xml
diff --git a/android-app-widget/res/layout/widget_nine_digit_button.xml b/android-app-core/res/layout/widget_nine_digit_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_nine_digit_button.xml
rename to android-app-core/res/layout/widget_nine_digit_button.xml
diff --git a/android-app-widget/res/layout/widget_one_digit_button.xml b/android-app-core/res/layout/widget_one_digit_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_one_digit_button.xml
rename to android-app-core/res/layout/widget_one_digit_button.xml
diff --git a/android-app-widget/res/layout/widget_paste_button.xml b/android-app-core/res/layout/widget_paste_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_paste_button.xml
rename to android-app-core/res/layout/widget_paste_button.xml
diff --git a/android-app-widget/res/layout/widget_percent_button.xml b/android-app-core/res/layout/widget_percent_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_percent_button.xml
rename to android-app-core/res/layout/widget_percent_button.xml
diff --git a/android-app-widget/res/layout/widget_plus_button.xml b/android-app-core/res/layout/widget_plus_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_plus_button.xml
rename to android-app-core/res/layout/widget_plus_button.xml
diff --git a/android-app-widget/res/layout/widget_power_button.xml b/android-app-core/res/layout/widget_power_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_power_button.xml
rename to android-app-core/res/layout/widget_power_button.xml
diff --git a/android-app-widget/res/layout/widget_right_button.xml b/android-app-core/res/layout/widget_right_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_right_button.xml
rename to android-app-core/res/layout/widget_right_button.xml
diff --git a/android-app-widget/res/layout/widget_round_brackets_button.xml b/android-app-core/res/layout/widget_round_brackets_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_round_brackets_button.xml
rename to android-app-core/res/layout/widget_round_brackets_button.xml
diff --git a/android-app-widget/res/layout/widget_settings_button.xml b/android-app-core/res/layout/widget_settings_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_settings_button.xml
rename to android-app-core/res/layout/widget_settings_button.xml
diff --git a/android-app-widget/res/layout/widget_seven_digit_button.xml b/android-app-core/res/layout/widget_seven_digit_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_seven_digit_button.xml
rename to android-app-core/res/layout/widget_seven_digit_button.xml
diff --git a/android-app-widget/res/layout/widget_six_digit_button.xml b/android-app-core/res/layout/widget_six_digit_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_six_digit_button.xml
rename to android-app-core/res/layout/widget_six_digit_button.xml
diff --git a/android-app-widget/res/layout/widget_subtraction_button.xml b/android-app-core/res/layout/widget_subtraction_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_subtraction_button.xml
rename to android-app-core/res/layout/widget_subtraction_button.xml
diff --git a/android-app-widget/res/layout/widget_three_digit_button.xml b/android-app-core/res/layout/widget_three_digit_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_three_digit_button.xml
rename to android-app-core/res/layout/widget_three_digit_button.xml
diff --git a/android-app-widget/res/layout/widget_two_digit_button.xml b/android-app-core/res/layout/widget_two_digit_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_two_digit_button.xml
rename to android-app-core/res/layout/widget_two_digit_button.xml
diff --git a/android-app-widget/res/layout/widget_vars_button.xml b/android-app-core/res/layout/widget_vars_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_vars_button.xml
rename to android-app-core/res/layout/widget_vars_button.xml
diff --git a/android-app-widget/res/layout/widget_zero_digit_button.xml b/android-app-core/res/layout/widget_zero_digit_button.xml
similarity index 100%
rename from android-app-widget/res/layout/widget_zero_digit_button.xml
rename to android-app-core/res/layout/widget_zero_digit_button.xml
diff --git a/android-app-core/res/values/dimens.xml b/android-app-core/res/values/dimens.xml
index 340956d2..d5674683 100644
--- a/android-app-core/res/values/dimens.xml
+++ b/android-app-core/res/values/dimens.xml
@@ -26,4 +26,6 @@
5dp
3dp
+
+ 20dp
\ No newline at end of file
diff --git a/android-app-core/res/values/styles.xml b/android-app-core/res/values/styles.xml
index 83c17c25..3dd2ecce 100644
--- a/android-app-core/res/values/styles.xml
+++ b/android-app-core/res/values/styles.xml
@@ -87,4 +87,22 @@
- @color/cpp_default_text_color
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java b/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java
similarity index 99%
rename from android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java
rename to android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java
index 0c122bce..d35fdd4b 100644
--- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java
+++ b/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java
@@ -15,6 +15,7 @@ import android.util.AttributeSet;
import android.util.TypedValue;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.solovyev.android.calculator.core.R;
import org.solovyev.android.calculator.text.TextProcessor;
import org.solovyev.android.calculator.view.TextHighlighter;
import org.solovyev.android.view.AutoResizeTextView;
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java b/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java
similarity index 100%
rename from android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java
rename to android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java
diff --git a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/WidgetButton.java b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButton.java
similarity index 75%
rename from android-app-widget/src/main/java/org/solovyev/android/calculator/widget/WidgetButton.java
rename to android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButton.java
index bff1977e..f20a5555 100644
--- a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/WidgetButton.java
+++ b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButton.java
@@ -1,10 +1,9 @@
-package org.solovyev.android.calculator.widget;
+package org.solovyev.android.calculator;
import android.content.Context;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.solovyev.android.calculator.CalculatorSpecialButton;
-import org.solovyev.android.calculator.Locator;
+import org.solovyev.android.calculator.core.R;
import java.util.HashMap;
import java.util.Map;
@@ -14,7 +13,7 @@ import java.util.Map;
* Date: 10/20/12
* Time: 12:05 AM
*/
-public enum WidgetButton {
+public enum CalculatorButton {
/*digits*/
one(R.id.oneDigitButton, "1"),
@@ -69,24 +68,24 @@ public enum WidgetButton {
private final String onLongClickText;
@NotNull
- private static Map buttonsByIds = new HashMap();
+ private static Map buttonsByIds = new HashMap();
- WidgetButton(int buttonId, @NotNull CalculatorSpecialButton onClickButton, @Nullable CalculatorSpecialButton onLongClickButton) {
+ CalculatorButton(int buttonId, @NotNull CalculatorSpecialButton onClickButton, @Nullable CalculatorSpecialButton onLongClickButton) {
this(buttonId, onClickButton.getActionCode(), onLongClickButton == null ? null : onLongClickButton.getActionCode());
}
- WidgetButton(int buttonId, @NotNull CalculatorSpecialButton onClickButton) {
+ CalculatorButton(int buttonId, @NotNull CalculatorSpecialButton onClickButton) {
this(buttonId, onClickButton, null);
}
- WidgetButton(int buttonId, @NotNull String onClickText, @Nullable String onLongClickText) {
+ CalculatorButton(int buttonId, @NotNull String onClickText, @Nullable String onLongClickText) {
this.buttonId = buttonId;
this.onClickText = onClickText;
this.onLongClickText = onLongClickText;
}
- WidgetButton(int buttonId, @NotNull String onClickText) {
+ CalculatorButton(int buttonId, @NotNull String onClickText) {
this(buttonId, onClickText, null);
}
@@ -103,7 +102,7 @@ public enum WidgetButton {
}
@Nullable
- public static WidgetButton getById(int buttonId) {
+ public static CalculatorButton getById(int buttonId) {
initButtonsByIdsMap();
return buttonsByIds.get(buttonId);
@@ -113,11 +112,11 @@ public enum WidgetButton {
if ( buttonsByIds.isEmpty() ) {
// if not initialized
- final WidgetButton[] widgetButtons = values();
+ final CalculatorButton[] calculatorButtons = values();
- final Map localButtonsByIds = new HashMap(widgetButtons.length);
- for (WidgetButton widgetButton : widgetButtons) {
- localButtonsByIds.put(widgetButton.getButtonId(), widgetButton);
+ final Map localButtonsByIds = new HashMap(calculatorButtons.length);
+ for (CalculatorButton calculatorButton : calculatorButtons) {
+ localButtonsByIds.put(calculatorButton.getButtonId(), calculatorButton);
}
buttonsByIds = localButtonsByIds;
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayMenuItem.java b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayMenuItem.java
similarity index 94%
rename from android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayMenuItem.java
rename to android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayMenuItem.java
index 00d6ff48..136040ce 100644
--- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayMenuItem.java
+++ b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayMenuItem.java
@@ -4,7 +4,9 @@ import android.content.Context;
import jscl.math.Generic;
import jscl.math.function.Constant;
import org.jetbrains.annotations.NotNull;
+import org.solovyev.android.calculator.core.R;
import org.solovyev.android.calculator.jscl.JsclOperation;
+import org.solovyev.android.calculator.plot.PlotInput;
import org.solovyev.android.calculator.view.NumeralBaseConverterDialog;
import org.solovyev.android.menu.LabeledMenuItem;
import org.solovyev.common.collections.CollectionsUtils;
@@ -82,7 +84,8 @@ public enum CalculatorDisplayMenuItem implements LabeledMenuItem
+
\ No newline at end of file
diff --git a/android-app-onscreen/pom.xml b/android-app-onscreen/pom.xml
new file mode 100644
index 00000000..27b7e988
--- /dev/null
+++ b/android-app-onscreen/pom.xml
@@ -0,0 +1,45 @@
+
+
+ 4.0.0
+
+
+ org.solovyev.android
+ calculatorpp-parent
+ 1.5.3-SNAPSHOT
+
+
+ org.solovyev.android
+ calculatorpp-android-app-onscreen
+ 1.5.3-SNAPSHOT
+ Calculator++ Application Onscreen
+ apklib
+
+
+
+
+ org.solovyev.android
+ calculatorpp-core
+
+
+
+ org.solovyev.android
+ calculatorpp-android-app-core
+ apklib
+
+
+
+
+
+
+
+
+ com.jayway.maven.plugins.android.generation2
+ android-maven-plugin
+
+
+
+
+
+
diff --git a/android-app/res/layout/onscreen_display.xml b/android-app-onscreen/res/layout/onscreen_display.xml
similarity index 100%
rename from android-app/res/layout/onscreen_display.xml
rename to android-app-onscreen/res/layout/onscreen_display.xml
diff --git a/android-app/res/layout/onscreen_editor.xml b/android-app-onscreen/res/layout/onscreen_editor.xml
similarity index 100%
rename from android-app/res/layout/onscreen_editor.xml
rename to android-app-onscreen/res/layout/onscreen_editor.xml
diff --git a/android-app/res/layout/onscreen_footer.xml b/android-app-onscreen/res/layout/onscreen_footer.xml
similarity index 100%
rename from android-app/res/layout/onscreen_footer.xml
rename to android-app-onscreen/res/layout/onscreen_footer.xml
diff --git a/android-app/res/layout/onscreen_header.xml b/android-app-onscreen/res/layout/onscreen_header.xml
similarity index 100%
rename from android-app/res/layout/onscreen_header.xml
rename to android-app-onscreen/res/layout/onscreen_header.xml
diff --git a/android-app/res/layout/onscreen_keyboard.xml b/android-app-onscreen/res/layout/onscreen_keyboard.xml
similarity index 100%
rename from android-app/res/layout/onscreen_keyboard.xml
rename to android-app-onscreen/res/layout/onscreen_keyboard.xml
diff --git a/android-app/res/layout/onscreen_layout.xml b/android-app-onscreen/res/layout/onscreen_layout.xml
similarity index 95%
rename from android-app/res/layout/onscreen_layout.xml
rename to android-app-onscreen/res/layout/onscreen_layout.xml
index 328b38b8..1593b4ec 100644
--- a/android-app/res/layout/onscreen_layout.xml
+++ b/android-app-onscreen/res/layout/onscreen_layout.xml
@@ -2,7 +2,7 @@
+ style="@style/cpp_onscreen_main_layout_style">
diff --git a/android-app-onscreen/res/values/colors.xml b/android-app-onscreen/res/values/colors.xml
new file mode 100644
index 00000000..b514ada9
--- /dev/null
+++ b/android-app-onscreen/res/values/colors.xml
@@ -0,0 +1,4 @@
+
+
+ #ff707070
+
\ No newline at end of file
diff --git a/android-app-onscreen/res/values/styles.xml b/android-app-onscreen/res/values/styles.xml
new file mode 100644
index 00000000..8f842ce2
--- /dev/null
+++ b/android-app-onscreen/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenBroadcastReceiver.java b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenBroadcastReceiver.java
similarity index 100%
rename from android-app/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenBroadcastReceiver.java
rename to android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenBroadcastReceiver.java
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenService.java b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenService.java
similarity index 98%
rename from android-app/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenService.java
rename to android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenService.java
index d37af37f..315793b2 100644
--- a/android-app/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenService.java
+++ b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenService.java
@@ -15,7 +15,6 @@ import org.solovyev.android.AndroidUtils;
import org.solovyev.android.calculator.CalculatorDisplayViewState;
import org.solovyev.android.calculator.CalculatorEditorViewState;
import org.solovyev.android.calculator.Locator;
-import org.solovyev.android.calculator.R;
import org.solovyev.android.calculator.external.*;
/**
@@ -112,7 +111,7 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul
@NotNull
private static String getCursorColor(@NotNull Context context) {
if (cursorColor == null) {
- cursorColor = Integer.toHexString(context.getResources().getColor(R.color.cpp_widget_cursor_color)).substring(2);
+ cursorColor = Integer.toHexString(context.getResources().getColor(R.color.cpp_onscreen_cursor_color)).substring(2);
}
return cursorColor;
}
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenView.java b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenView.java
similarity index 98%
rename from android-app/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenView.java
rename to android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenView.java
index dd29ca24..8bd0c2e5 100644
--- a/android-app/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenView.java
+++ b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenView.java
@@ -10,7 +10,7 @@ import android.widget.ImageView;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.calculator.*;
-import org.solovyev.android.calculator.widget.WidgetButton;
+import org.solovyev.android.calculator.CalculatorButton;
/**
* User: serso
@@ -153,14 +153,14 @@ public class CalculatorOnscreenView {
private void init() {
if (!initialized) {
- for (final WidgetButton widgetButton : WidgetButton.values()) {
+ for (final CalculatorButton widgetButton : CalculatorButton.values()) {
final View button = root.findViewById(widgetButton.getButtonId());
if (button != null) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
widgetButton.onClick(context);
- if ( widgetButton == WidgetButton.app ) {
+ if ( widgetButton == CalculatorButton.app ) {
minimize();
}
}
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenViewDef.java b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenViewDef.java
similarity index 100%
rename from android-app/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenViewDef.java
rename to android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenViewDef.java
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/onscreen/OnscreenViewListener.java b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/OnscreenViewListener.java
similarity index 100%
rename from android-app/src/main/java/org/solovyev/android/calculator/onscreen/OnscreenViewListener.java
rename to android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/OnscreenViewListener.java
diff --git a/android-app-widget/res/values/dimens.xml b/android-app-widget/res/values/dimens.xml
index 744d6015..3915feed 100644
--- a/android-app-widget/res/values/dimens.xml
+++ b/android-app-widget/res/values/dimens.xml
@@ -1,7 +1,6 @@
25sp
- 20dp
25sp
6dp
\ No newline at end of file
diff --git a/android-app-widget/res/values/styles.xml b/android-app-widget/res/values/styles.xml
index 00f79aeb..95b2a8f0 100644
--- a/android-app-widget/res/values/styles.xml
+++ b/android-app-widget/res/values/styles.xml
@@ -1,5 +1,6 @@
+
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java b/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java
index 75ef8b5e..9412c797 100644
--- a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java
+++ b/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java
@@ -10,10 +10,7 @@ import android.text.Html;
import android.widget.RemoteViews;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.solovyev.android.calculator.CalculatorButtons;
-import org.solovyev.android.calculator.CalculatorDisplayViewState;
-import org.solovyev.android.calculator.CalculatorEditorViewState;
-import org.solovyev.android.calculator.Locator;
+import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.external.ExternalCalculatorIntentHandler;
import org.solovyev.android.calculator.external.ExternalCalculatorStateUpdater;
@@ -113,7 +110,7 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem
for (int appWidgetId : appWidgetIds) {
final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
- for (WidgetButton button : WidgetButton.values()) {
+ for (CalculatorButton button : CalculatorButton.values()) {
final Intent onButtonClickIntent = new Intent(context, getComponentClass());
onButtonClickIntent.setAction(BUTTON_PRESSED_ACTION);
onButtonClickIntent.putExtra(BUTTON_ID_EXTRA, button.getButtonId());
diff --git a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidgetIntentHandler.java b/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidgetIntentHandler.java
index 0d58cbc1..a1a6095d 100644
--- a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidgetIntentHandler.java
+++ b/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidgetIntentHandler.java
@@ -3,6 +3,7 @@ package org.solovyev.android.calculator.widget;
import android.content.Context;
import android.content.Intent;
import org.jetbrains.annotations.NotNull;
+import org.solovyev.android.calculator.CalculatorButton;
import org.solovyev.android.calculator.Locator;
import org.solovyev.android.calculator.external.DefaultExternalCalculatorIntentHandler;
import org.solovyev.android.calculator.external.ExternalCalculatorStateUpdater;
@@ -25,7 +26,7 @@ public class CalculatorWidgetIntentHandler extends DefaultExternalCalculatorInte
if (AbstractCalculatorWidgetProvider.BUTTON_PRESSED_ACTION.equals(intent.getAction())) {
final int buttonId = intent.getIntExtra(AbstractCalculatorWidgetProvider.BUTTON_ID_EXTRA, 0);
- final WidgetButton button = WidgetButton.getById(buttonId);
+ final CalculatorButton button = CalculatorButton.getById(buttonId);
if (button != null) {
button.onClick(context);
}
diff --git a/android-app/pom.xml b/android-app/pom.xml
index 40283d01..3f1d027f 100644
--- a/android-app/pom.xml
+++ b/android-app/pom.xml
@@ -35,6 +35,12 @@
apklib
+
+ org.solovyev.android
+ calculatorpp-android-app-onscreen
+ apklib
+
+
org.solovyev
common-core
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java
index 943aeed8..9fc3d854 100644
--- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java
+++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java
@@ -1,14 +1,10 @@
package org.solovyev.android.calculator;
import android.app.Activity;
-import android.app.AlertDialog;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.TextView;
import jscl.NumeralBase;
import jscl.math.Generic;
import org.jetbrains.annotations.NotNull;
@@ -40,19 +36,6 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S
PreferenceManager.getDefaultSharedPreferences(application).registerOnSharedPreferenceChangeListener(this);
}
- public static void showEvaluationError(@NotNull Context context, @NotNull final String errorMessage) {
- final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
-
- final View errorMessageView = layoutInflater.inflate(R.layout.display_error_message, null);
- ((TextView) errorMessageView.findViewById(R.id.error_message_text_view)).setText(errorMessage);
-
- final AlertDialog.Builder builder = new AlertDialog.Builder(context)
- .setPositiveButton(R.string.c_cancel, null)
- .setView(errorMessageView);
-
- builder.create().show();
- }
-
public void init(@NotNull final Activity activity) {
setEditor(activity);
setDisplay(activity);
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityLauncher.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityLauncher.java
index 27235789..dd2d2cfe 100644
--- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityLauncher.java
+++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityLauncher.java
@@ -1,10 +1,15 @@
package org.solovyev.android.calculator;
+import android.app.Activity;
+import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.preference.PreferenceManager;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import jscl.math.Generic;
import jscl.math.function.Constant;
@@ -18,6 +23,7 @@ import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
import org.solovyev.android.calculator.math.edit.*;
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
import org.solovyev.android.calculator.plot.CalculatorPlotFragment;
+import org.solovyev.android.calculator.plot.PlotInput;
import org.solovyev.common.msg.Message;
import org.solovyev.common.msg.MessageType;
import org.solovyev.common.text.StringUtils;
@@ -190,6 +196,40 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
}
});
break;
+ case plot_graph:
+ final PlotInput plotInput = (PlotInput) data;
+ assert plotInput != null;
+ App.getInstance().getUiThreadExecutor().execute(new Runnable() {
+ @Override
+ public void run() {
+ plotGraph(App.getInstance().getApplication(), plotInput.getFunction(), plotInput.getConstant());
+ }
+ });
+ break;
+ case show_evaluation_error:
+ final String errorMessage = (String) data;
+ if (errorMessage != null) {
+ App.getInstance().getUiThreadExecutor().execute(new Runnable() {
+ @Override
+ public void run() {
+ showEvaluationError(App.getInstance().getApplication(), errorMessage);
+ }
+ });
+ }
+ break;
}
}
+
+ public static void showEvaluationError(@NotNull Context context, @NotNull final String errorMessage) {
+ final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
+
+ final View errorMessageView = layoutInflater.inflate(R.layout.display_error_message, null);
+ ((TextView) errorMessageView.findViewById(R.id.error_message_text_view)).setText(errorMessage);
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(context)
+ .setPositiveButton(R.string.c_cancel, null)
+ .setView(errorMessageView);
+
+ builder.create().show();
+ }
}
diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventType.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventType.java
index 1b9a0b31..306e0ad2 100644
--- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventType.java
+++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventType.java
@@ -156,7 +156,13 @@ public enum CalculatorEventType {
show_like_dialog,
show_create_var_dialog,
- show_create_function_dialog;
+ show_create_function_dialog,
+
+ //org.solovyev.android.calculator.plot.PlotInput
+ plot_graph,
+
+ //String
+ show_evaluation_error;
public boolean isOfType(@NotNull CalculatorEventType... types) {
for (CalculatorEventType type : types) {
diff --git a/pom.xml b/pom.xml
index 3808b754..64858624 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,6 +26,7 @@
android-app
android-app-core
android-app-widget
+ android-app-onscreen
android-app-test
core
@@ -59,6 +60,13 @@
apklib
+
+ org.solovyev.android
+ calculatorpp-android-app-onscreen
+ 1.5.3-SNAPSHOT
+ apklib
+
+
org.solovyev
common-core