mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-19 21:20:39 +01:00
use rounded corners imageview instead of rounding it ourselves
This commit is contained in:
parent
9052c5183d
commit
5e97a97e5f
@ -18,7 +18,6 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
|
|||||||
import com.bumptech.glide.load.engine.GlideException
|
import com.bumptech.glide.load.engine.GlideException
|
||||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||||
import com.bumptech.glide.load.resource.bitmap.FitCenter
|
import com.bumptech.glide.load.resource.bitmap.FitCenter
|
||||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
|
||||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
|
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
|
||||||
import com.bumptech.glide.request.RequestListener
|
import com.bumptech.glide.request.RequestListener
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
@ -50,7 +49,6 @@ import kotlinx.android.synthetic.main.item_thread_success.view.*
|
|||||||
class ThreadAdapter(
|
class ThreadAdapter(
|
||||||
activity: SimpleActivity, var messages: ArrayList<ThreadItem>, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit
|
activity: SimpleActivity, var messages: ArrayList<ThreadItem>, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit
|
||||||
) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
|
) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
|
||||||
private val roundedCornersRadius = resources.getDimension(R.dimen.normal_margin).toInt()
|
|
||||||
private var fontSize = activity.getTextSize()
|
private var fontSize = activity.getTextSize()
|
||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
@ -285,7 +283,7 @@ class ThreadAdapter(
|
|||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||||
.placeholder(placeholderDrawable)
|
.placeholder(placeholderDrawable)
|
||||||
.transform(transformation, RoundedCorners(roundedCornersRadius))
|
.transform(transformation)
|
||||||
|
|
||||||
var builder = Glide.with(context)
|
var builder = Glide.with(context)
|
||||||
.load(uri)
|
.load(uri)
|
||||||
@ -302,8 +300,10 @@ class ThreadAdapter(
|
|||||||
false
|
false
|
||||||
})
|
})
|
||||||
|
|
||||||
if (isTallImage) {
|
builder = if (isTallImage) {
|
||||||
builder = builder.override(attachment.width, attachment.width)
|
builder.override(attachment.width, attachment.width)
|
||||||
|
} else {
|
||||||
|
builder.override(attachment.width, attachment.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.into(imageView.attachment_image)
|
builder.into(imageView.attachment_image)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
<com.google.android.material.imageview.ShapeableImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/attachment_image"
|
android:id="@+id/attachment_image"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:paddingBottom="@dimen/medium_margin" />
|
android:paddingBottom="@dimen/medium_margin"
|
||||||
|
app:shapeAppearanceOverlay="@style/roundedImageView" />
|
||||||
|
@ -2,4 +2,8 @@
|
|||||||
|
|
||||||
<style name="AppTheme" parent="AppTheme.Base" />
|
<style name="AppTheme" parent="AppTheme.Base" />
|
||||||
|
|
||||||
|
<style name="roundedImageView" parent="">
|
||||||
|
<item name="cornerFamily">rounded</item>
|
||||||
|
<item name="cornerSize">@dimen/normal_margin</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user