mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
Added option to disable confirmation dialog for "mark all as read"
Fixes issue 1415
This commit is contained in:
parent
c852721f8a
commit
4aec4b096c
@ -344,6 +344,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
|||||||
<string name="global_settings_confirm_action_archive">Archive</string>
|
<string name="global_settings_confirm_action_archive">Archive</string>
|
||||||
<string name="global_settings_confirm_action_delete">Delete (message view only)</string>
|
<string name="global_settings_confirm_action_delete">Delete (message view only)</string>
|
||||||
<string name="global_settings_confirm_action_spam">Spam</string>
|
<string name="global_settings_confirm_action_spam">Spam</string>
|
||||||
|
<string name="global_settings_confirm_action_mark_all_as_read">Mark all as read</string>
|
||||||
<string name="global_settings_confirm_action_send">Send</string>
|
<string name="global_settings_confirm_action_send">Send</string>
|
||||||
|
|
||||||
<string name="global_settings_privacy_mode_title">Lock-screen notifications</string>
|
<string name="global_settings_privacy_mode_title">Lock-screen notifications</string>
|
||||||
|
@ -148,6 +148,7 @@ public class K9 extends Application {
|
|||||||
|
|
||||||
private static boolean mConfirmDelete = false;
|
private static boolean mConfirmDelete = false;
|
||||||
private static boolean mConfirmSpam = false;
|
private static boolean mConfirmSpam = false;
|
||||||
|
private static boolean mConfirmMarkAllAsRead = true;
|
||||||
private static boolean mKeyguardPrivacy = false;
|
private static boolean mKeyguardPrivacy = false;
|
||||||
|
|
||||||
private static boolean mMessageListStars = true;
|
private static boolean mMessageListStars = true;
|
||||||
@ -446,6 +447,7 @@ public class K9 extends Application {
|
|||||||
|
|
||||||
editor.putBoolean("confirmDelete", mConfirmDelete);
|
editor.putBoolean("confirmDelete", mConfirmDelete);
|
||||||
editor.putBoolean("confirmSpam", mConfirmSpam);
|
editor.putBoolean("confirmSpam", mConfirmSpam);
|
||||||
|
editor.putBoolean("confirmMarkAllAsRead", mConfirmMarkAllAsRead);
|
||||||
|
|
||||||
editor.putBoolean("keyguardPrivacy", mKeyguardPrivacy);
|
editor.putBoolean("keyguardPrivacy", mKeyguardPrivacy);
|
||||||
|
|
||||||
@ -499,6 +501,7 @@ public class K9 extends Application {
|
|||||||
|
|
||||||
mConfirmDelete = sprefs.getBoolean("confirmDelete", false);
|
mConfirmDelete = sprefs.getBoolean("confirmDelete", false);
|
||||||
mConfirmSpam = sprefs.getBoolean("confirmSpam", false);
|
mConfirmSpam = sprefs.getBoolean("confirmSpam", false);
|
||||||
|
mConfirmMarkAllAsRead = sprefs.getBoolean("confirmMarkAllAsRead", true);
|
||||||
|
|
||||||
|
|
||||||
mKeyguardPrivacy = sprefs.getBoolean("keyguardPrivacy", false);
|
mKeyguardPrivacy = sprefs.getBoolean("keyguardPrivacy", false);
|
||||||
@ -946,6 +949,14 @@ public class K9 extends Application {
|
|||||||
mConfirmSpam = confirm;
|
mConfirmSpam = confirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean confirmMarkAllAsRead() {
|
||||||
|
return mConfirmMarkAllAsRead;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setConfirmMarkAllAsRead(final boolean confirm) {
|
||||||
|
mConfirmMarkAllAsRead = confirm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether privacy rules should be applied when system is locked
|
* @return Whether privacy rules should be applied when system is locked
|
||||||
*/
|
*/
|
||||||
|
@ -631,9 +631,21 @@ public class FolderList extends K9ListActivity {
|
|||||||
|
|
||||||
private void onMarkAllAsRead(final Account account, final String folder) {
|
private void onMarkAllAsRead(final Account account, final String folder) {
|
||||||
mSelectedContextFolder = mAdapter.getFolder(folder);
|
mSelectedContextFolder = mAdapter.getFolder(folder);
|
||||||
|
if (K9.confirmMarkAllAsRead()) {
|
||||||
showDialog(DIALOG_MARK_ALL_AS_READ);
|
showDialog(DIALOG_MARK_ALL_AS_READ);
|
||||||
|
} else {
|
||||||
|
markAllAsRead();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void markAllAsRead() {
|
||||||
|
try {
|
||||||
|
MessagingController.getInstance(getApplication())
|
||||||
|
.markAllMessagesRead(mAccount, mSelectedContextFolder.name);
|
||||||
|
mSelectedContextFolder.unreadMessageCount = 0;
|
||||||
|
mHandler.dataChanged();
|
||||||
|
} catch (Exception e) { /* Ignore */ }
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(int id) {
|
public Dialog onCreateDialog(int id) {
|
||||||
@ -648,12 +660,7 @@ public class FolderList extends K9ListActivity {
|
|||||||
new Runnable() {
|
new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
markAllAsRead();
|
||||||
MessagingController.getInstance(getApplication())
|
|
||||||
.markAllMessagesRead(mAccount, mSelectedContextFolder.name);
|
|
||||||
mSelectedContextFolder.unreadMessageCount = 0;
|
|
||||||
mHandler.dataChanged();
|
|
||||||
} catch (Exception e) { /* Ignore */ }
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1252,7 +1252,26 @@ public class MessageList
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onMarkAllAsRead(final Account account, final String folder) {
|
private void onMarkAllAsRead(final Account account, final String folder) {
|
||||||
|
if (K9.confirmMarkAllAsRead()) {
|
||||||
showDialog(DIALOG_MARK_ALL_AS_READ);
|
showDialog(DIALOG_MARK_ALL_AS_READ);
|
||||||
|
} else {
|
||||||
|
markAllAsRead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void markAllAsRead() {
|
||||||
|
try {
|
||||||
|
mController.markAllMessagesRead(mAccount, mCurrentFolder.name);
|
||||||
|
|
||||||
|
synchronized (mAdapter.messages) {
|
||||||
|
for (MessageInfoHolder holder : mAdapter.messages) {
|
||||||
|
holder.read = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mHandler.sortMessages();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onExpunge(final Account account, String folderName) {
|
private void onExpunge(final Account account, String folderName) {
|
||||||
@ -1272,18 +1291,7 @@ public class MessageList
|
|||||||
new Runnable() {
|
new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
markAllAsRead();
|
||||||
mController.markAllMessagesRead(mAccount, mCurrentFolder.name);
|
|
||||||
|
|
||||||
synchronized (mAdapter.messages) {
|
|
||||||
for (MessageInfoHolder holder : mAdapter.messages) {
|
|
||||||
holder.read = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mHandler.sortMessages();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
case R.id.dialog_confirm_spam:
|
case R.id.dialog_confirm_spam:
|
||||||
|
@ -181,9 +181,16 @@ public class Prefs extends K9PreferenceActivity {
|
|||||||
mStartIntegratedInbox.setChecked(K9.startIntegratedInbox());
|
mStartIntegratedInbox.setChecked(K9.startIntegratedInbox());
|
||||||
|
|
||||||
mConfirmActions = (CheckBoxListPreference) findPreference(PREFERENCE_CONFIRM_ACTIONS);
|
mConfirmActions = (CheckBoxListPreference) findPreference(PREFERENCE_CONFIRM_ACTIONS);
|
||||||
mConfirmActions.setItems(new CharSequence[] {getString(R.string.global_settings_confirm_action_delete),
|
mConfirmActions.setItems(new CharSequence[] {
|
||||||
getString(R.string.global_settings_confirm_action_spam)});
|
getString(R.string.global_settings_confirm_action_delete),
|
||||||
mConfirmActions.setCheckedItems(new boolean[] {K9.confirmDelete(), K9.confirmSpam()});
|
getString(R.string.global_settings_confirm_action_spam),
|
||||||
|
getString(R.string.global_settings_confirm_action_mark_all_as_read)
|
||||||
|
});
|
||||||
|
mConfirmActions.setCheckedItems(new boolean[] {
|
||||||
|
K9.confirmDelete(),
|
||||||
|
K9.confirmSpam(),
|
||||||
|
K9.confirmMarkAllAsRead()
|
||||||
|
});
|
||||||
|
|
||||||
mPrivacyMode = (CheckBoxPreference) findPreference(PREFERENCE_PRIVACY_MODE);
|
mPrivacyMode = (CheckBoxPreference) findPreference(PREFERENCE_PRIVACY_MODE);
|
||||||
mPrivacyMode.setChecked(K9.keyguardPrivacy());
|
mPrivacyMode.setChecked(K9.keyguardPrivacy());
|
||||||
@ -307,6 +314,7 @@ public class Prefs extends K9PreferenceActivity {
|
|||||||
K9.setStartIntegratedInbox(!mHideSpecialAccounts.isChecked() && mStartIntegratedInbox.isChecked());
|
K9.setStartIntegratedInbox(!mHideSpecialAccounts.isChecked() && mStartIntegratedInbox.isChecked());
|
||||||
K9.setConfirmDelete(mConfirmActions.getCheckedItems()[0]);
|
K9.setConfirmDelete(mConfirmActions.getCheckedItems()[0]);
|
||||||
K9.setConfirmSpam(mConfirmActions.getCheckedItems()[1]);
|
K9.setConfirmSpam(mConfirmActions.getCheckedItems()[1]);
|
||||||
|
K9.setConfirmMarkAllAsRead(mConfirmActions.getCheckedItems()[2]);
|
||||||
K9.setKeyguardPrivacy(mPrivacyMode.isChecked());
|
K9.setKeyguardPrivacy(mPrivacyMode.isChecked());
|
||||||
K9.setMeasureAccounts(mMeasureAccounts.isChecked());
|
K9.setMeasureAccounts(mMeasureAccounts.isChecked());
|
||||||
K9.setCountSearchMessages(mCountSearch.isChecked());
|
K9.setCountSearchMessages(mCountSearch.isChecked());
|
||||||
|
Loading…
Reference in New Issue
Block a user