Skip to content

Commit 97bafb0

Browse files
committed
feat: fixed sidebar menu on tablets
Signed-off-by: mykh-hailo <kristianderonta0205@gmail.com>
1 parent b1ca702 commit 97bafb0

File tree

16 files changed

+715
-220
lines changed

16 files changed

+715
-220
lines changed

app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

Lines changed: 213 additions & 29 deletions
Large diffs are not rendered by default.

app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,16 @@ class FileDisplayActivity :
394394
}
395395
}
396396
}
397+
398+
if (isDrawerLayout) {
399+
mMenuButton.visibility = View.VISIBLE
400+
} else {
401+
if (isRoot(currentDir)) {
402+
mMenuButton.visibility = View.GONE
403+
} else {
404+
mMenuButton.visibility = View.VISIBLE
405+
}
406+
}
397407
}
398408

399409
override fun onPostCreate(savedInstanceState: Bundle?) {
@@ -1059,6 +1069,9 @@ class FileDisplayActivity :
10591069
private fun exitSelectionMode() {
10601070
val ocFileListFragment = this.listOfFilesFragment
10611071
ocFileListFragment?.exitSelectionMode()
1072+
1073+
// Update toolbar with current directory
1074+
updateActionBarTitleAndHomeButton(currentDir)
10621075
}
10631076

10641077
private fun requestUploadOfFilesFromFileSystem(data: Intent, resultCode: Int) {
@@ -1981,6 +1994,16 @@ class FileDisplayActivity :
19811994
chosenFile = file // if no file is passed, current file decides
19821995
}
19831996
super.updateActionBarTitleAndHomeButton(chosenFile)
1997+
1998+
if (isDrawerLayout) {
1999+
mMenuButton.visibility = View.VISIBLE
2000+
} else {
2001+
if (isRoot(currentDir)) {
2002+
mMenuButton.visibility = View.GONE
2003+
} else {
2004+
mMenuButton.visibility = View.VISIBLE
2005+
}
2006+
}
19842007
}
19852008

19862009
override fun isDrawerIndicatorAvailable(): Boolean = isRoot(getCurrentDir())

app/src/main/res/layout/activity_compose.xml

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,61 @@
88
-->
99
<androidx.drawerlayout.widget.DrawerLayout android:id="@+id/drawer_layout"
1010
xmlns:android="http://schemas.android.com/apk/res/android"
11+
xmlns:app="http://schemas.android.com/apk/res-auto"
1112
android:layout_width="match_parent"
1213
android:layout_height="match_parent"
1314
android:clickable="true"
14-
android:focusable="true"
15-
xmlns:app="http://schemas.android.com/apk/res-auto">
15+
android:focusable="true">
1616

17-
<LinearLayout
17+
<androidx.constraintlayout.widget.ConstraintLayout
1818
android:layout_width="match_parent"
19-
android:layout_height="match_parent"
20-
android:orientation="vertical">
19+
android:layout_height="match_parent">
20+
21+
<FrameLayout
22+
android:id="@+id/sidebar_menu"
23+
android:layout_width="@dimen/drawer_width"
24+
android:layout_height="0dp"
25+
android:visibility="gone"
26+
app:layout_constraintBottom_toBottomOf="parent"
27+
app:layout_constraintStart_toStartOf="parent"
28+
app:layout_constraintTop_toTopOf="parent">
29+
30+
<include
31+
layout="@layout/sidebar"
32+
android:layout_width="match_parent"
33+
android:layout_height="match_parent"
34+
android:layout_gravity="start" />
2135

22-
<include layout="@layout/toolbar_standard" />
36+
</FrameLayout>
2337

