Glimpse: Hook up adjust button
Change-Id: Id72ec262b0a237b7f07b16f465912eb19cf705e8
This commit is contained in:
parent
b57d776fc2
commit
568bd417f2
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue