From d45081abaab2795789ad982682b733fbdcde22f1 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 7 Nov 2010 19:40:42 +0000 Subject: [PATCH] Animate the batch-operations toolbar (Imported from AOSP) --- res/anim/footer_appear.xml | 26 ++++++++++++++++ res/anim/footer_disappear.xml | 26 ++++++++++++++++ src/com/fsck/k9/activity/MessageList.java | 36 +++++++++++++++++++---- 3 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 res/anim/footer_appear.xml create mode 100644 res/anim/footer_disappear.xml diff --git a/res/anim/footer_appear.xml b/res/anim/footer_appear.xml new file mode 100644 index 000000000..29beff9a4 --- /dev/null +++ b/res/anim/footer_appear.xml @@ -0,0 +1,26 @@ + + + + + + diff --git a/res/anim/footer_disappear.xml b/res/anim/footer_disappear.xml new file mode 100644 index 000000000..35a28cb9c --- /dev/null +++ b/res/anim/footer_disappear.xml @@ -0,0 +1,26 @@ + + + + + + diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 6eb73604e..51e97df7b 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -23,6 +23,9 @@ import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; import android.util.Log; import android.util.TypedValue; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.view.animation.Animation.AnimationListener; import android.view.ContextMenu; import android.view.GestureDetector; import android.view.KeyEvent; @@ -76,7 +79,7 @@ import com.fsck.k9.mail.store.LocalStore.LocalFolder; */ public class MessageList extends K9Activity - implements OnClickListener, AdapterView.OnItemClickListener + implements OnClickListener, AdapterView.OnItemClickListener, AnimationListener { /** @@ -2884,14 +2887,23 @@ public class MessageList private void hideBatchButtons() { - //TODO: Fade out animation - mBatchButtonArea.setVisibility(View.GONE); + if (mBatchButtonArea.getVisibility() != View.GONE) + { + mBatchButtonArea.setVisibility(View.GONE); + mBatchButtonArea.startAnimation( + AnimationUtils.loadAnimation(this, R.anim.footer_disappear)); + } } private void showBatchButtons() { - //TODO: Fade in animation - mBatchButtonArea.setVisibility(View.VISIBLE); + if (mBatchButtonArea.getVisibility() != View.VISIBLE) + { + mBatchButtonArea.setVisibility(View.VISIBLE); + Animation animation = AnimationUtils.loadAnimation(this, R.anim.footer_appear); + animation.setAnimationListener(this); + mBatchButtonArea.startAnimation(animation); + } } private void toggleBatchButtons() @@ -3058,6 +3070,20 @@ public class MessageList mHandler.sortMessages(); } + public void onAnimationEnd(Animation animation) + { + } + + public void onAnimationRepeat(Animation animation) + { + } + + public void onAnimationStart(Animation animation) + { + } + + + private void setAllSelected(boolean isSelected) { mSelectedCount = 0;