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

Add material animation(transition) #592

Merged
merged 6 commits into from Jan 27, 2020
Merged

Conversation

@koji-1009
Copy link
Contributor

koji-1009 commented Jan 25, 2020

Issue

Overview (Required)

  • Add Stagger transition (Contributor and Staff screen)
  • Add Fade Through transition (SessionDetail screen)

Links

Screenshot

Type Before After
Stagger(contributor)
Stagger(staff)
FadeThrough(SessionDetail)
import androidx.core.view.animation.PathInterpolatorCompat

/**
* Standard easing.

This comment has been minimized.

Copy link
@takahirom

takahirom Jan 25, 2020

Member

Thank you!
Please add a link you copied? and Can you add it in README? 🙏

/**
 * @see http://github.com/google/material...

This comment has been minimized.

Copy link
@koji-1009

koji-1009 Jan 25, 2020

Author Contributor

🙆‍♂

This comment has been minimized.

Copy link
@koji-1009

koji-1009 Jan 25, 2020

Author Contributor

@takahirom
Hi, what about this 26e8069 ?

I copied some files .
So, I think comment is more better than KDoc. 🤔

@takahirom takahirom added the awesome label Jan 25, 2020
@@ -68,14 +72,27 @@ class StaffsFragment : Fragment() {

val groupAdapter = GroupAdapter<ViewHolder<*>>()
binding.staffRecycler.adapter = groupAdapter
binding.staffRecycler.itemAnimator = object : DefaultItemAnimator() {
override fun animateAdd(holder: RecyclerView.ViewHolder?): Boolean {
dispatchAddFinished(holder)

This comment has been minimized.

Copy link
@takahirom

takahirom Jan 25, 2020

Member

I have a question 🙋
Why this is needed? Can you add a comment?

This comment has been minimized.

Copy link
@koji-1009

koji-1009 Jan 25, 2020

Author Contributor

In "Motion" repository, editor comments We animate item additions on our side, so disable it in RecyclerView..

ref https://github.com/android/animation-samples/blob/232709094f9c60e0ead9cf4873e0c1549a9a8505/Motion/app/src/main/java/com/example/android/motion/demo/stagger/StaggerActivity.kt#L61

In my opinion, that comment is based on animationAdd method's documents.

Called when an item is added to the RecyclerView. Implementors can choose whether and how to animate that change, but must always call dispatchAddFinished(RecyclerView.ViewHolder) when done, either immediately (if no animation will occur) or after the animation actually finishes.

ref https://developer.android.com/reference/androidx/recyclerview/widget/SimpleItemAnimator.html#animateAdd(androidx.recyclerview.widget.RecyclerView.ViewHolder)

In this case, we set custom animation (Stagger transition), so we should call dispatchAddFinished( and dispatchAddStarting for running animation).


I plan to add following comments.
Does this comment look good?

// Because custom RecyclerView's animation, set custom SimpleItemAnimator implementation.
//
// see https://developer.android.com/reference/androidx/recyclerview/widget/SimpleItemAnimator.html#animateAdd(androidx.recyclerview.widget.RecyclerView.ViewHolder)
// see https://github.com/android/animation-samples/blob/232709094f9c60e0ead9cf4873e0c1549a9a8505/Motion/app/src/main/java/com/example/android/motion/demo/stagger/StaggerActivity.kt#L61
binding.staffRecycler.itemAnimator = ~~

This comment has been minimized.

Copy link
@koji-1009

koji-1009 Jan 25, 2020

Author Contributor

Plus one point, DefaultItemAnimator 's animateAdd is following code.

    @Override
    public boolean animateAdd(final RecyclerView.ViewHolder holder) {
        resetAnimation(holder);
        holder.itemView.setAlpha(0);
        mPendingAdditions.add(holder);
        return true;
    }

Probably, if you do not set the SimpleItemAnimator implementation, the custom animation will be cleared or the holder is blinked. (Sorry, not tried yet...)

This comment has been minimized.

Copy link
@takahirom

takahirom Jan 25, 2020

Member

Thanks! Looks good!

This comment has been minimized.

Copy link
@koji-1009

koji-1009 Jan 25, 2020

Author Contributor

✈️ 34f0d8f

@koji-1009 koji-1009 requested a review from takahirom Jan 25, 2020
@takahirom

This comment has been minimized.

Copy link
Member

takahirom commented Jan 26, 2020

LGTM 👍
Can you fix the conflict? 🙇

@koji-1009

This comment has been minimized.

Copy link
Contributor Author

koji-1009 commented Jan 26, 2020

Thanks! Of course 😊

@jmatsu-bot

This comment has been minimized.

Copy link
Collaborator

jmatsu-bot commented Jan 27, 2020

Your apk has been deployed to https://deploygate.com/distributions/061b83425a3fba57dd243d7c63686e0ef0d8439c. Anyone can try your changes via the link.

Generated by 🚫 Danger

@jmatsu-bot

This comment has been minimized.

Copy link
Collaborator

jmatsu-bot commented Jan 27, 2020

2 Warnings
⚠️ feature/session/src/main/res/layout/item_session.xml#L63 - Missing contentDescription attribute on image
⚠️ feature/session/src/main/res/layout/item_speaker_session.xml#L69 - Missing contentDescription attribute on image

No error was reported but at least one warning was found.

Generated by 🚫 Danger

@koji-1009

This comment has been minimized.

Copy link
Contributor Author

koji-1009 commented Jan 27, 2020

@takahirom
Hi, I resolved conflict! 5fdfcae

@takahirom

This comment has been minimized.

Copy link
Member

takahirom commented Jan 27, 2020

Thank you for the awesome animations!

@takahirom takahirom merged commit 1ccd358 into DroidKaigi:master Jan 27, 2020
3 checks passed
3 checks passed
ci/circleci: assemble_apk Your tests passed on CircleCI!
Details
ci/circleci: test_android Your tests passed on CircleCI!
Details
every_pull_request Workflow: every_pull_request
Details
@koji-1009 koji-1009 deleted the koji-1009:add_animation branch Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.