aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt16
-rw-r--r--androidApp/src/main/res/layout/unit_map_fragment.xml5
2 files changed, 11 insertions, 10 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt
index 4298058..a8eb2fa 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt
@@ -78,10 +78,9 @@ class MapFragment : GlobeMapFragment() {
val loader = QuadImageLoader(params, tileInfo, baseControl)
loader.setImageFormat(RenderController.ImageFormat.MaplyImageUShort565)
- val latitude = 23.191 * Math.PI / 180
- val longitude = -100.36 * Math.PI / 180
- val zoom = 0.4
- mapControl.setPositionGeo(longitude, latitude, zoom)
+ val latitude = 23.191
+ val longitude = -100.36
+ focusOn(latitude, longitude, zoom = 0.4, animated = false)
}
override fun userDidSelect(
@@ -140,11 +139,14 @@ class MapFragment : GlobeMapFragment() {
)
}
- fun focusOn(latitude: Double, longitude: Double) {
+ fun focusOn(latitude: Double, longitude: Double, zoom: Double = 0.000008, animated: Boolean = true) {
val lat = latitude * Math.PI / 180
val lon = longitude * Math.PI / 180
- val zoom = 0.000008
- mapControl.setPositionGeo(lon, lat, zoom)
+ if (animated) {
+ mapControl.animatePositionGeo(lon, lat, zoom, 0.5)
+ } else {
+ mapControl.setPositionGeo(lon, lat, zoom)
+ }
}
private fun getIcon(markerType: MarkerType): Bitmap {
diff --git a/androidApp/src/main/res/layout/unit_map_fragment.xml b/androidApp/src/main/res/layout/unit_map_fragment.xml
index 763c7c9..f476c66 100644
--- a/androidApp/src/main/res/layout/unit_map_fragment.xml
+++ b/androidApp/src/main/res/layout/unit_map_fragment.xml
@@ -26,9 +26,7 @@
app:cardUseCompatPadding="true"
app:cardElevation="@dimen/card_elevation"
app:cardCornerRadius="@dimen/card_border_radius"
- app:contentPaddingTop="@dimen/card_padding"
- app:contentPaddingLeft="@dimen/card_padding"
- app:contentPaddingRight="@dimen/card_padding"
+ app:contentPadding="@dimen/card_padding"
android:visibility="gone">
<RelativeLayout
@@ -156,6 +154,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/gridLayout"
+ android:layout_marginTop="@dimen/padding"
android:gravity="center"
android:orientation="horizontal"
android:visibility="visible">