diff --git a/app/src/main/java/com/vanpra/composematerialdialogdemos/demos/BasicDialog.kt b/app/src/main/java/com/vanpra/composematerialdialogdemos/demos/BasicDialog.kt index d32bda7a..8f4aa0c2 100644 --- a/app/src/main/java/com/vanpra/composematerialdialogdemos/demos/BasicDialog.kt +++ b/app/src/main/java/com/vanpra/composematerialdialogdemos/demos/BasicDialog.kt @@ -15,10 +15,11 @@ import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.text.input.ImeAction import com.vanpra.composematerialdialogdemos.DialogAndShowButton import com.vanpra.composematerialdialogdemos.R +import com.vanpra.composematerialdialogs.TextFieldStyle import com.vanpra.composematerialdialogs.iconTitle +import com.vanpra.composematerialdialogs.input import com.vanpra.composematerialdialogs.message import com.vanpra.composematerialdialogs.title -import input /** * @brief Basic Dialog Demos diff --git a/core/src/androidTest/java/com/vanpra/composematerialdialogs/test/functional/InputDialogTest.kt b/core/src/androidTest/java/com/vanpra/composematerialdialogs/test/functional/InputDialogTest.kt index 5757dac6..2d23ef3b 100644 --- a/core/src/androidTest/java/com/vanpra/composematerialdialogs/test/functional/InputDialogTest.kt +++ b/core/src/androidTest/java/com/vanpra/composematerialdialogs/test/functional/InputDialogTest.kt @@ -12,6 +12,7 @@ import androidx.compose.ui.test.performTextClearance import androidx.compose.ui.test.performTextInput import androidx.test.ext.junit.runners.AndroidJUnit4 import com.vanpra.composematerialdialogs.MaterialDialogScope +import com.vanpra.composematerialdialogs.input import com.vanpra.composematerialdialogs.rememberMaterialDialogState import com.vanpra.composematerialdialogs.test.R import com.vanpra.composematerialdialogs.test.utils.DialogWithContent @@ -20,7 +21,6 @@ import com.vanpra.composematerialdialogs.test.utils.extensions.onDialogInput import com.vanpra.composematerialdialogs.test.utils.extensions.onDialogInputError import com.vanpra.composematerialdialogs.test.utils.extensions.onPositiveButton import com.vanpra.composematerialdialogs.title -import input import org.junit.Assert.assertEquals import org.junit.Rule import org.junit.Test diff --git a/core/src/androidTest/java/com/vanpra/composematerialdialogs/test/screenshot/InputDialogTest.kt b/core/src/androidTest/java/com/vanpra/composematerialdialogs/test/screenshot/InputDialogTest.kt index 4f77dbeb..75a894f8 100644 --- a/core/src/androidTest/java/com/vanpra/composematerialdialogs/test/screenshot/InputDialogTest.kt +++ b/core/src/androidTest/java/com/vanpra/composematerialdialogs/test/screenshot/InputDialogTest.kt @@ -3,12 +3,13 @@ package com.vanpra.composematerialdialogs.test.screenshot import androidx.compose.ui.test.junit4.createComposeRule import androidx.test.ext.junit.runners.AndroidJUnit4 import com.karumi.shot.ScreenshotTest +import com.vanpra.composematerialdialogs.TextFieldStyle +import com.vanpra.composematerialdialogs.input import com.vanpra.composematerialdialogs.test.R import com.vanpra.composematerialdialogs.test.utils.DialogWithContent import com.vanpra.composematerialdialogs.test.utils.extensions.onDialog import com.vanpra.composematerialdialogs.test.utils.extensions.setContentAndWaitForIdle import com.vanpra.composematerialdialogs.title -import input import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith diff --git a/core/src/main/java/com/vanpra/composematerialdialogs/MaterialDialogInput.kt b/core/src/main/java/com/vanpra/composematerialdialogs/MaterialDialogInput.kt index 1909903e..5f155226 100644 --- a/core/src/main/java/com/vanpra/composematerialdialogs/MaterialDialogInput.kt +++ b/core/src/main/java/com/vanpra/composematerialdialogs/MaterialDialogInput.kt @@ -1,3 +1,5 @@ +package com.vanpra.composematerialdialogs + import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth @@ -26,31 +28,31 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.vanpra.composematerialdialogs.MaterialDialogScope enum class TextFieldStyle { Filled, - Outlined/** - * Adds an input field with the given parameters to the dialog - * @param label string to be shown in the input field before selection eg. Username - * @param hint hint to be shown in the input field when it is selected but empty eg. Joe - * @param prefill string to be input into the text field by default - * @param waitForPositiveButton if true the [onInput] callback will only be called when the - * positive button is pressed, otherwise it will be called when the input value is changed - * @param visualTransformation a visual transformation of the content of the text field - * @param keyboardOptions software keyboard options which can be used to customize parts - * of the keyboard - * @param errorMessage a message to be shown to the user when the input is not valid - * @param focusRequester a [FocusRequester] which can be used to control the focus state of the - * text field - * @param focusOnShow if set to true this will auto focus the text field when the input - * field is shown - * @param isTextValid a function which is called to check if the user input is valid - * @param onInput a function which is called with the user input. The timing of this call is - * dictated by [waitForPositiveButton] - */ + Outlined } +/** + * Adds an input field with the given parameters to the dialog + * @param label string to be shown in the input field before selection eg. Username + * @param placeholder hint to be shown in the input field when it is selected but empty eg. Joe + * @param prefill string to be input into the text field by default + * @param waitForPositiveButton if true the [onInput] callback will only be called when the + * positive button is pressed, otherwise it will be called when the input value is changed + * @param visualTransformation a visual transformation of the content of the text field + * @param keyboardOptions software keyboard options which can be used to customize parts + * of the keyboard + * @param errorMessage a message to be shown to the user when the input is not valid + * @param focusRequester a [FocusRequester] which can be used to control the focus state of the + * text field + * @param focusOnShow if set to true this will auto focus the text field when the input + * field is shown + * @param isTextValid a function which is called to check if the user input is valid + * @param onInput a function which is called with the user input. The timing of this call is + * dictated by [waitForPositiveButton] + */ @Composable fun MaterialDialogScope.input( modifier: Modifier = Modifier,