diff options
author | Jin Cao <jinyan@google.com> | 2014-03-26 13:04:40 -0700 |
---|---|---|
committer | Jin Cao <jinyan@google.com> | 2014-03-26 14:08:27 -0700 |
commit | d4e02e4072a34c0207841298ddcb4f081a94973a (patch) | |
tree | f4a310bc2d82ddaefb0b4a7287240d1f17a8ddb1 /src | |
parent | 4f347e811052f446c3958c76db278bcd7b39a44f (diff) | |
download | android_packages_apps_UnifiedEmail-d4e02e4072a34c0207841298ddcb4f081a94973a.tar.gz android_packages_apps_UnifiedEmail-d4e02e4072a34c0207841298ddcb4f081a94973a.tar.bz2 android_packages_apps_UnifiedEmail-d4e02e4072a34c0207841298ddcb4f081a94973a.zip |
Change default swipe action
For folders where archive is not feasible (e.g. All Mail), we are
changing the default action to be a no-op (bounce the item back)
instead of deleting it since it can be confusing for users.
For delete, it still deletes everything regardless.
b/9825846
Change-Id: Id56d2327db3b2bc48f94a8afb3ca32c95b56c4ef
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/mail/ui/ConversationListFragment.java | 19 | ||||
-rw-r--r-- | src/com/android/mail/ui/SwipeableListView.java | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/com/android/mail/ui/ConversationListFragment.java b/src/com/android/mail/ui/ConversationListFragment.java index f6e40f4c4..8587b6bf3 100644 --- a/src/com/android/mail/ui/ConversationListFragment.java +++ b/src/com/android/mail/ui/ConversationListFragment.java @@ -865,16 +865,18 @@ public final class ConversationListFragment extends ListFragment implements } else { final int action; mListView.enableSwipe(true); - if (ConversationListContext.isSearchResult(mViewContext) - || (mFolder != null && mFolder.isType(FolderType.SPAM))) { - action = R.id.delete; - } else if (mFolder == null) { + if (mFolder == null) { action = R.id.remove_folder; } else { - // We have enough information to respect user settings. switch (swipeSetting) { + // Try to respect user's setting as best as we can and default to doing nothing + case Swipe.DELETE: + action = R.id.delete; + break; case Swipe.ARCHIVE: - if (mAccount.supportsCapability(AccountCapabilities.ARCHIVE)) { + // Special case spam since it shouldn't remove spam folder label on swipe + if (mAccount.supportsCapability(AccountCapabilities.ARCHIVE) + && !mFolder.isSpam()) { if (mFolder.supportsCapability(FolderCapabilities.ARCHIVE)) { action = R.id.archive; break; @@ -887,12 +889,11 @@ public final class ConversationListFragment extends ListFragment implements /* * If we get here, we don't support archive, on either the account or the - * folder, so we want to fall through into the delete case. + * folder, so we want to fall through into the default doing nothing case */ //$FALL-THROUGH$ - case Swipe.DELETE: default: - action = R.id.delete; + action = R.id.swipe_action_do_nothing; break; } } diff --git a/src/com/android/mail/ui/SwipeableListView.java b/src/com/android/mail/ui/SwipeableListView.java index 8e03b9395..ad41db780 100644 --- a/src/com/android/mail/ui/SwipeableListView.java +++ b/src/com/android/mail/ui/SwipeableListView.java @@ -205,7 +205,7 @@ public class SwipeableListView extends ListView implements Callback, OnScrollLis @Override public boolean canChildBeDismissed(SwipeableItemView v) { - return v.canChildBeDismissed(); + return mSwipeAction != R.id.swipe_action_do_nothing && v.canChildBeDismissed(); } @Override |