mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
update commons, use our custom map for determining file mimetype
This commit is contained in:
parent
7ad578ec2e
commit
3e7d67a3a2
4 changed files with 5 additions and 6 deletions
|
@ -37,7 +37,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.simplemobiletools:commons:2.31.4'
|
||||
compile 'com.simplemobiletools:commons:2.31.10'
|
||||
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
||||
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
|
||||
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
||||
|
|
|
@ -480,7 +480,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
private fun fillIntentPath(resultData: Intent, resultIntent: Intent) {
|
||||
val path = resultData.data.path
|
||||
val uri = Uri.fromFile(File(path))
|
||||
val type = File(path).getMimeType("image/jpeg")
|
||||
val type = path.getMimeTypeFromPath()
|
||||
resultIntent.setDataAndTypeAndNormalize(uri, type)
|
||||
resultIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ fun Activity.setAs(uri: Uri, file: File, showToast: Boolean = true): Boolean {
|
|||
var success = false
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_ATTACH_DATA
|
||||
setDataAndType(uri, file.getMimeType("image/*"))
|
||||
setDataAndType(uri, file.getMimeType())
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
val chooser = Intent.createChooser(this, getString(R.string.set_as))
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package com.simplemobiletools.gallery.models
|
||||
|
||||
import com.simplemobiletools.commons.extensions.getMimeType
|
||||
import com.simplemobiletools.commons.extensions.getMimeTypeFromPath
|
||||
import com.simplemobiletools.commons.extensions.isGif
|
||||
import com.simplemobiletools.commons.extensions.isPng
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
|
||||
data class Medium(var name: String, var path: String, val video: Boolean, val modified: Long, val taken: Long, val size: Long) : Serializable, Comparable<Medium> {
|
||||
|
@ -21,7 +20,7 @@ data class Medium(var name: String, var path: String, val video: Boolean, val mo
|
|||
|
||||
fun isImage() = !isGif() && !video
|
||||
|
||||
fun getMimeType() = File(path).getMimeType()
|
||||
fun getMimeType() = path.getMimeTypeFromPath()
|
||||
|
||||
override fun compareTo(other: Medium): Int {
|
||||
var result: Int
|
||||
|
|
Loading…
Reference in a new issue