mirror of https://github.com/M66B/FairEmail.git
Added option to disabled generated icons
This commit is contained in:
parent
bc6555210f
commit
226964e9fc
|
@ -173,7 +173,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
private boolean date;
|
||||
private boolean threading;
|
||||
private boolean avatars;
|
||||
private boolean name_email;
|
||||
private boolean subject_italic;
|
||||
private boolean flags;
|
||||
|
@ -743,7 +742,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
@Override
|
||||
protected void onPreExecute(Bundle args) {
|
||||
Address[] addresses = (Address[]) args.getSerializable("addresses");
|
||||
ivAvatar.setVisibility(avatars ? View.INVISIBLE : View.GONE);
|
||||
ivAvatar.setVisibility(View.GONE);
|
||||
tvFrom.setText(MessageHelper.formatAddresses(addresses, !compact, false));
|
||||
}
|
||||
|
||||
|
@ -869,11 +868,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
}
|
||||
|
||||
private void bindContactInfo(ContactInfo info, TupleMessageEx message) {
|
||||
if (info.hasPhoto())
|
||||
if (info.hasPhoto()) {
|
||||
ivAvatar.setImageBitmap(info.getPhotoBitmap());
|
||||
else
|
||||
ivAvatar.setImageResource(R.drawable.baseline_person_24);
|
||||
ivAvatar.setVisibility(avatars ? View.VISIBLE : View.GONE);
|
||||
ivAvatar.setVisibility(View.VISIBLE);
|
||||
} else
|
||||
ivAvatar.setVisibility(View.GONE);
|
||||
tvFrom.setText(info.getDisplayName(name_email));
|
||||
}
|
||||
|
||||
|
@ -2941,8 +2940,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
this.date = prefs.getBoolean("date", true);
|
||||
this.threading = prefs.getBoolean("threading", true);
|
||||
this.avatars = (prefs.getBoolean("avatars", true) ||
|
||||
prefs.getBoolean("identicons", false));
|
||||
this.name_email = prefs.getBoolean("name_email", !compact);
|
||||
this.subject_italic = prefs.getBoolean("subject_italic", true);
|
||||
this.flags = prefs.getBoolean("flags", true);
|
||||
|
|
|
@ -159,11 +159,14 @@ public class ContactInfo {
|
|||
if (info.bitmap == null) {
|
||||
int dp = Helper.dp2pixels(context, 48);
|
||||
boolean dark = Helper.isDarkTheme(context);
|
||||
boolean identicons = prefs.getBoolean("identicons", false);
|
||||
if (identicons)
|
||||
info.bitmap = Identicon.icon(key, dp, 5, dark);
|
||||
else
|
||||
info.bitmap = Identicon.letter(key, dp, dark);
|
||||
boolean generated = prefs.getBoolean("generated_icons", true);
|
||||
if (generated) {
|
||||
boolean identicons = prefs.getBoolean("identicons", false);
|
||||
if (identicons)
|
||||
info.bitmap = Identicon.icon(key, dp, 5, dark);
|
||||
else
|
||||
info.bitmap = Identicon.letter(key, dp, dark);
|
||||
}
|
||||
}
|
||||
|
||||
boolean circular = prefs.getBoolean("circular", true);
|
||||
|
|
|
@ -38,7 +38,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
private PagerAdapter adapter;
|
||||
|
||||
static String[] OPTIONS_RESTART = new String[]{
|
||||
"startup", "date", "threading", "avatars", "identicons", "circular", "name_email", "subject_italic", "flags", "preview",
|
||||
"startup", "date", "threading", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic", "flags", "preview",
|
||||
"addresses", "attachments_alt", "contrast", "monospaced", "autohtml", "autoimages", "actionbar",
|
||||
"autoscroll", "swipenav", "autoexpand", "autoclose", "autonext",
|
||||
"subscriptions", "debug",
|
||||
|
|
|
@ -47,6 +47,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swDate;
|
||||
private SwitchCompat swThreading;
|
||||
private SwitchCompat swAvatars;
|
||||
private SwitchCompat swGeneratedIcons;
|
||||
private SwitchCompat swIdenticons;
|
||||
private SwitchCompat swCircular;
|
||||
private SwitchCompat swNameEmail;
|
||||
|
@ -65,7 +66,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swActionbar;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"theme", "startup", "date", "threading", "avatars", "identicons", "circular", "name_email", "subject_italic",
|
||||
"theme", "startup", "date", "threading", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic",
|
||||
"flags", "preview", "addresses", "attachments_alt",
|
||||
"contrast", "monospaced", "inline_images", "autoimages", "collapse_quotes", "autocontent", "actionbar",
|
||||
};
|
||||
|
@ -85,6 +86,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swDate = view.findViewById(R.id.swDate);
|
||||
swThreading = view.findViewById(R.id.swThreading);
|
||||
swAvatars = view.findViewById(R.id.swAvatars);
|
||||
swGeneratedIcons = view.findViewById(R.id.swGeneratedIcons);
|
||||
swIdenticons = view.findViewById(R.id.swIdenticons);
|
||||
swCircular = view.findViewById(R.id.swCircular);
|
||||
swNameEmail = view.findViewById(R.id.swNameEmail);
|
||||
|
@ -149,6 +151,15 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
}
|
||||
});
|
||||
|
||||
swGeneratedIcons.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("generated_icons", checked).apply();
|
||||
swIdenticons.setEnabled(checked);
|
||||
ContactInfo.clearCache();
|
||||
}
|
||||
});
|
||||
|
||||
swIdenticons.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -314,7 +325,9 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swDate.setChecked(prefs.getBoolean("date", true));
|
||||
swThreading.setChecked(prefs.getBoolean("threading", true));
|
||||
swAvatars.setChecked(prefs.getBoolean("avatars", true));
|
||||
swGeneratedIcons.setChecked(prefs.getBoolean("generated_icons", true));
|
||||
swIdenticons.setChecked(prefs.getBoolean("identicons", false));
|
||||
swIdenticons.setEnabled(swGeneratedIcons.isChecked());
|
||||
swCircular.setChecked(prefs.getBoolean("circular", true));
|
||||
swNameEmail.setChecked(prefs.getBoolean("name_email", !compact));
|
||||
swSubjectItalic.setChecked(prefs.getBoolean("subject_italic", true));
|
||||
|
|
|
@ -98,6 +98,18 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/tvThreadingHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swGeneratedIcons"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_generated_icons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAvatars"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swIdenticons"
|
||||
android:layout_width="0dp"
|
||||
|
@ -106,7 +118,7 @@
|
|||
android:text="@string/title_advanced_identicons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAvatars"
|
||||
app:layout_constraintTop_toBottomOf="@id/swGeneratedIcons"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -209,6 +209,7 @@
|
|||
<string name="title_advanced_date_header">Group by date</string>
|
||||
<string name="title_advanced_threading">Conversation threading</string>
|
||||
<string name="title_advanced_avatars">Show contact photos</string>
|
||||
<string name="title_advanced_generated_icons">Show generated icons</string>
|
||||
<string name="title_advanced_identicons">Show identicons</string>
|
||||
<string name="title_advanced_circular">Show round icons</string>
|
||||
<string name="title_advanced_name_email">Show names and email addresses</string>
|
||||
|
|
Loading…
Reference in New Issue