diff options
author | Andy Huang <ath@google.com> | 2012-07-24 18:50:34 -0700 |
---|---|---|
committer | Mindy Pereira <mindyp@google.com> | 2012-07-25 11:38:10 -0700 |
commit | 62d7962b2b4d73f8414bbab1f42952442ac25be0 (patch) | |
tree | faa81f3e7d690a59cfc60f35c44f9632e5665fb2 /src/com/android/mail/ui/LeaveBehindItem.java | |
parent | c11011d29d87f76d902438b2f79c75d1ebc45fda (diff) | |
download | android_packages_apps_UnifiedEmail-62d7962b2b4d73f8414bbab1f42952442ac25be0.tar.gz android_packages_apps_UnifiedEmail-62d7962b2b4d73f8414bbab1f42952442ac25be0.tar.bz2 android_packages_apps_UnifiedEmail-62d7962b2b4d73f8414bbab1f42952442ac25be0.zip |
Animate out existing leave behinds.
When the user swipes away a new item and there is a leave behind showing,
shrink away the existing leave behind so that we maintain some reasonable positioning.
Change-Id: I7318cc6ad1a7c0c8ed3420374680bac549c2e458
Diffstat (limited to 'src/com/android/mail/ui/LeaveBehindItem.java')
-rw-r--r-- | src/com/android/mail/ui/LeaveBehindItem.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/com/android/mail/ui/LeaveBehindItem.java b/src/com/android/mail/ui/LeaveBehindItem.java index 51c1c997c..3482183a1 100644 --- a/src/com/android/mail/ui/LeaveBehindItem.java +++ b/src/com/android/mail/ui/LeaveBehindItem.java @@ -22,7 +22,6 @@ import android.text.Html; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; -import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; @@ -32,13 +31,12 @@ import com.android.mail.providers.Account; import com.android.mail.providers.Conversation; import com.google.common.collect.ImmutableList; -public class LeaveBehindItem extends LinearLayout implements OnClickListener, +public class LeaveBehindItem extends AnimatingItemView implements OnClickListener, SwipeableItemView { private ToastBarOperation mUndoOp; private Account mAccount; private AnimatedAdapter mAdapter; - private Conversation mConversation; private ConversationCursor mConversationCursor; public LeaveBehindItem(Context context) { @@ -65,7 +63,7 @@ public class LeaveBehindItem extends LinearLayout implements OnClickListener, // TODO: Use UIProvider.SEQUENCE_QUERY_PARAMETER to indicate // the set of // commands to undo - mAdapter.clearLeaveBehind(mConversation); + mAdapter.clearLeaveBehind(getData()); mAdapter.setUndo(true); mConversationCursor.undo(getContext(), mAccount.undoUri); } @@ -79,15 +77,20 @@ public class LeaveBehindItem extends LinearLayout implements OnClickListener, mAccount = account; mAdapter = adapter; mConversationCursor = (ConversationCursor)adapter.getCursor(); - mConversation = target; + setData(target); ((TextView) findViewById(R.id.undo_descriptionview)).setText(Html.fromHtml(mUndoOp .getDescription(getContext()))); ((RelativeLayout) findViewById(R.id.undo_button)).setOnClickListener(this); } public void commit() { - mConversationCursor.delete(getContext(), ImmutableList.of(mConversation)); - mAdapter.clearLeaveBehind(mConversation); + Conversation conv = getData(); + mConversationCursor.delete(getContext(), ImmutableList.of(conv)); + mAdapter.clearLeaveBehind(conv); + } + + public long getConversationId() { + return getData().id; } @Override |