Added optiont to disabling printing of block quotes

This commit is contained in:
M66B
2023-10-08 17:07:03 +02:00
parent 08a7011335
commit f3d13efc90
4 changed files with 37 additions and 2 deletions

View File

@@ -77,6 +77,7 @@ public class FragmentDialogPrint extends FragmentDialogBase {
View dview = LayoutInflater.from(context).inflate(R.layout.dialog_print, null);
CheckBox cbHeader = dview.findViewById(R.id.cbHeader);
CheckBox cbImages = dview.findViewById(R.id.cbImages);
CheckBox cbBlockQuotes = dview.findViewById(R.id.cbBlockQuotes);
CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
cbHeader.setChecked(prefs.getBoolean("print_html_header", true));
@@ -95,6 +96,14 @@ public class FragmentDialogPrint extends FragmentDialogBase {
}
});
cbBlockQuotes.setChecked(prefs.getBoolean("print_html_block_quotes", true));
cbBlockQuotes.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
prefs.edit().putBoolean("print_html_block_quotes", isChecked).apply();
}
});
cbNotAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@@ -128,9 +137,11 @@ public class FragmentDialogPrint extends FragmentDialogBase {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
boolean print_html_header = prefs.getBoolean("print_html_header", true);
boolean print_html_images = prefs.getBoolean("print_html_images", true);
boolean print_html_block_quotes = prefs.getBoolean("print_html_block_quotes", true);
args.putBoolean("print_html_header", print_html_header);
args.putBoolean("print_html_images", print_html_images);
args.putBoolean("print_html_block_quotes", print_html_block_quotes);
new SimpleTask<String[]>() {
@Override
@@ -139,6 +150,7 @@ public class FragmentDialogPrint extends FragmentDialogBase {
boolean headers = args.getBoolean("headers");
boolean print_html_header = args.getBoolean("print_html_header");
boolean print_html_images = args.getBoolean("print_html_images");
boolean print_html_block_quotes = args.getBoolean("print_html_block_quotes");
CharSequence selected = args.getCharSequence("selected");
boolean draft = args.getBoolean("draft");
@@ -172,6 +184,15 @@ public class FragmentDialogPrint extends FragmentDialogBase {
if (message.isPlainOnly() && monospaced_pre)
HtmlHelper.restorePre(document);
if (!print_html_block_quotes)
for (Element bq : document.select("blockquote")) {
String style = bq.attr("style");
bq.attr("style", HtmlHelper.mergeStyles(style,
"border: none !important;" +
"margin-left: 0; margin-right: 0;" +
"padding-left: 0; padding-right: 0;"));
}
HtmlHelper.markText(document);
HtmlHelper.embedInlineImages(context, id, document, true);