Fix text color in bottom sheet
This commit is contained in:
parent
f9340ae604
commit
5fffee2c7d
|
@ -3,8 +3,6 @@ package org.schabi.newpipe.fragments.list.comments
|
|||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.compose.content
|
||||
|
@ -20,9 +18,7 @@ class CommentsFragment : Fragment() {
|
|||
savedInstanceState: Bundle?
|
||||
) = content {
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
CommentSection()
|
||||
}
|
||||
CommentSection()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,33 +50,35 @@ fun CommentSection(
|
|||
val nestedScrollInterop = rememberNestedScrollInteropConnection()
|
||||
val state = rememberLazyListState()
|
||||
|
||||
LazyColumnScrollbar(state = state) {
|
||||
LazyColumn(modifier = Modifier.nestedScroll(nestedScrollInterop), state = state) {
|
||||
if (parentComment != null) {
|
||||
item {
|
||||
CommentRepliesHeader(comment = parentComment)
|
||||
HorizontalDivider(thickness = 1.dp)
|
||||
}
|
||||
}
|
||||
|
||||
if (itemCount == 0) {
|
||||
item {
|
||||
val refresh = comments.loadState.refresh
|
||||
if (refresh is LoadState.Loading) {
|
||||
LoadingIndicator(modifier = Modifier.padding(top = 8.dp))
|
||||
} else {
|
||||
val error = (refresh as? LoadState.Error)?.error
|
||||
val message = if (error is CommentsDisabledException) {
|
||||
R.string.comments_are_disabled
|
||||
} else {
|
||||
R.string.no_comments
|
||||
}
|
||||
NoItemsMessage(message)
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
LazyColumnScrollbar(state = state) {
|
||||
LazyColumn(modifier = Modifier.nestedScroll(nestedScrollInterop), state = state) {
|
||||
if (parentComment != null) {
|
||||
item {
|
||||
CommentRepliesHeader(comment = parentComment)
|
||||
HorizontalDivider(thickness = 1.dp)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
items(itemCount) {
|
||||
Comment(comment = comments[it]!!)
|
||||
|
||||
if (itemCount == 0) {
|
||||
item {
|
||||
val refresh = comments.loadState.refresh
|
||||
if (refresh is LoadState.Loading) {
|
||||
LoadingIndicator(modifier = Modifier.padding(top = 8.dp))
|
||||
} else {
|
||||
val error = (refresh as? LoadState.Error)?.error
|
||||
val message = if (error is CommentsDisabledException) {
|
||||
R.string.comments_are_disabled
|
||||
} else {
|
||||
R.string.no_comments
|
||||
}
|
||||
NoItemsMessage(message)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
items(itemCount) {
|
||||
Comment(comment = comments[it]!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,9 +118,7 @@ private fun CommentSectionPreview(
|
|||
@PreviewParameter(CommentDataProvider::class) pagingData: PagingData<CommentsInfoItem>
|
||||
) {
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
CommentSection(commentsFlow = flowOf(pagingData))
|
||||
}
|
||||
CommentSection(commentsFlow = flowOf(pagingData))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,8 +142,6 @@ private fun CommentRepliesPreview() {
|
|||
val flow = flowOf(PagingData.from(replies))
|
||||
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
CommentSection(parentComment = comment, commentsFlow = flow)
|
||||
}
|
||||
CommentSection(parentComment = comment, commentsFlow = flow)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue