Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable auto suggest on input fields for URLs #3377

Merged
merged 2 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
Expand Down Expand Up @@ -59,7 +60,7 @@ fun ManualSetupView(
modifier = Modifier.align(Alignment.CenterHorizontally),
label = { Text(stringResource(id = commonR.string.input_url)) },
singleLine = true,
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done, autoCorrect = false, keyboardType = KeyboardType.Uri),
keyboardActions = KeyboardActions(
onDone = {
keyboardController?.hide()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ class ServerSettingsFragment : ServerSettingsView, PreferenceFragmentCompat() {
}

findPreference<EditTextPreference>("connection_internal")?.let {
it.setOnBindEditTextListener { edit ->
edit.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
}
it.onPreferenceChangeListener =
onChangeUrlValidator
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import io.homeassistant.companion.android.common.R as commonR
Expand Down Expand Up @@ -53,7 +54,7 @@ fun ExternalUrlInputView(
urlInput = it
urlError = false
},
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done, autoCorrect = false, keyboardType = KeyboardType.Uri),
keyboardActions = KeyboardActions(
onDone = {
urlError = !performUrlUpdate(urlInput?.trim(), url, onSaveUrl)
Expand Down
2 changes: 1 addition & 1 deletion wear/src/main/res/layout/activity_manual_setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:layout_marginTop="8dp"
android:ems="10"
android:hint="@string/input_url_hint"
android:inputType="textPersonName"
android:inputType="textNoSuggestions"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
Expand Down