Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d4a2132 authored by Jesse Vincent's avatar Jesse Vincent
Browse files

Remove "mark all as read" from the UI. (leaving the backend support for now)

User-facing "select all, mark as read" is slightly different but less confusing and cluttered than the duplicated option
parent 5a29c8a4
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -4,10 +4,6 @@
        android:id="@+id/open_folder"
        android:title="@string/open_action"
    />
    <item
        android:id="@+id/mark_all_as_read"
        android:title="@string/mark_all_as_read_action"
    />
    <item
        android:id="@+id/empty_trash"
        android:title="@string/empty_trash_action"
+0 −5
Original line number Diff line number Diff line
@@ -53,11 +53,6 @@
        android:icon="?attr/iconActionRefresh"
        android:showAsAction="always"
        android:title="@string/check_mail_action"/>
    <item
        android:id="@+id/mark_all_as_read"
        android:icon="?attr/iconMenuInbox"
        android:showAsAction="never"
        android:title="@string/mark_all_as_read_action"/>
    <item
        android:id="@+id/expunge"
        android:showAsAction="never"
+0 −11
Original line number Diff line number Diff line
@@ -154,7 +154,6 @@ public class K9 extends Application {
    private static boolean mConfirmDelete = false;
    private static boolean mConfirmDeleteStarred = false;
    private static boolean mConfirmSpam = false;
    private static boolean mConfirmMarkAllAsRead = true;

    private static NotificationHideSubject sNotificationHideSubject = NotificationHideSubject.NEVER;

@@ -464,7 +463,6 @@ public class K9 extends Application {
        editor.putBoolean("confirmDelete", mConfirmDelete);
        editor.putBoolean("confirmDeleteStarred", mConfirmDeleteStarred);
        editor.putBoolean("confirmSpam", mConfirmSpam);
        editor.putBoolean("confirmMarkAllAsRead", mConfirmMarkAllAsRead);

        editor.putString("sortTypeEnum", mSortType.name());
        editor.putBoolean("sortAscending", mSortAscending.get(mSortType));
@@ -620,7 +618,6 @@ public class K9 extends Application {
        mConfirmDelete = sprefs.getBoolean("confirmDelete", false);
        mConfirmDeleteStarred = sprefs.getBoolean("confirmDeleteStarred", false);
        mConfirmSpam = sprefs.getBoolean("confirmSpam", false);
        mConfirmMarkAllAsRead = sprefs.getBoolean("confirmMarkAllAsRead", true);

        try {
            String value = sprefs.getString("sortTypeEnum", Account.DEFAULT_SORT_TYPE.name());
@@ -1025,14 +1022,6 @@ public class K9 extends Application {
        mConfirmSpam = confirm;
    }

    public static boolean confirmMarkAllAsRead() {
        return mConfirmMarkAllAsRead;
    }

    public static void setConfirmMarkAllAsRead(final boolean confirm) {
        mConfirmMarkAllAsRead = confirm;
    }

    public static NotificationHideSubject getNotificationHideSubject() {
        return sNotificationHideSubject;
    }
+0 −43
Original line number Diff line number Diff line
@@ -79,7 +79,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
    /*
     * Constants for showDialog() etc.
     */
    private static final int DIALOG_MARK_ALL_AS_READ = 1;
    private static final int DIALOG_FIND_FOLDER = 2;

    private static final String EXTRA_ACCOUNT = "account";
@@ -649,10 +648,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
            onOpenFolder(folder.name);
            break;

        case R.id.mark_all_as_read:
            onMarkAllAsRead(mAccount, folder.name);
            break;

        case R.id.send_messages:
            sendMail(mAccount);

@@ -687,41 +682,9 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {

    private FolderInfoHolder mSelectedContextFolder = null;


    private void onMarkAllAsRead(final Account account, final String folder) {
        mSelectedContextFolder = mAdapter.getFolder(folder);
        if (K9.confirmMarkAllAsRead()) {
            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
    public Dialog onCreateDialog(int id) {
        switch (id) {
        case DIALOG_MARK_ALL_AS_READ:
            return ConfirmationDialog.create(this, id, R.string.mark_all_as_read_dlg_title,
                                             getString(R.string.mark_all_as_read_dlg_instructions_fmt,
                                                     mSelectedContextFolder.displayName),
                                             R.string.okay_action, R.string.cancel_action,
            new Runnable() {
                @Override
                public void run() {
                    markAllAsRead();
                }
            });
        case DIALOG_FIND_FOLDER: {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(R.string.filter_folders_action);
@@ -776,12 +739,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
    @Override
    public void onPrepareDialog(int id, Dialog dialog) {
        switch (id) {
        case DIALOG_MARK_ALL_AS_READ: {
            AlertDialog alertDialog = (AlertDialog) dialog;
            alertDialog.setMessage(getString(R.string.mark_all_as_read_dlg_instructions_fmt,
                                             mSelectedContextFolder.displayName));
            break;
        }
        case DIALOG_FIND_FOLDER: {
            AlertDialog alertDialog = (AlertDialog) dialog;
            EditText input = (EditText) alertDialog.findViewById(R.id.filter_folders);
+0 −48
Original line number Diff line number Diff line
@@ -217,7 +217,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
     */
    private static final Message[] EMPTY_MESSAGE_ARRAY = new Message[0];

    private static final int DIALOG_MARK_ALL_AS_READ = 1;

    private static final int ACTIVITY_CHOOSE_FOLDER_MOVE = 1;
    private static final int ACTIVITY_CHOOSE_FOLDER_COPY = 2;
@@ -1338,26 +1337,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
        }
    }

    private void onMarkAllAsRead(final Account account, final String folder) {
        if (K9.confirmMarkAllAsRead()) {
            showDialog(DIALOG_MARK_ALL_AS_READ);
        } else {
            markAllAsRead();
        }
    }

    private void markAllAsRead() {
        try {
            mController.markAllMessagesRead(mAccount, mCurrentFolder.name);

            for (MessageInfoHolder holder : mAdapter.getMessages()) {
                holder.read = true;
            }
            mAdapter.sortMessages();
        } catch (Exception e) {
            // Ignore
        }
    }

    private void onExpunge(final Account account, String folderName) {
        mController.expunge(account, folderName, null);
@@ -1366,19 +1345,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
    @Override
    public Dialog onCreateDialog(int id) {
        switch (id) {
        case DIALOG_MARK_ALL_AS_READ:
            return ConfirmationDialog.create(this, id,
                                             R.string.mark_all_as_read_dlg_title,
                                             getString(R.string.mark_all_as_read_dlg_instructions_fmt,
                                                     mCurrentFolder.displayName),
                                             R.string.okay_action,
                                             R.string.cancel_action,
            new Runnable() {
                @Override
                public void run() {
                    markAllAsRead();
                }
            });
        case R.id.dialog_confirm_spam:
            return ConfirmationDialog.create(this, id,
                                             R.string.dialog_confirm_spam_title,
@@ -1415,13 +1381,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
    @Override
    public void onPrepareDialog(final int id, final Dialog dialog) {
        switch (id) {
        case DIALOG_MARK_ALL_AS_READ: {
            if (mCurrentFolder != null) {
                ((AlertDialog)dialog).setMessage(getString(R.string.mark_all_as_read_dlg_instructions_fmt,
                                                 mCurrentFolder.displayName));
            }
            break;
        }
        case R.id.dialog_confirm_spam: {
            // mActiveMessages can be null if Android restarts the activity
            // while this dialog is not actually shown (but was displayed at
@@ -1556,12 +1515,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
            mController.sendPendingMessages(mAccount, mAdapter.mListener);
            return true;
        }
        case R.id.mark_all_as_read: {
            if (mFolderName != null) {
                onMarkAllAsRead(mAccount, mFolderName);
            }
            return true;
        }
        case R.id.folder_settings: {
            if (mFolderName != null) {
                FolderSettings.actionSettings(this, mAccount, mFolderName);
@@ -1596,7 +1549,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
    public boolean onPrepareOptionsMenu(Menu menu) {

        if (mQueryString != null) {
            menu.findItem(R.id.mark_all_as_read).setVisible(false);
            menu.findItem(R.id.expunge).setVisible(false);
            menu.findItem(R.id.check_mail).setVisible(false);
            menu.findItem(R.id.send_messages).setVisible(false);
Loading