Prevent play button displayed above videos to be displayed above images as well
This commit is contained in:
parent
29e8542803
commit
ba1708beaa
2 changed files with 7 additions and 1 deletions
|
@ -547,7 +547,7 @@ fun loadAvatarWithCoil(imageView: ImageView, path: String?) {
|
||||||
|
|
||||||
@BindingAdapter("coilVideoPreview")
|
@BindingAdapter("coilVideoPreview")
|
||||||
fun loadVideoPreview(imageView: ImageView, path: String?) {
|
fun loadVideoPreview(imageView: ImageView, path: String?) {
|
||||||
if (!path.isNullOrEmpty()) {
|
if (!path.isNullOrEmpty() && FileUtils.isExtensionVideo(path)) {
|
||||||
imageView.load(path) {
|
imageView.load(path) {
|
||||||
videoFrameMillis(0)
|
videoFrameMillis(0)
|
||||||
listener(
|
listener(
|
||||||
|
|
|
@ -91,6 +91,12 @@ class FileUtils {
|
||||||
return getMimeType(type) == MimeType.Image
|
return getMimeType(type) == MimeType.Image
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isExtensionVideo(path: String): Boolean {
|
||||||
|
val extension = getExtensionFromFileName(path)
|
||||||
|
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
||||||
|
return getMimeType(type) == MimeType.Video
|
||||||
|
}
|
||||||
|
|
||||||
fun clearExistingPlainFiles() {
|
fun clearExistingPlainFiles() {
|
||||||
val dir = File(corePreferences.vfsCachePath)
|
val dir = File(corePreferences.vfsCachePath)
|
||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
|
|
Loading…
Reference in a new issue