Design review fixes.

This commit is contained in:
Onuray Sahin 2021-11-08 17:26:01 +03:00
parent cbe07c4aee
commit a10253c003
9 changed files with 52 additions and 3 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?vctr_content_tertiary" android:state_enabled="false" />
<item android:color="?vctr_content_tertiary" android:state_focused="false" />
<item android:color="?colorPrimary" />
</selector>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?colorPrimary" android:state_focused="true"/>
<item android:color="?colorPrimary" android:state_hovered="true"/>
<item android:color="?colorPrimary" android:state_enabled="false"/>
<item android:color="?vctr_content_quinary"/>
</selector>

View File

@ -19,4 +19,9 @@
<item name="android:textColor">?vctr_message_text_color</item>
</style>
<style name="Widget.Vector.EditText.Form" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="boxStrokeColor">@color/form_edit_text_stroke_color_selector</item>
<item name="android:textColorHint">@color/form_edit_text_hint_color_selector</item>
</style>
</resources>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Widget.Vector.Button.CreatePoll" parent="Widget.Vector.Button">
<item name="android:backgroundTint">@color/button_background_tint_selector</item>
<item name="android:textAppearance">@style/TextAppearance.Vector.Button</item>
<item name="android:textColor">@android:color/white</item>
</style>
</resources>

View File

@ -44,6 +44,12 @@ abstract class FormEditTextWithDeleteItem : VectorEpoxyModel<FormEditTextWithDel
@EpoxyAttribute
var enabled: Boolean = true
@EpoxyAttribute
var singleLine: Boolean = true
@EpoxyAttribute
var imeOptions: Int? = null
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
var onTextChange: TextListener? = null
@ -64,6 +70,12 @@ abstract class FormEditTextWithDeleteItem : VectorEpoxyModel<FormEditTextWithDel
holder.textInputEditText.setTextIfDifferent(value)
holder.textInputEditText.isEnabled = enabled
if (singleLine) {
holder.textInputEditText.setSingleLine()
}
imeOptions?.let {
holder.textInputEditText.imeOptions = it
}
holder.textInputEditText.addTextChangedListenerOnce(onTextChangeListener)

View File

@ -17,6 +17,7 @@
package im.vector.app.features.poll.create
import android.view.Gravity
import android.view.inputmethod.EditorInfo
import com.airbnb.epoxy.EpoxyController
import im.vector.app.R
import im.vector.app.core.resources.ColorProvider
@ -69,10 +70,13 @@ class CreatePollController @Inject constructor(
}
currentState.options.forEachIndexed { index, option ->
val imeOptions = if (index == currentState.options.size -1) EditorInfo.IME_ACTION_DONE else EditorInfo.IME_ACTION_NEXT
formEditTextWithDeleteItem {
id("option_$index")
value(option)
hint(host.stringProvider.getString(R.string.create_poll_options_hint, (index + 1)))
singleLine(true)
imeOptions(imeOptions)
onTextChange {
host.callback?.onOptionChanged(index, it)
}

View File

@ -14,7 +14,8 @@
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/createPollToolbar"
android:layout_width="match_parent"
android:layout_height="?actionBarSize">
android:layout_height="?actionBarSize"
app:contentInsetStart="0dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -72,11 +73,13 @@
<Button
android:id="@+id/createPollButton"
style="@style/Widget.Vector.Button.CreatePoll"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_margin="16dp"
android:text="@string/create_poll_button"
app:layout_constraintBottom_toBottomOf="parent" />
app:layout_constraintBottom_toBottomOf="parent"
tools:enabled="false" />
<TextView
android:id="@+id/createPollToast"
@ -84,8 +87,8 @@
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginBottom="84dp"
android:visibility="gone"
android:accessibilityLiveRegion="polite"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View File

@ -9,6 +9,7 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/formTextInputTextInputLayout"
style="@style/Widget.Vector.EditText.Form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_horizontal_margin"

View File

@ -9,6 +9,7 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/formTextInputTextInputLayout"
style="@style/Widget.Vector.EditText.Form"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_horizontal_margin"