Skip to content

Commit 0667c49

Browse files
committed
fix: hide public links when there is no read permission
fix: remove updateToolbarTitle() as this is not in the requirement fix: keep simple UX refactor: remove updateMembersLoadingProgressVisibility
1 parent bf812a9 commit 0667c49

2 files changed

Lines changed: 122 additions & 99 deletions

File tree

owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/members/SpaceMembersFragment.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ class SpaceMembersFragment : Fragment(), SpaceMembersAdapter.SpaceMembersAdapter
101101
canEditMembers = it.getBoolean(CAN_EDIT_MEMBERS, false)
102102
canReadMembers = it.getBoolean(CAN_READ_MEMBERS, false)
103103
}
104-
binding.membersRecyclerView.isVisible = canReadMembers
104+
binding.membersListSection.isVisible = canReadMembers
105+
binding.publicLinksSection.isVisible = canReadMembers
105106

106107
subscribeToViewModels()
107108

@@ -210,9 +211,10 @@ class SpaceMembersFragment : Fragment(), SpaceMembersAdapter.SpaceMembersAdapter
210211
addMemberRoles = it.roles
211212
val membersForList = if (canReadMembers) spaceMembers else emptyList()
212213
spaceMembersAdapter.setSpaceMembers(membersForList, roles, canRemoveMembers, canEditMembers, numberOfManagers)
213-
val hasLinks = it.links.isNotEmpty()
214+
val linksForList = if (canReadMembers) it.links else emptyList()
215+
val hasLinks = linksForList.isNotEmpty()
214216
showOrHideEmptyView(hasLinks)
215-
if (hasLinks) { showSpaceLinks(it.links) }
217+
if (hasLinks) { showSpaceLinks(linksForList) }
216218
binding.indeterminateProgressBar.isVisible = false
217219
}
218220
}
@@ -237,7 +239,8 @@ class SpaceMembersFragment : Fragment(), SpaceMembersAdapter.SpaceMembersAdapter
237239
canRemoveMembers = DRIVES_DELETE_PERMISSION in spacePermissions
238240
canEditMembers = DRIVES_UPDATE_PERMISSION in spacePermissions
239241
canReadMembers = DRIVES_READ_PERMISSION in spacePermissions
240-
binding.membersRecyclerView.isVisible = canReadMembers
242+
binding.membersListSection.isVisible = canReadMembers
243+
binding.publicLinksSection.isVisible = canReadMembers
241244
val membersForList = if (canReadMembers) spaceMembers else emptyList()
242245
spaceMembersAdapter.setSpaceMembers(membersForList, roles, canRemoveMembers, canEditMembers, numberOfManagers)
243246
}

owncloudApp/src/main/res/layout/members_fragment.xml

Lines changed: 115 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -30,111 +30,131 @@
3030
android:layout_height="wrap_content"
3131
android:orientation="vertical">
3232

