textDrawable #136

Merged
AmineB merged 8 commits from davidoskky/ReaderForSelfoss-multiplatform:textDrawable into master 2023-03-26 11:12:03 +00:00
Showing only changes of commit 1ad529067d - Show all commits

View File

@ -3,11 +3,9 @@ package bou.amine.apps.readerforselfossv2.android.utils.glide
import android.content.Context
import android.graphics.Bitmap
import android.widget.ImageView
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory
import bou.amine.apps.readerforselfossv2.android.utils.CircleImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.BitmapImageViewTarget
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.InputStream
@ -19,22 +17,6 @@ fun Context.bitmapCenterCrop(url: String, iv: ImageView) =
.apply(RequestOptions.centerCropTransform())
.into(iv)
fun Context.circularBitmapDrawable(url: String, iv: ImageView) =
Glide.with(this)
.asBitmap()
.load(url)
.apply(RequestOptions.centerCropTransform())
.into(object : BitmapImageViewTarget(iv) {
override fun setResource(resource: Bitmap?) {
val circularBitmapDrawable = RoundedBitmapDrawableFactory.create(
resources,
resource
)
circularBitmapDrawable.isCircular = true
iv.setImageDrawable(circularBitmapDrawable)
}
})
fun Context.circularDrawable(url: String, view: CircleImageView) {
view.textView.text =""