Merge pull request #5179 from vector-im/feature/ons/fix_poll_option_animation

Remove redundant highlight on add poll option button
This commit is contained in:
Onuray Sahin 2022-02-09 22:24:54 +03:00 committed by GitHub
commit e71063222b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

1
changelog.d/5178.bugfix Normal file
View File

@ -0,0 +1 @@
Remove redundant highlight on add poll option button

View File

@ -19,6 +19,7 @@ import android.graphics.Typeface
import android.view.Gravity import android.view.Gravity
import androidx.annotation.ColorInt import androidx.annotation.ColorInt
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass import com.airbnb.epoxy.EpoxyModelClass
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
@ -55,6 +56,9 @@ abstract class GenericButtonItem : VectorEpoxyModel<GenericButtonItem.Holder>()
@EpoxyAttribute @EpoxyAttribute
var bold: Boolean = false var bold: Boolean = false
@EpoxyAttribute
var highlight: Boolean = true
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder) super.bind(holder)
holder.button.text = text holder.button.text = text
@ -70,6 +74,12 @@ abstract class GenericButtonItem : VectorEpoxyModel<GenericButtonItem.Holder>()
val textStyle = if (bold) Typeface.BOLD else Typeface.NORMAL val textStyle = if (bold) Typeface.BOLD else Typeface.NORMAL
holder.button.setTypeface(null, textStyle) holder.button.setTypeface(null, textStyle)
holder.button.rippleColor = if (highlight) {
ContextCompat.getColorStateList(holder.view.context, R.color.mtrl_btn_text_btn_ripple_color)
} else {
null
}
holder.button.onClick(buttonClickAction) holder.button.onClick(buttonClickAction)
} }

View File

@ -121,6 +121,7 @@ class CreatePollController @Inject constructor(
textColor(host.colorProvider.getColor(R.color.palette_element_green)) textColor(host.colorProvider.getColor(R.color.palette_element_green))
gravity(Gravity.START) gravity(Gravity.START)
bold(true) bold(true)
highlight(false)
buttonClickAction { buttonClickAction {
host.callback?.onAddOption() host.callback?.onAddOption()
} }