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 a1bd2bd1a3..42ce6d68a8 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 @@ -57,6 +57,9 @@ abstract class FormEditTextItem : VectorEpoxyModel() { @EpoxyAttribute var imeOptions: Int? = null + @EpoxyAttribute + var endIconMode: Int? = null + @EpoxyAttribute var onTextChange: ((String) -> Unit)? = null @@ -72,6 +75,10 @@ abstract class FormEditTextItem : VectorEpoxyModel() { holder.textInputLayout.hint = hint holder.textInputLayout.error = errorMessage + endIconMode?.let { mode -> + holder.textInputLayout.endIconMode = mode + } + // Update only if text is different and value is not null holder.textInputEditText.setTextSafe(value) holder.textInputEditText.isEnabled = enabled diff --git a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt index cd2680ef5f..9988bbe003 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt @@ -111,7 +111,10 @@ class CreateSpaceViewModel @AssistedInject constructor( override fun initialState(viewModelContext: ViewModelContext): CreateSpaceState? { return CreateSpaceState( - defaultRooms = mapOf(0 to viewModelContext.activity.getString(R.string.create_spaces_default_public_room_name)) + defaultRooms = mapOf( + 0 to viewModelContext.activity.getString(R.string.create_spaces_default_public_room_name), + 1 to viewModelContext.activity.getString(R.string.create_spaces_default_public_random_room_name) + ) ) } } diff --git a/vector/src/main/java/im/vector/app/features/spaces/create/SpaceDefaultRoomEpoxyController.kt b/vector/src/main/java/im/vector/app/features/spaces/create/SpaceDefaultRoomEpoxyController.kt index 27b57713ba..800de01b62 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/create/SpaceDefaultRoomEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/create/SpaceDefaultRoomEpoxyController.kt @@ -17,6 +17,7 @@ package im.vector.app.features.spaces.create import com.airbnb.epoxy.TypedEpoxyController +import com.google.android.material.textfield.TextInputLayout import im.vector.app.R import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.StringProvider @@ -51,6 +52,7 @@ class SpaceDefaultRoomEpoxyController @Inject constructor( enabled(true) value(data?.defaultRooms?.get(0)) hint(stringProvider.getString(R.string.create_room_name_section)) + endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT) showBottomSeparator(false) onTextChange { text -> listener?.onNameChange(0, text) @@ -62,6 +64,7 @@ class SpaceDefaultRoomEpoxyController @Inject constructor( enabled(true) value(data?.defaultRooms?.get(1)) hint(stringProvider.getString(R.string.create_room_name_section)) + endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT) showBottomSeparator(false) onTextChange { text -> listener?.onNameChange(1, text) @@ -73,6 +76,7 @@ class SpaceDefaultRoomEpoxyController @Inject constructor( enabled(true) value(data?.defaultRooms?.get(2)) hint(stringProvider.getString(R.string.create_room_name_section)) + endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT) showBottomSeparator(false) onTextChange { text -> listener?.onNameChange(2, text) diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 41b489002b..5c6966ef4e 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -3276,6 +3276,7 @@ What are some discussions you want to have in Runner’s World? We’ll create rooms for them, and auto-join everyone. You can add more later too. General + Random Creating Space… Invite people to your space It’s just you at the moment. %s will be even better with others.