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 ae1c4324..fba551b7 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
@@ -24,29 +24,30 @@ package org.solovyev.android.calculator.buttons;
import org.solovyev.android.Check;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
// see values/text_glyphs.xml for glyph constants
public enum CppSpecialButton {
- history("history"),
+ history("history", '\ue005'),
history_undo("↶", '\ue007'),
history_redo("↷", '\ue008'),
- cursor_right("▷"),
+ cursor_right("▷", '\ue003'),
cursor_to_end(">>"),
- cursor_left("◁"),
+ cursor_left("◁", '\ue002'),
cursor_to_start("<<"),
settings("settings"),
settings_widget("settings_widget"),
- like("like"),
+ like("like", '\ue006'),
memory("memory"),
memory_plus("M+"),
memory_minus("M-"),
memory_clear("MC"),
- erase("erase"),
+ erase("erase", '\ue004'),
paste("paste", '\uE000'),
copy("copy", '\uE001'),
brackets_wrap("(…)"),
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 f0bdf05b..ee7c45fd 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
@@ -12,21 +12,38 @@ import android.util.TypedValue;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
-import dagger.Lazy;
+
import org.solovyev.android.Check;
-import org.solovyev.android.calculator.*;
+import org.solovyev.android.calculator.ActivityLauncher;
+import org.solovyev.android.calculator.App;
+import org.solovyev.android.calculator.Calculator;
+import org.solovyev.android.calculator.Editor;
+import org.solovyev.android.calculator.Keyboard;
+import org.solovyev.android.calculator.Preferences;
import org.solovyev.android.calculator.buttons.CppButton;
import org.solovyev.android.calculator.memory.Memory;
import org.solovyev.android.views.Adjuster;
-import org.solovyev.android.views.dragbutton.*;
+import org.solovyev.android.views.dragbutton.DirectionDragButton;
+import org.solovyev.android.views.dragbutton.DirectionDragImageButton;
+import org.solovyev.android.views.dragbutton.DirectionDragListener;
+import org.solovyev.android.views.dragbutton.DirectionDragView;
+import org.solovyev.android.views.dragbutton.Drag;
+import org.solovyev.android.views.dragbutton.DragDirection;
+import org.solovyev.android.views.dragbutton.DragEvent;
+import org.solovyev.android.views.dragbutton.DragView;
-import javax.annotation.Nonnull;
-import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.inject.Inject;
+
+import dagger.Lazy;
+
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
-import static android.view.HapticFeedbackConstants.*;
+import static android.view.HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING;
+import static android.view.HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING;
+import static android.view.HapticFeedbackConstants.KEYBOARD_TAP;
import static org.solovyev.android.calculator.App.cast;
import static org.solovyev.android.calculator.Preferences.Gui.Mode.simple;
@@ -111,18 +128,6 @@ public abstract class BaseKeyboardUi implements SharedPreferences.OnSharedPrefer
textSize = calculateTextSize(activity);
}
- protected final void prepareButton(@Nullable ImageView button) {
- prepareButton(button, IMAGE_SCALE);
- }
-
- protected final void prepareButton(@Nullable ImageView button, float scale) {
- if (button == null) {
- return;
- }
- prepareButton((View) button);
- Adjuster.adjustImage(button, scale);
- }
-
protected final void prepareButton(@Nullable View button) {
if (button == null) {
return;
@@ -132,18 +137,6 @@ public abstract class BaseKeyboardUi implements SharedPreferences.OnSharedPrefer
button.setOnClickListener(this);
}
- protected final void prepareButton(@Nullable DirectionDragImageButton button) {
- if (button == null) {
- return;
- }
- dragButtons.add(button);
- button.setVibrateOnDrag(keyboard.isVibrateOnKeypress());
- prepareButton((ImageView) button);
- button.setOnDragListener(listener);
- button.setTextSize(textSize);
- Adjuster.adjustText(button, AdjusterHelper.instance, textScale, 0);
- }
-
protected final void prepareButton(@Nullable DirectionDragButton button) {
if (button == null) {
return;
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 7c45b836..83688573 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
@@ -5,22 +5,24 @@ import android.app.Application;
import android.content.SharedPreferences;
import android.support.annotation.Nullable;
import android.view.View;
-import android.widget.ImageButton;
-import butterknife.Bind;
-import butterknife.ButterKnife;
-import jscl.NumeralBase;
+
import org.solovyev.android.calculator.Display;
import org.solovyev.android.calculator.Engine;
import org.solovyev.android.calculator.R;
import org.solovyev.android.views.dragbutton.DirectionDragButton;
-import org.solovyev.android.views.dragbutton.DirectionDragImageButton;
import javax.annotation.Nonnull;
import javax.inject.Inject;
+import butterknife.Bind;
+import butterknife.ButterKnife;
+import jscl.NumeralBase;
+
import static org.solovyev.android.calculator.Engine.Preferences.multiplicationSign;
import static org.solovyev.android.calculator.Engine.Preferences.numeralBase;
-import static org.solovyev.android.views.dragbutton.DragDirection.*;
+import static org.solovyev.android.views.dragbutton.DragDirection.down;
+import static org.solovyev.android.views.dragbutton.DragDirection.left;
+import static org.solovyev.android.views.dragbutton.DragDirection.up;
public class KeyboardUi extends BaseKeyboardUi {
@@ -58,7 +60,7 @@ public class KeyboardUi extends BaseKeyboardUi {
@Bind(R.id.cpp_button_functions)
DirectionDragButton functionsButton;
@Bind(R.id.cpp_button_history)
- DirectionDragImageButton historyButton;
+ DirectionDragButton historyButton;
@Bind(R.id.cpp_button_multiplication)
DirectionDragButton multiplicationButton;
@Bind(R.id.cpp_button_plus)
@@ -72,14 +74,8 @@ public class KeyboardUi extends BaseKeyboardUi {
@Bind(R.id.cpp_button_round_brackets)
DirectionDragButton bracketsButton;
@Nullable
- @Bind(R.id.cpp_button_copy)
- DirectionDragImageButton copyButton;
- @Nullable
- @Bind(R.id.cpp_button_paste)
- DirectionDragImageButton pasteButton;
- @Nullable
@Bind(R.id.cpp_button_like)
- ImageButton likeButton;
+ DirectionDragButton likeButton;
@Nullable
@Bind(R.id.cpp_button_percent)
DirectionDragButton percentButton;
@@ -132,12 +128,6 @@ public class KeyboardUi extends BaseKeyboardUi {
prepareButton(button8);
prepareButton(button9);
- if (copyButton != null) {
- prepareButton(copyButton);
- }
- if (pasteButton != null) {
- prepareButton(pasteButton);
- }
prepareButton(likeButton);
prepareButton(memoryButton);
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 94a4c58a..5fb9feb8 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
@@ -6,17 +6,17 @@ import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
-import android.widget.ImageButton;
-import butterknife.Bind;
-import butterknife.ButterKnife;
+
import org.solovyev.android.calculator.R;
import org.solovyev.android.calculator.view.EditorLongClickEraser;
import org.solovyev.android.views.dragbutton.DirectionDragButton;
-import org.solovyev.android.views.dragbutton.DirectionDragImageButton;
import javax.annotation.Nonnull;
import javax.inject.Inject;
+import butterknife.Bind;
+import butterknife.ButterKnife;
+
import static org.solovyev.android.calculator.Preferences.Gui.vibrateOnKeypress;
import static org.solovyev.android.views.dragbutton.DragDirection.down;
@@ -24,16 +24,16 @@ public class PartialKeyboardUi extends BaseKeyboardUi {
@Nullable
@Bind(R.id.cpp_button_right)
- DirectionDragImageButton rightButton;
+ DirectionDragButton rightButton;
@Nullable
@Bind(R.id.cpp_button_left)
- DirectionDragImageButton leftButton;
+ DirectionDragButton leftButton;
@Nullable
@Bind(R.id.cpp_button_clear)
DirectionDragButton clearButton;
@Nullable
@Bind(R.id.cpp_button_erase)
- ImageButton eraseButton;
+ DirectionDragButton eraseButton;
@Nullable
@Bind(R.id.cpp_button_equals)
DirectionDragButton equalsButton;
@@ -54,11 +54,10 @@ public class PartialKeyboardUi extends BaseKeyboardUi {
prepareButton(equalsButton);
prepareButton(clearButton);
if (eraseButton != null) {
- // backspace button is too big, scale it more
- prepareButton(eraseButton, IMAGE_SCALE_ERASE);
+ prepareButton(eraseButton);
longClickEraser = EditorLongClickEraser.attachTo(eraseButton, keyboard.isVibrateOnKeypress(), editor, calculator);
}
- if(isSimpleMode()) {
+ if (isSimpleMode()) {
hideText(equalsButton, down);
}
}
diff --git a/app/src/main/res/layout/cpp_app_button_copy.xml b/app/src/main/res/layout/cpp_app_button_copy.xml
deleted file mode 100644
index abf9433b..00000000
--- a/app/src/main/res/layout/cpp_app_button_copy.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/cpp_app_button_erase.xml b/app/src/main/res/layout/cpp_app_button_erase.xml
index 1a05ca1b..5dd168f1 100644
--- a/app/src/main/res/layout/cpp_app_button_erase.xml
+++ b/app/src/main/res/layout/cpp_app_button_erase.xml
@@ -22,8 +22,8 @@
~ Site: http://se.solovyev.org
-->
-
\ No newline at end of file
+ android:text="@string/cpp_glyph_backspace"/>
\ No newline at end of file
diff --git a/app/src/main/res/layout/cpp_app_button_history.xml b/app/src/main/res/layout/cpp_app_button_history.xml
index a7291251..3710be8d 100644
--- a/app/src/main/res/layout/cpp_app_button_history.xml
+++ b/app/src/main/res/layout/cpp_app_button_history.xml
@@ -21,12 +21,12 @@
~ Email: se.solovyev@gmail.com
~ Site: http://se.solovyev.org
-->
-
\ No newline at end of file
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 845176fa..e0565d79 100644
--- a/app/src/main/res/layout/cpp_app_button_left.xml
+++ b/app/src/main/res/layout/cpp_app_button_left.xml
@@ -22,12 +22,12 @@
~ Site: http://se.solovyev.org
-->
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/cpp_app_button_like.xml b/app/src/main/res/layout/cpp_app_button_like.xml
index 88497724..05363467 100644
--- a/app/src/main/res/layout/cpp_app_button_like.xml
+++ b/app/src/main/res/layout/cpp_app_button_like.xml
@@ -22,8 +22,8 @@
~ Site: http://se.solovyev.org
-->
-
\ No newline at end of file
+ android:text="@string/cpp_glyph_heart"/>
\ No newline at end of file
diff --git a/app/src/main/res/layout/cpp_app_button_paste.xml b/app/src/main/res/layout/cpp_app_button_paste.xml
deleted file mode 100644
index 718e80dc..00000000
--- a/app/src/main/res/layout/cpp_app_button_paste.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
\ 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 f5d9d2c3..36d755b0 100644
--- a/app/src/main/res/layout/cpp_app_button_right.xml
+++ b/app/src/main/res/layout/cpp_app_button_right.xml
@@ -22,12 +22,12 @@
~ Site: http://se.solovyev.org
-->
-
\ No newline at end of file