1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-25 15:11:52 -05:00

Add a preference to allow users to always show email addresses instead

of the "friendly" parts of email addresses.
This commit is contained in:
Jesse Vincent 2011-01-23 00:55:46 +00:00
parent 26ba1280ba
commit c06643bd47
5 changed files with 40 additions and 3 deletions

View File

@ -322,6 +322,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="global_settings_touchable_label">Message previews</string> <string name="global_settings_touchable_label">Message previews</string>
<string name="global_settings_touchable_summary">Roomier list items with message previews</string> <string name="global_settings_touchable_summary">Roomier list items with message previews</string>
<string name="global_settings_preview_lines_label">Preview lines</string> <string name="global_settings_preview_lines_label">Preview lines</string>
<string name="global_settings_show_correspondent_names_label">Show correspondent names</string>
<string name="global_settings_show_correspondent_names_summary">Show correspondent names rather than their email addresses</string>
<string name="global_settings_show_contact_name_label">Show contact names</string> <string name="global_settings_show_contact_name_label">Show contact names</string>
<string name="global_settings_show_contact_name_summary">Use recipient names from Contacts when available</string> <string name="global_settings_show_contact_name_summary">Use recipient names from Contacts when available</string>
<string name="global_settings_registered_name_color_label">Colorize contacts</string> <string name="global_settings_registered_name_color_label">Colorize contacts</string>

View File

@ -119,18 +119,29 @@
android:title="@string/global_settings_checkbox_label" android:title="@string/global_settings_checkbox_label"
android:summary="@string/global_settings_checkbox_summary" /> android:summary="@string/global_settings_checkbox_summary" />
<CheckBoxPreference
android:persistent="false"
android:key="messagelist_show_correspondent_names"
android:title="@string/global_settings_show_correspondent_names_label"
android:summary="@string/global_settings_show_correspondent_names_summary"
/>
<CheckBoxPreference <CheckBoxPreference
android:persistent="false" android:persistent="false"
android:key="messagelist_show_contact_name" android:key="messagelist_show_contact_name"
android:title="@string/global_settings_show_contact_name_label" android:title="@string/global_settings_show_contact_name_label"
android:summary="@string/global_settings_show_contact_name_summary" /> android:summary="@string/global_settings_show_contact_name_summary"
android:dependency="messagelist_show_correspondent_names"
/>
<CheckBoxPreference <CheckBoxPreference
android:persistent="false" android:persistent="false"
android:key="messagelist_contact_name_color" android:key="messagelist_contact_name_color"
android:title="@string/global_settings_registered_name_color_label" android:title="@string/global_settings_registered_name_color_label"
android:summary="@string/global_settings_registered_name_color_default" android:summary="@string/global_settings_registered_name_color_default"
android:dependency="messagelist_show_contact_name" /> android:dependency="messagelist_show_contact_name"
/>
</PreferenceCategory> </PreferenceCategory>

View File

