summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2020-02-22 13:32:59 +0100
committerJan Holesovsky <kendy@collabora.com>2020-02-24 13:49:02 +0100
commit0bc1f92b3d9138d4bdff3874b42715abc25cd5c3 (patch)
treee5180b317c7099aaf5728dad60f00909a805204a
parent11b7270acd930dd0ab61c96b1ab7d04a7d3e1d8b (diff)
android shell: Use the CoordinatorLayout for the shell.
Hides the toolbar nicely when scrolling the content & the scrolling is smoother with it too. Change-Id: I618fece423749c3eb99c949e6f8d456ee9cf3c38 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89251 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--android/app/src/main/res/layout/activity_document_browser.xml195
1 files changed, 97 insertions, 98 deletions
diff --git a/android/app/src/main/res/layout/activity_document_browser.xml b/android/app/src/main/res/layout/activity_document_browser.xml
index 17b358fc0..44b01b52a 100644
--- a/android/app/src/main/res/layout/activity_document_browser.xml
+++ b/android/app/src/main/res/layout/activity_document_browser.xml
@@ -7,32 +7,27 @@
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.drawerlayout.widget.DrawerLayout
+ 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical">
+ android:clickable="true"
+ android:focusableInTouchMode="true"
+ android:focusable="true">
- <androidx.drawerlayout.widget.DrawerLayout
- android:id="@+id/drawer_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- tools:layout_constraintBottom_creator="1"
- tools:layout_constraintLeft_creator="1"
- tools:layout_constraintRight_creator="1"
- tools:layout_constraintTop_creator="1">
+ <!-- The content -->
- <!-- The content -->
+ <androidx.coordinatorlayout.widget.CoordinatorLayout
+ android:id="@+id/overview_coordinator_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
- <androidx.constraintlayout.widget.ConstraintLayout
+ <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1">
+ android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
@@ -40,95 +35,98 @@
android:layout_height="wrap_content"
android:background="@color/toolbar_background"
android:elevation="3dp"
- app:layout_constraintTop_toTopOf="parent"
- app:popupTheme="@style/LibreOfficeTheme"
app:theme="@style/LibreOfficeTheme.Toolbar"
- tools:layout_constraintLeft_creator="1"
- tools:layout_constraintRight_creator="1"
- tools:layout_constraintTop_creator="1"
- tools:theme="@style/LibreOfficeTheme.Toolbar">
+ app:popupTheme="@style/LibreOfficeTheme"
+ app:layout_scrollFlags="enterAlways|scroll" />
- </androidx.appcompat.widget.Toolbar>
+ </com.google.android.material.appbar.AppBarLayout>
- <ScrollView
+ <androidx.core.widget.NestedScrollView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior">
+
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/toolbar">
+ android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:orientation="vertical">
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
- <LinearLayout
+ <TextView
+ android:id="@+id/header_recents"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:layout_weight="1"
+ android:gravity="center_vertical"
+ android:padding="16dp"
+ android:text="@string/title_recents"
+ android:textSize="14sp"
+ android:textStyle="bold" />
+
+ <ImageView
+ android:id="@+id/recent_list_or_grid"
+ android:layout_width="96dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:scaleType="centerInside"
+ app:srcCompat="@drawable/ic_list_black_24dp" />
+ </LinearLayout>
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/list_recent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal">
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="8dp" >
- <TextView
- android:id="@+id/header_recents"
- android:layout_width="match_parent"
- android:layout_height="48dp"
- android:layout_weight="1"
- android:gravity="center_vertical"
- android:padding="16dp"
- android:text="@string/title_recents"
- android:textSize="14sp"
- android:textStyle="bold" />
-
- <ImageView
- android:id="@+id/recent_list_or_grid"
- android:layout_width="96dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:scaleType="centerInside"
- app:srcCompat="@drawable/ic_list_black_24dp" />
- </LinearLayout>
+ </androidx.recyclerview.widget.RecyclerView>
- <FrameLayout
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="match_parent"
+ android:layout_marginTop="16dp"
+ android:orientation="horizontal">
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/list_recent"
+ <Space
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:layout_marginBottom="8dp" >
+ android:layout_weight="3" />
- </androidx.recyclerview.widget.RecyclerView>
+ <TextView
+ android:id="@+id/no_recent_items_msg"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/no_recent_items"
+ android:textAlignment="center"
+ android:textSize="14sp" />
- <LinearLayout
+ <Space
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginTop="16dp"
- android:orientation="horizontal">
-
- <Space
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="3" />
-
- <TextView
- android:id="@+id/no_recent_items_msg"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="2"
- android:text="@string/no_recent_items"
- android:textAlignment="center"
- android:textSize="14sp" />
-
- <Space
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="3" />
- </LinearLayout>
-
- </FrameLayout>
+ android:layout_height="wrap_content"
+ android:layout_weight="3" />
+ </LinearLayout>
- </LinearLayout>
- </ScrollView>
+ </FrameLayout>
+
+ </LinearLayout>
+
+ </androidx.core.widget.NestedScrollView>
+
+ <!-- Floating Action Buttons -->
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/editFAB"
@@ -245,17 +243,18 @@
</androidx.constraintlayout.widget.ConstraintLayout>
- <!-- The navigation drawer -->
- <com.google.android.material.navigation.NavigationView
- android:id="@+id/navigation_drawer"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="start"
- android:background="@color/background_normal"
- android:theme="@style/LibreOfficeTheme.NavigationView"
- app:headerLayout="@layout/navigation_header"
- app:menu="@menu/navigation_menu" />
+ </androidx.coordinatorlayout.widget.CoordinatorLayout>
- </androidx.drawerlayout.widget.DrawerLayout>
+ <!-- The navigation drawer -->
+
+ <com.google.android.material.navigation.NavigationView
+ android:id="@+id/navigation_drawer"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="start"
+ android:background="@color/background_normal"
+ android:theme="@style/LibreOfficeTheme.NavigationView"
+ app:headerLayout="@layout/navigation_header"
+ app:menu="@menu/navigation_menu" />
-</LinearLayout>
+</androidx.drawerlayout.widget.DrawerLayout>