Glimpse: Hook up adjust button

Change-Id: Id72ec262b0a237b7f07b16f465912eb19cf705e8
This commit is contained in:
Luca Stefani 2023-08-07 18:48:15 +02:00 committed by Sebastiano Barezzi
parent b57d776fc2
commit 568bd417f2
2 changed files with 14 additions and 0 deletions

View File

@ -7,9 +7,16 @@ package org.lineageos.glimpse.ext
import android.content.Intent
import android.net.Uri
import org.lineageos.glimpse.models.Media
fun Intent.shareIntent(vararg uris: Uri) = apply {
action = Intent.ACTION_SEND_MULTIPLE
putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris.toCollection(ArrayList()))
type = "*/*"
}
fun Intent.editIntent(media: Media) = apply {
action = Intent.ACTION_EDIT
setDataAndType(media.externalContentUri, media.mimeType)
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
}

View File

@ -285,6 +285,13 @@ class MediaViewerFragment : Fragment(
}
}
adjustButton.setOnClickListener {
mediaViewerAdapter.getMediaFromMediaStore(viewPager.currentItem)?.let {
val intent = Intent().editIntent(it)
startActivity(Intent.createChooser(intent, null))
}
}
if (!permissionsUtils.mainPermissionsGranted()) {
mainPermissionsRequestLauncher.launch(PermissionsUtils.mainPermissions)
} else {