@Override public void onDragEnd() { if (!mDeferOnDragEnd) { // Restore the QSB search bar, and animate out the drop target bar prepareStartAnimation(mDropTargetBar); mDropTargetBarAnim.reverse(); if (!mIsSearchBarHidden) { prepareStartAnimation(mQSBSearchBar); mQSBSearchBarAnim.reverse(); } } else { mDeferOnDragEnd = false; } }
public void reverse(Animator animation, long time) { if (animation instanceof ObjectAnimator) { animation.removeAllListeners(); animation.setDuration(time); ((ObjectAnimator) animation).reverse(); } else if (animation instanceof AnimatorSet) { ArrayList<Animator> animations = ((AnimatorSet) animation).getChildAnimations(); for (Animator animator : animations) { reverse(animator, time); } } }
/* * Shows and hides the search bar. */ public void showSearchBar(boolean animated) { boolean needToCancelOngoingAnimation = mQSBSearchBarAnim.isRunning() && !animated; if (!mIsSearchBarHidden && !needToCancelOngoingAnimation) return; if (animated) { prepareStartAnimation(mQSBSearchBar); mQSBSearchBarAnim.reverse(); } else { mQSBSearchBarAnim.cancel(); if (mEnableDropDownDropTargets) { mQSBSearchBar.setTranslationY(0); } else { mQSBSearchBar.setAlpha(1f); } } mIsSearchBarHidden = false; }
/** Hides the drop target bar. */ public void hideDeleteTarget() { // Restore the QSB search bar, and animate out the drop target bar prepareStartAnimation(mDropTargetBar); mShowDropTargetBarAnim.reverse(); showSearchBar(true); }
/** Finishes all the animations on the search and drop target bars. */ public void finishAnimations() { prepareStartAnimation(mDropTargetBar); mShowDropTargetBarAnim.reverse(); prepareStartAnimation(mQSBSearchBar); mHideSearchBarAnim.reverse(); }