fixes for android4

This commit is contained in:
Sergey Solovyev 2011-12-26 15:47:56 +04:00
parent 0462b327c9
commit 555b2cdd61
3 changed files with 18 additions and 8 deletions

View File

@ -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;

View File

@ -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

View File

@ -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