mirror of
https://github.com/ev-map/EVMap.git
synced 2026-04-22 23:29:40 -04:00
display timeRetrieved in detail view if older than 1 hour
This commit is contained in:
committed by
Johan von Forstner
parent
81b4e77a66
commit
463ff61420
@@ -31,6 +31,12 @@
|
||||
|
||||
<import type="net.vonforst.evmap.api.chargeprice.ChargepriceApi" />
|
||||
|
||||
<import type="android.text.format.DateUtils" />
|
||||
|
||||
<import type="java.time.Instant" />
|
||||
|
||||
<import type="java.time.Duration" />
|
||||
|
||||
<variable
|
||||
name="charger"
|
||||
type="Resource<ChargeLocation>" />
|
||||
@@ -99,7 +105,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:colorBackground"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtName"
|
||||
@@ -470,11 +476,27 @@
|
||||
tools:targetApi="o" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtLicense"
|
||||
android:id="@+id/txtTimeRetrieved"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:breakStrategy="balanced"
|
||||
android:text="@{@string/data_retrieved_at(DateUtils.getRelativeTimeSpanString(charger.data.timeRetrieved.toEpochMilli(), Instant.now().toEpochMilli(), 0))}"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
|
||||
android:textStyle="italic"
|
||||
app:goneUnless="@{charger.data.timeRetrieved == null || Duration.between(charger.data.timeRetrieved, Instant.now()).compareTo(Duration.ofHours(1)) > 0}"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sourceButton"
|
||||
tools:text="Data retrieved 4 hours ago" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtLicense"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:breakStrategy="balanced"
|
||||
android:text="@{charger.data.license}"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
|
||||
@@ -482,7 +504,7 @@
|
||||
app:goneUnless="@{charger.data.license != null}"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sourceButton"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtTimeRetrieved"
|
||||
tools:text="The data is provided under the National Oman Open Data LicensE (NOODLE), Version 3.14, and may be used for any purpose whatsoever." />
|
||||
|
||||
<Button
|
||||
|
||||
@@ -319,4 +319,5 @@
|
||||
<string name="pref_map_scale_meters">Meter</string>
|
||||
<string name="pref_map_scale_miles">Meilen</string>
|
||||
<string name="pref_map_scale_off">aus</string>
|
||||
<string name="data_retrieved_at">Daten abgerufen %s</string>
|
||||
</resources>
|
||||
@@ -319,4 +319,5 @@
|
||||
<string name="pref_map_scale_meters">meters</string>
|
||||
<string name="pref_map_scale_miles">miles</string>
|
||||
<string name="pref_map_scale_off">off</string>
|
||||
<string name="data_retrieved_at">Data retrieved %s</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user