1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Add setting to toggle contact pictures

This commit is contained in:
cketti 2013-02-07 20:23:53 +01:00
parent 04ce0a9d3f
commit c27a5a8104
5 changed files with 39 additions and 3 deletions

View File

@ -1155,4 +1155,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="global_settings_splitview_when_in_landscape">When in Landscape orientation</string> <string name="global_settings_splitview_when_in_landscape">When in Landscape orientation</string>
<string name="message_view_empty">Please select a message on the left</string> <string name="message_view_empty">Please select a message on the left</string>
<string name="global_settings_show_contact_picture_label">Show contact pictures</string>
<string name="global_settings_show_contact_picture_summary">Show contact pictures in the message list</string>
</resources> </resources>

View File

@ -179,6 +179,13 @@
android:dependency="messagelist_show_contact_name" android:dependency="messagelist_show_contact_name"
/> />
<CheckBoxPreference
android:persistent="false"
android:key="messagelist_show_contact_picture"
android:title="@string/global_settings_show_contact_picture_label"
android:summary="@string/global_settings_show_contact_picture_summary"
/>
<CheckBoxPreference <CheckBoxPreference
android:persistent="false" android:persistent="false"
android:key="messagelist_background_as_unread_indicator" android:key="messagelist_background_as_unread_indicator"

View File

