diff options
Diffstat (limited to 'androidApp/src/main/java/mx')
2 files changed, 22 insertions, 0 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt index 0c3577e..6c15ae4 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt @@ -13,6 +13,7 @@ import androidx.core.widget.TextViewCompat import androidx.fragment.app.Fragment import com.google.android.material.button.MaterialButton import kotlinx.coroutines.DelicateCoroutinesApi +import kotlinx.serialization.json.longOrNull import mx.trackermap.TrackerMap.android.R import mx.trackermap.TrackerMap.android.databinding.UnitDetailsInformationBinding import mx.trackermap.TrackerMap.android.details.UnitDetailsAdapter @@ -94,6 +95,13 @@ class UnitInformationFragment : Fragment() { unit.position?.address?.let { address -> details.add(getString(R.string.unit_info_address) to address) } + unit.position?.attributes?.get("hours")?.longOrNull?.let { + if (it > 0) { + details.add( + getString(R.string.unit_hourmeter) to Formatter.formatHours(it) + ) + } + } unit.position?.protocol?.let { protocol -> details.add(getString(R.string.unit_info_protocol) to protocol) } diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt index beeba6f..c7999de 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt @@ -12,6 +12,7 @@ import android.widget.TextView import androidx.cardview.widget.CardView import androidx.core.content.ContextCompat import com.zerobranch.layout.SwipeLayout +import kotlinx.serialization.json.longOrNull import mx.trackermap.TrackerMap.android.R import mx.trackermap.TrackerMap.android.map.MarkerTransformations import mx.trackermap.TrackerMap.client.models.UnitInformation @@ -128,6 +129,19 @@ class UnitRenderData { ) } + /* Hourmeter */ + position.attributes["hours"]?.longOrNull?.let { + if (it > 0) { + details.add( + Triple( + R.drawable.position_hourmeter, + Formatter.formatHours(it), + context.getString(R.string.unit_hourmeter) + ) + ) + } + } + /* Date time */ position.fixTime?.let { fixTime -> details.add( |