Make Appbar in profile view scrollable

This commit is contained in:
Ammar Githam 2020-08-11 20:44:51 +09:00
parent c1b113e275
commit 31d02b3e12
2 changed files with 13 additions and 13 deletions

View File

@ -412,18 +412,18 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
// main.mainBinding.profileView.profileInfo.setBackgroundColor(color); // main.mainBinding.profileView.profileInfo.setBackgroundColor(color);
// if (!isBottomToolbar) main.mainBinding.toolbar.toolbar.setBackgroundColor(color); // if (!isBottomToolbar) main.mainBinding.toolbar.toolbar.setBackgroundColor(color);
main.mainBinding.profileView.appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { // main.mainBinding.profileView.appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
private int height; // private int height;
//
@Override // @Override
public void onOffsetChanged(final AppBarLayout appBarLayout, final int verticalOffset) { // public void onOffsetChanged(final AppBarLayout appBarLayout, final int verticalOffset) {
if (height == 0) { // if (height == 0) {
height = main.mainBinding.profileView.profileInfo.getHeight(); // height = main.mainBinding.profileView.profileInfo.getHeight();
collapsingToolbar.setMinimumHeight(height); // collapsingToolbar.setMinimumHeight(height);
} // }
main.mainBinding.profileView.profileInfo.setTranslationY(-Math.min(0, verticalOffset)); // main.mainBinding.profileView.profileInfo.setTranslationY(-Math.min(0, verticalOffset));
} // }
}); // });
main.setSupportActionBar(main.mainBinding.toolbar.toolbar); main.setSupportActionBar(main.mainBinding.toolbar.toolbar);
if (isBottomToolbar) { if (isBottomToolbar) {

View File

@ -16,7 +16,7 @@
<com.google.android.material.appbar.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_scrollFlags="noScroll"> app:layout_scrollFlags="scroll|enterAlways">
<RelativeLayout <RelativeLayout
android:id="@+id/infoContainer" android:id="@+id/infoContainer"