diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java index 038ab4f1..454c167c 100644 --- a/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java +++ b/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java @@ -36,6 +36,7 @@ import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.model.CalculatorEngine; import org.solovyev.android.view.FontSizeAdjuster; import org.solovyev.android.view.widgets.*; +import org.solovyev.android.view.widgets.DragEvent; import org.solovyev.common.utils.Announcer; import org.solovyev.common.utils.Point2d; import org.solovyev.common.utils.StringUtils; diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorEditor.java b/src/main/java/org/solovyev/android/calculator/CalculatorEditor.java index a6e9c328..22126f0d 100644 --- a/src/main/java/org/solovyev/android/calculator/CalculatorEditor.java +++ b/src/main/java/org/solovyev/android/calculator/CalculatorEditor.java @@ -8,6 +8,7 @@ package org.solovyev.android.calculator; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Color; +import android.os.Build; import android.text.Html; import android.util.AttributeSet; import android.util.Log; @@ -17,6 +18,8 @@ import org.jetbrains.annotations.NotNull; import org.solovyev.android.calculator.model.CalculatorEngine; import org.solovyev.android.calculator.model.CalculatorParseException; import org.solovyev.android.calculator.model.TextProcessor; +import org.solovyev.common.utils.CollectionsUtils; +import org.solovyev.common.utils.StringUtils; /** * User: serso @@ -48,12 +51,18 @@ public class CalculatorEditor extends EditText implements SharedPreferences.OnSh @Override public boolean onCheckIsTextEditor() { // fix for missing cursor in android - //if ( Build.VERSION.SDK_INT >= 11 ) { + if ( Build.VERSION.SDK_INT >= 11 ) { // cannot be applied as in that case soft keyboard appears on application start + for (StackTraceElement stackTraceElement : CollectionsUtils.asList(Thread.currentThread().getStackTrace())) { + if ( "isCursorVisible".equals(stackTraceElement.getMethodName()) ) { + return true; + } + } + return false; //return true; - //} else { - return false; - //} + } else { + return false; + } } @Override diff --git a/src/main/java/org/solovyev/android/view/widgets/DragButton.java b/src/main/java/org/solovyev/android/view/widgets/DragButton.java index 66de089a..54d8622a 100644 --- a/src/main/java/org/solovyev/android/view/widgets/DragButton.java +++ b/src/main/java/org/solovyev/android/view/widgets/DragButton.java @@ -22,7 +22,7 @@ public class DragButton extends ColorButton { private Point2d startPoint = null; @Nullable - private OnDragListener onDragListener; + private org.solovyev.android.view.widgets.OnDragListener onDragListener; private final OnTouchListener onTouchListener = new OnTouchListenerImpl(); @@ -38,12 +38,12 @@ public class DragButton extends ColorButton { } } - public void setOnDragListener(@Nullable OnDragListener onDragListener) { + public void setOnDragListener(@Nullable org.solovyev.android.view.widgets.OnDragListener onDragListener) { this.onDragListener = onDragListener; } @Nullable - public OnDragListener getOnDragListener() { + public org.solovyev.android.view.widgets.OnDragListener getOnDragListener() { return onDragListener; } @@ -61,7 +61,7 @@ public class DragButton extends ColorButton { // in order to avoid possible NPEs final Point2d localStartPoint = startPoint; - final OnDragListener localOnDragListener = onDragListener; + final org.solovyev.android.view.widgets.OnDragListener localOnDragListener = onDragListener; if (localOnDragListener != null) { // only if onDrag() listener specified