Added option to skip printing quoted text

This commit is contained in:
M66B 2022-05-30 18:06:58 +02:00
parent 9deb727594
commit 5bca6849c5
4 changed files with 40 additions and 1 deletions

View File

@ -8212,6 +8212,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
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 cbQuotes = dview.findViewById(R.id.cbQuotes);
CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
cbHeader.setChecked(prefs.getBoolean("print_html_header", true));
@ -8230,6 +8231,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
});
cbQuotes.setChecked(prefs.getBoolean("print_html_quotes", true));
cbQuotes.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
prefs.edit().putBoolean("print_html_quotes", isChecked).apply();
}
});
cbNotAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

View File

@ -9165,9 +9165,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean print_html_header = prefs.getBoolean("print_html_header", true);
boolean print_html_images = prefs.getBoolean("print_html_images", true);
boolean print_html_quotes = prefs.getBoolean("print_html_quotes", true);
args.putBoolean("print_html_header", print_html_header);
args.putBoolean("print_html_images", print_html_images);
args.putBoolean("print_html_quotes", print_html_quotes);
new SimpleTask<String[]>() {
private final ExecutorService executor = Helper.getBackgroundExecutor(0, "print");
@ -9178,6 +9180,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");
boolean print_html_quotes = args.getBoolean("print_html_quotes");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int timeout = prefs.getInt("timeout", ImageHelper.DOWNLOAD_TIMEOUT) * 1000;
@ -9266,6 +9269,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
element.removeClass(clazz);
}
if (!print_html_quotes)
document.body().select("blockquote").remove();
if (print_html_header) {
Element header = document.createElement("p");

View File

@ -64,6 +64,28 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbImages" />
<CheckBox
android:id="@+id/cbQuotes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_print_quotes"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesRemark" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvQuotesRemark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/title_print_quotes_remark"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbQuotes" />
<CheckBox
android:id="@+id/cbNotAgain"
android:layout_width="wrap_content"
@ -72,6 +94,6 @@
android:text="@string/title_no_ask_again"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesRemark" />
app:layout_constraintTop_toBottomOf="@id/tvQuotesRemark" />
</eu.faircode.email.ConstraintLayoutEx>
</eu.faircode.email.ScrollViewEx>

View File

@ -1176,7 +1176,9 @@
<string name="title_print">Print</string>
<string name="title_print_header">Print header</string>
<string name="title_print_images">Print images</string>
<string name="title_print_quotes">Print quoted text</string>
<string name="title_print_images_remark">Downloading images might take some time</string>
<string name="title_print_quotes_remark">Disabling this will remove quoted text (mostly answers)</string>
<string name="title_show_headers">Show headers</string>
<string name="title_share_as_html">Share as HTML</string>
<string name="title_raw_save">Save raw message</string>