Ask show images per sender

pull/162/head
M66B 5 years ago
parent e3e7130ea8
commit 467966c4cc

@ -205,7 +205,7 @@ FairEmail follows all the best practices for an email client as decribed in [thi
* [(113) How does biometric authentication work?](#user-content-faq113)
* [(114) Can you add an import for the settings of other email apps?](#user-content-faq114)
* [(115) Can you add email address chips?](#user-content-faq114)
* [(116) How can I show images in messages from trusted senders by default?](#user-content-faq116)
* [~~(116) How can I show images in messages from trusted senders by default?~~](#user-content-faq116)
* [(117) Can you help me restore my purchase?](#user-content-faq117)
* [(118) What does 'Remove tracking parameters' exactly?](#user-content-faq118)
* [(119) Can you add colors to the unified inbox widget?](#user-content-faq119)
@ -217,6 +217,7 @@ FairEmail follows all the best practices for an email client as decribed in [thi
* [(125) What are the current experimental features?](#user-content-faq125)
* [(126) What does 'User is authenticated but not connected' mean?](#user-content-faq126)
* [(127) How can I fix 'Syntactically invalid HELO argument(s)'?](#user-content-faq127)
* [(128) How can I reset asked questions, for example to show images?](#user-content-faq128)
[I have another question.](#support)
@ -2047,12 +2048,12 @@ Reverted [commit](https://github.com/M66B/FairEmail/commit/2c80c25b8aa75af2287f4
<br />
<a name="faq116"></a>
**(116) How can I show images in messages from trusted senders by default?**
**~~(116) How can I show images in messages from trusted senders by default?~~**
You can show images in messages from trusted senders by default by enabled the display setting *Automatically show images for known contacts*.
~~You can show images in messages from trusted senders by default by enabled the display setting *Automatically show images for known contacts*.~~
Contacts in the Android contacts list are considered to be known and trusted,
unless the contact is in the group / has the label '*Untrusted*' (case insensitive).
~~Contacts in the Android contacts list are considered to be known and trusted,~~
~~unless the contact is in the group / has the label '*Untrusted*' (case insensitive).~~
<br />
@ -2172,6 +2173,13 @@ You can likely fix the error *Syntactically invalid HELO argument(s)* by disabli
<br />
<a name="faq128"></a>
**(128) How can I reset asked questions, for example to show images?**
You can reset asked questions via the three dots overflow menu in the miscellaneous settings.
<br />
## Support
If you have another question, want to request a feature or report a bug, you can use [this forum](https://forum.xda-developers.com/android/apps-games/source-email-t3824168).

@ -190,8 +190,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean attachments_alt;
private boolean contrast;
private boolean monospaced;
private boolean contact_images;
private boolean all_images;
private boolean collapse_quotes;
private boolean authentication;
private static boolean debug;
@ -829,9 +827,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} else
bindContactInfo(info, message);
if (all_images || (contact_images && message.avatar != null))
properties.setValue("images", message.id, true);
if (viewType == ViewType.THREAD) {
if (expanded)
bindExpanded(message, false);
@ -1990,17 +1985,20 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
private void onShowImages(final TupleMessageEx message) {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getBoolean("show_images_confirmed", false)) {
onShowImagesConfirmed(message);
return;
}
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_ask_again, null);
final TextView tvMessage = dview.findViewById(R.id.tvMessage);
final CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
tvMessage.setText(context.getText(R.string.title_ask_show_image));
if (message.from == null || message.from.length == 0)
cbNotAgain.setVisibility(View.GONE);
else {
List<String> froms = new ArrayList<>();
for (Address address : message.from)
froms.add(((InternetAddress) address).getAddress());
cbNotAgain.setText(context.getString(R.string.title_no_ask_for_again,
TextUtils.join(", ", froms)));
}
// TODO: dialog fragment
final Dialog dialog = new AlertDialog.Builder(context)
@ -2008,8 +2006,16 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (cbNotAgain.isChecked())
prefs.edit().putBoolean("show_images_confirmed", true).apply();
if (cbNotAgain.isChecked()) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
for (Address address : message.from) {
String from = ((InternetAddress) address).getAddress();
editor.putBoolean(from + ".show_images", true);
}
editor.apply();
}
properties.setValue("images", message.id, true);
onShowImagesConfirmed(message);
}
})
@ -2406,6 +2412,16 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private void loadText(TupleMessageEx message, boolean scroll) {
if (message.content) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (message.from != null)
for (Address address : message.from) {
String from = ((InternetAddress) address).getAddress();
if (prefs.getBoolean(from + ".show_images", false)) {
properties.setValue("images", message.id, true);
break;
}
}
boolean show_images = properties.getValue("images", message.id);
boolean show_quotes = (properties.getValue("quotes", message.id) || !collapse_quotes);
@ -3068,8 +3084,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.attachments_alt = prefs.getBoolean("attachments_alt", false);
this.contrast = prefs.getBoolean("contrast", false);
this.monospaced = prefs.getBoolean("monospaced", false);
this.contact_images = (this.contacts && prefs.getBoolean("contact_images", true));
this.all_images = prefs.getBoolean("all_images", false);
this.collapse_quotes = prefs.getBoolean("collapse_quotes", false);
this.authentication = prefs.getBoolean("authentication", true);

@ -280,20 +280,6 @@ public class ContactInfo {
Log.i("Reading email/uri");
ContentResolver resolver = context.getContentResolver();
long untrusted = -1;
try (Cursor cursor = resolver.query(
ContactsContract.Groups.CONTENT_URI,
new String[]{ContactsContract.Groups._ID},
ContactsContract.Groups.TITLE + " = ? COLLATE NOCASE",
new String[]{"untrusted"},
null)) {
if (cursor != null && cursor.moveToNext())
untrusted = cursor.getLong(0);
} catch (Throwable ex) {
Log.e(ex);
}
Log.i("Untrusted group=" + untrusted);
try (Cursor cursor = resolver.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,
new String[]{
ContactsContract.CommonDataKinds.Photo.CONTACT_ID,
@ -307,24 +293,6 @@ public class ContactInfo {
String lookupKey = cursor.getString(1);
String email = cursor.getString(2);
try (Cursor group = resolver.query(
ContactsContract.Data.CONTENT_URI,
new String[]{ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID},
ContactsContract.Data.MIMETYPE + " = ?" +
" AND " + ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID + "= ?" +
" AND " + ContactsContract.CommonDataKinds.GroupMembership.CONTACT_ID + " = ?",
new String[]{
ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE,
Long.toString(untrusted),
Long.toString(contactId)
},
null)) {
if (group != null && group.moveToNext()) {
Log.i("Contact email=" + email + " untrusted");
continue;
}
}
Uri uri = ContactsContract.Contacts.getLookupUri(contactId, lookupKey);
all.put(email, uri);
}

@ -41,8 +41,7 @@ public class FragmentOptions extends FragmentBase {
"subscriptions",
"startup", "cards", "date", "threading", "highlight_unread", "avatars", "generated_icons", "identicons", "circular",
"name_email", "subject_top", "subject_italic", "flags", "preview", "preview_italic",
"addresses", "attachments_alt", "contrast", "monospaced", "inline_images",
"contact_images", "all_images", "collapse_quotes", "autocontent", "actionbar",
"addresses", "attachments_alt", "contrast", "monospaced", "inline_images", "collapse_quotes", "autocontent", "actionbar",
"autoscroll", "swipenav", "autoexpand", "autoclose", "onclose",
"experiments", "debug",
"biometrics"

@ -64,8 +64,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swContrast;
private SwitchCompat swMonospaced;
private SwitchCompat swImagesInline;
private SwitchCompat swImagesContacts;
private SwitchCompat swImagesAll;
private SwitchCompat swCollapseQuotes;
private SwitchCompat swRemoteContent;
private SwitchCompat swActionbar;
@ -74,7 +72,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"theme", "startup", "cards", "date", "threading", "highlight_unread",
"avatars", "generated_icons", "identicons", "circular", "name_email", "subject_top", "subject_italic",
"flags", "preview", "preview_italic", "addresses", "attachments_alt",
"contrast", "monospaced", "inline_images", "contact_images", "all_images", "collapse_quotes", "autocontent", "actionbar",
"contrast", "monospaced", "inline_images", "collapse_quotes", "autocontent", "actionbar",
};
@Override
@ -108,8 +106,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swContrast = view.findViewById(R.id.swContrast);
swMonospaced = view.findViewById(R.id.swMonospaced);
swImagesInline = view.findViewById(R.id.swImagesInline);
swImagesContacts = view.findViewById(R.id.swImagesContacts);
swImagesAll = view.findViewById(R.id.swImagesAll);
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
swRemoteContent = view.findViewById(R.id.swRemoteContent);
swActionbar = view.findViewById(R.id.swActionbar);
@ -279,20 +275,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swImagesContacts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("contact_images", checked).apply();
}
});
swImagesAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("all_images", checked).apply();
}
});
swCollapseQuotes.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -388,8 +370,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swContrast.setChecked(prefs.getBoolean("contrast", false));
swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
swImagesContacts.setChecked(prefs.getBoolean("contact_images", true));
swImagesAll.setChecked(prefs.getBoolean("all_images", false));
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
swRemoteContent.setChecked(prefs.getBoolean("autocontent", false));
swActionbar.setChecked(prefs.getBoolean("actionbar", true));

@ -69,7 +69,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
};
private final static String[] RESET_QUESTIONS = new String[]{
"welcome", "show_html_confirmed", "show_images_confirmed", "print_html_confirmed", "edit_ref_confirmed", "crash_reports_asked"
"welcome", "show_html_confirmed", "print_html_confirmed", "edit_ref_confirmed", "crash_reports_asked"
};
@Override
@ -225,25 +225,37 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_default:
onMenuDefault(RESET_OPTIONS);
onMenuDefault();
return true;
case R.id.menu_reset_questions:
onMenuDefault(RESET_QUESTIONS);
onMenuResetQuestions();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void onMenuDefault(String[] options) {
private void onMenuDefault() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences.Editor editor = prefs.edit();
for (String option : options)
for (String option : RESET_OPTIONS)
editor.remove(option);
editor.apply();
ToastEx.makeText(getContext(), R.string.title_setup_done, Toast.LENGTH_LONG).show();
}
private void onMenuResetQuestions() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences.Editor editor = prefs.edit();
for (String option : RESET_QUESTIONS)
editor.remove(option);
for (String key : prefs.getAll().keySet())
if (key.endsWith(".show_images"))
editor.remove(key);
editor.apply();
ToastEx.makeText(getContext(), R.string.title_setup_done, Toast.LENGTH_LONG).show();
}
private void onCleanup() {
new SimpleTask<Void>() {
@Override

@ -319,66 +319,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swImagesInline" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swImagesContacts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_images"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesInlineHint"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvImagesContactsHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_ask_show_image"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swImagesContacts" />
<TextView
android:id="@+id/tvImagesPermissionHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_permission_contacts_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesContactsHint" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swImagesAll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_images_all"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesPermissionHint"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvImagesAllHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_ask_show_image"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swImagesAll" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCollapseQuotes"
android:layout_width="0dp"
@ -387,7 +327,7 @@
android:text="@string/title_advanced_collapse_quotes"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesAllHint"
app:layout_constraintTop_toBottomOf="@id/tvImagesInlineHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -248,8 +248,6 @@
<string name="title_advanced_contrast">Use high contrast for message text</string>
<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_images_all">Automatically show all images</string>
<string name="title_advanced_collapse_quotes">Collapse quoted text</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>
@ -323,7 +321,6 @@
<string name="title_advanced_name_email_hint">When disabled only names will be shown when available</string>
<string name="title_advanced_preview_hint">Only available when message text has been downloaded</string>
<string name="title_advanced_inline_hint">Inline images are images included in the message</string>
<string name="title_advanced_permission_contacts_hint">This requires granting permission to read your contacts</string>
<string name="title_advanced_autoexpand_hint">Automatically open message when there is just one message or just one unread message in a conversation</string>
<string name="title_advanced_autocollapse_hint">Multiple expanded messages will always be closed on \'back\'</string>
@ -791,6 +788,7 @@
<string name="title_completed">Completed</string>
<string name="title_ask_what">Ask what to do</string>
<string name="title_no_ask_again">Do not ask this again</string>
<string name="title_no_ask_for_again">Do not ask this again for %1$s</string>
<string name="title_no_body">No message text found</string>
<string name="title_no_charset">Unsupported encoding: %1$s</string>
<string name="title_via">Via: %1$s</string>

Loading…
Cancel
Save