33-
<androidx.constraintlayout.widget.ConstraintLayout
33+
<LinearLayout
34+
android:id="@+id/members_list_section"
3435
android:layout_width="match_parent"
35-
android:layout_height="match_parent"
36-
android:background="@color/actionbar_start_color">
37-
38-
<TextView
39-
android:id="@+id/members_title"
36+
android:layout_height="wrap_content"
37+
android:orientation="vertical"
38+
android:visibility="gone"
39+
tools:visibility="visible">
40+
41+
<androidx.constraintlayout.widget.ConstraintLayout
42+
android:layout_width="match_parent"
43+
android:layout_height="match_parent"
44+
android:background="@color/actionbar_start_color">
45+
46+
<TextView
47+
android:id="@+id/members_title"
48+
android:layout_width="wrap_content"
49+
android:layout_height="50dp"
50+
android:layout_centerVertical="true"
51+
android:gravity="center"
52+
android:text="@string/members_title"
53+
android:layout_marginStart="@dimen/standard_half_margin"
54+
android:textAllCaps="true"
55+
android:textColor="@color/white"
56+
android:textStyle="bold"
57+
android:accessibilityHeading="true"
58+
app:layout_constraintStart_toStartOf="parent"
59+
app:layout_constraintTop_toTopOf="parent"/>
60+
61+
<ImageButton
62+
android:id="@+id/add_member_button"
63+
android:layout_width="48dp"
64+
android:layout_height="48dp"
65+
android:padding="@dimen/standard_padding"
66+
android:background="@color/transparent"
67+
android:src="@drawable/ic_add"
68+
android:contentDescription="@string/content_description_add_member"
69+
android:visibility="gone"
70+
android:focusable="true"
71+
android:clickable="true"
72+
app:layout_constraintEnd_toEndOf="parent"
73+
app:layout_constraintTop_toTopOf="parent"
74+
tools:visibility="visible"/>
75+
76+
</androidx.constraintlayout.widget.ConstraintLayout>
77+
78+
<ProgressBar
79+
android:id="@+id/indeterminate_progress_bar"
4080
android:layout_width="wrap_content"
41-
android:layout_height="50dp"
42-
android:layout_centerVertical="true"
43-
android:gravity="center"
44-
android:text="@string/members_title"
45-
android:layout_marginStart="@dimen/standard_half_margin"
46-
android:textAllCaps="true"
47-
android:textColor="@color/white"
48-
android:textStyle="bold"
49-
android:accessibilityHeading="true"
50-
app:layout_constraintStart_toStartOf="parent"
51-
app:layout_constraintTop_toTopOf="parent"/>
52-
53-
<ImageButton
54-
android:id="@+id/add_member_button"
55-
android:layout_width="48dp"
56-
android:layout_height="48dp"
57-
android:padding="@dimen/standard_padding"
58-
android:background="@color/transparent"
59-
android:src="@drawable/ic_add"
60-
android:contentDescription="@string/content_description_add_member"
61-
android:visibility="gone"
62-
android:focusable="true"
63-
android:clickable="true"
64-
app:layout_constraintEnd_toEndOf="parent"
65-
app:layout_constraintTop_toTopOf="parent"
81+
android:layout_height="wrap_content"
82+
android:layout_gravity="center"
83+
android:indeterminate="true"
84+
android:visibility="gone"/>
85+
86+
<androidx.recyclerview.widget.RecyclerView
87+
android:id="@+id/members_recycler_view"
88+
android:layout_width="match_parent"
89+
android:layout_height="wrap_content"
90+
android:scrollbars="vertical"
91+
android:visibility="visible"
6692
tools:visibility="visible"/>
6793

68-
</androidx.constraintlayout.widget.ConstraintLayout>
69-
70-
<ProgressBar
71-
android:id="@+id/indeterminate_progress_bar"
72-
android:layout_width="wrap_content"
73-
android:layout_height="wrap_content"
74-
android:layout_gravity="center"
75-
android:indeterminate="true"
76-
android:visibility="gone"/>
94+
</LinearLayout>
7795

78-
<androidx.recyclerview.widget.RecyclerView
79-
android:id="@+id/members_recycler_view"
96+
<LinearLayout
97+
android:id="@+id/public_links_section"
8098
android:layout_width="match_parent"
8199
android:layout_height="wrap_content"
82-
android:scrollbars="vertical"
83-
android:visibility="visible"
84-
tools:visibility="visible"/>
85-
86-
<androidx.constraintlayout.widget.ConstraintLayout
87-
android:layout_width="match_parent"
88-
android:layout_height="match_parent"
89-
android:background="@color/actionbar_start_color">
100+
android:orientation="vertical"
101+
android:visibility="gone"
102+
tools:visibility="visible">
103+
104+
<androidx.constraintlayout.widget.ConstraintLayout
105+
android:layout_width="match_parent"
106+
android:layout_height="match_parent"
107+
android:background="@color/actionbar_start_color">
108+
109+
<TextView
110+
android:id="@+id/public_links_title"
111+
android:layout_width="wrap_content"
112+
android:layout_height="50dp"
113+
android:layout_centerVertical="true"
114+
android:gravity="center"
115+
android:text="@string/share_via_link_section_title"
116+
android:layout_marginStart="@dimen/standard_half_margin"
117+
android:textAllCaps="true"
118+
android:textColor="@color/white"
119+
android:textStyle="bold"
120+
android:accessibilityHeading="true"
121+
app:layout_constraintStart_toStartOf="parent"
122+
app:layout_constraintTop_toTopOf="parent"/>
123+
124+
</androidx.constraintlayout.widget.ConstraintLayout>
90125

