mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Design review fixes.
This commit is contained in:
parent
cbe07c4aee
commit
a10253c003
@ -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>
|
@ -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>
|
@ -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>
|
10
library/ui-styles/src/main/res/values/styles_polls.xml
Normal file
10
library/ui-styles/src/main/res/values/styles_polls.xml
Normal 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>
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user