[android] Add current speed widget

Signed-off-by: TobiPeterG <codeberg.sadness522@passmail.net>
This commit is contained in:
TobiPeterG
2025-08-04 23:38:43 +02:00
committed by Harry Bond
parent 4bad37a829
commit ea1d0eefa2
8 changed files with 392 additions and 189 deletions

View File

@@ -123,12 +123,24 @@
app:lanesEditModeLanesCount="10"
tools:visibility="visible" />
<app.organicmaps.widget.CurrentSpeedView
android:id="@+id/nav_current_speed"
style="@style/MwmWidget.CurrentSpeed"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="@dimen/margin_half"
app:layout_constraintStart_toEndOf="@id/nav_next_turn_container"
app:layout_constraintTop_toBottomOf="@id/street_frame"/>
<app.organicmaps.widget.SpeedLimitView
android:id="@+id/nav_speed_limit"
style="@style/MwmWidget.SpeedLimit"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="@dimen/margin_half"
app:layout_constraintStart_toEndOf="@id/nav_next_turn_container"
app:layout_constraintTop_toBottomOf="@id/street_frame" />
app:layout_constraintTop_toBottomOf="@id/nav_current_speed"
android:translationY="-21dp"
android:translationX="-12dp"
android:translationZ="1dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -124,13 +124,26 @@
app:lanesEditModeLanesCount="5"
tools:visibility="visible" />
<app.organicmaps.widget.CurrentSpeedView
android:id="@+id/nav_current_speed"
style="@style/MwmWidget.CurrentSpeed"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="@dimen/margin_half"
app:layout_constraintEnd_toEndOf="@id/nav_next_turn_container"
app:layout_constraintStart_toStartOf="@id/nav_next_turn_container"
app:layout_constraintTop_toBottomOf="@id/nav_next_turn_container"/>
<app.organicmaps.widget.SpeedLimitView
android:id="@+id/nav_speed_limit"
style="@style/MwmWidget.SpeedLimit"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="@dimen/margin_half"
app:layout_constraintEnd_toEndOf="@id/nav_next_turn_container"
app:layout_constraintStart_toStartOf="@id/nav_next_turn_container"
app:layout_constraintTop_toBottomOf="@id/nav_next_turn_container" />
app:layout_constraintTop_toBottomOf="@id/nav_current_speed"
android:translationY="-23dp"
android:translationX="-23dp"
android:translationZ="1dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -3,6 +3,8 @@
<declare-styleable name="SpeedLimitView">
<attr name="speedLimitBackgroundColor" format="color" />
<attr name="speedLimitBorderColor" format="color" />
<attr name="speedLimitUnlimitedBorderColor" format="color" />
<attr name="speedLimitUnlimitedStripeColor" format="color" />
<attr name="speedLimitAlertColor" format="color" />
<attr name="speedLimitTextColor" format="color" />
<attr name="speedLimitTextAlertColor" format="color" />
@@ -11,6 +13,14 @@
<attr name="speedLimitEditModeAlert" format="boolean" />
</declare-styleable>
<declare-styleable name="CurrentSpeedView">
<attr name="currentSpeedBackgroundColor" format="color" />
<attr name="currentSpeedBorderColor" format="color" />
<attr name="currentSpeedTextColor" format="color" />
<!-- These values are used only in edit mode -->
<attr name="currentSpeedEditModeCurrentSpeed" format="integer" />
</declare-styleable>
<declare-styleable name="LanesView">
<attr name="lanesActiveLaneTintColor" format="reference" />
<attr name="lanesInactiveLaneTintColor" format="color" />

View File

@@ -10,6 +10,10 @@
<item name="speedLimitBorderColor">@color/base_red</item>
</style>
<style name="MwmWidget.CurrentSpeed">
<item name="speedLimitBorderColor">@color/black_primary</item>
</style>
<style name="MwmWidget.FrameLayout"/>
<style name="MwmWidget.Downloader"/>