@@ -5,6 +5,11 @@ import android.content.ClipboardManager
5
5
import android.content.Context
6
6
import android.widget.Toast
7
7
import 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
8
13
import androidx.compose.foundation.layout.Arrangement
9
14
import androidx.compose.foundation.layout.Box
10
15
import androidx.compose.foundation.layout.Column
@@ -115,11 +120,11 @@ fun HomeScreen(
115
120
val selectedTag = viewModel.selectedTagFilter.collectAsStateWithLifecycle()
116
121
val hazeState = rememberHazeState()
117
122
val context = LocalContext .current
118
- val contextCoroutine = rememberCoroutineScope()
119
123
val scrollBehavior = SearchBarDefaults .enterAlwaysSearchBarScrollBehavior()
120
124
val searchBarState = rememberSearchBarState()
121
125
val textFieldState = rememberTextFieldState()
122
126
val scope = rememberCoroutineScope()
127
+ val totalLinks = viewModel.countOfLinks.collectAsStateWithLifecycle()
123
128
124
129
val qrScanner =
125
130
rememberLauncherForActivityResult(
@@ -166,7 +171,7 @@ fun HomeScreen(
166
171
if (searchBarState.currentValue == SearchBarValue .Collapsed ) {
167
172
Text (
168
173
modifier = Modifier .fillMaxWidth(),
169
- text = stringResource(R .string.search),
174
+ text = stringResource(R .string.search) + " ( " + totalLinks.value + " ) " ,
170
175
textAlign = TextAlign .Center ,
171
176
)
172
177
}
@@ -456,7 +461,11 @@ fun DeeprList(
456
461
onTagClick : (String ) -> Unit ,
457
462
modifier : Modifier = Modifier ,
458
463
) {
459
- if (accounts.isEmpty()) {
464
+ AnimatedVisibility (
465
+ accounts.isEmpty(),
466
+ enter = scaleIn() + expandVertically(expandFrom = Alignment .CenterVertically ),
467
+ exit = scaleOut() + shrinkVertically(shrinkTowards = Alignment .CenterVertically ),
468
+ ) {
460
469
// When empty, use a Column with weights to ensure vertical centering
461
470
Column (
462
471
modifier = modifier.fillMaxSize(),
@@ -495,14 +504,20 @@ fun DeeprList(
495
504
496
505
Spacer (modifier = Modifier .weight(1f )) // Push content up
497
506
}
498
- } else {
507
+ }
508
+ AnimatedVisibility (
509
+ accounts.isNotEmpty(),
510
+ enter = scaleIn() + expandVertically(expandFrom = Alignment .CenterVertically ),
511
+ exit = scaleOut() + shrinkVertically(shrinkTowards = Alignment .CenterVertically ),
512
+ ) {
499
513
LazyColumn (
500
514
modifier = modifier,
501
515
contentPadding = contentPaddingValues,
502
516
verticalArrangement = Arrangement .spacedBy(4 .dp),
503
517
) {
504
518
items(accounts) { account ->
505
519
DeeprItem (
520
+ modifier = Modifier .animateItem(),
506
521
account = account,
507
522
selectedTag = selectedTag,
508
523
onItemClick = onItemClick,
0 commit comments