Skip to content

Instantly share code, notes, and snippets.

View alirezazarghi's full-sized avatar

Ali Reza Zarghi alirezazarghi

View GitHub Profile
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.VectorConverter
import androidx.compose.animation.core.spring
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.forEachGesture
@AsheeshSharma
AsheeshSharma / dynamic_aspect_ratio.kt
Last active December 27, 2022 08:24
Dynamic aspect ratio handling with glide
fun setUpOneDimenNoAspectRatioImage(imageUrl: String?, imageView: AppCompatImageView, @DimenRes defaultHeight: Int, @DimenRes marginToBeAdjusted: Int, availableWidth: Int? = null) {
if (imageUrl?.isNotEmpty() == true) {
imageView.visibility = View.VISIBLE
GlideApp.with(imageView.context)
.load(imageUrl)
.centerCrop()
.into(object : CustomTarget<Drawable>() {
override fun onLoadFailed(errorDrawable: Drawable?) {
}