mzgreen / HideOnScrollExample

This is an example on how to show/hide views when scrolling a list.
620 stars 173 forks source link

Neither demo handles the top over scroll effect correctly #1

Closed chrislacy closed 9 years ago

chrislacy commented 9 years ago

In Part 1 only the bottom portion is visible beneath the Toolbar. In Part 2 it's not visible at all.

mzgreen commented 9 years ago

Thanks for reporting this. I've completely forgot about this to be honest :) Also I've looked at Google+ and Play Store apps on which I was basing my implementation and it seems that Play Store also has this bug and G+ has SwipeToRefresh. Anyways I'll try to fix this.

mzgreen commented 9 years ago

Actually I can't see any simple way to fix this. It seems that there is no way to move the origin of glow effect in the RecyclerView.

This is from it's onDraw() method:

        if (mTopGlow != null && !mTopGlow.isFinished()) {
            final int restore = c.save();
            if (mClipToPadding) {
                c.translate(getPaddingLeft(), getPaddingTop());
            }
            needsInvalidate |= mTopGlow != null && mTopGlow.draw(c);
            c.restoreToCount(restore);
        }

And I'm using clipToPadding="false" so it's not going to translate it. Do you have any idea what can be done here? I think that I could add a margin to the first item of the list using ItemDecoration and it could help but if someone would need to use it with GridLayoutManager or StaggeredGridLayoutManager then it becomes tricky.

mzgreen commented 9 years ago

It's now handled by CoordinatorLayout.