mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-07-07 12:32:59 +00:00
Fix content color in comment replies fragment
This commit is contained in:
parent
23b3835af0
commit
ef56dea817
@ -6,10 +6,13 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.ModalBottomSheet
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.contentColorFor
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -67,54 +70,64 @@ private fun CommentRepliesDialog(
|
|||||||
val state = rememberLazyListState()
|
val state = rememberLazyListState()
|
||||||
|
|
||||||
ModalBottomSheet(onDismissRequest = onDismissRequest) {
|
ModalBottomSheet(onDismissRequest = onDismissRequest) {
|
||||||
LazyColumnScrollbar(
|
CompositionLocalProvider(
|
||||||
state = state,
|
// contentColorFor(MaterialTheme.colorScheme.containerColor), i.e. ModalBottomSheet's
|
||||||
settings = ScrollbarSettings.Default.copy(
|
// default background color, does not resolve correctly, so need to manually set the
|
||||||
thumbSelectedColor = md_theme_dark_primary,
|
// content color for MaterialTheme.colorScheme.background instead
|
||||||
thumbUnselectedColor = Color.Red
|
LocalContentColor provides contentColorFor(MaterialTheme.colorScheme.background)
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
LazyColumn(
|
LazyColumnScrollbar(
|
||||||
modifier = Modifier.nestedScroll(nestedScrollInterop),
|
state = state,
|
||||||
state = state
|
settings = ScrollbarSettings.Default.copy(
|
||||||
|
thumbSelectedColor = md_theme_dark_primary,
|
||||||
|
thumbUnselectedColor = Color.Red
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
item {
|
LazyColumn(
|
||||||
CommentRepliesHeader(comment = parentComment)
|
modifier = Modifier.nestedScroll(nestedScrollInterop),
|
||||||
HorizontalDivider(
|
state = state
|
||||||
thickness = 1.dp,
|
) {
|
||||||
modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 8.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (comments.itemCount == 0) {
|
|
||||||
item {
|
item {
|
||||||
val refresh = comments.loadState.refresh
|
CommentRepliesHeader(comment = parentComment)
|
||||||
if (refresh is LoadState.Loading) {
|
HorizontalDivider(
|
||||||
LoadingIndicator(modifier = Modifier.padding(top = 8.dp))
|
thickness = 1.dp,
|
||||||
} else {
|
modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 8.dp)
|
||||||
val message = if (refresh is LoadState.Error) {
|
)
|
||||||
R.string.error_unable_to_load_comments
|
|
||||||
} else {
|
|
||||||
R.string.no_comments
|
|
||||||
}
|
|
||||||
NoItemsMessage(message)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (comments.itemCount >= 0) {
|
if (comments.itemCount == 0) {
|
||||||
item {
|
item {
|
||||||
Text(
|
val refresh = comments.loadState.refresh
|
||||||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 4.dp),
|
if (refresh is LoadState.Loading) {
|
||||||
text = pluralStringResource(
|
LoadingIndicator(modifier = Modifier.padding(top = 8.dp))
|
||||||
R.plurals.replies, comments.itemCount, comments.itemCount
|
} else {
|
||||||
),
|
val message = if (refresh is LoadState.Error) {
|
||||||
maxLines = 1,
|
R.string.error_unable_to_load_comments
|
||||||
style = MaterialTheme.typography.titleMedium
|
} else {
|
||||||
)
|
R.string.no_comments
|
||||||
|
}
|
||||||
|
NoItemsMessage(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (comments.itemCount >= 0) {
|
||||||
|
item {
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.padding(
|
||||||
|
horizontal = 12.dp,
|
||||||
|
vertical = 4.dp
|
||||||
|
),
|
||||||
|
text = pluralStringResource(
|
||||||
|
R.plurals.replies, comments.itemCount, comments.itemCount
|
||||||
|
),
|
||||||
|
maxLines = 1,
|
||||||
|
style = MaterialTheme.typography.titleMedium
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
items(comments.itemCount) {
|
||||||
|
Comment(comment = comments[it]!!)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
items(comments.itemCount) {
|
|
||||||
Comment(comment = comments[it]!!)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user