From 4435ec4267f5af8a38e37be057ef97e884becea0 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Mon, 18 Mar 2024 16:03:53 +0100 Subject: [PATCH] Lint --- .../screens/user/achievements/AchievementsFragment.kt | 5 +++-- .../screens/user/achievements/AchievementsViewModelImpl.kt | 4 +--- .../streetcomplete/screens/user/links/LinksFragment.kt | 6 +++--- .../streetcomplete/screens/user/links/LinksViewModelImpl.kt | 2 +- .../streetcomplete/screens/user/login/LoginViewModel.kt | 1 - 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/de/westnordost/streetcomplete/screens/user/achievements/AchievementsFragment.kt b/app/src/main/java/de/westnordost/streetcomplete/screens/user/achievements/AchievementsFragment.kt index ccb33f406f..d54db67713 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/screens/user/achievements/AchievementsFragment.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/screens/user/achievements/AchievementsFragment.kt @@ -44,10 +44,11 @@ class AchievementsFragment : Fragment(R.layout.fragment_achievements) { observe(viewModel.isSynchronizingStatistics) { isSynchronizingStatistics -> binding.emptyText.setText( - if (isSynchronizingStatistics) + if (isSynchronizingStatistics) { R.string.stats_are_syncing - else + } else { R.string.links_empty + } ) } diff --git a/app/src/main/java/de/westnordost/streetcomplete/screens/user/achievements/AchievementsViewModelImpl.kt b/app/src/main/java/de/westnordost/streetcomplete/screens/user/achievements/AchievementsViewModelImpl.kt index f4b7aa2f68..705f2e8813 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/screens/user/achievements/AchievementsViewModelImpl.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/screens/user/achievements/AchievementsViewModelImpl.kt @@ -10,15 +10,13 @@ import kotlinx.coroutines.flow.MutableStateFlow class AchievementsViewModelImpl( private val achievementsSource: AchievementsSource, private val statisticsSource: StatisticsSource, -): AchievementsViewModel() { +) : AchievementsViewModel() { override val isSynchronizingStatistics = MutableStateFlow(statisticsSource.isSynchronizing) override val achievements = MutableStateFlow>?>(null) - init { launch(Dispatchers.IO) { achievements.value = achievementsSource.getAchievements() } } } - diff --git a/app/src/main/java/de/westnordost/streetcomplete/screens/user/links/LinksFragment.kt b/app/src/main/java/de/westnordost/streetcomplete/screens/user/links/LinksFragment.kt index 1c80fcf686..f0f6df3cbf 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/screens/user/links/LinksFragment.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/screens/user/links/LinksFragment.kt @@ -13,7 +13,6 @@ import de.westnordost.streetcomplete.util.ktx.awaitLayout import de.westnordost.streetcomplete.util.ktx.dpToPx import de.westnordost.streetcomplete.util.ktx.observe import de.westnordost.streetcomplete.util.ktx.openUri -import de.westnordost.streetcomplete.util.ktx.pxToDp import de.westnordost.streetcomplete.util.viewBinding import de.westnordost.streetcomplete.view.GridLayoutSpacingItemDecoration import kotlinx.coroutines.launch @@ -32,10 +31,11 @@ class LinksFragment : Fragment(R.layout.fragment_links) { observe(viewModel.isSynchronizingStatistics) { isSynchronizingStatistics -> binding.emptyText.setText( - if (isSynchronizingStatistics) + if (isSynchronizingStatistics) { R.string.stats_are_syncing - else + } else { R.string.links_empty + } ) } diff --git a/app/src/main/java/de/westnordost/streetcomplete/screens/user/links/LinksViewModelImpl.kt b/app/src/main/java/de/westnordost/streetcomplete/screens/user/links/LinksViewModelImpl.kt index 4a3fdc79de..65b83107a8 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/screens/user/links/LinksViewModelImpl.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/screens/user/links/LinksViewModelImpl.kt @@ -10,7 +10,7 @@ import kotlinx.coroutines.flow.MutableStateFlow class LinksViewModelImpl( private val achievementsSource: AchievementsSource, private val statisticsSource: StatisticsSource, -): LinksViewModel() { +) : LinksViewModel() { override val isSynchronizingStatistics = MutableStateFlow(statisticsSource.isSynchronizing) override val links = MutableStateFlow?>(null) diff --git a/app/src/main/java/de/westnordost/streetcomplete/screens/user/login/LoginViewModel.kt b/app/src/main/java/de/westnordost/streetcomplete/screens/user/login/LoginViewModel.kt index e33f777148..b5c7139705 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/screens/user/login/LoginViewModel.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/screens/user/login/LoginViewModel.kt @@ -35,4 +35,3 @@ enum class LoginError : LoginState { CommunicationError } data object LoggedIn : LoginState -