show an error if the user tries sharing too much data

This commit is contained in:
tibbi 2017-10-28 19:56:33 +02:00
parent 75c9d28547
commit 1dad41fdf7
2 changed files with 7 additions and 2 deletions

View file

@ -37,7 +37,7 @@ android {
}
dependencies {
compile 'com.simplemobiletools:commons:2.32.12'
compile 'com.simplemobiletools:commons:2.32.15'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'

View file

@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.extensions
import android.app.Activity
import android.content.Intent
import android.net.Uri
import android.os.TransactionTooLargeException
import android.provider.MediaStore
import android.support.v7.app.AppCompatActivity
import android.view.View
@ -61,7 +62,11 @@ fun Activity.shareMedia(media: List<Medium>) {
type = uris.getMimeType()
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris)
startActivity(Intent.createChooser(this, shareTitle))
try {
startActivity(Intent.createChooser(this, shareTitle))
} catch (e: TransactionTooLargeException) {
toast(R.string.maximum_share_reached)
}
}
}