diff --git a/app/src/main/assets/fonts/Roboto-Regular.ttf b/app/src/main/assets/fonts/Roboto-Regular.ttf
index 0e58508a..bca461d0 100644
Binary files a/app/src/main/assets/fonts/Roboto-Regular.ttf and b/app/src/main/assets/fonts/Roboto-Regular.ttf differ
diff --git a/app/src/main/java/org/solovyev/android/calculator/Keyboard.java b/app/src/main/java/org/solovyev/android/calculator/Keyboard.java
index 7d610c20..ab314896 100644
--- a/app/src/main/java/org/solovyev/android/calculator/Keyboard.java
+++ b/app/src/main/java/org/solovyev/android/calculator/Keyboard.java
@@ -43,6 +43,10 @@ public class Keyboard implements SharedPreferences.OnSharedPreferenceChangeListe
@Nonnull
private final MathType.Result mathType = new MathType.Result();
+ @Nonnull
+ private static final String GLYPH_PASTE = "\uE000";
+ @Nonnull
+ private static final String GLYPH_COPY = "\uE001";
@Inject
Editor editor;
@@ -74,10 +78,17 @@ public class Keyboard implements SharedPreferences.OnSharedPreferenceChangeListe
return vibrateOnKeypress;
}
- public boolean buttonPressed(@Nullable final String text) {
+ public boolean buttonPressed(@Nullable String text) {
if (TextUtils.isEmpty(text)) {
return false;
}
+
+ if (text.equals(GLYPH_COPY)) {
+ text = CppSpecialButton.copy.action;
+ } else if (text.equals(GLYPH_PASTE)) {
+ text = CppSpecialButton.paste.action;
+ }
+
ga.onButtonPressed(text);
if (!processSpecialAction(text)) {
processText(prepareText(text));
@@ -137,10 +148,16 @@ public class Keyboard implements SharedPreferences.OnSharedPreferenceChangeListe
launcher.showHistory();
break;
case cursor_right:
- moveCursorRight();
+ editor.moveCursorRight();
+ break;
+ case cursor_to_end:
+ editor.setCursorOnEnd();
break;
case cursor_left:
- moveCursorLeft();
+ editor.moveCursorLeft();
+ break;
+ case cursor_to_start:
+ editor.setCursorOnStart();
break;
case settings:
launcher.showSettings();
@@ -158,16 +175,19 @@ public class Keyboard implements SharedPreferences.OnSharedPreferenceChangeListe
editor.erase();
break;
case paste:
- pasteButtonPressed();
+ final String text = clipboard.get().getText();
+ if (!TextUtils.isEmpty(text)) {
+ editor.insert(text);
+ }
break;
case copy:
- copyButtonPressed();
+ bus.get().post(new Display.CopyOperation());
break;
case equals:
equalsButtonPressed();
break;
case clear:
- clearButtonPressed();
+ editor.clear();
break;
case functions:
launcher.showFunctions();
@@ -209,29 +229,6 @@ public class Keyboard implements SharedPreferences.OnSharedPreferenceChangeListe
editor.setText("(" + oldText.subSequence(0, cursorPosition) + ")" + oldText.subSequence(cursorPosition, oldText.length()), cursorPosition + 2);
}
- public void pasteButtonPressed() {
- final String text = clipboard.get().getText();
- if (!TextUtils.isEmpty(text)) {
- editor.insert(text);
- }
- }
-
- public void clearButtonPressed() {
- editor.clear();
- }
-
- public void copyButtonPressed() {
- bus.get().post(new Display.CopyOperation());
- }
-
- public void moveCursorLeft() {
- editor.moveCursorLeft();
- }
-
- public void moveCursorRight() {
- editor.moveCursorRight();
- }
-
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
if (Preferences.Gui.vibrateOnKeypress.isSameKey(key)) {
diff --git a/app/src/main/java/org/solovyev/android/calculator/buttons/CppSpecialButton.java b/app/src/main/java/org/solovyev/android/calculator/buttons/CppSpecialButton.java
index b999dc15..875431dc 100644
--- a/app/src/main/java/org/solovyev/android/calculator/buttons/CppSpecialButton.java
+++ b/app/src/main/java/org/solovyev/android/calculator/buttons/CppSpecialButton.java
@@ -33,7 +33,9 @@ public enum CppSpecialButton {
history("history"),
cursor_right("▷"),
+ cursor_to_end(">>"),
cursor_left("◁"),
+ cursor_to_start("<<"),
settings("settings"),
settings_widget("settings_widget"),
like("like"),
diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java
index c9adcd43..c8098c7c 100644
--- a/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java
+++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java
@@ -65,7 +65,10 @@ public abstract class BaseKeyboardUi implements SharedPreferences.OnSharedPrefer
listener = new DirectionDragListener(application) {
@Override
protected boolean onDrag(@NonNull View view, @NonNull DragEvent event, @NonNull DragDirection direction) {
- return Drag.hasDirectionText(view, direction) && BaseKeyboardUi.this.onDrag(view, direction);
+ if (!Drag.hasDirectionText(view, direction)) {
+ return false;
+ }
+ return BaseKeyboardUi.this.onDrag(view, direction, ((DirectionDragView) view).getText(direction).getValue());
}
};
textScale = getTextScale(application);
@@ -82,7 +85,7 @@ public abstract class BaseKeyboardUi implements SharedPreferences.OnSharedPrefer
}
}
- protected abstract boolean onDrag(@NonNull View view, @NonNull DragDirection direction);
+ protected abstract boolean onDrag(@NonNull View view, @NonNull DragDirection direction, @Nonnull String value);
public void onCreateView(@Nonnull Activity activity, @Nonnull View view) {
cast(activity.getApplication()).getComponent().inject(this);
diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/KeyboardUi.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/KeyboardUi.java
index 735a8cba..5990bf86 100644
--- a/app/src/main/java/org/solovyev/android/calculator/keyboard/KeyboardUi.java
+++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/KeyboardUi.java
@@ -246,7 +246,7 @@ public class KeyboardUi extends BaseKeyboardUi {
}
@Override
- protected boolean onDrag(@NonNull View view, @NonNull DragDirection direction) {
+ protected boolean onDrag(@NonNull View view, @NonNull DragDirection direction, @Nonnull String value) {
switch (view.getId()) {
case R.id.cpp_button_functions:
if (direction == up) {
diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java
index e9889b76..dd503ded 100644
--- a/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java
+++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java
@@ -75,13 +75,11 @@ public class PartialKeyboardUi extends BaseKeyboardUi {
}
@Override
- protected boolean onDrag(@NonNull View view, @NonNull DragDirection direction) {
+ protected boolean onDrag(@NonNull View view, @NonNull DragDirection direction, @Nonnull String value) {
switch (view.getId()) {
case R.id.cpp_button_right:
- editor.setCursorOnEnd();
- return true;
case R.id.cpp_button_left:
- editor.setCursorOnStart();
+ keyboard.buttonPressed(value);
return true;
case R.id.cpp_button_clear:
if(direction == up) {
diff --git a/app/src/main/res/layout/cpp_app_button_left.xml b/app/src/main/res/layout/cpp_app_button_left.xml
index f616ebbd..845176fa 100644
--- a/app/src/main/res/layout/cpp_app_button_left.xml
+++ b/app/src/main/res/layout/cpp_app_button_left.xml
@@ -29,4 +29,5 @@
xmlns:tools="http://schemas.android.com/tools"
a:src="@drawable/ic_keyboard_arrow_left_white_48dp"
c:directionTextUp="<<"
+ c:directionTextDown="@string/cpp_glyph_copy"
tools:ignore="HardcodedText" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/cpp_app_button_right.xml b/app/src/main/res/layout/cpp_app_button_right.xml
index 6983f4ce..f5d9d2c3 100644
--- a/app/src/main/res/layout/cpp_app_button_right.xml
+++ b/app/src/main/res/layout/cpp_app_button_right.xml
@@ -29,4 +29,5 @@
xmlns:tools="http://schemas.android.com/tools"
a:src="@drawable/ic_keyboard_arrow_right_white_48dp"
c:directionTextUp=">>"
+ c:directionTextDown="@string/cpp_glyph_paste"
tools:ignore="HardcodedText" />
\ No newline at end of file
diff --git a/app/src/main/res/values/text_non_translatable.xml b/app/src/main/res/values/text_non_translatable.xml
index c7026931..6144e7a8 100644
--- a/app/src/main/res/values/text_non_translatable.xml
+++ b/app/src/main/res/values/text_non_translatable.xml
@@ -17,6 +17,8 @@
αβγ
E
%1$s (AMOLED)
+ "\ue000"
+ "\ue001"
- 0
- 1