change the way third party photos are shared
This commit is contained in:
parent
5177530b0e
commit
6c7fc3683e
3 changed files with 12 additions and 3 deletions
|
@ -104,7 +104,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.menu_set_as_wallpaper -> setAsWallpaper(File(mMedium!!.path))
|
R.id.menu_set_as_wallpaper -> setAsWallpaper(File(mMedium!!.path))
|
||||||
R.id.menu_open_with -> openWith(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))
|
R.id.menu_edit -> openEditor(File(mMedium!!.path))
|
||||||
else -> return super.onOptionsItemSelected(item)
|
else -> return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,16 @@ import com.simplemobiletools.gallery.models.Medium
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
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) {
|
fun Activity.shareMedium(medium: Medium) {
|
||||||
val shareTitle = resources.getString(R.string.share_via)
|
val shareTitle = resources.getString(R.string.share_via)
|
||||||
val file = File(medium.path)
|
val file = File(medium.path)
|
||||||
|
|
|
@ -55,8 +55,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
exif.setTagValue(ExifInterface.TAG_ORIENTATION, 1)
|
exif.setTagValue(ExifInterface.TAG_ORIENTATION, 1)
|
||||||
exif.removeCompressedThumbnail()
|
exif.removeCompressedThumbnail()
|
||||||
|
|
||||||
val uri = Uri.parse(originalPath)
|
val file = File(context.externalCacheDir, Uri.parse(originalPath).lastPathSegment)
|
||||||
val file = File(context.cacheDir, uri.lastPathSegment)
|
|
||||||
var out: FileOutputStream? = null
|
var out: FileOutputStream? = null
|
||||||
try {
|
try {
|
||||||
out = FileOutputStream(file)
|
out = FileOutputStream(file)
|
||||||
|
|
Loading…
Reference in a new issue