Added option to always show remote content in original messages

This commit is contained in:
M66B 2019-07-08 14:51:36 +02:00
parent 77bd52ace6
commit 88b5146245
4 changed files with 26 additions and 4 deletions

View File

@ -3622,6 +3622,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean inline = prefs.getBoolean("inline_images", false);
boolean autocontent = prefs.getBoolean("autocontent", false);
setupWebView(webView);
@ -3629,8 +3630,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
settings.setDefaultFontSize(Math.round(textSize));
settings.setDefaultFixedFontSize(Math.round(textSize));
settings.setLoadsImagesAutomatically(show_images || inline);
settings.setBlockNetworkLoads(!show_images);
settings.setBlockNetworkImage(!show_images);
settings.setBlockNetworkLoads(!show_images && !autocontent);
settings.setBlockNetworkImage(!show_images && !autocontent);
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);

View File

@ -57,11 +57,12 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swMonospaced;
private SwitchCompat swInline;
private SwitchCompat swImages;
private SwitchCompat swRemoteContent;
private SwitchCompat swActionbar;
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "date", "threading", "avatars", "identicons", "circular", "name_email", "subject_italic",
"flags", "preview", "addresses", "attachments_alt", "monospaced", "inline_images", "autoimages", "actionbar",
"flags", "preview", "addresses", "attachments_alt", "monospaced", "inline_images", "autoimages", "autocontent", "actionbar",
};
@Override
@ -90,6 +91,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swMonospaced = view.findViewById(R.id.swMonospaced);
swInline = view.findViewById(R.id.swInline);
swImages = view.findViewById(R.id.swImages);
swRemoteContent = view.findViewById(R.id.swRemoteContent);
swActionbar = view.findViewById(R.id.swActionbar);
setOptions();
@ -219,6 +221,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swRemoteContent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autocontent", checked).apply();
}
});
swActionbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -294,6 +303,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
swInline.setChecked(prefs.getBoolean("inline_images", false));
swImages.setChecked(prefs.getBoolean("autoimages", false));
swRemoteContent.setChecked(prefs.getBoolean("autocontent", false));
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
}

View File

@ -256,6 +256,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swImages" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swRemoteContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_remote_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swActionbar"
android:layout_width="match_parent"
@ -264,7 +274,7 @@
android:checked="true"
android:text="@string/title_advanced_actionbar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesHint"
app:layout_constraintTop_toBottomOf="@id/swRemoteContent"
app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -209,6 +209,7 @@
<string name="title_advanced_monospaced">Use monospaced font for message text</string>
<string name="title_advanced_images_inline">Automatically show inline images</string>
<string name="title_advanced_images">Automatically show images for known contacts</string>
<string name="title_advanced_remote_content">Automatically show remote content when viewing original messages</string>
<string name="title_advanced_actionbar">Conversation action bar</string>
<string name="title_advanced_pull_refresh">Pull down to refresh</string>