From 179474b975a2628c8b108dd85e6cd06661cab51a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 10 Jul 2020 17:51:57 +0200 Subject: [PATCH] Cleanup --- .../riotx/features/reactions/widget/ReactionButton.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/reactions/widget/ReactionButton.kt b/vector/src/main/java/im/vector/riotx/features/reactions/widget/ReactionButton.kt index ec5aba8ee5..140edaf03a 100644 --- a/vector/src/main/java/im/vector/riotx/features/reactions/widget/ReactionButton.kt +++ b/vector/src/main/java/im/vector/riotx/features/reactions/widget/ReactionButton.kt @@ -45,7 +45,8 @@ import javax.inject.Inject * An animated reaction button. * Displays a String reaction (emoji), with a count, and that can be selected or not (toggle) */ -class ReactionButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, +class ReactionButton @JvmOverloads constructor(context: Context, + attrs: AttributeSet? = null, defStyleAttr: Int = 0) : FrameLayout(context, attrs, defStyleAttr), View.OnClickListener, View.OnLongClickListener { @@ -110,9 +111,7 @@ class ReactionButton @JvmOverloads constructor(context: Context, attrs: Attribut countTextView?.text = TextUtils.formatCountToShortDecimal(reactionCount) // emojiView?.typeface = this.emojiTypeFace ?: Typeface.DEFAULT - context.withStyledAttributes(attrs, R.styleable.ReactionButton, defStyleAttr) { - onDrawable = ContextCompat.getDrawable(context, R.drawable.rounded_rect_shape) offDrawable = ContextCompat.getDrawable(context, R.drawable.rounded_rect_shape_off) @@ -143,9 +142,10 @@ class ReactionButton @JvmOverloads constructor(context: Context, attrs: Attribut val status = getBoolean(R.styleable.ReactionButton_toggled, false) setChecked(status) - setOnClickListener(this@ReactionButton) - setOnLongClickListener(this@ReactionButton) } + + setOnClickListener(this) + setOnLongClickListener(this) } private fun getDrawableFromResource(array: TypedArray, styleableIndexId: Int): Drawable? {