Show original without images

This commit is contained in:
M66B 2019-03-28 07:14:45 +00:00
parent cfe8b4bd04
commit f0b51a1edf
1 changed files with 21 additions and 8 deletions

View File

@ -1046,7 +1046,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
adapterImage.set(images); adapterImage.set(images);
boolean show_html = properties.getValue("html", message.id); boolean show_html = properties.getValue("html", message.id);
if (message.content && !show_html) { if (message.content)
if (show_html)
onShowHtmlConfirmed(message);
else {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putSerializable("message", message); args.putSerializable("message", message);
bodyTask.execute(context, owner, args, "message:body"); bodyTask.execute(context, owner, args, "message:body");
@ -1404,9 +1407,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
private void onShowHtmlConfirmed(final TupleMessageEx message) { private void onShowHtmlConfirmed(final TupleMessageEx message) {
properties.setValue("html", message.id, true); properties.setValue("html", message.id, true);
boolean show_images = properties.getValue("images", message.id);
btnHtml.setVisibility(View.GONE); btnHtml.setVisibility(View.GONE);
ibQuotes.setVisibility(View.GONE); ibQuotes.setVisibility(View.GONE);
ibImages.setVisibility(View.GONE); ibImages.setVisibility(show_images ? View.GONE : View.VISIBLE);
tvBody.setVisibility(View.GONE); tvBody.setVisibility(View.GONE);
rvImage.setVisibility(View.GONE); rvImage.setVisibility(View.GONE);
@ -1441,6 +1447,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
settings.setDisplayZoomControls(false); settings.setDisplayZoomControls(false);
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
settings.setAllowFileAccess(false); settings.setAllowFileAccess(false);
settings.setLoadsImagesAutomatically(show_images);
// Set default font // Set default font
int px = Math.round(TypedValue.applyDimension( int px = Math.round(TypedValue.applyDimension(
@ -1591,11 +1598,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private void onShowImagesConfirmed(final TupleMessageEx message) { private void onShowImagesConfirmed(final TupleMessageEx message) {
properties.setValue("images", message.id, true); properties.setValue("images", message.id, true);
ibImages.setEnabled(false);
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putSerializable("message", message); args.putSerializable("message", message);
boolean show_html = properties.getValue("html", message.id);
if (show_html)
onShowHtmlConfirmed(message);
else {
ibImages.setEnabled(false);
bodyTask.execute(context, owner, args, "message:body"); bodyTask.execute(context, owner, args, "message:body");
}
// Download inline images // Download inline images
new SimpleTask<Void>() { new SimpleTask<Void>() {