plaid icon indicating copy to clipboard operation
plaid copied to clipboard

Migrate to support lib components

Open nickbutcher opened this issue 6 years ago • 3 comments

Support lib now offers:

  • Fling velocity in CollapsingToolbarLayout
  • TextView auto-sizing.

Should remove the custom CollapsingTitleLayout class and migrate to standard components. Possibly also migrate ReflowText to simply work TextViews rather than custom components.

nickbutcher avatar Aug 29 '17 17:08 nickbutcher

👋 I'll do the non-reflow text part of this 😬

oh it might be linked 🙈 ~~still would like to try.~~

ataulm avatar Feb 03 '19 18:02 ataulm

@nickbutcher Would this ticket require replacing the ElasticDragDismissFrameLayout with a (custom) CoordinatorLayout?

CollapsingToolbarLayout is designed to work as a direct child of AppBarLayout which, in my understanding, works with the behaviours in a CoordinatorLayout.

ataulm avatar Feb 03 '19 21:02 ataulm

This is too heavy for me 😓😞

I think I understand the different parts a little better:

  • ReflowText is a Transition for the Activity that figures out what the text will look like in the destination Activity (hence all the interface methods on Reflowable) so it can animate between
  • the CollapsingTitleLayout doesn't have anything to do with the reflow animation itself - it just exposes information about the text's start state (== the reflow animation's end state) when the Activity is first laid out, with the CollapsingTitleLayout in the "expanded" state.

fiddling with ElasticDragDismissLayout

I started by replacing the superclass of ElasticDragDismissFrameLayout with CoordinatorLayout and while this worked, the way I did it would have messed up the scrolling behaviours of its children: overriding *NestedScroll* events of the ElastricDragDismissCoordinatorLayout so that we could dispatch the drag callbacks must also take into consideration any children that have layout behaviours which want to know about nested scrolls.

adding a redundant layout

Then I tried instead with adding a plain CoordinatorLayout as the first/only child of the ElasticDragDismissFrameLayout in activity_designer_news_story.xml which is the only place where the CollapsingTitleLayout is used.

This also has no negative effects on the drag-dismiss functionality, but it's not possible to replace the CollapsingTitleLayout with a CollapsingToolbarLayout without a lot of stuff - we need a wrapper around the toolbar layout that implements ReflowText.Reflowable so that ReflowText.setupReflow(reflowable) still works or extending CollapsingToolbarLayout.

I think that's the way to go but it's too much for a small pay-off IMO - it's unclear also what the differences between the project's CollapsingTextHelper and the one from the support library, else I think that could make a good first PR (not using a custom one).

☠️

ataulm avatar Feb 09 '19 19:02 ataulm