Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action transitionOutLeftSection does have animation when leftActionMode is showSearch #240

Closed
lenguyenthanh opened this issue Jun 2, 2017 · 2 comments

Comments

@lenguyenthanh
Copy link

lenguyenthanh commented Jun 2, 2017

When SearchView looses focus, left icon is changed from backImage to searchImage. This action doesn't have animation now. It's caused by changeIcon method:

    private void changeIcon(ImageView imageView, Drawable newIcon, boolean withAnim) {
        imageView.setImageDrawable(newIcon);
        if (withAnim) {
            ObjectAnimator fadeInVoiceInputOrClear = ObjectAnimator.ofFloat(imageView, "alpha", 0.0f, 1.0f);
            fadeInVoiceInputOrClear.setDuration(250);
            fadeInVoiceInputOrClear.start();
        } else {
            imageView.setAlpha(1.0f);
        }
    }

We can fix it by updating it:

    private void changeIcon(ImageView imageView, Drawable newIcon, boolean withAnim) {
        imageView.setImageDrawable(newIcon);
        if (withAnim) {
            mLeftAction.setRotation(-45);
            mLeftAction.setAlpha(0.0f);
            ObjectAnimator rotateAnim = ViewPropertyObjectAnimator.animate(mLeftAction).rotation(0).get();
            ObjectAnimator fadeAnim = ViewPropertyObjectAnimator.animate(mLeftAction).alpha(1.0f).get();
            AnimatorSet animSet = new AnimatorSet();
            animSet.setDuration(500);
            animSet.playTogether(rotateAnim, fadeAnim);
            animSet.start();
        } else {
            imageView.setAlpha(1.0f);
        }
    }

@arimorty What do you think about this issue? Does it happen with any intention or just a bug?
If it's a bug, I'm happy to do a PR. Thanks!

@arimorty
Copy link
Owner

arimorty commented Jun 4, 2017

That's a nice animation :) (I love animations!), but that method is used for other scenarios as well, so it will require some more thought. But feel free to fork and adapt the library to your needs, because I won't be able to actively maintain the project anymore anyway.

Have a look at this announcement

It has been a blast supporting the project, but I really think that with a little digging, the code can be adapted and I just don't have the time to update the library for everyone's custom needs.

Best,
Ari

@arimorty arimorty closed this as completed Jun 4, 2017
@lenguyenthanh
Copy link
Author

Thanks @arimorty for great work you've done. This library is amazing! I understand your decision.

Best,
Thanh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants