Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b200963 authored by nebkat's avatar nebkat
Browse files

Enable SlidingTab animation when releasing slider

Normally when you drag a SlidingTab slider on the lockscreen and release it it just jumps back to place while the other one (hidden) animates. This makes both sliders animate and it looks much better.

Change-Id: I393ffdfc2f440de0e011d5ee51802f5a0082ac3f
parent aad7cd44
Loading
Loading
Loading
Loading
+28 −8
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ public class SlidingTab extends ViewGroup {
     * {@link #target} is the target the user must drag the slider past to trigger the slider.
     *
     */
    private static class Slider {
    private class Slider {
        /**
         * Tab alignment - determines which side the tab should be drawn on
         */
@@ -307,12 +307,32 @@ public class SlidingTab extends ViewGroup {
            int dy = horiz ? 0 : (alignment == ALIGN_TOP ? alignment_value - tab.getTop()
                    : alignment_value - tab.getBottom());
            if (animate) {
                TranslateAnimation trans = new TranslateAnimation(0, dx, 0, dy);
                trans.setDuration(ANIM_DURATION);
                trans.setFillAfter(false);
                text.startAnimation(trans);
                tab.startAnimation(trans);
                mAnimating = true;
                TranslateAnimation trans1 = new TranslateAnimation(0, dx, 0, dy);
                TranslateAnimation trans2 = new TranslateAnimation(0, dx, 0, dy);
                trans1.setDuration(ANIM_DURATION);
                trans2.setDuration(ANIM_DURATION);
                trans1.setFillAfter(true);
                trans2.setFillAfter(true);
                trans1.setAnimationListener(new AnimationListener() {
                    public void onAnimationEnd(Animation animation) {
                        mAnimating = false;
                        reset(false);
                    }

                    public void onAnimationRepeat(Animation animation) {

                    }

                    public void onAnimationStart(Animation animation) {

                    }

                });
                text.startAnimation(trans1);
                tab.startAnimation(trans2);
            } else {
                mAnimating = false;
                if (horiz) {
                    text.offsetLeftAndRight(dx);
                    tab.offsetLeftAndRight(dx);
@@ -620,7 +640,7 @@ public class SlidingTab extends ViewGroup {
                    mTracking = false;
                    mTriggered = false;
                    mOtherSlider.show(true);
                    mCurrentSlider.reset(false);
                    mCurrentSlider.reset(true);
                    mCurrentSlider.hideTarget();
                    mCurrentSlider = null;
                    mOtherSlider = null;