@ -157,6 +157,7 @@ public class K9 extends Application
private static boolean mMessageListTouchable = false; private static boolean mMessageListTouchable = false;
private static int mMessageListPreviewLines = 2; private static int mMessageListPreviewLines = 2;
private static boolean mShowCorrespondentNames = true;
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;
@ -436,6 +437,7 @@ public class K9 extends Application
editor.putBoolean("messageListTouchable",mMessageListTouchable); editor.putBoolean("messageListTouchable",mMessageListTouchable);
editor.putInt("messageListPreviewLines",mMessageListPreviewLines); editor.putInt("messageListPreviewLines",mMessageListPreviewLines);
editor.putBoolean("showCorrespondentNames",mShowCorrespondentNames);
editor.putBoolean("showContactName",mShowContactName); editor.putBoolean("showContactName",mShowContactName);
editor.putBoolean("changeRegisteredNameColor",mChangeContactNameColor); editor.putBoolean("changeRegisteredNameColor",mChangeContactNameColor);
editor.putInt("registeredNameColor",mContactNameColor); editor.putInt("registeredNameColor",mContactNameColor);
@ -487,6 +489,7 @@ public class K9 extends Application
mQuietTimeStarts = sprefs.getString("quietTimeStarts", "21:00" ); mQuietTimeStarts = sprefs.getString("quietTimeStarts", "21:00" );
mQuietTimeEnds= sprefs.getString("quietTimeEnds", "7:00"); mQuietTimeEnds= sprefs.getString("quietTimeEnds", "7:00");
mShowCorrespondentNames = sprefs.getBoolean("showCorrespondentNames", true);
mShowContactName = sprefs.getBoolean("showContactName", false); mShowContactName = sprefs.getBoolean("showContactName", false);
mChangeContactNameColor = sprefs.getBoolean("changeRegisteredNameColor", false); mChangeContactNameColor = sprefs.getBoolean("changeRegisteredNameColor", false);
mContactNameColor = sprefs.getInt("registeredNameColor", 0xff00008f); mContactNameColor = sprefs.getInt("registeredNameColor", 0xff00008f);
@ -890,6 +893,16 @@ public class K9 extends Application
mMessageListCheckboxes = checkboxes; mMessageListCheckboxes = checkboxes;
} }
public static boolean showCorrespondentNames()
{
return mShowCorrespondentNames;
}
public static void setShowCorrespondentNames(boolean showCorrespondentNames)
{
mShowCorrespondentNames = showCorrespondentNames;
}
public static boolean showContactName() public static boolean showContactName()
{ {
return mShowContactName; return mShowContactName;

View File

@ -57,6 +57,7 @@ public class Prefs extends K9PreferenceActivity
private static final String PREFERENCE_MESSAGELIST_PREVIEW_LINES = "messagelist_preview_lines"; private static final String PREFERENCE_MESSAGELIST_PREVIEW_LINES = "messagelist_preview_lines";
private static final String PREFERENCE_MESSAGELIST_STARS = "messagelist_stars"; private static final String PREFERENCE_MESSAGELIST_STARS = "messagelist_stars";
private static final String PREFERENCE_MESSAGELIST_CHECKBOXES = "messagelist_checkboxes"; private static final String PREFERENCE_MESSAGELIST_CHECKBOXES = "messagelist_checkboxes";
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_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font"; private static final String PREFERENCE_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font";
@ -91,6 +92,7 @@ public class Prefs extends K9PreferenceActivity
private ListPreference mPreviewLines; private ListPreference mPreviewLines;
private CheckBoxPreference mStars; private CheckBoxPreference mStars;
private CheckBoxPreference mCheckboxes; private CheckBoxPreference mCheckboxes;
private CheckBoxPreference mShowCorrespondentNames;
private CheckBoxPreference mShowContactName; private CheckBoxPreference mShowContactName;
private CheckBoxPreference mChangeContactNameColor; private CheckBoxPreference mChangeContactNameColor;
private CheckBoxPreference mFixedWidth; private CheckBoxPreference mFixedWidth;
@ -204,6 +206,9 @@ public class Prefs extends K9PreferenceActivity
mCheckboxes = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_CHECKBOXES); mCheckboxes = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_CHECKBOXES);
mCheckboxes.setChecked(K9.messageListCheckboxes()); mCheckboxes.setChecked(K9.messageListCheckboxes());
mShowCorrespondentNames = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES);
mShowCorrespondentNames.setChecked(K9.showCorrespondentNames());
mShowContactName = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME); mShowContactName = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME);
mShowContactName.setChecked(K9.showContactName()); mShowContactName.setChecked(K9.showContactName());
@ -318,6 +323,7 @@ public class Prefs extends K9PreferenceActivity
K9.setMessageListPreviewLines(Integer.parseInt(mPreviewLines.getValue())); K9.setMessageListPreviewLines(Integer.parseInt(mPreviewLines.getValue()));
K9.setMessageListStars(mStars.isChecked()); K9.setMessageListStars(mStars.isChecked());
K9.setMessageListCheckboxes(mCheckboxes.isChecked()); K9.setMessageListCheckboxes(mCheckboxes.isChecked());
K9.setShowCorrespondentNames(mShowCorrespondentNames.isChecked());
K9.setShowContactName(mShowContactName.isChecked()); K9.setShowContactName(mShowContactName.isChecked());
K9.setChangeContactNameColor(mChangeContactNameColor.isChecked()); K9.setChangeContactNameColor(mChangeContactNameColor.isChecked());
K9.setMessageViewFixedWidthFont(mFixedWidth.isChecked()); K9.setMessageViewFixedWidthFont(mFixedWidth.isChecked());

View File

@ -268,7 +268,12 @@ public class Address
*/ */
public CharSequence toFriendly(final Contacts contacts) public CharSequence toFriendly(final Contacts contacts)
{ {
if (contacts != null) if (!K9.showCorrespondentNames())
{
return mAddress;
}
else if (contacts != null)
{ {
final String name = contacts.getNameForAddress(mAddress); final String name = contacts.getNameForAddress(mAddress);