mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
update commons to 2.9.0
This commit is contained in:
parent
53444a5d57
commit
4c659df49d
3 changed files with 6 additions and 17 deletions
|
@ -32,7 +32,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.simplemobiletools:commons:2.8.9'
|
||||
compile 'com.simplemobiletools:commons:2.9.0'
|
||||
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
||||
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
|
||||
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.app.WallpaperManager
|
|||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.GridLayoutManager
|
||||
import android.util.Log
|
||||
|
@ -333,8 +332,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
} else {
|
||||
val file = File(path)
|
||||
val isVideo = file.isVideoFast()
|
||||
val isNougat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
|
||||
if (isVideo && !isNougat) {
|
||||
if (isVideo && !isNougatPlus()) {
|
||||
openWith(file, false)
|
||||
} else {
|
||||
Intent(this, ViewPagerActivity::class.java).apply {
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.app.Activity
|
|||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.support.v4.content.FileProvider
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.KeyCharacterMap
|
||||
|
@ -37,7 +36,7 @@ fun Activity.shareUri(medium: Medium, uri: Uri) {
|
|||
fun Activity.shareMedium(medium: Medium) {
|
||||
val shareTitle = resources.getString(R.string.share_via)
|
||||
val file = File(medium.path)
|
||||
val uri = getFileUri(file)
|
||||
val uri = getMyFileUri(file)
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_SEND
|
||||
putExtra(Intent.EXTRA_STREAM, uri)
|
||||
|
@ -55,7 +54,7 @@ fun Activity.shareMedia(media: List<Medium>) {
|
|||
type = "image/* video/*"
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
media.map { File(it.path) }
|
||||
.mapTo(uris) { getFileUri(it) }
|
||||
.mapTo(uris) { getMyFileUri(it) }
|
||||
|
||||
putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris)
|
||||
startActivity(Intent.createChooser(this, shareTitle))
|
||||
|
@ -63,7 +62,7 @@ fun Activity.shareMedia(media: List<Medium>) {
|
|||
}
|
||||
|
||||
fun Activity.setAsWallpaper(file: File) {
|
||||
val uri = getFileUri(file)
|
||||
val uri = getMyFileUri(file)
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_ATTACH_DATA
|
||||
setDataAndType(uri, file.getMimeType("image/*"))
|
||||
|
@ -79,7 +78,7 @@ fun Activity.setAsWallpaper(file: File) {
|
|||
}
|
||||
|
||||
fun Activity.openWith(file: File, forceChooser: Boolean = true) {
|
||||
val uri = getFileUri(file)
|
||||
val uri = getMyFileUri(file)
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
setDataAndType(uri, file.getMimeType("image/jpeg"))
|
||||
|
@ -109,14 +108,6 @@ fun Activity.openEditor(file: File) {
|
|||
}
|
||||
}
|
||||
|
||||
fun Activity.getFileUri(file: File): Uri {
|
||||
val isNougat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
|
||||
return if (isNougat)
|
||||
FileProvider.getUriForFile(this, "$packageName.provider", file)
|
||||
else
|
||||
Uri.fromFile(file)
|
||||
}
|
||||
|
||||
fun Activity.hasNavBar(): Boolean {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
val display = windowManager.defaultDisplay
|
||||
|
|
Loading…
Reference in a new issue