fixes for android4
This commit is contained in:
parent
0462b327c9
commit
555b2cdd61
@ -36,6 +36,7 @@ import org.solovyev.android.calculator.math.MathType;
|
|||||||
import org.solovyev.android.calculator.model.CalculatorEngine;
|
import org.solovyev.android.calculator.model.CalculatorEngine;
|
||||||
import org.solovyev.android.view.FontSizeAdjuster;
|
import org.solovyev.android.view.FontSizeAdjuster;
|
||||||
import org.solovyev.android.view.widgets.*;
|
import org.solovyev.android.view.widgets.*;
|
||||||
|
import org.solovyev.android.view.widgets.DragEvent;
|
||||||
import org.solovyev.common.utils.Announcer;
|
import org.solovyev.common.utils.Announcer;
|
||||||
import org.solovyev.common.utils.Point2d;
|
import org.solovyev.common.utils.Point2d;
|
||||||
import org.solovyev.common.utils.StringUtils;
|
import org.solovyev.common.utils.StringUtils;
|
||||||
|
@ -8,6 +8,7 @@ package org.solovyev.android.calculator;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
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.CalculatorEngine;
|
||||||
import org.solovyev.android.calculator.model.CalculatorParseException;
|
import org.solovyev.android.calculator.model.CalculatorParseException;
|
||||||
import org.solovyev.android.calculator.model.TextProcessor;
|
import org.solovyev.android.calculator.model.TextProcessor;
|
||||||
|
import org.solovyev.common.utils.CollectionsUtils;
|
||||||
|
import org.solovyev.common.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
@ -48,12 +51,18 @@ public class CalculatorEditor extends EditText implements SharedPreferences.OnSh
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCheckIsTextEditor() {
|
public boolean onCheckIsTextEditor() {
|
||||||
// fix for missing cursor in android
|
// 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
|
// cannot be applied as in that case soft keyboard appears on application start
|
||||||
//return true;
|
for (StackTraceElement stackTraceElement : CollectionsUtils.asList(Thread.currentThread().getStackTrace())) {
|
||||||
//} else {
|
if ( "isCursorVisible".equals(stackTraceElement.getMethodName()) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
//}
|
//return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,7 +22,7 @@ public class DragButton extends ColorButton {
|
|||||||
private Point2d startPoint = null;
|
private Point2d startPoint = null;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private OnDragListener onDragListener;
|
private org.solovyev.android.view.widgets.OnDragListener onDragListener;
|
||||||
|
|
||||||
private final OnTouchListener onTouchListener = new OnTouchListenerImpl();
|
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;
|
this.onDragListener = onDragListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public OnDragListener getOnDragListener() {
|
public org.solovyev.android.view.widgets.OnDragListener getOnDragListener() {
|
||||||
return onDragListener;
|
return onDragListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public class DragButton extends ColorButton {
|
|||||||
|
|
||||||
// in order to avoid possible NPEs
|
// in order to avoid possible NPEs
|
||||||
final Point2d localStartPoint = startPoint;
|
final Point2d localStartPoint = startPoint;
|
||||||
final OnDragListener localOnDragListener = onDragListener;
|
final org.solovyev.android.view.widgets.OnDragListener localOnDragListener = onDragListener;
|
||||||
|
|
||||||
if (localOnDragListener != null) {
|
if (localOnDragListener != null) {
|
||||||
// only if onDrag() listener specified
|
// only if onDrag() listener specified
|
||||||
|
Loading…
Reference in New Issue
Block a user