Clean up `SleepTimerCustomAlertDialog`
This commit is contained in:
parent
b57e782613
commit
b3b0bc84f9
|
@ -1,6 +1,7 @@
|
||||||
package com.simplemobiletools.flashlight.dialogs
|
package com.simplemobiletools.flashlight.dialogs
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
|
@ -13,6 +14,7 @@ import androidx.compose.ui.unit.dp
|
||||||
import com.simplemobiletools.commons.R
|
import com.simplemobiletools.commons.R
|
||||||
import com.simplemobiletools.commons.compose.alert_dialog.AlertDialogState
|
import com.simplemobiletools.commons.compose.alert_dialog.AlertDialogState
|
||||||
import com.simplemobiletools.commons.compose.alert_dialog.DialogSurface
|
import com.simplemobiletools.commons.compose.alert_dialog.DialogSurface
|
||||||
|
import com.simplemobiletools.commons.compose.alert_dialog.dialogTextColor
|
||||||
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
|
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
|
||||||
import com.simplemobiletools.commons.compose.extensions.MyDevices
|
import com.simplemobiletools.commons.compose.extensions.MyDevices
|
||||||
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
||||||
|
@ -58,8 +60,10 @@ fun SleepTimerCustomAlertDialog(
|
||||||
top = SimpleTheme.dimens.padding.extraLarge
|
top = SimpleTheme.dimens.padding.extraLarge
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
TextField(
|
OutlinedTextField(
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(
|
||||||
bottom = SimpleTheme.dimens.padding.large
|
bottom = SimpleTheme.dimens.padding.large
|
||||||
),
|
),
|
||||||
value = value,
|
value = value,
|
||||||
|
@ -69,6 +73,11 @@ fun SleepTimerCustomAlertDialog(
|
||||||
label = {
|
label = {
|
||||||
Text(stringResource(id = R.string.value))
|
Text(stringResource(id = R.string.value))
|
||||||
},
|
},
|
||||||
|
colors = OutlinedTextFieldDefaults.colors(
|
||||||
|
disabledTextColor = dialogTextColor,
|
||||||
|
disabledBorderColor = SimpleTheme.colorScheme.primary,
|
||||||
|
disabledLabelColor = SimpleTheme.colorScheme.primary,
|
||||||
|
),
|
||||||
keyboardOptions = KeyboardOptions(
|
keyboardOptions = KeyboardOptions(
|
||||||
keyboardType = KeyboardType.Number
|
keyboardType = KeyboardType.Number
|
||||||
)
|
)
|
||||||
|
@ -76,13 +85,18 @@ fun SleepTimerCustomAlertDialog(
|
||||||
|
|
||||||
items.forEachIndexed { index, item ->
|
items.forEachIndexed { index, item ->
|
||||||
Row(
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.clickable {
|
||||||
|
selectedItem = index
|
||||||
|
}
|
||||||
|
.padding(vertical = SimpleTheme.dimens.padding.large)
|
||||||
|
.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
RadioButton(
|
RadioButton(
|
||||||
|
modifier = Modifier.padding(horizontal = SimpleTheme.dimens.padding.small),
|
||||||
selected = index == selectedItem,
|
selected = index == selectedItem,
|
||||||
onClick = {
|
onClick = null
|
||||||
selectedItem = index
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = item.stringResId)
|
text = stringResource(id = item.stringResId)
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/dialog_custom_sleep_timer_holder"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingLeft="@dimen/activity_margin"
|
|
||||||
android:paddingTop="@dimen/activity_margin"
|
|
||||||
android:paddingRight="@dimen/activity_margin">
|
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextInputLayout
|
|
||||||
android:id="@+id/value_hint"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/value">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/timer_value"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="@dimen/activity_margin"
|
|
||||||
android:digits="0123456789"
|
|
||||||
android:inputType="number"
|
|
||||||
android:maxLength="5"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textCursorDrawable="@null"
|
|
||||||
android:imeOptions="actionDone"
|
|
||||||
android:textSize="@dimen/normal_text_size" />
|
|
||||||
|
|
||||||
</com.simplemobiletools.commons.views.MyTextInputLayout>
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:id="@+id/dialog_radio_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingTop="@dimen/normal_margin">
|
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
|
||||||
android:id="@+id/dialog_radio_minutes"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingTop="@dimen/normal_margin"
|
|
||||||
android:paddingBottom="@dimen/normal_margin"
|
|
||||||
android:text="@string/minutes_raw" />
|
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
|
||||||
android:id="@+id/dialog_radio_seconds"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingTop="@dimen/normal_margin"
|
|
||||||
android:paddingBottom="@dimen/normal_margin"
|
|
||||||
android:text="@string/seconds_raw" />
|
|
||||||
|
|
||||||
</RadioGroup>
|
|
||||||
</LinearLayout>
|
|
Loading…
Reference in New Issue