new ItemTouchHelper(cb).attachToRecyclerView(recyclerView);
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(),
DividerItemDecoration.VERTICAL));
-
- recyclerView.setOnFlingListener(new RecyclerView.OnFlingListener() {
- @Override
- public boolean onFling(int dX, int dY) {
-// Log.d("tmp", String.format("fling %d %d", dX, dY));
- if (dY > 0) fab.hide();
- if (dY < 0) fab.show();
- return false;
- }
- });
-
- recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
- @Override
- public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
- super.onScrolled(recyclerView, dx, dy);
- if (dy > 0) fab.hide();
- if (dy < 0) fab.show();
- }
- });
}
public static class ProfilesRecyclerViewAdapter
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright © 2019 Damyan Ivanov.
~ This file is part of Mobile-Ledger.
~ Mobile-Ledger is free software: you can distribute it and/or modify it
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="@dimen/app_bar_height"
android:theme="@style/AppTheme.AppBarOverlay">
- <android.support.v7.widget.Toolbar
- android:id="@+id/toolbar"
+ <android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
- android:layout_height="?attr/actionBarSize"
- app:popupTheme="@style/AppTheme.PopupOverlay" />
+ android:layout_height="match_parent"
+ app:layout_scrollFlags="scroll|exitUntilCollapsed">
+
+ <android.support.v7.widget.Toolbar
+ android:id="@+id/toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ app:popupTheme="@style/AppTheme.PopupOverlay" />
+ </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
- <FrameLayout
+ <android.support.v4.widget.NestedScrollView
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include layout="@layout/profile_list" />
- </FrameLayout>
+ </android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom|end"
+ android:layout_gravity="start|center_vertical"
android:layout_margin="@dimen/fab_margin"
+ app:layout_anchor="@id/frameLayout"
+ app:layout_anchorGravity="top|end"
app:srcCompat="@drawable/svg_thick_plus_white" />