add ktlint plugin to project and apply default code style (#2209)
* add ktlint plugin to project and apply default code style * some manual adjustments, fix wildcard imports * update CONTRIBUTING.md * fix formatting
This commit is contained in:
parent
955267199e
commit
16ffcca748
227 changed files with 3933 additions and 3371 deletions
|
|
@ -11,41 +11,38 @@ import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
|||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.keylesspalace.tusky.R
|
||||
|
||||
|
||||
private val centerCropTransformation = CenterCrop()
|
||||
|
||||
fun loadAvatar(url: String?, imageView: ImageView, @Px radius: Int, animate: Boolean) {
|
||||
|
||||
if (url.isNullOrBlank()) {
|
||||
Glide.with(imageView)
|
||||
.load(R.drawable.avatar_default)
|
||||
.into(imageView)
|
||||
.load(R.drawable.avatar_default)
|
||||
.into(imageView)
|
||||
} else {
|
||||
if (animate) {
|
||||
Glide.with(imageView)
|
||||
.load(url)
|
||||
.transform(
|
||||
centerCropTransformation,
|
||||
RoundedCorners(radius)
|
||||
)
|
||||
.placeholder(R.drawable.avatar_default)
|
||||
.into(imageView)
|
||||
|
||||
.load(url)
|
||||
.transform(
|
||||
centerCropTransformation,
|
||||
RoundedCorners(radius)
|
||||
)
|
||||
.placeholder(R.drawable.avatar_default)
|
||||
.into(imageView)
|
||||
} else {
|
||||
Glide.with(imageView)
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.transform(
|
||||
centerCropTransformation,
|
||||
RoundedCorners(radius)
|
||||
)
|
||||
.placeholder(R.drawable.avatar_default)
|
||||
.into(imageView)
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.transform(
|
||||
centerCropTransformation,
|
||||
RoundedCorners(radius)
|
||||
)
|
||||
.placeholder(R.drawable.avatar_default)
|
||||
.into(imageView)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun decodeBlurHash(context: Context, blurhash: String): BitmapDrawable {
|
||||
return BitmapDrawable(context.resources, BlurHashDecoder.decode(blurhash, 32, 32, 1f))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue