mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-13 22:57:20 +01:00
Performance: Avoids creating a SharedSettings ViewModel on Galery
This commit is contained in:
@@ -41,7 +41,6 @@ import com.vitorpamplona.amethyst.ui.feeds.FeedState
|
||||
import com.vitorpamplona.amethyst.ui.feeds.LoadingFeed
|
||||
import com.vitorpamplona.amethyst.ui.navigation.INav
|
||||
import com.vitorpamplona.amethyst.ui.screen.FeedViewModel
|
||||
import com.vitorpamplona.amethyst.ui.screen.SharedPreferencesViewModel
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||
|
||||
@@ -89,14 +88,13 @@ private fun GalleryFeedLoaded(
|
||||
nav: INav,
|
||||
) {
|
||||
val items by loaded.feed.collectAsStateWithLifecycle()
|
||||
val sharedPreferencesViewModel: SharedPreferencesViewModel = viewModel()
|
||||
|
||||
sharedPreferencesViewModel.init()
|
||||
|
||||
var ratio = 1.0f
|
||||
if (sharedPreferencesViewModel.sharedPrefs.modernGalleryStyle.value) {
|
||||
ratio = 0.8f
|
||||
}
|
||||
val ratio =
|
||||
if (accountViewModel.settings.modernGalleryStyle.value) {
|
||||
0.8f
|
||||
} else {
|
||||
1.0f
|
||||
}
|
||||
|
||||
LazyVerticalGrid(
|
||||
columns = GridCells.Fixed(3),
|
||||
|
||||
Reference in New Issue
Block a user