From b9a9eeeb9f104b6fe11a5bc523cad189b293160c Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Wed, 12 Jan 2022 17:36:31 -0600 Subject: Improved reports design --- .../TrackerMap/android/map/MapFragment.kt | 22 +++++++++++++++------- androidApp/src/main/res/values/colors.xml | 3 +++ 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'androidApp/src/main') 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 9bda9d4..1b736d1 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 @@ -7,6 +7,7 @@ import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.core.content.ContextCompat import androidx.core.content.res.ResourcesCompat import androidx.core.graphics.drawable.toBitmap import com.mousebird.maply.* @@ -126,24 +127,29 @@ class MapFragment : GlobeMapFragment() { }.toTypedArray() val vectorInfo = VectorInfo() - vectorInfo.setColor(Color.GREEN) + vectorInfo.setColor(ContextCompat.getColor(context!!, R.color.colorReport)) vectorInfo.setLineWidth(20.0f) /* Draw markers for positions */ val screenMarkers = markers.mapIndexed { i, marker -> val screenMarker = ScreenMarker() - val markerSize = Point2d(144.0, 144.0) - screenMarker.loc = Point2d.FromDegrees(marker.longitude, marker.latitude) screenMarker.image = if (isReport) { - // For reports, position, start and end markers must be shown differently + // For reports, position, start and end, icons must be different when (i) { 0 -> getIcon(MarkerType.REPORT_START) markers.size - 1 -> getIcon(MarkerType.REPORT_END) else -> getIcon(MarkerType.REPORT_POSITION) } } else getIcon(marker.type) - screenMarker.size = markerSize + screenMarker.size = if (isReport) { + // For reports, position, start and end, size must be different + when (i) { + 0 -> Point2d(144.0, 144.0) + markers.size - 1 -> Point2d(144.0, 144.0) + else -> Point2d(82.0, 82.0) + } + } else Point2d(144.0, 144.0) screenMarker.userObject = marker.id screenMarker.selectable = true if (!isReport) { @@ -196,12 +202,14 @@ class MapFragment : GlobeMapFragment() { clear(true) + val color = ContextCompat.getColor(context!!, R.color.colorGeofence) + val vectorInfo = VectorInfo() - vectorInfo.setColor(Color.BLUE) + vectorInfo.setColor(color) vectorInfo.setLineWidth(10.0f) val labelInfo = LabelInfo() - labelInfo.textColor = Color.BLUE + labelInfo.textColor = color val shapes = mutableListOf() val vectors = mutableListOf() diff --git a/androidApp/src/main/res/values/colors.xml b/androidApp/src/main/res/values/colors.xml index 0ebcff7..ee5d167 100644 --- a/androidApp/src/main/res/values/colors.xml +++ b/androidApp/src/main/res/values/colors.xml @@ -6,6 +6,9 @@ #FDFDFD #ECEFF3 + #1976D2 + #388E3C + #388E3C #D32F2F \ No newline at end of file -- cgit v1.2.3