Default Rooms Handling
This commit is contained in:
parent
a901e1d179
commit
2952dca3a3
|
@ -57,6 +57,9 @@ abstract class FormEditTextItem : VectorEpoxyModel<FormEditTextItem.Holder>() {
|
||||||
@EpoxyAttribute
|
@EpoxyAttribute
|
||||||
var imeOptions: Int? = null
|
var imeOptions: Int? = null
|
||||||
|
|
||||||
|
@EpoxyAttribute
|
||||||
|
var endIconMode: Int? = null
|
||||||
|
|
||||||
@EpoxyAttribute
|
@EpoxyAttribute
|
||||||
var onTextChange: ((String) -> Unit)? = null
|
var onTextChange: ((String) -> Unit)? = null
|
||||||
|
|
||||||
|
@ -72,6 +75,10 @@ abstract class FormEditTextItem : VectorEpoxyModel<FormEditTextItem.Holder>() {
|
||||||
holder.textInputLayout.hint = hint
|
holder.textInputLayout.hint = hint
|
||||||
holder.textInputLayout.error = errorMessage
|
holder.textInputLayout.error = errorMessage
|
||||||
|
|
||||||
|
endIconMode?.let { mode ->
|
||||||
|
holder.textInputLayout.endIconMode = mode
|
||||||
|
}
|
||||||
|
|
||||||
// Update only if text is different and value is not null
|
// Update only if text is different and value is not null
|
||||||
holder.textInputEditText.setTextSafe(value)
|
holder.textInputEditText.setTextSafe(value)
|
||||||
holder.textInputEditText.isEnabled = enabled
|
holder.textInputEditText.isEnabled = enabled
|
||||||
|
|
|
@ -111,7 +111,10 @@ class CreateSpaceViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
override fun initialState(viewModelContext: ViewModelContext): CreateSpaceState? {
|
override fun initialState(viewModelContext: ViewModelContext): CreateSpaceState? {
|
||||||
return 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)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package im.vector.app.features.spaces.create
|
package im.vector.app.features.spaces.create
|
||||||
|
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.resources.ColorProvider
|
import im.vector.app.core.resources.ColorProvider
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
|
@ -51,6 +52,7 @@ class SpaceDefaultRoomEpoxyController @Inject constructor(
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(data?.defaultRooms?.get(0))
|
value(data?.defaultRooms?.get(0))
|
||||||
hint(stringProvider.getString(R.string.create_room_name_section))
|
hint(stringProvider.getString(R.string.create_room_name_section))
|
||||||
|
endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT)
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
listener?.onNameChange(0, text)
|
listener?.onNameChange(0, text)
|
||||||
|
@ -62,6 +64,7 @@ class SpaceDefaultRoomEpoxyController @Inject constructor(
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(data?.defaultRooms?.get(1))
|
value(data?.defaultRooms?.get(1))
|
||||||
hint(stringProvider.getString(R.string.create_room_name_section))
|
hint(stringProvider.getString(R.string.create_room_name_section))
|
||||||
|
endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT)
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
listener?.onNameChange(1, text)
|
listener?.onNameChange(1, text)
|
||||||
|
@ -73,6 +76,7 @@ class SpaceDefaultRoomEpoxyController @Inject constructor(
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(data?.defaultRooms?.get(2))
|
value(data?.defaultRooms?.get(2))
|
||||||
hint(stringProvider.getString(R.string.create_room_name_section))
|
hint(stringProvider.getString(R.string.create_room_name_section))
|
||||||
|
endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT)
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
listener?.onNameChange(2, text)
|
listener?.onNameChange(2, text)
|
||||||
|
|
|
@ -3276,6 +3276,7 @@
|
||||||
<string name="create_spaces_room_public_header">What are some discussions you want to have in Runner’s World?</string>
|
<string name="create_spaces_room_public_header">What are some discussions you want to have in Runner’s World?</string>
|
||||||
<string name="create_spaces_room_public_header_desc">We’ll create rooms for them, and auto-join everyone. You can add more later too.</string>
|
<string name="create_spaces_room_public_header_desc">We’ll create rooms for them, and auto-join everyone. You can add more later too.</string>
|
||||||
<string name="create_spaces_default_public_room_name">General</string>
|
<string name="create_spaces_default_public_room_name">General</string>
|
||||||
|
<string name="create_spaces_default_public_random_room_name">Random</string>
|
||||||
<string name="create_spaces_loading_message">Creating Space…</string>
|
<string name="create_spaces_loading_message">Creating Space…</string>
|
||||||
<string name="invite_people_to_your_space">Invite people to your space</string>
|
<string name="invite_people_to_your_space">Invite people to your space</string>
|
||||||
<string name="invite_people_to_your_space_desc">It’s just you at the moment. %s will be even better with others.</string>
|
<string name="invite_people_to_your_space_desc">It’s just you at the moment. %s will be even better with others.</string>
|
||||||
|
|
Loading…
Reference in New Issue