|
|
@ -20,6 +20,7 @@ package eu.faircode.email;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
import android.app.NotificationManager;
|
|
|
|
import android.app.NotificationManager;
|
|
|
|
|
|
|
|
import android.content.ClipData;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
@ -40,6 +41,7 @@ import androidx.preference.PreferenceManager;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
@ -216,26 +218,40 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
|
|
|
|
if (!TextUtils.isEmpty(html))
|
|
|
|
if (!TextUtils.isEmpty(html))
|
|
|
|
args.putString("body", html);
|
|
|
|
args.putString("body", html);
|
|
|
|
|
|
|
|
|
|
|
|
if (intent.hasExtra(Intent.EXTRA_STREAM))
|
|
|
|
ArrayList<Uri> uris = new ArrayList<>();
|
|
|
|
if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
|
|
|
|
|
|
|
|
ArrayList<Uri> streams = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
|
|
|
ClipData clip = intent.getClipData();
|
|
|
|
if (streams != null) {
|
|
|
|
if (clip != null)
|
|
|
|
// Some apps send null streams
|
|
|
|
for (int i = 0; i < clip.getItemCount(); i++) {
|
|
|
|
ArrayList<Uri> uris = new ArrayList<>();
|
|
|
|
ClipData.Item item = clip.getItemAt(i);
|
|
|
|
for (Uri stream : streams)
|
|
|
|
Uri stream = (item == null ? null : item.getUri());
|
|
|
|
if (stream != null)
|
|
|
|
if (stream != null)
|
|
|
|
uris.add(stream);
|
|
|
|
|
|
|
|
if (uris.size() > 0)
|
|
|
|
|
|
|
|
args.putParcelableArrayList("attachments", uris);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Uri stream = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
|
|
|
|
|
|
|
if (stream != null) {
|
|
|
|
|
|
|
|
ArrayList<Uri> uris = new ArrayList<>();
|
|
|
|
|
|
|
|
uris.add(stream);
|
|
|
|
uris.add(stream);
|
|
|
|
args.putParcelableArrayList("attachments", uris);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (intent.hasExtra(Intent.EXTRA_STREAM)) {
|
|
|
|
|
|
|
|
ArrayList<Uri> streams = (Intent.ACTION_SEND_MULTIPLE.equals(action)
|
|
|
|
|
|
|
|
? intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM)
|
|
|
|
|
|
|
|
: new ArrayList<>(Arrays.asList((Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM))));
|
|
|
|
|
|
|
|
if (streams != null) {
|
|
|
|
|
|
|
|
// Some apps send null streams
|
|
|
|
|
|
|
|
for (Uri stream : streams)
|
|
|
|
|
|
|
|
if (stream != null) {
|
|
|
|
|
|
|
|
boolean found = false;
|
|
|
|
|
|
|
|
for (Uri e : uris)
|
|
|
|
|
|
|
|
if (stream.equals(e)) {
|
|
|
|
|
|
|
|
found = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
|
|
|
|
uris.add(stream);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uris.size() > 0)
|
|
|
|
|
|
|
|
args.putParcelableArrayList("attachments", uris);
|
|
|
|
|
|
|
|
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
args = intent.getExtras();
|
|
|
|
args = intent.getExtras();
|
|
|
|
|
|
|
|
|
|
|
|