Merge pull request #1028 from Bars107/master

Bugfix for direction drawable and test for buggy geo intent.
This commit is contained in:
Alexey Pelykh 2014-12-29 18:41:45 +02:00
commit 6627a4d2b5
2 changed files with 13 additions and 4 deletions

View file

@ -97,6 +97,17 @@ public class GeoPointParserUtil {
actual = GeoPointParserUtil.parse("geo", url); actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(qstr)); assertGeoPoint(actual, new GeoParsedPoint(qstr));
// geo:50.451300,30.569900?z=15&q=50.451300,30.569900 (Kiev)
z = 15;
String qname = "Kiev";
double qlat = 50.4513;
double qlon = 30.5699;
url = "geo:50.451300,30.569900?z=15&q=50.451300,30.569900 (Kiev)";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(qlat, qlon, z, qname));
// http://download.osmand.net/go?lat=34&lon=-106&z=11 // http://download.osmand.net/go?lat=34&lon=-106&z=11
url = "http://download.osmand.net/go?lat=" + ilat + "&lon=" + ilon + "&z=" + z; url = "http://download.osmand.net/go?lat=" + ilat + "&lon=" + ilon + "&z=" + z;
System.out.println("url: " + url); System.out.println("url: " + url);
@ -335,7 +346,7 @@ public class GeoPointParserUtil {
* *
* @param scheme * @param scheme
* The intent scheme * The intent scheme
* @param data * @param uri
* The URI object * The URI object
* @return {@link GeoParsedPoint} * @return {@link GeoParsedPoint}
*/ */

View file

@ -47,17 +47,15 @@ public class DirectionDrawable extends Drawable {
@Override @Override
public void draw(Canvas canvas) { public void draw(Canvas canvas) {
if (favorite) { if (favorite) {
canvas.rotate(angle, canvas.getHeight()/2, canvas.getWidth()/2); canvas.rotate(angle, canvas.getHeight()/2, canvas.getWidth()/2);
Bitmap arrow = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.ic_destination_arrow); Bitmap arrow = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.ic_destination_arrow);
canvas.drawBitmap(arrow, null, new Rect(0,0,arrow.getHeight(), arrow.getWidth()), null); canvas.drawBitmap(arrow, null, new Rect(0,0,arrow.getHeight(), arrow.getWidth()), null);
} else { } else {
canvas.rotate(angle, width / 2, height / 2); canvas.rotate(angle, canvas.getHeight()/2, canvas.getWidth() / 2);
Path directionPath = createDirectionPath(); Path directionPath = createDirectionPath();
canvas.drawPath(directionPath, paintRouteDirection); canvas.drawPath(directionPath, paintRouteDirection);
} }
} }
@Override @Override