aboutsummaryrefslogtreecommitdiff
path: root/androidApp
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-04 23:15:54 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-04 23:15:54 -0600
commit08863d4c9336d7d8a795124fefcf0efa9c23cb30 (patch)
tree3ce3876a07541e9dca460f0094a824faa89c638d /androidApp
parent956ae12a22a5d4895ec7bbca5c35a98a66acbe61 (diff)
downloadetbsa-trackermap-mobile-08863d4c9336d7d8a795124fefcf0efa9c23cb30.tar.gz
etbsa-trackermap-mobile-08863d4c9336d7d8a795124fefcf0efa9c23cb30.tar.bz2
etbsa-trackermap-mobile-08863d4c9336d7d8a795124fefcf0efa9c23cb30.zip
Animated marker centering and small UI tweak
Diffstat (limited to 'androidApp')
-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 0b0dcbc..35643eb 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">