24-
<androidx.compose.ui.platform.ComposeView
25-
android:id="@+id/compose_view"
26-
android:layout_width="match_parent"
38+
<LinearLayout
39+
android:layout_width="0dp"
2740
android:layout_height="0dp"
28-
android:layout_weight="1"/>
29-
30-
<com.google.android.material.bottomnavigation.BottomNavigationView
31-
android:id="@+id/bottom_navigation"
32-
android:layout_width="match_parent"
33-
android:layout_height="wrap_content"
34-
android:layout_gravity="bottom"
35-
app:labelVisibilityMode="labeled"
36-
app:menu="@menu/bottom_navigation_menu"
37-
app:layout_behavior="com.nextcloud.ui.behavior.OnScrollBehavior" />
38-
39-
</LinearLayout>
41+
android:orientation="vertical"
42+
app:layout_constraintBottom_toBottomOf="parent"
43+
app:layout_constraintEnd_toEndOf="parent"
44+
app:layout_constraintStart_toEndOf="@id/sidebar_menu"
45+
app:layout_constraintTop_toTopOf="parent">
46+
47+
<include layout="@layout/toolbar_standard" />
48+
49+
<androidx.compose.ui.platform.ComposeView
50+
android:id="@+id/compose_view"
51+
android:layout_width="match_parent"
52+
android:layout_height="0dp"
53+
android:layout_weight="1"/>
54+
55+
<com.google.android.material.bottomnavigation.BottomNavigationView
56+
android:id="@+id/bottom_navigation"
57+
android:layout_width="match_parent"
58+
android:layout_height="wrap_content"
59+
android:layout_gravity="bottom"
60+
app:labelVisibilityMode="labeled"
61+
app:menu="@menu/bottom_navigation_menu"
62+
app:layout_behavior="com.nextcloud.ui.behavior.OnScrollBehavior" />
63+
64+
</LinearLayout>
65+
</androidx.constraintlayout.widget.ConstraintLayout>
4066

4167
<include
4268
layout="@layout/drawer"

app/src/main/res/layout/activity_navigator.xml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,48 @@
1010
android:layout_width="match_parent"
1111
android:layout_height="match_parent">
1212

13-
<androidx.coordinatorlayout.widget.CoordinatorLayout
13+
<androidx.constraintlayout.widget.ConstraintLayout
1414
android:layout_width="match_parent"
1515
android:layout_height="match_parent">
1616

17-
<include
18-
android:id="@+id/appbar"
19-
layout="@layout/toolbar_standard" />
17+
<FrameLayout
18+
android:id="@+id/sidebar_menu"
19+
android:layout_width="@dimen/drawer_width"
20+
android:layout_height="0dp"
21+
android:visibility="gone"
22+
app:layout_constraintBottom_toBottomOf="parent"
23+
app:layout_constraintStart_toStartOf="parent"
24+
app:layout_constraintTop_toTopOf="parent">
2025

21-
<androidx.fragment.app.FragmentContainerView
22-
android:id="@+id/fragment_container_view"
23-
android:layout_width="match_parent"
24-
android:layout_height="match_parent"
25-
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
26+
<include
27+
layout="@layout/sidebar"
28+
android:layout_width="match_parent"
29+
android:layout_height="match_parent"
30+
android:layout_gravity="start" />
2631

27-
</androidx.coordinatorlayout.widget.CoordinatorLayout>
32+
</FrameLayout>
33+
34+
<androidx.coordinatorlayout.widget.CoordinatorLayout
35+
android:layout_width="0dp"
36+
android:layout_height="0dp"
37+
app:layout_constraintBottom_toBottomOf="parent"
38+
app:layout_constraintEnd_toEndOf="parent"
39+
app:layout_constraintStart_toEndOf="@id/sidebar_menu"
40+
app:layout_constraintTop_toTopOf="parent">
41+
42+
<include
43+
android:id="@+id/appbar"
44+
layout="@layout/toolbar_standard" />
45+
46+
<androidx.fragment.app.FragmentContainerView
47+
android:id="@+id/fragment_container_view"
48+
android:layout_width="match_parent"
49+
android:layout_height="match_parent"
50+
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
51+
52+
</androidx.coordinatorlayout.widget.CoordinatorLayout>
53+
54+
</androidx.constraintlayout.widget.ConstraintLayout>
2855

2956
<include
3057
layout="@layout/drawer"

