Mark not important from priority inbox is destructive;reflect immediately

Fixes b/6944223 Mark not important not destructive

roll back commit destructive actions on cab mode empty; this
is not the correct way to do it and we lost undo aniamtions
Change-Id: Ia30598c07bfdeb0c3eadb5d7276ac71bbf81a77f
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9da68be..b48159a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -401,6 +401,13 @@
         <item quantity="other">&lt;b><xliff:g id="count">%1$d</xliff:g>&lt;/b> reported as not spam.</item>
     </plurals>
 
+    <plurals name="conversation_not_important">
+        <!-- Displayed while reporting one conversation as not important in the important folder -->
+        <item quantity="one">&lt;b><xliff:g id="count">%1$d</xliff:g>&lt;/b> marked not important.</item>
+        <!-- Displayed while reporting several conversations as not important in the important folder -->
+        <item quantity="other">&lt;b><xliff:g id="count">%1$d</xliff:g>&lt;/b> marked not important.</item>
+    </plurals>
+
     <plurals name="conversation_phished">
         <!-- Displayed while reporting one conversation as phishing -->
         <item quantity="one">&lt;b><xliff:g id="count">%1$d</xliff:g>&lt;/b> reported as phishing.</item>
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java
index ab4d9fa..9548b65 100644
--- a/src/com/android/mail/ui/AbstractActivityController.java
+++ b/src/com/android/mail/ui/AbstractActivityController.java
@@ -1794,8 +1794,16 @@
                     break;
                 case R.id.mark_not_important:
                     LogUtils.d(LOG_TAG, "Marking not-important");
-                    // Marking not important is destructive in a mailbox containing only important
-                    // messages
+                    // Marking not important is destructive in a mailbox
+                    // containing only important messages
+                    if (mFolder != null
+                            && mFolder
+                                    .supportsCapability(
+                                            UIProvider.FolderCapabilities.ONLY_IMPORTANT)) {
+                        for (Conversation conv : mTarget) {
+                            conv.localDeleteOnUpdate = true;
+                        }
+                    }
                     mConversationListCursor.updateInt(mContext, mTarget,
                             ConversationColumns.PRIORITY, UIProvider.ConversationPriority.LOW);
                     break;
@@ -1970,10 +1978,6 @@
 
     @Override
     public void onSetEmpty() {
-        ConversationListFragment fragment = getConversationListFragment();
-        if (fragment != null) {
-            getConversationListFragment().commitDestructiveActions();
-        }
     }
 
     @Override
diff --git a/src/com/android/mail/ui/ToastBarOperation.java b/src/com/android/mail/ui/ToastBarOperation.java
index 139e0aa..63b477e 100644
--- a/src/com/android/mail/ui/ToastBarOperation.java
+++ b/src/com/android/mail/ui/ToastBarOperation.java
@@ -109,6 +109,9 @@
             case R.id.mark_not_spam:
                 resId = R.plurals.conversation_not_spam;
                 break;
+            case R.id.mark_not_important:
+                resId = R.plurals.conversation_not_important;
+                break;
             case R.id.mute:
                 resId = R.plurals.conversation_muted;
                 break;