tangled
alpha
login
or
join now
geesawra.industries
/
jerry-no
8
fork
atom
A cheap attempt at a native Bluesky client for Android
8
fork
atom
overview
issues
pulls
pipelines
MainView: better scroll to top fab
geesawra.industries
5 months ago
2ca23647
7f8940b8
+13
-17
1 changed file
expand all
collapse all
unified
split
app
src
main
java
industries
geesawra
monarch
MainView.kt
+13
-17
app/src/main/java/industries/geesawra/monarch/MainView.kt
···
4
4
5
5
import android.widget.Toast
6
6
import androidx.annotation.StringRes
7
7
-
import androidx.compose.foundation.clickable
7
7
+
import androidx.compose.animation.AnimatedVisibility
8
8
+
import androidx.compose.animation.slideInVertically
9
9
+
import androidx.compose.animation.slideOutVertically
8
10
import androidx.compose.foundation.layout.Arrangement
9
11
import androidx.compose.foundation.layout.Column
10
12
import androidx.compose.foundation.layout.Row
···
20
22
import androidx.compose.foundation.shape.CircleShape
21
23
import androidx.compose.material.icons.Icons
22
24
import androidx.compose.material.icons.filled.AirlineStops
25
25
+
import androidx.compose.material.icons.filled.ArrowUpward
23
26
import androidx.compose.material.icons.filled.Create
24
27
import androidx.compose.material.icons.filled.Home
25
28
import androidx.compose.material.icons.filled.Notifications
···
265
268
}
266
269
},
267
270
scrollBehavior = scrollBehavior,
268
268
-
modifier = Modifier.clickable {
269
269
-
coroutineScope.launch {
270
270
-
when (currentDestination) {
271
271
-
TabBarDestinations.TIMELINE -> timelineState.animateScrollToItem(
272
272
-
0
273
273
-
)
274
274
-
275
275
-
TabBarDestinations.NOTIFICATIONS -> notificationsState.animateScrollToItem(
276
276
-
0
277
277
-
)
278
278
-
279
279
-
}
280
280
-
}
281
281
-
},
282
271
navigationIcon = {
283
272
when (currentDestination) {
284
273
TabBarDestinations.TIMELINE -> IconButton(onClick = {
···
299
288
TabBarDestinations.TIMELINE -> {
300
289
Column(
301
290
verticalArrangement = Arrangement.spacedBy(8.dp),
291
291
+
horizontalAlignment = Alignment.CenterHorizontally,
302
292
) {
303
303
-
if (timelineState.canScrollBackward) {
293
293
+
AnimatedVisibility(
294
294
+
visible = timelineState.canScrollBackward,
295
295
+
enter = slideInVertically(),
296
296
+
exit = slideOutVertically()
297
297
+
) {
304
298
FloatingActionButton(
299
299
+
modifier = Modifier
300
300
+
.size(40.dp),
305
301
onClick = {
306
302
coroutineScope.launch {
307
303
timelineState.animateScrollToItem(0)
···
309
305
},
310
306
shape = FloatingActionButtonDefaults.smallShape,
311
307
) {
312
312
-
Icon(Icons.Default.AirlineStops, "Scroll to top")
308
308
+
Icon(Icons.Default.ArrowUpward, "Scroll to top")
313
309
}
314
310
}
315
311