Browse Source

Merge pull request #1950 from nextcloud/feature/noid/hideToolbarOnScroll

Hide shared items toolbar on scroll
Andy Scherzinger 3 years ago
parent
commit
7140f184cb
1 changed files with 29 additions and 28 deletions
  1. 29 28
      app/src/main/res/layout/activity_shared_items.xml

+ 29 - 28
app/src/main/res/layout/activity_shared_items.xml

@@ -19,7 +19,7 @@
   ~ You should have received a copy of the GNU General Public License
   ~ along with this program.  If not, see <http://www.gnu.org/licenses/>.
   -->
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
@@ -27,40 +27,41 @@
     android:background="@color/bg_default"
     tools:context=".activities.SharedItemsActivity">
 
-    <com.google.android.material.appbar.MaterialToolbar
-        android:id="@+id/shared_items_toolbar"
+    <com.google.android.material.appbar.AppBarLayout
+        android:id="@+id/shared_items_appbar"
         android:layout_width="match_parent"
-        android:layout_height="?attr/actionBarSize"
-        android:background="@color/appbar"
-        android:theme="?attr/actionBarPopupTheme"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_scrollFlags="enterAlwaysCollapsed|noScroll"
-        app:navigationIconTint="@color/fontAppbar"
-        app:popupTheme="@style/appActionBarPopupMenu"
-        app:titleTextColor="@color/fontAppbar"
-        tools:title="@string/nc_app_product_name" />
+        android:layout_height="wrap_content">
 
-    <com.google.android.material.tabs.TabLayout
-        android:id="@+id/shared_items_tabs"
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/min_size_clickable_area"
-        android:background="@color/appbar"
-        app:layout_constraintTop_toBottomOf="@id/shared_items_toolbar"
-        app:tabGravity="fill"
-        app:tabMode="fixed"
-        app:tabMaxWidth="0dp"
-        app:tabTextAppearance="@style/TextAppearanceTab" />
+        <com.google.android.material.appbar.MaterialToolbar
+            android:id="@+id/shared_items_toolbar"
+            android:layout_width="match_parent"
+            android:layout_height="?attr/actionBarSize"
+            android:background="@color/appbar"
+            android:theme="?attr/actionBarPopupTheme"
+            app:layout_scrollFlags="scroll|enterAlways"
+            app:navigationIconTint="@color/fontAppbar"
+            app:popupTheme="@style/appActionBarPopupMenu"
+            app:titleTextColor="@color/fontAppbar"
+            tools:title="@string/nc_app_product_name" />
+
+        <com.google.android.material.tabs.TabLayout
+            android:id="@+id/shared_items_tabs"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/min_size_clickable_area"
+            android:background="@color/appbar"
+            app:tabGravity="fill"
+            app:tabMode="fixed"
+            app:tabMaxWidth="0dp"
+            app:tabTextAppearance="@style/TextAppearanceTab" />
 
+    </com.google.android.material.appbar.AppBarLayout>
 
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/image_recycler"
         android:layout_width="match_parent"
-        android:layout_height="0dp"
+        android:layout_height="match_parent"
         app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/shared_items_tabs"
-        android:layout_marginTop="@dimen/double_margin_between_elements"
+        app:layout_behavior="@string/appbar_scrolling_view_behavior"
         tools:listitem="@layout/shared_item_grid" />
 
-
-</androidx.constraintlayout.widget.ConstraintLayout>
+</androidx.coordinatorlayout.widget.CoordinatorLayout>