diff options
author | Andrew Sapperstein <asapperstein@google.com> | 2014-03-25 16:00:43 -0700 |
---|---|---|
committer | Andrew Sapperstein <asapperstein@google.com> | 2014-03-26 11:45:10 -0700 |
commit | 1165d291b938f406631768795c0dbee58898315e (patch) | |
tree | 1774899ef95f0ec279426e151d9c05034e38adb9 /src | |
parent | 1b0675c1abb42c4a9add7178f1cc7a7bacbe76ec (diff) | |
download | android_packages_apps_UnifiedEmail-1165d291b938f406631768795c0dbee58898315e.tar.gz android_packages_apps_UnifiedEmail-1165d291b938f406631768795c0dbee58898315e.tar.bz2 android_packages_apps_UnifiedEmail-1165d291b938f406631768795c0dbee58898315e.zip |
Commit DestructiveActions immediately. b/9904716.
For whatever reason, we have this weird two stage
commit of DestructiveActions. We call
performAndSetNextAction twice every time we wanted
to commit. This results in the next destructive action
trying to perform the action again, but that doesn't
matter because we debounce the actions so they're only
performed once.
Unfortunately, in two pane mode, when we transition back
to the conversation list, we only called performAndSetNextAction
once. As a result, the first call tried to re-apply the old
version. But it was never called a second time so we never
committed the action. Worse, the action would sit there waiting
for another action and then get applied.
Now, if we're in tablet, we set the next action so that
the single call will commit when the animation completes.
A proper fix probably involved rewriting all of this
logic and is not something I want to touch this late
in the release.
Change-Id: Iaa7b4c7d21837b93916ada5b6c9b49b13361be08
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/mail/ui/AbstractActivityController.java | 17 | ||||
-rw-r--r-- | src/com/android/mail/ui/AnimatedAdapter.java | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java index d075ca05c..9ec78f062 100644 --- a/src/com/android/mail/ui/AbstractActivityController.java +++ b/src/com/android/mail/ui/AbstractActivityController.java @@ -1978,6 +1978,23 @@ public abstract class AbstractActivityController implements ActivityController, if (!showNextConversation(target, operation)) { // This method will be called again if the user selects an autoadvance option + + // HACKFIX around b/9904716. We were not properly performing the last + // DestructiveAction. A proper fix probably involves rewriting + // the logic for animating changes in the list as well as undo + // and probably batch DestructiveActions. The change is limited to + // tablets where the issue occurs. + final ConversationListFragment convListFragment = getConversationListFragment(); + if (mIsTablet && convListFragment != null) { + convListFragment.getAnimatedAdapter().setNextAction( + new SwipeableListView.ListItemsRemovedListener() { + @Override + public void onListItemsRemoved() { + action.performAction(); + } + } + ); + } return; } // If the conversation is in the selected set, remove it from the set. diff --git a/src/com/android/mail/ui/AnimatedAdapter.java b/src/com/android/mail/ui/AnimatedAdapter.java index 866c0e5f9..affba1030 100644 --- a/src/com/android/mail/ui/AnimatedAdapter.java +++ b/src/com/android/mail/ui/AnimatedAdapter.java @@ -867,6 +867,10 @@ public class AnimatedAdapter extends SimpleCursorAdapter { mPendingDestruction = next; } + /* package */ void setNextAction(ListItemsRemovedListener next) { + mPendingDestruction = next; + } + private void updateAnimatingConversationItems(Object obj, HashSet<Long> items) { if (!items.isEmpty()) { if (obj instanceof ConversationItemView) { |