Fix small issues for accessibility
This commit is contained in:
parent
a0148658f5
commit
403d5c31b5
6 changed files with 31 additions and 17 deletions
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="access_mark_final_location_first">Accessibility mode : please select destination first</string>
|
||||
<string name="use_magnetic_sensor_descr">Use magnetic sensor to determine compass value instead of orientation sensor</string>
|
||||
<string name="use_magnetic_sensor">Use magnetic sensor (compass)</string>
|
||||
<string name="other_location">Other</string>
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package net.osmand.access;
|
||||
|
||||
import android.graphics.PointF;
|
||||
|
||||
// This interface is intended for defining prioritized actions
|
||||
// to be performed in touch exploration mode. Implementations
|
||||
// should do nothing and return false when accessibility is disabled.
|
||||
public interface AccessibilityActionsProvider {
|
||||
public boolean onClick();
|
||||
public boolean onLongClick();
|
||||
public boolean onClick(PointF point);
|
||||
public boolean onLongClick(PointF point);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package net.osmand.access;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import android.graphics.PointF;
|
||||
import android.os.Build;
|
||||
|
||||
// Accessibility actions for map view.
|
||||
|
@ -14,19 +16,21 @@ public class MapAccessibilityActions implements AccessibilityActionsProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onClick() {
|
||||
public boolean onClick(PointF point) {
|
||||
if ((Build.VERSION.SDK_INT >= 14) && activity.getMyApplication().getInternalAPI().accessibilityEnabled()) {
|
||||
activity.getMyApplication().getLocationProvider().emitNavigationHint();
|
||||
return true;
|
||||
// not sure if it is very clear why should I mark destination first when I tap on the object
|
||||
return activity.getMyApplication().getLocationProvider().emitNavigationHint();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick() {
|
||||
public boolean onLongClick(PointF point) {
|
||||
if ((Build.VERSION.SDK_INT >= 14) && activity.getMyApplication().getInternalAPI().accessibilityEnabled()) {
|
||||
final OsmandMapTileView mapView = activity.getMapView();
|
||||
activity.getMapActions().contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
|
||||
LatLon pressedLoc = mapView.getLatLonFromScreenPoint(point.x, point.y);
|
||||
activity.getMapActions().contextMenuPoint(pressedLoc.getLatitude(), pressedLoc.getLongitude());
|
||||
// activity.getMapActions().contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -10,7 +10,6 @@ import net.osmand.PlatformUtil;
|
|||
import net.osmand.access.NavigationInfo;
|
||||
import net.osmand.binary.RouteDataObject;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
@ -602,7 +601,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
|||
return hint;
|
||||
}
|
||||
|
||||
public void emitNavigationHint() {
|
||||
public boolean emitNavigationHint() {
|
||||
final LatLon point = app.getTargetPointsHelper().getPointToNavigate();
|
||||
if (point != null) {
|
||||
if (app.getRoutingHelper().isRouteCalculated()) {
|
||||
|
@ -610,8 +609,10 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
|||
} else {
|
||||
app.showToastMessage(getNavigationHint(point));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
app.showToastMessage(R.string.mark_final_location_first);
|
||||
app.showToastMessage(R.string.access_mark_final_location_first);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,11 @@ import java.util.List;
|
|||
|
||||
import net.osmand.NativeLibrary;
|
||||
import net.osmand.ResultMatcher;
|
||||
import net.osmand.access.AccessibilityPlugin;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.plus.NavigationService;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.PoiFilter;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.access.AccessibilityMode;
|
||||
|
@ -66,10 +68,14 @@ public class InternalOsmAndAPIImpl implements InternalOsmAndAPI {
|
|||
@Override
|
||||
public boolean accessibilityEnabled() {
|
||||
final AccessibilityMode mode = app.getSettings().ACCESSIBILITY_MODE.get();
|
||||
if (mode == AccessibilityMode.ON)
|
||||
return true;
|
||||
else if (mode == AccessibilityMode.OFF)
|
||||
if(OsmandPlugin.getEnabledPlugin(AccessibilityPlugin.class) == null) {
|
||||
return false;
|
||||
}
|
||||
if (mode == AccessibilityMode.ON) {
|
||||
return true;
|
||||
} else if (mode == AccessibilityMode.OFF) {
|
||||
return false;
|
||||
}
|
||||
return ((AccessibilityManager) app.getSystemService(Context.ACCESSIBILITY_SERVICE)).isEnabled();
|
||||
}
|
||||
|
||||
|
|
|
@ -879,10 +879,10 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
if (log.isDebugEnabled()) {
|
||||
log.debug("On long click event " + e.getX() + " " + e.getY()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
if ((accessibilityActions != null) && accessibilityActions.onLongClick()) {
|
||||
PointF point = new PointF(e.getX(), e.getY());
|
||||
if ((accessibilityActions != null) && accessibilityActions.onLongClick(point)) {
|
||||
return;
|
||||
}
|
||||
PointF point = new PointF(e.getX(), e.getY());
|
||||
for (int i = layers.size() - 1; i >= 0; i--) {
|
||||
if (layers.get(i).onLongPressEvent(point)) {
|
||||
return;
|
||||
|
@ -909,7 +909,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
if (log.isDebugEnabled()) {
|
||||
log.debug("On click event " + point.x + " " + point.y); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
if ((accessibilityActions != null) && accessibilityActions.onClick()) {
|
||||
if ((accessibilityActions != null) && accessibilityActions.onClick(point)) {
|
||||
return true;
|
||||
}
|
||||
for (int i = layers.size() - 1; i >= 0; i--) {
|
||||
|
|
Loading…
Reference in a new issue