91126
<TextView
92-
android:id="@+id/public_links_title"
93-
android:layout_width="wrap_content"
94-
android:layout_height="50dp"
95-
android:layout_centerVertical="true"
96-
android:gravity="center"
97-
android:text="@string/share_via_link_section_title"
98-
android:layout_marginStart="@dimen/standard_half_margin"
99-
android:textAllCaps="true"
100-
android:textColor="@color/white"
101-
android:textStyle="bold"
102-
android:accessibilityHeading="true"
103-
app:layout_constraintStart_toStartOf="parent"
104-
app:layout_constraintTop_toTopOf="parent"/>
105-
106-
</androidx.constraintlayout.widget.ConstraintLayout>
107-
108-
<TextView
109-
android:id="@+id/public_links_warning"
110-
android:layout_width="match_parent"
111-
android:layout_height="wrap_content"
112-
android:background="@color/warning_background_color"
113-
android:paddingTop="@dimen/standard_padding"
114-
android:paddingBottom="@dimen/standard_padding"
115-
android:paddingStart="@dimen/standard_half_padding"
116-
android:paddingEnd="@dimen/standard_half_padding"
117-
android:text="@string/share_warning_about_forwarding_space_public_links"
118-
android:textColor="@color/warning_grey_text"
119-
android:textSize="15sp" />
120-
121-
<androidx.recyclerview.widget.RecyclerView
122-
android:id="@+id/public_links_recycler_view"
123-
android:layout_width="match_parent"
124-
android:layout_height="wrap_content"
125-
android:scrollbars="vertical" />
127+
android:id="@+id/public_links_warning"
128+
android:layout_width="match_parent"
129+
android:layout_height="wrap_content"
130+
android:background="@color/warning_background_color"
131+
android:paddingTop="@dimen/standard_padding"
132+
android:paddingBottom="@dimen/standard_padding"
133+
android:paddingStart="@dimen/standard_half_padding"
134+
android:paddingEnd="@dimen/standard_half_padding"
135+
android:text="@string/share_warning_about_forwarding_space_public_links"
136+
android:textColor="@color/warning_grey_text"
137+
android:textSize="15sp" />
138+
139+
<androidx.recyclerview.widget.RecyclerView
140+
android:id="@+id/public_links_recycler_view"
141+
android:layout_width="match_parent"
142+
android:layout_height="wrap_content"
143+
android:scrollbars="vertical" />
126144

127-
<TextView
128-
android:id="@+id/no_public_links_message"
129-
android:layout_width="match_parent"
130-
android:layout_height="wrap_content"
131-
android:paddingTop="@dimen/standard_padding"
132-
android:paddingBottom="@dimen/standard_padding"
133-
android:paddingStart="@dimen/standard_half_padding"
134-
android:paddingEnd="@dimen/standard_half_padding"
135-
android:text="@string/share_no_public_links"
136-
android:textSize="15sp"
137-
android:visibility="gone"/>
145+
<TextView
146+
android:id="@+id/no_public_links_message"
147+
android:layout_width="match_parent"
148+
android:layout_height="wrap_content"
149+
android:paddingTop="@dimen/standard_padding"
150+
android:paddingBottom="@dimen/standard_padding"
151+
android:paddingStart="@dimen/standard_half_padding"
152+
android:paddingEnd="@dimen/standard_half_padding"
153+
android:text="@string/share_no_public_links"
154+
android:textSize="15sp"
155+
android:visibility="gone"/>
156+
157+
</LinearLayout>
138158

139159
</LinearLayout>
140160

0 commit comments

Comments
 (0)