@@ -7,18 +7,14 @@ import androidx.compose.foundation.layout.fillMaxSize
77import androidx.compose.foundation.layout.fillMaxWidth
88import androidx.compose.foundation.layout.heightIn
99import androidx.compose.foundation.layout.padding
10- import androidx.compose.material3.LocalTextStyle
1110import androidx.compose.material3.MaterialTheme
1211import androidx.compose.material3.Text
1312import androidx.compose.runtime.Composable
1413import androidx.compose.ui.Alignment
1514import androidx.compose.ui.Modifier
1615import androidx.compose.ui.res.stringResource
17- import androidx.compose.ui.text.TextStyle
18- import androidx.compose.ui.text.font.FontFamily
1916import androidx.compose.ui.tooling.preview.Preview
2017import androidx.compose.ui.unit.dp
21- import androidx.compose.ui.unit.sp
2218import org.schabi.newpipe.R
2319import org.schabi.newpipe.ui.theme.AppTheme
2420
@@ -28,39 +24,32 @@ fun EmptyStateComposable(
2824 modifier : Modifier = Modifier ,
2925) = EmptyStateComposable (
3026 modifier = spec.modifier(modifier),
31- emojiModifier = spec.emojiModifier(),
3227 emojiText = spec.emojiText(),
33- emojiTextStyle = spec.emojiTextStyle(),
34- descriptionModifier = spec.descriptionModifier(),
3528 descriptionText = spec.descriptionText(),
36- descriptionTextStyle = spec.descriptionTextStyle(),
3729)
3830
3931@Composable
4032private fun EmptyStateComposable (
41- modifier : Modifier ,
42- emojiModifier : Modifier ,
4333 emojiText : String ,
44- emojiTextStyle : TextStyle ,
45- descriptionModifier : Modifier ,
4634 descriptionText : String ,
47- descriptionTextStyle : TextStyle ,
35+ modifier : Modifier = Modifier ,
4836) {
4937 Column (
5038 modifier = modifier,
5139 horizontalAlignment = Alignment .CenterHorizontally ,
5240 verticalArrangement = Arrangement .Center
5341 ) {
5442 Text (
55- modifier = emojiModifier,
5643 text = emojiText,
57- style = emojiTextStyle ,
44+ style = MaterialTheme .typography.titleLarge ,
5845 )
5946
6047 Text (
61- modifier = descriptionModifier,
48+ modifier = Modifier
49+ .padding(top = 6 .dp)
50+ .padding(horizontal = 16 .dp),
6251 text = descriptionText,
63- style = descriptionTextStyle ,
52+ style = MaterialTheme .typography.bodyMedium ,
6453 )
6554 }
6655}
@@ -83,12 +72,8 @@ fun EmptyStateComposableNoCommentPreview() {
8372
8473data class EmptyStateSpec (
8574 val modifier : (Modifier ) -> Modifier ,
86- val emojiModifier : () -> Modifier ,
8775 val emojiText : @Composable () -> String ,
88- val emojiTextStyle : @Composable () -> TextStyle ,
8976 val descriptionText : @Composable () -> String ,
90- val descriptionModifier : () -> Modifier ,
91- val descriptionTextStyle : @Composable () -> TextStyle ,
9277) {
9378 companion object {
9479
@@ -99,34 +84,15 @@ data class EmptyStateSpec(
9984 .fillMaxWidth()
10085 .heightIn(min = 128 .dp)
10186 },
102- emojiModifier = { Modifier },
10387 emojiText = { " ¯\\ _(ツ)_/¯" },
104- emojiTextStyle = { MaterialTheme .typography.titleLarge },
105- descriptionModifier = {
106- Modifier
107- .padding(top = 6 .dp)
108- .padding(horizontal = 16 .dp)
109- },
11088 descriptionText = { stringResource(id = R .string.empty_list_subtitle) },
111- descriptionTextStyle = { MaterialTheme .typography.bodyMedium }
11289 )
11390
11491 val NoComment =
11592 EmptyStateSpec (
11693 modifier = { it.padding(top = 85 .dp) },
117- emojiModifier = { Modifier .padding(bottom = 10 .dp) },
11894 emojiText = { " (╯°-°)╯" },
119- emojiTextStyle = {
120- LocalTextStyle .current.merge(
121- fontFamily = FontFamily .Monospace ,
122- fontSize = 35 .sp,
123- )
124- },
125- descriptionModifier = { Modifier },
12695 descriptionText = { stringResource(id = R .string.no_comments) },
127- descriptionTextStyle = {
128- LocalTextStyle .current.merge(fontSize = 24 .sp)
129- }
13096 )
13197
13298 val NoSearchResult =
@@ -145,10 +111,7 @@ data class EmptyStateSpec(
145111 NoComment .copy(
146112 modifier = { it.padding(top = 90 .dp) },
147113 emojiText = { " (︶︹︺)" },
148- emojiTextStyle = { LocalTextStyle .current.merge(fontSize = 45 .sp) },
149- descriptionModifier = { Modifier .padding(top = 20 .dp) },
150114 descriptionText = { stringResource(id = R .string.content_not_supported) },
151- descriptionTextStyle = { LocalTextStyle .current.merge(fontSize = 15 .sp) },
152115 )
153116 }
154117}
0 commit comments