nickbutcher / plaid

An Android app which provides design news & inspiration as well as being an example of implementing material design.
Apache License 2.0
16.26k stars 3.16k forks source link

Migrate to support lib components #208

Open nickbutcher opened 7 years ago

nickbutcher commented 7 years ago

Support lib now offers:

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

ataulm commented 5 years ago

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

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

ataulm commented 5 years ago

@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 commented 5 years ago

This is too heavy for me 😓😞

I think I understand the different parts a little better:

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).

☠️