@@ -5,6 +5,11 @@ import android.content.ClipboardManager
55import android.content.Context
66import android.widget.Toast
77import androidx.activity.compose.rememberLauncherForActivityResult
8+ import androidx.compose.animation.AnimatedVisibility
9+ import androidx.compose.animation.expandVertically
10+ import androidx.compose.animation.scaleIn
11+ import androidx.compose.animation.scaleOut
12+ import androidx.compose.animation.shrinkVertically
813import androidx.compose.foundation.layout.Arrangement
914import androidx.compose.foundation.layout.Box
1015import androidx.compose.foundation.layout.Column
@@ -115,11 +120,11 @@ fun HomeScreen(
115120 val selectedTag = viewModel.selectedTagFilter.collectAsStateWithLifecycle()
116121 val hazeState = rememberHazeState()
117122 val context = LocalContext .current
118- val contextCoroutine = rememberCoroutineScope()
119123 val scrollBehavior = SearchBarDefaults .enterAlwaysSearchBarScrollBehavior()
120124 val searchBarState = rememberSearchBarState()
121125 val textFieldState = rememberTextFieldState()
122126 val scope = rememberCoroutineScope()
127+ val totalLinks = viewModel.countOfLinks.collectAsStateWithLifecycle()
123128
124129 val qrScanner =
125130 rememberLauncherForActivityResult(
@@ -166,7 +171,7 @@ fun HomeScreen(
166171 if (searchBarState.currentValue == SearchBarValue .Collapsed ) {
167172 Text (
168173 modifier = Modifier .fillMaxWidth(),
169- text = stringResource(R .string.search),
174+ text = stringResource(R .string.search) + " ( " + totalLinks.value + " ) " ,
170175 textAlign = TextAlign .Center ,
171176 )
172177 }
@@ -456,7 +461,11 @@ fun DeeprList(
456461 onTagClick : (String ) -> Unit ,
457462 modifier : Modifier = Modifier ,
458463) {
459- if (accounts.isEmpty()) {
464+ AnimatedVisibility (
465+ accounts.isEmpty(),
466+ enter = scaleIn() + expandVertically(expandFrom = Alignment .CenterVertically ),
467+ exit = scaleOut() + shrinkVertically(shrinkTowards = Alignment .CenterVertically ),
468+ ) {
460469 // When empty, use a Column with weights to ensure vertical centering
461470 Column (
462471 modifier = modifier.fillMaxSize(),
@@ -495,14 +504,20 @@ fun DeeprList(
495504
496505 Spacer (modifier = Modifier .weight(1f )) // Push content up
497506 }
498- } else {
507+ }
508+ AnimatedVisibility (
509+ accounts.isNotEmpty(),
510+ enter = scaleIn() + expandVertically(expandFrom = Alignment .CenterVertically ),
511+ exit = scaleOut() + shrinkVertically(shrinkTowards = Alignment .CenterVertically ),
512+ ) {
499513 LazyColumn (
500514 modifier = modifier,
501515 contentPadding = contentPaddingValues,
502516 verticalArrangement = Arrangement .spacedBy(4 .dp),
503517 ) {
504518 items(accounts) { account ->
505519 DeeprItem (
520+ modifier = Modifier .animateItem(),
506521 account = account,
507522 selectedTag = selectedTag,
508523 onItemClick = onItemClick,
0 commit comments