Skip to content

Commit e53f0ff

Browse files
committed
Update EmptyStateComposable usages to include modifiers
1 parent d4cd54f commit e53f0ff

File tree

4 files changed

+48
-8
lines changed

4 files changed

+48
-8
lines changed

app/src/main/java/org/schabi/newpipe/ui/components/video/RelatedItems.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.res.Configuration
44
import androidx.compose.foundation.layout.Arrangement
55
import androidx.compose.foundation.layout.Row
66
import androidx.compose.foundation.layout.fillMaxWidth
7+
import androidx.compose.foundation.layout.heightIn
78
import androidx.compose.foundation.layout.padding
89
import androidx.compose.material3.Surface
910
import androidx.compose.material3.Switch
@@ -74,7 +75,12 @@ fun RelatedItems(info: StreamInfo) {
7475
}
7576
if (info.relatedItems.isEmpty()) {
7677
item {
77-
EmptyStateComposable(EmptyStateSpec.NoVideos)
78+
EmptyStateComposable(
79+
spec = EmptyStateSpec.NoComments,
80+
modifier = Modifier
81+
.fillMaxWidth()
82+
.heightIn(min = 128.dp)
83+
)
7884
}
7985
}
8086
}

app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentRepliesDialog.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.schabi.newpipe.ui.components.video.comment
22

33
import android.content.res.Configuration
4+
import androidx.compose.foundation.layout.fillMaxWidth
5+
import androidx.compose.foundation.layout.heightIn
46
import androidx.compose.foundation.layout.padding
57
import androidx.compose.foundation.lazy.LazyColumn
68
import androidx.compose.foundation.lazy.rememberLazyListState
@@ -126,14 +128,22 @@ private fun CommentRepliesDialog(
126128
} else if (refresh is LoadState.Error) {
127129
// TODO use error panel instead
128130
EmptyStateComposable(
129-
EmptyStateSpec.DisabledComments.copy(
131+
spec = EmptyStateSpec.DisabledComments.copy(
130132
descriptionText = {
131133
stringResource(R.string.error_unable_to_load_comments)
132134
},
133135
),
136+
modifier = Modifier
137+
.fillMaxWidth()
138+
.heightIn(min = 128.dp)
134139
)
135140
} else {
136-
EmptyStateComposable(EmptyStateSpec.NoComments)
141+
EmptyStateComposable(
142+
spec = EmptyStateSpec.NoComments,
143+
modifier = Modifier
144+
.fillMaxWidth()
145+
.heightIn(min = 128.dp)
146+
)
137147
}
138148
}
139149
} else {

app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentSection.kt

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.schabi.newpipe.ui.components.video.comment
22

33
import android.content.res.Configuration
4+
import androidx.compose.foundation.layout.fillMaxWidth
5+
import androidx.compose.foundation.layout.heightIn
46
import androidx.compose.foundation.layout.padding
57
import androidx.compose.foundation.lazy.LazyColumn
68
import androidx.compose.foundation.lazy.rememberLazyListState
@@ -68,11 +70,22 @@ private fun CommentSection(
6870

6971
if (commentInfo.isCommentsDisabled) {
7072
item {
71-
EmptyStateComposable(EmptyStateSpec.DisabledComments)
73+
EmptyStateComposable(
74+
spec = EmptyStateSpec.DisabledComments,
75+
modifier = Modifier
76+
.fillMaxWidth()
77+
.heightIn(min = 128.dp)
78+
79+
)
7280
}
7381
} else if (count == 0) {
7482
item {
75-
EmptyStateComposable(EmptyStateSpec.NoComments)
83+
EmptyStateComposable(
84+
spec = EmptyStateSpec.NoComments,
85+
modifier = Modifier
86+
.fillMaxWidth()
87+
.heightIn(min = 128.dp)
88+
)
7689
}
7790
} else {
7891
// do not show anything if the comment count is unknown
@@ -121,11 +134,14 @@ private fun CommentSection(
121134
item {
122135
// TODO use error panel instead
123136
EmptyStateComposable(
124-
EmptyStateSpec.DisabledComments.copy(
137+
spec = EmptyStateSpec.DisabledComments.copy(
125138
descriptionText = {
126139
stringResource(R.string.error_unable_to_load_comments)
127140
}
128-
)
141+
),
142+
modifier = Modifier
143+
.fillMaxWidth()
144+
.heightIn(min = 128.dp)
129145
)
130146
}
131147
}

app/src/main/java/org/schabi/newpipe/ui/emptystate/EmptyStateUtil.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
package org.schabi.newpipe.ui.emptystate
44

5+
import androidx.compose.foundation.layout.fillMaxWidth
6+
import androidx.compose.foundation.layout.heightIn
57
import androidx.compose.material3.LocalContentColor
68
import androidx.compose.material3.MaterialTheme
79
import androidx.compose.material3.contentColorFor
810
import androidx.compose.runtime.CompositionLocalProvider
11+
import androidx.compose.ui.Modifier
912
import androidx.compose.ui.platform.ComposeView
1013
import androidx.compose.ui.platform.ViewCompositionStrategy
14+
import androidx.compose.ui.unit.dp
1115
import org.schabi.newpipe.ui.theme.AppTheme
1216

1317
@JvmOverloads
@@ -22,7 +26,11 @@ fun ComposeView.setEmptyStateComposable(
2226
LocalContentColor provides contentColorFor(MaterialTheme.colorScheme.background)
2327
) {
2428
EmptyStateComposable(
25-
spec = spec
29+
spec = spec,
30+
modifier = Modifier
31+
.fillMaxWidth()
32+
.heightIn(min = 128.dp)
33+
2634
)
2735
}
2836
}

0 commit comments

Comments
 (0)