henrytao-me / smooth-app-bar-layout

Smooth version of Google Support Design AppBarLayout
Apache License 2.0
1.76k stars 240 forks source link

Possibilty to initially expand parallax appbarlayout to specific offset smaller than ImageView size #60

Closed borgwald closed 8 years ago

borgwald commented 8 years ago

Hello,

i am trying to not fully expand my smoothappbarlayout. reason: my imageview inside collapsingtoolbarlayout can contain full sized images in portraitmode and i want to expand my smoothappbarlayout max half size of screen, maintainig the ability to expand further until the whole image is visible.

i tried it with Appbarlayout.Behavior:

CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) getAppBarLayout().getLayoutParams();
AppBarLayout.Behavior behavior = new AppBarLayout.Behavior();
behavior.setTopAndBottomOffset(0);
behavior.onNestedPreScroll(getCoordinatorLayout(), getAppBarLayout(), null, 0, getOffset(), new int[2]);
params.setBehavior(behavior);
getAppBarLayout().setLayoutParams(params);

this does expand my smoothappbarlayout only to the specified offset, but it also breaks overall scrolling behavior with smoothappbarlayout + collapsingtoolbarlayout + recyclerview

for better understanding: whats app is using a similar layout in their profileoverview of other users.

henrytao-me commented 8 years ago

Hi @borgwald

I looked into WhatsApp profile style, I am not sure you are asking about cover animation or title/subtitle animation but overall, we can easily achieve this style with SmoothAppBarLayout and SmoothCollapsingToolbarLayout.

I can make an example this weekend and ping you when it's ready.

Cheers, Henry

borgwald commented 8 years ago

hello henry.

when you look at whatsapp into the detail of a user, at the initial start of the detailactivity the toolbar is not expanded to the full imagesize. this is what i want to achieve. when you scroll down in whatsapp, the toolbar expands a little more until the whole image is visible. i dont have a good startingpoint on how to achieve this with smoothappbarlayout.

henrytao-me commented 8 years ago

Oh. I see what you mean. For that kind of style, I can make it work with ScrollView. Making it work with RecyclerView (with Async loading) is kind of tricky. What's your need right now? ScrollView with pre-design item or RecyclerView with async loading items?

borgwald commented 8 years ago

hello henry,

first of all thanks for your reply and efforts.

i am using a recyclerview in my layout.

henrytao-me commented 8 years ago

;). I found that our needs are always more than existing apps from BigCorp. But that makes things are more interesting. Let me work on it this weekend. Thanks for your consideration to use this library.

Cheers, Henry

borgwald commented 8 years ago

Hello Henry,

did you have any Updates on this?

henrytao-me commented 8 years ago

Hi @borgwald

Please upgrade to 23.2.1.2 and check PreScroll example. Note: Use Utils.initPreScroll