diff --git a/changelog.d/6645.misc b/changelog.d/6645.misc new file mode 100644 index 0000000000..b24655879d --- /dev/null +++ b/changelog.d/6645.misc @@ -0,0 +1 @@ +Enable auto-capitalization for Room creation Title field diff --git a/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt b/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt index 9f32980874..7618a84bb1 100644 --- a/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt +++ b/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt @@ -58,6 +58,9 @@ abstract class FormEditTextItem : VectorEpoxyModel(R.la @EpoxyAttribute var singleLine: Boolean = true + @EpoxyAttribute + var autoCapitalize: Boolean = false + @EpoxyAttribute var imeOptions: Int? = null @@ -132,10 +135,9 @@ abstract class FormEditTextItem : VectorEpoxyModel(R.la */ private fun configureInputType(holder: Holder) { val newInputType = - inputType ?: when (singleLine) { - true -> InputType.TYPE_CLASS_TEXT - false -> InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE - } + inputType ?: InputType.TYPE_CLASS_TEXT + .let { if (autoCapitalize) it or InputType.TYPE_TEXT_FLAG_CAP_SENTENCES else it } + .let { if (!singleLine) it or InputType.TYPE_TEXT_FLAG_MULTI_LINE else it } // This is a must in order to avoid extreme lag in some devices, on fast typing if (holder.textInputEditText.inputType != newInputType) { diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomController.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomController.kt index 71c83946d0..56d04aeaa1 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomController.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomController.kt @@ -67,6 +67,7 @@ class CreateRoomController @Inject constructor( enabled(enableFormElement) value(viewState.roomName) hint(host.stringProvider.getString(R.string.create_room_name_hint)) + autoCapitalize(true) onTextChange { text -> host.listener?.onNameChange(text) diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsController.kt b/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsController.kt index 31c3e86671..f8efe73ebf 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsController.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsController.kt @@ -91,6 +91,7 @@ class RoomSettingsController @Inject constructor( enabled(data.actionPermissions.canChangeName) value(data.newName ?: roomSummary.displayName) hint(host.stringProvider.getString(R.string.room_settings_name_hint)) + autoCapitalize(true) onTextChange { text -> host.callback?.onNameChanged(text)