mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-06 09:03:56 +02:00
Improved sharing
This commit is contained in:
@@ -315,8 +315,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
|
||||
private static final int MAX_RECIPIENTS_COMPACT = 3;
|
||||
private static final int MAX_RECIPIENTS_NORMAL = 7;
|
||||
private static final int MAX_QUOTE_LEVEL = 3;
|
||||
private static final int MAX_TRANSLATABLE_TEXT_SIZE = 50 * 1024;
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements
|
||||
View.OnClickListener,
|
||||
@@ -5249,7 +5247,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
String link = "message://email.faircode.eu/link/#" + message.id;
|
||||
|
||||
Document document = JsoupEx.parse(file);
|
||||
HtmlHelper.truncate(document, HtmlHelper.MAX_FULL_TEXT_SIZE / 2);
|
||||
HtmlHelper.truncate(document, HtmlHelper.MAX_SHARE_TEXT_SIZE);
|
||||
|
||||
Element a = document.createElement("a");
|
||||
a.text(context.getString(R.string.app_name));
|
||||
@@ -5442,9 +5440,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", message.id);
|
||||
|
||||
new SimpleTask<String>() {
|
||||
new SimpleTask<File>() {
|
||||
@Override
|
||||
protected String onExecute(Context context, Bundle args) throws IOException {
|
||||
protected File onExecute(Context context, Bundle args) throws IOException {
|
||||
Long id = args.getLong("id");
|
||||
|
||||
File file = EntityMessage.getFile(context, id);
|
||||
@@ -5462,15 +5460,19 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
element.attr("computed", computed);
|
||||
}
|
||||
|
||||
return d.html();
|
||||
File dir = new File(context.getCacheDir(), "shared");
|
||||
if (!dir.exists())
|
||||
dir.mkdir();
|
||||
|
||||
File share = new File(dir, message.id + ".txt");
|
||||
Helper.writeText(share, d.html());
|
||||
|
||||
return share;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, String html) {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, html);
|
||||
context.startActivity(intent);
|
||||
protected void onExecuted(Bundle args, File share) {
|
||||
Helper.share(context, share, "text/plain", share.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -7017,7 +7019,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
String html = Helper.readText(file);
|
||||
Document d = HtmlHelper.sanitizeCompose(context, html, false);
|
||||
d.select("blockquote").remove();
|
||||
HtmlHelper.truncate(d, MAX_TRANSLATABLE_TEXT_SIZE);
|
||||
HtmlHelper.truncate(d, HtmlHelper.MAX_TRANSLATABLE_TEXT_SIZE);
|
||||
SpannableStringBuilder ssb = HtmlHelper.fromDocument(context, d, null, null);
|
||||
return ssb.toString()
|
||||
.replace("\uFFFC", "") // Object replacement character
|
||||
|
||||
Reference in New Issue
Block a user