@@ -30,6 +30,7 @@ import androidx.compose.ui.Alignment
30
30
import androidx.compose.ui.Modifier
31
31
import androidx.compose.ui.graphics.Color
32
32
import androidx.compose.ui.text.TextStyle
33
+ import androidx.compose.ui.text.style.TextOverflow
33
34
import androidx.compose.ui.unit.TextUnit
34
35
import androidx.compose.ui.unit.dp
35
36
import androidx.compose.ui.unit.sp
@@ -72,7 +73,7 @@ private fun Data(state: ArrivalsState.Data, onClickRefresh: () -> Unit) {
72
73
.padding(top = 16 .dp, bottom = 8 .dp, start = 32 .dp, end = 32 .dp)
73
74
) {
74
75
val rowHeight = maxHeight / 3
75
- val textSize = (rowHeight * textScale ).value.sp
76
+ val textSize = (rowHeight * TEXT_SCALE ).value.sp
76
77
77
78
Column (
78
79
modifier = Modifier .fillMaxSize(),
@@ -134,7 +135,7 @@ fun Error(message: String) {
134
135
.padding(top = 16 .dp, bottom = 8 .dp, start = 32 .dp, end = 32 .dp)
135
136
) {
136
137
val rowHeight = (maxHeight - footerHeight) / 3 // Match text size in Data composable
137
- val textSize = (rowHeight * textScale ).value.sp
138
+ val textSize = (rowHeight * TEXT_SCALE ).value.sp
138
139
139
140
Column (
140
141
modifier = Modifier .fillMaxSize(),
@@ -148,10 +149,9 @@ fun Error(message: String) {
148
149
@Composable
149
150
fun ArrivalRow (arrival : Arrival , textSize : TextUnit ) {
150
151
Row (
151
- horizontalArrangement = Arrangement .SpaceBetween ,
152
152
modifier = Modifier .fillMaxWidth()
153
153
) {
154
- LedText (arrival.destination, textSize)
154
+ LedText (arrival.destination, textSize, modifier = Modifier .weight( 1f ) )
155
155
if (arrival.secondsToStop < 60 ) {
156
156
FlashingLedText (arrival.time, textSize)
157
157
} else {
@@ -161,15 +161,22 @@ fun ArrivalRow(arrival: Arrival, textSize: TextUnit) {
161
161
}
162
162
163
163
@Composable
164
- fun LedText (string : String , textSize : TextUnit , color : Color = LedYellow ) {
164
+ fun LedText (
165
+ string : String ,
166
+ textSize : TextUnit ,
167
+ color : Color = LedYellow ,
168
+ modifier : Modifier = Modifier
169
+ ) {
165
170
Text (
166
171
text = string,
167
172
color = color,
168
173
maxLines = 1 ,
174
+ overflow = TextOverflow .Ellipsis ,
169
175
style = TextStyle (
170
176
fontFamily = LurFontFamily ,
171
177
fontSize = textSize
172
- )
178
+ ),
179
+ modifier = modifier
173
180
)
174
181
}
175
182
@@ -187,5 +194,5 @@ fun FlashingLedText(string: String, textSize: TextUnit) {
187
194
LedText (string, textSize, LedYellow .copy(alpha = alpha))
188
195
}
189
196
190
- private val textScale = 0.6f
197
+ private const val TEXT_SCALE = 0.58f
191
198
private val footerHeight = 70 .dp
0 commit comments