Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Execute multi line->single line transition during content scrim animation #34

Open
dmfs opened this issue Apr 3, 2017 · 7 comments
Open

Comments

@dmfs
Copy link

dmfs commented Apr 3, 2017

I'd like to execute the multi line to single line transition in an automated animation, synchronized with the content scrim animation, instead of gradually morphing from multi line to single line.
Is there any way to achieve that?

@johan12345
Copy link
Contributor

One would need to add something to this listener that then influences the blending of the text. Currently, this is done here instead depending on the scrolling position.

If you'd implement this and make the behavior switchable between the current animation and this version using a method in CollapsingToolbarLayout, we would accept that as a pull request.

@dmfs
Copy link
Author

dmfs commented Apr 6, 2017

I've implemented something that works for us. At present it can't be disabled but I think that shouldn't be hard to do. Do you have any preference for an xml attribute name to switch this behavior?

 <net.opacapp.multilinecollapsingtoolbar.CollapsingToolbarLayout
        ...
    app:collapseMode = "onScrim"
 >
...

With the values onScroll (the default) and onScrim?

@johan12345
Copy link
Contributor

Maybe something like textCollapseMode would be more clear. @raphaelm, what do you think?

@raphaelm
Copy link
Member

raphaelm commented Apr 6, 2017

Or even textCollapseOn with the values scroll and scrim?

@johan12345
Copy link
Contributor

Yeah, that's fine too.

@dmfs
Copy link
Author

dmfs commented Apr 6, 2017

My idea was to target a broader scope with that field and not just the title text. We have implemented another extension that could be affected by this setting.
The other extension allows you to specify for each child element how it behaves during content scrim. We've called it scrimMode and it's applied to the child elements. The values are none (the default) which keeps the current behavior, out which fades the element out on scrim and in which fades the element in. The transitions can be executed while scrolling or when the scrim animation is started.

We use it to switch between a white themed toolbar and a dark themed toolbar during the scrim animation. The scrim changes the appearance of our toolbar from a dark background to a white one. So we have two toolbars and x-fade them during the scrim animation (or optionally as per collapseMode, while scrolling)

@dmfs
Copy link
Author

dmfs commented Apr 7, 2017

I've just opened PR #38
As you see I've taken the orthogonal approach. I've added a flag to specify which elements should be auto-animated and which should be gradually morphed.

you apply it like this

 <net.opacapp.multilinecollapsingtoolbar.CollapsingToolbarLayout
        ...
    app:autoAnimate = "title|scrim"
 >

You can also apply this

 <net.opacapp.multilinecollapsingtoolbar.CollapsingToolbarLayout
        ...
    app:autoAnimate = "none"
 >

Which means that the scrim is now applied gradually as you scroll.

There is another value called children but it's not implemented yet as it depends on PR #36.

I have a branch called "schedjoules" which will contain the changes of all three PRs. Let me know if you'd prefer a single PR with all the enhancements (with the conflicts already being resolved).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants