mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2024-12-23 06:36:27 +01:00
change the way third party photos are shared
This commit is contained in:
parent
5177530b0e
commit
6c7fc3683e
@ -104,7 +104,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||
when (item.itemId) {
|
||||
R.id.menu_set_as_wallpaper -> setAsWallpaper(File(mMedium!!.path))
|
||||
R.id.menu_open_with -> openWith(File(mMedium!!.path))
|
||||
R.id.menu_share -> shareMedium(mMedium!!)
|
||||
R.id.menu_share -> shareUri(mMedium!!, mUri)
|
||||
R.id.menu_edit -> openEditor(File(mMedium!!.path))
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
@ -22,6 +22,16 @@ import com.simplemobiletools.gallery.models.Medium
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
fun Activity.shareUri(medium: Medium, uri: Uri) {
|
||||
val shareTitle = resources.getString(R.string.share_via)
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_SEND
|
||||
putExtra(Intent.EXTRA_STREAM, uri)
|
||||
type = medium.getMimeType()
|
||||
startActivity(Intent.createChooser(this, shareTitle))
|
||||
}
|
||||
}
|
||||
|
||||
fun Activity.shareMedium(medium: Medium) {
|
||||
val shareTitle = resources.getString(R.string.share_via)
|
||||
val file = File(medium.path)
|
||||
|
@ -55,8 +55,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||
exif.setTagValue(ExifInterface.TAG_ORIENTATION, 1)
|
||||
exif.removeCompressedThumbnail()
|
||||
|
||||
val uri = Uri.parse(originalPath)
|
||||
val file = File(context.cacheDir, uri.lastPathSegment)
|
||||
val file = File(context.externalCacheDir, Uri.parse(originalPath).lastPathSegment)
|
||||
var out: FileOutputStream? = null
|
||||
try {
|
||||
out = FileOutputStream(file)
|
||||
|
Loading…
Reference in New Issue
Block a user