|
|
@ -17,6 +17,7 @@
|
|
|
|
package com.google.samples.apps.nowinandroid.feature.author
|
|
|
|
package com.google.samples.apps.nowinandroid.feature.author
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.VisibleForTesting
|
|
|
|
import androidx.annotation.VisibleForTesting
|
|
|
|
|
|
|
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
@ -27,7 +28,7 @@ import androidx.compose.foundation.layout.padding
|
|
|
|
import androidx.compose.foundation.layout.safeDrawing
|
|
|
|
import androidx.compose.foundation.layout.safeDrawing
|
|
|
|
import androidx.compose.foundation.layout.size
|
|
|
|
import androidx.compose.foundation.layout.size
|
|
|
|
import androidx.compose.foundation.layout.windowInsetsBottomHeight
|
|
|
|
import androidx.compose.foundation.layout.windowInsetsBottomHeight
|
|
|
|
import androidx.compose.foundation.layout.windowInsetsTopHeight
|
|
|
|
import androidx.compose.foundation.layout.windowInsetsPadding
|
|
|
|
import androidx.compose.foundation.lazy.LazyColumn
|
|
|
|
import androidx.compose.foundation.lazy.LazyColumn
|
|
|
|
import androidx.compose.foundation.lazy.LazyListScope
|
|
|
|
import androidx.compose.foundation.lazy.LazyListScope
|
|
|
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
|
|
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
|
|
@ -83,6 +84,7 @@ internal fun AuthorRoute(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalFoundationApi::class)
|
|
|
|
@VisibleForTesting
|
|
|
|
@VisibleForTesting
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
internal fun AuthorScreen(
|
|
|
|
internal fun AuthorScreen(
|
|
|
@ -96,13 +98,10 @@ internal fun AuthorScreen(
|
|
|
|
val scrollableState = rememberLazyListState()
|
|
|
|
val scrollableState = rememberLazyListState()
|
|
|
|
TrackScrollJank(scrollableState = scrollableState, stateName = "author:column")
|
|
|
|
TrackScrollJank(scrollableState = scrollableState, stateName = "author:column")
|
|
|
|
LazyColumn(
|
|
|
|
LazyColumn(
|
|
|
|
modifier = modifier,
|
|
|
|
modifier = modifier.windowInsetsPadding(WindowInsets.safeDrawing),
|
|
|
|
horizontalAlignment = Alignment.CenterHorizontally,
|
|
|
|
horizontalAlignment = Alignment.CenterHorizontally,
|
|
|
|
state = scrollableState
|
|
|
|
state = scrollableState
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
item {
|
|
|
|
|
|
|
|
Spacer(Modifier.windowInsetsTopHeight(WindowInsets.safeDrawing))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
when (authorUiState) {
|
|
|
|
when (authorUiState) {
|
|
|
|
AuthorUiState.Loading -> {
|
|
|
|
AuthorUiState.Loading -> {
|
|
|
|
item {
|
|
|
|
item {
|
|
|
@ -116,7 +115,7 @@ internal fun AuthorScreen(
|
|
|
|
TODO()
|
|
|
|
TODO()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
is AuthorUiState.Success -> {
|
|
|
|
is AuthorUiState.Success -> {
|
|
|
|
item {
|
|
|
|
stickyHeader {
|
|
|
|
AuthorToolbar(
|
|
|
|
AuthorToolbar(
|
|
|
|
onBackClick = onBackClick,
|
|
|
|
onBackClick = onBackClick,
|
|
|
|
onFollowClick = onFollowClick,
|
|
|
|
onFollowClick = onFollowClick,
|
|
|
@ -204,6 +203,7 @@ private fun AuthorToolbar(
|
|
|
|
onBackClick: () -> Unit = {},
|
|
|
|
onBackClick: () -> Unit = {},
|
|
|
|
onFollowClick: (Boolean) -> Unit = {},
|
|
|
|
onFollowClick: (Boolean) -> Unit = {},
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
|
|
|
|
NiaBackground {
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
horizontalArrangement = Arrangement.SpaceBetween,
|
|
|
|
horizontalArrangement = Arrangement.SpaceBetween,
|
|
|
|
verticalAlignment = Alignment.CenterVertically,
|
|
|
|
verticalAlignment = Alignment.CenterVertically,
|
|
|
@ -233,6 +233,7 @@ private fun AuthorToolbar(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@DevicePreviews
|
|
|
|
@DevicePreviews
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|