Disabled special accessibility tricks for map exploration by touch on

Android 4.0 or higher. Here these capabilities should be implemented
in some other way.
This commit is contained in:
Igor B. Poretsky 2013-03-01 05:13:50 +04:00
parent b3e12061e0
commit c9d52283e3
3 changed files with 12 additions and 9 deletions

View file

@ -107,13 +107,14 @@ public class AccessibilityPlugin extends OsmandPlugin {
cat.addPreference(activity.createCheckBoxPreference(settings.ZOOM_BY_TRACKBALL, R.string.zoom_by_trackball,
R.string.zoom_by_trackball_descr));
cat.addPreference(activity.createCheckBoxPreference(settings.SCROLL_MAP_BY_GESTURES, R.string.scroll_map_by_gestures,
R.string.scroll_map_by_gestures_descr));
cat.addPreference(activity.createCheckBoxPreference(settings.USE_SHORT_OBJECT_NAMES, R.string.use_short_object_names,
R.string.use_short_object_names_descr));
if (Build.VERSION.SDK_INT < 14) // Build.VERSION_CODES.ICE_CREAM_SANDWICH
if (Build.VERSION.SDK_INT < 14) { // Build.VERSION_CODES.ICE_CREAM_SANDWICH
cat.addPreference(activity.createCheckBoxPreference(settings.SCROLL_MAP_BY_GESTURES, R.string.scroll_map_by_gestures,
R.string.scroll_map_by_gestures_descr));
cat.addPreference(activity.createCheckBoxPreference(settings.ACCESSIBILITY_EXTENSIONS, R.string.accessibility_extensions,
R.string.accessibility_extensions));
}
}

View file

@ -13,6 +13,7 @@ import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView;
import android.content.Context;
import android.graphics.PointF;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
@ -89,7 +90,7 @@ public class MapExplorer implements OnGestureListener, IContextMenuProvider {
@Override
public boolean onDown(MotionEvent e) {
if (mapView.getSettings().SCROLL_MAP_BY_GESTURES.get())
if ((Build.VERSION.SDK_INT >= 14) || mapView.getSettings().SCROLL_MAP_BY_GESTURES.get())
return fallback.onDown(e);
ContextMenuLayer contextMenuLayer = mapView.getLayerByClass(ContextMenuLayer.class);
if (contextMenuLayer != null)
@ -101,7 +102,7 @@ public class MapExplorer implements OnGestureListener, IContextMenuProvider {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if (mapView.getSettings().SCROLL_MAP_BY_GESTURES.get())
if ((Build.VERSION.SDK_INT >= 14) || mapView.getSettings().SCROLL_MAP_BY_GESTURES.get())
return fallback.onFling(e1, e2, velocityX, velocityY);
return true;
}
@ -113,7 +114,7 @@ public class MapExplorer implements OnGestureListener, IContextMenuProvider {
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
if (mapView.getSettings().SCROLL_MAP_BY_GESTURES.get()) {
if ((Build.VERSION.SDK_INT >= 14) || mapView.getSettings().SCROLL_MAP_BY_GESTURES.get()) {
return fallback.onScroll(e1, e2, distanceX, distanceY);
} else {
describePointedObjects(e2);
@ -123,7 +124,7 @@ public class MapExplorer implements OnGestureListener, IContextMenuProvider {
@Override
public void onShowPress(MotionEvent e) {
if (mapView.getSettings().SCROLL_MAP_BY_GESTURES.get())
if ((Build.VERSION.SDK_INT >= 14) || mapView.getSettings().SCROLL_MAP_BY_GESTURES.get())
fallback.onShowPress(e);
}

View file

@ -22,6 +22,7 @@ import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.MotionEvent;
@ -194,7 +195,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
@Override
public boolean onLongPressEvent(PointF point) {
if (!view.getSettings().SCROLL_MAP_BY_GESTURES.get()) {
if ((Build.VERSION.SDK_INT < 14) && !view.getSettings().SCROLL_MAP_BY_GESTURES.get()) {
if (!selectedObjects.isEmpty())
view.showMessage(activity.getNavigationHint(latLon));
return true;
@ -289,7 +290,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
@Override
public boolean onSingleTap(PointF point) {
boolean nativeMode = view.getSettings().SCROLL_MAP_BY_GESTURES.get();
boolean nativeMode = (Build.VERSION.SDK_INT >= 14) || view.getSettings().SCROLL_MAP_BY_GESTURES.get();
int val = pressedInTextView(point.x, point.y);
if (val == 2) {
setLocation(null, ""); //$NON-NLS-1$