mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-13 14:46:40 +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.feeds.LoadingFeed
|
||||||
import com.vitorpamplona.amethyst.ui.navigation.INav
|
import com.vitorpamplona.amethyst.ui.navigation.INav
|
||||||
import com.vitorpamplona.amethyst.ui.screen.FeedViewModel
|
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.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
|
|
||||||
@@ -89,14 +88,13 @@ private fun GalleryFeedLoaded(
|
|||||||
nav: INav,
|
nav: INav,
|
||||||
) {
|
) {
|
||||||
val items by loaded.feed.collectAsStateWithLifecycle()
|
val items by loaded.feed.collectAsStateWithLifecycle()
|
||||||
val sharedPreferencesViewModel: SharedPreferencesViewModel = viewModel()
|
|
||||||
|
|
||||||
sharedPreferencesViewModel.init()
|
val ratio =
|
||||||
|
if (accountViewModel.settings.modernGalleryStyle.value) {
|
||||||
var ratio = 1.0f
|
0.8f
|
||||||
if (sharedPreferencesViewModel.sharedPrefs.modernGalleryStyle.value) {
|
} else {
|
||||||
ratio = 0.8f
|
1.0f
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyVerticalGrid(
|
LazyVerticalGrid(
|
||||||
columns = GridCells.Fixed(3),
|
columns = GridCells.Fixed(3),
|
||||||
|
|||||||
Reference in New Issue
Block a user