1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Added setting to disable using the background as (un)read indicator

This commit is contained in:
cketti 2012-10-02 22:56:06 +02:00
parent fad52e6dac
commit 952c40710e
9 changed files with 46 additions and 10 deletions

View File

@ -43,6 +43,8 @@
<attr name="textColorPrimaryRecipientDropdown" format="reference" />
<attr name="textColorSecondaryRecipientDropdown" format="reference" />
<attr name="backgroundColorChooseAccountHeader" format="color" />
<attr name="messageListReadItemBackgroundColor" format="reference|color"/>
<attr name="messageListUnreadItemBackgroundColor" format="reference|color"/>
</declare-styleable>
</resources>

View File

@ -1147,4 +1147,7 @@ http://k9mail.googlecode.com/
<string name="pull_to_refresh_remote_search_from_local_search_pull">Pull to search server…</string>
<string name="pull_to_refresh_remote_search_from_local_search_release">Release to search server…</string>
<string name="remote_search_unavailable_no_network">Remote search is unavailable without network connectivity.</string>
<string name="global_settings_background_as_unread_indicator_label">Use background as (un)read indicator</string>
<string name="global_settings_background_as_unread_indicator_summary">Show read and unread messages with different background colors</string>
</resources>

View File

@ -42,6 +42,8 @@
<item name="iconMenuShowFolders">@drawable/ic_show_folders</item>
<item name="textColorPrimaryRecipientDropdown">@android:color/primary_text_light</item>
<item name="textColorSecondaryRecipientDropdown">@android:color/secondary_text_light</item>
<item name="messageListReadItemBackgroundColor">#80cdcdcd</item>
<item name="messageListUnreadItemBackgroundColor">#00ffffff</item>
</style>
<style name="Theme.K9.Dark.Base" parent="Theme.Sherlock">
@ -85,6 +87,8 @@
<item name="iconMenuShowFolders">@drawable/ic_show_folders</item>
<item name="textColorPrimaryRecipientDropdown">@android:color/primary_text_dark</item>
<item name="textColorSecondaryRecipientDropdown">@android:color/secondary_text_dark</item>
<item name="messageListReadItemBackgroundColor">#00000000</item>
<item name="messageListUnreadItemBackgroundColor">#805a5a5a</item>
</style>
<style name="Theme.K9.Light" parent="Theme.K9.Light.Base">

View File

@ -137,6 +137,12 @@
android:dependency="messagelist_show_contact_name"
/>
<CheckBoxPreference
android:persistent="false"
android:key="messagelist_background_as_unread_indicator"
android:title="@string/global_settings_background_as_unread_indicator_label"
android:summary="@string/global_settings_background_as_unread_indicator_summary"
/>
</PreferenceCategory>

View File

@ -204,6 +204,8 @@ public class K9 extends Application {
private static SortType mSortType;
private static HashMap<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>();
private static boolean sUseBackgroundAsUnreadIndicator = true;
/**
* The MIME type(s) of attachments we're willing to view.
*/
@ -469,6 +471,7 @@ public class K9 extends Application {
editor.putString("notificationHideSubject", sNotificationHideSubject.toString());
editor.putString("attachmentdefaultpath", mAttachmentDefaultPath);
editor.putBoolean("useBackgroundAsUnreadIndicator", sUseBackgroundAsUnreadIndicator);
fontSizes.save(editor);
}
@ -637,6 +640,7 @@ public class K9 extends Application {
}
mAttachmentDefaultPath = sprefs.getString("attachmentdefaultpath", Environment.getExternalStorageDirectory().toString());
sUseBackgroundAsUnreadIndicator = sprefs.getBoolean("useBackgroundAsUnreadIndicator", true);
fontSizes.load(sprefs);
try {
@ -1116,4 +1120,11 @@ public class K9 extends Application {
mSortAscending.put(sortType, sortAscending);
}
public static synchronized boolean useBackgroundAsUnreadIndicator() {
return sUseBackgroundAsUnreadIndicator;
}
public static synchronized void setUseBackgroundAsUnreadIndicator(boolean enabled) {
sUseBackgroundAsUnreadIndicator = enabled;
}
}

View File

@ -2493,14 +2493,15 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().generateColorChip(message.read,message.message.toMe(), false, message.flagged).drawable());
}
// if (K9.getK9Theme() == K9.THEME_LIGHT) {
// // Light theme: light grey background for read messages
// view.setBackgroundColor(message.read ?
// Color.rgb(230, 230, 230) : Color.rgb(255, 255, 255));
// } else {
// // Dark theme: dark grey background for unread messages
// view.setBackgroundColor(message.read ? 0 : Color.rgb(45, 45, 45));
// }
if (K9.useBackgroundAsUnreadIndicator()) {
int res = (message.read) ? R.attr.messageListReadItemBackgroundColor :
R.attr.messageListUnreadItemBackgroundColor;
TypedValue outValue = new TypedValue();
getTheme().resolveAttribute(res, outValue, true);
view.setBackgroundColor(outValue.data);
}
String subject = null;

