Skip to content

Commit

Permalink
Merge pull request #5179 from vector-im/feature/ons/fix_poll_option_a…
Browse files Browse the repository at this point in the history
…nimation

Remove redundant highlight on add poll option button
  • Loading branch information
onurays authored Feb 9, 2022
2 parents c28a20d + f6a24e9 commit e710632
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/5178.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove redundant highlight on add poll option button
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import android.graphics.Typeface
import android.view.Gravity
import androidx.annotation.ColorInt
import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import com.google.android.material.button.MaterialButton
Expand Down Expand Up @@ -55,6 +56,9 @@ abstract class GenericButtonItem : VectorEpoxyModel<GenericButtonItem.Holder>()
@EpoxyAttribute
var bold: Boolean = false

@EpoxyAttribute
var highlight: Boolean = true

override fun bind(holder: Holder) {
super.bind(holder)
holder.button.text = text
Expand All @@ -70,6 +74,12 @@ abstract class GenericButtonItem : VectorEpoxyModel<GenericButtonItem.Holder>()
val textStyle = if (bold) Typeface.BOLD else Typeface.NORMAL
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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class CreatePollController @Inject constructor(
textColor(host.colorProvider.getColor(R.color.palette_element_green))
gravity(Gravity.START)
bold(true)
highlight(false)
buttonClickAction {
host.callback?.onAddOption()
}
Expand Down

0 comments on commit e710632

Please sign in to comment.