app/src/main/res/layout/contacts_preference.xml

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,55 @@
77
~ SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
88
-->
99
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
10+
xmlns:app="http://schemas.android.com/apk/res-auto"
1011
android:id="@+id/drawer_layout"
1112
android:layout_width="match_parent"
1213
android:layout_height="match_parent">
1314

14-
<!-- The main content view -->
15-
<RelativeLayout
16-
android:id="@+id/contacts_layout"
15+
<androidx.constraintlayout.widget.ConstraintLayout
1716
android:layout_width="match_parent"
18-
android:layout_height="match_parent"
19-
android:orientation="vertical">
20-
21-
<include layout="@layout/toolbar_standard" />
17+
android:layout_height="match_parent">
2218

2319
<FrameLayout
24-
android:id="@+id/frame_container"
25-
android:layout_width="match_parent"
26-
android:layout_height="match_parent"
27-
android:layout_below="@id/appbar">
20+
android:id="@+id/sidebar_menu"
21+
android:layout_width="@dimen/drawer_width"
22+
android:layout_height="0dp"
23+
android:visibility="gone"
24+
app:layout_constraintBottom_toBottomOf="parent"
25+
app:layout_constraintStart_toStartOf="parent"
26+
app:layout_constraintTop_toTopOf="parent">
27+
28+
<include
29+
layout="@layout/sidebar"
30+
android:layout_width="match_parent"
31+
android:layout_height="match_parent"
32+
android:layout_gravity="start" />
2833

2934
</FrameLayout>
30-
</RelativeLayout>
35+
36+
<!-- The main content view -->
37+
<RelativeLayout
38+
android:id="@+id/contacts_layout"
39+
android:layout_width="0dp"
40+
android:layout_height="0dp"
41+
android:orientation="vertical"
42+
app:layout_constraintBottom_toBottomOf="parent"
43+
app:layout_constraintEnd_toEndOf="parent"
44+
app:layout_constraintStart_toEndOf="@id/sidebar_menu"
45+
app:layout_constraintTop_toTopOf="parent">
46+
47+
<include layout="@layout/toolbar_standard" />
48+
49+
<FrameLayout
50+
android:id="@+id/frame_container"
51+
android:layout_width="match_parent"
52+
android:layout_height="match_parent"
53+
android:layout_below="@id/appbar">
54+
55+
</FrameLayout>
56+
</RelativeLayout>
57+
58+
</androidx.constraintlayout.widget.ConstraintLayout>
3159

3260
<include
3361
layout="@layout/drawer"

app/src/main/res/layout/files.xml

Lines changed: 67 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -17,57 +17,83 @@
1717
android:layout_width="match_parent"
1818
android:layout_height="match_parent">
1919

20-
<androidx.coordinatorlayout.widget.CoordinatorLayout
20+
<androidx.constraintlayout.widget.ConstraintLayout
2121
android:layout_width="match_parent"
2222
android:layout_height="match_parent">
2323

24-
<include
25-
android:id="@+id/appbar"
26-
layout="@layout/toolbar_standard" />
24+
<FrameLayout
25+
android:id="@+id/sidebar_menu"
26+
android:layout_width="@dimen/drawer_width"
27+
android:layout_height="0dp"
28+
android:visibility="gone"
29+
app:layout_constraintBottom_toBottomOf="parent"
30+
app:layout_constraintStart_toStartOf="parent"
31+
app:layout_constraintTop_toTopOf="parent">
32+
33+
<include
34+
layout="@layout/sidebar"
35+
android:layout_width="match_parent"
36+
android:layout_height="match_parent"
37+
android:layout_gravity="start" />
38+
39+
</FrameLayout>
2740

28-
<!-- The main content view -->
29-
<LinearLayout
30-
android:id="@+id/root_layout"
31-
android:layout_width="match_parent"
32-
android:layout_height="match_parent"
33-
android:background="@color/bg_default"
34-
android:baselineAligned="false"
35-
android:contentDescription="@string/list_layout"
36-
android:orientation="horizontal"
37-
app:layout_behavior="@string/appbar_scrolling_view_behavior">
41+
<androidx.coordinatorlayout.widget.CoordinatorLayout
42+
android:layout_width="0dp"
43+
android:layout_height="0dp"
44+
app:layout_constraintBottom_toBottomOf="parent"
45+
app:layout_constraintEnd_toEndOf="parent"
46+
app:layout_constraintStart_toEndOf="@id/sidebar_menu"
47+
app:layout_constraintTop_toTopOf="parent">
3848

