Fix missing recycle call and ensure this mistake will not happen again

This commit is contained in:
Benoit Marty 2020-02-27 14:30:49 +01:00
parent bc9493d5b9
commit a1466e299b
3 changed files with 4 additions and 3 deletions

View File

@ -30,6 +30,7 @@
<issue id="SetTextI18n" severity="error" />
<issue id="ViewConstructor" severity="error" />
<issue id="UseValueOf" severity="error" />
<issue id="Recycle" severity="error" />
<!-- Ignore error from HtmlCompressor lib -->
<issue id="InvalidPackage">

View File

@ -129,7 +129,7 @@ class BadgeFloatingActionButton @JvmOverloads constructor(
attrs?.let { initAttrs(attrs) }
}
@SuppressWarnings("ResourceType", "Recycle")
@SuppressWarnings("Recycle")
private fun initAttrs(attrs: AttributeSet) {
context.obtainStyledAttributes(attrs, R.styleable.BadgeFloatingActionButton).use {
counterBackgroundColor = it.getColor(R.styleable.BadgeFloatingActionButton_badgeBackgroundColor, 0)

View File

@ -73,11 +73,11 @@ class PollResultLineView @JvmOverloads constructor(
orientation = HORIZONTAL
ButterKnife.bind(this)
val typedArray = context.obtainStyledAttributes(attrs,
R.styleable.PollResultLineView, 0, 0)
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.PollResultLineView, 0, 0)
label = typedArray.getString(R.styleable.PollResultLineView_optionName) ?: ""
percent = typedArray.getString(R.styleable.PollResultLineView_optionCount) ?: ""
optionSelected = typedArray.getBoolean(R.styleable.PollResultLineView_optionSelected, false)
isWinner = typedArray.getBoolean(R.styleable.PollResultLineView_optionIsWinner, false)
typedArray.recycle()
}
}