Refactor MapView code to be more maintainable. Implement JavaDocs up to rotation.

This commit is contained in:
Leith Bade
2015-10-01 15:53:34 +10:00
parent 9fdc36c1a1
commit 4930a40f1f
8 changed files with 850 additions and 655 deletions

View File

@@ -75,9 +75,14 @@ android.libraryVariants.all { variant ->
destinationDir = new File(destinationDir, variant.baseName)
source = files(variant.javaCompile.source)
classpath = files(variant.javaCompile.classpath.files) + files(android.bootClasspath)
options.windowTitle("Mapbox Android SDK")
options.docTitle("Mapbox Android SDK")
options.header("<b>Mapbox Android SDK</b>")
options.bottom("&copy; 2015 Mapbox. All rights reserved.")
options.links("http://docs.oracle.com/javase/7/docs/api/")
// TODO this will fail as package-list file not online, need to use offline
options.links("http://d.android.com/reference/")
exclude '**/R.html', '**/R.*.html'
// TODO exclude generated R, BuildConfig, com.almeros.*
}
}

View File

@@ -3,6 +3,7 @@ package com.mapbox.mapboxgl.annotations;
import android.graphics.Point;
import android.view.View;
import com.mapbox.mapboxgl.geometry.LatLng;
import com.mapbox.mapboxgl.views.InfoWindow;
import com.mapbox.mapboxgl.views.R;
public class Marker extends Annotation {
@@ -138,6 +139,10 @@ public class Marker extends Annotation {
this.sprite = sprite;
}
public String getSprite() {
return sprite;
}
public void setTitle(String title) {
this.title = title;
}

View File

@@ -1,4 +1,4 @@
package com.mapbox.mapboxgl.annotations;
package com.mapbox.mapboxgl.views;
import android.content.Context;
import android.graphics.PointF;
@@ -7,8 +7,9 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mapbox.mapboxgl.annotations.Marker;
import com.mapbox.mapboxgl.geometry.LatLng;
import com.mapbox.mapboxgl.views.MapView;
/**
* A tooltip view
@@ -85,7 +86,7 @@ public class InfoWindow {
mView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
PointF coords = mMapView.toScreenLocation(position);
double y = mMapView.getTopOffsetPixelsForAnnotationSymbol(object.sprite);
double y = mMapView.getTopOffsetPixelsForAnnotationSymbol(object.getSprite());
y = y * mMapView.getScreenDensity();
// Flip y coordinate as Android view origin is upper left corner

View File

@@ -1,4 +1,4 @@
package com.mapbox.mapboxgl.annotations;
package com.mapbox.mapboxgl.views;
import android.content.Context;
import android.graphics.Canvas;

View File

@@ -0,0 +1,4 @@
/**
* Classes that render a map and the map's UI.
*/
package com.mapbox.mapboxgl.views;

View File

@@ -44,7 +44,7 @@
android:visibility="gone"/>
</LinearLayout>
<com.mapbox.mapboxgl.annotations.InfoWindowTipView
<com.mapbox.mapboxgl.views.InfoWindowTipView
android:layout_width="fill_parent"
android:layout_height="10dp"/>

View File

@@ -5,6 +5,7 @@
<item>&#169; OpenStreetMap</item>
<item>Improve this map</item>
</array>
<!-- If editing this array update MapView.ATTRIBUTION_INDEX_IMPROVE_THIS_MAP -->
<array name="attribution_links" formatted="false" translatable="false">
<item>https://www.mapbox.com/about/maps/</item>
<item>http://www.openstreetmap.org/about/</item>