Im trying to animate a card view's position and resize it to fit screen at the same time. When the user clicks a button inside the cardview, the cardview should expand to the size of its container, and scroll up to become fully visible at the same time
in my custom animator class, im using the following function:
@Override
protected void applyTransformation(float interpolatedTimeTransformation t) {
int newHeight = (int) (startHeight + (targetHeight - startHeight) *interpolatedTime);
view.getLayoutParams().height = newHeight;
((LinearLayoutManager) MainPage.mainGroupRecycler.getLayoutManager()).scrollToPositionWithOffset(MainPage.mainGroupRecycler.getChildAdapterPosition((CardView) view.getParent()), 0);
view.requestLayout();
}
in the following case, the recyclerview instantly shows the cardview at the top of the visible area without animating the scrolling, then it animates the resize. I need it to scroll at the same time the resize is happening.
i tried calling another scroll function:
MainPage.mainGroupRecycler.scrollToPosition(MainPage.mainGroupRecycler.getChildAdapterPosition((CardView) view.getParent()));
But the problem with this is that the scrolling will only animate after the resize is complete.
I need the resizing and the scrolling to happen simultaneously.
Any help will be appreciated