This commit is contained in:
Alexey Kulish 2016-01-21 18:07:14 +03:00
commit 33e5f4748d
4 changed files with 59 additions and 30 deletions

View file

@ -780,7 +780,7 @@ public class BinaryInspector {
final MapStats mapObjectStats = new MapStats();
if(vInfo.osm){
printToFile("<?xml version='1.0' encoding='UTF-8'?>\n" +
"<osm version='0.5'>\n");
"<osm version='0.6'>\n");
}
if(vInfo.isVStats()) {
BinaryMapIndexReader.READ_STATS = true;
@ -952,7 +952,7 @@ public class BinaryInspector {
if(point) {
float lon= (float) MapUtils.get31LongitudeX(obj.getPoint31XTile(0));
float lat = (float) MapUtils.get31LatitudeY(obj.getPoint31YTile(0));
b.append("<node id = '" + OSM_ID++ + "' lat='" +lat+"' lon='"+lon+"' >\n" );
b.append("<node id = '" + OSM_ID++ + "' version='1' lat='" +lat+"' lon='"+lon+"' >\n" );
b.append(tags);
b.append("</node>\n");
} else {
@ -962,7 +962,7 @@ public class BinaryInspector {
float lon = (float) MapUtils.get31LongitudeX(obj.getPoint31XTile(i));
float lat = (float) MapUtils.get31LatitudeY(obj.getPoint31YTile(i));
int id = OSM_ID++;
b.append("\t<node id = '" + id + "' lat='" +lat+"' lon='"+lon+"' />\n" );
b.append("\t<node id = '" + id + "' version='1' lat='" +lat+"' lon='"+lon+"' />\n" );
ids.add(id);
}
long outerId = printWay(ids, b, multipolygon ? null : tags);
@ -974,13 +974,13 @@ public class BinaryInspector {
float lon = (float) MapUtils.get31LongitudeX(polygonInnerCoordinates[j][i]);
float lat = (float) MapUtils.get31LatitudeY(polygonInnerCoordinates[j][i + 1]);
int id = OSM_ID++;
b.append("<node id = '" + id + "' lat='" + lat + "' lon='" + lon + "' />\n");
b.append("<node id = '" + id + "' version='1' lat='" + lat + "' lon='" + lon + "' />\n");
ids.add(id);
}
innerIds.add(printWay(ids, b, null));
}
int id = OSM_ID++;
b.append("<relation id = '" + id + "'>\n" );
b.append("<relation id = '" + id + "' version='1'>\n" );
b.append(tags);
b.append("\t<member type='way' role='outer' ref= '" + outerId + "'/>\n" );
TLongIterator it = innerIds.iterator();
@ -995,7 +995,7 @@ public class BinaryInspector {
private long printWay(TLongArrayList ids, StringBuilder b , StringBuilder tags){
int id = OSM_ID++;
b.append("<way id = '" + id + "'>\n" );
b.append("<way id = '" + id + "' version='1'>\n" );
if(tags != null) {
b.append(tags);
}

View file

@ -119,6 +119,10 @@ public class PerformLiveUpdateAsyncTask
}
}
}
} else {
if (context instanceof DownloadIndexesThread.DownloadEvents) {
((DownloadIndexesThread.DownloadEvents) context).downloadInProgress();
}
}
}
}

View file

@ -153,7 +153,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements SearchSelecti
for (WorldRegion group : groups) {
String name = getHumanReadableName(group);
regionNames.add(name);
queryRegionNames.put(name, group.getRegionDownloadName());
queryRegionNames.put(name, group == root ? "" : group.getRegionDownloadName());
}
}

View file

@ -13,21 +13,26 @@ import org.apache.commons.logging.Log;
public class DoubleTapScaleDetector {
private static final Log LOG = PlatformUtil.getLog(DoubleTapScaleDetector.class);
private static final int DOUBLE_TAPPING_DELTA = ViewConfiguration.getTapTimeout() + 100;
private static final int DOUBLE_TAP_TIMEOUT = ViewConfiguration.getDoubleTapTimeout();
private static final int DOUBLE_TAP_MIN_TIME = 40;
private static final int DP_PER_1X = 200;
private final DoubleTapZoomListener listener;
protected final Context ctx;
private long startTime = 0;
private boolean isDoubleTapping = false;
private float startX;
private float startY;
private float scale;
private MotionEvent firstDown;
private MotionEvent firstUp;
private int mDoubleTapSlopSquare;
public DoubleTapScaleDetector(Context ctx, DoubleTapZoomListener listener) {
this.ctx = ctx;
this.listener = listener;
final ViewConfiguration configuration = ViewConfiguration.get(ctx);
int doubleTapSlop = configuration.getScaledTouchSlop();
mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
public boolean onTouchEvent(MotionEvent event) {
@ -41,26 +46,28 @@ public class DoubleTapScaleDetector {
listener.onZoomEnded(scale, 0);
return true;
} else {
startTime = currentTime;
return true;
firstUp = MotionEvent.obtain(event);
}
} else if (event.getAction() == MotionEvent.ACTION_DOWN && !isDoubleTapping
&& currentTime - startTime < DOUBLE_TAPPING_DELTA) {
isDoubleTapping = true;
startX = event.getX();
startY = event.getY();
listener.onGestureInit(startX, startY, startX, startY);
listener.onZoomStarted(new PointF(startX, startY));
return true;
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
if (isDoubleTapping) {
float delta = convertPxToDp((int) (startY - event.getY()));
float scaleDelta = delta / DP_PER_1X;
scale = 1 - scaleDelta;
listener.onZoomingOrRotating(scale, 0);
return true;
} else {
return false;
} else {
if (event.getAction() == MotionEvent.ACTION_DOWN && !isDoubleTapping) {
if (isConsideredDoubleTap(firstDown, firstUp, event)) {
isDoubleTapping = true;
float x = event.getX();
float y = event.getY();
listener.onGestureInit(x, y, x, y);
listener.onZoomStarted(new PointF(x, y));
return true;
} else {
firstDown = MotionEvent.obtain(event);
}
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
if (isDoubleTapping) {
float delta = convertPxToDp((int) (firstDown.getY() - event.getY()));
float scaleDelta = delta / DP_PER_1X;
scale = 1 - scaleDelta;
listener.onZoomingOrRotating(scale, 0);
return true;
}
}
}
return false;
@ -74,6 +81,24 @@ public class DoubleTapScaleDetector {
return Math.round(px / (Resources.getSystem().getDisplayMetrics().xdpi / DisplayMetrics.DENSITY_DEFAULT));
}
private final boolean isConsideredDoubleTap(MotionEvent firstDown,
MotionEvent firstUp,
MotionEvent secondDown) {
if (firstDown == null || firstUp == null || secondDown == null) {
return false;
}
final long deltaTime = secondDown.getEventTime() - firstUp.getEventTime();
if (deltaTime > DOUBLE_TAP_TIMEOUT || deltaTime < DOUBLE_TAP_MIN_TIME) {
return false;
}
int deltaX = (int) firstDown.getX() - (int) secondDown.getX();
int deltaY = (int) firstDown.getY() - (int) secondDown.getY();
int squared = deltaX * deltaX + deltaY * deltaY;
boolean toReturn = squared < mDoubleTapSlopSquare;
return toReturn;
}
public interface DoubleTapZoomListener {
public void onZoomStarted(PointF centerPoint);