Skip to content

Commit

Permalink
Fix text overflow on long alarm labels (closes #27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnyro committed Apr 12, 2023
1 parent 8db0045 commit 9967f33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 2,
"versionName": "2.0",
"versionCode": 3,
"versionName": "2.1",
"outputFile": "app-release.apk"
}
],
Expand Down
15 changes: 11 additions & 4 deletions app/src/main/java/com/bnyro/clock/ui/screens/AlarmScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.bnyro.clock.R
Expand Down Expand Up @@ -126,21 +127,26 @@ fun AlarmScreen(alarmModel: AlarmModel) {
) {
val interactionSource = remember { MutableInteractionSource() }

Column {
Column(
modifier = Modifier.weight(1f)
) {
Row(
modifier = Modifier
.clip(RoundedCornerShape(20.dp))
.clickable {
showLabelDialog = true
}
.padding(start = 5.dp, end = 10.dp)
.alpha(if (label != null) 1f else 0.5f),
.alpha(if (label != null) 1f else 0.5f)
.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Icon(Icons.Default.Label, null)
Spacer(modifier = Modifier.width(5.dp))
Text(
text = label ?: stringResource(R.string.label)
text = label ?: stringResource(R.string.label),
overflow = TextOverflow.Ellipsis,
maxLines = 1
)
}
Spacer(modifier = Modifier.height(5.dp))
Expand Down Expand Up @@ -265,7 +271,8 @@ fun AlarmScreen(alarmModel: AlarmModel) {
Spacer(modifier = Modifier.height(10.dp))
OutlinedTextField(
value = newLabel.orEmpty(),
onValueChange = { text -> newLabel = text }
onValueChange = { text -> newLabel = text },
singleLine = true
)
},
confirmButton = {
Expand Down

0 comments on commit 9967f33

Please sign in to comment.