File tree 4 files changed +21
-4
lines changed
app/src/main/java/dev/shorthouse/coinwatch
4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ package dev.shorthouse.coinwatch.navigation
2
2
3
3
import androidx.compose.animation.EnterTransition
4
4
import androidx.compose.animation.ExitTransition
5
+ import androidx.compose.animation.core.tween
6
+ import androidx.compose.animation.fadeIn
7
+ import androidx.compose.animation.fadeOut
5
8
import androidx.compose.runtime.Composable
6
9
import androidx.navigation.NavHostController
7
10
import androidx.navigation.compose.NavHost
@@ -21,10 +24,14 @@ fun AppNavHost(navController: NavHostController = rememberNavController()) {
21
24
enterTransition = { EnterTransition .None },
22
25
exitTransition = { ExitTransition .None }
23
26
) {
24
- composable(Screen .NavigationBar .route) {
27
+ composable(route = Screen .NavigationBar .route) {
25
28
NavigationBarScaffold (onNavigateDetails = onNavigateDetails)
26
29
}
27
- composable(route = Screen .Details .route + " /{coinId}" ) {
30
+ composable(
31
+ route = Screen .Details .route + " /{coinId}" ,
32
+ enterTransition = { fadeIn(animationSpec = tween(700 )) },
33
+ exitTransition = { fadeOut(animationSpec = tween(700 )) }
34
+ ) {
28
35
CoinDetailsScreen (onNavigateUp = { navController.navigateUp() })
29
36
}
30
37
}
Original file line number Diff line number Diff line change @@ -45,7 +45,9 @@ fun FavouritesScreen(
45
45
onCoinClick = { coin ->
46
46
onNavigateDetails(coin.id)
47
47
},
48
- onRefresh = { viewModel.initialiseUiState() }
48
+ onRefresh = {
49
+ viewModel.initialiseUiState()
50
+ }
49
51
)
50
52
}
51
53
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ fun MarketScreen(
115
115
)
116
116
val showJumpToTopFab by remember {
117
117
derivedStateOf {
118
- lazyListState.firstVisibleItemIndex > 0
118
+ lazyListState.firstVisibleItemIndex > 1
119
119
}
120
120
}
121
121
Original file line number Diff line number Diff line change @@ -114,10 +114,18 @@ class MarketViewModel @Inject constructor(
114
114
}
115
115
116
116
fun updateShowCoinSortBottomSheet (showSheet : Boolean ) {
117
+ if (showSheet && isAnyBottomSheetOpen()) return
118
+
117
119
_uiState .update { it.copy(showCoinSortBottomSheet = showSheet) }
118
120
}
119
121
120
122
fun updateShowCoinCurrencyBottomSheet (showSheet : Boolean ) {
123
+ if (showSheet && isAnyBottomSheetOpen()) return
124
+
121
125
_uiState .update { it.copy(showCoinCurrencyBottomSheet = showSheet) }
122
126
}
127
+
128
+ private fun isAnyBottomSheetOpen (): Boolean {
129
+ return _uiState .value.showCoinSortBottomSheet || _uiState .value.showCoinCurrencyBottomSheet
130
+ }
123
131
}
You can’t perform that action at this time.
0 commit comments