Print selected text

This commit is contained in:
M66B 2022-05-30 19:06:55 +02:00
parent 61c50ddbf3
commit 749fd99414
2 changed files with 8 additions and 1 deletions

View File

@ -6312,6 +6312,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Bundle args = new Bundle();
args.putLong("id", message.id);
args.putBoolean("headers", properties.getValue("headers", message.id));
args.putCharSequence("selected", getSelectedText());
if (prefs.getBoolean("print_html_confirmed", false)) {
Intent data = new Intent();

View File

@ -83,6 +83,7 @@ import android.text.Layout;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.format.DateUtils;
@ -9178,6 +9179,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean headers = args.getBoolean("headers");
boolean print_html_header = args.getBoolean("print_html_header");
boolean print_html_images = args.getBoolean("print_html_images");
CharSequence selected = args.getCharSequence("selected");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int timeout = prefs.getInt("timeout", ImageHelper.DOWNLOAD_TIMEOUT) * 1000;
@ -9195,7 +9197,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (attachments == null)
return null;
Document document = JsoupEx.parse(file);
Document document;
if (!TextUtils.isEmpty(selected) && selected instanceof Spanned)
document = JsoupEx.parse(HtmlHelper.toHtml((Spanned) selected, context));
else
document = JsoupEx.parse(file);
boolean monospaced_pre = prefs.getBoolean("monospaced_pre", false);
if (message.isPlainOnly() && monospaced_pre)