mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 15:30:31 +05:30
Merge pull request #2958 from Isira-Seneviratne/Remove_TextViewCompat
Remove unnecessary TextViewCompat calls.
This commit is contained in:
commit
459d8f92ac
@ -1,9 +1,7 @@
|
||||
package com.github.libretube.ui.extensions
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.core.widget.TextViewCompat
|
||||
|
||||
fun TextView.setDrawables(
|
||||
start: Int? = null,
|
||||
@ -11,19 +9,10 @@ fun TextView.setDrawables(
|
||||
end: Int? = null,
|
||||
bottom: Int? = null
|
||||
) {
|
||||
setDrawables(
|
||||
setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||
start?.let { AppCompatResources.getDrawable(context, it) },
|
||||
top?.let { AppCompatResources.getDrawable(context, it) },
|
||||
end?.let { AppCompatResources.getDrawable(context, it) },
|
||||
bottom?.let { AppCompatResources.getDrawable(context, it) }
|
||||
)
|
||||
}
|
||||
|
||||
fun TextView.setDrawables(
|
||||
start: Drawable? = null,
|
||||
top: Drawable? = null,
|
||||
end: Drawable? = null,
|
||||
bottom: Drawable? = null
|
||||
) {
|
||||
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(this, start, top, end, bottom)
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.widget.TextViewCompat
|
||||
import com.github.libretube.R
|
||||
|
||||
/**
|
||||
@ -73,33 +72,4 @@ class DrawableTextView(
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
fun setDrawables(
|
||||
start: Drawable? = null,
|
||||
top: Drawable? = null,
|
||||
end: Drawable? = null,
|
||||
bottom: Drawable? = null
|
||||
) {
|
||||
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||
this,
|
||||
start,
|
||||
top,
|
||||
end,
|
||||
bottom
|
||||
)
|
||||
}
|
||||
|
||||
fun setDrawablesDimension(
|
||||
start: Float = drawableStartDimen,
|
||||
top: Float = drawableTopDimen,
|
||||
end: Float = drawableEndDimen,
|
||||
bottom: Float = drawableBottomDimen
|
||||
) {
|
||||
drawableStartDimen = start
|
||||
drawableTopDimen = top
|
||||
drawableEndDimen = end
|
||||
drawableBottomDimen = bottom
|
||||
|
||||
invalidate()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user