Add usage of TypedArray.use when possible
This commit is contained in:
parent
4cfb79d566
commit
d62cf70b8c
|
@ -22,6 +22,7 @@ import android.util.AttributeSet
|
|||
import android.view.Gravity
|
||||
import android.widget.ImageView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.use
|
||||
import androidx.core.view.marginBottom
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.core.view.updateLayoutParams
|
||||
|
@ -65,12 +66,8 @@ class MapTilerMapView @JvmOverloads constructor(
|
|||
R.styleable.MapTilerMapView,
|
||||
0,
|
||||
0
|
||||
).run {
|
||||
try {
|
||||
setLocateButtonVisibility(this)
|
||||
} finally {
|
||||
recycle()
|
||||
}
|
||||
).use {
|
||||
setLocateButtonVisibility(it)
|
||||
}
|
||||
dimensionConverter = DimensionConverter(resources)
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.content.res.TypedArray
|
|||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.res.use
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import im.vector.app.R
|
||||
import im.vector.app.databinding.ViewLocationLiveEndedBannerBinding
|
||||
|
@ -42,13 +43,9 @@ class LocationLiveEndedBannerView @JvmOverloads constructor(
|
|||
R.styleable.LocationLiveEndedBannerView,
|
||||
0,
|
||||
0
|
||||
).run {
|
||||
try {
|
||||
setBackgroundAlpha(this)
|
||||
setIconMarginStart(this)
|
||||
} finally {
|
||||
recycle()
|
||||
}
|
||||
).use {
|
||||
setBackgroundAlpha(it)
|
||||
setIconMarginStart(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.widget.ImageView
|
|||
import androidx.annotation.ColorInt
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.use
|
||||
import androidx.core.view.setPadding
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.tintBackground
|
||||
|
@ -50,13 +51,9 @@ class LocationSharingOptionView @JvmOverloads constructor(
|
|||
R.styleable.LocationSharingOptionView,
|
||||
0,
|
||||
0
|
||||
).run {
|
||||
try {
|
||||
setIcon(this)
|
||||
setTitle(this)
|
||||
} finally {
|
||||
recycle()
|
||||
}
|
||||
).use {
|
||||
setIcon(it)
|
||||
setTitle(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue