1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-22 02:53:09 +01:00

Fix text color in bottom sheet

This commit is contained in:
Isira Seneviratne 2024-08-28 17:59:38 +05:30
parent f9340ae604
commit 5fffee2c7d
2 changed files with 30 additions and 36 deletions

View File

@ -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()
}
}

View File

@ -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)
}
}