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

Fix part of #140: Topic play animation #486

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unused code
  • Loading branch information
Rajat Talesra committed Nov 29, 2019
commit 16c18aa776f154dc2cbcef80a58f49b77375da64
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.oppia.app.topic.play

import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -141,7 +140,6 @@ class StorySummaryAdapter(
}

private fun expand(chapterListContainer: View) {
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused by this. Why can't we rely on RecyclerView's own item animator for this? These animations seem a bit complex, and should really be tested directly since if they regress it will be hard for us to detect. I'd rather we rely on existing animation systems rather than creating our own Animation classes, if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am actually not able to understand how can we do this using RecyclerView's animator?
Also, the main point behind introducing these animations were two fold:

  1. Make expand/collapse animation smooth.
  2. The animation time of expand, and arrow rotate all should be in sync.

I don't have much experience of automated animation, can you just give information regarding RecyclerView's item animator in more detail?
Thanks.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I was thinking specifically DefaultItemAnimator, but I'm guessing that might not do the right thing. In which case, maybe something like https://stackoverflow.com/a/37453839 or another animator library might make this a bit easier if it's possible.

Copy link
Contributor Author

@rt4914 rt4914 Dec 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This animation is applicable on recyclerview item. But here we want to expand and contract a linear layout, which is again within a recyclerview item.

Log.d("TAG", "expand")
chapterListContainer.clearAnimation()
val matchParentMeasureSpec =
View.MeasureSpec.makeMeasureSpec((chapterListContainer.parent as View).width, View.MeasureSpec.EXACTLY)
Expand Down Expand Up @@ -171,7 +169,6 @@ class StorySummaryAdapter(
}

private fun collapse(chapterListContainer: View) {
Log.d("TAG", "collapse")
chapterListContainer.clearAnimation()

val initialHeight = chapterListContainer.measuredHeight
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_arrow_drop_up_black_24dp.xml

This file was deleted.