Browse Source

Make Appbar in profile view scrollable

legacy
Ammar Githam 4 years ago
parent
commit
31d02b3e12
  1. 24
      app/src/main/java/awais/instagrabber/MainHelper.java
  2. 2
      app/src/main/res/layout/layout_profile_view.xml

24
app/src/main/java/awais/instagrabber/MainHelper.java

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

2
app/src/main/res/layout/layout_profile_view.xml

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

Loading…
Cancel
Save