@ -226,6 +226,7 @@ public class K9 extends Application {
private static boolean mShowContactName = false; private static boolean mShowContactName = false;
private static boolean mChangeContactNameColor = false; private static boolean mChangeContactNameColor = false;
private static int mContactNameColor = 0xff00008f; private static int mContactNameColor = 0xff00008f;
private static boolean sShowContactPicture = true;
private static boolean mMessageViewFixedWidthFont = false; private static boolean mMessageViewFixedWidthFont = false;
private static boolean mMessageViewReturnToList = false; private static boolean mMessageViewReturnToList = false;
private static boolean mMessageViewShowNext = false; private static boolean mMessageViewShowNext = false;
@ -506,6 +507,7 @@ public class K9 extends Application {
editor.putBoolean("messageListCheckboxes", mMessageListCheckboxes); editor.putBoolean("messageListCheckboxes", mMessageListCheckboxes);
editor.putBoolean("showCorrespondentNames", mShowCorrespondentNames); editor.putBoolean("showCorrespondentNames", mShowCorrespondentNames);
editor.putBoolean("showContactName", mShowContactName); editor.putBoolean("showContactName", mShowContactName);
editor.putBoolean("showContactPicture", sShowContactPicture);
editor.putBoolean("changeRegisteredNameColor", mChangeContactNameColor); editor.putBoolean("changeRegisteredNameColor", mChangeContactNameColor);
editor.putInt("registeredNameColor", mContactNameColor); editor.putInt("registeredNameColor", mContactNameColor);
editor.putBoolean("messageViewFixedWidthFont", mMessageViewFixedWidthFont); editor.putBoolean("messageViewFixedWidthFont", mMessageViewFixedWidthFont);
@ -703,6 +705,7 @@ public class K9 extends Application {
mShowCorrespondentNames = sprefs.getBoolean("showCorrespondentNames", true); mShowCorrespondentNames = sprefs.getBoolean("showCorrespondentNames", true);
mShowContactName = sprefs.getBoolean("showContactName", false); mShowContactName = sprefs.getBoolean("showContactName", false);
sShowContactPicture = sprefs.getBoolean("showContactPicture", true);
mChangeContactNameColor = sprefs.getBoolean("changeRegisteredNameColor", false); mChangeContactNameColor = sprefs.getBoolean("changeRegisteredNameColor", false);
mContactNameColor = sprefs.getInt("registeredNameColor", 0xff00008f); mContactNameColor = sprefs.getInt("registeredNameColor", 0xff00008f);
mMessageViewFixedWidthFont = sprefs.getBoolean("messageViewFixedWidthFont", false); mMessageViewFixedWidthFont = sprefs.getBoolean("messageViewFixedWidthFont", false);
@ -1336,6 +1339,14 @@ public class K9 extends Application {
sSplitViewMode = mode; sSplitViewMode = mode;
} }
public static boolean showContactPicture() {
return sShowContactPicture;
}
public static void setShowContactPicture(boolean show) {
sShowContactPicture = show;
}
/** /**
* Check if we already know whether all databases are using the current database schema. * Check if we already know whether all databases are using the current database schema.
* *

View File

@ -73,6 +73,7 @@ public class Prefs extends K9PreferenceActivity {
private static final String PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES = "messagelist_show_correspondent_names"; private static final String PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES = "messagelist_show_correspondent_names";
private static final String PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME = "messagelist_show_contact_name"; private static final String PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME = "messagelist_show_contact_name";
private static final String PREFERENCE_MESSAGELIST_CONTACT_NAME_COLOR = "messagelist_contact_name_color"; private static final String PREFERENCE_MESSAGELIST_CONTACT_NAME_COLOR = "messagelist_contact_name_color";
private static final String PREFERENCE_MESSAGELIST_SHOW_CONTACT_PICTURE = "messagelist_show_contact_picture";
private static final String PREFERENCE_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font"; private static final String PREFERENCE_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font";
private static final String PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST = "messageview_return_to_list"; private static final String PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST = "messageview_return_to_list";
@ -124,6 +125,7 @@ public class Prefs extends K9PreferenceActivity {
private CheckBoxPreference mShowCorrespondentNames; private CheckBoxPreference mShowCorrespondentNames;
private CheckBoxPreference mShowContactName; private CheckBoxPreference mShowContactName;
private CheckBoxPreference mChangeContactNameColor; private CheckBoxPreference mChangeContactNameColor;
private CheckBoxPreference mShowContactPicture;
private CheckBoxPreference mFixedWidth; private CheckBoxPreference mFixedWidth;
private CheckBoxPreference mReturnToList; private CheckBoxPreference mReturnToList;
private CheckBoxPreference mShowNext; private CheckBoxPreference mShowNext;
@ -266,6 +268,9 @@ public class Prefs extends K9PreferenceActivity {
mShowContactName = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME); mShowContactName = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME);
mShowContactName.setChecked(K9.showContactName()); mShowContactName.setChecked(K9.showContactName());
mShowContactPicture = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CONTACT_PICTURE);
mShowContactPicture.setChecked(K9.showContactPicture());
mBackgroundAsUnreadIndicator = (CheckBoxPreference)findPreference(PREFERENCE_BACKGROUND_AS_UNREAD_INDICATOR); mBackgroundAsUnreadIndicator = (CheckBoxPreference)findPreference(PREFERENCE_BACKGROUND_AS_UNREAD_INDICATOR);
mBackgroundAsUnreadIndicator.setChecked(K9.useBackgroundAsUnreadIndicator()); mBackgroundAsUnreadIndicator.setChecked(K9.useBackgroundAsUnreadIndicator());
@ -497,6 +502,7 @@ public class Prefs extends K9PreferenceActivity {
K9.setShowCorrespondentNames(mShowCorrespondentNames.isChecked()); K9.setShowCorrespondentNames(mShowCorrespondentNames.isChecked());
K9.setMessageListSenderAboveSubject(mSenderAboveSubject.isChecked()); K9.setMessageListSenderAboveSubject(mSenderAboveSubject.isChecked());
K9.setShowContactName(mShowContactName.isChecked()); K9.setShowContactName(mShowContactName.isChecked());
K9.setShowContactPicture(mShowContactPicture.isChecked());
K9.setUseBackgroundAsUnreadIndicator(mBackgroundAsUnreadIndicator.isChecked()); K9.setUseBackgroundAsUnreadIndicator(mBackgroundAsUnreadIndicator.isChecked());
K9.setThreadedViewEnabled(mThreadedView.isChecked()); K9.setThreadedViewEnabled(mThreadedView.isChecked());
K9.setChangeContactNameColor(mChangeContactNameColor.isChecked()); K9.setChangeContactNameColor(mChangeContactNameColor.isChecked());

View File

@ -750,8 +750,10 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
mPreviewLines = K9.messageListPreviewLines(); mPreviewLines = K9.messageListPreviewLines();
mCheckboxes = K9.messageListCheckboxes(); mCheckboxes = K9.messageListCheckboxes();
mContactsPictureLoader = new ContactPictureLoader(getActivity(), if (K9.showContactPicture()) {
R.drawable.ic_contact_picture); mContactsPictureLoader = new ContactPictureLoader(getActivity(),
R.drawable.ic_contact_picture);
}
restoreInstanceState(savedInstanceState); restoreInstanceState(savedInstanceState);
decodeArguments(); decodeArguments();
@ -1733,7 +1735,14 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
holder.date = (TextView) view.findViewById(R.id.date); holder.date = (TextView) view.findViewById(R.id.date);
holder.chip = view.findViewById(R.id.chip); holder.chip = view.findViewById(R.id.chip);
holder.preview = (TextView) view.findViewById(R.id.preview); holder.preview = (TextView) view.findViewById(R.id.preview);
holder.contactBadge = (QuickContactBadge) view.findViewById(R.id.contact_badge);
QuickContactBadge contactBadge =
(QuickContactBadge) view.findViewById(R.id.contact_badge);
if (mContactsPictureLoader != null) {
holder.contactBadge = contactBadge;
} else {
contactBadge.setVisibility(View.GONE);
}
if (mSenderAboveSubject) { if (mSenderAboveSubject) {
holder.from = (TextView) view.findViewById(R.id.subject); holder.from = (TextView) view.findViewById(R.id.subject);