mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
Add usage of TypedArray.use when possible
This commit is contained in:
parent
4cfb79d566
commit
d62cf70b8c
3 changed files with 11 additions and 20 deletions
|
@ -22,6 +22,7 @@ import android.util.AttributeSet
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.content.res.use
|
||||||
import androidx.core.view.marginBottom
|
import androidx.core.view.marginBottom
|
||||||
import androidx.core.view.marginTop
|
import androidx.core.view.marginTop
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
|
@ -65,12 +66,8 @@ class MapTilerMapView @JvmOverloads constructor(
|
||||||
R.styleable.MapTilerMapView,
|
R.styleable.MapTilerMapView,
|
||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
).run {
|
).use {
|
||||||
try {
|
setLocateButtonVisibility(it)
|
||||||
setLocateButtonVisibility(this)
|
|
||||||
} finally {
|
|
||||||
recycle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dimensionConverter = DimensionConverter(resources)
|
dimensionConverter = DimensionConverter(resources)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.content.res.TypedArray
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import androidx.core.content.res.use
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.databinding.ViewLocationLiveEndedBannerBinding
|
import im.vector.app.databinding.ViewLocationLiveEndedBannerBinding
|
||||||
|
@ -42,13 +43,9 @@ class LocationLiveEndedBannerView @JvmOverloads constructor(
|
||||||
R.styleable.LocationLiveEndedBannerView,
|
R.styleable.LocationLiveEndedBannerView,
|
||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
).run {
|
).use {
|
||||||
try {
|
setBackgroundAlpha(it)
|
||||||
setBackgroundAlpha(this)
|
setIconMarginStart(it)
|
||||||
setIconMarginStart(this)
|
|
||||||
} finally {
|
|
||||||
recycle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import android.widget.ImageView
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.content.res.use
|
||||||
import androidx.core.view.setPadding
|
import androidx.core.view.setPadding
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.extensions.tintBackground
|
import im.vector.app.core.extensions.tintBackground
|
||||||
|
@ -50,13 +51,9 @@ class LocationSharingOptionView @JvmOverloads constructor(
|
||||||
R.styleable.LocationSharingOptionView,
|
R.styleable.LocationSharingOptionView,
|
||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
).run {
|
).use {
|
||||||
try {
|
setIcon(it)
|
||||||
setIcon(this)
|
setTitle(it)
|
||||||
setTitle(this)
|
|
||||||
} finally {
|
|
||||||
recycle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue