mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-24 16:48:50 -05:00
Added a setting to disable marking messages as read on viewing
This commit is contained in:
parent
5245191900
commit
1d28eb003d
@ -549,6 +549,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
||||
<string name="account_settings_notification_opens_unread_summary">Searches for unread messages when Notification is opened</string>
|
||||
<string name="account_settings_notification_unread_count_label">Show unread count</string>
|
||||
<string name="account_settings_notification_unread_count_summary">Show the number of unread messages in the notification bar.</string>
|
||||
<string name="account_settings_mark_message_as_read_on_view_label">Mark message as read when opening</string>
|
||||
<string name="account_settings_mark_message_as_read_on_view_summary">Mark a message as read when it is opened for viewing</string>
|
||||
|
||||
<string name="account_settings_enable_move_buttons_label">Enable refile buttons</string>
|
||||
<string name="account_settings_enable_move_buttons_summary">Show the Archive, Move, and Spam buttons.</string>
|
||||
|
@ -81,6 +81,17 @@
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
android:title="@string/interaction_preferences">
|
||||
|
||||
<CheckBoxPreference
|
||||
android:persistent="false"
|
||||
android:key="mark_message_as_read_on_view"
|
||||
android:title="@string/account_settings_mark_message_as_read_on_view_label"
|
||||
android:summary="@string/account_settings_mark_message_as_read_on_view_summary" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
android:title="@string/account_settings_sync"
|
||||
android:key="incoming_prefs">
|
||||
|
@ -149,6 +149,7 @@ public class Account implements BaseAccount {
|
||||
private String mCryptoApp;
|
||||
private boolean mCryptoAutoSignature;
|
||||
private boolean mCryptoAutoEncrypt;
|
||||
private boolean mMarkMessageAsReadOnView;
|
||||
|
||||
private CryptoProvider mCryptoProvider = null;
|
||||
|
||||
@ -236,6 +237,7 @@ public class Account implements BaseAccount {
|
||||
mCryptoAutoSignature = false;
|
||||
mCryptoAutoEncrypt = false;
|
||||
mEnabled = true;
|
||||
mMarkMessageAsReadOnView = true;
|
||||
|
||||
searchableFolders = Searchable.ALL;
|
||||
|
||||
@ -391,6 +393,7 @@ public class Account implements BaseAccount {
|
||||
mCryptoAutoSignature = prefs.getBoolean(mUuid + ".cryptoAutoSignature", false);
|
||||
mCryptoAutoEncrypt = prefs.getBoolean(mUuid + ".cryptoAutoEncrypt", false);
|
||||
mEnabled = prefs.getBoolean(mUuid + ".enabled", true);
|
||||
mMarkMessageAsReadOnView = prefs.getBoolean(mUuid + ".markMessageAsReadOnView", true);
|
||||
}
|
||||
|
||||
protected synchronized void delete(Preferences preferences) {
|
||||
@ -472,6 +475,7 @@ public class Account implements BaseAccount {
|
||||
editor.remove(mUuid + ".enabled");
|
||||
editor.remove(mUuid + ".enableMoveButtons");
|
||||
editor.remove(mUuid + ".hideMoveButtonsEnum");
|
||||
editor.remove(mUuid + ".markMessageAsReadOnView");
|
||||
for (String type : networkTypes) {
|
||||
editor.remove(mUuid + ".useCompression." + type);
|
||||
}
|
||||
@ -632,6 +636,7 @@ public class Account implements BaseAccount {
|
||||
editor.putBoolean(mUuid + ".cryptoAutoSignature", mCryptoAutoSignature);
|
||||
editor.putBoolean(mUuid + ".cryptoAutoEncrypt", mCryptoAutoEncrypt);
|
||||
editor.putBoolean(mUuid + ".enabled", mEnabled);
|
||||
editor.putBoolean(mUuid + ".markMessageAsReadOnView", mMarkMessageAsReadOnView);
|
||||
|
||||
editor.putBoolean(mUuid + ".vibrate", mNotificationSetting.shouldVibrate());
|
||||
editor.putInt(mUuid + ".vibratePattern", mNotificationSetting.getVibratePattern());
|
||||
@ -1500,4 +1505,12 @@ public class Account implements BaseAccount {
|
||||
public synchronized void setEnabled(boolean enabled) {
|
||||
mEnabled = enabled;
|
||||
}
|
||||
|
||||
public synchronized boolean isMarkMessageAsReadOnView() {
|
||||
return mMarkMessageAsReadOnView;
|
||||
}
|
||||
|
||||
public synchronized void setMarkMessageAsReadOnView(boolean value) {
|
||||
mMarkMessageAsReadOnView = value;
|
||||
}
|
||||
}
|
||||
|
@ -756,17 +756,16 @@ public class MessageView extends K9Activity implements OnClickListener {
|
||||
mPrevious.requestFocus();
|
||||
}
|
||||
|
||||
private void onMarkAsUnread() {
|
||||
private void onToggleRead() {
|
||||
if (mMessage != null) {
|
||||
mController.setFlag(mAccount, mMessage.getFolder().getName(),
|
||||
new Message[] { mMessage }, Flag.SEEN, false);
|
||||
new Message[] { mMessage }, Flag.SEEN, !mMessage.isSet(Flag.SEEN));
|
||||
mMessageView.setHeaders(mMessage, mAccount);
|
||||
String subject = mMessage.getSubject();
|
||||
setTitle(subject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onDownloadRemainder() {
|
||||
if (mMessage.isSet(Flag.X_DOWNLOADED_FULL)) {
|
||||
return;
|
||||
@ -833,7 +832,7 @@ public class MessageView extends K9Activity implements OnClickListener {
|
||||
onSendAlternate();
|
||||
break;
|
||||
case R.id.mark_as_unread:
|
||||
onMarkAsUnread();
|
||||
onToggleRead();
|
||||
break;
|
||||
case R.id.flag:
|
||||
onFlag();
|
||||
@ -944,6 +943,12 @@ public class MessageView extends K9Activity implements OnClickListener {
|
||||
additionalHeadersItem.setTitle(mMessageView.additionalHeadersVisible() ?
|
||||
R.string.hide_full_header_action : R.string.show_full_header_action);
|
||||
}
|
||||
|
||||
if (mMessage != null) {
|
||||
int actionTitle = mMessage.isSet(Flag.SEEN) ?
|
||||
R.string.mark_as_unread_action : R.string.mark_as_read_action;
|
||||
menu.findItem(R.id.mark_as_unread).setTitle(actionTitle);
|
||||
}
|
||||
}
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
private static final String PREFERENCE_SCREEN_PUSH_ADVANCED = "push_advanced";
|
||||
|
||||
private static final String PREFERENCE_DESCRIPTION = "account_description";
|
||||
private static final String PREFERENCE_MARK_MESSAGE_AS_READ_ON_VIEW = "mark_message_as_read_on_view";
|
||||
private static final String PREFERENCE_COMPOSITION = "composition";
|
||||
private static final String PREFERENCE_MANAGE_IDENTITIES = "manage_identities";
|
||||
private static final String PREFERENCE_FREQUENCY = "account_check_frequency";
|
||||
@ -94,9 +95,7 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
private static final String PREFERENCE_CRYPTO_APP = "crypto_app";
|
||||
private static final String PREFERENCE_CRYPTO_AUTO_SIGNATURE = "crypto_auto_signature";
|
||||
private static final String PREFERENCE_CRYPTO_AUTO_ENCRYPT = "crypto_auto_encrypt";
|
||||
|
||||
private static final String PREFERENCE_LOCAL_STORAGE_PROVIDER = "local_storage_provider";
|
||||
|
||||
private static final String PREFERENCE_CATEGORY_FOLDERS = "folders";
|
||||
private static final String PREFERENCE_ARCHIVE_FOLDER = "archive_folder";
|
||||
private static final String PREFERENCE_DRAFTS_FOLDER = "drafts_folder";
|
||||
@ -114,6 +113,7 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
private PreferenceScreen mComposingScreen;
|
||||
|
||||
private EditTextPreference mAccountDescription;
|
||||
private CheckBoxPreference mMarkMessageAsReadOnView;
|
||||
private ListPreference mCheckFrequency;
|
||||
private ListPreference mDisplayCount;
|
||||
private ListPreference mMessageAge;
|
||||
@ -157,10 +157,7 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
private ListPreference mCryptoApp;
|
||||
private CheckBoxPreference mCryptoAutoSignature;
|
||||
private CheckBoxPreference mCryptoAutoEncrypt;
|
||||
|
||||
private ListPreference mLocalStorageProvider;
|
||||
|
||||
|
||||
private ListPreference mArchiveFolder;
|
||||
private ListPreference mDraftsFolder;
|
||||
private ListPreference mSentFolder;
|
||||
@ -204,6 +201,9 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
}
|
||||
});
|
||||
|
||||
mMarkMessageAsReadOnView = (CheckBoxPreference) findPreference(PREFERENCE_MARK_MESSAGE_AS_READ_ON_VIEW);
|
||||
mMarkMessageAsReadOnView.setChecked(mAccount.isMarkMessageAsReadOnView());
|
||||
|
||||
mMessageFormat = (ListPreference) findPreference(PREFERENCE_MESSAGE_FORMAT);
|
||||
mMessageFormat.setValue(mAccount.getMessageFormat().name());
|
||||
mMessageFormat.setSummary(mMessageFormat.getEntry());
|
||||
@ -672,6 +672,7 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
}
|
||||
|
||||
mAccount.setDescription(mAccountDescription.getText());
|
||||
mAccount.setMarkMessageAsReadOnView(mMarkMessageAsReadOnView.isChecked());
|
||||
mAccount.setNotifyNewMail(mAccountNotify.isChecked());
|
||||
mAccount.setNotifySelfNewMail(mAccountNotifySelf.isChecked());
|
||||
mAccount.setShowOngoing(mAccountNotifySync.isChecked());
|
||||
|
@ -2846,7 +2846,7 @@ public class MessagingController implements Runnable {
|
||||
|| message.getId() == 0) {
|
||||
throw new IllegalArgumentException("Message not found: folder=" + folder + ", uid=" + uid);
|
||||
}
|
||||
if (!message.isSet(Flag.SEEN)) {
|
||||
if (account.isMarkMessageAsReadOnView() && !message.isSet(Flag.SEEN)) {
|
||||
message.setFlag(Flag.SEEN, true);
|
||||
setFlag(new Message[] { message }, Flag.SEEN, true);
|
||||
}
|
||||
|
@ -96,6 +96,9 @@ public class AccountSettings {
|
||||
s.put("localStorageProvider", Settings.versions(
|
||||
new V(1, new StorageProviderSetting())
|
||||
));
|
||||
s.put("markMessageAsReadOnView", Settings.versions(
|
||||
new V(7, new BooleanSetting(true))
|
||||
));
|
||||
s.put("maxPushFolders", Settings.versions(
|
||||
new V(1, new IntegerRangeSetting(0, 100, 10))
|
||||
));
|
||||
|
@ -35,7 +35,7 @@ public class Settings {
|
||||
*
|
||||
* @see SettingsExporter
|
||||
*/
|
||||
public static final int VERSION = 6;
|
||||
public static final int VERSION = 7;
|
||||
|
||||
public static Map<String, Object> validate(int version, Map<String,
|
||||
TreeMap<Integer, SettingsDescription>> settings,
|
||||
|
Loading…
Reference in New Issue
Block a user