Skip to content

Commit

Permalink
Fix: Save button covering preset timers
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed Mar 25, 2024
1 parent f0a16b8 commit 09ffb8c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
22 changes: 14 additions & 8 deletions app/src/main/java/com/bnyro/clock/ui/screens/TimerScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Create
import androidx.compose.material.icons.filled.FilterAlt
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material.icons.filled.Save
import androidx.compose.material.icons.rounded.Add
import androidx.compose.material.icons.rounded.AddAlarm
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
Expand All @@ -46,6 +49,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.bnyro.clock.R
import com.bnyro.clock.obj.NumberKeypadOperation
import com.bnyro.clock.ui.components.ClickableIcon
import com.bnyro.clock.ui.components.FormattedTimerTime
import com.bnyro.clock.ui.components.NumberKeypad
import com.bnyro.clock.ui.components.TimePickerDial
Expand Down Expand Up @@ -82,12 +86,6 @@ fun TimerScreen(onClickSettings: () -> Unit, timerModel: TimerModel) {
}
Spacer(Modifier.height(8.dp))
}
FloatingActionButton(onClick = {
timerModel.addPersistentTimer(timerModel.timePickerSeconds)
}) {
Icon(imageVector = Icons.Default.Save, contentDescription = null)
}
Spacer(Modifier.height(16.dp))
FloatingActionButton(
onClick = {
createNew = false
Expand All @@ -105,6 +103,15 @@ fun TimerScreen(onClickSettings: () -> Unit, timerModel: TimerModel) {
Icon(imageVector = Icons.Default.Create, contentDescription = null)
}
}
}, actions = {
if (timerModel.scheduledObjects.isEmpty() || createNew) {
ClickableIcon(
imageVector = Icons.Rounded.AddAlarm,
contentDescription = stringResource(R.string.add_preset_timer)
) {
timerModel.addPersistentTimer(timerModel.timePickerSeconds)
}
}
}) { paddingValues ->
if (timerModel.scheduledObjects.isEmpty() || createNew) {
Column(
Expand Down Expand Up @@ -151,8 +158,7 @@ fun TimerScreen(onClickSettings: () -> Unit, timerModel: TimerModel) {
val haptic = LocalHapticFeedback.current
LazyVerticalGrid(
modifier = Modifier
.fillMaxWidth()
.weight(1f),
.fillMaxWidth(),
columns = GridCells.Adaptive(100.dp),
contentPadding = PaddingValues(16.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,5 @@
<string name="lap">Lap</string>
<string name="lap_time">Lap Time</string>
<string name="overall_time">Overall Time</string>
<string name="add_preset_timer">Add preset timer</string>
</resources>

0 comments on commit 09ffb8c

Please sign in to comment.