@@ -2,40 +2,20 @@ package me.ash.reader.ui.page.home.flow
2
2
3
3
import androidx.compose.foundation.background
4
4
import androidx.compose.foundation.clickable
5
- import androidx.compose.foundation.layout.Arrangement
6
- import androidx.compose.foundation.layout.Box
7
- import androidx.compose.foundation.layout.Column
8
- import androidx.compose.foundation.layout.Row
9
- import androidx.compose.foundation.layout.Spacer
10
- import androidx.compose.foundation.layout.fillMaxSize
11
- import androidx.compose.foundation.layout.fillMaxWidth
12
- import androidx.compose.foundation.layout.padding
13
- import androidx.compose.foundation.layout.size
14
- import androidx.compose.foundation.layout.width
15
- import androidx.compose.material.DismissDirection
16
- import androidx.compose.material.DismissValue
17
- import androidx.compose.material.ExperimentalMaterialApi
18
- import androidx.compose.material.SwipeToDismiss
5
+ import androidx.compose.foundation.layout.*
6
+ import androidx.compose.material.*
19
7
import androidx.compose.material.icons.Icons
20
8
import androidx.compose.material.icons.rounded.CheckCircleOutline
21
9
import androidx.compose.material.icons.rounded.Star
22
- import androidx.compose.material.rememberDismissState
23
10
import androidx.compose.material3.Icon
24
11
import androidx.compose.material3.MaterialTheme
25
12
import androidx.compose.material3.Text
26
- import androidx.compose.runtime.Composable
27
- import androidx.compose.runtime.LaunchedEffect
28
- import androidx.compose.runtime.getValue
29
- import androidx.compose.runtime.mutableStateOf
30
- import androidx.compose.runtime.remember
31
- import androidx.compose.runtime.setValue
13
+ import androidx.compose.runtime.*
32
14
import androidx.compose.ui.Alignment
33
15
import androidx.compose.ui.Modifier
34
16
import androidx.compose.ui.draw.alpha
35
17
import androidx.compose.ui.draw.clip
36
18
import androidx.compose.ui.layout.ContentScale
37
- import androidx.compose.ui.layout.onGloballyPositioned
38
- import androidx.compose.ui.platform.LocalDensity
39
19
import androidx.compose.ui.res.stringResource
40
20
import androidx.compose.ui.text.style.TextAlign
41
21
import androidx.compose.ui.text.style.TextOverflow
@@ -44,13 +24,7 @@ import coil.size.Precision
44
24
import coil.size.Scale
45
25
import me.ash.reader.R
46
26
import me.ash.reader.domain.model.article.ArticleWithFeed
47
- import me.ash.reader.infrastructure.preference.FlowArticleReadIndicatorPreference
48
- import me.ash.reader.infrastructure.preference.LocalFlowArticleListDesc
49
- import me.ash.reader.infrastructure.preference.LocalFlowArticleListFeedIcon
50
- import me.ash.reader.infrastructure.preference.LocalFlowArticleListFeedName
51
- import me.ash.reader.infrastructure.preference.LocalFlowArticleListImage
52
- import me.ash.reader.infrastructure.preference.LocalFlowArticleListReadIndicator
53
- import me.ash.reader.infrastructure.preference.LocalFlowArticleListTime
27
+ import me.ash.reader.infrastructure.preference.*
54
28
import me.ash.reader.ui.component.FeedIcon
55
29
import me.ash.reader.ui.component.base.RYAsyncImage
56
30
import me.ash.reader.ui.component.base.SIZE_1000
@@ -69,18 +43,6 @@ fun ArticleItem(
69
43
val articleListDesc = LocalFlowArticleListDesc .current
70
44
val articleListDate = LocalFlowArticleListTime .current
71
45
val articleListReadIndicator = LocalFlowArticleListReadIndicator .current
72
- var titleHeight by remember { mutableStateOf(0 ) }
73
- val density = LocalDensity .current
74
- var descriptionLines by remember { mutableStateOf(1 ) }
75
- LaunchedEffect (titleHeight) {
76
- with (density) {
77
- descriptionLines = if (titleHeight > 0 && titleHeight + 16 .dp.roundToPx() / 16 > 32 ) {
78
- 1
79
- } else {
80
- 2
81
- }
82
- }
83
- }
84
46
85
47
Column (
86
48
modifier = Modifier
@@ -174,15 +136,8 @@ fun ArticleItem(
174
136
text = articleWithFeed.article.title,
175
137
color = MaterialTheme .colorScheme.onSurface,
176
138
style = MaterialTheme .typography.titleMedium,
177
- // maxLines = if (articleListDesc.value) 2 else 4,
139
+ maxLines = if (articleListDesc.value) 2 else 4 ,
178
140
overflow = TextOverflow .Ellipsis ,
179
- modifier = Modifier .onGloballyPositioned {coordinates ->
180
- if (titleHeight == 0 ) {
181
- titleHeight = with (density) {
182
- coordinates.size.height.toDp().value.toInt()
183
- }
184
- }
185
- }
186
141
)
187
142
188
143
// Description
@@ -192,7 +147,7 @@ fun ArticleItem(
192
147
text = articleWithFeed.article.shortDescription,
193
148
color = MaterialTheme .colorScheme.onSurfaceVariant,
194
149
style = MaterialTheme .typography.bodySmall,
195
- maxLines = descriptionLines ,
150
+ maxLines = 2 ,
196
151
overflow = TextOverflow .Ellipsis ,
197
152
)
198
153
}
0 commit comments