View File

@ -85,6 +85,7 @@ public class Prefs extends K9PreferenceActivity {
private static final String PREFERENCE_SENSITIVE_LOGGING = "sensitive_logging";
private static final String PREFERENCE_ATTACHMENT_DEF_PATH = "attachment_default_path";
private static final String PREFERENCE_BACKGROUND_AS_UNREAD_INDICATOR = "messagelist_background_as_unread_indicator";
private static final int ACTIVITY_CHOOSE_FOLDER = 1;
private ListPreference mLanguage;
@ -124,6 +125,7 @@ public class Prefs extends K9PreferenceActivity {
private CheckBoxPreference mBatchButtonsMove;
private CheckBoxPreference mBatchButtonsFlag;
private CheckBoxPreference mBatchButtonsUnselect;
private CheckBoxPreference mBackgroundAsUnreadIndicator;
public static void actionPrefs(Context context) {
Intent i = new Intent(context, Prefs.class);
@ -223,6 +225,9 @@ public class Prefs extends K9PreferenceActivity {
mShowContactName = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME);
mShowContactName.setChecked(K9.showContactName());
mBackgroundAsUnreadIndicator = (CheckBoxPreference)findPreference(PREFERENCE_BACKGROUND_AS_UNREAD_INDICATOR);
mBackgroundAsUnreadIndicator.setChecked(K9.useBackgroundAsUnreadIndicator());
mChangeContactNameColor = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_CONTACT_NAME_COLOR);
mChangeContactNameColor.setChecked(K9.changeContactNameColor());
if (K9.changeContactNameColor()) {
@ -406,6 +411,7 @@ public class Prefs extends K9PreferenceActivity {
K9.setShowCorrespondentNames(mShowCorrespondentNames.isChecked());
K9.setMessageListSenderAboveSubject(mSenderAboveSubject.isChecked());
K9.setShowContactName(mShowContactName.isChecked());
K9.setUseBackgroundAsUnreadIndicator(mBackgroundAsUnreadIndicator.isChecked());
K9.setChangeContactNameColor(mChangeContactNameColor.isChecked());
K9.setMessageViewFixedWidthFont(mFixedWidth.isChecked());
K9.setMessageViewReturnToList(mReturnToList.isChecked());

View File

@ -216,6 +216,9 @@ public class GlobalSettings {
new V(12, new EnumSetting(NotificationHideSubject.class,
NotificationHideSubject.NEVER))
));
s.put("useBackgroundAsUnreadIndicator", Settings.versions(
new V(19, new BooleanSetting(true))
));
SETTINGS = Collections.unmodifiableMap(s);

View File

@ -35,7 +35,7 @@ public class Settings {
*
* @see SettingsExporter
*/
public static final int VERSION = 18;
public static final int VERSION = 19;
public static Map<String, Object> validate(int version, Map<String,
TreeMap<Integer, SettingsDescription>> settings,