show a Play icon at video MMS items
This commit is contained in:
parent
18f8b271e1
commit
e792ff37ab
|
@ -36,7 +36,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.25.7'
|
||||
implementation 'com.simplemobiletools:commons:5.25.8'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
|
||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
implementation 'com.klinkerapps:android-smsmms:5.2.6'
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
package com.simplemobiletools.smsmessenger.adapters
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.Menu
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.DataSource
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.load.engine.GlideException
|
||||
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.request.RequestListener
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.bumptech.glide.request.target.Target
|
||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
|
@ -25,7 +30,6 @@ import com.simplemobiletools.smsmessenger.models.Message
|
|||
import com.simplemobiletools.smsmessenger.models.ThreadDateTime
|
||||
import com.simplemobiletools.smsmessenger.models.ThreadError
|
||||
import com.simplemobiletools.smsmessenger.models.ThreadItem
|
||||
import kotlinx.android.synthetic.main.item_contact_with_number.view.*
|
||||
import kotlinx.android.synthetic.main.item_received_message.view.*
|
||||
import kotlinx.android.synthetic.main.item_thread_date_time.view.*
|
||||
|
||||
|
@ -195,6 +199,15 @@ class ThreadAdapter(
|
|||
.load(uri)
|
||||
.transition(DrawableTransitionOptions.withCrossFade())
|
||||
.apply(options)
|
||||
.listener(object : RequestListener<Drawable> {
|
||||
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
|
||||
thread_message_play_outline.beGone()
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onResourceReady(dr: Drawable?, a: Any?, t: Target<Drawable>?, d: DataSource?, i: Boolean) = false
|
||||
|
||||
})
|
||||
.into(thread_message_image)
|
||||
|
||||
thread_message_image.setOnClickListener {
|
||||
|
@ -206,6 +219,8 @@ class ThreadAdapter(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
thread_message_play_outline.beVisibleIf(type.startsWith("video/"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,16 @@
|
|||
android:layout_toEndOf="@+id/thread_message_photo"
|
||||
android:adjustViewBounds="true" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thread_message_play_outline"
|
||||
android:layout_width="@dimen/play_outline_size"
|
||||
android:layout_height="@dimen/play_outline_size"
|
||||
android:layout_alignEnd="@+id/thread_message_image"
|
||||
android:layout_alignBottom="@+id/thread_message_image"
|
||||
android:layout_margin="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_play_outline"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/thread_message_body"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -24,6 +24,16 @@
|
|||
android:layout_marginBottom="@dimen/medium_margin"
|
||||
android:adjustViewBounds="true" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thread_message_play_outline"
|
||||
android:layout_width="@dimen/play_outline_size"
|
||||
android:layout_height="@dimen/play_outline_size"
|
||||
android:layout_alignEnd="@+id/thread_message_image"
|
||||
android:layout_alignBottom="@+id/thread_message_image"
|
||||
android:layout_margin="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_play_outline"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/thread_message_body"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
<resources>
|
||||
<dimen name="notification_large_icon_size">72dp</dimen>
|
||||
<dimen name="avatar_size">40dp</dimen>
|
||||
<dimen name="play_outline_size">36dp</dimen>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue