Skip to content

Commit

Permalink
fix: some minor fixes for easier customization (#359)
Browse files Browse the repository at this point in the history
* fix: some minor fixes for easier customization

* Apply automatic changes

* fix: some minor fixes for easier customization

* Apply automatic changes

* fix: some minor fixes for easier customization

---------

Co-authored-by: Archdoog <[email protected]>
  • Loading branch information
Archdoog and Archdoog authored Nov 14, 2024
1 parent 12a6f19 commit c3350fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.stadiamaps.ferrostar.composeui.formatting

import android.icu.util.ULocale
import java.time.format.FormatStyle
import java.util.Locale
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.toJavaLocalDateTime
Expand All @@ -11,12 +12,11 @@ interface DateTimeFormatter {

class EstimatedArrivalDateTimeFormatter(
private var localeOverride: ULocale? = null,
private val unitStyle: FormatStyle = FormatStyle.SHORT
) : DateTimeFormatter {
override fun format(dateTime: LocalDateTime): String {
val locale = localeOverride?.let { Locale(it.language, it.country) } ?: Locale.getDefault()
val formatter =
java.time.format.DateTimeFormatter.ofLocalizedTime(java.time.format.FormatStyle.SHORT)
.withLocale(locale)
val formatter = java.time.format.DateTimeFormatter.ofLocalizedTime(unitStyle).withLocale(locale)
return formatter.format(dateTime.toJavaLocalDateTime())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ interface NavigationViewModel {
* interface that is reused across navigation sessions will probably need to craft their own view
* model.
*/
class DefaultNavigationViewModel(
open class DefaultNavigationViewModel(
private val ferrostarCore: FerrostarCore,
private val annotationPublisher: AnnotationPublisher<*> = NoOpAnnotationPublisher()
) : ViewModel(), NavigationViewModel {
Expand Down

0 comments on commit c3350fe

Please sign in to comment.