39-
<FrameLayout
40-
android:id="@+id/left_fragment_container"
41-
android:layout_width="0dp"
49+
<include
50+
android:id="@+id/appbar"
51+
layout="@layout/toolbar_standard" />
52+
53+
<!-- The main content view -->
54+
<LinearLayout
55+
android:id="@+id/root_layout"
56+
android:layout_width="match_parent"
4257
android:layout_height="match_parent"
43-
android:layout_weight="1"
44-
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
58+
android:background="@color/bg_default"
59+
android:baselineAligned="false"
60+
android:contentDescription="@string/list_layout"
61+
android:orientation="horizontal"
62+
app:layout_behavior="@string/appbar_scrolling_view_behavior">
4563

46-
</LinearLayout>
64+
<FrameLayout
65+
android:id="@+id/left_fragment_container"
66+
android:layout_width="0dp"
67+
android:layout_height="match_parent"
68+
android:layout_weight="1"
69+
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
4770

48-
<com.google.android.material.bottomnavigation.BottomNavigationView
49-
android:id="@+id/bottom_navigation"
50-
app:labelVisibilityMode="labeled"
51-
android:layout_width="match_parent"
52-
android:layout_height="wrap_content"
53-
android:layout_gravity="bottom"
54-
app:menu="@menu/bottom_navigation_menu"
55-
app:layout_behavior="com.nextcloud.ui.behavior.OnScrollBehavior" />
71+
</LinearLayout>
5672

57-
<com.google.android.material.floatingactionbutton.FloatingActionButton
58-
android:id="@+id/fab_main"
59-
android:layout_width="wrap_content"
60-
android:layout_height="wrap_content"
61-
android:layout_gravity="end|bottom"
62-
android:layout_marginEnd="@dimen/standard_margin"
63-
android:layout_marginBottom="@dimen/floating_action_button_bottom_margin"
64-
android:contentDescription="@string/fab_label"
65-
app:srcCompat="@drawable/ic_plus"
66-
app:layout_behavior="com.nextcloud.ui.behavior.OnScrollBehavior"
67-
android:visibility="gone"
68-
tools:visibility="visible" />
73+
<com.google.android.material.bottomnavigation.BottomNavigationView
74+
android:id="@+id/bottom_navigation"
75+
app:labelVisibilityMode="labeled"
76+
android:layout_width="match_parent"
77+
android:layout_height="wrap_content"
78+
android:layout_gravity="bottom"
79+
app:menu="@menu/bottom_navigation_menu"
80+
app:layout_behavior="com.nextcloud.ui.behavior.OnScrollBehavior" />
81+
82+
<com.google.android.material.floatingactionbutton.FloatingActionButton
83+
android:id="@+id/fab_main"
84+
android:layout_width="wrap_content"
85+
android:layout_height="wrap_content"
86+
android:layout_gravity="end|bottom"
87+
android:layout_marginEnd="@dimen/standard_margin"
88+
android:layout_marginBottom="@dimen/floating_action_button_bottom_margin"
89+
android:contentDescription="@string/fab_label"
90+
app:srcCompat="@drawable/ic_plus"
91+
app:layout_behavior="com.nextcloud.ui.behavior.OnScrollBehavior"
92+
android:visibility="gone"
93+
tools:visibility="visible" />
6994

70-
</androidx.coordinatorlayout.widget.CoordinatorLayout>
95+
</androidx.coordinatorlayout.widget.CoordinatorLayout>
96+
</androidx.constraintlayout.widget.ConstraintLayout>
7197

7298
<include
7399
layout="@layout/drawer"

0 commit comments

Comments
 (0)